Gromacs  2021-beta2-UNCHECKED
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Friends
gmx::KeyValueTreeObjectBuilder Class Reference

#include <gromacs/utility/keyvaluetreebuilder.h>

Description

Builder for KeyValueTreeObject objects.

The builder does not own the object being constructed, but instead holds a reference to an object within a tree rooted in KeyValueTreeBuilder or KeyValueTreeValueBuilder.

Public Member Functions

void addRawValue (const std::string &key, KeyValueTreeValue &&value)
 Adds a property with given key from a KeyValueTreeValue.
 
void addRawValue (const std::string &key, Any &&value)
 Adds a property with given key from a Any value.
 
template<typename T >
void addValue (const std::string &key, const T &value)
 Adds a scalar property with given key, type, and value.
 
KeyValueTreeObjectBuilder addObject (const std::string &key)
 Adds an object-valued property with given key. More...
 
KeyValueTreeArrayBuilder addArray (const std::string &key)
 Adds a generic array-valued property with given key. More...
 
template<typename T >
KeyValueTreeUniformArrayBuilder
< T > 
addUniformArray (const std::string &key)
 Adds an array-valued property with uniform value types with given key. More...
 
template<typename T >
void addUniformArray (const std::string &key, std::initializer_list< T > values)
 Adds an array-valued property with uniform value types with given key and values. More...
 
KeyValueTreeObjectArrayBuilder addObjectArray (const std::string &key)
 Adds an array-valued property with objects in the array with given key. More...
 
bool keyExists (const std::string &key) const
 Whether a property with given key exists.
 
const KeyValueTreeValue & operator[] (const std::string &key) const
 Returns value for a given key.
 
KeyValueTreeObjectBuilder getObjectBuilder (const std::string &key)
 Returns an object builder for an existing object.
 
bool objectHasDistinctProperties (const KeyValueTreeObject &obj) const
 Returns whether the given object shares any keys with this.
 
void mergeObject (KeyValueTreeObject &&obj)
 Merges properties from a given object to this. More...
 

Friends

class KeyValueTreeBuilder
 
class KeyValueTreeValueBuilder
 
class KeyValueTreeObjectArrayBuilder
 

Member Function Documentation

KeyValueTreeArrayBuilder gmx::KeyValueTreeObjectBuilder::addArray ( const std::string &  key)
inline

Adds a generic array-valued property with given key.

The array is created empty and can be built using the returned builder.

KeyValueTreeObjectBuilder gmx::KeyValueTreeObjectBuilder::addObject ( const std::string &  key)
inline

Adds an object-valued property with given key.

The object is created empty and can be built using the returned builder.

KeyValueTreeObjectArrayBuilder gmx::KeyValueTreeObjectBuilder::addObjectArray ( const std::string &  key)
inline

Adds an array-valued property with objects in the array with given key.

The array is created empty and can be built using the returned builder.

template<typename T >
KeyValueTreeUniformArrayBuilder<T> gmx::KeyValueTreeObjectBuilder::addUniformArray ( const std::string &  key)
inline

Adds an array-valued property with uniform value types with given key.

Template Parameters
TType for all values in the array.

The array is created empty and can be built using the returned builder.

template<typename T >
void gmx::KeyValueTreeObjectBuilder::addUniformArray ( const std::string &  key,
std::initializer_list< T >  values 
)
inline

Adds an array-valued property with uniform value types with given key and values.

Template Parameters
TType for all values in the array.

The array is created to contain the values from values.

void gmx::KeyValueTreeObjectBuilder::mergeObject ( KeyValueTreeObject &&  obj)
inline

Merges properties from a given object to this.

The objects should not share any keys, i.e., objectHasDistinctProperties() should return true.


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