INET Framework for OMNeT++/OMNEST
inet::Message Class Reference

#include <Message.h>

Inheritance diagram for inet::Message:
inet::IPrintableObject inet::ITaggedObject inet::Indication inet::Request

Public Member Functions

Tag related functions
virtual SharingTagSetgetTags () override
 Returns all tags. More...
 
int getNumTags () const
 Returns the number of message tags. More...
 
const Ptr< const TagBasegetTag (int index) const
 Returns the message tag at the given index. More...
 
void clearTags ()
 Clears the set of message tags. More...
 
void copyTags (const Message &source)
 Copies the set of message tags from the other message. More...
 
template<typename T >
const Ptr< const TfindTag () const
 Returns the message tag for the provided type or returns nullptr if no such message tag is found. More...
 
template<typename T >
const Ptr< TfindTagForUpdate ()
 Returns the message tag for the provided type or returns nullptr if no such message tag is found. More...
 
template<typename T >
const Ptr< const TgetTag () const
 Returns the message tag for the provided type or throws an exception if no such message tag is found. More...
 
template<typename T >
const Ptr< TgetTagForUpdate ()
 Returns the message tag for the provided type or throws an exception if no such message tag is found. More...
 
template<typename T >
const Ptr< TaddTag ()
 Returns a newly added message tag for the provided type, or throws an exception if such a message tag is already present. More...
 
template<typename T >
const Ptr< TaddTagIfAbsent ()
 Returns a newly added message tag for the provided type if absent, or returns the message tag that is already present. More...
 
template<typename T >
const Ptr< TremoveTag ()
 Removes the message tag for the provided type, or throws an exception if no such message tag is found. More...
 
template<typename T >
const Ptr< TremoveTagIfPresent ()
 Removes the message tag for the provided type if present, or returns nullptr if no such message tag is found. More...
 
Utility functions
virtual std::ostream & printToStream (std::ostream &stream, int level, int evFlags=0) const override
 Prints this object to the provided output stream. More...
 
- Public Member Functions inherited from inet::IPrintableObject
virtual ~IPrintableObject ()
 
virtual std::string printToString () const
 
virtual std::string printToString (int level, int evFlags=0) const
 
virtual std::string getInfoStringRepresentation (int evFlags=0) const
 
virtual std::string getDetailStringRepresentation (int evFlags=0) const
 
virtual std::string getDebugStringRepresentation (int evFlags=0) const
 
virtual std::string getTraceStringRepresentation (int evFlags=0) const
 
virtual std::string getCompleteStringRepresentation (int evFlags=0) const
 

Protected Attributes

SharingTagSet tags
 

Friends

class MessageDescriptor
 

Class descriptor functions

const TagBase_getTag (int index)
 
 Message (const char *name=nullptr, short kind=0)
 
 Message (const Message &other)
 
virtual Messagedup () const override
 

Additional Inherited Members

- Public Types inherited from inet::IPrintableObject
enum  PrintLevel {
  PRINT_LEVEL_TRACE, PRINT_LEVEL_DEBUG, PRINT_LEVEL_DETAIL, PRINT_LEVEL_INFO,
  PRINT_LEVEL_COMPLETE = INT_MIN
}
 
enum  PrintFlag { PRINT_FLAG_FORMATTED = (1 << 0), PRINT_FLAG_MULTILINE = (1 << 1) }
 

Constructor & Destructor Documentation

◆ Message() [1/2]

inet::Message::Message ( const char *  name = nullptr,
short  kind = 0 
)
explicit
14  :
15  cMessage(name, kind)
16 {
17 }

◆ Message() [2/2]

inet::Message::Message ( const Message other)
19  :
20  cMessage(other),
21  tags(other.tags)
22 {
23 }

Member Function Documentation

◆ _getTag()

const TagBase* inet::Message::_getTag ( int  index)
inlineprotected
27 { return tags.getTag(index).get(); }

◆ addTag()

template<typename T >
const Ptr<T> inet::Message::addTag ( )
inline

Returns a newly added message tag for the provided type, or throws an exception if such a message tag is already present.

102  {
103  return tags.addTag<T>();
104  }

