47 template <
typename T,
int x=-1,
int y=-1>
85 virtual void read(
void) = 0;
217template<
typename T,
int x,
int y>
218SOIL::Figure<T, x, y>::Figure(std::shared_ptr<Element> parent, std::string uuid, std::string name, std::string description, std::string unit, std::string ontology,
Range<T> range,
SOIL::TIME time) :
SOIL::
Element(parent, uuid, name, description, ontology), unit(unit), range(range), time(time)
222template<
typename T,
int x,
int y>
228template<
typename T,
int x,
int y>
232 std::unique_lock<std::recursive_mutex> lock(mutex);
234 json_root[U(
"timestamp"] = (time.
is_null() || time.
rfc3339() ==
"")) ? HTTP::Json::null() : HTTP::Json::string(utility::conversions::to_string_t(time.
rfc3339()));
235 json_root[U(
"range")] = range.
wjson();
236 json_root[U(
"unit")] = (unit.length() == 0) ? HTTP::Json::null() :
SOIL::to_json(unit);
239 json_root[U(
"value")] = value_json[U(
"value")];
240 json_root[U(
"dimension")] = value_json[U(
"dimension")];
241 json_root[U(
"datatype")] = datatype<T>();
247template<
typename T,
int x,
int y>
253template<
typename T,
int x,
int y>
258template<
typename T,
int x,
int y>
261 if (!check_range(value))
263 throw std::range_error(
"Value is out of range specified for Figure " + uuid);
270template<
typename T,
int x,
int y>
277template<
typename T,
int x,
int y>
283template<
typename T,
int x,
int y>
290template<
typename T,
int x,
int y>
297template<
typename T,
int x,
int y>
300 if (!check_range(value))
302 throw std::range_error(
"Value is out of range specified for Figure " + uuid);
307template<
typename T,
int x,
int y>
310 std::unique_lock<std::recursive_mutex> lock(mutex);
311 if (!check_range(value))
313 throw std::range_error(
"Value is out of range specified for Figure " + uuid);
HTTP::Json wjson(void)
WJSON representation.
bool check_range(Range< T > range) const
Check range.
T * cast(void)
Get dynamically casted pointer.
std::string uuid
Local UUID.
virtual HTTP::Json wjson(void)
HTTP JSON.
std::string description
Description.
std::string ontology
Ontology identifier.
std::shared_ptr< Element > parent
Parent Pointer.
HTTP::Json wjson(void)
HTTP JSON.
bool is_null(void) const
Is Null?
DLL std::string rfc3339(void) const
RFC3339 representation.
web::json::value Json
HTTP JSON.
DLL HTTP::Json datatype< bool >(void)
DLL HTTP::Json datatype< int >(void)
HTTP::Json datatype(void)
HTTP JSON datatype.
DLL web::json::value to_json(const T &value)
Value to JSON.
DLL HTTP::Json datatype< double >(void)
DLL HTTP::Json datatype< int64_t >(void)