Changeset 7181 for code/branches/consolecommands3/src/libraries/network
- Timestamp:
- Aug 18, 2010, 4:01:38 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/consolecommands3/src/libraries/network/synchronisable/Serialise.h
r7163 r7181 39 39 #include "core/CorePrereqs.h" 40 40 #include "core/CoreIncludes.h" 41 #include "core/SmartPtr.h" 41 #include "core/BaseObject.h" // remove this if circular dependencies in BaseObject/SmartPtr are fixed 42 //#include "core/SmartPtr.h" 42 43 43 44 namespace orxonox{ 44 45 45 46 // These functions implement loading / saving / etc. for pointer types 46 47 47 48 /** @brief returns the size of the objectID needed to synchronise the pointer */ 48 49 template <class T> inline uint32_t returnSize( T*& variable ) … … 50 51 return sizeof(uint32_t); 51 52 } 52 53 53 54 /** @brief reads the objectID of a pointer out of the bytestream and increases the mem pointer */ 54 55 template <class T> inline void loadAndIncrease( T*& variable, uint8_t*& mem ) … … 57 58 mem += returnSize( variable ); 58 59 } 59 60 60 61 /** @brief saves the objectID of a pointer into the bytestream and increases the mem pointer */ 61 62 template <class T> inline void saveAndIncrease( T*& variable, uint8_t*& mem ) … … 67 68 mem += returnSize( variable ); 68 69 } 69 70 70 71 /** @brief checks whether the objectID of the variable is the same as in the bytestream */ 71 72 template <class T> inline bool checkEquality( T*& variable, uint8_t* mem ) … … 76 77 return variable == variable->getSynchronisable(*(uint32_t*)(mem)); 77 78 } 78 79 79 80 // These functions implement loading / saving / etc. for SmartPtr<T> 80 81 81 82 /** @brief returns the size of the objectID needed to synchronise the pointer */ 82 83 template <class T> inline uint32_t returnSize( const SmartPtr<T>& variable ) … … 84 85 return sizeof(uint32_t); 85 86 } 86 87 87 88 /** @brief reads the objectID of a pointer out of the bytestream and increases the mem pointer */ 88 89 template <class T> inline void loadAndIncrease( const SmartPtr<T>& variable, uint8_t*& mem ) … … 92 93 mem += returnSize( variable ); 93 94 } 94 95 95 96 /** @brief saves the objectID of a pointer into the bytestream and increases the mem pointer */ 96 97 template <class T> inline void saveAndIncrease( const SmartPtr<T>& variable, uint8_t*& mem ) … … 102 103 mem += returnSize( variable ); 103 104 } 104 105 105 106 /** @brief checks whether the objectID of the variable is the same as in the bytestream */ 106 107 template <class T> inline bool checkEquality( const SmartPtr<T>& variable, uint8_t* mem ) … … 111 112 return *(uint32_t*)(mem) == OBJECTID_UNKNOWN; 112 113 } 113 114 114 115 // These functions implement loading / saving / etc. for WeakPtr<T> 115 116 116 117 /** @brief returns the size of the objectID needed to synchronise the pointer */ 117 118 template <class T> inline uint32_t returnSize( const WeakPtr<T>& variable ) … … 119 120 return sizeof(uint32_t); 120 121 } 121 122 122 123 /** @brief reads the objectID of a pointer out of the bytestream and increases the mem pointer */ 123 124 template <class T> inline void loadAndIncrease( const WeakPtr<T>& variable, uint8_t*& mem ) … … 127 128 mem += returnSize( variable ); 128 129 } 129 130 130 131 /** @brief saves the objectID of a pointer into the bytestream and increases the mem pointer */ 131 132 template <class T> inline void saveAndIncrease( const WeakPtr<T>& variable, uint8_t*& mem ) … … 137 138 mem += returnSize( variable ); 138 139 } 139 140 140 141 /** @brief checks whether the objectID of the variable is the same as in the bytestream */ 141 142 template <class T> inline bool checkEquality( const WeakPtr<T>& variable, uint8_t* mem )
Note: See TracChangeset
for help on using the changeset viewer.