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_t 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 str () 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_t getSsrc () const
 Returns the ssrc identifier this SdesChunk is for. More...
 
virtual void setSsrc (uint32_t 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_t _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

◆ SdesChunk() [1/2]

inet::rtp::SdesChunk::SdesChunk ( const char *  name = nullptr,
uint32_t  ssrc = 0 
)

Default constructor.

113  : cArray(name)
114 {
115  _ssrc = ssrc;
116  _length = 4;
117 }

Referenced by dup().

◆ SdesChunk() [2/2]

inet::rtp::SdesChunk::SdesChunk ( const SdesChunk sdesChunk)

Copy constructor.

119  : cArray(sdesChunk)
120 {
121  copy(sdesChunk);
122 }

◆ ~SdesChunk()

inet::rtp::SdesChunk::~SdesChunk ( )
virtual

Destructor.

125 {
126 }

Member Function Documentation

◆ addSDESItem()

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.

167 {
168  for (int i = 0; i < size(); i++) {
169  if (exist(i)) {
170  SdesItem *compareItem = check_and_cast<SdesItem *>(get(i));
171  if (compareItem->getType() == sdesItem->getType()) {
172  remove(compareItem);
173  _length = _length - compareItem->getSdesTotalLength();
174  delete compareItem;
175  }
176  }
177  }
178 
179 // sdesItem->setOwner(this);
180  add(sdesItem);
181  _length += sdesItem->getSdesTotalLength();
182 }

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

◆ copy()

void inet::rtp::SdesChunk::copy ( const SdesChunk other)
inlineprivate
138 {
139  _ssrc = sdesChunk._ssrc;
140  _length = sdesChunk._length;
141 }

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

◆ dump()

void inet::rtp::SdesChunk::dump ( std::ostream &  os) const
virtual

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

156 {
157  os << "SdesChunk:" << endl;
158  os << " ssrc = " << _ssrc << endl;
159  for (int i = 0; i < size(); i++) {
160  if (exist(i)) {
161  ((const SdesItem *)(get(i)))->dump(os);
162  }
163  }
164 }

◆ dup()

SdesChunk * inet::rtp::SdesChunk::dup ( ) const
overridevirtual

Duplicates this SdesChunk by calling the copy constructor.

144 {
145  return new SdesChunk(*this);
146 }

◆ getLength()

int inet::rtp::SdesChunk::getLength ( ) const
virtual

Returns the length in bytes of this SdesChunk.

195 {
196  return _length;
197 }

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

◆ getSsrc()

uint32_t inet::rtp::SdesChunk::getSsrc ( ) const
virtual

Returns the ssrc identifier this SdesChunk is for.

185 {
186  return _ssrc;
187 }

Referenced by inet::rtp::RtpParticipantInfo::getSsrc(), and inet::rtp::Rtcp::processIncomingRTCPSDESPacket().

◆ operator=()

SdesChunk & inet::rtp::SdesChunk::operator= ( const SdesChunk sdesChunk)

Operator equal.

129 {
130  if (this == &sdesChunk)
131  return *this;
132  cArray::operator=(sdesChunk);
133  copy(sdesChunk);
134  return *this;
135 }

◆ setSsrc()

void inet::rtp::SdesChunk::setSsrc ( uint32_t  ssrc)
virtual

Sets the ssrc identifier this SdesChunk is for.

190 {
191  _ssrc = ssrc;
192 }

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

◆ str()

std::string inet::rtp::SdesChunk::str ( ) const
overridevirtual

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

149 {
150  std::stringstream out;
151  out << "SdesChunk.ssrc=" << _ssrc << " items=" << size();
152  return out.str();
153 }

Member Data Documentation

◆ _length

int inet::rtp::SdesChunk::_length
protected

The length in bytes of this SdesChunk.

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

◆ _ssrc

uint32_t inet::rtp::SdesChunk::_ssrc
protected

The ssrc identifier this SdesChunk is for.

Referenced by copy(), dump(), getSsrc(), SdesChunk(), setSsrc(), and str().


The documentation for this class was generated from the following files:
inet::rtp::SdesChunk::_length
int _length
The length in bytes of this SdesChunk.
Definition: Sdes.h:198
inet::remove
void remove(std::vector< T > &v, const Tk &a)
Definition: stlutils.h:107
inet::rtp::SdesChunk::copy
void copy(const SdesChunk &other)
Definition: Sdes.cc:137
inet::rtp::SdesChunk::_ssrc
uint32_t _ssrc
The ssrc identifier this SdesChunk is for.
Definition: Sdes.h:193
inet::rtp::SdesChunk::SdesChunk
SdesChunk(const char *name=nullptr, uint32_t ssrc=0)
Default constructor.
Definition: Sdes.cc:113