www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
OutputMapWrapper< T > Class Template Reference

In newer versions of Clang calling operator[] on a map with a component that has a default constructor is an error, thus utilizing a map directly to store a MultiMooseEnum is not possible. More...

#include <AdvancedOutputUtils.h>

Public Member Functions

 OutputMapWrapper ()
 Constructor. More...
 
T & operator[] (const std::string &name)
 A map accessor that errors if the key is not found. More...
 
bool contains (const std::string &name)
 A method for testing of a key exists. More...
 
std::map< std::string, T >::iterator begin ()
 Provide iterator and find access to the underlying map data. More...
 
std::map< std::string, T >::iterator end ()
 
std::map< std::string, T >::iterator find (const std::string &name)
 
std::map< std::string, T >::const_iterator begin () const
 
std::map< std::string, T >::const_iterator end () const
 
const std::map< std::string, T >::const_iterator find (const std::string &name) const
 

Protected Attributes

std::map< std::string, T > _map
 Data storage. More...
 

Detailed Description

template<typename T>
class OutputMapWrapper< T >

In newer versions of Clang calling operator[] on a map with a component that has a default constructor is an error, thus utilizing a map directly to store a MultiMooseEnum is not possible.

This template class is a map wrapper that provides the basic map-like functionality for accessing map types with operator[] by using find internally. It also produces an error if the map key does not exists, this it provides a layer of protection not available to maps operator[] in general.

This class is used here to create two different warehouse containers below.

See also
OutputOnWarehouse OutputDataWarehouse

Definition at line 63 of file AdvancedOutputUtils.h.

Constructor & Destructor Documentation

template<typename T>
OutputMapWrapper< T >::OutputMapWrapper ( )
inline

Constructor.

Definition at line 69 of file AdvancedOutputUtils.h.

69 {};

Member Function Documentation

template<typename T>
std::map<std::string, T>::iterator OutputMapWrapper< T >::begin ( )
inline

Provide iterator and find access to the underlying map data.

Definition at line 87 of file AdvancedOutputUtils.h.

87 { return _map.begin(); }
std::map< std::string, T > _map
Data storage.
template<typename T>
std::map<std::string, T>::const_iterator OutputMapWrapper< T >::begin ( ) const
inline

Definition at line 93 of file AdvancedOutputUtils.h.

93 { return _map.begin(); }
std::map< std::string, T > _map
Data storage.
template<typename T>
bool OutputMapWrapper< T >::contains ( const std::string &  name)
inline

A method for testing of a key exists.

Definition at line 104 of file AdvancedOutputUtils.h.

Referenced by AdvancedOutput::hasOutput(), AdvancedOutput::hasOutputHelper(), AdvancedOutput::initPostprocessorOrVectorPostprocessorLists(), and AdvancedOutput::wantOutput().

104 { return find(name) != end(); }
std::map< std::string, T >::iterator end()
std::map< std::string, T >::iterator find(const std::string &name)
template<typename T>
std::map<std::string, T>::iterator OutputMapWrapper< T >::end ( )
inline

Definition at line 88 of file AdvancedOutputUtils.h.

Referenced by AdvancedOutput::wantOutput().

88 { return _map.end(); }
std::map< std::string, T > _map
Data storage.
template<typename T>
std::map<std::string, T>::const_iterator OutputMapWrapper< T >::end ( ) const
inline

Definition at line 94 of file AdvancedOutputUtils.h.

94 { return _map.end(); }
std::map< std::string, T > _map
Data storage.
template<typename T>
std::map<std::string, T>::iterator OutputMapWrapper< T >::find ( const std::string &  name)
inline

Definition at line 89 of file AdvancedOutputUtils.h.

Referenced by AdvancedOutput::wantOutput().

90  {
91  return _map.find(name);
92  }
std::map< std::string, T > _map
Data storage.
template<typename T>
const std::map<std::string, T>::const_iterator OutputMapWrapper< T >::find ( const std::string &  name) const
inline

Definition at line 95 of file AdvancedOutputUtils.h.

96  {
97  return _map.find(name);
98  }
std::map< std::string, T > _map
Data storage.
template<typename T>
T& OutputMapWrapper< T >::operator[] ( const std::string &  name)
inline

A map accessor that errors if the key is not found.

Definition at line 74 of file AdvancedOutputUtils.h.

75  {
76  // Locate the map entry, error if it is not found
77  typename std::map<std::string, T>::iterator iter = _map.find(name);
78  if (iter == _map.end())
79  mooseError("Unknown map key ", name);
80  return iter->second;
81  }
std::map< std::string, T > _map
Data storage.
void mooseError(Args &&...args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:182

Member Data Documentation

template<typename T>
std::map<std::string, T> OutputMapWrapper< T >::_map
protected

Data storage.

Definition at line 108 of file AdvancedOutputUtils.h.


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