Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7181 for code/branches


Ignore:
Timestamp:
Aug 18, 2010, 4:01:38 PM (14 years ago)
Author:
landauf
Message:

Great, looks like I created some circular dependencies between BaseObject, SmartPtr, and Functor. Lets fix this later, just a quick workaround for now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/consolecommands3/src/libraries/network/synchronisable/Serialise.h

    r7163 r7181  
    3939#include "core/CorePrereqs.h"
    4040#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"
    4243
    4344namespace orxonox{
    44    
     45
    4546    // These functions implement loading / saving / etc. for pointer types
    46    
     47
    4748    /** @brief returns the size of the objectID needed to synchronise the pointer */
    4849    template <class T> inline uint32_t returnSize( T*& variable )
     
    5051      return sizeof(uint32_t);
    5152    }
    52    
     53
    5354    /** @brief reads the objectID of a pointer out of the bytestream and increases the mem pointer */
    5455    template <class T> inline void loadAndIncrease( T*& variable, uint8_t*& mem )
     
    5758        mem += returnSize( variable );
    5859    }
    59    
     60
    6061    /** @brief saves the objectID of a pointer into the bytestream and increases the mem pointer */
    6162    template <class T> inline void saveAndIncrease( T*& variable, uint8_t*& mem )
     
    6768        mem += returnSize( variable );
    6869    }
    69    
     70
    7071    /** @brief checks whether the objectID of the variable is the same as in the bytestream */
    7172    template <class T> inline  bool checkEquality( T*& variable, uint8_t* mem )
     
    7677            return variable == variable->getSynchronisable(*(uint32_t*)(mem));
    7778    }
    78    
     79
    7980    // These functions implement loading / saving / etc. for SmartPtr<T>
    80    
     81
    8182    /** @brief returns the size of the objectID needed to synchronise the pointer */
    8283    template <class T> inline uint32_t returnSize( const SmartPtr<T>& variable )
     
    8485        return sizeof(uint32_t);
    8586    }
    86    
     87
    8788    /** @brief reads the objectID of a pointer out of the bytestream and increases the mem pointer */
    8889    template <class T> inline void loadAndIncrease( const SmartPtr<T>& variable, uint8_t*& mem )
     
    9293        mem += returnSize( variable );
    9394    }
    94    
     95
    9596    /** @brief saves the objectID of a pointer into the bytestream and increases the mem pointer */
    9697    template <class T> inline void saveAndIncrease( const SmartPtr<T>& variable, uint8_t*& mem )
     
    102103        mem += returnSize( variable );
    103104    }
    104    
     105
    105106    /** @brief checks whether the objectID of the variable is the same as in the bytestream */
    106107    template <class T> inline  bool checkEquality( const SmartPtr<T>& variable, uint8_t* mem )
     
    111112            return *(uint32_t*)(mem) == OBJECTID_UNKNOWN;
    112113    }
    113    
     114
    114115    // These functions implement loading / saving / etc. for WeakPtr<T>
    115    
     116
    116117    /** @brief returns the size of the objectID needed to synchronise the pointer */
    117118    template <class T> inline uint32_t returnSize( const WeakPtr<T>& variable )
     
    119120        return sizeof(uint32_t);
    120121    }
    121    
     122
    122123    /** @brief reads the objectID of a pointer out of the bytestream and increases the mem pointer */
    123124    template <class T> inline void loadAndIncrease( const WeakPtr<T>& variable, uint8_t*& mem )
     
    127128        mem += returnSize( variable );
    128129    }
    129    
     130
    130131    /** @brief saves the objectID of a pointer into the bytestream and increases the mem pointer */
    131132    template <class T> inline void saveAndIncrease( const WeakPtr<T>& variable, uint8_t*& mem )
     
    137138        mem += returnSize( variable );
    138139    }
    139    
     140
    140141    /** @brief checks whether the objectID of the variable is the same as in the bytestream */
    141142    template <class T> inline  bool checkEquality( const WeakPtr<T>& variable, uint8_t* mem )
Note: See TracChangeset for help on using the changeset viewer.