Phonon::Packet

Search for usage in LXR

#include <phonon/Packet>

Public Member Functions

 Packet ()
 
 Packet (const Packet &rhs)
 
 Packet (PacketPool &pool)
 
 ~Packet ()
 
int capacity () const
 
char * data ()
 
const char * data () const
 
bool isNull () const
 
bool operator!= (const Packet &rhs) const
 
Packetoperator= (const Packet &rhs)
 
bool operator== (const Packet &rhs) const
 
void setSize (int size)
 
int size () const
 

Protected Member Functions

 Packet (PacketPrivate &dd)
 

Protected Attributes

PacketPrivate * d_ptr
 

Detailed Description

Class to access memory preallocated by PacketPool.

Note
PacketPool and Packet are threadsafe.
Author
Matthias Kretz kretz.nosp@m.@kde.nosp@m..org

Definition at line 38 of file packet.h.

Constructor & Destructor Documentation

◆ Packet() [1/4]

Phonon::Packet::Packet ( )

Constructs a null packet.

See also
isNull

Definition at line 30 of file packet.cpp.

◆ Packet() [2/4]

Phonon::Packet::Packet ( PacketPool & pool)
explicit

Returns a packet with a capacity of pool.packetSize if there is still free data in the PacketPool.

Returns a null packet otherwise. The size will initially be set to 0.

Definition at line 31 of file packet.cpp.

◆ Packet() [3/4]

Phonon::Packet::Packet ( const Packet & rhs)

Returns a shared copy of the object.

Note that Packet will not detach (and it can not detach as there's a fixed amount of memory preallocated. If you want to copy the actual memory data you have to request another packet from the pool and copy the memory yourself.)

Definition at line 32 of file packet.cpp.

◆ ~Packet()

Phonon::Packet::~Packet ( )

Dereferences the packet data.

If this is the last reference that gets released the packet becomes available in the PacketPool again automatically.

Definition at line 44 of file packet.cpp.

◆ Packet() [4/4]

Phonon::Packet::Packet ( PacketPrivate & dd)
explicitprotected

Definition at line 33 of file packet.cpp.

Member Function Documentation

◆ capacity()

int Phonon::Packet::capacity ( ) const

Returns the number of bytes that may be accessed.

Definition at line 58 of file packet.cpp.

◆ data() [1/2]

char * Phonon::Packet::data ( )

Returns a pointer to read and write the data this packet references.

You may read size() bytes. You may write capacity() bytes. If you write to this pointer do not forget to adjust the size by calling setSize().

Definition at line 55 of file packet.cpp.

◆ data() [2/2]

const char * Phonon::Packet::data ( ) const

Returns a pointer to read the data this packet references.

You may read size() bytes.

Definition at line 54 of file packet.cpp.

◆ isNull()

bool Phonon::Packet::isNull ( ) const

Returns whether this object is a null packet.

See also
Packet()

Definition at line 53 of file packet.cpp.

◆ operator!=()

bool Phonon::Packet::operator!= ( const Packet & rhs) const

Returns whether the packets reference different data.

Definition at line 52 of file packet.cpp.

◆ operator=()

Packet & Phonon::Packet::operator= ( const Packet & rhs)

Assigns a shared copy of the object.

Note that Packet will not detach (and it can not detach as there's a fixed amount of memory preallocated. If you want to copy the actual memory data you have to request another packet from the pool and copy the memory yourself.)

Definition at line 34 of file packet.cpp.

◆ operator==()

bool Phonon::Packet::operator== ( const Packet & rhs) const

Returns whether the packets reference the same data.

Definition at line 51 of file packet.cpp.

◆ setSize()

void Phonon::Packet::setSize ( int size)

Sets how many bytes in the data pointer have a defined value.

Definition at line 57 of file packet.cpp.

◆ size()

int Phonon::Packet::size ( ) const

Returns the number of bytes that have a defined value.

Definition at line 56 of file packet.cpp.

Member Data Documentation

◆ d_ptr

PacketPrivate* Phonon::Packet::d_ptr
protected

Definition at line 125 of file packet.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:01:16 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.