#include <value_type.hxx>

Public Member Functions

 ~ValueType ()
 

Static Public Member Functions

template<typename T >
static std::ostream & Build (std::ostream &os, const T &value)
 
template<typename T >
static WriterBuild (Writer &writer, const T &value)
 
template<typename IteratorT >
static std::ostream & BuildArray (std::ostream &os, const IteratorT &begin, const IteratorT &end)
 
template<typename IteratorT >
static WriterBuildArray (Writer &writer, const IteratorT &begin, const IteratorT &end)
 

Private Member Functions

 ValueType (std::ostream &os)
 
ValueType operator= (ValueType &)
 
template<typename T >
bool Write (T value)
 

Static Private Member Functions

static bool Write (Writer &writer, char value)
 
static bool Write (Writer &writer, bool value)
 
static bool Write (Writer &writer, double value)
 
static bool Write (Writer &writer, int value)
 
static bool Write (Writer &writer, int64_t value)
 
static bool Write (Writer &writer, const String &value)
 
static bool Write (Writer &writer, unsigned value)
 
static bool Write (Writer &writer, uint64_t value)
 

Private Attributes

std::unique_ptr< Streamstream
 
std::unique_ptr< Writerwriter
 

Detailed Description

Definition at line 29 of file value_type.hxx.

Constructor & Destructor Documentation

SHA_Logger::ValueType::~ValueType ( )
inline

Definition at line 33 of file value_type.hxx.

33 { assert(this->writer->IsComplete()); }
std::unique_ptr< Writer > writer
Definition: value_type.hxx:118
SHA_Logger::ValueType::ValueType ( std::ostream &  os)
inlineprivate

Definition at line 99 of file value_type.hxx.

99  : stream(std::unique_ptr<Stream>(new Stream(os))),
100  writer(std::unique_ptr<Writer>(new Writer(*this->stream))) {}
std::unique_ptr< Stream > stream
Definition: value_type.hxx:117
rapidjson::OStreamWrapper Stream
Definition: typedef.hxx:32
std::unique_ptr< Writer > writer
Definition: value_type.hxx:118
rapidjson::PrettyWriter< Stream > Writer
Definition: typedef.hxx:33

Member Function Documentation

template<typename T >
static std::ostream& SHA_Logger::ValueType::Build ( std::ostream &  os,
const T &  value 
)
inlinestatic

Instantiate a new json writer using the stream passed as argument and write Value_Type information depending on type.

Returns
stream reference filled up with Iterator object information, error information in case of failure.

Definition at line 41 of file value_type.hxx.

42  {
43  // Create ValueType and add it to the logger
44  std::unique_ptr<ValueType> builder = std::unique_ptr<ValueType>(new Iterator(os));
45  builder->Write(value);
46 
47  return os;
48  }
template<typename T >
static Writer& SHA_Logger::ValueType::Build ( Writer writer,
const T &  value 
)
inlinestatic

Use json writer passed as parameter to write Value_Type information.

Returns
stream reference filled up with Array object information depending on type, error information in case of failure.

Definition at line 55 of file value_type.hxx.

56  {
57  Write(writer, value);
58 
59  return writer;
60  }
bool Write(T value)
Definition: value_type.hxx:105
std::unique_ptr< Writer > writer
Definition: value_type.hxx:118
template<typename IteratorT >
static std::ostream& SHA_Logger::ValueType::BuildArray ( std::ostream &  os,
const IteratorT &  begin,
const IteratorT &  end 
)
inlinestatic

Instantiate a new json writer using the stream passed as argument and write array information depending on type.

Returns
stream reference filled up with Iterator object information, error information in case of failure.

Definition at line 68 of file value_type.hxx.

