MeVis/Foundation/Sources/MLUtilities/mlBase.h File Reference

Class representing general ML objects that support import/export via strings (setPersistentState() and getPersistentState()) or arbitrary tree structures (using addStateToTree() and readStateFromTree()). More...

#include "mlUtilsSystem.h"
#include "mlRuntimeSubClass.h"
#include <vector>

Go to the source code of this file.


Classes

class  ml::Base
 Class representing general ML objects that support import/export via strings (setPersistentState() and getPersistentState()) or arbitrary tree structures (using addStateToTree() and readStateFromTree()). More...

Namespaces

namespace  ml
 Define the namespace name like in the ML. Default is ml.

Defines

#define ML_SET_ADDSTATE_VERSION(v)   static int getAddStateVersion(void) { return v; };
 Macro to add the static function getAddStateVersion(void) to the implementation.

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.


Detailed Description

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

Note that this file needs to be included explicitly, because it is no default include of mlUtils.h.

Author:
Dirk Selle
Date:
03/2001

Definition in file mlBase.h.


Define Documentation

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

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

Definition at line 28 of file mlBase.h.


Function Documentation

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 148 of file mlBase.h.

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)) {
    ...
  }

Example 2:

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

Definition at line 134 of file mlBase.h.


Generated on Sat Sep 3 18:37:43 2011 for MLReference by  doxygen 1.5.8