Blue Brain BioExplorer
core::PropertyObject Class Reference

#include <PropertyObject.h>

Inheritance diagram for core::PropertyObject:
Collaboration diagram for core::PropertyObject:

Public Member Functions

void setCurrentType (const std::string &type)
 
const std::string & getCurrentType () const
 
template<typename T >
void updateProperty (const std::string &name, const T &value, const bool triggerCallback=true)
 
bool hasProperty (const std::string &name) const
 
template<typename T >
getProperty (const std::string &name) const
 
template<typename T >
getPropertyOrValue (const std::string &name, T val) const
 
void setProperties (const PropertyMap &properties)
 
void setProperties (const std::string &type, const PropertyMap &properties)
 
void updateProperties (const PropertyMap &properties)
 
const auto & getPropertyMap () const
 
const auto & getPropertyMap (const std::string &type) const
 
strings getTypes () const
 
void clonePropertiesFrom (const PropertyObject &obj)
 
- Public Member Functions inherited from core::BaseObject
 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 Attributes

std::string _currentType
 
std::map< std::string, PropertyMap_properties
 

Additional Inherited Members

- Public Types inherited from core::BaseObject
using ModifiedCallback = std::function< void(const BaseObject &)>
 
- Protected Member Functions inherited from core::BaseObject
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

Maps generic properties to user-defined types/keys/names and tracks the current type/key/name for querying, setting and updating its properties.

Definition at line 36 of file PropertyObject.h.

Member Function Documentation

◆ clonePropertiesFrom()

void core::PropertyObject::clonePropertiesFrom ( const PropertyObject obj)
inline

Clear all current properties and clone new properties from object

Definition at line 124 of file PropertyObject.h.

◆ getCurrentType()

const std::string& core::PropertyObject::getCurrentType ( ) const
inline
Returns
the current set type.

Definition at line 50 of file PropertyObject.h.

◆ getProperty()

template<typename T >
T core::PropertyObject::getProperty ( const std::string &  name) const
inline
Returns
the value of the property with the given name for the current type.

Definition at line 75 of file PropertyObject.h.

◆ getPropertyMap() [1/2]

const auto& core::PropertyObject::getPropertyMap ( ) const
inline
Returns
the entire property map for the current type.

Definition at line 110 of file PropertyObject.h.

◆ getPropertyMap() [2/2]

const auto& core::PropertyObject::getPropertyMap ( const std::string &  type) const
inline
Returns
the entire property map for the given type.

Definition at line 112 of file PropertyObject.h.

◆ getPropertyOrValue()

template<typename T >
T core::PropertyObject::getPropertyOrValue ( const std::string &  name,
val 
) const
inline
Returns
the value of the property with the given name for the current type. If it does not exist return the given value.

Definition at line 85 of file PropertyObject.h.

◆ getTypes()

strings core::PropertyObject::getTypes ( ) const
inline
Returns
the list of all registered types.

Definition at line 115 of file PropertyObject.h.

◆ hasProperty()

bool core::PropertyObject::hasProperty ( const std::string &  name) const
inline
Returns
true if the property with the given name exists for the current type.

Definition at line 68 of file PropertyObject.h.

◆ setCurrentType()

void core::PropertyObject::setCurrentType ( const std::string &  type)
inline

Set the current type to use for 'type-less' queries and updates.

Definition at line 40 of file PropertyObject.h.

◆ setProperties() [1/2]

void core::PropertyObject::setProperties ( const PropertyMap properties)
inline

Assign a new set of properties to the current type.

Definition at line 91 of file PropertyObject.h.

◆ setProperties() [2/2]

void core::PropertyObject::setProperties ( const std::string &  type,
const PropertyMap properties 
)
inline

Assign a new set of properties to the given type.

Definition at line 94 of file PropertyObject.h.

◆ updateProperties()

void core::PropertyObject::updateProperties ( const PropertyMap properties)
inline

Update or add all the properties from the given map to the current type.

Definition at line 103 of file PropertyObject.h.

◆ updateProperty()

template<typename T >
void core::PropertyObject::updateProperty ( const std::string &  name,
const T &  value,
const bool  triggerCallback = true 
)
inline

Update the value of the given property for the current type.

Definition at line 53 of file PropertyObject.h.

Member Data Documentation

◆ _currentType

std::string core::PropertyObject::_currentType
protected

Definition at line 142 of file PropertyObject.h.

◆ _properties

std::map<std::string, PropertyMap> core::PropertyObject::_properties
protected

Definition at line 143 of file PropertyObject.h.


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