Public Member Functions | Private Attributes | List of all members
stan::test::unit::instrumented_writer Class Reference

#include "test/unit/services/instrumented_callbacks.hpp"

Inheritance diagram for stan::test::unit::instrumented_writer:
stan::callbacks::writer

Public Member Functions

 instrumented_writer ()
 
void operator() (const std::string &key, double value)
 
void operator() (const std::string &key, int value)
 
void operator() (const std::string &key, const std::string &value)
 
void operator() (const std::string &key, const double *values, int n_values)
 
void operator() (const std::string &key, const double *values, int n_rows, int n_cols)
 
void operator() (const std::vector< std::string > &names)
 
void operator() (const std::vector< double > &state)
 
void operator() ()
 
void operator() (const std::string &message)
 
unsigned int call_count ()
 
unsigned int call_count (std::string s)
 
std::vector< std::pair< std::string, double > > string_double_values ()
 
std::vector< std::pair< std::string, int > > string_int_values ()
 
std::vector< std::pair< std::string, std::string > > string_string_values ()
 
std::vector< std::pair< std::string, std::vector< double > > > string_pdouble_int_values ()
 
std::vector< std::pair< std::string, Eigen::MatrixXd > > string_pdouble_int_int_values ()
 
std::vector< std::vector< std::string > > vector_string_values ()
 
std::vector< std::vector< double > > vector_double_values ()
 
std::vector< std::stringstring_values ()
 

Private Attributes

std::map< std::string, intcounter_
 
std::vector< std::pair< std::string, double > > string_double
 
std::vector< std::pair< std::string, int > > string_int
 
std::vector< std::pair< std::string, std::string > > string_string
 
std::vector< std::pair< std::string, std::vector< double > > > string_pdouble_int
 
std::vector< std::pair< std::string, Eigen::MatrixXd > > string_pdouble_int_int
 
std::vector< std::vector< std::string > > vector_string
 
std::vector< std::vector< double > > vector_double
 
std::vector< std::string > string
 

Detailed Description

instrumented_writer counts the number of times it is called through each route and makes the count available via methods. Stores all arguments passed and makes them available via methods.

Definition at line 40 of file instrumented_callbacks.hpp.

Constructor & Destructor Documentation

stan::test::unit::instrumented_writer::instrumented_writer ( )
inline

Definition at line 42 of file instrumented_callbacks.hpp.

42 {}

Member Function Documentation

unsigned int stan::test::unit::instrumented_writer::call_count ( )
inline

Definition at line 101 of file instrumented_callbacks.hpp.

References stan::test::unit::instrumented_interrupt::counter_, it, and getGoodRuns4SAM::n.

Referenced by TEST_F().

101  {
102  unsigned int n = 0;
103  for (std::map<std::string, int>::iterator it=counter_.begin();
104  it!=counter_.end(); ++it)
105  n += it->second;
106  return n;
107  }
set< int >::iterator it
unsigned int stan::test::unit::instrumented_writer::call_count ( std::string  s)
inline

Definition at line 109 of file instrumented_callbacks.hpp.

References stan::test::unit::instrumented_interrupt::counter_.

109  {
110  return counter_[s];
111  }
const XML_Char * s
Definition: expat.h:262
void stan::test::unit::instrumented_writer::operator() ( const std::string key,
double  value 
)
inline

Definition at line 44 of file instrumented_callbacks.hpp.

References stan::test::unit::instrumented_interrupt::counter_, and make_pair().

44  {
45  counter_["string_double"]++;
47  }
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:336
std::vector< std::pair< std::string, double > > string_double
const XML_Char int const XML_Char * value
Definition: expat.h:331
void stan::test::unit::instrumented_writer::operator() ( const std::string key,
int  value 
)
inline

Definition at line 49 of file instrumented_callbacks.hpp.

References stan::test::unit::instrumented_interrupt::counter_, and make_pair().

