SIM/SIM_DataUtils.h File Reference

#include "SIM_Data.h"
#include "SIM_DataFactory.h"
#include "SIM_Utils.h"

Go to the source code of this file.

Defines

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


Define Documentation

#define DECLARE_CLASSNAME ( DataClass,
SuperClass   ) 

Value:

private: \
            typedef SuperClass   BaseClass; \
            typedef DataClass    ThisClass; \
            static const char   *classname() { return #DataClass; } \
            virtual const UT_String     &getDataTypeSubclass() const \
                                 { \
                                     static UT_String theType(classname()); \
                                     return theType; \
                                 }
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 23 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 51 of file SIM_DataUtils.h.

 
#define DECLARE_STANDARD_GETCASTTOTYPE (  ) 

Value:

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 39 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/SIM_ElectricalProperties.C, SIM/SIM_ForceOrbit.C, SIM/SIM_GasAdd.C, SIM/SIM_SolverHair.C, and SIM/SIM_SolverSNOW.C.

Definition at line 87 of file SIM_DataUtils.h.


Generated on Thu May 24 00:09:05 2012 for HDK by  doxygen 1.5.9