cgv
Loading...
Searching...
No Matches
cgv::data::object_registry< T > Class Template Reference

An object registry allows registering and querying objects identified by a unique name. More...

#include <object_registry.h>

Public Types

using entry_type = std::pair< std::string, T >
 
using const_iterator = typename std::vector< entry_type >::const_iterator
 
using const_reverse_iterator = typename std::vector< entry_type >::const_reverse_iterator
 

Public Member Functions

size_t size () const
 
bool empty () const
 
const T & get (size_t index) const
 
std::string get_name (size_t index) const
 
std::vector< std::string > get_names () const
 
bool add (const std::string &name, const T &object)
 
void clear ()
 
const_iterator begin () const noexcept
 
const_iterator end () const noexcept
 
const_reverse_iterator rbegin () const noexcept
 
const_reverse_iterator rend () const noexcept
 
const_iterator cbegin () const noexcept
 
const_iterator cend () const noexcept
 
const_reverse_iterator crbegin () const noexcept
 
const_reverse_iterator crend () const noexcept
 
const_iterator find (const std::string &name) const
 
template<typename UnaryPredicate >
const_iterator find_first (UnaryPredicate predicate) const
 
template<typename UnaryPredicate >
std::vector< const_iterator > find_all (UnaryPredicate predicate) const
 

Detailed Description

template<typename T>
class cgv::data::object_registry< T >

An object registry allows registering and querying objects identified by a unique name.

Objects can be retrieved using their name or index. The order of registration defines the order of the objects in the registry.

Template Parameters
Tthe object type.

Definition at line 17 of file object_registry.h.

Member Typedef Documentation

◆ const_iterator

template<typename T >
using cgv::data::object_registry< T >::const_iterator = typename std::vector<entry_type>::const_iterator

Definition at line 20 of file object_registry.h.

◆ const_reverse_iterator

template<typename T >
using cgv::data::object_registry< T >::const_reverse_iterator = typename std::vector<entry_type>::const_reverse_iterator

Definition at line 21 of file object_registry.h.

◆ entry_type

template<typename T >
using cgv::data::object_registry< T >::entry_type = std::pair<std::string, T>

Definition at line 19 of file object_registry.h.

Member Function Documentation

◆ add()

template<typename T >
bool cgv::data::object_registry< T >::add ( const std::string &  name,
const T &  object 
)
inline

Definition at line 46 of file object_registry.h.

◆ begin()

template<typename T >
const_iterator cgv::data::object_registry< T >::begin ( ) const
inlinenoexcept

Definition at line 60 of file object_registry.h.

◆ cbegin()

template<typename T >
const_iterator cgv::data::object_registry< T >::cbegin ( ) const
inlinenoexcept

Definition at line 76 of file object_registry.h.

◆ cend()

template<typename T >
const_iterator cgv::data::object_registry< T >::cend ( ) const
inlinenoexcept

Definition at line 80 of file object_registry.h.

◆ clear()

template<typename T >
void cgv::data::object_registry< T >::clear ( )
inline

Definition at line 55 of file object_registry.h.

◆ crbegin()

template<typename T >
const_reverse_iterator cgv::data::object_registry< T >::crbegin ( ) const
inlinenoexcept

Definition at line 84 of file object_registry.h.

◆ crend()

template<typename T >
const_reverse_iterator cgv::data::object_registry< T >::crend ( ) const
inlinenoexcept

Definition at line 88 of file object_registry.h.

◆ empty()

template<typename T >
bool cgv::data::object_registry< T >::empty ( ) const
inline

Definition at line 27 of file object_registry.h.

◆ end()

template<typename T >
const_iterator cgv::data::object_registry< T >::end ( ) const
inlinenoexcept

Definition at line 64 of file object_registry.h.

◆ find()

template<typename T >
const_iterator cgv::data::object_registry< T >::find ( const std::string &  name) const
inline

Definition at line 92 of file object_registry.h.

◆ find_all()

template<typename T >
template<typename UnaryPredicate >
std::vector< const_iterator > cgv::data::object_registry< T >::find_all ( UnaryPredicate  predicate) const
inline

Definition at line 109 of file object_registry.h.

◆ find_first()

template<typename T >
template<typename UnaryPredicate >
const_iterator cgv::data::object_registry< T >::find_first ( UnaryPredicate  predicate) const
inline

Definition at line 100 of file object_registry.h.

◆ get()

template<typename T >
const T & cgv::data::object_registry< T >::get ( size_t  index) const
inline

Definition at line 31 of file object_registry.h.

◆ get_name()

template<typename T >
std::string cgv::data::object_registry< T >::get_name ( size_t  index) const
inline

Definition at line 35 of file object_registry.h.

◆ get_names()

template<typename T >
std::vector< std::string > cgv::data::object_registry< T >::get_names ( ) const
inline

Definition at line 39 of file object_registry.h.

◆ rbegin()

template<typename T >
const_reverse_iterator cgv::data::object_registry< T >::rbegin ( ) const
inlinenoexcept

Definition at line 68 of file object_registry.h.

◆ rend()

template<typename T >
const_reverse_iterator cgv::data::object_registry< T >::rend ( ) const
inlinenoexcept

Definition at line 72 of file object_registry.h.

◆ size()

template<typename T >
size_t cgv::data::object_registry< T >::size ( ) const
inline

Definition at line 23 of file object_registry.h.


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