Dev Essential
Loading...
Searching...
No Matches
ddl::utility::TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS > Class Template Reference

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

#include <access_vector.h>

Inherits TypeAccessVectorObserver< DDL_TYPE_TO_ACCESS >.

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::vector< 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 TypeAccessVectorObserver< DDL_TYPE_TO_ACCESS > parent_type
 local definition of the parent type to register observer
 
typedef TypeAccessVectorSubject< DDL_TYPE_TO_ACCESS > observer_subject_type
 local definition of the internal subject type
 
typedef observer_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 Member Functions

 TypeAccessVector ()=delete
 no default CTOR!
 
 TypeAccessVector (TYPE_VALIDATOR_CLASS *validator, const std::string &validation_info)
 CTOR.
 
virtual ~TypeAccessVector ()
 DTOR.
 
 TypeAccessVector (TypeAccessVector &&other)
 move CTOR
 
TypeAccessVectoroperator= (TypeAccessVector &&other)
 move assignment operator
 
 TypeAccessVector (const TypeAccessVector &other)
 copies (deepcopy!) CTOR
 
TypeAccessVectoroperator= (const TypeAccessVector &other)
 copies (deepcopy!) and overwrite the current content.
 
std::shared_ptr< const DDL_TYPE_TO_ACCESS > get (size_t index) const
 get the item with the given index
 
void add (const DDL_TYPE_TO_ACCESS &type_to_add)
 adds the given item
 
void insert (const size_t pos_idx, const DDL_TYPE_TO_ACCESS &type_to_add)
 inserts the given item at the given pos
 
void emplace (DDL_TYPE_TO_ACCESS &&type_to_add)
 emplace the given item
 
void remove (size_t index)
 item to remove
 
std::shared_ptr< DDL_TYPE_TO_ACCESS > access (size_t index)
 change access to an item
 
size_t getSize () const
 Get the Size.
 
iterator begin ()
 the range based begin iterator
 
iterator end ()
 the range based end iterator
 
const_iterator cbegin () const
 const begin iterator access
 
const_iterator cend () const
 const end iterator access
 
const_iterator begin () const
 range based begin operator for const access
 
const_iterator end () const
 range based end operator for const access
 
bool operator== (const TypeAccessVector &other) const
 equality operator.
 
bool operator!= (const TypeAccessVector &other) const
 non equality operator.
 
void clear ()
 clears the list and remove this as observer
 
void popBack ()
 removes the last element if exists.
 
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
 

Detailed Description

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

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

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

Constructor & Destructor Documentation

◆ TypeAccessVector() [1/2]

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

CTOR.

Parameters
validatorthe validator for name check!
validation_infoinfo for errors

◆ TypeAccessVector() [2/2]

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
ddl::utility::TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::TypeAccessVector ( const TypeAccessVector< 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::utility::TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::access ( size_t index)
inline

change access to an item

Parameters
indexthe item index
Returns
std::shared_ptr<DDL_TYPE_TO_ACCESS>

◆ add()

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
void ddl::utility::TypeAccessVector< 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::utility::TypeAccessVector< 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::utility::TypeAccessVector< 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::utility::TypeAccessVector< 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::utility::TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::cend ( ) const
inline

const end iterator access

Returns
const_iterator

◆ emplace()

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

emplace 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::utility::TypeAccessVector< 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::utility::TypeAccessVector< 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::utility::TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::get ( size_t index) const
inline

get the item with the given index

Parameters
indexthe 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::utility::TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::getSize ( ) const
inline

Get the Size.

Returns
size_t

◆ insert()

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
void ddl::utility::TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::insert ( const size_t pos_idx,
const DDL_TYPE_TO_ACCESS & type_to_add )
inline

inserts the given item at the given pos

Parameters
type_to_addthe item to insert
pos_idxthe pos where to insert the item
Exceptions
throwsif a item with that name already exists, or the pos_idx is invalid or out of range

◆ modelChanged()

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

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)

◆ operator!=()

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

non equality operator.

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

◆ operator=() [1/2]

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

copies (deepcopy!) and overwrite the current content.

Parameters
otherthe other list
Returns
TypeAccessList&

◆ operator=() [2/2]

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

move assignment operator

Returns
TypeAccessList&

◆ operator==()

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

equality operator.

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

◆ popBack()

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
void ddl::utility::TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::popBack ( )
inline

removes the last element if exists.

Exceptions
ddl::dd::Errorif it is empty.

◆ remove()

template<typename DDL_TYPE_TO_ACCESS, typename TYPE_VALIDATOR_CLASS>
void ddl::utility::TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::remove ( size_t index)
inline

item to remove

Parameters
indexthe item index to remove

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