https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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 ExecFlagEnum is not possible. More...

#include <AdvancedOutputUtils.h>

Public Member Functions

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

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 ExecFlagEnum 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 60 of file AdvancedOutputUtils.h.

Constructor & Destructor Documentation

◆ OutputMapWrapper()

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

Constructor.

Definition at line 66 of file AdvancedOutputUtils.h.

66{}

Member Function Documentation

◆ begin() [1/2]

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 84 of file AdvancedOutputUtils.h.

84{ return _map.begin(); }
std::map< std::string, T > _map
Data storage.

◆ begin() [2/2]

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

Definition at line 90 of file AdvancedOutputUtils.h.

90{ return _map.begin(); }

◆ contains()

template<typename T >
bool OutputMapWrapper< T >::contains ( const std::string &  name) const
inline

A method for testing of a key exists.

Definition at line 101 of file AdvancedOutputUtils.h.

101{ return find(name) != end(); }
std::map< std::string, T >::iterator end()
std::map< std::string, T >::iterator find(const std::string &name)

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

◆ end() [1/2]

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

Definition at line 85 of file AdvancedOutputUtils.h.

85{ return _map.end(); }

Referenced by OutputMapWrapper< T >::contains(), and AdvancedOutput::wantOutput().

◆ end() [2/2]

template<typename T >
std::map< std::string, T >::const_iterator OutputMapWrapper< T >::end ( ) const
inline

Definition at line 91 of file AdvancedOutputUtils.h.

91{ return _map.end(); }

◆ find() [1/2]

template<typename T >
std::map< std::string, T >::iterator OutputMapWrapper< T >::find ( const std::string &  name)
inline

Definition at line 86 of file AdvancedOutputUtils.h.

87 {
88 return _map.find(name);
89 }

Referenced by OutputMapWrapper< T >::contains(), CSV::initialSetup(), and AdvancedOutput::wantOutput().

◆ find() [2/2]

template<typename T >
const std::map< std::string, T >::const_iterator OutputMapWrapper< T >::find ( const std::string &  name) const
inline

Definition at line 92 of file AdvancedOutputUtils.h.

93 {
94 return _map.find(name);
95 }

◆ operator[]()

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 71 of file AdvancedOutputUtils.h.

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

Member Data Documentation

◆ _map

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

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