Reactions  0.1.2
Handling reaction trees and decays
Public Types | Public Member Functions | Protected Attributes | List of all members
reactions::database::database< Element, NameField, IdField >::cache Class Reference

Cache of elements. More...

#include <database.hpp>

Collaboration diagram for reactions::database::database< Element, NameField, IdField >::cache:
Collaboration graph
[legend]

Public Types

enum  cache_status { empty, user, full }
 Code to define the status of the cache. More...
 
using cache_type = std::vector< element_type >
 
using const_iterator_type = typename cache_type::const_iterator
 
using size_type = typename cache_type::size_type
 

Public Member Functions

 cache ()=default
 
void clear ()
 Clear the cache. More...
 
void clear_database_elements ()
 Clear the cache. More...
 
cache_status status () const
 Status of the cache. More...
 
cache_type const & elements () const
 Underlying vector of elements. More...
 
cache_typeelements ()
 Underlying vector of elements. More...
 
const_iterator_type begin () const
 Begining of the cache. More...
 
const_iterator_type end () const
 End of the cache. More...
 
const_iterator_type database_cbegin () const
 Begining of the database elements. More...
 
const_iterator_type database_cend () const
 End of the database elements. More...
 
const_iterator_type user_registered_cbegin () const
 Begining of the user-registered elements. More...
 
const_iterator_type user_registered_cend () const
 End of the user-registered elements. More...
 
size_type database_size () const
 Number of elements associated to the database. More...
 
size_type user_registered_size () const
 Number of user-registered elements. More...
 
size_type size () const
 Number of cached elements. More...
 
template<class ElementReader >
void add_database_elements (size_type n, ElementReader func)
 
template<class... Args>
element_type const & add_user_element (Args &&...args)
 Add a new element (by the user) More...
 

Protected Attributes

cache_type m_vector
 Collection of elements. More...
 
size_type m_separator = 0
 

Detailed Description

template<class Element, class NameField, class IdField>
class reactions::database::database< Element, NameField, IdField >::cache

Cache of elements.

Member Typedef Documentation

◆ cache_type

template<class Element, class NameField, class IdField>
using reactions::database::database< Element, NameField, IdField >::cache::cache_type = std::vector<element_type>

◆ const_iterator_type

template<class Element, class NameField, class IdField>
using reactions::database::database< Element, NameField, IdField >::cache::const_iterator_type = typename cache_type::const_iterator

◆ size_type

template<class Element, class NameField, class IdField>
using reactions::database::database< Element, NameField, IdField >::cache::size_type = typename cache_type::size_type

Member Enumeration Documentation

◆ cache_status

template<class Element, class NameField, class IdField>
enum reactions::database::database::cache::cache_status

Code to define the status of the cache.

Enumerator
empty 
user 
full 

Constructor & Destructor Documentation

◆ cache()

template<class Element, class NameField, class IdField>
reactions::database::database< Element, NameField, IdField >::cache::cache ( )
default

Member Function Documentation

◆ add_database_elements()

template<class Element, class NameField, class IdField>
template<class ElementReader >
void reactions::database::database< Element, NameField, IdField >::cache::add_database_elements ( size_type  n,
ElementReader  func 
)
inline

Add elements from a database by calling the given function several times

◆ add_user_element()

template<class Element, class NameField, class IdField>
template<class... Args>
element_type const& reactions::database::database< Element, NameField, IdField >::cache::add_user_element ( Args &&...  args)
inline

Add a new element (by the user)

◆ begin()

template<class Element, class NameField, class IdField>
const_iterator_type reactions::database::database< Element, NameField, IdField >::cache::begin ( ) const
inline

Begining of the cache.

◆ clear()

template<class Element, class NameField, class IdField>
void reactions::database::database< Element, NameField, IdField >::cache::clear ( )
inline

Clear the cache.

◆ clear_database_elements()

template<class Element, class NameField, class IdField>
void reactions::database::database< Element, NameField, IdField >::cache::clear_database_elements ( )
inline

Clear the cache.

◆ database_cbegin()

template<class Element, class NameField, class IdField>
const_iterator_type reactions::database::database< Element, NameField, IdField >::cache::database_cbegin ( ) const
inline

Begining of the database elements.

◆ database_cend()

template<class Element, class NameField, class IdField>
const_iterator_type reactions::database::database< Element, NameField, IdField >::cache::database_cend ( ) const
inline

End of the database elements.

◆ database_size()

template<class Element, class NameField, class IdField>
size_type reactions::database::database< Element, NameField, IdField >::cache::database_size ( ) const
inline

Number of elements associated to the database.

◆ elements() [1/2]

template<class Element, class NameField, class IdField>
cache_type const& reactions::database::database< Element, NameField, IdField >::cache::elements ( ) const
inline

Underlying vector of elements.

◆ elements() [2/2]

template<class Element, class NameField, class IdField>
cache_type& reactions::database::database< Element, NameField, IdField >::cache::elements ( )
inline

Underlying vector of elements.

◆ end()

template<class Element, class NameField, class IdField>
const_iterator_type reactions::database::database< Element, NameField, IdField >::cache::end ( ) const
inline

End of the cache.

◆ size()

template<class Element, class NameField, class IdField>
size_type reactions::database::database< Element, NameField, IdField >::cache::size ( ) const
inline

Number of cached elements.

◆ status()

template<class Element, class NameField, class IdField>
cache_status reactions::database::database< Element, NameField, IdField >::cache::status ( ) const
inline

Status of the cache.

◆ user_registered_cbegin()

template<class Element, class NameField, class IdField>
const_iterator_type reactions::database::database< Element, NameField, IdField >::cache::user_registered_cbegin ( ) const
inline

Begining of the user-registered elements.

◆ user_registered_cend()

template<class Element, class NameField, class IdField>
const_iterator_type reactions::database::database< Element, NameField, IdField >::cache::user_registered_cend ( ) const
inline

End of the user-registered elements.

◆ user_registered_size()

template<class Element, class NameField, class IdField>
size_type reactions::database::database< Element, NameField, IdField >::cache::user_registered_size ( ) const
inline

Number of user-registered elements.

Member Data Documentation

◆ m_separator

template<class Element, class NameField, class IdField>
size_type reactions::database::database< Element, NameField, IdField >::cache::m_separator = 0
protected

Index that defines elements registered by the user and those read from the database

◆ m_vector

template<class Element, class NameField, class IdField>
cache_type reactions::database::database< Element, NameField, IdField >::cache::m_vector
protected

Collection of elements.


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