37 #if !defined(THEOLIZER_INTERNAL_SERIALIZER_FAST_H) 38 #define THEOLIZER_INTERNAL_SERIALIZER_FAST_H 40 #include "internal/core.h" 52 #pragma warning(disable:4100 4251) 59 #ifndef THEOLIZER_INTERNAL_DOXYGEN 69 const static unsigned kFastSerializerVersionNo=1;
76 inline bool hasPropertyFast(
Property iProperty,
bool iIsSaver)
81 case Property::IsSaver:
85 case Property::EncodedString:
89 case Property::SupportModifying:
93 case Property::BinaryOpen:
107 class FastMidISerializer;
109 #endif // THEOLIZER_INTERNAL_DOXYGEN 122 THEOLIZER_INTERNAL_FRIENDS_FOR_INTERNAL;
128 std::ostream& mOStream;
130 static const unsigned kLastVersionNo=kFastSerializerVersionNo;
137 static char const*
const kSerializerName;
138 static std::ios_base::openmode kOpenMode;
142 std::ostream& iOStream,
143 Destinations
const& iDestinations,
144 GlobalVersionNoTableBase
const*
const iGlobalVersionNoTable,
145 unsigned iLastGlobalVersionNo,
146 bool iNoThrowException
165 void saveControl(
int iControl) {savePrimitive(iControl);}
166 void saveControl(
long iControl) {savePrimitive(iControl);}
167 void saveControl(
long long iControl) {savePrimitive(iControl);}
168 void saveControl(
unsigned iControl) {savePrimitive(iControl);}
169 void saveControl(
unsigned long iControl) {savePrimitive(iControl);}
170 void saveControl(
unsigned long long iControl) {savePrimitive(iControl);}
171 void saveControl(std::string
const& iControl) {saveString(iControl);}
175 #define THEOLIZER_INTERNAL_DEF_SAVE 176 #include "internal/primitive.inc" 180 void writePreElement(
bool iDoProcess=
false) { }
190 void saveGroupStart(
bool iIsTop=
false)
192 void saveGroupEnd(
bool iIsTop=
false)
197 void saveStructureStart(Structure, std::string&, std::size_t iOjbectId)
199 if (iOjbectId != kInvalidSize) saveControl(iOjbectId);
201 void saveStructureEnd(Structure, std::string
const& )
206 template<
typename tType>
207 static char const* getPrimitiveName(
unsigned iSerializerVersionNo)
214 void saveElementName(ElementsMapping,
char const*)
220 void saveString(std::string
const& iString);
234 THEOLIZER_INTERNAL_FRIENDS_FOR_INTERNAL;
240 std::istream& mIStream;
242 static const unsigned kLastVersionNo=kFastSerializerVersionNo;
249 static char const*
const kSerializerName;
250 static std::ios_base::openmode kOpenMode;
254 std::istream& iIStream,
255 Destinations
const& iDestinations,
256 GlobalVersionNoTableBase
const*
const iGlobalVersionNoTable,
257 unsigned iLastGlobalVersionNo,
258 bool iNoThrowException
273 bool isMatchTypeIndex(
size_t iSerializedTypeIndex,
274 size_t iProgramTypeIndex);
284 void loadControl(
int& oControl) {loadPrimitive(oControl);}
285 void loadControl(
long& oControl) {loadPrimitive(oControl);}
286 void loadControl(
long long& oControl) {loadPrimitive(oControl);}
287 void loadControl(
unsigned& oControl) {loadPrimitive(oControl);}
288 void loadControl(
unsigned long& oControl) {loadPrimitive(oControl);}
289 void loadControl(
unsigned long long& oControl) {loadPrimitive(oControl);}
290 void loadControl(std::string& oControl) {loadString(oControl);}
294 #define THEOLIZER_INTERNAL_DEF_LOAD 295 #include "internal/primitive.inc" 299 ReadStat readPreElement(
bool iDoProcess=
false) {
return DontCare;}
303 void disposeElement()
314 void loadGroupStart(
bool)
316 void loadGroupEnd(
bool)
321 void loadStructureStart(Structure, std::string&, std::size_t* oObjectId)
323 if (oObjectId) loadPrimitive(*oObjectId);
325 void loadStructureEnd(Structure, std::string
const&)
330 template<
typename tType>
331 static char const* getPrimitiveName(
unsigned iSerializerVersionNo)
336 std::string loadElementName(ElementsMapping iElementsMapping)
341 void loadString(std::string& iString);
355 #ifndef THEOLIZER_INTERNAL_DOXYGEN 357 #endif // THEOLIZER_INTERNAL_DOXYGEN 367 THEOLIZER_INTERNAL_FRIENDS;
369 void AbstructSerializer() { }
371 static internal::Destinations
const& getDestinations()
373 static const internal::Destinations destinations{uDefault, uDestinations...};
378 constexpr
static internal::GlobalVersionNoTableBase
const*
const*
const 379 kPtrGlobalVersionNoTable=&internal::sGlobalVersionNoTable;
385 using MidSerializer::kSerializerName;
386 using BaseSerializer::mIsSaver;
390 using MidSerializer::kOpenMode;
392 #ifndef THEOLIZER_INTERNAL_DOXYGEN 393 static const bool kHasDestination=
true;
394 #endif // THEOLIZER_INTERNAL_DOXYGEN 402 internal::sGlobalVersionNoTable,
403 kLastGlobalVersionNo,
411 return internal::hasPropertyFast(iProperty,
true);
416 using BaseSerializer::getRequireClearTracking;
430 THEOLIZER_INTERNAL_FRIENDS;
432 void AbstructSerializer() { }
434 static internal::Destinations
const& getDestinations()
436 static const internal::Destinations destinations{uDefault, uDestinations...};
441 constexpr
static internal::GlobalVersionNoTableBase
const*
const*
const 442 kPtrGlobalVersionNoTable=&internal::sGlobalVersionNoTable;
448 using MidSerializer::kSerializerName;
449 using BaseSerializer::mIsSaver;
453 using MidSerializer::kOpenMode;
455 #ifndef THEOLIZER_INTERNAL_DOXYGEN 456 static const bool kHasDestination=
true;
457 #endif // THEOLIZER_INTERNAL_DOXYGEN 465 internal::sGlobalVersionNoTable,
466 kLastGlobalVersionNo,
474 return internal::hasPropertyFast(iProperty,
false);
479 using BaseSerializer::getRequireClearTracking;
492 #ifndef THEOLIZER_INTERNAL_DOXYGEN 499 template<class tClass, THEOLIZER_INTERNAL_OVERLOAD((!IsTheolizerVersion<tClass>::value))>
500 void backupSerializable(tClass
const& iInstance, std::ostream& oStream,
bool iIsBackup=
false)
510 template<class tClass, THEOLIZER_INTERNAL_OVERLOAD((IsTheolizerVersion<tClass>::value))>
511 void backupSerializable(tClass
const& iInstance, std::ostream& oStream,
bool iIsBackup=
false)
514 typedef typename RemoveCV<tClass>::type Type;
519 BaseSerializer& aBaseSerializer=aSerializer;
520 THEOLIZER_INTERNAL_SAVE(aBaseSerializer, const_cast<Type&>(iInstance), etmDefault);
530 template<class tClass, THEOLIZER_INTERNAL_OVERLOAD((!IsTheolizerVersion<tClass>::value))>
531 void restoreSerializable(tClass& oInstance, std::istream& iStream,
bool iIsBackup=
false)
537 aSerializer.clearTracking();
541 template<class tClass, THEOLIZER_INTERNAL_OVERLOAD((IsTheolizerVersion<tClass>::value))>
542 void restoreSerializable(tClass& oInstance, std::istream& iStream,
bool iIsBackup=
false)
547 BaseSerializer& aBaseSerializer=aSerializer;
548 THEOLIZER_INTERNAL_LOAD(aBaseSerializer, oInstance, etmDefault);
550 aSerializer.clearTracking();
557 class THEOLIZER_INTERNAL_DLL MemoryStream
561 std::unique_ptr<Impl> mImpl;
564 MemoryStream() noexcept;
565 ~MemoryStream() noexcept;
567 std::iostream&
get() noexcept;
568 operator std::iostream&() noexcept
576 #endif // THEOLIZER_INTERNAL_DOXYGEN 583 template<
typename tType>
586 internal::MemoryStream aBuff;
587 backupSerializable(iSource, aBuff);
589 restoreSerializable(oDestination, aBuff);
606 #endif // THEOLIZER_INTERNAL_SERIALIZER_FAST_H ErrorInfo const & getErrorInfo() const
エラー情報返却(3-1-2.メンバ関数 参照)
#define THEOLIZER_PROCESS(dSerializer, dInstance)
通常の保存/回復処理マクロ(2-4-2.シリアライズ処理要求 参照)
static bool hasProperty(Property iProperty)
FastISerializerのプロパティ返却(3-1-3.プロパティ 参照)
unsigned getGlobalVersionNo() const
処理中のグローバル・バージョン番号返却(3-1-2.メンバ関数 参照)
void clearTracking()
オブジェクト追跡の区切り(3-1-2.メンバ関数 参照)
FastISerializer(std::istream &iIStream, bool iNoThrowException=false)
コンストラクタ
static bool hasProperty(Property iProperty)
FastOSerializerのプロパティ返却(3-1-3.プロパティ 参照)
void copySerializable(tType const &iSource, tType &oDestination)
シアライズ対象メンバをコピーする
bool isError()
エラー発生ならtrue(3-1-2.メンバ関数 参照)
Destination
保存先シンボルを定義するscoped enum型
Property
シリアライザが提供する機能(プロパティ)のリスト
FastOSerializer(std::ostream &iOStream, bool iNoThrowException=false)
コンストラクタ
CheckMode getCheckMode()
現在のCheckMode返却(3-1-2.メンバ関数 参照)