EntityType.hpp

Go to the documentation of this file.
00001 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
00002 //
00003 //        This file is part of E-Cell Simulation Environment package
00004 //
00005 //                Copyright (C) 1996-2002 Keio University
00006 //
00007 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
00008 //
00009 //
00010 // E-Cell is free software; you can redistribute it and/or
00011 // modify it under the terms of the GNU General Public
00012 // License as published by the Free Software Foundation; either
00013 // version 2 of the License, or (at your option) any later version.
00014 // 
00015 // E-Cell is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00018 // See the GNU General Public License for more details.
00019 // 
00020 // You should have received a copy of the GNU General Public
00021 // License along with E-Cell -- see the file COPYING.
00022 // If not, write to the Free Software Foundation, Inc.,
00023 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00024 // 
00025 //END_HEADER
00026 //
00027 // written by Koichi Takahashi <shafi@e-cell.org>,
00028 // E-Cell Project.
00029 //
00030 
00031 #ifndef __ENTITYTYPE_HPP 
00032 #define __ENTITYTYPE_HPP 
00033 
00034 #include "libecs.hpp"
00035 
00036 
00037 namespace libecs
00038 {
00039 
00040   /** @addtogroup identifier
00041    *
00042    *@{
00043    */
00044 
00045   /** @file */
00046 
00047 
00048   /**
00049 
00050   */
00051 
00052   class EntityType
00053   {
00054 
00055   public:
00056     
00057     enum Type
00058       {
00059         NONE      = 0,
00060         ENTITY    = 1,
00061         VARIABLE  = 2,
00062         PROCESS   = 3,
00063         SYSTEM    = 4
00064       };
00065 
00066     ECELL_API EntityType( StringCref typestring );
00067 
00068     EntityType( const int number );
00069 
00070     EntityType( const Type type )
00071       :
00072       theType( type )
00073     {
00074       ; // do nothing
00075     }
00076 
00077     EntityType( EntityTypeCref primitivetype )
00078       :
00079       theType( primitivetype.getType() )
00080     {
00081       ; // do nothing
00082     }
00083 
00084     EntityType()
00085       :
00086       theType( NONE )
00087     {
00088       ; // do nothing
00089     }
00090 
00091       
00092     StringCref getString() const;
00093 
00094     operator StringCref() const
00095     {
00096       return getString();
00097     }
00098 
00099     const Type& getType() const
00100     {
00101       return theType;
00102     }
00103 
00104     operator const Type&() const
00105     {
00106       return getType();
00107     }
00108 
00109     //    operator const int&() const
00110     //    {
00111     //      return static_cast<const int&>( getType() ); 
00112     //    }
00113 
00114     bool operator<( EntityTypeCref rhs ) const
00115     {
00116       return theType < rhs.getType();
00117     }
00118 
00119     bool operator<( const Type rhs ) const
00120     {
00121       return theType < rhs;
00122     }
00123 
00124     bool operator==( EntityTypeCref rhs ) const
00125     {
00126       return theType == rhs.getType();
00127     }
00128 
00129     bool operator==( const Type rhs ) const
00130     {
00131       return theType == rhs;
00132     }
00133 
00134 
00135     static StringCref  EntityTypeStringOfNone();
00136 
00137     static StringCref  EntityTypeStringOfEntity();
00138 
00139     static StringCref  EntityTypeStringOfProcess();
00140     
00141     static StringCref  EntityTypeStringOfVariable();
00142     
00143     static StringCref  EntityTypeStringOfSystem();
00144 
00145   private:
00146 
00147     Type theType;
00148 
00149   };
00150 
00151   /*@}*/
00152 
00153 } // namespace libecs
00154 
00155 
00156 #endif /* __ENTITYTYPE_HPP */

Generated on Mon Dec 18 07:29:46 2006 for E-CELL C++ libraries (libecs and libemc) 3.1.105 by  doxygen 1.5.1