HOPS
HOPS class reference
Classes | Public Member Functions | Protected Member Functions | List of all members
hops::MHO_ContainerJSONConverter< XContainerType > Class Template Reference

Class MHO_ContainerJSONConverter. More...

#include <MHO_ContainerJSONConverter.hh>

Inheritance diagram for hops::MHO_ContainerJSONConverter< XContainerType >:
[legend]

Classes

class  AxisDumper
 Class AxisDumper - helper class needed to extract MHO_Axis objects from MHO_AxisPack objects inside MHO_TableContainer types. More...
 

Public Member Functions

 MHO_ContainerJSONConverter ()
 
 MHO_ContainerJSONConverter (MHO_ExtensibleElement *element)
 
virtual ~MHO_ContainerJSONConverter ()
 
virtual void ConstructJSONRepresentation ()
 Constructs a JSON representation if fContainer is not nullptr. More...
 
virtual void SetObjectToConvert (MHO_Serializable *obj)
 Setter for object to convert. More...
 
- Public Member Functions inherited from hops::MHO_JSONConverter
 MHO_JSONConverter ()
 
virtual ~MHO_JSONConverter ()
 
mho_jsonGetJSON ()
 Getter for json. More...
 
std::size_t GetRank () const
 Getter for rank, needed for access to raw data in table containers this is a bit of a hack for 'hops2flat'. More...
 
std::size_t GetRawByteSize () const
 Getter for raw byte size. More...
 
const char * GetRawData () const
 Getter for raw data. More...
 
std::string GetRawDataDescriptor () const
 Getter for raw data descriptor. More...
 
void SetLevelOfDetail (int level)
 Setter for level of detail. More...
 

Protected Member Functions

