Jpp  17.3.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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::stringgetSeparator () 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 32 of file JSonObjectOutput.hh.

Constructor & Destructor Documentation

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 42 of file JSonObjectOutput.hh.

43  :
44  __out(out),
45  __sep(sep)
46  {}

Member Function Documentation

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 55 of file JSonObjectOutput.hh.

56  {
57  using namespace JPP;
58 
59  if (JConversion<T, TObject>::is_derived)
60  return (bool) (__out << (const char*) TBufferJSON::ConvertToJSON(&object) << __sep);
61  else
62  return false;
63  }
template<class T>
const std::string& JROOT::JSonObjectOutput< T >::getSeparator ( ) const
inline

Get token separator.

Returns
separator

Definition at line 71 of file JSonObjectOutput.hh.

72  {
73  return this->__sep;
74  }
template<class T>
void JROOT::JSonObjectOutput< T >::setSeparator ( const std::string sep)
inline

Set token separator.

Parameters
sepseparator

Definition at line 82 of file JSonObjectOutput.hh.

83  {
84  this->__sep = sep;
85  }

Member Data Documentation

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

Definition at line 88 of file JSonObjectOutput.hh.

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

Definition at line 89 of file JSonObjectOutput.hh.


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