BVB Source Codes

CRYENGINE Show IMetadataRecorder.h Source code

Return Download CRYENGINE: download IMetadataRecorder.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. #ifndef __IMETADATARECORDER_H__
  4. #define __IMETADATARECORDER_H__
  5.  
  6. #pragma once
  7.  
  8. struct IMetadata
  9. {
  10.         static IMetadata*        CreateInstance();
  11.         void                     Delete();
  12.  
  13.         virtual void             SetTag(uint32 tag) = 0;
  14.         virtual bool             SetValue(uint32 type, const uint8* data, uint8 size) = 0;
  15.         virtual bool             AddField(const IMetadata* metadata) = 0;
  16.         virtual bool             AddField(uint32 tag, uint32 type, const uint8* data, uint8 size) = 0;
  17.  
  18.         virtual uint32           GetTag() const = 0;
  19.         virtual size_t           GetNumFields() const = 0; // 0 means this is a basic typed value
  20.         virtual const IMetadata* GetFieldByIndex(size_t i) const = 0;
  21.         virtual uint32           GetValueType() const = 0;
  22.         virtual uint8            GetValueSize() const = 0;
  23.         virtual bool             GetValue(uint8* data /*[out]*/, uint8* size /*[in|out]*/) const = 0;
  24.  
  25.         virtual IMetadata*       Clone() const = 0;
  26.  
  27.         virtual void             Reset() = 0;
  28.  
  29. protected:
  30.         virtual ~IMetadata() {}
  31. };
  32.  
  33. // This interface should be implemented by user of IMetadataRecorder.
  34. struct IMetadataListener
  35. {
  36.         virtual ~IMetadataListener(){}
  37.         virtual void OnData(const IMetadata* metadata) = 0;
  38. };
  39.  
  40. // Records toplevel metadata - everything being recorded is added to the toplevel in a sequential manner.
  41. struct IMetadataRecorder
  42. {
  43.         static IMetadataRecorder* CreateInstance();
  44.         void                      Delete();
  45.  
  46.         virtual bool              InitSave(const char* filename) = 0;
  47.         virtual bool              InitLoad(const char* filename) = 0;
  48.  
  49.         virtual void              RecordIt(const IMetadata* metadata) = 0;
  50.         virtual void              Flush() = 0;
  51.  
  52.         virtual bool              Playback(IMetadataListener* pListener) = 0;
  53.  
  54.         virtual void              Reset() = 0;
  55.  
  56. protected:
  57.         virtual ~IMetadataRecorder() {}
  58. };
  59.  
  60. template<typename I>
  61. class CSimpleAutoPtr
  62. {
  63. public:
  64.         CSimpleAutoPtr() { m_pI = I::CreateInstance(); }
  65.         ~CSimpleAutoPtr() { m_pI->Delete(); }
  66.         I*       operator->() const { return m_pI; }
  67.         const I* get() const        { return m_pI; }
  68. private:
  69.         CSimpleAutoPtr(const CSimpleAutoPtr& rhs);
  70.         CSimpleAutoPtr& operator=(const CSimpleAutoPtr& rhs);
  71.         I* m_pI;
  72. };
  73.  
  74. typedef CSimpleAutoPtr<IMetadata>         IMetadataPtr;
  75. typedef CSimpleAutoPtr<IMetadataRecorder> IMetadataRecorderPtr;
  76.  
  77. #endif
  78.  
downloadIMetadataRecorder.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