All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SIM_DataUtils.h File Reference
#include "SIM_Data.h"
#include "SIM_DataFactory.h"
#include "SIM_Utils.h"
#include <UT/UT_StringArray.h>
#include <UT/UT_StringHolder.h>
#include <SYS/SYS_Compiler.h>
+ Include dependency graph for SIM_DataUtils.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


#define DECLARE_CLASSNAME(DataClass, SuperClass)
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)

Macro Definition Documentation

#define DECLARE_CLASSNAME (   DataClass,
private: \
typedef SuperClass BaseClass; \
typedef DataClass ThisClass; \
static inline UT_StringHolder classname() \
{ return SYS_CONCAT(#DataClass,_UTsh); } \
virtual const UT_String &getDataTypeSubclass() const \
{ \
static UT_String theType(classname()); \
return theType; \
} \
protected: \
static void getDataTypeSuperclasses(UT_StringArray& classes) \
{ \
classes.append(SYS_CONCAT(#SuperClass,_UTsh)); \
SuperClass::getDataTypeSuperclasses(classes); \
} \
private: \
#define SYS_CONCAT(a, b)
Definition: SYS_Compiler.h:32
#define const
Definition: zconf.h:214

This macro provides a quick way to define a static function called classname() which returns the provided class name as a string.

Definition at line 20 of file SIM_DataUtils.h.

#define DECLARE_DATAFACTORY (   DataClass,

This macro simplifies the calling and casting the return value from This macro quickly defines all the static functions needed to declare a SIM_DataFactory for a SIM_Data subclass.

Definition at line 58 of file SIM_DataUtils.h.

protected: \
virtual void *getCastToType(const char *totype) const \
{ \
if( strcmp(classname(), totype) == 0 ) \
return (void *)this; \
return BaseClass::getCastToType(totype); \
} \

This function implements a standard version of getDistanceToType(). Only if your subclass uses multiple inheritance will it be necessary to write a customized version of this function. Be sure to add this declaration to your class definition or the DECLARE_DATAFACTORY() macro will not compile properly.

Definition at line 45 of file SIM_DataUtils.h.

#define IMPLEMENT_DATAFACTORY (   DataClass)
static SIM_DataFactoryCreator \

Add this macro to the initialization function for your library. It uses the declaration above to register your data type.

SIM/SIM_ElectricalProperties.C, SIM/SIM_ForceOrbit.C, SIM/SIM_GasAdd.C, SIM/SIM_RadialEmit.C, SIM/SIM_SolverHair.C, and SIM/SNOW_Solver.C.

Definition at line 97 of file SIM_DataUtils.h.