LBANN  0.103.0
LivermoreBigArtificialNeuralNetworkToolkit
lbann::description Class Reference

Generates nicely formatted description messages. More...

#include <description.hpp>

Public Member Functions

 description (std::string title="")
 
void set_title (std::string title)
 
void add (std::string line)
 
template<typename T >
void add (std::string field, T value)
 
void add (const description &desc)
 

Private Attributes

std::string m_title
 
std::vector< std::string > m_lines
 

Friends

std::ostream & operator<< (std::ostream &os, const description &desc)
 

Detailed Description

Generates nicely formatted description messages.

Messages have hanging indentation and can be output to an output stream like std::cout. For example:

Title
  Some numerical field: 12.3
  A boolean parameter: true
  Miscellaneous statement

Definition at line 49 of file description.hpp.

Constructor & Destructor Documentation

◆ description()

lbann::description::description ( std::string  title = "")
Parameters
titleFirst line in description message.

Member Function Documentation

◆ add() [1/3]

void lbann::description::add ( std::string  line)

Add new line.

Here is the caller graph for this function:

◆ add() [2/3]

template<typename T >
void lbann::description::add ( std::string  field,
value 
)
inline

Add new line describing a field value.

The line is formatted:

<field>: <value> 

Definition at line 72 of file description.hpp.

Here is the call graph for this function:

◆ add() [3/3]

void lbann::description::add ( const description desc)

Insert a nested description.

The indentation in desc is combined with the current indentation. For instance:

Outer description
  Some numerical field: 12.3
    Nested description
      This: abc
      That: 123

◆ set_title()

void lbann::description::set_title ( std::string  title)

Set first line in description message.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const description desc 
)
friend

Print description to stream.

Member Data Documentation

◆ m_lines

std::vector<std::string> lbann::description::m_lines
private

Lines in message (excluding first line).

When printed, each line is indented.

Definition at line 106 of file description.hpp.

◆ m_title

std::string lbann::description::m_title
private

First line of message.

When printed, this line isn't indented.

Definition at line 100 of file description.hpp.


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