69  {
70  // Create ValueType logger
71  std::unique_ptr<ValueType> builder = std::unique_ptr<ValueType>(new ValueType(os));
72 
73  // @todo check & log error? --> time consuming
74  builder->writer->StartArray();
75  for (auto it = begin; it != end; ++it)
76  builder->Write(*it);
77  builder->writer->EndArray();
78 
79  return os;
80  }
ValueType(std::ostream &os)
Definition: value_type.hxx:99
template<typename IteratorT >
static Writer& SHA_Logger::ValueType::BuildArray ( Writer writer,
const IteratorT &  begin,
const IteratorT &  end 
)
inlinestatic

Use json writer passed as parameter to write array of value_type information.

Returns
stream reference filled up with Array object information depending on type, error information in case of failure.

Definition at line 87 of file value_type.hxx.

88  {
89  // @todo check & log error? --> time consuming
90  writer.StartArray();
91  for (auto it = begin; it != end; ++it)
92  Write(writer, *it);
93  writer.EndArray();
94 
95  return writer;
96  }
bool Write(T value)
Definition: value_type.hxx:105
std::unique_ptr< Writer > writer
Definition: value_type.hxx:118
ValueType SHA_Logger::ValueType::operator= ( ValueType )
inlineprivate

Definition at line 101 of file value_type.hxx.

101 {} // Not Implemented
template<typename T >
bool SHA_Logger::ValueType::Write ( value)
inlineprivate

Definition at line 105 of file value_type.hxx.

105 { return this->Write(*this->writer, value); }
bool Write(T value)
Definition: value_type.hxx:105
std::unique_ptr< Writer > writer
Definition: value_type.hxx:118
static bool SHA_Logger::ValueType::Write ( Writer writer,
char  value 
)
inlinestaticprivate

Definition at line 108 of file value_type.hxx.

108 { return writer.String(String(1, value)); }
const std::string String
Definition: typedef.hxx:36
std::unique_ptr< Writer > writer
Definition: value_type.hxx:118
static bool SHA_Logger::ValueType::Write ( Writer writer,
bool  value 
)
inlinestaticprivate

Definition at line 109 of file value_type.hxx.

109 { return writer.Bool(value); }
std::unique_ptr< Writer > writer
Definition: value_type.hxx:118
static bool SHA_Logger::ValueType::Write ( Writer writer,
double  value 
)
inlinestaticprivate

Definition at line 110 of file value_type.hxx.

110 { return writer.Double(value); }
std::unique_ptr< Writer > writer
Definition: value_type.hxx:118
static bool SHA_Logger::ValueType::Write ( Writer writer,
int  value 
)
inlinestaticprivate

Definition at line 111 of file value_type.hxx.

111 { return writer.Int(value); }
std::unique_ptr< Writer > writer
Definition: value_type.hxx:118
static bool SHA_Logger::ValueType::Write ( Writer writer,
int64_t  value 
)
inlinestaticprivate

Definition at line 112 of file value_type.hxx.

112 { return writer.Int64(value); }
std::unique_ptr< Writer > writer
Definition: value_type.hxx:118
static bool SHA_Logger::ValueType::Write ( Writer writer,
const String value 
)
inlinestaticprivate

Definition at line 113 of file value_type.hxx.

113 { return writer.String(value); }
std::unique_ptr< Writer > writer
Definition: value_type.hxx:118
static bool SHA_Logger::ValueType::Write ( Writer writer,
unsigned  value 
)
inlinestaticprivate

Definition at line 114 of file value_type.hxx.

114 { return writer.Uint(value); }
std::unique_ptr< Writer > writer
Definition: value_type.hxx:118
static bool SHA_Logger::ValueType::Write ( Writer writer,
uint64_t  value 
)
inlinestaticprivate

Definition at line 115 of file value_type.hxx.

115 { return writer.Uint64(value); }
std::unique_ptr< Writer > writer
Definition: value_type.hxx:118

Member Data Documentation

std::unique_ptr<Stream> SHA_Logger::ValueType::stream
private

Definition at line 117 of file value_type.hxx.

std::unique_ptr<Writer> SHA_Logger::ValueType::writer
private

Definition at line 118 of file value_type.hxx.


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