ADTF
Loading...
Searching...
No Matches
ddl::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS > Class Template Reference

Utility class for observable named items where the order is NOT important. More...

#include <access_map.h>

Inherits ddl::dd::utility::ModelObserverUtility< T, TypeAccessMapEventCode >.

Public Types

typedef DDL_TYPE_TO_ACCESS access_type
 local definition of the access type
 
typedef std::shared_ptr< DDL_TYPE_TO_ACCESS > value_type
 local definition of the value type
 
typedef std::unordered_map< std::string, value_typecontainer_type
 local definition of the container type
 
typedef container_type::iterator iterator
 local definition of the container iterator
 
typedef container_type::const_iterator const_iterator
 local definition of the container const_iterator
 
typedef TypeAccessMapObserver< DDL_TYPE_TO_ACCESS > parent_type
 local definition of the parent type to register observe
 
typedef TypeAccessMapSubject< DDL_TYPE_TO_ACCESS > map_subject_type
 local definition of the internal subject type
 
typedef map_subject_type::observer_type observer_type
 local definition of the observer type
 
typedef parent_type::event_code_type event_code_type
 local definition of the eventcode type
 
typedef parent_type::subject_type subject_type
 local definition of the subject type
 
- Public Types inherited from ddl::dd::utility::ModelObserverUtility< T, TypeAccessMapEventCode >
typedef TypeAccessMapEventCode event_code_type
 local definition of the event code type
 
typedef T subject_type
 local definition of the subject code type
 
typedef TypeAccessMapEventCode event_code_type
 local definition of the event code type
 
typedef T subject_type
 local definition of the subject code type
 
typedef TypeAccessMapEventCode event_code_type
 local definition of the event code type
 
typedef T subject_type
 local definition of the subject code type
 
typedef TypeAccessMapEventCode event_code_type
 local definition of the event code type
 
typedef T subject_type
 local definition of the subject code type
 

Public Member Functions

 TypeAccessMap ()=delete
 no default CTOR!
 
 TypeAccessMap (TYPE_VALIDATOR_CLASS *validator, const std::string &validation_info)
 CTOR.
 
 TypeAccessMap (TypeAccessMap &&other)
 move CTOR
 
 TypeAccessMap (const TypeAccessMap &other)
 copies (deepcopy!) CTOR
 
virtual ~TypeAccessMap ()
 DTOR.
 
TypeAccessMapoperator= (TypeAccessMap &&other)
 move assignment operator
 
TypeAccessMapoperator= (const TypeAccessMap &other)
 copies (deepcopy!) and overwrite the current content.
 
std::shared_ptr< const DDL_TYPE_TO_ACCESS > get (const std::string &type_name) const
 get the item with the given name type_name
 
bool contains (const std::string &type_name) const
 determines is the type name exists in this map
 
bool contains (const DDL_TYPE_TO_ACCESS &type_to_find) const
 determines if the item is in this map.
 
bool contains (const TypeAccessMap &other) const
 determines if the other is a subset of this map
 
std::shared_ptr< DDL_TYPE_TO_ACCESS > create (const DDL_TYPE_TO_ACCESS &type_to_add)
 creates the given item by copy
 
std::shared_ptr< DDL_TYPE_TO_ACCESS > create (DDL_TYPE_TO_ACCESS &&type_to_add)
 creates the given item in place
 
void add (const DDL_TYPE_TO_ACCESS &type_to_add)
 adds the given item
 
void emplace (DDL_TYPE_TO_ACCESS &&type_to_add)
 emplaces the given item
 
void remove (const std::string &type_name)
 item to remove
 
std::shared_ptr< DDL_TYPE_TO_ACCESS > access (const std::string &type_name)
 change access to an item
 
size_t getSize () const
 Get the Size.
 
iterator begin ()
 the range based begin iterator
 
const_iterator begin () const
 range based begin operator for const access
 
iterator end ()
 the range based end iterator
 
const_iterator end () const
 range based end operator for const access
 
const_iterator cbegin () const
 const begin iterator access
 
const_iterator cend () const
 const end iterator access
 
bool operator== (const TypeAccessMap &other) const
 equality operator.
 
bool operator!= (const TypeAccessMap &other) const
 non equality operator.
 
void clear ()
 clears the list and remove this as observer
 
void modelChanged (event_code_type event_code, subject_type &subject_changed, const std::string &additional_info)
 overrides the observers utility function.
 

Public Attributes

friend TYPE_VALIDATOR_CLASS
 friend validator class
 

Additional Inherited Members

- Protected Member Functions inherited from ddl::dd::utility::ModelObserverUtility< T, TypeAccessMapEventCode >
virtual ~ModelObserverUtility ()
 protected DTOR
 
virtual ~ModelObserverUtility ()
 protected DTOR
 
virtual ~ModelObserverUtility ()
 protected DTOR
 
virtual ~ModelObserverUtility ()
 protected DTOR
 

Detailed Description

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
class ddl::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >

Utility class for observable named items where the order is NOT important.

Template Parameters
DDL_TYPE_TO_ACCESSthe value type
TYPE_VALIDATOR_CLASSthe validator class to inform on changes

