Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members  

cGate Class Reference

#include <cgate.h>

Inheritance diagram for cGate::

cObject List of all members.

Public Methods

void deliver (cMessage *msg)
Constructors, destructor, assignment.
 cGate (const cGate &gate)
 cGate (const char *name, char tp)
virtual ~cGate ()
cGate& operator= (const cGate &gate)
Redefined cObject member functions
virtual const char* className () const
virtual cObjectdup () const
virtual const char* inspectorFactoryName () const
virtual void forEach (ForeachFunc f)
virtual void info (char *buf)
virtual const char* fullName () const
virtual const char* fullPath () const
virtual const char* fullPath (char *buffer, int bufsize) const
virtual void writeContents (ostream &os)
Setting up the gate.
void setOwnerModule (cModule *m, int gid)
void setIndex (int sn, int vs)
Connecting the gate.
void setFrom (cGate *g)
void setTo (cGate *g)
Setting and getting link attributes.
void setLink (cLinkType *l)
void setDelay (cPar *p)
void setError (cPar *p)
void setDataRate (cPar *p)
cLinkTypelink () const
cPardelay () const
cParerror () const
cPardatarate () const
Information about the gate.
char type () const
cModuleownerModule () const
int id () const
bool isVector () const
int index () const
int size () const
Transmission state.
bool isBusy () const
simtime_t transmissionFinishes () const
Gate connectivity.
cGate* fromGate () const
cGate* toGate () const
cGate* sourceGate () const
cGate* destinationGate () const
int routeContains (cModule *m, int g=-1)
bool isConnected () const
bool isRouteOK () const
Display string.
void setDisplayString (const char *dispstr, bool immediate=true)
const char* displayString () const
void setDisplayStringNotify (void(*notify_func)(cGate *,bool, void *), void *data)

Detailed Description

Represents a module gate. 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.


Constructor & Destructor Documentation

cGate::cGate ( const cGate & gate )
 

Copy constructor.

cGate::cGate ( const char * name,
char tp ) [explicit]
 

Constructor.

cGate::~cGate ( ) [virtual]
 

Destructor.


Member Function Documentation

const char * cGate::className ( ) const [inline, virtual]
 

Returns pointer to a string containing the class name, "cGate".

Reimplemented from cObject.

cPar * cGate::datarate ( ) const [inline]
 

Return pointers to the delay, bit error rate and datarate parameters of the link. Links are one-directional; these parameters are only stored at their starting side.

cPar * cGate::delay ( ) const [inline]
 

Return pointers to the delay, bit error rate and datarate parameters of the link. Links are one-directional; these parameters are only stored at their starting side.

void cGate::deliver ( cMessage * msg )
 

This function is called internally by the send() functions to deliver the message to its destination.

cGate * cGate::destinationGate ( ) const
 

Return the ultimate source and destination of the series of connections (the route) that contains this gate.

const char * cGate::displayString ( ) const
 

Returns the display string for the gate, which in practice affects the apprearance of the connection for which this gate is the source.

cObject * cGate::dup ( ) const [inline, virtual]
 

Creates and returns an exact copy of this object. See cObject for more details.

Reimplemented from cObject.

cPar * cGate::error ( ) const [inline]
 

Return pointers to the delay, bit error rate and datarate parameters of the link. Links are one-directional; these parameters are only stored at their starting side.

void cGate::forEach ( ForeachFunc f ) [virtual]
 

Call the passed function for each contained object. See cObject for more details.

Reimplemented from cObject.

cGate * cGate::fromGate ( ) const [inline]
 

Returns the previous gate in the series of connections (the route) that contains this gate, or a NULL pointer if this gate is the first one in the route. (E.g. for a simple module output gate, this function will return NULL.)

const char * cGate::fullName ( ) const [virtual]
 

Returns the full name of the gate, which is name() plus the index in square brackets (e.g. "out[4]"). Redefined to add the index.

Reimplemented from cObject.

const char * cGate::fullPath ( char * buffer,
int bufsize ) const [virtual]
 

The original fullPath() method is redefined to hide the internal array (a cArray) used to store the gate objects.

Reimplemented from cObject.

const char * cGate::fullPath ( ) const [virtual]
 

Redefined. (Reason: a C++ rule that overloaded virtual methods must be redefined together.)

Reimplemented from cObject.

int cGate::id ( ) const [inline]
 

Returns gate ID, the position of the gate in the array of all gates of the module.

int cGate::index ( ) const [inline]
 

