Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members  

cgate.h

00001 //==========================================================================
00002 //   CGATE.H  -  header for
00003 //                             OMNeT++
00004 //            Discrete System Simulation in C++
00005 //
00006 //
00007 //  Declaration of the following classes:
00008 //    cGate       : module gate
00009 //
00010 //==========================================================================
00011 
00012 /*--------------------------------------------------------------*
00013   Copyright (C) 1992-2001 Andras Varga
00014   Technical University of Budapest, Dept. of Telecommunications,
00015   Stoczek u.2, H-1111 Budapest, Hungary.
00016 
00017   This file is distributed WITHOUT ANY WARRANTY. See the file
00018   `license' for details on this and other legal matters.
00019 *--------------------------------------------------------------*/
00020 
00021 #ifndef __CGATE_H
00022 #define __CGATE_H
00023 
00024 #include "cobject.h"
00025 
00026 //=== classes mentioned here:
00027 class  cGate;
00028 class  cModule;
00029 class  cPar;
00030 class  cMessage;
00031 class  cLinkType;
00032 
00033 //==========================================================================
00034 
00043 class SIM_API cGate : public cObject
00044 {
00045     friend class cModule;
00046   protected:
00047     mutable char *fullname; // buffer to store full name of object
00048     int  serno;         // index if gate vector, 0 otherwise
00049     int  vectsize;      // gate vector size (-1 if not vector)
00050     char typ;           // type of gate: 'I' or 'O'
00051 
00052     cLinkType *linkp;   // link prototype or NULL
00053     cPar *delayp;       // propagation delay or NULL
00054     cPar *errorp;       // bit error rate or NULL
00055     cPar *dataratep;    // data rate or NULL
00056 
00057     cModule *omodp;     // owner module
00058     int gateid;         // gate number within the module
00059 
00060     cGate *fromgatep;   // previous and next gate
00061     cGate *togatep;     //   in the route
00062 
00063     simtime_t transm_finishes; // end of transmission; used if dataratep!=NULL
00064 
00065     opp_string dispstr;      // the display string
00066 
00067     void (*notify_inspector)(cGate*,bool,void*); // to notify inspector about display string changes
00068     void *data_for_inspector;
00069 
00070   public:
00073 
00077     cGate(const cGate& gate);
00078 
00082     explicit cGate(const char *name, char tp);
00083 
00087     virtual ~cGate();
00088 
00093     cGate& operator=(const cGate& gate);
00095 
00098 
00102     virtual const char *className() const {return "cGate";}
00103 
00108     virtual cObject *dup() const  {return new cGate(*this);}
00109 
00114     virtual const char *inspectorFactoryName() const {return "cGateIFC";}
00115 
00120     virtual void forEach(ForeachFunc f);
00121 
00126     virtual void info(char *buf);
00127 
00133     virtual const char *fullName() const;
00134 
00138     virtual const char *fullPath() const;
00139 
00144     virtual const char *fullPath(char *buffer, int bufsize) const;
00145 
00150     virtual void writeContents(ostream& os);
00152 
00157     // FIXME: why public?
00158     void deliver(cMessage *msg);
00159 
00162 
00168     void setOwnerModule(cModule *m, int gid);
00169 
00175     void setIndex(int sn, int vs);
00177 
00180 
00186     void setFrom(cGate *g);
00187 
00193     void setTo(cGate *g);
00195 
00198 
00203     void setLink(cLinkType *l);
00204 
00209     void setDelay(cPar *p);
00210 
00215     void setError(cPar *p);
00216 
00221     void setDataRate(cPar *p);
00222 
00226     cLinkType *link() const {return linkp;}
00227 
00233     cPar *delay() const     {return delayp;}
00234 
00240     cPar *error() const     {return errorp;}
00241 
00247     cPar *datarate() const  {return dataratep;}
00249 
00252 
00256     char type() const      {return typ;}
00257 
00261     cModule *ownerModule() const {return omodp;}
00262 
00267     int id() const         {return gateid;}
00268 
00272     bool isVector() const  {return vectsize>=0;}
00273 
00278     int index() const      {return serno;}
00279 
00284     int size()  const      {return vectsize<0?1:vectsize;}
00286 
00289 
00293     bool isBusy() const;
00294 
00300     simtime_t transmissionFinishes() const {return transm_finishes;}
00302 
00305 
00311     cGate *fromGate() const {return fromgatep;}
00312 
00318     cGate *toGate() const   {return togatep;}
00319 
00324     cGate *sourceGate() const;
00325 
00330     cGate *destinationGate() const;
00331 
00335     int routeContains(cModule *m, int g=-1);
00336 
00344     bool isConnected() const;
00345 
00350     bool isRouteOK() const;
00352 
00355 
00370     void setDisplayString(const char *dispstr, bool immediate=true);
00371 
00376     const char *displayString() const;
00377 
00382     void setDisplayStringNotify(void (*notify_func)(cGate*,bool,void*), void *data);
00384 };
00385 
00386 #endif
00387 

Generated at Sat May 4 15:45:48 2002 for OMNeT++ by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001