#include <iterator.hxx>

Public Member Functions

 ~Iterator ()
 

Static Public Member Functions

static OstreamBuild (Ostream &os, const String &parentId, const String &name, int index, const String &comment="")
 
static WriterBuild (Writer &writer, const String &parentId, const String &name, int index, const String &comment="")
 
template<typename T >
static const T & BuildIt (Ostream &os, const String &parentId, const String &name, int index, const T &it, const String &comment="")
 
template<typename T >
static const T & BuildIt (Writer &writer, const String &parentId, const String &name, int index, const T &it, const String &comment="")
 

Private Member Functions

 Iterator (Ostream &os)
 
Iterator operator= (Iterator &)
 
bool Write (const String &parentId, const String &name, int index, const String &comment)
 

Static Private Member Functions

static bool Write (Writer &writer, const String &parentId, const String &name, int index, const String &comment)
 

Private Attributes

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

Detailed Description

parameter.

Definition at line 31 of file iterator.hxx.

Constructor & Destructor Documentation

SHA_Logger::Iterator::~Iterator ( )
inline

Definition at line 35 of file iterator.hxx.

35 { assert(this->writer->IsComplete()); }
std::unique_ptr< Writer > writer
Definition: iterator.hxx:137
SHA_Logger::Iterator::Iterator ( Ostream os)
inlineprivate

Definition at line 92 of file iterator.hxx.

92  : stream(std::unique_ptr<Stream>(new Stream(os))),
93  writer(std::unique_ptr<Writer>(new Writer(*this->stream))) {}
std::unique_ptr< Writer > writer
Definition: iterator.hxx:137
rapidjson::OStreamWrapper Stream
Definition: typedef.hxx:32
std::unique_ptr< Stream > stream
Definition: iterator.hxx:136
rapidjson::PrettyWriter< Stream > Writer
Definition: typedef.hxx:33

Member Function Documentation

static Ostream& SHA_Logger::Iterator::Build ( Ostream os,
const String parentId,
const String name,
int  index,
const String comment = "" 
)
inlinestatic

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

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

Definition at line 43 of file iterator.hxx.

44  {
45  std::unique_ptr<Iterator> builder = std::unique_ptr<Iterator>(new Iterator(os));
46  builder->Write(parentId, name, index, comment);
47 
48  return os;
49  }
Iterator(Ostream &os)
Definition: iterator.hxx:92
static Writer& SHA_Logger::Iterator::Build ( Writer writer,
const String parentId,
const String name,
int  index,
const String comment = "" 
)
inlinestatic

Use json writer passed as parameter to write iterator information.

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

Definition at line 56 of file iterator.hxx.

57  {
58  Write(writer, parentId, name, index, comment);
59 
60  return writer;
61  }
std::unique_ptr< Writer > writer
Definition: iterator.hxx:137
bool Write(const String &parentId, const String &name, int index, const String &comment)
Definition: iterator.hxx:96
template<typename T >
static const T& SHA_Logger::Iterator::BuildIt ( Ostream os,
const String parentId,
const String name,
int  index,
const T &  it,
const String comment = "" 
)
inlinestatic

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

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

Definition at line 69 of file iterator.hxx.

71  {
72  std::unique_ptr<Iterator> builder = std::unique_ptr<Iterator>(new Iterator(os));
73  builder->Write(parentId, name, index, comment);
74 
75  return it;
76  }
Iterator(Ostream &os)
Definition: iterator.hxx:92
template<typename T >
static const T& SHA_Logger::Iterator::BuildIt ( Writer writer,
const String parentId,
const String name,
int  index,
const T &  it,
const String comment = "" 
)
inlinestatic

Use json writer passed as parameter to write iterator information.

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

Definition at line 83 of file iterator.hxx.

85  {
86  Write(writer, parentId, name, index, comment);
87 
88  return it;
89  }
std::unique_ptr< Writer > writer
Definition: iterator.hxx:137
bool Write(const String &parentId, const String &name, int index, const String &comment)
Definition: iterator.hxx:96
Iterator SHA_Logger::Iterator::operator= ( Iterator )
inlineprivate

Definition at line 94 of file iterator.hxx.

94 {} // Not Implemented
bool SHA_Logger::Iterator::Write ( const String parentId,
const String name,
int  index,
const String comment 
)
inlineprivate

Definition at line 96 of file iterator.hxx.

97  { return Write(*this->writer, parentId, name, index, comment); }
std::unique_ptr< Writer > writer
Definition: iterator.hxx:137
bool Write(const String &parentId, const String &name, int index, const String &comment)
Definition: iterator.hxx:96
static bool SHA_Logger::Iterator::Write ( Writer writer,
const String parentId,
const String name,
int  index,
const String comment 
)
inlinestaticprivate

Definition at line 100 of file iterator.hxx.

101  {
102  // Add Error Object log in case of failure
103  if (parentId.empty() || name.empty())
104  {
105  Error::Build(writer, __FILE__, __LINE__,
106  "Missing parameter: " +
107  (parentId.empty()) ? "+ parentId " : "" +
108  (name.empty()) ? "+ name " : "");
109  return false;
110  }
111 
112  // Add iterator information
113  writer.StartObject();
114  writer.Key("type");
115  writer.String("iterator");
116 
117  writer.Key("name");
118  writer.String(name);
119 
120  writer.Key("ref");
121  writer.String(parentId);
122 
123  writer.Key("data");
124  writer.Int(index);
125 
126  if (!comment.empty())
127  {
128  writer.Key("comment");
129  writer.String(comment);
130  }
131  writer.EndObject();
132 
133  return true;
134  }
static Ostream & Build(Ostream &os, const String &file, int line, const String &message)
Definition: error.hxx:41
std::unique_ptr< Writer > writer
Definition: iterator.hxx:137

Member Data Documentation

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

Definition at line 136 of file iterator.hxx.

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

Definition at line 137 of file iterator.hxx.


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