template<typename XCheckType >
void ConstructJSON (const XCheckType *obj)
 Constructs a JSON representation for an object of type XCheckType (unspecialized template doesn't do much) More...
 
template<typename XCheckType = XContainerType>
std::enable_if< std::is_base_of< MHO_ScalarContainerBase, XCheckType >::value, void >::type ConstructJSON (const XContainerType *obj)
 Constructs a JSON representation for an XContainerType object (scalar specialization) More...
 
template<typename XCheckType = XContainerType>
std::enable_if<(std::is_base_of< MHO_VectorContainerBase, XCheckType >::value &&!std::is_base_of< MHO_AxisBase, XCheckType >::value), void >::type ConstructJSON (const XContainerType *obj)
 Constructs a JSON representation for an XContainerType object (vector specialization (but not an axis!)). More...
 
template<typename XCheckType = XContainerType>
std::enable_if< std::is_base_of< MHO_AxisBase, XCheckType >::value, void >::type ConstructJSON (const XContainerType *obj)
 Constructs a JSON representation for an XContainerType object (axis specialization) More...
 
template<typename XCheckType = XContainerType>
std::enable_if< std::is_base_of< MHO_TableContainerBase, XCheckType >::value, void >::type ConstructJSON (const XContainerType *obj)
 Constructs a JSON representation for the given XContainerType object (table specialization). More...
 
- Protected Member Functions inherited from hops::MHO_JSONConverter
void InsertElement (const std::complex< double > &value, mho_json &data)
 Inserts a complex double value into an mho_json data structure. More...
 
void InsertElement (const std::complex< float > &value, mho_json &data)
 Inserts a complex float value into the given mho_json data structure. More...
 
void InsertElement (const std::complex< long double > &value, mho_json &data)
 Inserts a complex value into a JSON data array, this is a specialization for complex<> element data insertion, and is needed because mho_json doesn't have a first-class complex type. More...
 
template<typename XValueType >
void InsertElement (const XValueType &value, mho_json &data)
 Inserts an element into a JSON data list (helper functions for generic data insertion for elements of a list) More...
 

Additional Inherited Members

- Protected Attributes inherited from hops::MHO_JSONConverter
mho_json fJSON
 
int fLOD
 
std::size_t fRank
 
std::size_t fRawByteSize
 
const char * fRawData
 
std::string fRawDataDescriptor
 

Detailed Description

template<typename XContainerType>
class hops::MHO_ContainerJSONConverter< XContainerType >

Class MHO_ContainerJSONConverter.

Converts a given ndarray-based container into a JSON representation this isn't really intended for data transport/storage, but only as conversion to an ascii-like representation for human inspection/debugging.

Author
J. Barrett - barre.nosp@m.ttj@.nosp@m.mit.e.nosp@m.du
Date
Fri Feb 18 14:17:16 2022 -0500

the (integer) code specifing the level-of-detail in the output is as follows: 0 = basic quantities (rank, dimensions, etc.) 1 = basic quantities plus tags 2 = basic quantities plus the axes (if the object is a table) 3 = basic quantities plus axes with interval labels 4 = everything including the main data array

Constructor & Destructor Documentation

◆ MHO_ContainerJSONConverter() [1/2]

template<typename XContainerType >
hops::MHO_ContainerJSONConverter< XContainerType >::MHO_ContainerJSONConverter ( )
inline

◆ MHO_ContainerJSONConverter() [2/2]

template<typename XContainerType >
hops::MHO_ContainerJSONConverter< XContainerType >::MHO_ContainerJSONConverter ( MHO_ExtensibleElement element)
inline

◆ ~MHO_ContainerJSONConverter()

template<typename XContainerType >
virtual hops::MHO_ContainerJSONConverter< XContainerType >::~MHO_ContainerJSONConverter ( )
inlinevirtual

Member Function Documentation

◆ ConstructJSON() [1/5]

template<typename XContainerType >
template<typename XCheckType >
void hops::MHO_ContainerJSONConverter< XContainerType >::ConstructJSON ( const XCheckType *  obj)
inlineprotected

Constructs a JSON representation for an object of type XCheckType (unspecialized template doesn't do much)

uses SFINAE to generate specialization for the rest of the container types

Parameters
objPointer to the object of type XCheckType.
Returns
No return value (void)

◆ ConstructJSON() [2/5]

template<typename XContainerType >
template<typename XCheckType = XContainerType>
std::enable_if< std::is_base_of< MHO_ScalarContainerBase, XCheckType >::value, void >::type hops::MHO_ContainerJSONConverter< XContainerType >::ConstructJSON ( const XContainerType *  obj)
inlineprotected

Constructs a JSON representation for an XContainerType object (scalar specialization)

Template Parameters
XCheckTypeTemplate parameter XCheckType
Parameters
objPointer to const XContainerType object.

◆ ConstructJSON() [3/5]

template<typename XContainerType >
template<typename XCheckType = XContainerType>
std::enable_if< (std::is_base_of< MHO_VectorContainerBase, XCheckType >::value && !std::is_base_of< MHO_AxisBase, XCheckType >::value), void >::type hops::MHO_ContainerJSONConverter< XContainerType >::ConstructJSON ( const XContainerType *  obj)
inlineprotected

Constructs a JSON representation for an XContainerType object (vector specialization (but not an axis!)).

Template Parameters
XCheckTypeTemplate parameter XCheckType
Parameters
objPointer to the const XContainerType object to construct JSON from.

◆ ConstructJSON() [4/5]

template<typename XContainerType >
template<typename XCheckType = XContainerType>
std::enable_if< std::is_base_of< MHO_AxisBase, XCheckType >::value, void >::type hops::MHO_ContainerJSONConverter< XContainerType >::ConstructJSON ( const XContainerType *  obj)
inlineprotected

Constructs a JSON representation for an XContainerType object (axis specialization)

Template Parameters
XCheckTypeTemplate parameter XCheckType
Parameters
objPointer to const XContainerType object.

◆ ConstructJSON() [5/5]

template<typename XContainerType >
template<typename XCheckType = XContainerType>
std::enable_if< std::is_base_of< MHO_TableContainerBase, XCheckType >::value, void >::type hops::MHO_ContainerJSONConverter< XContainerType >::ConstructJSON ( const XContainerType *  obj)
inlineprotected

Constructs a JSON representation for the given XContainerType object (table specialization).

Template Parameters
XCheckTypeTemplate parameter XCheckType
Parameters
objPointer to the const XContainerType object to construct JSON from.

◆ ConstructJSONRepresentation()

template<typename XContainerType >
virtual void hops::MHO_ContainerJSONConverter< XContainerType >::ConstructJSONRepresentation ( )
inlinevirtual

Constructs a JSON representation if fContainer is not nullptr.

Note
This is a virtual function.

Implements hops::MHO_JSONConverter.

◆ SetObjectToConvert()

template<typename XContainerType >
virtual void hops::MHO_ContainerJSONConverter< XContainerType >::SetObjectToConvert ( MHO_Serializable obj)
inlinevirtual

Setter for object to convert.

Parameters
objPointer to an MHO_Serializable object to be converted
Note
This is a virtual function.

Implements hops::MHO_JSONConverter.


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