58 AutoUpdateModeDoNothing = 0,
65 static const char* autoUpdateModeNames[];
120 "Usage of copy constructor of CopyBase is not supported.");
130 "Usage of assignment operator of CopyBase is not supported.");
135 int _lockNotification;
169template <
class BASE_DERIVED_CLASS>
178 , _lockNotification(1)
192 _lockNotification = 0;
205template <
class BASE_DERIVED_CLASS>
211 _fldObjectType->setStringValue(
"(NULL)");
212 _fldStatusString->setStringValue(
"No input object detected.");
218 if (!
inType || !
inType->canCreateInstance() || !
inType->isDerivedFrom(BASE_DERIVED_CLASS::getClassTypeId())) {
219 _fldObjectType->setStringValue(
"(INVALID TYPE)");
220 _fldStatusString->setStringValue(
"Error: Invalid input object type.");
224 _fldObjectType->setStringValue(
inType->getName());
225 _fldStatusString->setStringValue(
"Input Object Valid.");
242 setNewOutputObject(
nullptr);
243 _fldUpToDate->setBoolValue(
inputObject ==
nullptr);
252 _fldUpToDate->setBoolValue(
true);
253 _fldStatusString->setStringValue(
"ok.");
259template <
class BASE_DERIVED_CLASS>
263 _fldOutputBase->setBaseValue(_outputObject);
272 _fldOutputBase->setBaseValue(
nullptr);
274 delete _outputObject;
276 _outputObject =
nullptr;
285 if (!_lockNotification) {
289 if (
field == _fldOutputBase) {
290 _fldUpToDate->setBoolValue(
false);
291 _fldStatusString->setStringValue(
"Output externally touched, possibly modified.");
295 if (
field == _fldInputBase) {
296 switch (_fldAutoUpdateMode->getEnumValue()) {
297 case AutoUpdateModeDoNothing:
298 checkObjectType(_fldInputBase->getBaseValue());
299 _fldUpToDate->setBoolValue(
false);
301 case AutoUpdateModeAutoClear:
302 checkObjectType(_fldInputBase->getBaseValue());
306 case AutoUpdateModeAutoUpdate:
320 if (
field == _fldClear) {
322 _fldStatusString->setStringValue(
"Output object deleted.");
323 _fldUpToDate->setBoolValue(_fldInputBase->getBaseValue() ==
nullptr);
327 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 okay because lists have an assignm...
Base class for all ML Engines that are derived from Module, and have no inputs or outputs but impleme...
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)
Similar to ML_CLASS_HEADER for the usage of derived classes from Module.
#define ML_PROGRAMMING_ERROR
A case occurred that should not appear and there 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.