Jpp  debug
the software that should make you happy
Public Types | Public Member Functions | Static Public Member Functions | List of all members
JDATABASE::JSonDictionary Struct Reference

Assignment. More...

#include <JSonSupportkit.hh>

Inheritance diagram for JDATABASE::JSonDictionary:
std::map< std::string, std::shared_ptr< JSonIO > > JLANG::JSingleton< T >

Public Types

typedef T data_type
 

Public Member Functions

 JSonDictionary ()
 Default constructor. More...
 
template<class T >
void operator() (const JLANG::JType< T > &type)
 Add data type. More...
 

Static Public Member Functions

template<class T >
static const char * getTypename ()
 Get typename for given template class. More...
 
static data_typegetInstance ()
 Get unique instance of template class. More...
 

Detailed Description

Assignment.

Definition at line 99 of file JSonSupportkit.hh.

Member Typedef Documentation

◆ data_type

template<class T >
typedef T JLANG::JSingleton< T >::data_type
inherited

Definition at line 20 of file JSingleton.hh.

Constructor & Destructor Documentation

◆ JSonDictionary()

JDATABASE::JSonDictionary::JSonDictionary ( )
inline

Default constructor.

Removed types:

  • long double (not supported by ROOT TDictionary)
  • char (not supported by JSon)

Added STL type definitions:

Definition at line 116 of file JSonSupportkit.hh.

117  {
118  using namespace JPP;
119 
120  for_each<JRemove<JPrimitiveTypes_t, JTypeList<char, long double> >::typelist>(*this);
121 
122  (*this)(JType<std::string>());
123  (*this)(JType<size_t>());
124  (*this)(JType<std::size_t>());
125  (*this)(JType<JDATABASE::JDBString>());
126  }
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary class for a type holder.
Definition: JType.hh:19

Member Function Documentation

◆ getTypename()

template<class T >
static const char* JDATABASE::JSonDictionary::getTypename ( )
inlinestatic

Get typename for given template class.

This method uses the TDictionary class to get the name of the given class.

Returns
type name

Definition at line 137 of file JSonSupportkit.hh.

138  {
139  const TDictionary* pDictionary = TDictionary::GetDictionary(typeid(T));
140 
141  if (pDictionary != NULL)
142  return pDictionary->GetName();
143  else
144  THROW(JException, "Data type not implemented.");
145  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
General exception.
Definition: JException.hh:24

◆ operator()()

template<class T >
void JDATABASE::JSonDictionary::operator() ( const JLANG::JType< T > &  type)
inline

Add data type.

Parameters
typedata type

Definition at line 153 of file JSonSupportkit.hh.

154  {
155  (*this)[getTypename<T>()] = std::make_shared< JSonIO_t<T> >();
156  }

◆ getInstance()

template<class T >
static data_type& JLANG::JSingleton< T >::getInstance ( )
inlinestaticinherited

Get unique instance of template class.

Returns
object

Definition at line 27 of file JSingleton.hh.

28  {
29  static data_type value;
30 
31  return value;
32  }

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