Thrill  0.1
JsonLine Class Reference

Detailed Description

JsonLine is an object used to aggregate a set of key:value pairs for output into a JSON log.

Definition at line 119 of file json_logger.hpp.

+ Collaboration diagram for JsonLine:

#include <json_logger.hpp>

Classes

struct  ArrayTag
 
struct  DictionaryTag
 

Public Member Functions

 JsonLine (JsonLogger *logger, std::ostream &os)
 ctor: bind output More...
 
 JsonLine (const JsonLine &)=delete
 non-copyable: delete copy-constructor More...
 
 JsonLine (JsonLine &&o)
 move-constructor: unlink pointer More...
 
 ~JsonLine ()
 destructor: deliver to output More...
 
template<typename Key >
JsonLine arr (const Key &key)
 return JsonLine has sub-dictionary of this one More...
 
void Close ()
 close the line More...
 
size_t items () const
 number of items already put More...
 
JsonLine obj ()
 return JsonLine has sub-dictionary of this one More...
 
template<typename Type >
JsonLineoperator<< (Type const &t)
 output any type More...
 
JsonLineoperator<< (const JsonBeginObj &t)
 
JsonLineoperator<< (const JsonEndObj &)
 
JsonLineoperator= (const JsonLine &)=delete
 non-copyable: delete assignment operator More...
 
void PutEscapedChar (char ch)
 
void PutSeparator ()
 put an items separator (either ',' or ':') and increment counter. More...
 
template<typename Key >
JsonLine sub (const Key &key)
 return JsonLine has sub-dictionary of this one More...
 

Public Attributes

size_t items_ = 0
 items counter for output stream More...
 
std::ostream & os_
 reference to output stream More...
 
bool sub_array_ = false
 indicator for sub-array. More...
 
bool sub_dict_ = false
 indicator for sub-dictionaries. More...
 

Private Member Functions

 JsonLine (struct DictionaryTag, JsonLine &parent)
 construct sub-dictionary More...
 
 JsonLine (struct ArrayTag, JsonLine &parent)
 construct sub-dictionary More...
 

Private Attributes

std::unique_lock< std::mutex > lock_
 lock on the logger output stream More...
 
JsonLoggerlogger_ = nullptr
 when destructed this object is delivered to the output. More...
 

Constructor & Destructor Documentation

◆ JsonLine() [1/5]

JsonLine ( JsonLogger logger,
std::ostream &  os 
)
inline

ctor: bind output

Definition at line 123 of file json_logger.hpp.

◆ JsonLine() [2/5]

JsonLine ( const JsonLine )
delete

non-copyable: delete copy-constructor

◆ JsonLine() [3/5]

JsonLine ( JsonLine &&  o)
inline

move-constructor: unlink pointer

Definition at line 134 of file json_logger.hpp.

◆ ~JsonLine()

~JsonLine ( )
inline

destructor: deliver to output

Definition at line 161 of file json_logger.hpp.

◆ JsonLine() [4/5]

JsonLine ( struct DictionaryTag  ,
JsonLine parent 
)
inlineprivate

construct sub-dictionary

Definition at line 254 of file json_logger.hpp.

◆ JsonLine() [5/5]

JsonLine ( struct ArrayTag  ,
JsonLine parent 
)
inlineprivate

construct sub-dictionary

Definition at line 258 of file json_logger.hpp.

Member Function Documentation

◆ arr()

JsonLine arr ( const Key &  key)
inline

return JsonLine has sub-dictionary of this one

Definition at line 197 of file json_logger.hpp.

References thrill::api::ArrayTag, and thrill::api::operator<<().

◆ Close()

void Close ( )
inline

close the line

Definition at line 166 of file json_logger.hpp.

◆ items()

size_t items ( ) const
inline

number of items already put

Definition at line 183 of file json_logger.hpp.

◆ obj()

JsonLine obj ( )
inline

return JsonLine has sub-dictionary of this one

Definition at line 206 of file json_logger.hpp.

◆ operator<<() [1/3]

JsonLine & operator<< ( Type const &  t)
inline

output any type

template << forwards to Put for ADL type switching

Definition at line 407 of file json_logger.hpp.

References thrill::common::Put().

◆ operator<<() [2/3]

JsonLine& operator<< ( const JsonBeginObj t)
inline

Definition at line 146 of file json_logger.hpp.

References thrill::api::operator<<(), and JsonBeginObj::str_.

◆ operator<<() [3/3]

JsonLine& operator<< ( const JsonEndObj )
inline

Definition at line 155 of file json_logger.hpp.

◆ operator=()

JsonLine& operator= ( const JsonLine )
delete

non-copyable: delete assignment operator

◆ PutEscapedChar()

void PutEscapedChar ( char  ch)
inline

Definition at line 222 of file json_logger.hpp.

Referenced by thrill::common::Put().

◆ PutSeparator()

void PutSeparator ( )
inline

put an items separator (either ',' or ':') and increment counter.

Definition at line 215 of file json_logger.hpp.

◆ sub()

JsonLine sub ( const Key &  key)
inline

return JsonLine has sub-dictionary of this one

Definition at line 187 of file json_logger.hpp.

References thrill::api::operator<<().

Referenced by Manager::RunTask(), and thrill::mem::update_memprofile().

Member Data Documentation

◆ items_

size_t items_ = 0

items counter for output stream

Definition at line 266 of file json_logger.hpp.

Referenced by thrill::common::Put().

◆ lock_

std::unique_lock<std::mutex> lock_
private

lock on the logger output stream

Definition at line 251 of file json_logger.hpp.

◆ logger_

JsonLogger* logger_ = nullptr
private

when destructed this object is delivered to the output.

Definition at line 248 of file json_logger.hpp.

◆ os_

std::ostream& os_

reference to output stream

Definition at line 263 of file json_logger.hpp.

Referenced by thrill::common::Put().

◆ sub_array_

bool sub_array_ = false

indicator for sub-array.

Definition at line 272 of file json_logger.hpp.

◆ sub_dict_

bool sub_dict_ = false

indicator for sub-dictionaries.

Definition at line 269 of file json_logger.hpp.


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