Constructor & Destructor Documentation

◆ TypeAccessMap() [1/2]

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::TypeAccessMap ( TYPE_VALIDATOR_CLASS * validator,
const std::string & validation_info )
inline

CTOR.

Parameters
validatorthe validator for name check!
validation_infoinfo for errors

◆ TypeAccessMap() [2/2]

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::TypeAccessMap ( const TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS > & other)
inline

copies (deepcopy!) CTOR

Parameters
otherthe other list

Member Function Documentation

◆ access()

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
std::shared_ptr< DDL_TYPE_TO_ACCESS > ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::access ( const std::string & type_name)
inline

change access to an item

Parameters
type_namethe item name
Returns
std::shared_ptr<DDL_TYPE_TO_ACCESS>

◆ add()

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
void ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::add ( const DDL_TYPE_TO_ACCESS & type_to_add)
inline

adds the given item

Parameters
type_to_addthe item to add
Exceptions
throwsif a item with that name already exists

◆ begin() [1/2]

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
iterator ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::begin ( )
inline

the range based begin iterator

Returns
iterator

◆ begin() [2/2]

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
const_iterator ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::begin ( ) const
inline

range based begin operator for const access

Returns
const_iterator

◆ cbegin()

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
const_iterator ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::cbegin ( ) const
inline

const begin iterator access

Returns
const_iterator

◆ cend()

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
const_iterator ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::cend ( ) const
inline

const end iterator access

Returns
const_iterator

◆ contains() [1/3]

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
bool ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::contains ( const DDL_TYPE_TO_ACCESS & type_to_find) const
inline

determines if the item is in this map.

Parameters
type_to_findthe item to find
Returns
true the item is in this map
false the item is not in this map

◆ contains() [2/3]

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
bool ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::contains ( const std::string & type_name) const
inline

determines is the type name exists in this map

Parameters
type_namethe type name to check
Returns
true if the typename exists
false the typename does not exist

◆ contains() [3/3]

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
bool ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::contains ( const TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS > & other) const
inline

determines if the other is a subset of this map

Parameters
otherthe other map
Returns
true the other map is a subset of this
false the other is not a subset of this

◆ create() [1/2]

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
std::shared_ptr< DDL_TYPE_TO_ACCESS > ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::create ( const DDL_TYPE_TO_ACCESS & type_to_add)
inline

creates the given item by copy

Parameters
type_to_addthe item to add
Returns
shared pointer to the created element
Exceptions
throwsif a item with that name already exists

◆ create() [2/2]

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
std::shared_ptr< DDL_TYPE_TO_ACCESS > ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::create ( DDL_TYPE_TO_ACCESS && type_to_add)
inline

creates the given item in place

Parameters
type_to_addthe item to emplace
Returns
shared pointer to the created element
Exceptions
throwsif a item with that name already exists

◆ emplace()

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
void ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::emplace ( DDL_TYPE_TO_ACCESS && type_to_add)
inline

emplaces the given item

Parameters
type_to_addthe item to emplace
Exceptions
throwsif a item with that name already exists

◆ end() [1/2]

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
iterator ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::end ( )
inline

the range based end iterator

Returns
iterator

◆ end() [2/2]

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
const_iterator ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::end ( ) const
inline

range based end operator for const access

Returns
const_iterator

◆ get()

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
std::shared_ptr< const DDL_TYPE_TO_ACCESS > ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::get ( const std::string & type_name) const
inline

get the item with the given name type_name

Parameters
type_namethe item to find
Returns
std::shared_ptr<const DDL_TYPE_TO_ACCESS>

◆ getSize()

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
size_t ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::getSize ( ) const
inline

Get the Size.

Returns
size_t

◆ modelChanged()

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
void ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::modelChanged ( event_code_type event_code,
subject_type & subject_changed,
const std::string & additional_info )
inlinevirtual

overrides the observers utility function.

Parameters
event_codethe internal event_code
subject_changedthe subject (these are the items of the list)
additional_infothe additional info (if any)

Implements ddl::dd::utility::ModelObserverUtility< T, TypeAccessMapEventCode >.

◆ operator!=()

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
bool ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::operator!= ( const TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS > & other) const
inline

non equality operator.

Parameters
otherthe other TypeAccessMap to compare this map to.
Returns
false the TypeAccessMap are equal (in size and content)
true the TypeAccessMap are not equal.

◆ operator=() [1/2]

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
TypeAccessMap & ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::operator= ( const TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS > & other)
inline

copies (deepcopy!) and overwrite the current content.

Parameters
otherthe other list
Returns
TypeAccessMap&

◆ operator=() [2/2]

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
TypeAccessMap & ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::operator= ( TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS > && other)
inline

move assignment operator

Returns
TypeAccessMap&

◆ operator==()

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
bool ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::operator== ( const TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS > & other) const
inline

equality operator.

Parameters
otherthe other TypeAccessMap to compare this map to.
Returns
true the TypeAccessMap are equal (in size and content)
false the TypeAccessMap are not equal.

◆ remove()

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
void ddl::dd::utility::TypeAccessMap< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::remove ( const std::string & type_name)
inline

item to remove

Parameters
type_namethe item name to remove

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