MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
maia::logtable::Data Struct Referencefinal

#include <logtable.h>

Inheritance diagram for maia::logtable::Data:
[legend]
Collaboration diagram for maia::logtable::Data:
[legend]

Public Types

enum  { LEFT , RIGHT }
 

Public Member Functions

 Data (MString title_, MString data_)
 
 Data (MString title_, MInt data_)
 
 Data (MString title_, MLong data_)
 
 Data (MString title_, MBool data_)
 
 Data (MString title_, MFloat data_)
 
MString buildString (const int shift=0) final
 
template<typename T >
DataaddData (const std::string &title_, T data_)
 
void addBlank ()
 
 ~Data () final
 
- Public Member Functions inherited from maia::logtable::FrameEntry
 FrameEntry (MString title_)
 
virtual ~FrameEntry ()=default
 
virtual MString buildString (const int shift=0)=0
 

Public Attributes

const MString data
 
const MInt alignment
 
std::vector< std::shared_ptr< FrameEntry > > entries
 
- Public Attributes inherited from maia::logtable::FrameEntry
const MString title
 

Detailed Description

Definition at line 32 of file logtable.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
LEFT 
RIGHT 

Definition at line 37 of file logtable.h.

Constructor & Destructor Documentation

◆ Data() [1/5]

maia::logtable::Data::Data ( MString  title_,
MString  data_ 
)
inline

Definition at line 42 of file logtable.h.

42: FrameEntry(title_), data(data_), alignment(LEFT){};
const MInt alignment
Definition: logtable.h:35
const MString data
Definition: logtable.h:33
FrameEntry(MString title_)
Definition: logtable.h:26

◆ Data() [2/5]

maia::logtable::Data::Data ( MString  title_,
MInt  data_ 
)
inline

Definition at line 45 of file logtable.h.

45: FrameEntry(title_), data(std::to_string(data_)), alignment(RIGHT){};

◆ Data() [3/5]

maia::logtable::Data::Data ( MString  title_,
MLong  data_ 
)
inline

Definition at line 48 of file logtable.h.

48: FrameEntry(title_), data(std::to_string(data_)), alignment(RIGHT){};

◆ Data() [4/5]

maia::logtable::Data::Data ( MString  title_,
MBool  data_ 
)
inline

Definition at line 51 of file logtable.h.

51: FrameEntry(title_), data(data_ ? "yes" : "no"), alignment(RIGHT){};

◆ Data() [5/5]

maia::logtable::Data::Data ( MString  title_,
MFloat  data_ 
)
inline

Definition at line 54 of file logtable.h.

54: FrameEntry(title_), data(std::to_string(data_)), alignment(RIGHT){};

◆ ~Data()

maia::logtable::Data::~Data ( )
inlinefinal

Definition at line 86 of file logtable.h.

86 {
87 for(auto&& en : entries) {
88 en.reset();
89 }
90 }
std::vector< std::shared_ptr< FrameEntry > > entries
Definition: logtable.h:39

Member Function Documentation

◆ addBlank()

void maia::logtable::Data::addBlank ( )
inline

Definition at line 81 of file logtable.h.

81 {
82 std::shared_ptr<Data> d = std::make_shared<Data>("", std::string(""));
83 entries.push_back(d);
84 }

◆ addData()

template<typename T >
Data & maia::logtable::Data::addData ( const std::string &  title_,
data_ 
)
inline

Definition at line 75 of file logtable.h.

75 {
76 std::shared_ptr<Data> d = std::make_shared<Data>(title_, data_);
77 entries.push_back(d);
78 return *d;
79 }

◆ buildString()

MString maia::logtable::Data::buildString ( const int  shift = 0)
inlinefinalvirtual

Implements maia::logtable::FrameEntry.

Definition at line 56 of file logtable.h.

56 {
57 std::stringstream ss;
58
59 ss << "| " << std::setw(width / 2 + shift) << std::left << title;
60 if(alignment == LEFT) {
61 ss << "| " << std::setw(width / 2 - 6) << std::left << data;
62 } else if(alignment == RIGHT) {
63 ss << "| " << std::setw(width / 2 - 6) << std::right << data;
64 }
65 ss << " |" << '\n';
66
67 for(auto&& entry : entries) {
68 ss << "| " << entry->buildString(shift - 2);
69 }
70
71 return ss.str();
72 }
const MInt width
Definition: logtable.h:21
const MString title
Definition: logtable.h:24

Member Data Documentation

◆ alignment

const MInt maia::logtable::Data::alignment

Definition at line 35 of file logtable.h.

◆ data

const MString maia::logtable::Data::data

Definition at line 33 of file logtable.h.

◆ entries

std::vector<std::shared_ptr<FrameEntry> > maia::logtable::Data::entries

Definition at line 39 of file logtable.h.


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