26 #include <ThirdPartyWarningsDisable.h>
29 #if ML_DEPRECATED_SINCE(3,5,0)
32 #include <ThirdPartyWarningsRestore.h>
35 #define ML_SET_ADDSTATE_VERSION(v) static int getAddStateVersion(void) { return v; };
37 #define ML_PERSISTENCE_VERSION(v) ML_SET_ADDSTATE_VERSION(v)
39 ML_UTILS_START_NAMESPACE
43 class AbstractPersistenceOutputStream;
44 class AbstractPersistenceInputStream;
74 #if ML_DEPRECATED_SINCE(3,5,0)
75 void operator()(
char* )
const {}
79 _this->clearPersistentState(p);
106 #if !ML_DEPRECATED_SINCE(3,5,0)
124 #if !ML_DEPRECATED_SINCE(3,5,0)
163 virtual
Base* deepCopy()
const {
return nullptr; };
183 ML_UTILS_END_NAMESPACE
185 #undef ML_BASE_VERSION
216 template<
typename ToTypePtr>
219 if (from->getTypeId()->isDerivedFrom((
static_cast<ToTypePtr
>(0))->getClassTypeId())) {
220 return static_cast<ToTypePtr
>(from);
230 template<
typename ToTypePtr>
231 inline ToTypePtr
mlbase_cast(
const ML_UTILS_NAMESPACE::Base* from) {
233 if (from->getTypeId()->isDerivedFrom((
static_cast<ToTypePtr
>(0))->getClassTypeId())) {
234 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 void clearPersistentState(char *) const
Disposes a string previously allocated by getPersistentState().
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 char * getPersistentState() const
Returns a C string describing the object's internal state.
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 setPersistentState(const char *)
Restores the object's internal state from a string that had been previously generated using getPersis...
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.
void operator()(char *p) const