Blue Brain BioExplorer
core::Property Struct Reference

#include <PropertyMap.h>

Collaboration diagram for core::Property:

Classes

struct  MetaData
 

Public Types

enum class  Type {
  Int , Double , String , Bool ,
  Vec2i , Vec2d , Vec3i , Vec3d ,
  Vec4d
}
 
using ModifiedCallback = std::function< void(const Property &)>
 

Public Member Functions

template<typename T >
void assertValidType () const
 
template<typename T >
void assertValidEnumType () const
 
template<typename T >
Type getType () const
 
template<typename T >
 Property (const std::string &name_, const T value, const MetaData &metaData_={})
 
template<typename T >
 Property (const std::string &name_, const T value, const T min_, const T max_, const MetaData &metaData_={})
 
template<typename T >
 Property (const std::string &name_, const T value, const std::vector< std::string > &enums_, const MetaData &metaData_)
 
 Property (Property &&other)
 
 Property (const Property &other)=default
 
void onModified (const ModifiedCallback &callback)
 
template<typename T >
void set (const T &v)
 
template<typename T >
get () const
 
template<typename T >
min () const
 
template<typename T >
max () const
 
void markReadOnly ()
 
bool readOnly () const
 

Static Public Member Functions

static Property makeReadOnly (Property property)
 

Public Attributes

const std::string name
 
const MetaData metaData
 user-friendly name and description More...
 
const Type type
 
const std::vector< std::string > enums
 

Friends

class PropertyMap
 

Detailed Description

Defines a single property which always has a name, a label for e.g. UIs and a typed value. Additionally, a user-defined minimum and maximum value range can be specified, otherwise the types' limits apply.

Definition at line 41 of file PropertyMap.h.

Member Typedef Documentation

◆ ModifiedCallback

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

Definition at line 167 of file PropertyMap.h.

Member Enumeration Documentation

◆ Type

enum core::Property::Type
strong
Enumerator
Int 
Double 
String 
Bool 
Vec2i 
Vec2d 
Vec3i 
Vec3d 
Vec4d 

Definition at line 43 of file PropertyMap.h.

Constructor & Destructor Documentation

◆ Property() [1/5]

template<typename T >
core::Property::Property ( const std::string &  name_,
const T  value,
const MetaData metaData_ = {} 
)
inline

Definition at line 113 of file PropertyMap.h.

◆ Property() [2/5]

template<typename T >
core::Property::Property ( const std::string &  name_,
const T  value,
const T  min_,
const T  max_,
const MetaData metaData_ = {} 
)
inline

Definition at line 125 of file PropertyMap.h.

◆ Property() [3/5]

template<typename T >
core::Property::Property ( const std::string &  name_,
const T  value,
const std::vector< std::string > &  enums_,
const MetaData metaData_ 
)
inline

Specialized for enum properties, the possible enum values are passed in enums_.

Definition at line 141 of file PropertyMap.h.

◆ Property() [4/5]

core::Property::Property ( Property &&  other)
inline

Definition at line 153 of file PropertyMap.h.

◆ Property() [5/5]

core::Property::Property ( const Property other)
default

Member Function Documentation

◆ assertValidEnumType()

template<typename T >
void core::Property::assertValidEnumType ( ) const
inline

Definition at line 81 of file PropertyMap.h.

◆ assertValidType()

template<typename T >
void core::Property::assertValidType ( ) const
inline

Definition at line 68 of file PropertyMap.h.

◆ get()

template<typename T >
T core::Property::get ( ) const
inline

Definition at line 183 of file PropertyMap.h.

◆ getType()

template<typename T >
Type core::Property::getType ( ) const
inline

Definition at line 87 of file PropertyMap.h.

◆ makeReadOnly()

static Property core::Property::makeReadOnly ( Property  property)
inlinestatic

Definition at line 213 of file PropertyMap.h.

◆ markReadOnly()

void core::Property::markReadOnly ( )
inline

Read-only property shall not be modified from the outside aka web API via JSON.

Definition at line 207 of file PropertyMap.h.

◆ max()

template<typename T >
T core::Property::max ( ) const
inline

Definition at line 197 of file PropertyMap.h.

◆ min()

template<typename T >
T core::Property::min ( ) const
inline

Definition at line 190 of file PropertyMap.h.

◆ onModified()

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

Set a function that is called after this property has been changed.

Definition at line 172 of file PropertyMap.h.

◆ readOnly()

bool core::Property::readOnly ( ) const
inline

Definition at line 208 of file PropertyMap.h.

◆ set()

template<typename T >
void core::Property::set ( const T &  v)
inline

Definition at line 175 of file PropertyMap.h.

Friends And Related Function Documentation

◆ PropertyMap

friend class PropertyMap
friend

Definition at line 226 of file PropertyMap.h.

Member Data Documentation

◆ enums

const std::vector<std::string> core::Property::enums

Name of enum values that are mapped to the integer value

Definition at line 223 of file PropertyMap.h.

◆ metaData

const MetaData core::Property::metaData

user-friendly name and description

Definition at line 210 of file PropertyMap.h.

◆ name

const std::string core::Property::name

Definition at line 209 of file PropertyMap.h.

◆ type

const Type core::Property::type

Definition at line 211 of file PropertyMap.h.


The documentation for this struct was generated from the following files: