Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Acts::GeometryHierarchyMapJsonConverter< value_t, decorator_t > Class Template Reference

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

+ Collaboration diagram for Acts::GeometryHierarchyMapJsonConverter< value_t, decorator_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 decorator_t *decorator) const
 
Container fromJson (const nlohmann::json &encoded) const
 

Static Public Member Functions

static nlohmann::json encodeIdentifier (const GeometryIdentifier &id)
 
static GeometryIdentifier decodeIdentifier (const nlohmann::json &encoded)
 Decode a geometry identifier from a json object.
 

Private Attributes

std::string m_valueIdentifier
 

Static Private Attributes

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

Detailed Description

template<typename value_t, class decorator_t = void>
class Acts::GeometryHierarchyMapJsonConverter< value_t, decorator_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 37 of file GeometryHierarchyMapJsonConverter.hpp.

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

Member Typedef Documentation

template<typename value_t, class decorator_t = void>
using Acts::GeometryHierarchyMapJsonConverter< value_t, decorator_t >::Container = GeometryHierarchyMap<value_t>

Definition at line 40 of file GeometryHierarchyMapJsonConverter.hpp.

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

template<typename value_t, class decorator_t = void>
using Acts::GeometryHierarchyMapJsonConverter< value_t, decorator_t >::Value = value_t

Definition at line 39 of file GeometryHierarchyMapJsonConverter.hpp.

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

Constructor & Destructor Documentation

template<typename value_t, class decorator_t = void>
Acts::GeometryHierarchyMapJsonConverter< value_t, decorator_t >::GeometryHierarchyMapJsonConverter ( std::string  valueIdentifier)
inline

Construct the converter.

Parameters
valueIdentifieruser-defined identifier for the stored value

Definition at line 45 of file GeometryHierarchyMapJsonConverter.hpp.

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

Member Function Documentation

template<typename value_t, class decorator_t = void>
static GeometryIdentifier Acts::GeometryHierarchyMapJsonConverter< value_t, decorator_t >::decodeIdentifier ( const nlohmann::json &  encoded)
inlinestatic

Decode a geometry identifier from a json object.

Parameters
encodedis the json object that carries the encoded identifier
Returns
a valid geometry Identifier

Definition at line 97 of file GeometryHierarchyMapJsonConverter.hpp.

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

template<typename value_t, class decorator_t = void>
static nlohmann::json Acts::GeometryHierarchyMapJsonConverter< value_t, decorator_t >::encodeIdentifier ( const GeometryIdentifier id)
inlinestatic

Encode the geometry identifier

Parameters
idis the geometry identifier that will be encoded

Definition at line 70 of file GeometryHierarchyMapJsonConverter.hpp.

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

template<typename value_t , class decorator_t >
auto Acts::GeometryHierarchyMapJsonConverter< value_t, decorator_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 169 of file GeometryHierarchyMapJsonConverter.hpp.

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

References entry, Acts::GeometryHierarchyMap< value_t >::find(), testing::internal::move(), and value.

+ Here is the call graph for this function:

template<typename value_t, class decorator_t = void>
nlohmann::json Acts::GeometryHierarchyMapJsonConverter< value_t, decorator_t >::toJson ( const Container container,
const decorator_t *  decorator 
) const

Encode the geometry hierarchy map into a Json object.

Parameters
containerGeometry hierarchy map that should be encoded
decoratornullptr or a decorator to add extra values to the json output
Returns
Encoded Json object

Definition at line 145 of file GeometryHierarchyMapJsonConverter.hpp.

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

References TauVsDIS_MachineLearning_Differentiation::array, Acts::decorateJson(), entry, i, Acts::GeometryHierarchyMap< value_t >::idAt(), testing::internal::move(), Acts::GeometryHierarchyMap< value_t >::size(), value, and Acts::GeometryHierarchyMap< value_t >::valueAt().

+ Here is the call graph for this function:

Member Data Documentation

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

Definition at line 109 of file GeometryHierarchyMapJsonConverter.hpp.

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

template<typename value_t, class decorator_t = void>
constexpr int Acts::GeometryHierarchyMapJsonConverter< value_t, decorator_t >::kFormatVersion = 0
staticprivate

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

Definition at line 112 of file GeometryHierarchyMapJsonConverter.hpp.

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

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

Definition at line 108 of file GeometryHierarchyMapJsonConverter.hpp.

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

template<typename value_t, class decorator_t = void>
std::string Acts::GeometryHierarchyMapJsonConverter< value_t, decorator_t >::m_valueIdentifier
private

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