INET Framework for OMNeT++/OMNEST
inet::rtp::SDESChunk Class Reference

The class SDESChunk is used for storing SDESItem objects for one rtp end system. More...

#include <sdes.h>

Inheritance diagram for inet::rtp::SDESChunk:

Public Member Functions

 SDESChunk (const char *name=nullptr, uint32 ssrc=0)
 Default constructor. More...
 
 SDESChunk (const SDESChunk &sdesChunk)
 Copy constructor. More...
 
virtual ~SDESChunk ()
 Destructor. More...
 
SDESChunkoperator= (const SDESChunk &sdesChunk)
 Operator equal. More...
 
virtual SDESChunkdup () const override
 Duplicates this SDESChunk by calling the copy constructor. More...
 
virtual std::string info () const override
 Writes a short info about this SDESChunk into the given string. More...
 
virtual void dump (std::ostream &os) const
 Writes a longer info about this SDESChunk into the given stream. More...
 
virtual void addSDESItem (SDESItem *item)
 Adds an SDESItem to this SDESChunk. More...
 
virtual uint32 getSsrc () const
 Returns the ssrc identifier this SDESChunk is for. More...
 
virtual void setSsrc (uint32 ssrc)
 Sets the ssrc identifier this SDESChunk is for. More...
 
virtual int getLength () const
 Returns the length in bytes of this SDESChunk. More...
 

Protected Attributes

uint32 _ssrc
 The ssrc identifier this SDESChunk is for. More...
 
int _length
 The length in bytes of this SDESChunk. More...
 

Private Member Functions

void copy (const SDESChunk &other)
 

Detailed Description

The class SDESChunk is used for storing SDESItem objects for one rtp end system.

Constructor & Destructor Documentation

inet::rtp::SDESChunk::SDESChunk ( const char *  name = nullptr,
uint32  ssrc = 0 
)

Default constructor.

Referenced by dup().

117  : cArray(name)
118 {
119  _ssrc = ssrc;
120  _length = 4;
121 }
uint32 _ssrc
The ssrc identifier this SDESChunk is for.
Definition: sdes.h:198
int _length
The length in bytes of this SDESChunk.
Definition: sdes.h:203
inet::rtp::SDESChunk::SDESChunk ( const SDESChunk sdesChunk)

Copy constructor.

123  : cArray(sdesChunk)
124 {
125  copy(sdesChunk);
126 }
void copy(const SDESChunk &other)
Definition: sdes.cc:141
inet::rtp::SDESChunk::~SDESChunk ( )
virtual

Destructor.

129 {
130 }

Member Function Documentation

void inet::rtp::SDESChunk::addSDESItem ( SDESItem item)
virtual

Adds an SDESItem to this SDESChunk.

If there is already an SDESItem of the same type in this SDESChunk it is replaced by the new one.

Referenced by inet::rtp::RTPParticipantInfo::addSDESItem().

171 {
172  for (int i = 0; i < size(); i++) {
173  if (exist(i)) {
174  SDESItem *compareItem = (SDESItem *)(get(i));
175  if (compareItem->getType() == sdesItem->getType()) {
176  remove(compareItem);
177  _length = _length - compareItem->getLength();
178  delete compareItem;
179  }
180  }
181  }
182 
183  //sdesItem->setOwner(this);
184  add(sdesItem);
185  _length += sdesItem->getLength();
186 }
int _length
The length in bytes of this SDESChunk.
Definition: sdes.h:203
void inet::rtp::SDESChunk::copy ( const SDESChunk other)
inlineprivate

Referenced by operator=(), and SDESChunk().

142 {
143  _ssrc = sdesChunk._ssrc;
144  _length = sdesChunk._length;
145 }
uint32 _ssrc
The ssrc identifier this SDESChunk is for.
Definition: sdes.h:198
int _length
The length in bytes of this SDESChunk.
Definition: sdes.h:203
void inet::rtp::SDESChunk::dump ( std::ostream &  os) const
virtual

Writes a longer info about this SDESChunk into the given stream.

160 {
161  os << "SDESChunk:" << endl;
162  os << " ssrc = " << _ssrc << endl;
163  for (int i = 0; i < size(); i++) {
164  if (exist(i)) {
165  ((const SDESItem *)(get(i)))->dump(os);
166  }
167  }
168 }
uint32 _ssrc
The ssrc identifier this SDESChunk is for.
Definition: sdes.h:198
SDESChunk * inet::rtp::SDESChunk::dup ( ) const
overridevirtual

Duplicates this SDESChunk by calling the copy constructor.

148 {
149  return new SDESChunk(*this);
150 }
SDESChunk(const char *name=nullptr, uint32 ssrc=0)
Default constructor.
Definition: sdes.cc:117
int inet::rtp::SDESChunk::getLength ( ) const
virtual

Returns the length in bytes of this SDESChunk.

Referenced by inet::rtp::RTCPSDESPacket::addSDESChunk().

199 {
200  return _length;
201 }
int _length
The length in bytes of this SDESChunk.
Definition: sdes.h:203
uint32 inet::rtp::SDESChunk::getSsrc ( ) const
virtual

Returns the ssrc identifier this SDESChunk is for.

Referenced by inet::rtp::RTPParticipantInfo::getSsrc(), and inet::rtp::RTCP::processIncomingRTCPSDESPacket().

189 {
190  return _ssrc;
191 }
uint32 _ssrc
The ssrc identifier this SDESChunk is for.
Definition: sdes.h:198
std::string inet::rtp::SDESChunk::info ( ) const
overridevirtual

Writes a short info about this SDESChunk into the given string.

153 {
154  std::stringstream out;
155  out << "SDESChunk.ssrc=" << _ssrc << " items=" << size();
156  return out.str();
157 }
uint32 _ssrc
The ssrc identifier this SDESChunk is for.
Definition: sdes.h:198
SDESChunk & inet::rtp::SDESChunk::operator= ( const SDESChunk sdesChunk)

Operator equal.

133 {
134  if (this == &sdesChunk)
135  return *this;
136  cArray::operator=(sdesChunk);
137  copy(sdesChunk);
138  return *this;
139 }
void copy(const SDESChunk &other)
Definition: sdes.cc:141
void inet::rtp::SDESChunk::setSsrc ( uint32  ssrc)
virtual

Sets the ssrc identifier this SDESChunk is for.

Referenced by inet::rtp::RTPParticipantInfo::setSsrc().

194 {
195  _ssrc = ssrc;
196 }
uint32 _ssrc
The ssrc identifier this SDESChunk is for.
Definition: sdes.h:198

Member Data Documentation

int inet::rtp::SDESChunk::_length
protected

The length in bytes of this SDESChunk.

Referenced by addSDESItem(), copy(), getLength(), and SDESChunk().

uint32 inet::rtp::SDESChunk::_ssrc
protected

The ssrc identifier this SDESChunk is for.

Referenced by copy(), dump(), getSsrc(), info(), SDESChunk(), and setSsrc().


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