Jpp  master_rocky-43-ge265d140c
the software that should make you happy
Public Member Functions | Private Attributes | List of all members
JROOT::JSonObjectOutput< T > Class Template Reference

Template implementation of stream output for single data type. More...

#include <JSonObjectOutput.hh>

Inheritance diagram for JROOT::JSonObjectOutput< T >:
JLANG::JObjectOutput< T >

Public Member Functions

 JSonObjectOutput (std::ostream &out, const std::string &sep="\n")
 Constructor. More...
 
virtual bool put (const T &object) override
 Object output. More...
 
const std::string & getSeparator () const
 Get token separator. More...
 
void setSeparator (const std::string &sep)
 Set token separator. More...
 

Private Attributes

std::ostream & __out
 
std::string __sep
 

Detailed Description

template<class T>
class JROOT::JSonObjectOutput< T >

Template implementation of stream output for single data type.

This class implements the JLANG::JObjectOutput interface.

Definition at line 34 of file JSonObjectOutput.hh.

Constructor & Destructor Documentation

◆ JSonObjectOutput()

template<class T >
JROOT::JSonObjectOutput< T >::JSonObjectOutput ( std::ostream &  out,
const std::string &  sep = "\n" 
)
inline

Constructor.

Parameters
outoutput stream
septoken separator

Definition at line 44 of file JSonObjectOutput.hh.

45  :
46  __out(out),
47  __sep(sep)
48  {}

Member Function Documentation

◆ put()

template<class T >
virtual bool JROOT::JSonObjectOutput< T >::put ( const T &  object)
inlineoverridevirtual

Object output.

Parameters
objectobject
Returns
true if OK; else false

Implements JLANG::JObjectOutput< T >.

Definition at line 57 of file JSonObjectOutput.hh.

58  {
59  using namespace JPP;
60 
62  return (bool) (__out << (const char*) TBufferJSON::ConvertToJSON(&object) << __sep);
63  else
64  return false;
65  }
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Template class test for polymorphism.
Definition: JConversion.hh:22

◆ getSeparator()

template<class T >
const std::string& JROOT::JSonObjectOutput< T >::getSeparator ( ) const
inline

Get token separator.

Returns
separator

Definition at line 73 of file JSonObjectOutput.hh.

74  {
75  return this->__sep;
76  }

◆ setSeparator()

template<class T >
void JROOT::JSonObjectOutput< T >::setSeparator ( const std::string &  sep)
inline

Set token separator.

Parameters
sepseparator

Definition at line 84 of file JSonObjectOutput.hh.

85  {
86  this->__sep = sep;
87  }

Member Data Documentation

◆ __out

template<class T >
std::ostream& JROOT::JSonObjectOutput< T >::__out
private

Definition at line 90 of file JSonObjectOutput.hh.

◆ __sep

template<class T >
std::string JROOT::JSonObjectOutput< T >::__sep
private

Definition at line 91 of file JSonObjectOutput.hh.


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