26 #include <ThirdPartyWarningsDisable.h>
29 #include <ThirdPartyWarningsRestore.h>
32 #define ML_SET_ADDSTATE_VERSION(v) static int getAddStateVersion(void) { return v; };
34 #define ML_PERSISTENCE_VERSION(v) ML_SET_ADDSTATE_VERSION(v)
36 ML_UTILS_START_NAMESPACE
40 class AbstractPersistenceOutputStream;
41 class AbstractPersistenceInputStream;
124 virtual
Base* deepCopy()
const {
return nullptr; };
144 ML_UTILS_END_NAMESPACE
146 #undef ML_BASE_VERSION
175 template<
typename ToTypePtr>
178 if (from->getTypeId()->isDerivedFrom((
static_cast<ToTypePtr
>(0))->getClassTypeId())) {
179 return static_cast<ToTypePtr
>(from);
189 template<
typename ToTypePtr>
190 inline ToTypePtr
mlbase_cast(
const ML_UTILS_NAMESPACE::Base* from) {
192 if (from->getTypeId()->isDerivedFrom((
static_cast<ToTypePtr
>(0))->getClassTypeId())) {
193 return static_cast<ToTypePtr
>(from);
Class for writing object data to a stream.
Class representing general ML objects that support import/export via strings (setPersistentState() an...
virtual void setPersistentState(const std::string &state)
Restores the object's internal state from a string that had been previously generated using persisten...
virtual std::string detailString() const
Returns a string describing this object.
virtual bool implementsPersistence(PersistenceInterface) const
Override this method to declare which persistence interfaces are implemented by your derived class.
virtual std::string persistentState() const
Returns a string describing the object's internal state.
virtual void addStateToTree(TreeNode *) const
Attaches the object state as children of the given parent node.
virtual ~Base()
Destructor.
virtual void readFrom(AbstractPersistenceInputStream *, int)
Reads the objects state from the data stream object.
virtual bool isRefCountedBase() const
Returns whether the instance is derived from RefCountedBase.
virtual void writeTo(AbstractPersistenceOutputStream *) const
Writes the objects state to the data stream object.
bool isOfAllowedType(const std::vector< const RuntimeType * > &types) const
Checks whether this object's type is equal to or derived from one of the types given in the argument.
PersistenceInterface
This enum describes the different persistence interfaces available.
virtual void readStateFromTree(TreeNode *)
Reads the object state from the children of the given parent node.
The class TreeNode is the abstract base class for the import/export of ML objects.
ToTypePtr mlbase_cast(ml::Base *from)
Template function to allow type-safe casting of a base object to a derived object.
#define ML_PERSISTENCE_VERSION(v)
Nicer name for ML_SET_ADDSTATE_VERSION.
#define ML_ABSTRACT_ROOT_CLASS_HEADER(className)