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)
36ML_UTILS_START_NAMESPACE
40class AbstractPersistenceOutputStream;
41class AbstractPersistenceInputStream;
124 virtual
Base* deepCopy()
const {
return nullptr; };
144ML_UTILS_END_NAMESPACE
146#undef ML_BASE_VERSION
177template<
typename ToTypePtr>
180 if (from->getTypeId()->isDerivedFrom((
static_cast<ToTypePtr
>(0))->getClassTypeId())) {
181 return static_cast<ToTypePtr
>(from);
191template<
typename ToTypePtr>
192inline ToTypePtr
mlbase_cast(
const ML_UTILS_NAMESPACE::Base* from) {
194 if (from->getTypeId()->isDerivedFrom((
static_cast<ToTypePtr
>(0))->getClassTypeId())) {
195 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
Return 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)
Read the objects state from the data stream object.
virtual bool isRefCountedBase() const
Returns if the instance is derived from RefCountedBase.
virtual void writeTo(AbstractPersistenceOutputStream *) const
Write the objects state to the data stream object.
bool isOfAllowedType(const std::vector< const RuntimeType * > &types) const
Check if 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)
#define ML_UTILS_EXPORT
Defines platform dependent DLL export macro for mlUtils.