49  {
50  counter_["string_int"]++;
51  string_int.push_back(std::make_pair(key, value));
52  }
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:336
const XML_Char int const XML_Char * value
Definition: expat.h:331
std::vector< std::pair< std::string, int > > string_int
void stan::test::unit::instrumented_writer::operator() ( const std::string key,
const std::string value 
)
inline

Definition at line 54 of file instrumented_callbacks.hpp.

References stan::test::unit::instrumented_interrupt::counter_, and make_pair().

54  {
55  counter_["string_string"]++;
57  }
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:336
const XML_Char int const XML_Char * value
Definition: expat.h:331
std::vector< std::pair< std::string, std::string > > string_string
void stan::test::unit::instrumented_writer::operator() ( const std::string key,
const double *  values,
int  n_values 
)
inline

Definition at line 59 of file instrumented_callbacks.hpp.

References stan::test::unit::instrumented_interrupt::counter_, MECModelEnuComparisons::i, and make_pair().

61  {
62  counter_["string_pdouble_int"]++;
63  if (n_values == 0) return;
64  std::vector<double> value(n_values);
65  for (int i = 0; i < n_values; ++i)
66  value[i] = values[i];
68  }
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:336
const XML_Char int const XML_Char * value
Definition: expat.h:331
std::vector< std::pair< std::string, std::vector< double > > > string_pdouble_int
void stan::test::unit::instrumented_writer::operator() ( const std::string key,
const double *  values,
int  n_rows,
int  n_cols 
)
inline

Definition at line 70 of file instrumented_callbacks.hpp.

References stan::test::unit::instrumented_interrupt::counter_, MECModelEnuComparisons::i, calib::j, and make_pair().

72  {
73  counter_["string_pdouble_int_int"]++;
74  if (n_rows == 0 || n_cols == 0) return;
75  Eigen::MatrixXd value(n_rows, n_cols);
76  for (int i = 0; i < n_rows; ++i)
77  for (int j = 0; j < n_cols; ++j)
78  value(i,j) = values[i*n_cols+j];
80  }
std::vector< std::pair< std::string, Eigen::MatrixXd > > string_pdouble_int_int
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:336
const XML_Char int const XML_Char * value
Definition: expat.h:331
const double j
Definition: BetheBloch.cxx:29
void stan::test::unit::instrumented_writer::operator() ( const std::vector< std::string > &  names)
inlinevirtual

Writes a set of names.

Parameters
[in]namesNames in a std::vector

Reimplemented from stan::callbacks::writer.

Definition at line 82 of file instrumented_callbacks.hpp.

References stan::test::unit::instrumented_interrupt::counter_.

82  {
83  counter_["vector_string"]++;
84  vector_string.push_back(names);
85  }
std::vector< std::vector< std::string > > vector_string
void stan::test::unit::instrumented_writer::operator() ( const std::vector< double > &  state)
inlinevirtual

Writes a set of values.

Parameters
[in]stateValues in a std::vector

Reimplemented from stan::callbacks::writer.

Definition at line 87 of file instrumented_callbacks.hpp.

References stan::test::unit::instrumented_interrupt::counter_.

87  {
88  counter_["vector_double"]++;
89  vector_double.push_back(state);
90  }
std::vector< std::vector< double > > vector_double
void stan::test::unit::instrumented_writer::operator() ( void  )
inlinevirtual

Writes blank input.

Reimplemented from stan::callbacks::writer.

Definition at line 92 of file instrumented_callbacks.hpp.

References stan::test::unit::instrumented_interrupt::counter_.

92  {
93  counter_["empty"]++;
94  }
void stan::test::unit::instrumented_writer::operator() ( const std::string message)
inlinevirtual

Writes a string.

Parameters
[in]messageA string

Reimplemented from stan::callbacks::writer.

Definition at line 96 of file instrumented_callbacks.hpp.

References stan::test::unit::instrumented_interrupt::counter_.

