40template <
class BASE_DERIVED_CLASS>
60 AutoUpdateModeDoNothing = 0,
67 static const char* autoUpdateModeNames[];
125 "Usage of copy constructor of CopyBase is not supported.");
136 "Usage of assignment operator of CopyBase is not supported.");
141 int _lockNotification;
180template <
class BASE_DERIVED_CLASS>
190template <
class BASE_DERIVED_CLASS>
207 _lockNotification = 0;
213template <
class BASE_DERIVED_CLASS>
221template <
class BASE_DERIVED_CLASS>
226 _fldObjectType->setStringValue(
"(NULL)");
227 _fldStatusString->setStringValue(
"No input object detected.");
233 if (!
inType || !
inType->canCreateInstance() || !
inType->isDerivedFrom(BASE_DERIVED_CLASS::getClassTypeId())) {
234 _fldObjectType->setStringValue(
"(INVALID TYPE)");
235 _fldStatusString->setStringValue(
"Error: Invalid input object type.");
239 _fldObjectType->setStringValue(
inType->getName());
240 _fldStatusString->setStringValue(
"Input Object Valid.");
247template <
class BASE_DERIVED_CLASS>
258 setNewOutputObject(
nullptr);
259 _fldUpToDate->setBoolValue(
inputObject ==
nullptr);
268 _fldUpToDate->setBoolValue(
true);
269 _fldStatusString->setStringValue(
"ok.");
276template <
class BASE_DERIVED_CLASS>
280 _fldOutputBase->setBaseValue(_outputObject);
287template <
class BASE_DERIVED_CLASS>
291 _fldOutputBase->setBaseValue(
nullptr);
293 delete _outputObject;
295 _outputObject =
nullptr;
302template <
class BASE_DERIVED_CLASS>
305 if (!_lockNotification) {
309 if (
field == _fldOutputBase) {
310 _fldUpToDate->setBoolValue(
false);
311 _fldStatusString->setStringValue(
"Output externally touched, possibly modified.");
315 if (
field == _fldInputBase) {
316 switch (_fldAutoUpdateMode->getEnumValue()) {
317 case AutoUpdateModeDoNothing:
318 checkObjectType(_fldInputBase->getBaseValue());
319 _fldUpToDate->setBoolValue(
false);
321 case AutoUpdateModeAutoClear:
322 checkObjectType(_fldInputBase->getBaseValue());
326 case AutoUpdateModeAutoUpdate:
339 if (
field == _fldClear) {
341 _fldStatusString->setStringValue(
"Output object deleted.");
342 _fldUpToDate->setBoolValue(_fldInputBase->getBaseValue() ==
nullptr);
347 if (
field == _fldUpdate) {
Field to encapsulate a pointer to an ML base object.
Class representing general ML objects that support import/export via strings (setPersistentState() an...
Field to encapsulate a boolean value.
Engine template module CopyBase to copy any Base-derived object that provides a virtual assignment op...
void copyObject()
Copies the input object to _outputObject and updates the base output.
static const char * autoUpdateModeNames[]
auto update mode enum tokens
@ AutoUpdateModeAutoUpdate
@ AutoUpdateModeAutoClear
StringField * _fldStatusString
String with object type name.
NotifyField * _fldClear
delete the output object now Also sets upToDate to (input == NULL).
BaseField * _fldInputBase
Base input.
void setNewOutputObject(BASE_DERIVED_CLASS *newOutObject)
Sets output object to newOutObject, touches the output object.
BaseField * _fldOutputBase
Base output.
Base * _outputObject
Copied object:
BoolField * _fldUpToDate
Is the current output update consistent with the input object? Becomes false if the input or output o...
void deleteObject()
Deletes the output object.
NotifyField * _fldUpdate
Delete output object, then update output object and set upToDateFld to true.
const RuntimeType * checkObjectType(const Base *inputObject) const
Returns the ml-runtime type of the input object if valid, NULL otherwise.
void handleNotification(Field *field) override
handle field changes
~CopyBase() override
Destructor, deleting the _outputObject.
StringField * _fldObjectType
String with object type name.
EnumField * _fldAutoUpdateMode
Possible actions at input touch: DoNothing, AutoClear, AutoUpdate.
Engine module class for copying ListBase derived classes, which is ok because lists have an assignmen...
Base class for all ML Engines which are derived from Module, which have no inputs or outputs and whic...
Field to encapsulate an enumerated value.
EnumField * addEnum(const char *name, const char *const *enumerationItemNames, MLint numEnumerationItems)
Creates an EnumField field with name and adds it to the container.
BaseField * addBase(const char *name)
Creates a Base field with name and adds it to the container. Default value is NULL.
BoolField * addBool(const char *name)
Creates a BoolField with name and adds it to the container. Default value is false.
NotifyField * addNotify(const char *name)
Creates a NotifyField field with name and adds it to the container.
StringField * addString(const char *name)
Creates a StringField with name and adds it to the container. Default value is empty string.
Base class for all fields used in the ML.
Field without value for notifications.
RuntimeType contains type and inheritance information of a class and a static dictionary with informa...
Field to encapsulate a string value.
#define ML_MODULE_CLASS_HEADER(className)
Like ML_CLASS_HEADER for the usage of derived classes from Module.
#define ML_PROGRAMMING_ERROR
A case occurred which should not appear and here are a variety of reasons, typically it is a programm...
#define ML_BAD_PARAMETER
A bad/invalid parameter (or even an inappropriate image) has been passed to a module or an algorithm;...
#define ML_PRINT_FATAL_ERROR(FUNC_NAME, REASON, HANDLING)
Like ML_PRINT_FATAL_ERROR_DUMP(FUNC_NAME, REASON, HANDLING, RT_OBJ) without a runtime object to be du...
#define MLBASEEXPORT
defined Header file mlBaseInit.h
Target mlrange_cast(Source arg)
Generic version of checked ML casts.