#pragma once #ifndef TPERSISTSET_H #define TPERSISTSET_H // TnzCore includes #include "tpersist.h" // STD includes #include #include //************************************************************************************** // TPersistSet declaration //************************************************************************************** /*! Container of TPersist instances that are unique per concrete type . This class acts as a container of TPersist instances where only a single instance of a given most-derived type can be stored. This is typically useful to \a overwrite objects of a given type, typically configuration options, without discarding the other objects. */ class DVAPI TPersistSet final : public TPersist { PERSIST_DECLARATION(TPersistSet) std::vector m_objects; //!< #owned# Stored objects. public: ~TPersistSet(); //!< Destroys the stored objects. const std::vector &objects() const { return m_objects; } //!< Returns the stored objects list void insert(std::unique_ptr object); //!< Overwrites an object type instance with //! the supplied one. public: void saveData(TOStream &os) override; //!< Saves data to stream void loadData(TIStream &is) override; //!< Loads data from stream }; #endif // TPERSISTSET_H