EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Acts::GeometryHierarchyMapJsonConverter< value_t > Class Template Reference

#include <acts/blob/sPHENIX/Plugins/Json/include/Acts/Plugins/Json/GeometryHierarchyMapJsonConverter.hpp>

+ Collaboration diagram for Acts::GeometryHierarchyMapJsonConverter< value_t >:

Public Types

using Value = value_t
 
using Container = GeometryHierarchyMap< value_t >
 

Public Member Functions

 GeometryHierarchyMapJsonConverter (std::string valueIdentifier)
 
nlohmann::json toJson (const Container &container) const
 
Container fromJson (const nlohmann::json &encoded) const
 

Static Private Member Functions

static nlohmann::json encodeIdentifier (GeometryIdentifier id)
 
static GeometryIdentifier decodeIdentifier (const nlohmann::json &encoded)
 

Private Attributes

std::string m_valueIdentifier
 

Static Private Attributes

static constexpr const char *const kHeaderKey = "acts-geometry-hierarchy-map"
 
static constexpr const char *const kEntriesKey = "entries"
 
static constexpr int kFormatVersion = 0
 

Detailed Description

template<typename value_t>
class Acts::GeometryHierarchyMapJsonConverter< value_t >

Convert a geometry hierarchy map to/from Json.

Template Parameters
value_tvalue type stored in the geometry hierarchy map

The value type is expected to be directly convertible to/from a Json object. It has to be either a fundamental type or appropriate to_json(json&, const value_t&) and from_json(const json&, value_t&) functions must be available. See the relevant nlohmann::json documentation for further information.

A user-defined identifier is stored in the encoded Json object that is used to identify which value type is stored in the file. The identifier is checked for consistency when decoding the Json object.

Definition at line 36 of file GeometryHierarchyMapJsonConverter.hpp.

View newest version in sPHENIX GitHub at line 36 of file GeometryHierarchyMapJsonConverter.hpp

Member Typedef Documentation

template<typename value_t >
using Acts::GeometryHierarchyMapJsonConverter< value_t >::Container = GeometryHierarchyMap<value_t>

Definition at line 39 of file GeometryHierarchyMapJsonConverter.hpp.

View newest version in sPHENIX GitHub at line 39 of file GeometryHierarchyMapJsonConverter.hpp

template<typename value_t >
using Acts::GeometryHierarchyMapJsonConverter< value_t >::Value = value_t

Definition at line 38 of file GeometryHierarchyMapJsonConverter.hpp.

View newest version in sPHENIX GitHub at line 38 of file GeometryHierarchyMapJsonConverter.hpp

Constructor & Destructor Documentation

template<typename value_t >
Acts::GeometryHierarchyMapJsonConverter< value_t >::GeometryHierarchyMapJsonConverter ( std::string  valueIdentifier)
inline

Construct the converter.

Parameters
valueIdentifieruser-defined identifier for the stored value

Definition at line 44 of file GeometryHierarchyMapJsonConverter.hpp.

View newest version in sPHENIX GitHub at line 44 of file GeometryHierarchyMapJsonConverter.hpp

References Acts::GeometryHierarchyMapJsonConverter< value_t >::m_valueIdentifier.

Member Function Documentation

template<typename value_t >
static GeometryIdentifier Acts::GeometryHierarchyMapJsonConverter< value_t >::decodeIdentifier ( const nlohmann::json encoded)
inlinestaticprivate

Definition at line 93 of file GeometryHierarchyMapJsonConverter.hpp.

View newest version in sPHENIX GitHub at line 93 of file GeometryHierarchyMapJsonConverter.hpp

References Acts::GeometryIdentifier::setVolume(), Acts::UnitConstants::u, and nlohmann::basic_json::value().

+ Here is the call graph for this function:

template<typename value_t >
static nlohmann::json Acts::GeometryHierarchyMapJsonConverter< value_t >::encodeIdentifier ( GeometryIdentifier  id)
inlinestaticprivate

Definition at line 73 of file GeometryHierarchyMapJsonConverter.hpp.

View newest version in sPHENIX GitHub at line 73 of file GeometryHierarchyMapJsonConverter.hpp

References G4TTL::layer, and Acts::Test::volume.

template<typename value_t >
auto Acts::GeometryHierarchyMapJsonConverter< value_t >::fromJson ( const nlohmann::json encoded) const

Decode a Json object into a geometry hierarchy map.

Parameters
encodedJson object that should be decoded
Returns
Decoded geometry hierarchy map
Exceptions
std::invalid_argumentin case of format errors

Definition at line 127 of file GeometryHierarchyMapJsonConverter.hpp.

View newest version in sPHENIX GitHub at line 127 of file GeometryHierarchyMapJsonConverter.hpp

References Acts::GeometryHierarchyMap< value_t >::find(), and value.

+ Here is the call graph for this function:

template<typename value_t >
nlohmann::json Acts::GeometryHierarchyMapJsonConverter< value_t >::toJson ( const Container container) const

Encode the geometry hierarchy map into a Json object.

Parameters
containerGeometry hierarchy map that should be encoded
Returns
Encoded Json object

Definition at line 107 of file GeometryHierarchyMapJsonConverter.hpp.

View newest version in sPHENIX GitHub at line 107 of file GeometryHierarchyMapJsonConverter.hpp

References nlohmann::basic_json::array(), Acts::GeometryHierarchyMap< value_t >::idAt(), nlohmann::basic_json::object(), nlohmann::basic_json::push_back(), Acts::GeometryHierarchyMap< value_t >::size(), and Acts::GeometryHierarchyMap< value_t >::valueAt().

+ Here is the call graph for this function:

Member Data Documentation

template<typename value_t >
constexpr const char* const Acts::GeometryHierarchyMapJsonConverter< value_t >::kEntriesKey = "entries"
staticprivate

Definition at line 66 of file GeometryHierarchyMapJsonConverter.hpp.

View newest version in sPHENIX GitHub at line 66 of file GeometryHierarchyMapJsonConverter.hpp

template<typename value_t >
constexpr int Acts::GeometryHierarchyMapJsonConverter< value_t >::kFormatVersion = 0
staticprivate

The version of the encoded Json container format. This must be increased manually everytime the container format changes.

Definition at line 69 of file GeometryHierarchyMapJsonConverter.hpp.

View newest version in sPHENIX GitHub at line 69 of file GeometryHierarchyMapJsonConverter.hpp

template<typename value_t >
constexpr const char* const Acts::GeometryHierarchyMapJsonConverter< value_t >::kHeaderKey = "acts-geometry-hierarchy-map"
staticprivate

Definition at line 65 of file GeometryHierarchyMapJsonConverter.hpp.

View newest version in sPHENIX GitHub at line 65 of file GeometryHierarchyMapJsonConverter.hpp

template<typename value_t >
std::string Acts::GeometryHierarchyMapJsonConverter< value_t >::m_valueIdentifier
private

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