#include <value.hxx>

Public Member Functions

 ~Value ()
 

Static Public Member Functions

static OstreamBuild (Ostream &os, const String &name, const T &value, const String &comment="")
 
static const T & BuildValue (Writer &writer, const String &name, const T &value, const String &comment="")
 
static const T & BuildValue (Ostream &os, const String &name, const T &value, const String &comment="")
 
static WriterBuild (Writer &writer, const String &name, const T &value, const String &comment="")
 

Private Member Functions

 Value (Ostream &os)
 
Value operator= (Value &)
 
bool Write (const String &name, const T &value, const String &comment)
 

Static Private Member Functions

static bool Write (Writer &writer, const String &name, const T &value, const String &comment)
 

Private Attributes

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

Detailed Description

template<typename T>
class SHA_Logger::Value< T >

Value parameter

Definition at line 33 of file value.hxx.

Constructor & Destructor Documentation

template<typename T>
SHA_Logger::Value< T >::~Value ( )
inline

Definition at line 37 of file value.hxx.

37 { assert(this->writer->IsComplete()); }
std::unique_ptr< Writer > writer
Definition: value.hxx:127
template<typename T>
SHA_Logger::Value< T >::Value ( Ostream os)
inlineprivate

Definition at line 89 of file value.hxx.

89  : stream(std::unique_ptr<Stream>(new Stream(os))),
90  writer(std::unique_ptr<Writer>(new Writer(*this->stream))) {}
rapidjson::OStreamWrapper Stream
Definition: typedef.hxx:32
std::unique_ptr< Stream > stream
Definition: value.hxx:126
std::unique_ptr< Writer > writer
Definition: value.hxx:127
rapidjson::PrettyWriter< Stream > Writer
Definition: typedef.hxx:33

Member Function Documentation

template<typename T>
static Ostream& SHA_Logger::Value< T >::Build ( Ostream os,
const String name,
const T &  value,
const String comment = "" 
)
inlinestatic

Instantiate a new json writer using the stream passed as argument and write value information.

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

Definition at line 44 of file value.hxx.

45  {
46  std::unique_ptr<Value> builder = std::unique_ptr<Value>(new Value(os));
47  builder->Write(name, value, comment);
48 
49  return os;
50  }
Value(Ostream &os)
Definition: value.hxx:89
template<typename T>
static Writer& SHA_Logger::Value< T >::Build ( Writer writer,
const String name,
const T &  value,
const String comment = "" 
)
inlinestatic

Use json writer passed as parameter to write iterator information.

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

Definition at line 81 of file value.hxx.

82  {
83  Write(writer, name, value, comment);
84 
85  return writer;
86  }
std::unique_ptr< Writer > writer
Definition: value.hxx:127
bool Write(const String &name, const T &value, const String &comment)
Definition: value.hxx:93
template<typename T>
static const T& SHA_Logger::Value< T >::BuildValue ( Writer writer,
const String name,
const T &  value,
const String comment = "" 
)
inlinestatic

Use json writer passed as parameter to write iterator information.

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

Definition at line 57 of file value.hxx.

58  {
59  Write(writer, name, value, comment);
60 
61  return value;
62  }
std::unique_ptr< Writer > writer
Definition: value.hxx:127
bool Write(const String &name, const T &value, const String &comment)
Definition: value.hxx:93
template<typename T>
static const T& SHA_Logger::Value< T >::BuildValue ( Ostream os,
const String name,
const T &  value,
const String comment = "" 
)
inlinestatic

Instantiate a new json writer using the stream passed as argument and write value information.

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

Definition at line 69 of file value.hxx.

70  {
71  std::unique_ptr<Value> builder = std::unique_ptr<Value>(new Value(os));
72  builder->Write(name, value, comment);
73 
74  return value;
75  }
Value(Ostream &os)
Definition: value.hxx:89
template<typename T>
Value SHA_Logger::Value< T >::operator= ( Value< T > &  )
inlineprivate

Definition at line 91 of file value.hxx.

91 {} // Not Implemented
template<typename T>
bool SHA_Logger::Value< T >::Write ( const String name,
const T &  value,
const String comment 
)
inlineprivate

Definition at line 93 of file value.hxx.

94  { return Write(*this->writer, name, value, comment); }
std::unique_ptr< Writer > writer
Definition: value.hxx:127
bool Write(const String &name, const T &value, const String &comment)
Definition: value.hxx:93
template<typename T>
static bool SHA_Logger::Value< T >::Write ( Writer writer,
const String name,
const T &  value,
const String comment 
)
inlinestaticprivate

Definition at line 96 of file value.hxx.

97  {
98  // Add Error Object log in case of failure
99  if (name.empty())
100  {
101  Error::Build(writer, __FILE__, __LINE__, "name parameter empty.");
102  return false;
103  }
104 
105  // Add iterator information
106  writer.StartObject();
107  writer.Key("type");
108  writer.String("value");
109 
110  writer.Key("name");
111  writer.String(name);
112 
113  writer.Key("data");
114  ValueType::Build<T>(writer, value);
115 
116  if (!comment.empty())
117  {
118  writer.Key("comment");
119  writer.String(comment);
120  }
121  writer.EndObject();
122 
123  return true;
124  }
static Ostream & Build(Ostream &os, const String &file, int line, const String &message)
Definition: error.hxx:41
std::unique_ptr< Writer > writer
Definition: value.hxx:127

Member Data Documentation

template<typename T>
std::unique_ptr<Stream> SHA_Logger::Value< T >::stream
private

Definition at line 126 of file value.hxx.

template<typename T>
std::unique_ptr<Writer> SHA_Logger::Value< T >::writer
private

Definition at line 127 of file value.hxx.


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