openDAQ
Open data acquisition platform
IConnection Struct Referenceabstract

Represents a connection between an Input port and Signal. Acts as a queue for packets sent by the signal, which can be read by the input port and the input port's owner. More...

+ Inheritance diagram for IConnection:
+ Collaboration diagram for IConnection:

Detailed Description

Represents a connection between an Input port and Signal. Acts as a queue for packets sent by the signal, which can be read by the input port and the input port's owner.

The Connection provides standard queue methods, allowing for packets to be put at the back of the queue, and popped from the front. Additionally, the front packet can be inspected via peek, and the number of queued packets can be obtained through getPacketCount.

The Connection has a reference to the connected Signal and Input port.

Public Member Functions

virtual ErrCode INTERFACE_FUNC enqueue (IPacket *packet)=0
 Places a packet at the back of the queue. More...
 
virtual ErrCode INTERFACE_FUNC enqueueOnThisThread (IPacket *packet)=0
 Places a packet at the back of the queue. More...
 
virtual ErrCode INTERFACE_FUNC dequeue (IPacket **packet)=0
 Removes the packet at the front of the queue and returns it. More...
 
virtual ErrCode INTERFACE_FUNC peek (IPacket **packet)=0
 Returns the packet at the front of the queue without removing it. More...
 
virtual ErrCode INTERFACE_FUNC getPacketCount (SizeT *packetCount)=0
 Gets the number of queued packets. More...
 
virtual ErrCode INTERFACE_FUNC getSignal (ISignal **signal)=0
 Gets the Signal that is sending packets through the Connection. More...
 
virtual ErrCode INTERFACE_FUNC getInputPort (IInputPort **inputPort)=0
 Gets the Input port to which packets are being sent. More...
 
virtual ErrCode INTERFACE_FUNC getAvailableSamples (SizeT *samples)=0
 Gets the number of samples available in the queued packets. The returned value ignores any Sample-Descriptor changes. More...
 
virtual ErrCode INTERFACE_FUNC getSamplesUntilNextDescriptor (SizeT *samples)=0
 Gets the number of same-type samples available in the queued packets. The returned value is up-to the next Sample-Descriptor-Changed packet if any. More...
 
virtual ErrCode INTERFACE_FUNC isRemote (Bool *remote)=0
 Returns true if the type of connection is remote. More...
 
virtual ErrCode INTERFACE_FUNC enqueueAndStealRef (IPacket *packet)=0
 Places a packet at the back of the queue. The reference of the packet is stolen. More...
 
virtual ErrCode INTERFACE_FUNC enqueueMultiple (IList *packets)=0
 Places multiple packets at the back of the queue. More...
 
virtual ErrCode INTERFACE_FUNC enqueueMultipleAndStealRef (IList *packets)=0
 Places multiple packets at the back of the queue. The references of the packets are stolen. More...
 
virtual ErrCode INTERFACE_FUNC dequeueAll (IList **packets)=0
 Removes all packets from the queue. More...
 
virtual ErrCode INTERFACE_FUNC getSamplesUntilNextEventPacket (SizeT *samples)=0
 Gets the number of samples available in the queued packets until the next event packet. The returned value is up-to the next Event packet if any. More...
 
virtual ErrCode INTERFACE_FUNC getSamplesUntilNextGapPacket (SizeT *samples)=0
 Gets the number of samples available in the queued packets until the next gap packet. The returned value is up-to the next Gap packet if any. More...
 
virtual ErrCode INTERFACE_FUNC hasEventPacket (Bool *hasEventPacket)=0
 Queries if the connection has an event packet. More...
 
virtual ErrCode INTERFACE_FUNC hasGapPacket (Bool *hasGapPacket)=0
 Queries if the connection has a gap packet. More...
 
- Public Member Functions inherited from IBaseObject
virtual ErrCode INTERFACE_FUNC borrowInterface (const IntfID &intfID, void **obj) const =0
 Returns another interface which is supported by the object without incrementing the reference count. More...
 
virtual ErrCode INTERFACE_FUNC dispose ()=0
 Disposes all references held by the object. More...
 
virtual ErrCode INTERFACE_FUNC getHashCode (SizeT *hashCode)=0
 Returns hash code of the object. More...
 
virtual ErrCode INTERFACE_FUNC equals (IBaseObject *other, Bool *equal) const =0
 Compares object to another object for equality. More...
 
virtual ErrCode INTERFACE_FUNC toString (CharPtr *str)=0
 Returns a string representation of the object. More...
 
- Public Member Functions inherited from IUnknown
virtual ErrCode INTERFACE_FUNC queryInterface (const IntfID &intfID, void **obj)=0
 Returns another interface which is supported by the object and increments the reference count. More...
 
virtual int INTERFACE_FUNC addRef ()=0
 Increments the reference count for an interface on an object. More...
 
virtual int INTERFACE_FUNC releaseRef ()=0
 Decrements the reference count for an interface on an object. More...
 

Member Function Documentation

◆ dequeue()

virtual ErrCode INTERFACE_FUNC dequeue ( IPacket **  packet)
pure virtual

Removes the packet at the front of the queue and returns it.

