YARP
Yet Another Robot Platform
yarp::os::impl::PortCorePackets Class Reference

A collection of messages being transmitted over connections. More...

#include <yarp/os/impl/PortCorePackets.h>

Public Member Functions

virtual ~PortCorePackets ()
 
size_t getCount ()
 
PortCorePacketgetFreePacket ()
 Get a packet that we can prepare for sending. More...
 
void freePacket (PortCorePacket *packet, bool clear=true)
 Force the given packet into an inactive state. More...
 
bool completePacket (PortCorePacket *packet)
 Send a completion notification if a packet has finished being sent on all connections. More...
 
bool checkPacket (PortCorePacket *packet)
 Move a packet to the inactive state if it has finished being sent on all connections. More...
 

Detailed Description

A collection of messages being transmitted over connections.

This tracks uses of the messages for memory management purposes. We call messages "packets" for no particular reason.

Definition at line 28 of file PortCorePackets.h.

Constructor & Destructor Documentation

◆ ~PortCorePackets()

PortCorePackets::~PortCorePackets ( )
virtual

Definition at line 21 of file PortCorePackets.cpp.

Member Function Documentation

◆ checkPacket()

bool PortCorePackets::checkPacket ( PortCorePacket packet)

Move a packet to the inactive state if it has finished being sent on all connections.

Parameters
packetthe packet to work on
Returns
true if the packet was made inactive

Definition at line 82 of file PortCorePackets.cpp.

◆ completePacket()

bool PortCorePackets::completePacket ( PortCorePacket packet)

Send a completion notification if a packet has finished being sent on all connections.

Parameters
packetthe packet to work on
Returns
true if the packet has finished being sent

Definition at line 71 of file PortCorePackets.cpp.

◆ freePacket()

void PortCorePackets::freePacket ( PortCorePacket packet,
bool  clear = true 
)

Force the given packet into an inactive state.

See checkPacket() for a less drastic way to nudge a packet onwards in its lifecycle.

Parameters
packetthe packet to work on
clearwhether to reset the contents of the packet

Definition at line 59 of file PortCorePackets.cpp.

◆ getCount()

size_t PortCorePackets::getCount ( )
Returns
the number of packets currently being sent.

Definition at line 33 of file PortCorePackets.cpp.

◆ getFreePacket()

PortCorePacket * PortCorePackets::getFreePacket ( )

Get a packet that we can prepare for sending.

If a previously sent packet that is not being used is available, we take that. Otherwise we create one.

Returns
an unused or freshly created packet

Definition at line 38 of file PortCorePackets.cpp.


The documentation for this class was generated from the following files: