Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::Stat Class Referenceabstract

Base class for a statistic that can be pretty-printed. More...

#include <stats.h>

Inheritance diagram for operations_research::Stat:
operations_research::DistributionStat operations_research::DoubleDistribution operations_research::IntegerDistribution operations_research::RatioDistribution operations_research::TimeDistribution

Public Member Functions

 Stat (absl::string_view name)
 
 Stat (absl::string_view name, StatsGroup *group)
 Also add this stat to the given group.
 
virtual ~Stat ()
 
std::string Name () const
 Only used for display purposes.
 
std::string StatString () const
 
virtual int Priority () const
 
virtual double Sum () const
 
virtual std::string ValueAsString () const =0
 Prints information about this statistic.
 
virtual bool WorthPrinting () const =0
 Is this stat worth printing? Usually false if nothing was measured.
 
virtual void Reset ()=0
 Reset this statistic to the same state as if it was newly created.
 

Detailed Description

Base class for a statistic that can be pretty-printed.

Definition at line 90 of file stats.h.

Constructor & Destructor Documentation

◆ Stat() [1/2]

operations_research::Stat::Stat ( absl::string_view name)
inlineexplicit

Definition at line 92 of file stats.h.

◆ Stat() [2/2]

operations_research::Stat::Stat ( absl::string_view name,
StatsGroup * group )

Also add this stat to the given group.

Definition at line 48 of file stats.cc.

◆ ~Stat()

virtual operations_research::Stat::~Stat ( )
inlinevirtual

Definition at line 96 of file stats.h.

Member Function Documentation

◆ Name()

std::string operations_research::Stat::Name ( ) const
inline

Only used for display purposes.

Definition at line 99 of file stats.h.

◆ Priority()

virtual int operations_research::Stat::Priority ( ) const
inlinevirtual

At display, stats are displayed by decreasing priority, then decreasing Sum(), then alphabetical order. Used to group the stats per category (timing, ratio, etc..,).

Reimplemented in operations_research::TimeDistribution.

Definition at line 108 of file stats.h.

◆ Reset()

virtual void operations_research::Stat::Reset ( )
pure virtual

Reset this statistic to the same state as if it was newly created.

Implemented in operations_research::DistributionStat.

◆ StatString()

std::string operations_research::Stat::StatString ( ) const

Returns a human-readable formatted line of the form "name: ValueAsString()".

Definition at line 52 of file stats.cc.

◆ Sum()

virtual double operations_research::Stat::Sum ( ) const
inlinevirtual

By default return 0 for the sum. This makes it possible to sort stats by decreasing total time.

Reimplemented in operations_research::DistributionStat.

Definition at line 112 of file stats.h.

◆ ValueAsString()

virtual std::string operations_research::Stat::ValueAsString ( ) const
pure virtual

◆ WorthPrinting()

virtual bool operations_research::Stat::WorthPrinting ( ) const
pure virtual

Is this stat worth printing? Usually false if nothing was measured.

Implemented in operations_research::DistributionStat.


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