/*************************************************************************** * Copyright (C) gempa GmbH * * All rights reserved. * * Contact: gempa GmbH (seiscomp-dev@gempa.de) * * * * GNU Affero General Public License Usage * * This file may be used under the terms of the GNU Affero * * Public License version 3.0 as published by the Free Software Foundation * * and appearing in the file LICENSE included in the packaging of this * * file. Please review the following information to ensure the GNU Affero * * Public License version 3.0 requirements will be met: * * https://www.gnu.org/licenses/agpl-3.0.html. * * * * Other Usage * * Alternatively, this file may be used in accordance with the terms and * * conditions contained in a signed written agreement between you and * * gempa GmbH. * ***************************************************************************/ // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template struct VectorReader {}; template struct VectorWriter {}; template struct ListReader {}; template struct ListWriter {}; template struct ContainerReader {}; template struct ContainerWriter {}; // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> namespace { template class IsTypeOf { class No { }; class Yes { No no[2]; }; static Yes Test(BASECLASS*); // declared, but not defined static No Test(...); // declared, but not defined public: enum { Value = sizeof(Test(static_cast(0))) == sizeof(Yes) }; }; } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template inline bool checkRootType(TYPE*&) { return IsTypeOf::Value; } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template inline bool checkRootType(::boost::intrusive_ptr&) { return IsTypeOf::Value; } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template inline bool checkRootType(TYPE&) { return IsTypeOf::Value; } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template inline const char *checkClassName(const ROOT_TYPE**, const TYPE*) { return TYPE::ClassName(); } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template inline const char *checkClassName(const ROOT_TYPE*, const TYPE&) { return TYPE::ClassName(); } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template inline const char *checkClassName(const ::boost::intrusive_ptr*, const ::boost::intrusive_ptr&) { return TYPE::ClassName(); } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template inline const char *checkClassName(const void**, const TYPE*) { return nullptr; } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template inline const char *checkClassName(const void*, const TYPE&) { return nullptr; } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template struct ClassQuery {}; template struct ClassQuery { const char *operator()() const { return nullptr; } }; template struct ClassQuery { const char *operator()() const { return T::ClassName(); } }; template const char *checkClassName(const ::boost::optional*, const ::boost::optional&) { ClassQuery::value> query; return query(); } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template template inline Archive& Archive::operator<<(T*& object) { write(nullptr, object, T::ClassName()); return *this; } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template template inline Archive& Archive::operator<<(::boost::intrusive_ptr& object) { write(nullptr, object.get(), T::ClassName()); return *this; } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template struct ContainerWriter { void operator()(Archive& ar, const ObjectNamer& namedObject) { ar << ObjectNamer(namedObject.name(), namedObject.object().container(), namedObject.hint()); /* namedObject.object().reset(); while ( namedObject.object().next() ) ar.write(namedObject.name(), namedObject.object().get(), checkClassName(&namedObject.object().get(), namedObject.object().get())); */ } }; template struct ContainerWriter { void operator()(Archive& ar, const ObjectNamer& namedObject) { ar.write(namedObject.name(), namedObject.object(), checkClassName(&namedObject.object(), namedObject.object())); } }; template template inline Archive& Archive::operator<<(const ObjectNamer& namedObject) { int h = setChildHint(namedObject.hint()); //setHint(h | namedObject.hint()); ContainerWriter::value?1:0> writer; writer(*this, namedObject); setHint(h); return *this; } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template struct VectorWriter { void operator()(Archive& ar, const ObjectNamer >& namedObject) { typename std::vector::iterator it; ar.writeSequence(namedObject.object().size()); ar._first = true; for ( it = namedObject.object().begin(); it != namedObject.object().end(); ++it ) { ar.write(namedObject.name(), *it, checkClassName(&(*it), *it)); ar._first = false; } ar._first = true; } }; template struct VectorWriter { void operator()(Archive& ar, const ObjectNamer >& namedObject) { if ( ar.locateObjectByName(namedObject.name(), nullptr, false) ) ar.write(namedObject.object()); } }; template template inline Archive& Archive::operator<<(const ObjectNamer >& namedObject) { int h = setChildHint(namedObject.hint()); typedef typename boost::remove_pointer::type RAW_T; VectorWriter::value? ( boost::is_same,T>::value? 0 : ( boost::is_same::value? 0 : ( boost::is_same::value? 0 : 1 ) ) ) : 0 > writer; writer(*this, namedObject); setHint(h); return *this; } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template struct ListWriter { void operator()(Archive& ar, const ObjectNamer >& namedObject) { typename std::list::iterator it; ar.writeSequence(namedObject.object().size()); ar._first = true; for ( it = namedObject.object().begin(); it != namedObject.object().end(); ++it ) { ar.write(namedObject.name(), *it, checkClassName(&(*it), *it)); ar._first = false; } ar._first = true; } }; template struct ListWriter { void operator()(Archive& ar, const ObjectNamer >& namedObject) { if ( ar.locateObjectByName(namedObject.name(), nullptr, false) ) ar.write(namedObject.object()); } }; template template inline Archive& Archive::operator<<(const ObjectNamer >& namedObject) { int h = setChildHint(namedObject.hint()); typedef typename boost::remove_pointer::type RAW_T; ListWriter::value? ( boost::is_same,T>::value ? 0 : ( boost::is_same::value? 0 : ( boost::is_same::value? 0 : 1 ) ) ) : 0 > writer; writer(*this, namedObject); setHint(h); return *this; } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template template inline Archive& Archive::operator>>(T*& object) { const char *classname = T::ClassName(); if ( !classname ) return *this; //_validObject = true; read(classname, object, classname); return *this; } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template template inline Archive& Archive::operator>>(::boost::intrusive_ptr& object) { //_validObject = true; const char *classname = T::ClassName(); if ( !classname ) return *this; read(classname, object, classname); return *this; } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template struct ContainerReader { void operator()(Archive& ar, const ObjectNamer& namedObject) { const char *objectName = namedObject.name(); typename T::Type value; bool oldState = ar.success(); ar.readSequence(); ObjectNamer namedItem = nameObject(objectName, value, namedObject.hint()); ar._first = true; ar >> namedItem; while ( ar._found ) { if ( ar.success() ) namedObject.object().add(value); ar._first = false; ar._validObject = true; ar >> namedItem; } ar._first = true; // Restore old state if not in strict mode otherwise pass it through if ( !ar._strict ) ar._validObject = oldState; } }; template struct ContainerReader { void operator()(Archive& ar, const ObjectNamer& namedObject) { // goto the object location in the archive const char *classname = checkClassName(&namedObject.object(), namedObject.object()); ar.read(namedObject.name(), namedObject.object(), classname); } }; template template inline Archive& Archive::operator>>(const ObjectIterator& it) { //_validObject = true; _first = it.first(); *this >> it.object(); _first = true; return *this; } template template inline Archive& Archive::operator>>(const ObjectNamer& namedObject) { int h = setChildHint(namedObject.hint()); //setHint(h | namedObject.hint()); //_validObject = true; ContainerReader::value?1:0> reader; reader(*this, namedObject); setHint(h); return *this; } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template struct VectorReader { void operator()(Archive& ar, const ObjectNamer >& namedObject) { const char *objectName = namedObject.name(); T value; bool oldState = ar.success(); ar.readSequence(); ar._first = true; ObjectNamer namedItem = nameObject(objectName, value, namedObject.hint()); ar >> namedItem; while ( ar._found ) { if ( ar.success() ) namedObject.object().push_back(value); ar._first = false; ar._validObject = true; ar >> namedItem; } ar._first = true; // Restore old state if not in strict mode otherwise pass it through if ( !ar._strict ) ar._validObject = oldState; } }; template struct VectorReader { void operator()(Archive& ar, const ObjectNamer >& namedObject) { if ( ar.locateObjectByName(namedObject.name(), nullptr, false) ) ar.read(namedObject.object()); } }; template template inline Archive& Archive::operator>>(const ObjectNamer >& namedObject) { int h = setChildHint(namedObject.hint()); //setHint(h | namedObject.hint()); typedef typename boost::remove_pointer::type RAW_T; //_validObject = true; VectorReader::value? ( boost::is_same,T>::value? 0 : ( boost::is_same::value? 0 : ( boost::is_same::value? 0 : 1 ) ) ) : 0 > reader; reader(*this, namedObject); setHint(h); return *this; } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template struct ListReader { void operator()(Archive& ar, const ObjectNamer >& namedObject) { const char *objectName = namedObject.name(); T value; bool oldState = ar.success(); ar.readSequence(); ar._first = true; ObjectNamer namedItem = nameObject(objectName, value, namedObject.hint()); ar >> namedItem; while ( ar._found ) { if ( ar.success() ) namedObject.object().push_back(value); ar._first = false; ar._validObject = true; ar >> namedItem; } ar._first = true; // Restore old state if not in strict mode otherwise pass it through if ( !ar._strict ) ar._validObject = oldState; } }; template struct ListReader { void operator()(Archive& ar, const ObjectNamer >& namedObject) { if ( ar.locateObjectByName(namedObject.name(), nullptr, false) ) ar.read(namedObject.object()); } }; template template inline Archive& Archive::operator>>(const ObjectNamer >& namedObject) { int h = setChildHint(namedObject.hint()); //setHint(h | namedObject.hint()); typedef typename boost::remove_pointer::type RAW_T; //_validObject = true; ListReader::value? ( boost::is_same,T>::value? 0 : ( boost::is_same::value? 0 : ( boost::is_same::value? 0 : 1 ) ) ) : 0 > reader; reader(*this, namedObject); setHint(h); return *this; } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template template inline Archive& Archive::operator&(ObjectNamer namedObject) { isReading() ? *this >> namedObject : *this << namedObject; return *this; } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template template inline void Archive::read(T*& object) { readPtr(object, object); } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template template inline void Archive::read(::boost::intrusive_ptr& object) { T *ref = nullptr; read(ref); object = ref; } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template template inline void Archive::read(::boost::optional& object) { bool oldState = success(); object = T(); read(*object); if ( !success() ) object = boost::none; // Restore old state if not in strict mode otherwise pass it through if ( !_strict ) _validObject = oldState; } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template template inline void Archive::readPtr(ROOT_TYPE*, T*& object) { if ( (hint() & STATIC_TYPE) == 0 ) { std::string className = determineClassName(); if ( className.empty() ) return; if ( !ClassFactoryInterface::IsTypeOf(T::ClassName(), className.c_str()) ) { _validObject = false; return; } object = static_cast(ClassFactoryInterface::Create(className.c_str())); if ( !object ) throw ClassNotFound(className); } else { object = static_cast(ClassFactoryInterface::Create(T::ClassName())); if ( !object ) throw ClassNotFound(T::ClassName()); } if ( object ) read(*object); else _validObject = false; if ( !success() && object ) { delete object; object = nullptr; } } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template template inline void Archive::readPtr(void*, T*& object) { object = new T; read(*object); if ( !success() ) { delete object; object = nullptr; } } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template template inline void Archive::read(T& object) { typename boost::mpl::if_c::value, ROOT_TYPE*, TypedSerializeDispatcher >::type t; t = &object; serialize(t); //_validObject = true; } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template template inline void Archive::read(const char *name, T &object, const char *targetClass) { if ( findObject(name, targetClass, false) ) read(object); else if ( !(boost::is_base_of::value || boost::is_same::value) ) _validObject = false; else object = T(); } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template template inline void Archive::read(const char *name, T *&object, const char *targetClass) { if ( findObject(name, targetClass, true) ) read(object); else { //_validObject = false; object = nullptr; } } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template template inline void Archive::read(const char *name, ::boost::intrusive_ptr &object, const char *targetClass) { if ( findObject(name, targetClass, true) ) read(object); else { //_validObject = false; object = nullptr; } } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template template inline void Archive::read(const char *name, ::boost::optional &object, const char *targetClass) { if ( findObject(name, targetClass, true) ) read(object); else { //_validObject = false; object = boost::none; } } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template template inline void Archive::write(T& object) { typename boost::mpl::if_c::value, ROOT_TYPE*, TypedSerializeDispatcher >::type t; t = &object; setClassName(hint() & STATIC_TYPE?nullptr:t->className()); serialize(t); } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template template inline void Archive::write(T *object) { write(*object); } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template template inline void Archive::write(const char *name, T &object, const char *targetClass) { // goto the object location in the archive findObject(name, targetClass, false); // write the object data write(object); } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template template inline void Archive::write(const char *name, T *object, const char *targetClass) { if ( !object ) { locateNullObjectByName(name, targetClass, _first); return; } findObject(name, targetClass, true); // write the object data write(*object); } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template template inline void Archive::write(const char *name, ::boost::intrusive_ptr &object, const char *targetClass) { write(name, object.get(), targetClass); } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> template template inline void Archive::write(const char *name, ::boost::optional &object, const char *targetClass) { write(name, object.get_ptr(), targetClass); } // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<