MeVisLab Toolbox Reference
mlBase.h File Reference
#include "mlUtilsSystem.h"
#include "mlRuntimeSubClass.h"
#include "mlRuntime.h"
#include <ThirdPartyWarningsDisable.h>
#include <string>
#include <vector>
#include <ThirdPartyWarningsRestore.h>

Go to the source code of this file.

Classes

class  ml::Base

Namespaces

namespace  ml
 Defines the class GetTileJob.

Macros

#define ML_SET_ADDSTATE_VERSION(v)
 Macro to add the static function getAddStateVersion(void) to the implementation.
#define ML_PERSISTENCE_VERSION(v)
 Nicer name for ML_SET_ADDSTATE_VERSION.

Functions

template<typename ToTypePtr>
ToTypePtr mlbase_cast (ml::Base *from)
 Template function to allow type-safe casting of a base object to a derived object.
template<typename ToTypePtr>
ToTypePtr mlbase_cast (const ml::Base *from)
 Overload of the above template function, which makes conversion of const-pointers possible.

Macro Definition Documentation

◆ ML_PERSISTENCE_VERSION

#define ML_PERSISTENCE_VERSION ( v)
Value:
#define ML_SET_ADDSTATE_VERSION(v)
Macro to add the static function getAddStateVersion(void) to the implementation.
Definition mlBase.h:32

Nicer name for ML_SET_ADDSTATE_VERSION.

Definition at line 34 of file mlBase.h.

◆ ML_SET_ADDSTATE_VERSION

#define ML_SET_ADDSTATE_VERSION ( v)
Value:
static int getAddStateVersion(void) { return v; };

Macro to add the static function getAddStateVersion(void) to the implementation.

Class representing general ML objects that support import/export via strings (setPersistentState() and getPersistentState()), arbitrary tree structures (using addStateToTree() and readStateFromTree()) or a data stream (using writeTo() and readFrom()).

Definition at line 32 of file mlBase.h.

Function Documentation

◆ mlbase_cast() [1/2]

template<typename ToTypePtr>
ToTypePtr mlbase_cast ( const ml::Base * from)
inline

Overload of the above template function, which makes conversion of const-pointers possible.

Definition at line 190 of file mlBase.h.

◆ mlbase_cast() [2/2]

template<typename ToTypePtr>
ToTypePtr mlbase_cast ( ml::Base * from)
inline

Template function to allow type-safe casting of a base object to a derived object.

Template function to allow type-safe casting of a base object to a derived object. The function takes a from base object and returns a pointer to the desired object if the from pointer is derived from that ToTypePtr type. Otherwise, a NULL pointer is returned. If NULL is passed to the function, NULL is returned. This function should be preferred to the ML_BASE_IS_A macro.

Example 1:

if (mlbase_cast<GVRVolume*>(someBaseObject)) {
GVRVolume* volume = static_cast<GVRVolume*>(someBaseObject);
...
} else if (mlbase_cast<OtherType*>(someBaseObject)) {
...
}
ToTypePtr mlbase_cast(ml::Base *from)
Template function to allow type-safe casting of a base object to a derived object.
Definition mlBase.h:176

Example 2:

GVRVolume* volume = mlbase_cast<GVRVolume*>(someBaseObject);
if (volume) {
...
}

Definition at line 176 of file mlBase.h.

Referenced by ml::PCLMLTools::createPointCloudFromBaseList(), ml::DcmtkMLConverters::createTypedRTObjectFromBase(), ml::BaseField::getTypedBaseValue(), ml::BaseField::getTypedValue(), SoSFMLBase::getTypedValue(), and ml::ITKDifferenceFunctionFromBasePointer().