96  {
97  counter_["string"]++;
98  string.push_back(message);
99  }
std::vector<std::pair<std::string, double> > stan::test::unit::instrumented_writer::string_double_values ( )
inline

Definition at line 113 of file instrumented_callbacks.hpp.

113  {
114  return string_double;
115  };
std::vector< std::pair< std::string, double > > string_double
std::vector<std::pair<std::string, int> > stan::test::unit::instrumented_writer::string_int_values ( )
inline

Definition at line 117 of file instrumented_callbacks.hpp.

117  {
118  return string_int;
119  };
std::vector< std::pair< std::string, int > > string_int
std::vector<std::pair<std::string, Eigen::MatrixXd> > stan::test::unit::instrumented_writer::string_pdouble_int_int_values ( )
inline

Definition at line 129 of file instrumented_callbacks.hpp.

129  {
130  return string_pdouble_int_int;
131  };
std::vector< std::pair< std::string, Eigen::MatrixXd > > string_pdouble_int_int
std::vector<std::pair<std::string, std::vector<double> > > stan::test::unit::instrumented_writer::string_pdouble_int_values ( )
inline

Definition at line 125 of file instrumented_callbacks.hpp.

125  {
126  return string_pdouble_int;
127  };
std::vector< std::pair< std::string, std::vector< double > > > string_pdouble_int
std::vector<std::pair<std::string, std::string> > stan::test::unit::instrumented_writer::string_string_values ( )
inline

Definition at line 121 of file instrumented_callbacks.hpp.

121  {
122  return string_string;
123  };
std::vector< std::pair< std::string, std::string > > string_string
std::vector<std::string> stan::test::unit::instrumented_writer::string_values ( )
inline

Definition at line 141 of file instrumented_callbacks.hpp.

References string.

Referenced by stan::test::unit::check_adaptation(), stan::test::unit::check_different(), and TEST_F().

141  {
142  return string;
143  };
std::vector<std::vector<double> > stan::test::unit::instrumented_writer::vector_double_values ( )
inline

Definition at line 137 of file instrumented_callbacks.hpp.

Referenced by TEST_F().

137  {
138  return vector_double;
139  };
std::vector< std::vector< double > > vector_double
std::vector<std::vector<std::string> > stan::test::unit::instrumented_writer::vector_string_values ( )
inline

Definition at line 133 of file instrumented_callbacks.hpp.

Referenced by TEST_F().

133  {
134  return vector_string;
135  };
std::vector< std::vector< std::string > > vector_string

Member Data Documentation

std::map<std::string, int> stan::test::unit::instrumented_writer::counter_
private

Definition at line 143 of file instrumented_callbacks.hpp.

std::vector<std::string> stan::test::unit::instrumented_writer::string
private

Definition at line 155 of file instrumented_callbacks.hpp.

std::vector<std::pair<std::string, double> > stan::test::unit::instrumented_writer::string_double
private

Definition at line 148 of file instrumented_callbacks.hpp.

std::vector<std::pair<std::string, int> > stan::test::unit::instrumented_writer::string_int
private

Definition at line 149 of file instrumented_callbacks.hpp.

std::vector<std::pair<std::string, std::vector<double> > > stan::test::unit::instrumented_writer::string_pdouble_int
private

Definition at line 151 of file instrumented_callbacks.hpp.

std::vector<std::pair<std::string, Eigen::MatrixXd> > stan::test::unit::instrumented_writer::string_pdouble_int_int
private

Definition at line 152 of file instrumented_callbacks.hpp.

std::vector<std::pair<std::string, std::string> > stan::test::unit::instrumented_writer::string_string
private

Definition at line 150 of file instrumented_callbacks.hpp.

std::vector<std::vector<double> > stan::test::unit::instrumented_writer::vector_double
private

Definition at line 154 of file instrumented_callbacks.hpp.

std::vector<std::vector<std::string> > stan::test::unit::instrumented_writer::vector_string
private

Definition at line 153 of file instrumented_callbacks.hpp.


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