Blue Brain BioExplorer
core::BaseObject Class Reference

#include <BaseObject.h>

Inheritance diagram for core::BaseObject:

Public Types

using ModifiedCallback = std::function< void(const BaseObject &)>
 

Public Member Functions

 BaseObject ()=default
 
virtual ~BaseObject ()=default
 
 BaseObject (const BaseObject &)
 
BaseObjectoperator= (const BaseObject &rhs)
 
bool isModified () const
 
void resetModified ()
 
void markModified (const bool triggerCallback=true)
 
void onModified (const ModifiedCallback &callback)
 
void clearModifiedCallback ()
 

Protected Member Functions

template<typename T >
void _updateValue (T &member, const T &newValue, const bool triggerCallback=true)
 
template<class T >
bool _isEqual (const T &a, const T &b, typename std::enable_if< std::is_floating_point< T >::value >::type *=0)
 
template<class T >
bool _isEqual (const T &a, const T &b, typename std::enable_if<!std::is_floating_point< T >::value >::type *=0)
 

Detailed Description

Definition at line 31 of file BaseObject.h.

Member Typedef Documentation

◆ ModifiedCallback

using core::BaseObject::ModifiedCallback = std::function<void(const BaseObject&)>

Definition at line 72 of file BaseObject.h.

Constructor & Destructor Documentation

◆ BaseObject() [1/2]

core::BaseObject::BaseObject ( )
default

◆ ~BaseObject()

virtual core::BaseObject::~BaseObject ( )
virtualdefault

◆ BaseObject() [2/2]

core::BaseObject::BaseObject ( const BaseObject )
inline

Custom copy constructor to not copy changedCallback and solve non-copyable atomic modified state.

Definition at line 41 of file BaseObject.h.

Member Function Documentation

◆ _isEqual() [1/2]

template<class T >
bool core::BaseObject::_isEqual ( const T &  a,
const T &  b,
typename std::enable_if< std::is_floating_point< T >::value >::type *  = 0 
)
inlineprotected

Definition at line 97 of file BaseObject.h.

◆ _isEqual() [2/2]

template<class T >
bool core::BaseObject::_isEqual ( const T &  a,
const T &  b,
typename std::enable_if<!std::is_floating_point< T >::value >::type *  = 0 
)
inlineprotected

Definition at line 103 of file BaseObject.h.

◆ _updateValue()

template<typename T >
void core::BaseObject::_updateValue ( T &  member,
const T &  newValue,
const bool  triggerCallback = true 
)
inlineprotected

Helper function for derived classes to update a parameter and mark it modified if it has changed.

Definition at line 87 of file BaseObject.h.

◆ clearModifiedCallback()

void core::BaseObject::clearModifiedCallback ( )
inline

Definition at line 79 of file BaseObject.h.

◆ isModified()

bool core::BaseObject::isModified ( ) const
inline
Returns
true if any parameter has been modified since the last resetModified().

Definition at line 60 of file BaseObject.h.

◆ markModified()

void core::BaseObject::markModified ( const bool  triggerCallback = true)
inline

Definition at line 65 of file BaseObject.h.

◆ onModified()

void core::BaseObject::onModified ( const ModifiedCallback callback)
inline

Set a function that is called after this object has been modified.

Definition at line 77 of file BaseObject.h.

◆ operator=()

BaseObject& core::BaseObject::operator= ( const BaseObject rhs)
inline

Custom assignment operator that does not copy the changedCallback.

Definition at line 47 of file BaseObject.h.

◆ resetModified()

void core::BaseObject::resetModified ( )
inline

Reset the modified state, typically done after changes have been applied.

Definition at line 64 of file BaseObject.h.


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