Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members
persisthelper.h
00001 /* 00002 Crystal Space Entity Layer 00003 Copyright (C) 2005 by Jorrit Tyberghein 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 00018 MA 02111-1307, USA. 00019 */ 00020 00021 #ifndef __CEL_CELTOOL_PERSISTHELPER__ 00022 #define __CEL_CELTOOL_PERSISTHELPER__ 00023 00024 #include "cstypes.h" 00025 #include "csutil/scf.h" 00026 #include "csutil/util.h" 00027 #include "csutil/array.h" 00028 #include "csutil/set.h" 00029 00030 #include "physicallayer/persist.h" 00031 #include "physicallayer/propclas.h" 00032 00039 class celStandardLocalEntitySet : public iCelLocalEntitySet 00040 { 00041 private: 00042 iCelPlLayer* pl; 00043 00044 csArray<iCelEntity*> local_entities; 00045 csSet<csPtrKey<iCelEntity> > local_entities_set; 00046 00047 public: 00048 celStandardLocalEntitySet (iCelPlLayer* pl); 00049 virtual ~celStandardLocalEntitySet (); 00050 00051 SCF_DECLARE_IBASE; 00052 00053 virtual size_t GetEntityCount () const 00054 { 00055 return local_entities.Length (); 00056 } 00057 virtual iCelEntity* GetEntity (size_t idx) const 00058 { 00059 return local_entities[idx]; 00060 } 00061 virtual void AddEntity (iCelEntity* entity) 00062 { 00063 local_entities.Push (entity); 00064 local_entities_set.Add (entity); 00065 } 00066 virtual bool IsLocal (iCelEntity* entity) 00067 { 00068 return local_entities_set.In (entity); 00069 } 00070 virtual bool IsLocal (iCelPropertyClass* pc) 00071 { 00072 return local_entities_set.In (pc->GetEntity ()); 00073 } 00074 virtual csPtr<iCelDataBuffer> SaveExternalEntity (iCelEntity* entity); 00075 virtual iCelEntity* FindExternalEntity (iCelDataBuffer* databuf); 00076 virtual csPtr<iCelDataBuffer> SaveExternalPC (iCelPropertyClass* pc); 00077 virtual iCelPropertyClass* FindExternalPC (iCelDataBuffer* databuf); 00078 }; 00079 00083 class celStandardPersistentDataList : public iCelPersistentDataList 00084 { 00085 private: 00086 class celPersistentDataEntry 00087 { 00088 public: 00089 csRef<iCelDataBuffer> databuf; 00090 csString pc_name; 00091 csString pc_tag; 00092 }; 00093 csArray<celPersistentDataEntry*> data_list; 00094 00095 public: 00096 celStandardPersistentDataList (); 00097 virtual ~celStandardPersistentDataList (); 00098 00099 SCF_DECLARE_IBASE; 00100 00101 virtual size_t GetCount () const 00102 { return data_list.Length (); } 00103 00104 virtual bool GetPersistentData (size_t idx, csRef<iCelDataBuffer>& databuf, 00105 csString& pc_name, csString& pc_tag) const; 00106 00107 virtual void AddPersistentData (csRef<iCelDataBuffer>& databuf, 00108 csString& pc_name, csString& pc_tag); 00109 }; 00110 00111 #endif // __CEL_CELTOOL_PERSISTHELPER__ 00112
Generated for CEL: Crystal Entity Layer by doxygen 1.4.4