#include <cgate.h>

cGate object are created and managed by modules; the user typically does not want to directly create or destroy cGate objects. However, they are important if a simple module algorithm needs to know about its surroundings.
Information about the gate. | |
| const char * | getBaseName () const |
| cProperties * | getProperties () const |
| Type | getType () const |
| cModule * | getOwnerModule () const |
| int | getId () const |
| bool | isVector () const |
| int | getIndex () const |
| int | getVectorSize () const |
| int | size () const |
| cChannel * | getChannel () const |
| void | setDeliverOnReceptionStart (bool d) |
| bool | getDeliverOnReceptionStart () const |
| static const char * | getTypeName (Type t) |
Public Types | |
| enum | Type |
Public Member Functions | |
| virtual bool | deliver (cMessage *msg, simtime_t at) |
Redefined cObject member functions | |
| virtual const char * | getName () const |
| virtual const char * | getFullName () const |
| virtual void | forEachChild (cVisitor *v) |
| virtual std::string | info () const |
| virtual cObject * | getOwner () const |
Connecting the gate. | |
| cChannel * | connectTo (cGate *gate, cChannel *channel=NULL, bool leaveUninitialized=false) |
| void | disconnect () |
| cChannel * | reconnectWith (cChannel *channel, bool leaveUninitialized=false) |
| _OPPDEPRECATED void | setChannel (cChannel *channel) |
Transmission state. | |
| cChannel * | getTransmissionChannel () const |
| bool | isBusy () const |
| simtime_t | getTransmissionFinishTime () const |
Gate connectivity. | |
| cGate * | getPreviousGate () const |
| cGate * | getNextGate () const |
| cGate * | getPathStartGate () const |
| cGate * | getPathEndGate () const |
| bool | pathContains (cModule *module, int gateId=-1) |
| bool | isConnectedOutside () const |
| bool | isConnectedInside () const |
| bool | isConnected () const |
| bool | isPathOK () const |
Display string. | |
| cDisplayString & | getDisplayString () |
| void | setDisplayString (const char *dispstr) |
Friends | |
| class | cModule |
| enum cGate::Type |
Gate type.
| virtual const char* cGate::getName | ( | ) | const [virtual] |
| virtual const char* cGate::getFullName | ( | ) | const [virtual] |
| virtual void cGate::forEachChild | ( | cVisitor * | v | ) | [virtual] |
| virtual std::string cGate::info | ( | ) | const [virtual] |
| virtual cObject* cGate::getOwner | ( | ) | const [virtual] |
| virtual bool cGate::deliver | ( | cMessage * | msg, | |
| simtime_t | at | |||
| ) | [virtual] |
This function is called internally by the send() functions and channel classes' deliver() to deliver the message to its destination.
A false return value means that the message object should be deleted by the caller. (This is used e.g. with parallel simulation, for messages leaving the partition.)
| cChannel* cGate::connectTo | ( | cGate * | gate, | |
| cChannel * | channel = NULL, |
|||
| bool | leaveUninitialized = false | |||
| ) |
Connects the gate to another gate, using the given channel object (if one is specified).
This method can be used to manually create connections for dynamically created modules.
This method invokes callInitialize() on the channel object, unless the compound module containing this connection is not yet initialized (then it assumes that this channel will be initialized as part of the compound module initialization process.) To leave the channel uninitialized, specify true for the leaveUninitialized parameter.
If the gate is already connected, an error will occur. The gate argument cannot be NULL, that is, you cannot use this function to disconnect a gate; use disconnect() for that.
Note: When you set channel parameters are after channel initialization, make sure the channel class is implemented so that the changes take effect; i.e. the channel should either override and properly handle handleParameterChange(), or should not cache any values from parameters.
| void cGate::disconnect | ( | ) |
Disconnects the gate, and also deletes the associated channel object if one has been set.
disconnect() must be invoked on the source gate ("from" side) of the connection.
The method has no effect if the gate is not connected.
Disconnects the gate, then connects it again to the same gate, with the given channel object (if not NULL).
The gate must be connected.
| _OPPDEPRECATED void cGate::setChannel | ( | cChannel * | channel | ) | [inline] |
DEPRECATED: Use reconnectWith() instead.
| const char* cGate::getBaseName | ( | ) | const |
Returns the gate name without index and potential "$i"/"$o" suffix.
| cProperties* cGate::getProperties | ( | ) | const |
Returns the properties for this gate.
Properties cannot be changed at runtime.
| Type cGate::getType | ( | ) | const [inline] |
Returns the gate's type, cGate::INPUT or cGate::OUTPUT.
(It never returns cGate::INOUT, because a cGate object is always either the input or the output half of an inout gate ("name$i" or "name$o").
| static const char* cGate::getTypeName | ( | Type | t | ) | [static] |
Returns the given type as a string.
| cModule* cGate::getOwnerModule | ( | ) | const |
Returns a pointer to the owner module of the gate.
| int cGate::getId | ( | ) | const |
Returns the gate ID, which uniquely identifies the gate within the module.
IDs are guaranteed to be contiguous within a gate vector: module->gate(id+index) == module->gate(id)+index.
Gate IDs are stable: they are guaranteed not to change during simulation. (This is a new feature of OMNeT++ 4.0. In earlier releases, gate IDs could change when the containing gate vector was resized.)
Note: As of OMNeT++ 4.0, gate IDs are no longer small integers, and cannot be used for iterating over the gates of a module. Use cModule::GateIterator for iteration.
| bool cGate::isVector | ( | ) | const [inline] |
Returns true if the gate is part of a gate vector.
| int cGate::getIndex | ( | ) | const [inline] |
If the gate is part of a gate vector, returns the gate's index in the vector.
Otherwise, it returns 0.
| int cGate::getVectorSize | ( | ) | const [inline] |
If the gate is part of a gate vector, returns the size of the vector.
For non-vector gates it returns 1.
The gate vector size can also be obtained by calling the cModule::gateSize().
| int cGate::size | ( | ) | const [inline] |
Alias for getVectorSize().
| cChannel* cGate::getChannel | ( | ) | const [inline] |
Returns the channel object attached to this gate, or NULL if there's no channel.
This is the channel between this gate and this->getNextGate(), that is, channels are stored on the "from" side of the connections.
| void cGate::setDeliverOnReceptionStart | ( | bool | d | ) |
This method may only be invoked on input gates of simple modules.
Messages with nonzero length then have a nonzero transmission duration (and thus, reception duration on the other side of the connection). By default, the delivery of the message to the module marks the end of the reception. Setting this bit will cause the channel to deliver the message to the module at the start of the reception. The duration that the reception will take can be extracted from the message object, by its getDuration() method.
| bool cGate::getDeliverOnReceptionStart | ( | ) | const [inline] |
Returns whether messages delivered through this gate will mark the start or the end of the reception process (assuming nonzero message length and data rate on the channel.
)
| cChannel* cGate::getTransmissionChannel | ( | ) | const |
Usually invoked on an output gate, this method returns the channel in the connection path that supports datarate (as determined by cChannel::isTransmissionChannel(); it is guaranteed that there can be at most one such channel per path).
If there is no suh channel, an error is thrown.
This method only checks the segment of the connection path that starts at this gate, so, for example, it is an error to invoke it on a simple module input gate.
Note: this method searches the connection path linearly, so at performance-critical places it may be better to cache its return value (provided that connections are not removed or created dynamically during simulation.)
| bool cGate::isBusy | ( | ) | const |
Usually only meaningful on an output gate, this method returns whether the datarate channel in the connection path starting at this gate is currently transmitting.
If there is no datarate channel in the path, this method throws an error.
It is equivalent to getTransmissionChannel()->isBusy().
| simtime_t cGate::getTransmissionFinishTime | ( | ) | const |
Usually only meaningful on an output gate, this method returns when the datarate channel in the connection path starting at this gate will finish transmitting.
If there is no datarate channel in the path, this method throws an error.
It is equivalent to getTransmissionChannel()->getTransmissionFinishTime().
| cGate* cGate::getPreviousGate | ( | ) | const [inline] |
Returns the previous gate in the series of connections (the path) that contains this gate, or a NULL pointer if this gate is the first one in the path.
(E.g. for a simple module output gate, this function will return NULL.)
| cGate* cGate::getNextGate | ( | ) | const [inline] |
Returns the next gate in the series of connections (the path) that contains this gate, or a NULL pointer if this gate is the last one in the path.
(E.g. for a simple module input gate, this function will return NULL.)
| cGate* cGate::getPathStartGate | ( | ) | const |
Return the ultimate source of the series of connections (the path) that contains this gate.
| cGate* cGate::getPathEndGate | ( | ) | const |
Return the ultimate destination of the series of connections (the path) that contains this gate.
| bool cGate::pathContains | ( | cModule * | module, | |
| int | gateId = -1 | |||
| ) |
Determines if a given module is in the path containing this gate.
| bool cGate::isConnectedOutside | ( | ) | const |
Returns true if the gate is connected outside (i.e.
to one of its sibling modules or to the parent module).
This means that for an input gate, getPreviousGate() must be non-NULL; for an output gate, getNextGate() must be non-NULL.
| bool cGate::isConnectedInside | ( | ) | const |
Returns true if the gate (of a compound module) is connected inside (i.e.
to one of its submodules).
This means that for an input gate, getNextGate() must be non-NULL; for an output gate, getPreviousGate() must be non-NULL.
| bool cGate::isConnected | ( | ) | const |
Returns true if the gate fully connected.
For a compound module gate this means both isConnectedInside() and isConnectedOutside() are true; for a simple module, only isConnectedOutside() is checked.
| bool cGate::isPathOK | ( | ) | const |
Returns true if the path (chain of connections) containing this gate starts and ends at a simple module.
| cDisplayString& cGate::getDisplayString | ( | ) |
Returns the display string for the gate, which controls the appearance of the connection arrow starting from gate.
The display string is stored in the channel associated with the connection. If there's no channel, this call creates an installs a cIdealChannel to hold the display string.
| void cGate::setDisplayString | ( | const char * | dispstr | ) |
Shortcut to getDisplayString().set(dispstr).
1.5.5