MeVisLabToolboxReference
ml::CSOModificator Class Reference

Base class for performing modifications on the CSOs of a CSOList. More...

#include <CSOModificator.h>

Inheritance diagram for ml::CSOModificator:
ml::CSOGenerator ml::CSOBaseModule ml::CSOGeneratorBase ml::Module ml::FieldContainer ml::Base

List of all members.

Public Member Functions

 CSOModificator (const std::string &type="CSOModificator", int numInImages=0, int numOutImages=0)
 Standard constructor.

Protected Member Functions

virtual ~CSOModificator ()
 Standard destructor.
virtual void activateAttachments ()
 Initialize module after loading.
virtual void handleNotification (Field *field)
 Called when input changes.
virtual void reset ()
 Resets parameteres of the modificator.
virtual void process ()
 Sets up the CSOList, applies the modificator to the CSOList and notifies other modules that processing has finished.
virtual void _setupCSOList ()
 Sets the _outCSOList correctly.
virtual bool _applyModificator ()
 Applies the modification to the CSOs of the attached list.
virtual void _notifyObservers ()
 Notifies other modules that processing has finished.
bool _isInIdList (CSO *cso)
 Checks if the given CSO is in the list of IDs given by _csoIdListFld.
void _parseCSOIds (std::set< unsigned int > &ids)
 Parse the CSO id field into the given vector of ids.
void _applyChangedSettings (CSO *cso) const
 Changes the settings of the given CSO (only if _changeSettingsForModifiedCSOsFld is true).
 ML_MODULE_CLASS_HEADER (CSOModificator)

Static Protected Member Functions

static void _csoListNotifyObserverCB (void *userData, int notificationFlag)
 Can be called from anywhere from the network.

Protected Attributes

BaseField_inputCSOListFld
 The input CSOList.
BaseField_outputCSOListFld
 The filtered output CSOList.
StringField_csoIdListFld
 The list of ids of the CSOs to be transformed; if this list is empty, all CSOs are transformed.
BoolField_workDirectlyOnInputListFld
 Shall the module work directly on the input CSOList? Otherwise, it would work on a copy which is returned by the output field.
BoolField_listenToFinishingNotificationsFld
 Shall the module listen to finishing events?
BoolField_listenToSelectionNotificationsFld
 Shall the module listen to selection change notifications?
BoolField_changeSettingsForModifiedCSOsFld
 Shall the module's user settings be used for modified CSOs?
CSOList_inCSOList
 A pointer to the input CSOList.
CSOListPtr _outCSOList
 A pointer to the output CSOList.
bool _isInNotificationCB
 Locking variable for removing/adding a notification observer.
bool _isNotifyingMyself
 Is this module notifying itself? Locking variable to avoid infinite loops.
std::set< unsigned int > _parsedIDs
 The IDs of the CSOs that should be processed according to the _csoIdListFld.
bool _parsedIDsValid
 Flag that indicates if _parsedIDs is valid.
bool _didSomething
 Flag that indicates that the modificator did something (i.e. it modified the attached CSOList).
bool _outCSOListChanged
 Flag that indicates that _outCSOList has been changed and thus that _outputCSOListFld has to be updated.
bool _isOutputCSOListOwner
 Flag that indicates whether this module is the owner of the output CSO list.
bool _isWorkingDirectlyOnInputCSOList
 Flag that indicates whether this module should work on its input CSO list directly.

Detailed Description

Base class for performing modifications on the CSOs of a CSOList.

Definition at line 22 of file CSOModificator.h.


Constructor & Destructor Documentation

ml::CSOModificator::CSOModificator ( const std::string &  type = "CSOModificator",
int  numInImages = 0,
int  numOutImages = 0 
)

Standard constructor.

virtual ml::CSOModificator::~CSOModificator ( ) [protected, virtual]

Standard destructor.


Member Function Documentation

void ml::CSOModificator::_applyChangedSettings ( CSO cso) const [protected]

Changes the settings of the given CSO (only if _changeSettingsForModifiedCSOsFld is true).

virtual bool ml::CSOModificator::_applyModificator ( ) [protected, virtual]