Parameters
[out]packetThe removed packet or nullptr if the connection has no packets.
Return values
OPENDAQ_NO_MORE_ITEMSWhen the connection does not hold any packets.

◆ dequeueAll()

virtual ErrCode INTERFACE_FUNC dequeueAll ( IList **  packets)
pure virtual

Removes all packets from the queue.

Parameters
[out]packetsThe removed packets.

Removing all packets can be more efficient than dequeuing packet by packet in heavily loaded systems.

◆ enqueue()

virtual ErrCode INTERFACE_FUNC enqueue ( IPacket packet)
pure virtual

Places a packet at the back of the queue.

Parameters
packetThe packet to be enqueued.

◆ enqueueAndStealRef()

virtual ErrCode INTERFACE_FUNC enqueueAndStealRef ( IPacket packet)
pure virtual

Places a packet at the back of the queue. The reference of the packet is stolen.

Parameters
packetThe packet to be enqueued.

After calling the method, the packet should not be touched again. The ownership of the packet is taken by underlying connections and it could be destroyed before the function returns.

◆ enqueueMultiple()

virtual ErrCode INTERFACE_FUNC enqueueMultiple ( IList packets)
pure virtual

Places multiple packets at the back of the queue.

Parameters
packetsThe packets to be enqueued.

◆ enqueueMultipleAndStealRef()

virtual ErrCode INTERFACE_FUNC enqueueMultipleAndStealRef ( IList packets)
pure virtual

Places multiple packets at the back of the queue. The references of the packets are stolen.

Parameters
packetsThe packets to be enqueued.

After calling the method, the packets should not be touched again. The ownership of the packets is taken by underlying connections and it could be destroyed before the function returns.

◆ enqueueOnThisThread()

virtual ErrCode INTERFACE_FUNC enqueueOnThisThread ( IPacket packet)
pure virtual

Places a packet at the back of the queue.

Parameters
packetThe packet to be enqueued.

The connection notifies the listener on the same thread that this method was called.

◆ getAvailableSamples()

virtual ErrCode INTERFACE_FUNC getAvailableSamples ( SizeT *  samples)
pure virtual

Gets the number of samples available in the queued packets. The returned value ignores any Sample-Descriptor changes.

Parameters
[out]samplesThe total amount of samples currently available in the stored packets.

◆ getInputPort()

virtual ErrCode INTERFACE_FUNC getInputPort ( IInputPort **  inputPort)
pure virtual

Gets the Input port to which packets are being sent.

Parameters
[out]inputPortThe input port.

◆ getPacketCount()

virtual ErrCode INTERFACE_FUNC getPacketCount ( SizeT *  packetCount)
pure virtual

Gets the number of queued packets.

Parameters
[out]packetCountThe number of queued packets.

◆ getSamplesUntilNextDescriptor()

virtual ErrCode INTERFACE_FUNC getSamplesUntilNextDescriptor ( SizeT *  samples)
pure virtual

Gets the number of same-type samples available in the queued packets. The returned value is up-to the next Sample-Descriptor-Changed packet if any.

Parameters
[out]samplesThe total amount of same-type samples currently available in the stored packets.

◆ getSamplesUntilNextEventPacket()

virtual ErrCode INTERFACE_FUNC getSamplesUntilNextEventPacket ( SizeT *  samples)
pure virtual

Gets the number of samples available in the queued packets until the next event packet. The returned value is up-to the next Event packet if any.

Parameters
[out]samplesThe total amount of samples currently available in the stored packets until the next event packet.

◆ getSamplesUntilNextGapPacket()

virtual ErrCode INTERFACE_FUNC getSamplesUntilNextGapPacket ( SizeT *  samples)
pure virtual

Gets the number of samples available in the queued packets until the next gap packet. The returned value is up-to the next Gap packet if any.

Parameters
[out]samplesThe total amount of samples currently available in the stored packets until the next gap packet.

◆ getSignal()

virtual ErrCode INTERFACE_FUNC getSignal ( ISignal **  signal)
pure virtual

Gets the Signal that is sending packets through the Connection.

Parameters
[out]signalThe Signal.

◆ hasEventPacket()

virtual ErrCode INTERFACE_FUNC hasEventPacket ( Bool *  hasEventPacket)
pure virtual

Queries if the connection has an event packet.

Parameters
[out]hasEventPacketTrue if the connection has an event packet.

◆ hasGapPacket()

virtual ErrCode INTERFACE_FUNC hasGapPacket ( Bool *  hasGapPacket)
pure virtual

Queries if the connection has a gap packet.

Parameters
[out]hasGapPacketTrue if the connection has a gap packet.

◆ isRemote()

virtual ErrCode INTERFACE_FUNC isRemote ( Bool *  remote)
pure virtual

Returns true if the type of connection is remote.

Parameters
[out]remoteTrue if connection is remote.

Remote connections do not pass any packets. They represent the connection between input ports and signals on remote devices.

◆ peek()

virtual ErrCode INTERFACE_FUNC peek ( IPacket **  packet)
pure virtual

Returns the packet at the front of the queue without removing it.

Parameters
[out]packetThe packet at the front of the queue or nullptr if the connection has no packets.
Return values
OPENDAQ_NO_MORE_ITEMSWhen the connection does not hold any packets.