physicallayer/propclas.h
00001 /* 00002 Crystal Space Entity Layer 00003 Copyright (C) 2001-2011 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., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __CEL_PL_PROPCLASS__ 00021 #define __CEL_PL_PROPCLASS__ 00022 00023 #include "cstypes.h" 00024 #include "csutil/scf.h" 00025 #include "csutil/strset.h" 00026 #include "csutil/ref.h" 00027 #include "physicallayer/datatype.h" 00028 #include "physicallayer/entity.h" 00029 #include "physicallayer/persist.h" 00030 00031 struct iCelPropertyClassList; 00032 00033 class csVector3; 00034 class csColor; 00035 struct iCelEntity; 00036 struct iCelDataBuffer; 00037 struct iCelCompactDataBufferWriter; 00038 struct iCelCompactDataBufferReader; 00039 struct iCelPropertyChangeCallback; 00040 struct iCelParameterBlock; 00041 struct iStringSet; 00042 00047 struct iCelPositionInfo : public virtual iBase 00048 { 00049 SCF_INTERFACE (iCelPositionInfo, 0, 1, 1); 00050 00055 virtual iSector* GetSector () = 0; 00056 00060 virtual const csVector3 GetPosition () = 0; 00061 00067 virtual iMovable* GetMovable () = 0; 00068 00072 virtual float GetBoundingRadius () = 0; 00073 }; 00074 00079 struct iCelPropertyClass : public virtual iBase 00080 { 00081 SCF_INTERFACE (iCelPropertyClass, 0, 0, 9); 00082 00086 virtual void SetName (const char* name) = 0; 00087 00091 virtual const char* GetName () const = 0; 00092 00096 virtual iObject *QueryObject () = 0; 00097 00104 virtual void SetTag (const char* tagname) = 0; 00105 00110 virtual const char* GetTag () const = 0; 00111 00115 virtual iCelEntity* GetEntity () = 0; 00116 00120 virtual void SetEntity (iCelEntity* entity) = 0; 00121 00129 virtual bool AddPropertyChangeCallback (iCelPropertyChangeCallback* cb) = 0; 00130 00137 virtual bool RemovePropertyChangeCallback ( 00138 iCelPropertyChangeCallback* cb) = 0; 00139 00152 virtual bool SetProperty (csStringID propertyID, long value) = 0; 00153 00157 virtual bool SetProperty (csStringID propertyID, float value) = 0; 00158 00162 virtual bool SetProperty (csStringID propertyID, bool value) = 0; 00163 00167 virtual bool SetProperty (csStringID propertyID, const char* value) = 0; 00168 00172 virtual bool SetProperty (csStringID propertyID, const csVector2& value) = 0; 00173 00177 virtual bool SetProperty (csStringID propertyID, const csVector3& value) = 0; 00178 00182 virtual bool SetProperty (csStringID propertyID, const csColor& value) = 0; 00183 00187 virtual bool SetProperty (csStringID propertyID, 00188 iCelPropertyClass* value) = 0; 00189 00193 virtual bool SetProperty (csStringID propertyID, iCelEntity* entity) = 0; 00194 00198 virtual bool SetProperty (csStringID propertyID, iBase* ibase) = 0; 00199 00214 virtual celDataType GetPropertyOrActionType ( 00215 csStringID propertyID) = 0; 00216 00220 virtual bool IsPropertyReadOnly (csStringID propertyID) = 0; 00221 00225 virtual long GetPropertyLongByID (csStringID propertyID) = 0; 00226 00230 virtual float GetPropertyFloatByID (csStringID propertyID) = 0; 00231 00235 virtual bool GetPropertyBoolByID (csStringID propertyID) = 0; 00236 00240 virtual const char* GetPropertyStringByID (csStringID propertyID) = 0; 00241 00245 virtual bool GetPropertyVectorByID (csStringID propertyID, csVector2& v) = 0; 00246 00250 virtual bool GetPropertyVectorByID (csStringID propertyID, csVector3& v) = 0; 00251 00255 virtual bool GetPropertyColorByID (csStringID propertyID, csColor& v) = 0; 00256 00260 virtual iCelPropertyClass* GetPropertyPClassByID (csStringID propertyID) = 0; 00261 00265 virtual iCelEntity* GetPropertyEntityByID (csStringID propertyID) = 0; 00266 00270 virtual iBase* GetPropertyIBaseByID (csStringID propertyID) = 0; 00271 00280 virtual bool PerformAction (csStringID actionID, 00281 iCelParameterBlock* params, celData& ret) = 0; 00282 00286 virtual size_t GetPropertyAndActionCount () = 0; 00287 00291 virtual csStringID GetPropertyOrActionID (size_t i) = 0; 00292 00296 virtual const char* GetPropertyOrActionDescription (csStringID) = 0; 00297 00305 virtual void PropertyClassesHaveChanged () = 0; 00306 00311 virtual csPtr<iCelDataBuffer> GetPersistentData ( 00312 celPersistenceType persistence_type) = 0; 00313 00325 virtual celPersistenceResult SetPersistentData (csTicks data_time, 00326 iCelDataBuffer* data, celPersistenceType persistence_type) = 0; 00327 00332 virtual iCelPositionInfo* QueryPositionInfo () = 0; 00333 00338 virtual void Activate () = 0; 00339 00344 virtual void Deactivate () = 0; 00345 00353 virtual void MarkBaseline () = 0; 00354 00358 virtual bool IsModifiedSinceBaseline () const = 0; 00359 00367 virtual void SaveModifications (iCelCompactDataBufferWriter* buf, iStringSet* strings) = 0; 00368 00375 virtual void RestoreModifications (iCelCompactDataBufferReader* buf, 00376 const csHash<csString,csStringID>& strings) = 0; 00377 }; 00378 00379 00383 struct iCelPropertyClassList : public virtual iBase 00384 { 00385 SCF_INTERFACE (iCelPropertyClassList, 0, 0, 2); 00386 00390 virtual size_t GetCount () const = 0; 00391 00395 virtual iCelPropertyClass* Get (size_t n) const = 0; 00396 00400 virtual size_t Add (iCelPropertyClass* obj) = 0; 00401 00405 virtual bool Remove (iCelPropertyClass* obj) = 0; 00406 00410 virtual bool Remove (size_t n) = 0; 00411 00415 virtual bool RemoveByInterface (scfInterfaceID scf_id, int iVersion) = 0; 00416 00421 virtual bool RemoveByInterfaceAndTag (scfInterfaceID scf_id, 00422 int iVersion, const char* tag) = 0; 00423 00427 virtual void RemoveAll () = 0; 00428 00432 virtual size_t Find (iCelPropertyClass* obj) const = 0; 00433 00440 virtual iCelPropertyClass* FindByName (const char *name) const = 0; 00441 00446 virtual iCelPropertyClass* FindByNameAndTag (const char *name, 00447 const char* tag) const = 0; 00448 00456 virtual iBase* FindByInterface ( 00457 scfInterfaceID id, int version) const = 0; 00458 00463 virtual iBase* FindByInterfaceAndTag ( 00464 scfInterfaceID id, int version, const char* tag) const = 0; 00465 }; 00466 00471 template<class Interface> 00472 inline csPtr<Interface> celQueryPropertyClassTag ( 00473 iCelPropertyClassList* plist, const char* tag) 00474 { 00475 iBase* base = plist->FindByInterfaceAndTag ( 00476 scfInterfaceTraits<Interface>::GetID (), 00477 scfInterfaceTraits<Interface>::GetVersion (), 00478 tag); 00479 00480 if (base == 0) return csPtr<Interface> (0); 00481 00482 Interface* x = (Interface*)base->QueryInterface ( 00483 scfInterfaceTraits<Interface>::GetID (), 00484 scfInterfaceTraits<Interface>::GetVersion ()); 00485 00486 base->DecRef (); // Release our base interface. 00487 return csPtr<Interface> (x); 00488 } 00489 00496 template<class Interface> 00497 inline csPtr<Interface> celQueryPropertyClass ( 00498 iCelPropertyClassList* plist) 00499 { 00500 iBase* base = plist->FindByInterface ( 00501 scfInterfaceTraits<Interface>::GetID (), 00502 scfInterfaceTraits<Interface>::GetVersion ()); 00503 00504 if (base == 0) return csPtr<Interface> (0); 00505 00506 Interface* x = (Interface*)base->QueryInterface ( 00507 scfInterfaceTraits<Interface>::GetID (), 00508 scfInterfaceTraits<Interface>::GetVersion ()); 00509 00510 base->DecRef (); // Release our base interface. 00511 return csPtr<Interface> (x); 00512 } 00513 00520 template<class Interface> 00521 inline csPtr<Interface> celQueryPropertyClassEntity ( 00522 iCelEntity* entity) 00523 { 00524 return celQueryPropertyClass<Interface> (entity->GetPropertyClassList ()); 00525 } 00526 00531 template<class Interface> 00532 inline csPtr<Interface> celQueryPropertyClassTagEntity ( 00533 iCelEntity* entity, const char* tag) 00534 { 00535 return celQueryPropertyClassTag<Interface> (entity->GetPropertyClassList (), 00536 tag); 00537 } 00538 00539 #endif // __CEL_PL_PROPCLASS__ 00540
Generated for CEL: Crystal Entity Layer 2.1 by doxygen 1.6.1
