![]() |
VR-Link API Documentation for DIS
|
00001 /****************************************************************************** 00002 ** Copyright (c) 1992-2010 VT MAK 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 00006 00010 00011 #ifndef envObjectSync_H__ 00012 #define envObjectSync_H__ 00013 00014 #include "appEnv.h" 00015 #include <vlutil/vlString.h> 00016 #include <vlutil/vlSmartPointers.h> 00017 #include <utility> 00018 #include <map> 00019 00020 #include "envValue.h" 00021 00022 #ifdef DtUSE_UTILITIES_NAMESPACE 00023 namespace DtUSE_UTILITIES_NAMESPACE 00024 { 00025 #endif 00026 00027 class DT_DLL_MTL DtEnvObject; 00028 class DT_DLL_MTL DtEnvObjectSync; 00029 class DT_DLL_MTL DtEnvironment; 00030 00031 typedef DtBoost::weak_ptr<DtEnvObjectSync> DtEnvObjectSyncWP; 00032 00035 class DT_DLL_MTL DtEnvObjectSync 00036 { 00037 public: 00038 00039 DtEnvObjectSync(); 00040 00041 virtual ~DtEnvObjectSync(); 00042 00045 virtual void generateObject(DtEnvironment&, const DtString& name); 00046 00051 virtual void bind(DtEnvValueSP value,bool createMissingAttributes); 00052 00056 virtual void unbind(); 00057 00060 virtual DtEnvValueSP binding() const; 00061 00064 virtual void addAttributeSync(const DtString&,DtEnvObjectSync*); 00065 00068 virtual void removeAttributeSync(const DtString&); 00069 00071 virtual void removeAllAttributeSyncs(); 00072 00074 virtual DtEnvObjectSync* attributeSync(const DtString&); 00075 00076 00077 /* CALLBACKS */ 00078 00079 /* Mandatory callbacks */ 00080 00084 virtual void syncInCB(const DtEnvObject&) = 0; 00085 00088 virtual void syncOutCB(DtEnvObject&) const = 0; 00089 00091 virtual DtString syncType() const = 0; 00092 00093 /* Optional callbacks */ 00094 00096 virtual void unboundAttributeSyncInCB(DtEnvValue*); 00097 00099 virtual void attributeAddedCB(DtEnvValueSP); 00100 00102 virtual void attributeRemovedCB(DtEnvValueSP); 00103 00104 protected: 00105 00106 00107 //typedef std::pair<DtEnvObjectSync*,DtEnvValueSP> DtAttributeBinding; 00108 typedef std::map<DtString,DtEnvObjectSync*> DtAttributeSyncMap; 00109 DtAttributeSyncMap myAttributeMap; 00110 DtEnvValueWP myBoundObject; 00111 }; 00112 00113 #ifdef DtUSE_UTILITIES_NAMESPACE 00114 } 00115 #endif 00116 00117 #endif