Mundy: Multibody Nonlocal Dynamics Version of the Day
Loading...
Searching...
No Matches
mundy::runtime_aggregate< VariantType > Class Template Reference

A runtime_aggregate: A bag of runtime tagged variants or, In other words, an unordered map of variants indexed by tag string. More...

#include <aggregate.hpp>

Public Types

using variant_t = VariantType

Public Member Functions

Constructors
 runtime_aggregate ()=default
 Default constructor.
 runtime_aggregate (const runtime_aggregate &)=default
 Default copy/move/assign constructors.
 runtime_aggregate (runtime_aggregate &&)=default
runtime_aggregateoperator= (const runtime_aggregate &)=default
runtime_aggregateoperator= (runtime_aggregate &&)=default
runtime_aggregate< VariantType > & append (const std::string &tag, variant_t new_component)
 Add a value (fluent interface):
const variant_tget (const std::string &tag) const
 Fetch the value corresponding to the given Tag.
variant_tget (const std::string &tag)
bool has (const std::string &tag) const
 Check if we have a value with the given Tag.
size_t size () const
 Get the number of components in this runtime_aggregate.

Public Attributes

Private members (no touch)
std::map< std::string, variant_tcomponent_map_

Detailed Description

template<typename VariantType>
class mundy::runtime_aggregate< VariantType >

Construct an runtime_aggregate via a fluent interface:

using VariantType = variant<Type1, Type2, Type3>;
.append("Tag1", variant_component1)
.append("Tag2", variant_component2);
auto make_runtime_aggregate()
Canonical way to construct a runtime_aggregate.
Definition aggregate.hpp:287
Definition variant.hpp:44

Member Typedef Documentation

◆ variant_t

template<typename VariantType>
using mundy::runtime_aggregate< VariantType >::variant_t = VariantType

Constructor & Destructor Documentation

◆ runtime_aggregate() [1/3]

template<typename VariantType>
mundy::runtime_aggregate< VariantType >::runtime_aggregate ( )
default

◆ runtime_aggregate() [2/3]

template<typename VariantType>
mundy::runtime_aggregate< VariantType >::runtime_aggregate ( const runtime_aggregate< VariantType > & )
default

◆ runtime_aggregate() [3/3]

template<typename VariantType>
mundy::runtime_aggregate< VariantType >::runtime_aggregate ( runtime_aggregate< VariantType > && )
default

Member Function Documentation

◆ operator=() [1/2]

template<typename VariantType>
runtime_aggregate & mundy::runtime_aggregate< VariantType >::operator= ( const runtime_aggregate< VariantType > & )
default

◆ operator=() [2/2]

template<typename VariantType>
runtime_aggregate & mundy::runtime_aggregate< VariantType >::operator= ( runtime_aggregate< VariantType > && )
default

◆ append()

template<typename VariantType>
runtime_aggregate< VariantType > & mundy::runtime_aggregate< VariantType >::append ( const std::string & tag,
variant_t new_component )
inline

◆ get() [1/2]

template<typename VariantType>
const variant_t & mundy::runtime_aggregate< VariantType >::get ( const std::string & tag) const
inline

◆ get() [2/2]

template<typename VariantType>
variant_t & mundy::runtime_aggregate< VariantType >::get ( const std::string & tag)
inline

◆ has()

template<typename VariantType>
bool mundy::runtime_aggregate< VariantType >::has ( const std::string & tag) const
inline

◆ size()

template<typename VariantType>
size_t mundy::runtime_aggregate< VariantType >::size ( ) const
inline

Member Data Documentation

◆ component_map_

template<typename VariantType>
std::map<std::string, variant_t> mundy::runtime_aggregate< VariantType >::component_map_