www.mooseframework.org
Public Member Functions | Protected Attributes | Friends | List of all members
MooseObjectParameterName Class Reference

A class for storing an input parameter name. More...

#include <MooseObjectParameterName.h>

Inheritance diagram for MooseObjectParameterName:
[legend]

Public Member Functions

 MooseObjectParameterName (std::string name)
 Build an object given a raw parameter name (e.g., from an input file parameter) More...
 
 MooseObjectParameterName (const MooseObjectName &obj_name, const std::string &param)
 Build an object given a MooseObjectName and parameter name. More...
 
 MooseObjectParameterName (const std::string &tag, const std::string &name, const std::string &param, const std::string &separator=std::string("/"))
 Build an object given a tag, object name, and parameter name. More...
 
 MooseObjectParameterName (const MooseObjectParameterName &rhs)
 
const std::string & parameter () const
 Return the parameter name. More...
 
virtual void check () final
 Adds the parameter name to error checking. More...
 
const std::string & name () const
 Return the name. More...
 
const std::string & tag () const
 Return the tag. More...
 
bool operator== (const MooseObjectParameterName &rhs) const
 Comparison operators. More...
 
bool operator== (const MooseObjectName &rhs) const
 
bool operator!= (const MooseObjectParameterName &rhs) const
 
bool operator!= (const MooseObjectName &rhs) const
 
bool operator< (const MooseObjectParameterName &rhs) const
 
bool operator< (const MooseObjectName &rhs) const
 

Protected Attributes

std::string _parameter
 The name of the input parameter. More...
 
std::string _tag
 
std::string _name
 
std::string _combined
 
std::string _separator
 

Friends

std::ostream & operator<< (std::ostream &stream, const MooseObjectParameterName &obj)
 

Detailed Description

A class for storing an input parameter name.

This class is used by the Control logic system, allowing for multiple tags to be applied to many different MooseObject parameters.

This class simply adds a third field (parameter name) to the MooseObjectName class.

Definition at line 26 of file MooseObjectParameterName.h.

Constructor & Destructor Documentation

◆ MooseObjectParameterName() [1/4]

MooseObjectParameterName::MooseObjectParameterName ( std::string  name)

Build an object given a raw parameter name (e.g., from an input file parameter)

Definition at line 39 of file MooseObjectParameterName.C.

39  : MooseObjectName()
40 {
41  // The tag precedes the :: (this is used in _moose_base::name and control_tag::name conventions)
42  std::size_t idx = name.find("::");
43  if (idx != std::string::npos)
44  {
45  _tag = name.substr(0, idx);
46  name.erase(0, idx + 2);
47  _separator = "::";
48  }
49 
50  // Locate the param name
51  idx = name.rfind("/");
52  if (idx != std::string::npos)
53  {
54  _parameter = name.substr(idx + 1);
55  name.erase(idx);
56  }
57  else // if a slash isn't located then the entire name must be the parameter
58  {
59  _parameter = name;
60  name.erase();
61  }
62 
63  // If there is a second slash, there is a syntax based tag: tag/object_name/param
64  idx = name.rfind("/");
65  if (idx != std::string::npos)
66  {
67  _name = name.substr(idx + 1);
68  name.erase(idx);
69  _tag = name;
70  }
71 
72  // If content still exists in "name", then this must be the object name
73  if (_name.empty() && !name.empty())
74  _name = name;
75 
76  // Set the combined name for sorting
78 }
const std::string & name() const
Return the name.
std::string _combined
std::string _tag
std::string _parameter
The name of the input parameter.
std::string _name
MooseObjectName()
A constructor for use by MooseObjectParameterName.
std::string _separator
unsigned int idx(const ElemType type, const unsigned int nx, const unsigned int i, const unsigned int j)

◆ MooseObjectParameterName() [2/4]

MooseObjectParameterName::MooseObjectParameterName ( const MooseObjectName obj_name,
const std::string &  param 
)

Build an object given a MooseObjectName and parameter name.

Definition at line 17 of file MooseObjectParameterName.C.

19  : MooseObjectName(obj_name), _parameter(param)
20 {
22 }
std::string _combined
std::string _tag
std::string _parameter
The name of the input parameter.
std::string _name
MooseObjectName()
A constructor for use by MooseObjectParameterName.

◆ MooseObjectParameterName() [3/4]

MooseObjectParameterName::MooseObjectParameterName ( const std::string &  tag,
const std::string &  name,
const std::string &  param,
const std::string &  separator = std::string("/") 
)

Build an object given a tag, object name, and parameter name.

Definition at line 24 of file MooseObjectParameterName.C.

28  : MooseObjectName(tag, name, separator), _parameter(param)
29 {
31 }
const std::string & name() const
Return the name.
std::string _combined
std::string _parameter
The name of the input parameter.
MooseObjectName()
A constructor for use by MooseObjectParameterName.
const std::string & tag() const
Return the tag.