If the gate is part of a gate vector, returns the gate's index in the vector. Otherwise, it returns 0.

void cGate::info ( char * buf ) [virtual]
 

Produces a one-line description of object contents into the buffer passed as argument. See cObject for more details.

Reimplemented from cObject.

const char * cGate::inspectorFactoryName ( ) const [inline, virtual]
 

Returns the name of the inspector factory class associated with this class. See cObject for more details.

Reimplemented from cObject.

bool cGate::isBusy ( ) const
 

Returns whether the gate is currently transmitting.

bool cGate::isConnected ( ) const
 

Returns true if the gate is connected. A simple module output gate is connected if toGate() is not NULL, and a simple module input gate is connected if fromGate() is not NULL. For a compound module gate to be connected, it should be connected both from "inside" and "outside", that is, both fromGate() and toGate() should be non-NULL.

bool cGate::isRouteOK ( ) const
 

Returns true if the route that this gate is in is complete, that is, if it starts and arrives at a simple module.

bool cGate::isVector ( ) const [inline]
 

Returns true if the gate is part of a gate vector.

cLinkType * cGate::link ( ) const [inline]
 

Returns the link type of the gate, if it has one.

cGate & cGate::operator= ( const cGate & gate )
 

Assignment operator. The name member doesn't get copied; see cObject's operator=() for more details.

cModule * cGate::ownerModule ( ) const [inline]
 

Returns a pointer to the owner module of the gate.

int cGate::routeContains ( cModule * m,
int g = -1 )
 

Determines if a given module is in the route containing this gate.

void cGate::setDataRate ( cPar * p )
 

Set the parameters of the link. Ownership of cPar objects are handled according to the ownership flag (that is set by takeOwnership()).

void cGate::setDelay ( cPar * p )
 

Set the parameters of the link. Ownership of cPar objects are handled according to the ownership flag (that is set by takeOwnership()).

void cGate::setDisplayString ( const char * dispstr,
bool immediate = true )
 

Sets the display string for the gate, which in practice affects the appearance of the connection for which this gate is the source.

The immediate flag selects whether the change should become effective right now or later (after finishing the current event).

If several display string changes are going to be done within one event, then immediate=false is useful because it reduces the number of necessary redraws. Immediate=false also uses less stack. But its drawback is that a setDisplayString() followed by a send() would actually be displayed in reverse order (message animation first), because message animations are always performed immediately (actually within the send() call).

void cGate::setDisplayStringNotify ( void(* notify_func)(cGate *,bool, void *),
void * data )
 

Sets up a notification function which is called every time the display string changes.

void cGate::setError ( cPar * p )
 

Set the parameters of the link. Ownership of cPar objects are handled according to the ownership flag (that is set by takeOwnership()).

void cGate::setFrom ( cGate * g )
 

Redirect gates. This method is mostly used internally during network setup to create the connections. It can also be used to manually create connections for dynamically created modules.

void cGate::setIndex ( int sn,
int vs )
 

Specifies that the gate is at index sn in a gate array of size vs. This function should not be directly called by the user.

void cGate::setLink ( cLinkType * l )
 

Sets the parameters of the link to those specified by the link type.

void cGate::setOwnerModule ( cModule * m,
int gid )
 

Specifies that the gate is owned by module m, and it is at index g in the gate vector. This function should not be directly called by the user.

void cGate::setTo ( cGate * g )
 

Redirect gates. This method is mostly used internally during network setup to create the connections. It can also be used to manually create connections for dynamically created modules.

int cGate::size ( ) const [inline]
 

If the gate is part of a gate vector, returns the size of the vector. Otherwise, it returns 1.

cGate * cGate::sourceGate ( ) const
 

Return the ultimate source and destination of the series of connections (the route) that contains this gate.

cGate * cGate::toGate ( ) const [inline]
 

Returns the next gate in the series of connections (the route) that contains this gate, or a NULL pointer if this gate is the last one in the route. (E.g. for a simple module input gate, this function will return NULL.)

simtime_t cGate::transmissionFinishes ( ) const [inline]
 

Returns the simulation time the gate is expected to finish transmitting. Note that additional messages send on the gate may prolong the time the gate will actually finish.

char cGate::type ( ) const [inline]
 

Returns the gate's type: 'I' for input and 'O' for output.

void cGate::writeContents ( ostream & os ) [virtual]
 

Writes textual information about this object to the stream. See cObject for more details.

Reimplemented from cObject.


The documentation for this class was generated from the following file:
Generated at Sat May 4 15:45:49 2002 for OMNeT++ by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001