id.h

Go to the documentation of this file.
00001 /*******************************************************************\
00002 
00003                    SESAME project software license
00004 
00005               Copyright (C) 2002 University of Amsterdam
00006 
00007     This program is free software; you can redistribute it and/or
00008      modify it under the terms of the GNU General Public License
00009     as published by the Free Software Foundation; either version 2
00010         of the License, or (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015              GNU General Public License for more details.
00016 
00017   You should have received a copy of the GNU General Public License
00018      along with this program; if not, write to the Free Software
00019       Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00020                            02111-1307, USA.
00021 
00022       For information regarding the SESAME software project see
00023               http://sesamesim.sourceforge.net or email
00024                     jcofflan@users.sourceforge.net
00025 
00026 \*******************************************************************/
00027 
00028 #ifndef ID_H
00029 #define ID_H
00030 
00031 // class Id : Identification of objects by name and type
00032 
00033 #include <BasicUtils/BasicArray.h>
00034 #include <iostream>
00035 
00036 class Id {
00037   BasicArray<Id *> children;
00038 
00039  public:
00040   typedef enum yapiObject_t {yapiUnknown = -1,
00041                              yapiFIFO,
00042                              yapiPort,
00043                              yapiProcess,
00044                              yapiNetwork
00045   } yapiObject_t;
00046 
00047   Id(const Id& i);
00048   Id(const char* n, Id* p);
00049   Id& operator=(const Id& i);
00050   virtual ~Id();
00051 
00052   Id* parent() const {return pa;}
00053   const char* name() const {return nm;}
00054   const char* fullName(char* buf=0) const;
00055   operator const char*() const {return name();}
00056 
00057   Id id(const char* n);
00058 
00059   int getNextPortNum() {return ++portNum;}
00060   virtual yapiObject_t getYAPIType() {return yapiUnknown;}
00061   void dumpYMLProp(std::ostream &stream, const char *name, const char *value);
00062   virtual void dumpYML(std::ostream &stream, int tablevel) {};
00063   virtual void dumpYMLChildren(std::ostream &stream, int tablevel);
00064   void dumpFullName(std::ostream &stream);
00065   void tabs(std::ostream &stream, int num);
00066 
00067   friend std::ostream &operator<<(std::ostream &stream, Id &i);
00068 
00069  private:
00070   char* nm;     // name
00071   Id*   pa;     // parent
00072   int portNum;
00073 };
00074 
00075 std::ostream &operator<<(std::ostream &stream, Id &i);
00076 
00077 Id id(const char* n);
00078 #endif

Generated on Wed Apr 5 20:57:45 2006 for Sesame by  doxygen 1.4.6