HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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.

Macros

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

Macro Definition Documentation

#define DECLARE_CLASSNAME (   DataClass,
  SuperClass 
)
Value:
private: \
typedef SuperClass BaseClass; \
typedef DataClass ThisClass; \
public: \
static inline const UT_StringHolder &classname() \
{ \
static constexpr UT_StringLit theType(#DataClass); \
return theType.asHolder(); \
} \
private: \
const UT_StringHolder &getDataTypeSubclass() const override \
{ \
return classname(); \
} \
protected: \
static void getDataTypeSuperclasses(UT_StringArray& classes) \
{ \
static constexpr UT_StringLit theSuperType(#SuperClass); \
classes.append(theSuperType.asHolder()); \
SuperClass::getDataTypeSuperclasses(classes); \
} \
private: \

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,
  SuperClass,
  Description,
  DopParms 
)

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 63 of file SIM_DataUtils.h.

#define DECLARE_STANDARD_GETCASTTOTYPE ( )
Value:
protected: \
void *getCastToType(const UT_StringRef &totype) const override \
{ \
if( classname() == totype ) \
return (void *)this; \
return BaseClass::getCastToType(totype); \
} \
void
Definition: png.h:1083
**But if you need a or simply need to know when the task has note that the like this
Definition: thread.h:617
if(num_boxed_items<=0)
Definition: UT_RTreeImpl.h:697

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 50 of file SIM_DataUtils.h.

#define IMPLEMENT_DATAFACTORY (   DataClass)
Value:
static SIM_DataFactoryCreator \
DataClass##Creator(DataClass::createDataFactory);

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

Examples:
SIM/GAS_NetVDBSliceExchange.C, 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 100 of file SIM_DataUtils.h.