Referenced by inet::SctpSocket::abort(), inet::SctpSocket::accept(), inet::SctpSocket::acceptSocket(), inet::SctpSocket::close(), inet::SctpSocket::connect(), inet::SctpSocket::destroy(), inet::sctp::SctpAssociation::generateSendQueueAbatedIndication(), inet::SctpSocket::getSocketOptions(), inet::NetPerfMeter::handleMessage(), inet::SctpNatServer::handleMessage(), inet::SctpServer::handleMessage(), inet::SctpPeer::handleMessage(), inet::SctpNatPeer::handleMessage(), inet::SctpNatServer::handleTimer(), inet::SctpServer::handleTimer(), inet::SctpPeer::handleTimer(), inet::SctpNatPeer::handleTimer(), inet::SctpSocket::listen(), inet::SctpServer::makeAbortNotification(), inet::SctpServer::makeDefaultReceive(), inet::sctp::SctpAssociation::pathStatusIndication(), inet::SctpSocket::requestStatus(), inet::sctp::SctpAssociation::sendAvailableIndicationToApp(), inet::sctp::SctpAssociation::sendDataArrivedNotification(), inet::sctp::SctpAssociation::sendEstabIndicationToApp(), inet::sctp::SctpAssociation::sendIndicationToApp(), inet::SctpNatServer::sendInfo(), inet::SctpClient::sendQueueRequest(), inet::SctpPeer::sendQueueRequest(), inet::SctpNatPeer::sendQueueRequest(), inet::NetPerfMeter::sendSCTPQueueRequest(), inet::SctpClient::sendStreamResetNotification(), inet::SctpClient::setPrimaryPath(), inet::SctpSocket::setRtoInfo(), inet::SctpSocket::setStreamPriority(), inet::SctpSocket::shutdown(), inet::SctpClient::shutdownReceivedArrived(), inet::SctpPeer::shutdownReceivedArrived(), inet::SctpNatPeer::shutdownReceivedArrived(), and inet::SctpNatPeer::socketEstablished().

◆ addTagIfAbsent()

template<typename T >
const Ptr<T> inet::Message::addTagIfAbsent ( )
inline

Returns a newly added message tag for the provided type if absent, or returns the message tag that is already present.

109  {
110  return tags.addTagIfAbsent<T>();
111  }

Referenced by inet::SctpServer::sendOrSchedule().

◆ clearTags()

void inet::Message::clearTags ( )
inline

Clears the set of message tags.

60  {
61  tags.clearTags();
62  }

◆ copyTags()

void inet::Message::copyTags ( const Message source)
inline

Copies the set of message tags from the other message.

67  {
68  tags.copyTags(source.tags);
69  }

◆ dup()

virtual Message* inet::Message::dup ( ) const
inlineoverridevirtual

Reimplemented in inet::Indication, and inet::Request.

34 { return new Message(*this); }

◆ findTag()

template<typename T >
const Ptr<const T> inet::Message::findTag ( ) const
inline

Returns the message tag for the provided type or returns nullptr if no such message tag is found.

74  {
75  return tags.findTag<T>();
76  }

Referenced by inet::MessageDispatcher::handleMessage(), inet::SctpServer::handleMessage(), and inet::SctpClient::socketDataNotificationArrived().

◆ findTagForUpdate()

template<typename T >
const Ptr<T> inet::Message::findTagForUpdate ( )
inline

Returns the message tag for the provided type or returns nullptr if no such message tag is found.

81  {
82  return tags.findTagForUpdate<T>();
83  }

◆ getNumTags()

int inet::Message::getNumTags ( ) const
inline

Returns the number of message tags.

46  {
47  return tags.getNumTags();
48  }

◆ getTag() [1/2]

template<typename T >
const Ptr<const T> inet::Message::getTag ( ) const
inline

Returns the message tag for the provided type or throws an exception if no such message tag is found.

88  {
89  return tags.getTag<T>();
90  }

◆ getTag() [2/2]

◆ getTagForUpdate()

template<typename T >
const Ptr<T> inet::Message::getTagForUpdate ( )
inline

Returns the message tag for the provided type or throws an exception if no such message tag is found.

95  {
96  return tags.getTagForUpdate<T>();
97  }

◆ getTags()

