Changeset 7284 for code/trunk/src/libraries/network/synchronisable
- Timestamp:
- Aug 31, 2010, 3:37:40 AM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/network/synchronisable/Serialise.h
r7266 r7284 42 42 #include "core/CorePrereqs.h" 43 43 #include "core/CoreIncludes.h" 44 #include "core/SmartPtr.h" 44 #include "core/BaseObject.h" // remove this if circular dependencies in BaseObject/SmartPtr are fixed 45 //#include "core/SmartPtr.h" 45 46 46 47 namespace orxonox{ 47 48 48 49 // These functions implement loading / saving / etc. for pointer types 49 50 50 51 /** @brief returns the size of the objectID needed to synchronise the pointer */ 51 52 template <class T> inline uint32_t returnSize( T*& variable ) … … 53 54 return sizeof(uint32_t); 54 55 } 55 56 56 57 /** @brief reads the objectID of a pointer out of the bytestream and increases the mem pointer */ 57 58 template <class T> inline void loadAndIncrease( T*& variable, uint8_t*& mem ) … … 60 61 mem += returnSize( variable ); 61 62 } 62 63 63 64 /** @brief saves the objectID of a pointer into the bytestream and increases the mem pointer */ 64 65 template <class T> inline void saveAndIncrease( T*& variable, uint8_t*& mem ) … … 70 71 mem += returnSize( variable ); 71 72 } 72 73 73 74 /** @brief checks whether the objectID of the variable is the same as in the bytestream */ 74 75 template <class T> inline bool checkEquality( T*& variable, uint8_t* mem ) … … 79 80 return variable == variable->getSynchronisable(*(uint32_t*)(mem)); 80 81 } 81 82 82 83 // These functions implement loading / saving / etc. for SmartPtr<T> 83 84 84 85 /** @brief returns the size of the objectID needed to synchronise the pointer */ 85 86 template <class T> inline uint32_t returnSize( const SmartPtr<T>& variable ) … … 87 88 return sizeof(uint32_t); 88 89 } 89 90 90 91 /** @brief reads the objectID of a pointer out of the bytestream and increases the mem pointer */ 91 92 template <class T> inline void loadAndIncrease( const SmartPtr<T>& variable, uint8_t*& mem ) … … 95 96 mem += returnSize( variable ); 96 97 } 97 98 98 99 /** @brief saves the objectID of a pointer into the bytestream and increases the mem pointer */ 99 100 template <class T> inline void saveAndIncrease( const SmartPtr<T>& variable, uint8_t*& mem ) … … 105 106 mem += returnSize( variable ); 106 107 } 107 108 108 109 /** @brief checks whether the objectID of the variable is the same as in the bytestream */ 109 110 template <class T> inline bool checkEquality( const SmartPtr<T>& variable, uint8_t* mem ) … … 114 115 return *(uint32_t*)(mem) == OBJECTID_UNKNOWN; 115 116 } 116 117 117 118 // These functions implement loading / saving / etc. for WeakPtr<T> 118 119 119 120 /** @brief returns the size of the objectID needed to synchronise the pointer */ 120 121 template <class T> inline uint32_t returnSize( const WeakPtr<T>& variable ) … … 122 123 return sizeof(uint32_t); 123 124 } 124 125 125 126 /** @brief reads the objectID of a pointer out of the bytestream and increases the mem pointer */ 126 127 template <class T> inline void loadAndIncrease( const WeakPtr<T>& variable, uint8_t*& mem ) … … 130 131 mem += returnSize( variable ); 131 132 } 132 133 133 134 /** @brief saves the objectID of a pointer into the bytestream and increases the mem pointer */ 134 135 template <class T> inline void saveAndIncrease( const WeakPtr<T>& variable, uint8_t*& mem ) … … 140 141 mem += returnSize( variable ); 141 142 } 142 143 143 144 /** @brief checks whether the objectID of the variable is the same as in the bytestream */ 144 145 template <class T> inline bool checkEquality( const WeakPtr<T>& variable, uint8_t* mem )
Note: See TracChangeset
for help on using the changeset viewer.