timemory 3.3.0
Modular C++ Toolkit for Performance Analysis and Logging. Profiling API and Tools for C, C++, CUDA, Fortran, and Python. The C++ template API is essentially a framework to creating tools: it is designed to provide a unifying interface for recording various performance measurements alongside data logging and interfaces to other tools.
tim::data::header Struct Reference

#include "timemory/data/stream.hpp"

+ Collaboration diagram for tim::data::header:

Public Types

using string_t = std::string
 
using stringstream_t = std::stringstream
 
using format_flags = std::ios_base::fmtflags
 

Public Member Functions

 header ()=default
 
 ~header ()=default
 
 header (const header &)=default
 
 header (header &&)=default
 
headeroperator= (const header &)=default
 
headeroperator= (header &&)=default
 
 header (const std::string &_val, format_flags _fmt={}, int _width=0, int _prec=0, bool _center=true)
 
template<typename Tp >
 header (const Tp &_val, format_flags _fmt, int _width, int _prec, bool _center=true)
 
string_t get () const
 
bool center () const
 
void center (bool v)
 
bool left () const
 
void left (bool v)
 
int row () const
 
void row (int v)
 
int width () const
 
void width (int v)
 
int column () const
 
void column (int v)
 
int precision () const
 
void precision (int v)
 
format_flags flags () const
 
void setf (format_flags v)
 
void operator() (const string_t &val)
 
template<typename Tp >
void construct (const Tp &val)
 
template<>
void construct (const timestamp_value_t &val)
 
template<>
void construct (const timestamp_value_t &val)
 

Protected Attributes

bool m_center = false
 
bool m_left = false
 
int m_row = 0
 
int m_column = 0
 
int m_width = 0
 
int m_precision = 0
 
format_flags m_format = {}
 
string_t m_value = {}
 

Detailed Description

Definition at line 187 of file stream.hpp.

Member Typedef Documentation

◆ format_flags

using tim::data::base::stream_entry::format_flags = std::ios_base::fmtflags
inherited

Definition at line 59 of file stream.hpp.

◆ string_t

using tim::data::base::stream_entry::string_t = std::string
inherited

Definition at line 57 of file stream.hpp.

◆ stringstream_t

using tim::data::base::stream_entry::stringstream_t = std::stringstream
inherited

Definition at line 58 of file stream.hpp.

Constructor & Destructor Documentation

◆ header() [1/5]

tim::data::header::header ( )
default

◆ ~header()

tim::data::header::~header ( )
default

◆ header() [2/5]

tim::data::header::header ( const header )
default

◆ header() [3/5]

tim::data::header::header ( header &&  )
default

◆ header() [4/5]

tim::data::header::header ( const std::string &  _val,
format_flags  _fmt = {},
int  _width = 0,
int  _prec = 0,
bool  _center = true 
)
inlineexplicit

Definition at line 196 of file stream.hpp.

196 {}, int _width = 0,
197 int _prec = 0, bool _center = true)
198 : base::stream_entry(0, -1, _fmt, _width, _prec, _center)
199 {
201 }
void construct(const Tp &val)
Definition: stream.hpp:98

◆ header() [5/5]

template<typename Tp >
tim::data::header::header ( const Tp &  _val,
format_flags  _fmt,
int  _width,
int  _prec,
bool  _center = true 
)
inlineexplicit

Definition at line 204 of file stream.hpp.

206 : base::stream_entry(0, -1, _fmt, _width, _prec, _center)
207 {
208 base::stream_entry::construct(std::forward<Tp>(_val));
209 }

References tim::data::base::stream_entry::construct().

Member Function Documentation

◆ center() [1/2]

bool tim::data::base::stream_entry::center ( ) const
inlineinherited

Definition at line 79 of file stream.hpp.

79{ return m_center; }
bool m_center
Definition: stream.hpp:128

References tim::data::base::stream_entry::m_center.

Referenced by tim::data::stream::operator()().

◆ center() [2/2]

void tim::data::base::stream_entry::center ( bool  v)
inlineinherited

Definition at line 87 of file stream.hpp.

87{ m_center = v; }

References tim::data::base::stream_entry::m_center.

◆ column() [1/2]

int tim::data::base::stream_entry::column ( ) const
inlineinherited

Definition at line 83 of file stream.hpp.

83{ return m_column; }
int m_column
Definition: stream.hpp:131

References tim::data::base::stream_entry::m_column.

Referenced by tim::data::stream::operator()().

◆ column() [2/2]

void tim::data::base::stream_entry::column ( int  v)
inlineinherited

Definition at line 91 of file stream.hpp.

91{ m_column = v; }

References tim::data::base::stream_entry::m_column.

◆ construct() [1/3]

template<>
void tim::data::base::stream_entry::construct ( const timestamp_value_t val)
inherited

Definition at line 144 of file timestamp.cpp.

146{
148 ss.setf(m_format);
149 ss << std::setprecision(m_precision) << component::timestamp::as_string(val) << " / "
150 << val.time_since_epoch().count();
151 m_value = ss.str();
152 if(settings::max_width() > 0 && m_value.length() > (size_t) settings::max_width())
153 {
154 //
155 // don't truncate and add ellipsis if max width is really small
156 //
157 if(settings::max_width() > 20)
158 {
159 m_value = m_value.substr(0, settings::max_width() - 3);
160 m_value += "...";
161 }
162 else
163 {
164 m_value = m_value.substr(0, settings::max_width());
165 }
166 }
167}
max_width
Definition: settings.cpp:1645
static std::string as_string(const time_point_type &_tp)
Definition: timestamp.cpp:64
format_flags m_format
Definition: stream.hpp:134
std::stringstream stringstream_t
Definition: stream.hpp:58
int m_precision
Definition: stream.hpp:133
string_t m_value
Definition: stream.hpp:135

