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::entry Struct Reference

#include "timemory/data/stream.hpp"

+ Collaboration diagram for tim::data::entry:

Public Types

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

Public Member Functions

template<typename Tp >
 entry (Tp &&_val, header &_hdr, bool _center=false, bool _left=false)
 
 entry (const std::string &_val, header &_hdr, bool _center=false, bool _left=true)
 
 entry (const entry &_rhs)
 
 ~entry ()=default
 
 entry (entry &&)=default
 
entryoperator= (const entry &)=default
 
entryoperator= (entry &&)=default
 
bool permit_empty () const
 
int width () const
 
int precision () const
 
format_flags flags () const
 
void permit_empty (bool v)
 
void width (int v)
 
void precision (int v)
 
void setf (format_flags v)
 
const headerget_header () const
 
headerget_header ()
 
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 column () const
 
void column (int 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 214 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

◆ entry() [1/4]

template<typename Tp >
tim::data::entry::entry ( Tp &&  _val,
header _hdr,
bool  _center = false,
bool  _left = false 
)
inlineexplicit

Definition at line 217 of file stream.hpp.

218 : base::stream_entry(_hdr)
219 , m_hdr(&_hdr)
220
221 {
222 m_center = _center;
223 m_left = _left;
224 base::stream_entry::construct(std::forward<Tp>(_val));
225 }
bool m_left
Definition: stream.hpp:129
bool m_center
Definition: stream.hpp:128
void construct(const Tp &val)
Definition: stream.hpp:98

References tim::data::base::stream_entry::construct(), tim::data::base::stream_entry::m_center, and tim::data::base::stream_entry::m_left.

◆ entry() [2/4]

tim::data::entry::entry ( const std::string &  _val,
header _hdr,
bool  _center = false,
bool  _left = true 
)
inlineexplicit

Definition at line 227 of file stream.hpp.

229 : base::stream_entry(_hdr)
230 , m_hdr(&_hdr)
231 , m_permit_empty(true)
232 {
233 m_center = _center;
234 m_left = _left;
236 }

References tim::data::base::stream_entry::construct(), tim::data::base::stream_entry::m_center, and tim::data::base::stream_entry::m_left.

◆ entry() [3/4]

tim::data::entry::entry ( const entry _rhs)
inline

Definition at line 238 of file stream.hpp.

239 : base::stream_entry(_rhs)
240 , m_hdr(_rhs.m_hdr)
241 {}

◆ ~entry()

tim::data::entry::~entry ( )
default

◆ entry() [4/4]

tim::data::entry::entry ( entry &&  )
default

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; }

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 entry(), and tim::data::header::header().

◆ flags()

format_flags tim::data::entry::flags ( ) const
inline

Definition at line 251 of file stream.hpp.

251{ return m_hdr->flags(); }
format_flags flags() const
Definition: stream.hpp:85

References tim::data::base::stream_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()().

◆ get_header() [1/2]

header & tim::data::entry::get_header ( )
inline

Definition at line 259 of file stream.hpp.

259{ return *m_hdr; }

◆ get_header() [2/2]

const header & tim::data::entry::get_header ( ) const
inline

Definition at line 258 of file stream.hpp.

258{ return *m_hdr; }

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; }

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]

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

◆ operator=() [2/2]

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

◆ permit_empty() [1/2]

bool tim::data::entry::permit_empty ( ) const
inline

Definition at line 248 of file stream.hpp.

248{ return m_permit_empty; }

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

◆ permit_empty() [2/2]

void tim::data::entry::permit_empty ( bool  v)
inline

Definition at line 253 of file stream.hpp.

253{ m_permit_empty = v; }

◆ precision() [1/2]

int tim::data::entry::precision ( ) const
inline

Definition at line 250 of file stream.hpp.

250{ return m_hdr->precision(); }
int precision() const
Definition: stream.hpp:84

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

◆ precision() [2/2]

void tim::data::entry::precision ( int  v)
inline

Definition at line 255 of file stream.hpp.

255{ m_hdr->precision(v); }

References tim::data::base::stream_entry::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::entry::setf ( format_flags  v)
inline

Definition at line 256 of file stream.hpp.

256{ m_hdr->setf(v); }
void setf(format_flags v)
Definition: stream.hpp:93

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

◆ width() [1/2]

int tim::data::entry::width ( ) const
inline

Definition at line 249 of file stream.hpp.

249{ return m_hdr->width(); }
int width() const
Definition: stream.hpp:82

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

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

◆ width() [2/2]

void tim::data::entry::width ( int  v)
inline

Definition at line 254 of file stream.hpp.

254{ m_hdr->width(v); }

References tim::data::base::stream_entry::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 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 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: