rippled
Classes | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
ripple::KnownFormats< KeyType > Class Template Reference

Manages a list of known formats. More...

Collaboration diagram for ripple::KnownFormats< KeyType >:
Collaboration graph
[legend]

Classes

class  Item
 A known format. More...
 

Public Member Functions

 KnownFormats ()=default
 Create the known formats object. More...
 
virtual ~KnownFormats ()=default
 Destroy the known formats object. More...
 
 KnownFormats (KnownFormats const &)=delete
 
KnownFormatsoperator= (KnownFormats const &)=delete
 
KeyType findTypeByName (std::string const &name) const
 Retrieve the type for a format specified by name. More...
 
Item const * findByType (KeyType type) const
 Retrieve a format based on its type. More...
 
std::forward_list< Item >::const_iterator begin () const
 
std::forward_list< Item >::const_iterator end () const
 

Protected Member Functions

Item const * findByName (std::string const &name) const
 Retrieve a format based on its name. More...
 
Item const & add (char const *name, KeyType type, std::initializer_list< SOElement > uniqueFields, std::initializer_list< SOElement > commonFields={})
 Add a new format. More...
 

Private Attributes

std::forward_list< Itemformats_
 
boost::container::flat_map< std::string, Item const * > names_
 
boost::container::flat_map< KeyType, Item const * > types_
 

Detailed Description

template<class KeyType>
class ripple::KnownFormats< KeyType >

Manages a list of known formats.

Each format has a name, an associated KeyType (typically an enumeration), and a predefined SOElement.

Template Parameters
KeyTypeThe type of key identifying the format.

Definition at line 39 of file KnownFormats.h.

Constructor & Destructor Documentation

◆ KnownFormats() [1/2]

template<class KeyType >
ripple::KnownFormats< KeyType >::KnownFormats ( )
default

Create the known formats object.

Derived classes will load the object with all the known formats.

◆ ~KnownFormats()

template<class KeyType >
virtual ripple::KnownFormats< KeyType >::~KnownFormats ( )
virtualdefault

Destroy the known formats object.

The defined formats are deleted.

◆ KnownFormats() [2/2]

template<class KeyType >
ripple::KnownFormats< KeyType >::KnownFormats ( KnownFormats< KeyType > const &  )
delete

Member Function Documentation

◆ operator=()

template<class KeyType >
KnownFormats& ripple::KnownFormats< KeyType >::operator= ( KnownFormats< KeyType > const &  )
delete

◆ findTypeByName()

template<class KeyType >
KeyType ripple::KnownFormats< KeyType >::findTypeByName ( std::string const &  name) const

Retrieve the type for a format specified by name.

If the format name is unknown, an exception is thrown.

Parameters
nameThe name of the type.
Returns
The type.

Definition at line 112 of file KnownFormats.h.

◆ findByType()

template<class KeyType >
Item const* ripple::KnownFormats< KeyType >::findByType ( KeyType  type) const

Retrieve a format based on its type.

Definition at line 125 of file KnownFormats.h.

◆ begin()

template<class KeyType >
std::forward_list<Item>::const_iterator ripple::KnownFormats< KeyType >::begin ( ) const

Definition at line 135 of file KnownFormats.h.

◆ end()

template<class KeyType >
std::forward_list<Item>::const_iterator ripple::KnownFormats< KeyType >::end ( ) const

Definition at line 141 of file KnownFormats.h.

◆ findByName()

template<class KeyType >
Item const* ripple::KnownFormats< KeyType >::findByName ( std::string const &  name) const
protected

Retrieve a format based on its name.

Definition at line 150 of file KnownFormats.h.

◆ add()

template<class KeyType >
Item const& ripple::KnownFormats< KeyType >::add ( char const *  name,
KeyType  type,
std::initializer_list< SOElement uniqueFields,
std::initializer_list< SOElement commonFields = {} 
)
protected

Add a new format.

Parameters
nameThe name of this format.
typeThe type of this format.
uniqueFieldsAn std::initializer_list of unique fields
commonFieldsAn std::initializer_list of common fields
Returns
The created format.

Definition at line 168 of file KnownFormats.h.

Member Data Documentation

◆ formats_

template<class KeyType >
std::forward_list<Item> ripple::KnownFormats< KeyType >::formats_
private

Definition at line 186 of file KnownFormats.h.

◆ names_

template<class KeyType >
boost::container::flat_map<std::string, Item const*> ripple::KnownFormats< KeyType >::names_
private

Definition at line 188 of file KnownFormats.h.

◆ types_

template<class KeyType >
boost::container::flat_map<KeyType, Item const*> ripple::KnownFormats< KeyType >::types_
private

Definition at line 189 of file KnownFormats.h.