openDAQ
Open data acquisition platform
Connection
+ Collaboration diagram for Connection:

Detailed Description

Modules

 Factories
 

Classes

struct  IConnection
 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...
 
class  ConnectionPtr
 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...
 

Functions

void enqueue (const daq::PacketPtr &packet) const
 Places a packet at the back of the queue. More...
 
void enqueueOnThisThread (const daq::PacketPtr &packet) const
 Places a packet at the back of the queue. More...
 
daq::PacketPtr dequeue () const
 Removes the packet at the front of the queue and returns it. More...
 
daq::PacketPtr peek () const
 Returns the packet at the front of the queue without removing it. More...
 
daq::SizeT getPacketCount () const
 Gets the number of queued packets. More...
 
daq::ObjectPtr< ISignalgetSignal () const
 Gets the Signal that is sending packets through the Connection. More...
 
daq::ObjectPtr< IInputPortgetInputPort () const
 Gets the Input port to which packets are being sent. More...
 
daq::SizeT getAvailableSamples () const
 Gets the number of samples available in the queued packets. The returned value ignores any Sample-Descriptor changes. More...
 
daq::SizeT getSamplesUntilNextDescriptor () const
 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...
 
daq::Bool isRemote () const
 Returns true if the type of connection is remote. More...
 
void enqueue (daq::PacketPtr &&packet) const
 Places a packet at the back of the queue. The reference of the packet is stolen. More...
 
void enqueueMultiple (const daq::ListPtr< daq::IPacket > &packets) const
 Places multiple packets at the back of the queue. More...
 
void enqueueMultiple (daq::ListPtr< daq::IPacket > &&packets) const
 Places multiple packets at the back of the queue. The references of the packets are stolen. More...
 
daq::ListPtr< daq::IPacket > dequeueAll () const
 Removes all packets from the queue. More...
 
daq::SizeT getSamplesUntilNextEventPacket () const
 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...
 
daq::SizeT getSamplesUntilNextGapPacket () const
 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...
 
daq::Bool hasEventPacket () const
 Queries if the connection has an event packet. More...
 
daq::Bool hasGapPacket () const
 Queries if the connection has a gap packet. More...
 

Function Documentation

◆ dequeue()

daq::PacketPtr dequeue ( ) const
inline

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

Returns
The removed packet or nullptr if the connection has no packets.
Return values
OPENDAQ_NO_MORE_ITEMSWhen the connection does not hold any packets.

◆ dequeueAll()

daq::ListPtr<daq::IPacket> dequeueAll ( ) const
inline

Removes all packets from the queue.

Returns
The removed packets.

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

◆ enqueue() [1/2]

void enqueue ( const daq::PacketPtr &  packet) const
inline

Places a packet at the back of the queue.

Parameters
packetThe packet to be enqueued.

◆ enqueue() [2/2]

void enqueue ( daq::PacketPtr &&  packet) const
inline

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() [1/2]

void enqueueMultiple ( const daq::ListPtr< daq::IPacket > &  packets) const
inline

Places multiple packets at the back of the queue.

Parameters
packetsThe packets to be enqueued.

◆ enqueueMultiple() [2/2]

void enqueueMultiple ( daq::ListPtr< daq::IPacket > &&  packets) const
inline

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()

void enqueueOnThisThread ( const daq::PacketPtr &  packet) const
inline

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()

daq::SizeT getAvailableSamples ( ) const
inline

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

Returns
The total amount of samples currently available in the stored packets.

◆ getInputPort()

daq::ObjectPtr<IInputPort> getInputPort ( ) const
inline

Gets the Input port to which packets are being sent.

Returns
The input port.

◆ getPacketCount()

daq::SizeT getPacketCount ( ) const
inline

Gets the number of queued packets.

Returns
The number of queued packets.

◆ getSamplesUntilNextDescriptor()

daq::SizeT getSamplesUntilNextDescriptor ( ) const
inline

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.

Returns
The total amount of same-type samples currently available in the stored packets.

◆ getSamplesUntilNextEventPacket()

daq::SizeT getSamplesUntilNextEventPacket ( ) const
inline

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.

Returns
The total amount of samples currently available in the stored packets until the next event packet.

◆ getSamplesUntilNextGapPacket()

daq::SizeT getSamplesUntilNextGapPacket ( ) const
inline

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.

Returns
The total amount of samples currently available in the stored packets until the next gap packet.

◆ getSignal()

daq::ObjectPtr<ISignal> getSignal ( ) const
inline

Gets the Signal that is sending packets through the Connection.

Returns
The Signal.

◆ hasEventPacket()

daq::Bool hasEventPacket ( ) const
inline

Queries if the connection has an event packet.

Returns
True if the connection has an event packet.

◆ hasGapPacket()

daq::Bool hasGapPacket ( ) const
inline

Queries if the connection has a gap packet.

Returns
True if the connection has a gap packet.

◆ isRemote()

daq::Bool isRemote ( ) const
inline

Returns true if the type of connection is remote.

Returns
True if connection is remote.

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

◆ peek()

daq::PacketPtr peek ( ) const
inline

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

Returns
The 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.