armarx::viz::json Namespace Reference

Namespaces

namespace  meta
 

Classes

class  ElementJsonSerializers
 Handles serialization and deserialization of dynamic data::Element objects to and from JSON. More...
 

Typedefs

template<class ValueT>
using FromJsonFn = std::function<void(const nlohmann::json& j, ValueT& v)>
 A std::function pointer to a function with signature:
 
template<class ValueT>
using RawFromJsonFn = void (*)(const nlohmann::json& j, ValueT& v)
 A raw function pointer to a function with signature:
 
template<class ValueT>
using RawToJsonFn = void (*)(nlohmann::json& j, const ValueT& v)
 A raw function pointer to a function with signature:
 
template<class ValueT>
using ToJsonFn = std::function<void(nlohmann::json& j, const ValueT& v)>
 A std::function pointer to a function with signature:
 

Functions

void from_json_base (const nlohmann::json &j, data::Element &value)
 
std::string getTypeName (const nlohmann::json &j, const std::string &key)
 Get the type name stored in j.
 
void setTypeName (nlohmann::json &j, const std::string &key, const std::string &typeName)
 Store the type name in j.
 
void to_json_base (nlohmann::json &j, const data::Element &element)
 

Typedef Documentation

◆ FromJsonFn

template<class ValueT>
using FromJsonFn = std::function<void(const nlohmann::json& j, ValueT& v)>

A std::function pointer to a function with signature:

void from_json(const nlohmann::json& j, Value& v);
void from_json(const nlohmann::json &j, Vector2f &value)

Definition at line 83 of file ElementJsonSerializers.h.

◆ RawFromJsonFn

template<class ValueT>
using RawFromJsonFn = void (*)(const nlohmann::json& j, ValueT& v)

A raw function pointer to a function with signature:

void from_json(const nlohmann::json& j, Value& v);

Definition at line 65 of file ElementJsonSerializers.h.

◆ RawToJsonFn

template<class ValueT>
using RawToJsonFn = void (*)(nlohmann::json& j, const ValueT& v)

A raw function pointer to a function with signature:

void to_json(nlohmann::json& j, const Value& v);
void to_json(nlohmann::json &j, const Vector2f &value)

Definition at line 57 of file ElementJsonSerializers.h.

◆ ToJsonFn

template<class ValueT>
using ToJsonFn = std::function<void(nlohmann::json& j, const ValueT& v)>

A std::function pointer to a function with signature:

void to_json(nlohmann::json& j, const Value& v);

Definition at line 75 of file ElementJsonSerializers.h.

Function Documentation

◆ from_json_base()

void from_json_base ( const nlohmann::json & j,
data::Element & value )

Definition at line 108 of file json_base.cpp.

+ Here is the caller graph for this function:

◆ getTypeName()

std::string getTypeName ( const nlohmann::json & j,
const std::string & key )

Get the type name stored in j.

Parameters
keyThe key of the type name entry.
Exceptions
`error::NoTypeNameEntryInJsonObject`If j is not an object or does not contain key.

Definition at line 6 of file ElementJsonSerializers.cpp.

+ Here is the caller graph for this function:

◆ setTypeName()

void setTypeName ( nlohmann::json & j,
const std::string & key,
const std::string & typeName )

Store the type name in j.

Parameters
keyThe key where the type name shall be stored.
typeNameThe type name.
Exceptions
`error::TypeNameEntryAlreadyInJsonObject`If j already contains key.

Definition at line 23 of file ElementJsonSerializers.cpp.

◆ to_json_base()

void to_json_base ( nlohmann::json & j,
const data::Element & element )

Definition at line 94 of file json_base.cpp.

+ Here is the caller graph for this function: