RawPacket
#include <icy/packet.h>
class RawPacketDefined in src/base/include/icy/packet.h:182
- Inherits
IPacket- Subclassed by
MediaPacket,SocketPacket
RawPacket is the default data packet type which consists of an optionally managed char pointer and a size value.
List of all members
| Name | Kind | Owner |
|---|---|---|
RawPacket | function | Declared here |
RawPacket | function | Declared here |
RawPacket | function | Declared here |
~RawPacket | function | Declared here |
clone | function | Declared here |
copyData | function | Declared here |
read | function | Declared here |
write | function | Declared here |
data | function | Declared here |
size | function | Declared here |
className | function | Declared here |
ownsBuffer | function | Declared here |
_data | variable | Declared here |
_size | variable | Declared here |
_owned | variable | Declared here |
operator<< | friend | Inherited from IPacket |
opaque | variable | Inherited from IPacket |
info | variable | Inherited from IPacket |
flags | variable | Inherited from IPacket |
IPacket | function | Inherited from IPacket |
IPacket | function | Inherited from IPacket |
operator= | function | Inherited from IPacket |
clone | function | Inherited from IPacket |
~IPacket | function | Inherited from IPacket |
read | function | Inherited from IPacket |
write | function | Inherited from IPacket |
size | function | Inherited from IPacket |
hasData | function | Inherited from IPacket |
data | function | Inherited from IPacket |
constData | function | Inherited from IPacket |
className | function | Inherited from IPacket |
print | function | Inherited from IPacket |
Inherited from IPacket
| Kind | Name | Description |
|---|---|---|
friend | operator<< inline | Stream insertion operator; delegates to print(). |
variable | opaque | Optional type-safe context data. Use std::any_cast to retrieve. Lifetime of the stored value is tied to the packet's lifetime. |
variable | info | Optional extra information about the packet. |
variable | flags | Provides basic information about the packet. |
function | IPacket inline | |
function | IPacket inline | Copy constructor; clones the info object if present. |
function | operator= inline | Copy assignment; clones the info object if present. |
function | clone virtual const | Returns a heap-allocated deep copy of this packet. |
function | ~IPacket virtual | Defaulted destructor. |
function | read virtual | Read/parse to the packet from the given input buffer. The number of bytes read is returned. |
function | write virtual const | Copy/generate to the packet given output buffer. The number of bytes written can be obtained from the buffer. |
function | size virtual const inline | The size of the packet in bytes. |
function | hasData virtual const inline | Returns true if the packet has a non-null data pointer. |
function | data virtual const inline | The packet data pointer for buffered packets. |
function | constData virtual const inline | The const packet data pointer for buffered packets. |
function | className virtual const | Returns the class name of this packet type for logging and diagnostics. |
function | print virtual const inline | Prints a human-readable representation to the given stream. |
Public Methods
| Return | Name | Description |
|---|---|---|
RawPacket inline | Construct with borrowed (non-owning) buffer. | |
RawPacket inline | Construct with const data (copied, owning). | |
RawPacket inline | Copy constructor (always copies data). | |
~RawPacket virtual | Defaulted destructor. | |
std::unique_ptr< IPacket > | clone virtual const inline override | |
void | copyData virtual inline | Copies data into an internally owned buffer, replacing any prior content. |
ssize_t | read virtual inline override | Reads from the buffer by copying its contents into an owned buffer. |
void | write virtual const inline override | Appends the packet data to the given output buffer. |
char * | data virtual const inline override | |
size_t | size virtual const inline override | |
const char * | className virtual const inline override | Returns the class name of this packet type for logging and diagnostics. |
bool | ownsBuffer const inline |
RawPacket
inline
inline RawPacket(char * data = nullptr, size_t size = 0, unsigned flags = 0, std::unique_ptr< IPacketInfo > info = nullptr)Defined in src/base/include/icy/packet.h:186
Construct with borrowed (non-owning) buffer.
RawPacket
inline
inline RawPacket(const char * data, size_t size = 0, unsigned flags = 0, std::unique_ptr< IPacketInfo > info = nullptr)Defined in src/base/include/icy/packet.h:195
Construct with const data (copied, owning).
RawPacket
inline
inline RawPacket(const RawPacket & that)Defined in src/base/include/icy/packet.h:205
Copy constructor (always copies data).
~RawPacket
virtual
virtual ~RawPacket() = defaultDefined in src/base/include/icy/packet.h:213
Defaulted destructor.
clone
virtual const inline override
virtual inline std::unique_ptr< IPacket > clone() const overrideDefined in src/base/include/icy/packet.h:216
Returns
Owning pointer to a deep copy of this packet (always copies data).
Reimplements
Reimplemented by
SocketPacket::cloneMediaPacket::cloneVideoPacket::clonePlanarVideoPacket::cloneAudioPacket::clonePlanarAudioPacket::cloneVisionFramePacket::clone
copyData
virtual inline
virtual inline void copyData(const void * data, size_t size)Defined in src/base/include/icy/packet.h:224
Copies data into an internally owned buffer, replacing any prior content.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | const void * | Source data pointer. |
size | size_t | Number of bytes to copy. |
read
virtual inline override
virtual inline ssize_t read(const ConstBuffer & buf) overrideDefined in src/base/include/icy/packet.h:237
Reads from the buffer by copying its contents into an owned buffer.
Returns
Number of bytes consumed (equal to buf.size()).
Reimplements
Reimplemented by
Parameters
| Parameter | Type | Description |
|---|---|---|
buf | const ConstBuffer & | Input buffer to read from. |
write
virtual const inline override
virtual inline void write(Buffer & buf) const overrideDefined in src/base/include/icy/packet.h:245
Appends the packet data to the given output buffer.
Reimplements
Reimplemented by
Parameters
| Parameter | Type | Description |
|---|---|---|
buf | Buffer & | Buffer to write into. |
data
virtual const inline override
virtual inline char * data() const overrideDefined in src/base/include/icy/packet.h:251
Returns
Mutable pointer to the raw packet data, or nullptr if empty.
Reimplements
size
virtual const inline override
virtual inline size_t size() const overrideDefined in src/base/include/icy/packet.h:254
Returns
Size of the packet data in bytes.
Reimplements
className
virtual const inline override
virtual inline const char * className() const overrideDefined in src/base/include/icy/packet.h:256
Returns the class name of this packet type for logging and diagnostics.
Reimplements
Reimplemented by
SocketPacket::classNameMediaPacket::classNameVideoPacket::classNamePlanarVideoPacket::classNameAudioPacket::classNamePlanarAudioPacket::classNameVisionFramePacket::className
ownsBuffer
const inline
inline bool ownsBuffer() constDefined in src/base/include/icy/packet.h:259
Returns
True if this packet owns (manages) its data buffer.
Protected Attributes
_data
char * _dataDefined in src/base/include/icy/packet.h:262
_size
size_t _sizeDefined in src/base/include/icy/packet.h:263
_owned
std::unique_ptr< char[]> _owned