https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | List of all members
WebServerControl::VectorValue< T, json_type > Class Template Reference

Class that stores a vector controllable value to be set. More...

#include <WebServerControl.h>

Inheritance diagram for WebServerControl::VectorValue< T, json_type >:
[legend]

Public Types

using value_type = std::vector< T >
 The underlying type of the value. More...
 

Public Member Functions

 VectorValue (const std::string &name, const std::string &type)
 
 VectorValue (const std::string &name, const std::string &type, const miniJson::Json &json_value)
 
const std::vector< T > & value () const
 
virtual void setControllableValue (WebServerControl &control) override final
 Sets the controllable value given the name and type via the controllable interface in control. More...
 
const std::string & name () const
 
const std::string & type () const
 

Static Public Member Functions

static std::vector< T > getVectorJSONValue (const miniJson::Json &json_value)
 

Detailed Description

template<typename T, miniJson::JsonType json_type>
class WebServerControl::VectorValue< T, json_type >

Class that stores a vector controllable value to be set.

Definition at line 116 of file WebServerControl.h.

Member Typedef Documentation

◆ value_type

using WebServerControl::TypedValueBase< std::vector< T > >::value_type = std::vector< T >
inherited

The underlying type of the value.

Definition at line 76 of file WebServerControl.h.

Constructor & Destructor Documentation

◆ VectorValue() [1/2]

template<typename T , miniJson::JsonType json_type>
WebServerControl::VectorValue< T, json_type >::VectorValue ( const std::string &  name,
const std::string &  type 
)
inline

Definition at line 119 of file WebServerControl.h.

120  : TypedValueBase<std::vector<T>>(name, type)
121  {
122  }

◆ VectorValue() [2/2]

template<typename T , miniJson::JsonType json_type>
WebServerControl::VectorValue< T, json_type >::VectorValue ( const std::string &  name,
const std::string &  type,
const miniJson::Json &  json_value 
)
inline

Definition at line 123 of file WebServerControl.h.

126  : TypedValueBase<std::vector<T>>(name, type, getVectorJSONValue(json_value))
127  {
128  }
static std::vector< T > getVectorJSONValue(const miniJson::Json &json_value)

Member Function Documentation

◆ getVectorJSONValue()

template<typename T , miniJson::JsonType json_type>
static std::vector<T> WebServerControl::VectorValue< T, json_type >::getVectorJSONValue ( const miniJson::Json &  json_value)
inlinestatic

Definition at line 130 of file WebServerControl.h.

131  {
132  const auto from_json_type = json_value.getType();
133  if (from_json_type != miniJson::JsonType::kArray)
134  throw ValueBase::Exception("The value '" + json_value.serialize() + "' of type " +
135  stringifyJSONType(from_json_type) + " is not an array");
136 
137  const auto & array_value = json_value.toArray();
138  std::vector<T> value(array_value.size());
139  for (const auto i : index_range(array_value))
140  value[i] = getScalarJSONValue<T, json_type>(array_value[i]);
141  return value;
142  }
static std::string stringifyJSONType(const miniJson::JsonType &json_type)
auto index_range(const T &sizable)

◆ name()

const std::string& Moose::WebServerControlTypeRegistry::ValueBase::name ( ) const
inlineinherited
Returns
The name that the value is for

Definition at line 57 of file WebServerControlTypeRegistry.h.

Referenced by WebServerControl::TypedValueBase< std::vector< T > >::setControllableValue().

57 { return _name; }
const std::string _name
The name that the value is for.

◆ setControllableValue()

virtual void WebServerControl::TypedValueBase< std::vector< T > >::setControllableValue ( WebServerControl control)
inlinefinaloverridevirtualinherited

Sets the controllable value given the name and type via the controllable interface in control.

Will broadcast the value for setting it.

Implements Moose::WebServerControlTypeRegistry::ValueBase.

Definition at line 83 of file WebServerControl.h.

84  {
85  control.comm().broadcast(_value);
86  control.setControllableValueByName<T>(name(), value());
87  }
const Parallel::Communicator & comm() const
std::vector< T > _value
The underlying value.
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
void setControllableValueByName(const std::string &name, const T &value)
Definition: Control.h:251

◆ type()

const std::string& Moose::WebServerControlTypeRegistry::ValueBase::type ( ) const
inlineinherited
Returns
The string representation of the type

Definition at line 61 of file WebServerControlTypeRegistry.h.

61 { return _type; }
const std::string _type
The string representation of the type.

◆ value()

const std::vector< T > & WebServerControl::TypedValueBase< std::vector< T > >::value ( ) const
inlineinherited
Returns
The underlying value

Definition at line 81 of file WebServerControl.h.

Referenced by WebServerControl::VectorValue< T, json_type >::getVectorJSONValue().

81 { return _value; }
std::vector< T > _value
The underlying value.

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