◆ printToStream()

std::ostream & inet::Message::printToStream ( std::ostream &  stream,
int  level,
int  evFlags = 0 
) const
overridevirtual

Prints this object to the provided output stream.

Reimplemented from inet::IPrintableObject.

26 {
27  std::string className = getClassName();
28  auto index = className.rfind("::");
29  if (index != std::string::npos)
30  className = className.substr(index + 2);
31  if (level <= PRINT_LEVEL_DETAIL)
32  stream << EV_FAINT << "(" << className << ")" << EV_NORMAL;
33  stream << EV_ITALIC << getName() << EV_NORMAL;
34  return stream;
35 }

◆ removeTag()

template<typename T >
const Ptr<T> inet::Message::removeTag ( )
inline

Removes the message tag for the provided type, or throws an exception if no such message tag is found.

116  {
117  return tags.removeTag<T>();
118  }

◆ removeTagIfPresent()

template<typename T >
const Ptr<T> inet::Message::removeTagIfPresent ( )
inline

Removes the message tag for the provided type if present, or returns nullptr if no such message tag is found.

123  {
124  return tags.removeTagIfPresent<T>();
125  }

Referenced by inet::EthernetEncapsulation::processCommandFromHigherLayer().

Friends And Related Function Documentation

◆ MessageDescriptor

friend class MessageDescriptor
friend

Member Data Documentation

◆ tags

SharingTagSet inet::Message::tags
protected

Referenced by copyTags().


The documentation for this class was generated from the following files:
inet::Message::Message
Message(const char *name=nullptr, short kind=0)
Definition: Message.cc:14
inet::units::units::T
compose< Wb, pow< m, -2 > > T
Definition: Units.h:951
inet::SharingTagSet::copyTags
void copyTags(const SharingTagSet &other)
Copies the set of tags from the other set.
Definition: SharingTagSet.h:191
inet::IPrintableObject::PRINT_LEVEL_DETAIL
@ PRINT_LEVEL_DETAIL
Definition: IPrintableObject.h:24
inet::SharingTagSet::findTag
const Ptr< const T > findTag() const
Returns the shared tag of the provided type, or returns nullptr if no such tag is present.
Definition: SharingTagSet.h:203
EV_FAINT
#define EV_FAINT
Definition: INETDefs.h:104
inet::SharingTagSet::removeTag
const Ptr< TagBase > removeTag(int index)
Definition: SharingTagSet.cc:35
inet::SharingTagSet::getTag
const Ptr< const TagBase > & getTag(int index) const
Returns the shared tag at the given index.
Definition: SharingTagSet.h:169
inet::Message::tags
SharingTagSet tags
Definition: Message.h:22
inet::SharingTagSet::removeTagIfPresent
const Ptr< T > removeTagIfPresent()
Removes the tag of the provided type if present and returns it for update, or returns nullptr if no s...
Definition: SharingTagSet.h:275
kind
removed DscpReq kind
Definition: IUdp-gates.txt:12
inet::SharingTagSet::getTagForUpdate
const Ptr< TagBase > getTagForUpdate(int index)
Returns the exclusively owned tag at the given index for update.
Definition: SharingTagSet.h:174
EV_ITALIC
#define EV_ITALIC
Definition: INETDefs.h:105
EV_NORMAL
#define EV_NORMAL
Definition: INETDefs.h:102
inet::SharingTagSet::addTag
void addTag(const Ptr< const TagBase > &tag)
Definition: SharingTagSet.cc:28
inet::SharingTagSet::addTagIfAbsent
const Ptr< T > addTagIfAbsent()
Returns a newly added exclusively owned tag of the provided type if absent, or returns the exclusivel...
Definition: SharingTagSet.h:251
inet::SharingTagSet::clearTags
void clearTags()
Clears the set of tags.
Definition: SharingTagSet.h:183
inet::SharingTagSet::getNumTags
int getNumTags() const
Returns the number of tags.
Definition: SharingTagSet.h:159
inet::SharingTagSet::findTagForUpdate
const Ptr< T > findTagForUpdate()
Returns the exclusively owned tag of the provided type for update, or returns nullptr if no such tag ...
Definition: SharingTagSet.h:211