INET Framework for OMNeT++/OMNEST
inet::physicallayer::Signal Class Reference

#include <Signal.h>

Inheritance diagram for inet::physicallayer::Signal:
inet::IPrintableObject inet::physicallayer::EthernetSignalBase inet::physicallayer::WirelessSignal inet::physicallayer::EthernetFilledIfgSignal inet::physicallayer::EthernetJamSignal inet::physicallayer::EthernetSignal

Public Member Functions

 Signal (const char *name=nullptr, short kind=0, int64_t bitLength=0)
 
 Signal (const Signal &other)
 
virtual Signaldup () const override
 
virtual const char * getFullName () const override
 
virtual std::ostream & printToStream (std::ostream &stream, int level, int evFlags=0) const override
 Prints this object to the provided output stream. More...
 
virtual std::string str () const override
 
- 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
 

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

◆ Signal() [1/2]

inet::physicallayer::Signal::Signal ( const char *  name = nullptr,
short  kind = 0,
int64_t  bitLength = 0 
)
explicit
20  :
21  cPacket(name, kind, bitLength)
22 {
23 }

◆ Signal() [2/2]

inet::physicallayer::Signal::Signal ( const Signal other)
25  :
26  cPacket(other)
27 {
28 }

Member Function Documentation

◆ dup()

◆ getFullName()

const char * inet::physicallayer::Signal::getFullName ( ) const
overridevirtual
31 {
32  if (!isUpdate())
33  return getName();
34  else {
35  const char *suffix;
36  if (getRemainingDuration().isZero())
37  suffix = ":end";
38  else if (getRemainingDuration() == getDuration())
39  suffix = ":start";
40  else
41  suffix = ":progress";
42  static std::set<std::string> pool;
43  std::string fullname = std::string(getName()) + suffix;
44  auto it = pool.insert(fullname).first;
45  return it->c_str();
46  }
47 }

◆ printToStream()

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

Prints this object to the provided output stream.

Reimplemented from inet::IPrintableObject.

Reimplemented in inet::physicallayer::WirelessSignal.

50 {
51  std::string className = getClassName();
52  auto index = className.rfind("::");
53  if (index != std::string::npos)
54  className = className.substr(index + 2);
55  if (level <= PRINT_LEVEL_DETAIL)
56  stream << EV_FAINT << "(" << className << ")" << EV_NORMAL;
57  stream << EV_ITALIC << getName() << EV_NORMAL << " (" << simsec(getDuration()) << " " << b(getBitLength()) << ")";
58  auto packet = check_and_cast<Packet *>(getEncapsulatedPacket());
59  packet->printToStream(stream, level + 1, evFlags);
60  return stream;
61 }

◆ str()

std::string inet::physicallayer::Signal::str ( ) const
overridevirtual
64 {
65  std::stringstream stream;
66  stream << "(" << simsec(getDuration()) << " " << b(getBitLength()) << ")";
67  if (auto packet = getEncapsulatedPacket())
68  stream << " " << packet;
69  return stream.str();
70 }

The documentation for this class was generated from the following files:
inet::physicallayer::Signal::Signal
Signal(const char *name=nullptr, short kind=0, int64_t bitLength=0)
Definition: Signal.cc:20
inet::units::values::simsec
value< simtime_t, units::s > simsec
Definition: Units.h:1236
inet::IPrintableObject::PRINT_LEVEL_DETAIL
@ PRINT_LEVEL_DETAIL
Definition: IPrintableObject.h:24
EV_FAINT
#define EV_FAINT
Definition: INETDefs.h:104
kind
removed DscpReq kind
Definition: IUdp-gates.txt:12
inet::units::values::b
value< int64_t, units::b > b
Definition: Units.h:1241
EV_ITALIC
#define EV_ITALIC
Definition: INETDefs.h:105
EV_NORMAL
#define EV_NORMAL
Definition: INETDefs.h:102
inet::evFlags
int evFlags
Definition: INETDefs.cc:12