Reference documentation for deal.II version 9.6.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
Patterns::Map Class Reference

#include <deal.II/base/patterns.h>

Inheritance diagram for Patterns::Map:

Public Types

enum  OutputStyle { Machine , Text , LaTeX }
 

Public Member Functions

 Map (const PatternBase &key_pattern, const PatternBase &value_pattern, const unsigned int min_elements=0, const unsigned int max_elements=max_int_value, const std::string &separator=",", const std::string &key_value_separator=":")
 
 Map (const Map &other)
 
virtual bool match (const std::string &test_string) const override
 
virtual std::string description (const OutputStyle style=Machine) const override
 
virtual std::unique_ptr< PatternBaseclone () const override
 
std::size_t memory_consumption () const override
 
const PatternBaseget_key_pattern () const
 
const PatternBaseget_value_pattern () const
 
const std::string & get_separator () const
 
const std::string & get_key_value_separator () const
 

Static Public Member Functions

static std::unique_ptr< Mapcreate (const std::string &description)
 
static ::ExceptionBaseExcInvalidRange (int arg1, int arg2)
 

Static Public Attributes

static const unsigned int max_int_value
 

Private Attributes

std::unique_ptr< PatternBasekey_pattern
 
std::unique_ptr< PatternBasevalue_pattern
 
const unsigned int min_elements
 
const unsigned int max_elements
 
const std::string separator
 
const std::string key_value_separator
 

Static Private Attributes

static const char * description_init = "[Map"
 

Detailed Description

This pattern matches a list of comma-separated values each of which denotes a pair of key and value. Both key and value have to match a pattern given to the constructor. For each entry of the map, parameters have to be entered in the form key: value. In other words, a map is described in the form key1: value1, key2: value2, key3: value3, .... Two constructor arguments allow to choose a delimiter between pairs other than the comma, and a delimiter between key and value other than colon.

With two additional parameters, the number of elements this list has to have can be specified. If none is specified, the map may have zero or more entries.

Definition at line 582 of file patterns.h.

Member Enumeration Documentation

◆ OutputStyle

List of possible description output formats.

Capitalization chosen for similarity to ParameterHandler::OutputStyle.

Enumerator
Machine 

Simple text suitable for machine parsing in the static public member functions for all of the built in inheriting classes.

Preferably human readable, but machine parsing is more critical.

Text 

Easily human readable plain text format suitable for plain text documentation.

LaTeX 

Easily human readable LaTeX format suitable for printing in manuals.

Definition at line 96 of file patterns.h.

Constructor & Destructor Documentation

◆ Map() [1/2]

Patterns::Map::Map ( const PatternBase & key_pattern,
const PatternBase & value_pattern,
const unsigned int min_elements = 0,
const unsigned int max_elements = max_int_value,
const std::string & separator = ",",
const std::string & key_value_separator = ":" )

Constructor. Take the given parameter as the specification of valid elements of the list.

The four other arguments can be used to denote minimal and maximal allowable lengths of the list as well as the separators used to delimit pairs of the map and the symbol used to separate keys and values.

Definition at line 839 of file patterns.cc.

◆ Map() [2/2]

Patterns::Map::Map ( const Map & other)

Copy constructor.

Definition at line 867 of file patterns.cc.

Member Function Documentation

◆ match()

bool Patterns::Map::match ( const std::string & test_string) const
overridevirtual

Return true if the string is a comma-separated list of strings each of which match the pattern given to the constructor.

Implements Patterns::PatternBase.

Definition at line 879 of file patterns.cc.

◆ description()

std::string Patterns::Map::description ( const OutputStyle style = Machine) const
overridevirtual

Return a description of the pattern that valid strings are expected to match.

Implements Patterns::PatternBase.

Definition at line 909 of file patterns.cc.

◆ clone()

std::unique_ptr< PatternBase > Patterns::Map::clone ( ) const
overridevirtual

Return a copy of the present object, which is newly allocated on the heap. Ownership of that object is transferred to the caller of this function.

Implements Patterns::PatternBase.

Definition at line 959 of file patterns.cc.

◆ create()

std::unique_ptr< Map > Patterns::Map::create ( const std::string & description)
static

Create a new object if the start of description matches description_init. Ownership of that object is transferred to the caller of this function.

Definition at line 983 of file patterns.cc.

◆ memory_consumption()

std::size_t Patterns::Map::memory_consumption ( ) const
overridevirtual

Determine an estimate for the memory consumption (in bytes) of this object.

Reimplemented from Patterns::PatternBase.

Definition at line 971 of file patterns.cc.

◆ get_key_pattern()

const PatternBase & Patterns::Map::get_key_pattern ( ) const

Return a reference to the key pattern.

Definition at line 1038 of file patterns.cc.

◆ get_value_pattern()

const PatternBase & Patterns::Map::get_value_pattern ( ) const

Return a reference to the value pattern.

Definition at line 1046 of file patterns.cc.

◆ get_separator()

const std::string & Patterns::Map::get_separator ( ) const

Return the separator of the map entries.

Definition at line 1054 of file patterns.cc.

◆ get_key_value_separator()

const std::string & Patterns::Map::get_key_value_separator ( ) const

Return the key-value separator.

Definition at line 1061 of file patterns.cc.

Member Data Documentation

◆ max_int_value

const unsigned int Patterns::Map::max_int_value
static
Initial value:
=
std::numeric_limits<unsigned int>::max()

Maximal integer value. If the numeric_limits class is available use this information to obtain the extremal values, otherwise set it so that this class understands that all values are allowed.

Definition at line 590 of file patterns.h.

◆ key_pattern

std::unique_ptr<PatternBase> Patterns::Map::key_pattern
private

Copy of the patterns that each key and each value of the map has to satisfy.

Definition at line 692 of file patterns.h.

◆ value_pattern

std::unique_ptr<PatternBase> Patterns::Map::value_pattern
private

Definition at line 693 of file patterns.h.

◆ min_elements

const unsigned int Patterns::Map::min_elements
private

Minimum number of elements the list must have.

Definition at line 698 of file patterns.h.

◆ max_elements

const unsigned int Patterns::Map::max_elements
private

Maximum number of elements the list must have.

Definition at line 703 of file patterns.h.

◆ separator

const std::string Patterns::Map::separator
private

Separator between elements of the list.

Definition at line 708 of file patterns.h.

◆ key_value_separator

const std::string Patterns::Map::key_value_separator
private

Separator between keys and values.

Definition at line 714 of file patterns.h.

◆ description_init

const char * Patterns::Map::description_init = "[Map"
staticprivate

Initial part of description

Definition at line 719 of file patterns.h.


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