gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-2191-ga4742ac
a Global And Modular Bsm Inference Tool
Gambit::Printers::BaseReader Class Reference

BASE PRINTER CLASS. More...

#include <baseprinter.hpp>

Inheritance diagram for Gambit::Printers::BaseReader:
Collaboration diagram for Gambit::Printers::BaseReader:

Public Member Functions

 BaseReader ()
 
virtual ~BaseReader ()
 Destructor. More...
 
template<typename T >
bool retrieve (T &out, const std::string &label)
 Reimplement overload for 'retrieve' that uses the current point as the input for rank/pointID. More...
 
template<typename T >
bool retrieve (T &out, const std::string &label, const uint rank, const ulong pointID)
 
bool retrieve_and_print (const std::string &in_label, const std::string &out_label, BaseBasePrinter &printer, const uint rank, const ulong pointID)
 Retrieve and directly print data to new output. More...
 
- Public Member Functions inherited from Gambit::Printers::BaseBaseReader
virtual ~BaseBaseReader ()
 
virtual void reset ()=0
 
virtual ulong get_dataset_length ()=0
 
virtual PPIDpair get_current_point ()=0
 
virtual ulong get_current_index ()=0
 
virtual PPIDpair get_next_point ()=0
 
virtual bool eoi ()=0
 
template<typename T >
bool retrieve (T &out, const std::string &label, const uint rank, const ulong pointID)
 Printer-retrieve dispatch function. More...
 
template<typename T >
bool retrieve (T &out, const std::string &label)
 Overload for 'retrieve' that uses the current point as the input for rank/pointID. More...
 
bool retrieve_and_print (const std::string &label, BaseBasePrinter &printer, const uint rank, const ulong pointID)
 Retrieve and directly print data to new output. More...
 
bool retrieve_and_print (const std::string &label, BaseBasePrinter &printer)
 Overload for 'retrieve_and_print' that uses the current point as the input for rank/pointID. More...
 
bool retrieve_and_print (const std::string &in_label, const std::string &out_label, BaseBasePrinter &printer)
 As above, but allows for different input/output labels. More...
 
virtual std::size_t get_type (const std::string &label)=0
 Get type information for a data entry, i.e. More...
 
virtual std::set< std::string > get_all_labels ()=0
 Get list of output labels that can be retrieved by this printer. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Gambit::Printers::BaseBaseReader
template<typename T >
bool _retrieve (T &, const std::string &label, const uint, const ulong)
 Default _retrieve function. More...
 

Detailed Description

BASE PRINTER CLASS.

BASE READER CLASS

Definition at line 188 of file baseprinter.hpp.

Constructor & Destructor Documentation

◆ BaseReader()

Gambit::Printers::BaseReader::BaseReader ( )
inline

Definition at line 191 of file baseprinter.hpp.

191 {}

◆ ~BaseReader()

virtual Gambit::Printers::BaseReader::~BaseReader ( )
inlinevirtual

Destructor.

Definition at line 194 of file baseprinter.hpp.

194 {}

Member Function Documentation

◆ retrieve() [1/2]

template<typename T >
bool Gambit::Printers::BaseReader::retrieve ( T &  out,
const std::string &  label 
)
inline

Reimplement overload for 'retrieve' that uses the current point as the input for rank/pointID.

Definition at line 200 of file baseprinter.hpp.

References Gambit::Printers::PPIDpair::pointID, and Gambit::Printers::PPIDpair::rank.

Referenced by Gambit::SpecBit::get_MSSM_spectrum_from_postprocessor().

201  {
202  PPIDpair pt = get_current_point();
203  return retrieve(out, label, pt.rank, pt.pointID);
204  }
virtual PPIDpair get_current_point()=0
bool retrieve(T &out, const std::string &label)
Reimplement overload for &#39;retrieve&#39; that uses the current point as the input for rank/pointID.
Here is the caller graph for this function:

◆ retrieve() [2/2]

template<typename T >
bool Gambit::Printers::BaseReader::retrieve ( T &  out,
const std::string &  label,
const uint  rank,
const ulong  pointID 
)
inline

Definition at line 208 of file baseprinter.hpp.

References Gambit::Printers::BaseBaseReader::_retrieve(), ADD_VIRTUAL_RETRIEVALS, Gambit::Printers::gambit_registry, combine_hdf5::rank, and RETRIEVABLE_TYPES.

209  {
210  return _retrieve(out, label, rank, pointID);
211  }
bool _retrieve(T &, const std::string &label, const uint, const ulong)
Default _retrieve function.
Here is the call graph for this function:

◆ retrieve_and_print()

bool Gambit::Printers::BaseReader::retrieve_and_print ( const std::string &  in_label,
const std::string &  out_label,
BaseBasePrinter printer,
const uint  rank,
const ulong  pointID 
)
virtual

Retrieve and directly print data to new output.

First need to get the type data for 'in_label', then call appropriate retrieve and print functions. I think there is no choice but to do this with a big switch. Also need to check if the type matches what the printer expects, and decide what to do in case of mismatch.

Implements Gambit::Printers::BaseBaseReader.

Definition at line 50 of file baseprinter.cpp.

References Gambit::LogTags::err, LOCAL_INFO, PRINTABLE_TYPES, Gambit::Printers::printer_error(), and TYPE_CASES.

51  {
56  bool valid = false; // Switch to true if value is successfully retrieved for this point
57  #define TYPE_CASES(r,data,elem) \
58  if( get_type(in_label) == getTypeID<elem>()) \
59  { \
60  elem buffer; \
61  valid = retrieve(buffer, in_label, rank, pointID); \
62  if(valid) \
63  { \
64  printer.print(buffer, out_label, rank, pointID); \
65  } \
66  } else
67  BOOST_PP_SEQ_FOR_EACH(TYPE_CASES, _, PRINTABLE_TYPES)
68  #undef TYPE_CASES
69  {
70  std::ostringstream err;
71  err << "Did not recognise retrieved type for data label '"<<in_label<<"'! This may indicate a bug in the Reader class you are using, please report it.";
72  printer_error().raise(LOCAL_INFO,err.str());
73  }
74  return valid;
75  }
EXPORT_SYMBOLS error & printer_error()
Printer errors.
#define LOCAL_INFO
Definition: local_info.hpp:34
#define PRINTABLE_TYPES
#define TYPE_CASES(r, data, elem)
Here is the call graph for this function:

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