References tim::component::timestamp::as_string(), tim::data::base::stream_entry::m_format, tim::data::base::stream_entry::m_precision, tim::data::base::stream_entry::m_value, and tim::max_width.

◆ construct() [2/3]

template<>
void tim::data::base::stream_entry::construct ( const timestamp_value_t val)
inherited

◆ construct() [3/3]

template<typename Tp >
void tim::data::base::stream_entry::construct ( const Tp &  val)
inlineinherited

Definition at line 98 of file stream.hpp.

99 {
101 ss.setf(m_format);
102 ss << std::setprecision(m_precision) << val;
103 m_value = ss.str();
104 if(settings::max_width() > 0 && m_value.length() > (size_t) settings::max_width())
105 {
106 //
107 // don't truncate and add ellipsis if max width is really small
108 //
109 if(settings::max_width() > 20)
110 {
111 m_value = m_value.substr(0, settings::max_width() - 3);
112 m_value += "...";
113 }
114 else
115 {
116 m_value = m_value.substr(0, settings::max_width());
117 }
118 }
119 }

References tim::data::base::stream_entry::m_format, tim::data::base::stream_entry::m_precision, tim::data::base::stream_entry::m_value, and tim::max_width.

Referenced by tim::data::entry::entry(), and header().

◆ flags()

format_flags tim::data::base::stream_entry::flags ( ) const
inlineinherited

Definition at line 85 of file stream.hpp.

85{ return m_format; }

References tim::data::base::stream_entry::m_format.

Referenced by tim::data::entry::flags().

◆ get()

string_t tim::data::base::stream_entry::get ( ) const
inlineinherited

Definition at line 77 of file stream.hpp.

77{ return m_value; }

References tim::data::base::stream_entry::m_value.

Referenced by tim::data::stream::operator()().

◆ left() [1/2]

bool tim::data::base::stream_entry::left ( ) const
inlineinherited

Definition at line 80 of file stream.hpp.

80{ return m_left; }
bool m_left
Definition: stream.hpp:129

References tim::data::base::stream_entry::m_left.

◆ left() [2/2]

void tim::data::base::stream_entry::left ( bool  v)
inlineinherited

Definition at line 88 of file stream.hpp.

88{ m_left = v; }

References tim::data::base::stream_entry::m_left.

◆ operator()()

void tim::data::base::stream_entry::operator() ( const string_t val)
inlineinherited

Definition at line 95 of file stream.hpp.

95{ m_value = val; }

References tim::data::base::stream_entry::m_value.

◆ operator=() [1/2]

header & tim::data::header::operator= ( const header )
default

◆ operator=() [2/2]

header & tim::data::header::operator= ( header &&  )
default

◆ precision() [1/2]

int tim::data::base::stream_entry::precision ( ) const
inlineinherited

Definition at line 84 of file stream.hpp.

84{ return m_precision; }

References tim::data::base::stream_entry::m_precision.

Referenced by tim::data::entry::precision().

◆ precision() [2/2]

void tim::data::base::stream_entry::precision ( int  v)
inlineinherited

Definition at line 92 of file stream.hpp.

92{ m_precision = v; }

References tim::data::base::stream_entry::m_precision.

◆ row() [1/2]

int tim::data::base::stream_entry::row ( ) const
inlineinherited

Definition at line 81 of file stream.hpp.

81{ return m_row; }
int m_row
Definition: stream.hpp:130

References tim::data::base::stream_entry::m_row.

Referenced by tim::data::stream::operator()().

◆ row() [2/2]

void tim::data::base::stream_entry::row ( int  v)
inlineinherited

Definition at line 89 of file stream.hpp.

89{ m_row = v; }

References tim::data::base::stream_entry::m_row.

◆ setf()

void tim::data::base::stream_entry::setf ( format_flags  v)
inlineinherited

Definition at line 93 of file stream.hpp.

93{ m_format = v; }

References tim::data::base::stream_entry::m_format.

Referenced by tim::data::entry::setf().

◆ width() [1/2]

int tim::data::base::stream_entry::width ( ) const
inlineinherited

◆ width() [2/2]

void tim::data::base::stream_entry::width ( int  v)
inlineinherited

Definition at line 90 of file stream.hpp.

90{ m_width = v; }

References tim::data::base::stream_entry::m_width.

Member Data Documentation

◆ m_center

bool tim::data::base::stream_entry::m_center = false
protectedinherited

Definition at line 128 of file stream.hpp.

Referenced by tim::data::entry::entry(), and tim::data::base::stream_entry::center().

◆ m_column

int tim::data::base::stream_entry::m_column = 0
protectedinherited

Definition at line 131 of file stream.hpp.

Referenced by tim::data::base::stream_entry::column().

◆ m_format

format_flags tim::data::base::stream_entry::m_format = {}
protectedinherited

◆ m_left

bool tim::data::base::stream_entry::m_left = false
protectedinherited

Definition at line 129 of file stream.hpp.

Referenced by tim::data::entry::entry(), and tim::data::base::stream_entry::left().

◆ m_precision

int tim::data::base::stream_entry::m_precision = 0
protectedinherited

◆ m_row

int tim::data::base::stream_entry::m_row = 0
protectedinherited

Definition at line 130 of file stream.hpp.

Referenced by tim::data::base::stream_entry::row().

◆ m_value

string_t tim::data::base::stream_entry::m_value = {}
protectedinherited

◆ m_width

int tim::data::base::stream_entry::m_width = 0
protectedinherited

Definition at line 132 of file stream.hpp.

Referenced by tim::data::base::stream_entry::width().


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