BVB Source Codes

CRYENGINE Show BinarySerializeHelper.h Source code

Return Download CRYENGINE: download BinarySerializeHelper.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. /*************************************************************************
  4.    -------------------------------------------------------------------------
  5.    $Id$
  6.    $DateTime$
  7.    Description: Manages one-off reader/writer usages for binary serialization
  8.  
  9.    -------------------------------------------------------------------------
  10.    History:
  11.    - 02:06:2010: Created by Kevin Kirst
  12.  
  13. *************************************************************************/
  14.  
  15. #ifndef __BINARYREADERWRITER_H__
  16. #define __BINARYREADERWRITER_H__
  17.  
  18. #include <CryNetwork/ISerializeHelper.h>
  19.  
  20. #include "Serialization/SerializeWriterXMLCPBin.h"
  21. #include "Serialization/SerializeReaderXMLCPBin.h"
  22. #include "Serialization/XMLCPBin/Writer/XMLCPB_WriterInterface.h"
  23. #include "Serialization/XMLCPBin/Reader/XMLCPB_ReaderInterface.h"
  24.  
  25. class CBinarySerializedObject : public ISerializedObject
  26. {
  27. public:
  28.         CBinarySerializedObject(const char* szSection);
  29.         virtual ~CBinarySerializedObject();
  30.  
  31.         enum { GUID = 0xBDE84A9A };
  32.         virtual uint32 GetGUID() const { return GUID; }
  33.         virtual void   GetMemoryUsage(ICrySizer* pSizer) const;
  34.  
  35.         virtual void   AddRef()  { ++m_nRefCount; }
  36.         virtual void   Release() { if (--m_nRefCount <= 0) delete this; }
  37.  
  38.         virtual bool   IsEmpty() const;
  39.         virtual void   Reset();
  40.         virtual void   Serialize(TSerialize& serialize);
  41.  
  42.         bool           FinishWriting(XMLCPB::CWriterInterface& Writer);
  43.         bool           PrepareReading(XMLCPB::CReaderInterface& Reader);
  44.         const char*    GetSectionName() const { return m_sSection.c_str(); }
  45.  
  46. private:
  47.         void FreeData();
  48.  
  49.         string m_sSection;
  50.  
  51.         int    m_nRefCount;
  52.         uint32 m_uSerializedDataSize;
  53.         uint8* m_pSerializedData;
  54. };
  55.  
  56. class CBinarySerializeHelper : public ISerializeHelper
  57. {
  58. public:
  59.         CBinarySerializeHelper();
  60.         virtual ~CBinarySerializeHelper();
  61.  
  62.         virtual void                          GetMemoryUsage(ICrySizer* pSizer) const;
  63.  
  64.         virtual void                          AddRef()  { ++m_nRefCount; }
  65.         virtual void                          Release() { if (--m_nRefCount <= 0) delete this; }
  66.  
  67.         virtual _smart_ptr<ISerializedObject> CreateSerializedObject(const char* szSection);
  68.         virtual bool                          Write(ISerializedObject* pObject, TSerializeFunc serializeFunc, void* pArgument = NULL);
  69.         virtual bool                          Read(ISerializedObject* pObject, TSerializeFunc serializeFunc, void* pArgument = NULL);
  70.  
  71. private:
  72.         static CBinarySerializedObject* GetBinarySerializedObject(ISerializedObject* pObject);
  73.  
  74. private:
  75.         int m_nRefCount;
  76. };
  77.  
  78. #endif //__BINARYREADERWRITER_H__
  79.  
downloadBinarySerializeHelper.h Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top