MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
maia::io::toml::Property Class Reference

Class that represents a single key-value pair for TOML properties. More...

#include <tomlutils.h>

Collaboration diagram for maia::io::toml::Property:
[legend]

Public Member Functions

 Property ()=default
 
 Property (MString name_, std::vector< MString > data)
 
 Property (MString name_, std::vector< MInt > data)
 
 Property (MString name_, std::vector< MFloat > data)
 
 Property (MString name_, std::vector< MBool > data)
 
MString name () const
 
VariableType type () const
 
MString type2string () const
 
MLong size () const
 
MBool valid () const
 
const std::vector< MString > & asString () const
 
const std::vector< MInt > & asInt () const
 
const std::vector< MFloat > & asFloat () const
 
const std::vector< MBool > & asBool () const
 

Private Attributes

MString m_name = ""
 
VariableType m_type = MINVALID
 
MLong m_size = -1
 
std::vector< MStringm_string
 
std::vector< MIntm_int
 
std::vector< MFloatm_float
 
std::vector< MBoolm_bool
 

Detailed Description

Definition at line 69 of file tomlutils.h.

Constructor & Destructor Documentation

◆ Property() [1/5]

maia::io::toml::Property::Property ( )
default

◆ Property() [2/5]

maia::io::toml::Property::Property ( MString  name_,
std::vector< MString data 
)
inline

Definition at line 73 of file tomlutils.h.

74 : m_name(std::move(name_)), m_type(MSTRING), m_size(data.size()), m_string(std::move(data)) {}
std::vector< MString > m_string
Definition: tomlutils.h:119
@ MSTRING
Definition: enums.h:269

◆ Property() [3/5]

maia::io::toml::Property::Property ( MString  name_,
std::vector< MInt data 
)
inline

Definition at line 75 of file tomlutils.h.

76 : m_name(std::move(name_)), m_type(MINT), m_size(data.size()), m_int(std::move(data)) {}
std::vector< MInt > m_int
Definition: tomlutils.h:120
@ MINT
Definition: enums.h:269

◆ Property() [4/5]

maia::io::toml::Property::Property ( MString  name_,
std::vector< MFloat data 
)
inline

Definition at line 77 of file tomlutils.h.

78 : m_name(std::move(name_)), m_type(MFLOAT), m_size(data.size()), m_float(std::move(data)) {}
std::vector< MFloat > m_float
Definition: tomlutils.h:121
@ MFLOAT
Definition: enums.h:269

◆ Property() [5/5]

maia::io::toml::Property::Property ( MString  name_,
std::vector< MBool data 
)
inline

Definition at line 79 of file tomlutils.h.

80 : m_name(std::move(name_)), m_type(MBOOL), m_size(data.size()), m_bool(std::move(data)) {}
std::vector< MBool > m_bool
Definition: tomlutils.h:122
@ MBOOL
Definition: enums.h:269

Member Function Documentation

◆ asBool()

const std::vector< MBool > & maia::io::toml::Property::asBool ( ) const
inline

Definition at line 108 of file tomlutils.h.

108 {
109 if(type() != MBOOL) {
110 TERMM(1, "bad type");
111 }
112 return m_bool;
113 }
VariableType type() const
Definition: tomlutils.h:84

◆ asFloat()

const std::vector< MFloat > & maia::io::toml::Property::asFloat ( ) const
inline

Definition at line 102 of file tomlutils.h.

102 {
103 if(type() != MFLOAT) {
104 TERMM(1, "bad type");
105 }
106 return m_float;
107 }

◆ asInt()

const std::vector< MInt > & maia::io::toml::Property::asInt ( ) const
inline

Definition at line 96 of file tomlutils.h.

96 {
97 if(type() != MINT) {
98 TERMM(1, "bad type");
99 }
100 return m_int;
101 }

◆ asString()

const std::vector< MString > & maia::io::toml::Property::asString ( ) const
inline

Definition at line 90 of file tomlutils.h.

90 {
91 if(type() != MSTRING) {
92 TERMM(1, "bad type");
93 }
94 return m_string;
95 }

◆ name()

MString maia::io::toml::Property::name ( ) const
inline

Definition at line 83 of file tomlutils.h.

83{ return m_name; }

◆ size()

MLong maia::io::toml::Property::size ( ) const
inline

Definition at line 86 of file tomlutils.h.

86{ return m_size; }

◆ type()

VariableType maia::io::toml::Property::type ( ) const
inline

Definition at line 84 of file tomlutils.h.

84{ return m_type; }

◆ type2string()

MString maia::io::toml::Property::type2string ( ) const
inline

Definition at line 126 of file tomlutils.h.

126 {
127 switch(type()) {
128 case MSTRING:
130 case MINT:
132 case MFLOAT:
134 case MBOOL:
136 default:
137 TERMM(1, "bad value type: " + std::to_string(type()));
138 }
139}
MString name() const
Definition: tomlutils.h:83

◆ valid()

MBool maia::io::toml::Property::valid ( ) const
inline

Definition at line 87 of file tomlutils.h.

87{ return m_size != -1; }

Member Data Documentation

◆ m_bool

std::vector<MBool> maia::io::toml::Property::m_bool
private

Definition at line 122 of file tomlutils.h.

◆ m_float

std::vector<MFloat> maia::io::toml::Property::m_float
private

Definition at line 121 of file tomlutils.h.

◆ m_int

std::vector<MInt> maia::io::toml::Property::m_int
private

Definition at line 120 of file tomlutils.h.

◆ m_name

MString maia::io::toml::Property::m_name = ""
private

Definition at line 116 of file tomlutils.h.

◆ m_size

MLong maia::io::toml::Property::m_size = -1
private

Definition at line 118 of file tomlutils.h.

◆ m_string

std::vector<MString> maia::io::toml::Property::m_string
private

Definition at line 119 of file tomlutils.h.

◆ m_type

VariableType maia::io::toml::Property::m_type = MINVALID
private

Definition at line 117 of file tomlutils.h.


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