16 #ifndef __OMNETPP_CGATE_H    17 #define __OMNETPP_CGATE_H    22 #include "cstringpool.h"    23 #include "opp_string.h"    24 #include "simtime_t.h"    25 #include "cexception.h"    37 class cDatarateChannel;
    44 #define GATEID_LBITS  20    45 #define GATEID_HBITS  (8*sizeof(int)-GATEID_LBITS)   // default 12    46 #define GATEID_HMASK  ((~0U)<<GATEID_LBITS)          // default 0xFFF00000    47 #define GATEID_LMASK  (~GATEID_HMASK)                // default 0x000FFFFF    49 #define MAX_VECTORGATES  ((1<<(GATEID_HBITS-1))-2)   // default 2046    50 #define MAX_SCALARGATES  ((1<<(GATEID_LBITS-1))-2)   // default ~500000    51 #define MAX_VECTORGATESIZE ((1<<(GATEID_LBITS-1))-1) // default ~500000    66     friend class cModuleGates;
    67     friend class cPlaceholderModule;
    88         Name(
const char *name, 
Type type);
    89         bool operator<(
const Name& other) 
const;
   108         Desc() {owner=
nullptr; vectorSize=-1; name=
nullptr; input.gate=output.gate=
nullptr;}
   109         bool inUse()
 const {
return name!=
nullptr;}
   110         Type getType()
 const {
return name->type;}
   111         bool isVector()
 const {
return vectorSize>=0;}
   112         const char *nameFor(
Type t)
 const {
return (t==INOUT||name->type!=INOUT) ? name->name.c_str() : t==INPUT ? name->namei.c_str() : name->nameo.c_str();}
   113         int indexOf(
const cGate *g)
 const {
return (g->pos>>2)==-1 ? 0 : g->pos>>2;}
   114         bool deliverOnReceptionStart(
const cGate *g)
 const {
return g->pos&2;}
   115         Type getTypeOf(
const cGate *g)
 const {
return (g->pos&1)==0 ? INPUT : OUTPUT;}
   116         bool isInput(
const cGate *g)
 const {
return (g->pos&1)==0;}
   117         bool isOutput(
const cGate *g)
 const {
return (g->pos&1)==1;}
   118         int gateSize()
 const {
return vectorSize>=0 ? vectorSize : 1;}
   119         void setInputGate(
cGate *g) {ASSERT(getType()!=OUTPUT && !isVector()); input.gate=g; g->desc=
this; g->pos=(-(1<<2));}
   120         void setOutputGate(
cGate *g) {ASSERT(getType()!=INPUT && !isVector()); output.gate=g; g->desc=
this; g->pos=(-(1<<2))|1;}
   121         void setInputGate(
cGate *g, 
int index) {ASSERT(getType()!=OUTPUT && isVector()); input.gatev[index]=g; g->desc=
this; g->pos=(index<<2);}
   122         void setOutputGate(
cGate *g, 
int index) {ASSERT(getType()!=INPUT && isVector()); output.gatev[index]=g; g->desc=
this; g->pos=(index<<2)|1;}
   123         static int capacityFor(
int size) {
return size<8 ? (size+1)&~1 : size<32 ? (size+3)&~3 : size<256 ? (size+15)&~15 : (size+63)&~63;}
   136     static int lastConnectionId;
   146     static void clearFullnamePool();
   149     void installChannel(
cChannel *chan);
   152     void checkChannels() 
const;
   154 #ifdef SIMFRONTEND_SUPPORT   156     virtual bool hasChangedSince(int64_t lastRefreshSerial);
   165     virtual const char *getName() 
const override;
   172     virtual const char *getFullName() 
const override;
   178     virtual void forEachChild(
cVisitor *v) 
override;
   184     virtual std::string str() 
const override;
   189     virtual cObject *getOwner() 
const override; 
   248     const char *getBaseName() 
const;
   253     const char *getNameSuffix() 
const;
   271     static const char *getTypeName(
Type t);
   276     cModule *getOwnerModule() 
const;
   302     int getBaseId() 
const;
   321     int size()
 const  {
return getVectorSize();}
   340     void setDeliverOnReceptionStart(
bool d);
   372     cChannel *getTransmissionChannel() 
const;
   378     cChannel *findTransmissionChannel() 
const;
   388     cChannel *getIncomingTransmissionChannel() 
const;
   395     cChannel *findIncomingTransmissionChannel() 
const;
   428     cGate *getPathStartGate() 
const;
   434     cGate *getPathEndGate() 
const;
   439     bool pathContains(
cModule *module, 
int gateId=-1);
   448     bool isConnectedOutside() 
const;
   457     bool isConnectedInside() 
const;
   464     bool isConnected() 
const;
   470     bool isPathOK() 
const;
   486     void setDisplayString(
const char *dispstr);
 int getConnectionId() const 
Definition: cgate.h:422
 
Lightweight string class, used internally in some parts of OMNeT++. 
Definition: opp_string.h:39
 
The message class in OMNeT++. cMessage objects may represent events, messages, jobs or other entities...
Definition: cmessage.h:95
 
Represents a module gate. 
Definition: cgate.h:63
 
Root of the OMNeT++ class hierarchy. cObject is a lightweight class without any data members...
Definition: cobject.h:58
 
int64_t-based, base-10 fixed-point simulation time. 
Definition: simtime.h:66
 
int getIndex() const 
Definition: cgate.h:308
 
bool isVector() const 
Definition: cgate.h:296
 
cChannel * getChannel() const 
Definition: cgate.h:328
 
This class represents modules in the simulation. 
Definition: cmodule.h:47
 
cGate * getPreviousGate() const 
Definition: cgate.h:406
 
bool getDeliverOnReceptionStart() const 
Definition: cgate.h:349
 
Type getType() const 
Definition: cgate.h:266
 
Enables traversing the tree of (cObject-rooted) simulation objects. 
Definition: cvisitor.h:56
 
Utility class, to make it impossible to call the operator= and copy constructor of any class derived ...
Definition: cobject.h:311
 
cGate * getNextGate() const 
Definition: cgate.h:413
 
Definition: cabstracthistogram.h:21
 
A collection of properties (cProperty). 
Definition: cproperties.h:34
 
Represents a display string. 
Definition: cdisplaystring.h:58
 
Base class for channels. 
Definition: cchannel.h:34
 
int size() const 
Definition: cgate.h:321
 
Type
Definition: cgate.h:73
 
int getVectorSize() const 
Definition: cgate.h:316