https://mooseframework.inl.gov
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 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 101 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 104 of file WebServerControl.h.

105  : TypedValueBase<std::vector<T>>(name, type)
106  {
107  }

◆ 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 108 of file WebServerControl.h.

111  : TypedValueBase<std::vector<T>>(name, type, getVectorJSONValue(json_value))
112  {
113  }
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 115 of file WebServerControl.h.

116  {
117  const auto from_json_type = json_value.getType();
118  if (from_json_type != miniJson::JsonType::kArray)
119  throw ValueBase::Exception("The value '" + json_value.serialize() + "' of type " +
120  stringifyJSONType(from_json_type) + " is not an array");
121 
122  const auto & array_value = json_value.toArray();
123  std::vector<T> value(array_value.size());
124  for (const auto i : index_range(array_value))
125  value[i] = getScalarJSONValue<T, json_type>(array_value[i]);
126  return value;
127  }
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 55 of file WebServerControlTypeRegistry.h.

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

55 { 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 68 of file WebServerControl.h.

69  {
70  control.comm().broadcast(_value);
71  control.setControllableValueByName<T>(name(), value());
72  }
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:249

◆ type()

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

Definition at line 59 of file WebServerControlTypeRegistry.h.

59 { 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 66 of file WebServerControl.h.

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

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

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