ADTF
TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >

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

Inheritance diagram for TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >:
[legend]

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 Types inherited from ModelObserverUtility< MODEL_SUBJECT_T, EVENT_CODE_T >
typedef EVENT_CODE_T event_code_type
 local definition of the event code type
 
typedef MODEL_SUBJECT_T subject_type
 local definition of the subject code type
 

Public Member Functions

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

Public Attributes

friend TYPE_VALIDATOR_CLASS
 friend validator class
 

Private Member Functions

void deepCopy (TypeAccessVector &destination, TYPE_VALIDATOR_CLASS *validator) const
 copies the content of the of the list (by reseting the observer) and resets the validator to the given one. More...
 
void setValidator (TYPE_VALIDATOR_CLASS *validator)
 

Private Attributes

container_type _types
 
TYPE_VALIDATOR_CLASS_validator = {}
 
std::string _validation_info
 

Additional Inherited Members

- Protected Member Functions inherited from ModelObserverUtility< MODEL_SUBJECT_T, EVENT_CODE_T >
virtual ~ModelObserverUtility ()
 protected DTOR
 

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

Definition at line 83 of file access_vector.h.

Constructor & Destructor Documentation

◆ TypeAccessVector() [1/2]

TypeAccessVector ( TYPE_VALIDATOR_CLASS validator,
const std::string &  validation_info 
)
inline

CTOR.

Parameters
validatorthe validator for name check!
validation_infoinfo for errors

Definition at line 120 of file access_vector.h.

◆ TypeAccessVector() [2/2]

TypeAccessVector ( const TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS > &  other)
inline

copies (deepcopy!) CTOR

Parameters
otherthe other list

Definition at line 166 of file access_vector.h.

Member Function Documentation

◆ access()

std::shared_ptr<DDL_TYPE_TO_ACCESS> access ( size_t  index)
inline

change access to an item

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

Definition at line 332 of file access_vector.h.

◆ add()

void 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

Definition at line 219 of file access_vector.h.

Referenced by TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::insert().

◆ begin() [1/2]

iterator begin ( )
inline

◆ begin() [2/2]

const_iterator begin ( ) const
inline

range based begin operator for const access

Returns
const_iterator

Definition at line 395 of file access_vector.h.

References TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::cbegin().

◆ cbegin()

const_iterator cbegin ( ) const
inline

◆ cend()

const_iterator cend ( ) const
inline

const end iterator access

Returns
const_iterator

Definition at line 385 of file access_vector.h.

Referenced by TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::end().

◆ deepCopy()

void deepCopy ( TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS > &  destination,
TYPE_VALIDATOR_CLASS validator 
) const
inlineprivate

copies the content of the of the list (by reseting the observer) and resets the validator to the given one.

Parameters
destinationthe destination list where to copy the content of this.
validatorthe validator to set in the destination!

Definition at line 500 of file access_vector.h.

◆ emplace()

void 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

Definition at line 276 of file access_vector.h.

Referenced by MappingConfigurationFromXMLFactory< DomNodeType >::createTarget().

◆ end() [1/2]

iterator end ( )
inline

the range based end iterator

Returns
iterator

Definition at line 365 of file access_vector.h.

Referenced by TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::operator==().

◆ end() [2/2]

const_iterator end ( ) const
inline

range based end operator for const access

Returns
const_iterator

Definition at line 405 of file access_vector.h.

References TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::cend().

◆ get()

std::shared_ptr<const DDL_TYPE_TO_ACCESS> 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>

Definition at line 204 of file access_vector.h.

◆ getSize()

size_t getSize ( ) const
inline

Get the Size.

Returns
size_t

Definition at line 345 of file access_vector.h.

Referenced by TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::insert().

◆ insert()

void 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

Definition at line 242 of file access_vector.h.

References TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::add(), TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::cbegin(), and TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::getSize().

◆ modelChanged()

void 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 ModelObserverUtility< MODEL_SUBJECT_T, EVENT_CODE_T >.

Definition at line 481 of file access_vector.h.

◆ operator!=()

bool 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.

Definition at line 432 of file access_vector.h.

References TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::operator==().

◆ operator=() [1/2]

TypeAccessVector& 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&

Definition at line 183 of file access_vector.h.

References TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::clear().

◆ operator=() [2/2]

TypeAccessVector& operator= ( TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS > &&  other)
inline

move assignment operator

Returns
TypeAccessList&

Definition at line 144 of file access_vector.h.

References TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::clear().

◆ operator==()

bool 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.

Definition at line 417 of file access_vector.h.

References TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::begin(), and TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::end().

Referenced by TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::operator!=().

◆ popBack()

void popBack ( )
inline

removes the last element if exists.

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

Definition at line 455 of file access_vector.h.

◆ remove()

void remove ( size_t  index)
inline

item to remove

Parameters
indexthe item index to remove

Definition at line 295 of file access_vector.h.

References TypeAccessVector< DDL_TYPE_TO_ACCESS, TYPE_VALIDATOR_CLASS >::begin().