48 nameStrings(nameStringsArg), parentSuperStruct(pSSArgs) {}
51 const std::string *
const nameStrings;
61 template<
class OBJ_TYPE,
typename OBJ_TYPE_POINTER,
typename WRAPPER_CLASS_NAME>
class VTKMLBaseWrapper
69 _realWrapper(realWrapper), _wrapperSuperStructPtrs(&parentSuperStruct)
71 _outputBaseField = NULL;
72 _inputBaseField = NULL;
76 _numAddOutputBaseFieldCalls=0;
77 _numAddInputBaseFieldCalls=0;
98 if (!outputFieldName){
102 if (_numAddOutputBaseFieldCalls!=0){
108 _outputBaseField = module.
addBase(outputFieldName);
110 ++_numAddOutputBaseFieldCalls;
120 if (!inputFieldName){
124 if (_numAddInputBaseFieldCalls!=0){
130 _inputBaseField = module.
addBase(inputFieldName);
132 ++_numAddInputBaseFieldCalls;
140 _outputObj = newObject;
141 if (_outputBaseField){ _outputBaseField->touch(); }
149 return _outputBaseField;
157 return _inputBaseField;
179 if (follow->
nameStrings[0] == className){
return true; }
194 if (_inputBaseField){
198 Base *inPtr = _inputBaseField->getBaseValue();
205 if (!wrapperBaseInPtr){
return NULL; }
208 WRAPPER_CLASS_NAME *wrapper = wrapperBaseInPtr ?
static_cast<WRAPPER_CLASS_NAME *
>(wrapperBaseInPtr) : NULL;
211 return (wrapper && wrapper->hasSuperClass(wrapper->getName())) ? wrapper->getWrappedOutputObject() : NULL;
261 #define ML_CREATE_BASE_WRAPPER_FOR_OBJECT_H(CLASS_NAME, CLASS_NAME_POINTER, WRAPPER_CLASS_NAME, PARENT_CLASS_NAME, ML_EXPORT_MACRO) \
266 class ML_EXPORT_MACRO WRAPPER_CLASS_NAME : public VTKWrapperBase \
270 WRAPPER_CLASS_NAME(); \
273 ~WRAPPER_CLASS_NAME(); \
278 void addOutputBaseField(Module &module, const char *outputFieldName); \
279 void addInputBaseField(Module &module, const char *inputFieldName); \
280 void setNewOutputBaseFieldObject(CLASS_NAME_POINTER newObject); \
281 BaseField *getOutputBaseField(); \
282 BaseField *getInputBaseField(); \
283 CLASS_NAME_POINTER getWrappedOutputObject(); \
284 CLASS_NAME_POINTER getWrappedInputObject(const RuntimeType * = NULL); \
285 bool hasSuperClass(const std::string &className) const; \
287 virtual std::string detailString() const override { \
288 std::string result; \
289 vtkObjectType* object = const_cast<WRAPPER_CLASS_NAME*>(this)->getWrappedOutputObject(); \
291 result = object->GetClassName();\
296 const std::string &getName(); \
299 static const std::string NameStrings[2]; \
303 static const WrapperSuperStructPtrs _wrapperSuperStructPtrs; \
311 ML_CLASS_HEADER(WRAPPER_CLASS_NAME); \
323 #define ML_CREATE_BASE_WRAPPER_FOR_OBJECT_CPP(CLASS_NAME, CLASS_NAME_POINTER, WRAPPER_CLASS_NAME, PARENT_CLASS_NAME, ML_EXPORT_MACRO) \
326 const std::string WRAPPER_CLASS_NAME::NameStrings[2] = { #CLASS_NAME, #PARENT_CLASS_NAME }; \
329 const WrapperSuperStructPtrs WRAPPER_CLASS_NAME::_wrapperSuperStructPtrs(WRAPPER_CLASS_NAME::NameStrings, &PARENT_CLASS_NAME##Wrapper::_wrapperSuperStructPtrs); \
332 WRAPPER_CLASS_NAME::WRAPPER_CLASS_NAME(){ _obj = static_cast<void*>(new VTKMLBaseWrapper<CLASS_NAME, CLASS_NAME_POINTER, WRAPPER_CLASS_NAME>(WRAPPER_CLASS_NAME::_wrapperSuperStructPtrs, *this)); } \
335 WRAPPER_CLASS_NAME::~WRAPPER_CLASS_NAME(){ if (_obj){ delete (static_cast<VTKMLBaseWrapper<CLASS_NAME, CLASS_NAME_POINTER, WRAPPER_CLASS_NAME>*>(_obj)); _obj = NULL; }; } \
338 void WRAPPER_CLASS_NAME::addOutputBaseField(Module &module, const char *outputFieldName){ (static_cast<VTKMLBaseWrapper<CLASS_NAME, CLASS_NAME_POINTER, WRAPPER_CLASS_NAME>*>(_obj))->addOutputBaseField(module, outputFieldName); } \
339 void WRAPPER_CLASS_NAME::addInputBaseField(Module &module, const char *inputFieldName) { (static_cast<VTKMLBaseWrapper<CLASS_NAME, CLASS_NAME_POINTER, WRAPPER_CLASS_NAME>*>(_obj))->addInputBaseField(module, inputFieldName) ; } \
340 void WRAPPER_CLASS_NAME::setNewOutputBaseFieldObject(CLASS_NAME_POINTER newObject) { (static_cast<VTKMLBaseWrapper<CLASS_NAME, CLASS_NAME_POINTER, WRAPPER_CLASS_NAME>*>(_obj))->setNewOutputBaseFieldObject(newObject) ; } \
341 BaseField *WRAPPER_CLASS_NAME::getOutputBaseField() { return (static_cast<VTKMLBaseWrapper<CLASS_NAME, CLASS_NAME_POINTER, WRAPPER_CLASS_NAME>*>(_obj))->getOutputBaseField() ; } \
342 BaseField *WRAPPER_CLASS_NAME::getInputBaseField() { return (static_cast<VTKMLBaseWrapper<CLASS_NAME, CLASS_NAME_POINTER, WRAPPER_CLASS_NAME>*>(_obj))->getInputBaseField() ; } \
343 CLASS_NAME_POINTER WRAPPER_CLASS_NAME::getWrappedOutputObject() { return (static_cast<VTKMLBaseWrapper<CLASS_NAME, CLASS_NAME_POINTER, WRAPPER_CLASS_NAME>*>(_obj))->getWrappedOutputObject() ; } \
344 CLASS_NAME_POINTER WRAPPER_CLASS_NAME::getWrappedInputObject(const RuntimeType *rt) { return (static_cast<VTKMLBaseWrapper<CLASS_NAME, CLASS_NAME_POINTER, WRAPPER_CLASS_NAME>*>(_obj))->getWrappedInputObject(rt) ; } \
345 bool WRAPPER_CLASS_NAME::hasSuperClass(const std::string &className) const { return (static_cast<VTKMLBaseWrapper<CLASS_NAME, CLASS_NAME_POINTER, WRAPPER_CLASS_NAME>*>(_obj))->hasSuperClass(className) ; } \
347 const std::string & WRAPPER_CLASS_NAME::getName() { return NameStrings[0]; }\
350 ML_CLASS_SOURCE(WRAPPER_CLASS_NAME, VTKWrapperBase); \
Field to encapsulate a pointer to an ML base object.
void setBaseValue(Base *basePointerValue)
Sets the value of the field to basePointerValue.
Class representing general ML objects that support import/export via strings (setPersistentState() an...
BaseField * addBase(const char *name)
Creates a Base field with name and adds it to the container. Default value is NULL.
Base class for an image processing module of the ML.
RuntimeType contains type and inheritance information of a class and a static dictionary with informa...
Class to create a Base wrapper around an object of a certain template type.
virtual ~VTKMLBaseWrapper()
Destructor.
MLint _numAddOutputBaseFieldCalls
Counter for the number of addOutputBaseField method calls.
BaseField * getOutputBaseField()
Return the pointer to the output base field or NULL if not created.
void addInputBaseField(Module &module, const char *inputFieldName)
Method to add a base field to the passed Module module.
BaseField * getInputBaseField()
Return the pointer to the input base field or NULL if not created.
OBJ_TYPE_POINTER getWrappedInputObject(const RuntimeType *=NULL)
void addOutputBaseField(Module &module, const char *outputFieldName)
Method to add a base field to the passed Module module.
bool hasSuperClass(const std::string &className) const
Return true if the passed parent class name is in the list of classes.
VTKMLBaseWrapper(const WrapperSuperStructPtrs &parentSuperStruct, VTKWrapperBase &realWrapper)
Constructor.
void setNewOutputBaseFieldObject(OBJ_TYPE_POINTER newObject)
Set base field so that it points to the new object.
OBJ_TYPE_POINTER getWrappedOutputObject()
Return the pointer to the wrapped object.
const WrapperSuperStructPtrs * _wrapperSuperStructPtrs
Reference to the inheritance pointer correlated to this class.
Base & _realWrapper
Reference to the real wrapper object creating this.
BaseField * _outputBaseField
Pointer to the field in _module which is used as output interface to another module; default is NULL.
OBJ_TYPE_POINTER _inputObj
Smart pointer to the connected OBJ_TYPE wrapped by this class if an input connector is created or NUL...
BaseField * _inputBaseField
Pointer to the field in _module which is used as input interface to another module; default is NULL.
Module * _module
Pointer to the Module which shall handle this; default is NULL.
OBJ_TYPE_POINTER _outputObj
Smart pointer to the OBJ_TYPE created and wrapped by this class if an output connector is created.
MLint _numAddInputBaseFieldCalls
Counter for the number of addInputBaseField method calls.
Helper class to have a common base class for all derived wrapper.
VTKWrapperBase()
Private on purpose to avoid instantiations.
ML_ABSTRACT_CLASS_HEADER(VTKWrapperBase)
Register this class abstractly.
Link structure between names and superclass names.
const WrapperSuperStructPtrs *const parentSuperStruct
Pointer to the WrapperSuperStructPtrs of the parent class.
const std::string *const nameStrings
Pointer to the type name and parent type name strings.
WrapperSuperStructPtrs(const std::string *const nameStringsArg, const WrapperSuperStructPtrs *const pSSArgs)
Default constructor.
#define ML_BASE_IS_A(base, type)
This file defines macros, which are inserted in classes to declare and implement additional class mem...
#define ML_BAD_POINTER_OR_0
A pointer is NULL or a value is NULL or 0 where it should not be; this sometimes indicates a memory a...
#define ML_BAD_STATE
The current state of an object is not appropriate for an operation; perhaps it is not initialized or ...
#define ML_PRINT_ERROR(FUNC_NAME, REASON, HANDLING)
Like ML_PRINT_ERROR_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ) without a runtime object to be dumped.
#define MLVTK_SUPPORT_EXPORT
When included by other libraries MLVTK_SUPPORT_EXPORT is compiled as import symbol.
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...