Entity.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 __ENTITY_HPP
00032 #define __ENTITY_HPP
00033 
00034 #include "libecs.hpp"
00035 #include "EntityType.hpp"
00036 #include "PropertiedClass.hpp"
00037 #include "PropertyInterface.hpp"
00038 
00039 
00040 namespace libecs
00041 {
00042 
00043   /** @addtogroup entities The Entities.
00044       Entities.
00045       
00046       @ingroup libecs
00047 
00048    
00049       @{ 
00050    */ 
00051 
00052   /** @file */
00053 
00054   DECLARE_VECTOR( EntityPtr, EntityVector );
00055 
00056   
00057   /**
00058      Entity class is a base class for all components in the cell model.
00059 
00060   */
00061 
00062 
00063   LIBECS_DM_CLASS( Entity, PropertiedClass )
00064   {
00065 
00066   public:
00067 
00068     LIBECS_DM_OBJECT_ABSTRACT( Entity ) 
00069       {
00070         INHERIT_PROPERTIES( PropertiedClass );
00071 
00072         PROPERTYSLOT_SET_GET( String, Name );
00073 
00074         //      PROPERTYSLOT_NO_LOAD_SAVE( String, FullID,
00075         //                                 NULLPTR, &Entity::getFullIDString );
00076       }
00077 
00078     Entity(); 
00079     virtual ~Entity();
00080 
00081     /**
00082        Get a System to which this Entity belongs.
00083 
00084        @return a borrowed pointer to the super system.
00085     */
00086 
00087     SystemPtr getSuperSystem() const 
00088     {
00089       return theSuperSystem;
00090     }
00091 
00092 
00093     /**
00094        Get a FullID of this Entity.
00095 
00096        @return a FullID of this Entity.
00097     */
00098 
00099     ECELL_API const FullID getFullID() const;
00100 
00101 
00102     /**
00103        Get EntityType of this Entity.
00104 
00105        This method is overridden in Variable, Process and System classes.
00106 
00107        @return EntityType of this Entity object.
00108        @see EntityType
00109     */
00110 
00111     virtual const EntityType getEntityType() const
00112     {
00113       return EntityType( EntityType::ENTITY );
00114     }
00115 
00116 
00117 
00118 
00119     /**
00120        Get a SystemPath of this Entity.
00121 
00122        @note The SystemPath doesn't include ID of this Entity even if 
00123        this Entity is a System.
00124 
00125        @return a SystemPath of this Entity.
00126     */
00127 
00128     ECELL_API virtual const SystemPath getSystemPath() const;
00129 
00130 
00131     /// \name Properties
00132     //@{
00133 
00134     /**
00135        Set an identifier of this Entity.
00136 
00137        @param anID an id of this Entry.
00138     */
00139 
00140     SET_METHOD( String, ID )
00141     {
00142       theID = value;
00143     }
00144 
00145     /**
00146        Get an id string of this Entity.
00147 
00148        @return an id of this Entity.
00149     */
00150 
00151     GET_METHOD( String, ID )
00152     {
00153       return theID;
00154     }
00155 
00156     /**
00157        Set name of this Entity.
00158 
00159        @param aName a name of this Entity.
00160     */
00161 
00162     SET_METHOD( String, Name )
00163     {
00164       theName = value;
00165     }
00166 
00167     /**
00168        Get a name of this Entity.
00169 
00170        @return a name of this Entity.
00171     */
00172 
00173     GET_METHOD( String, Name )
00174     { 
00175       return theName; 
00176     }
00177 
00178     /**
00179        Get a FullID of this Entity as String.
00180 
00181        @note Property name for this method is 'getFullID', not
00182        'getFullIDString.'
00183 
00184        @return a FullID string of this Entity.
00185     */
00186 
00187     ECELL_API const String getFullIDString() const;
00188 
00189     //@}
00190 
00191 
00192     /**
00193        @internal
00194 
00195        Set a supersystem of this Entity.  
00196 
00197        Usually no need to set this manually because a System object does
00198        this when an Entity is added to the System.
00199 
00200        @param supersystem a pointer to a System to which this object belongs.
00201     */
00202 
00203     void setSuperSystem( SystemPtr const supersystem ) 
00204     { 
00205       theSuperSystem = supersystem; 
00206     }
00207 
00208   private:
00209 
00210     // hide them
00211     Entity( EntityRef );
00212     EntityRef operator=( EntityRef );
00213 
00214   private:
00215 
00216     SystemPtr theSuperSystem;
00217 
00218 
00219     String    theID;
00220     String    theName;
00221   };
00222 
00223 
00224 
00225   /*@}*/
00226 
00227 } // namespace libecs
00228 
00229 #endif /*  __ENTITY_HPP */
00230 
00231 /*
00232   Do not modify
00233   $Author: sachiboo $
00234   $Revision: 2619 $
00235   $Date: 2006-11-24 13:13:59 +0100 (Fri, 24 Nov 2006) $
00236   $Locker$
00237 */

Generated on Fri Aug 31 18:42:38 2007 for E-CELL C++ libraries (libecs and libemc) 3.1.105 by  doxygen 1.5.3