Sleeping Wombat Common Library  0.50.0
swCommonLibrary
Serialization.h
Go to the documentation of this file.
1 #pragma once
2 
10 #include "swCommonLib/Common/RTTR.h"
11 #include "swCommonLib/Serialization/Serializer.h"
13 
14 #include "swCommonLib/Serialization/PropertySerialization/EngineSerializationContext.h"
15 #include <DirectXMath.h>
16 #include <string>
17 
18 
19 #include "swCommonLib/System/Path.h"
20 #include "swCommonLib/System/Dir.h"
21 
22 #include "SerializationContext.h"
23 #include "Core/SerializationCore.h"
24 
25 
26 namespace sw
27 {
28 
96 {
97 private:
98 
99  SerializationContextPtr m_context;
100 
101 protected:
102 public:
103 
106  explicit Serialization ();
107 
109  explicit Serialization ( SerializationContextPtr ctx );
110 
111  ~Serialization () = default;
112 
113 
115  bool Serialize ( const filesystem::Path& filePath, const EngineObject* object );
116 
118  template< typename Type >
119  bool Serialize ( const filesystem::Path& filePath, const Type& object );
120 
125  template< typename Type >
126  bool Serialize ( ISerializer& ser, const Type& object );
127 
129  template< typename Type >
130  bool Deserialize ( const filesystem::Path& filePath, const Type& object );
131 
136  template< typename Type >
137  bool Deserialize ( IDeserializer& deser, Type& object );
138 
139 private:
140 
141  void InitializeContext ( SerializationContext* ctx );
142 };
143 
144 
145 
146 
147 
148 } // sw
149 
150 
151 #include "Serialization.inl"
Serialization context for automatic serialization.
Definition: SerializationContext.h:30
Definition: Path.h:26
Interface for deserializers.
Definition: Deserializer.h:39
Definition: Exception.h:11
Deklaracja klasy deserializatora.
bool Deserialize(const filesystem::Path &filePath, const Type &object)
Deserialize object from file.
Definition: Serialization.inl:38
Serializers interface.
Definition: Serializer.h:31
Base class for serializable objects.
Definition: EngineObject.h:24
bool Serialize(const filesystem::Path &filePath, const EngineObject *object)
Serialize to file.
Definition: Serialization.cpp:51
Main object which performs serialization and deserialization.
Definition: Serialization.h:95
Serialization()
Creates serialization object with default serialization context. If your serialization needs custom c...
Definition: Serialization.cpp:25