◆ MooseObjectParameterName() [4/4]

MooseObjectParameterName::MooseObjectParameterName ( const MooseObjectParameterName rhs)

Definition at line 33 of file MooseObjectParameterName.C.

35 {
37 }
std::string _combined
std::string _tag
std::string _parameter
The name of the input parameter.
std::string _name
MooseObjectName()
A constructor for use by MooseObjectParameterName.
std::string _separator

Member Function Documentation

◆ check()

void MooseObjectParameterName::check ( )
finalvirtual

Adds the parameter name to error checking.

Reimplemented from MooseObjectName.

Definition at line 127 of file MooseObjectParameterName.C.

128 {
130  if (_parameter.empty())
131  mooseError("The supplied parameter name cannot be empty, to allow for any parameter name to be "
132  "supplied use the '*' character.");
133 }
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:299
std::string _parameter
The name of the input parameter.
virtual void check()
Check that the name and tag are supplied correctly.

◆ name()

const std::string& MooseObjectName::name ( ) const
inlineinherited

◆ operator!=() [1/2]

bool MooseObjectParameterName::operator!= ( const MooseObjectParameterName rhs) const

Definition at line 96 of file MooseObjectParameterName.C.

97 {
98  return !(*this == rhs);
99 }

◆ operator!=() [2/2]

bool MooseObjectParameterName::operator!= ( const MooseObjectName rhs) const

Definition at line 102 of file MooseObjectParameterName.C.

103 {
104  return MooseObjectName::operator!=(rhs);
105 }
bool operator!=(const MooseObjectName &rhs) const

◆ operator<() [1/2]

bool MooseObjectParameterName::operator< ( const MooseObjectParameterName rhs) const

Definition at line 108 of file MooseObjectParameterName.C.

109 {
110  return (_combined < rhs._combined);
111 }
std::string _combined

◆ operator<() [2/2]

bool MooseObjectName::operator< ( const MooseObjectName rhs) const
inherited

Definition at line 79 of file MooseObjectName.C.

80 {
81  return (_combined < rhs._combined);
82 }
std::string _combined

◆ operator==() [1/2]

bool MooseObjectParameterName::operator== ( const MooseObjectParameterName rhs) const

Comparison operators.

Not that this class may be compared with MooseObjectName, this feature is used by ControlInterface.

The less than operator is required so this container can work in std::map.

See also
InputParameterWarehouse

Definition at line 81 of file MooseObjectParameterName.C.

82 {
83  if (MooseObjectName::operator==(rhs) &&
84  (_parameter == rhs._parameter || _parameter == "*" || rhs._parameter == "*"))
85  return true;
86  return false;
87 }
std::string _parameter
The name of the input parameter.

◆ operator==() [2/2]

bool MooseObjectParameterName::operator== ( const MooseObjectName rhs) const

Definition at line 90 of file MooseObjectParameterName.C.

91 {
92  return MooseObjectName::operator==(rhs);
93 }
bool operator==(const MooseObjectName &rhs) const
Comparison operators.

◆ parameter()

const std::string& MooseObjectParameterName::parameter ( ) const
inline

Return the parameter name.

Definition at line 52 of file MooseObjectParameterName.h.

52 { return _parameter; }
std::string _parameter
The name of the input parameter.

◆ tag()

const std::string& MooseObjectName::tag ( ) const
inlineinherited

Return the tag.

Definition at line 76 of file MooseObjectName.h.

76 { return _tag; }
std::string _tag

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  stream,
const MooseObjectParameterName obj 
)
friend

Definition at line 114 of file MooseObjectParameterName.C.

115 {
116  if (obj._tag.empty() && obj._name.empty())
117  return stream << obj._parameter;
118  else if (obj._tag.empty())
119  return stream << obj._name << "/" << obj._parameter;
120  else if (obj._name.empty())
121  return stream << obj._tag << obj._separator << obj._parameter;
122  else
123  return stream << obj._tag << obj._separator << obj._name << "/" << obj._parameter;
124 }
std::string _tag
if(subdm)
std::string _parameter
The name of the input parameter.
std::string _name
std::string _separator

Member Data Documentation

◆ _combined

std::string MooseObjectName::_combined
protectedinherited

◆ _name

std::string MooseObjectName::_name
protectedinherited

◆ _parameter

std::string MooseObjectParameterName::_parameter
protected

The name of the input parameter.

Definition at line 84 of file MooseObjectParameterName.h.

Referenced by check(), MooseObjectParameterName(), operator<<(), operator==(), and parameter().

◆ _separator

std::string MooseObjectName::_separator
protectedinherited

◆ _tag

std::string MooseObjectName::_tag
protectedinherited

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