/*************************************************************************** * 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. * ***************************************************************************/ #ifndef SEISCOMP_CORE_SERIALIZATION_H #define SEISCOMP_CORE_SERIALIZATION_H #include namespace Seiscomp { namespace Core { namespace Generic { template class Archive; // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> //! Class used to give names to objects template class ObjectNamer { // ------------------------------------------------------------------ // Public types // ------------------------------------------------------------------ public: typedef T Type; // ------------------------------------------------------------------ // Xstruction // ------------------------------------------------------------------ public: //! Construction requires a reference to the object and the name to give the object ObjectNamer(const char* name, Type& object, int h = 0) : _pair(name, &object), _hint(h) {} // ------------------------------------------------------------------ // Public Interface // ------------------------------------------------------------------ public: //! Returns the name of the object const char* name() const { return _pair.first; } //! Returns a reference to the object being named Type& object() const { return *_pair.second; } //! Returns the hint for serialization int hint() const { return _hint; } // ------------------------------------------------------------------ // Implementation // ------------------------------------------------------------------ private: std::pair _pair; //!< The pair which maps a name to an object int _hint; }; // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> //! Class used to iterate over a sequence of objects template class ObjectIterator { // ------------------------------------------------------------------ // Public types // ------------------------------------------------------------------ public: typedef T Type; // ------------------------------------------------------------------ // Xstruction // ------------------------------------------------------------------ public: //! Construction requires a reference to the object and the name to give the object ObjectIterator(Type& object, bool first) : _object(&object), _first(first) {} // ------------------------------------------------------------------ // Public Interface // ------------------------------------------------------------------ public: //! Returns the flag to state whether to read the first //! object or the next in the sequence bool first() const { return _first; } //! Returns a reference to the object being read Type& object() const { return *_object; } // ------------------------------------------------------------------ // Implementation // ------------------------------------------------------------------ private: Type* _object; //!< The object which has to be read bool _first; //!< Initialize }; // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> //NOTE Because of a bug in the SUNPRO compiler up to version 5.10 // a non template containertype is being used. //template