Applies the modification to the CSOs of the attached list.

Use _outCSOList to access the CSO list that should be modified here. Typically this is the only function a derived class has to override. Return true if the modificator did something - and be sure the modificator does this even it is applied to no CSO in the list but it has been applied on the previous processing (necessary when _csoIdListFld has been set to an invalid value - see CSOAffineTransformation for example).

static void ml::CSOModificator::_csoListNotifyObserverCB ( void *  userData,
int  notificationFlag 
) [static, protected]

Can be called from anywhere from the network.

bool ml::CSOModificator::_isInIdList ( CSO cso) [protected]

Checks if the given CSO is in the list of IDs given by _csoIdListFld.

If _csoIdListFld is empty this function always returns true.

virtual void ml::CSOModificator::_notifyObservers ( ) [protected, virtual]

Notifies other modules that processing has finished.

void ml::CSOModificator::_parseCSOIds ( std::set< unsigned int > &  ids) [protected]

Parse the CSO id field into the given vector of ids.

virtual void ml::CSOModificator::_setupCSOList ( ) [protected, virtual]

Sets the _outCSOList correctly.

virtual void ml::CSOModificator::activateAttachments ( ) [protected, virtual]

Initialize module after loading.

Reimplemented from ml::CSOBaseModule.

virtual void ml::CSOModificator::handleNotification ( Field field) [protected, virtual]

Called when input changes.

Reimplemented from ml::CSOBaseModule.

ml::CSOModificator::ML_MODULE_CLASS_HEADER ( CSOModificator  ) [protected]
virtual void ml::CSOModificator::process ( ) [protected, virtual]

Sets up the CSOList, applies the modificator to the CSOList and notifies other modules that processing has finished.

Call this function in handle notification when the modificator should be applied to the CSOList. A derived module does not have to override this function.

virtual void ml::CSOModificator::reset ( ) [protected, virtual]

Resets parameteres of the modificator.


Member Data Documentation

Shall the module's user settings be used for modified CSOs?

Definition at line 87 of file CSOModificator.h.

The list of ids of the CSOs to be transformed; if this list is empty, all CSOs are transformed.

Definition at line 75 of file CSOModificator.h.

Flag that indicates that the modificator did something (i.e. it modified the attached CSOList).

Definition at line 106 of file CSOModificator.h.

A pointer to the input CSOList.

Definition at line 92 of file CSOModificator.h.

The input CSOList.

Definition at line 69 of file CSOModificator.h.

Locking variable for removing/adding a notification observer.

Definition at line 96 of file CSOModificator.h.

Is this module notifying itself? Locking variable to avoid infinite loops.

Definition at line 98 of file CSOModificator.h.

Flag that indicates whether this module is the owner of the output CSO list.

Definition at line 114 of file CSOModificator.h.

Flag that indicates whether this module should work on its input CSO list directly.

Definition at line 116 of file CSOModificator.h.

Shall the module listen to finishing events?

Definition at line 82 of file CSOModificator.h.

Shall the module listen to selection change notifications?

Definition at line 84 of file CSOModificator.h.

CSOListPtr ml::CSOModificator::_outCSOList [protected]

A pointer to the output CSOList.

Definition at line 94 of file CSOModificator.h.

Flag that indicates that _outCSOList has been changed and thus that _outputCSOListFld has to be updated.

Because ML_CHECK_NEW might assign the same memory block (i.e. the same pointer value) it is not enough to compare _outCSOList with _outputCSOListFld->getBaseValue() (see _notifyObservers()).

Definition at line 111 of file CSOModificator.h.

The filtered output CSOList.

Definition at line 71 of file CSOModificator.h.

std::set<unsigned int> ml::CSOModificator::_parsedIDs [protected]

The IDs of the CSOs that should be processed according to the _csoIdListFld.

Definition at line 101 of file CSOModificator.h.

Flag that indicates if _parsedIDs is valid.

Definition at line 103 of file CSOModificator.h.

Shall the module work directly on the input CSOList? Otherwise, it would work on a copy which is returned by the output field.

Definition at line 79 of file CSOModificator.h.


The documentation for this class was generated from the following file: