LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
lsst::pex::logging::PrinterFactory Class Reference

a factory used to create PrinterList instances to be used by a PropertyPrinter instance. More...

#include <PropertyPrinter.h>

Public Types

typedef PrinterList *(* factoryFuncPtr )(const lsst::daf::base::PropertySet &, const std::string &)
 

Public Member Functions

 PrinterFactory (bool loadDefaults=false)
 
void add (const std::type_info &tp, factoryFuncPtr func)
 
PrinterListmakePrinter (const lsst::daf::base::PropertySet &prop, const std::string &name) const
 

Private Types

typedef std::map< std::string,
factoryFuncPtr
Lookup
 

Private Member Functions

void _loadDefaults ()
 

Private Attributes

Lookup _factFuncs
 

Detailed Description

a factory used to create PrinterList instances to be used by a PropertyPrinter instance.

PrinterList classes are used to print out property values of a particular type. Typically, a default PrinterFactory is filled with support for the common primitive types and type classes that are important for logging. Other types can be supported by providing an implementation of PrinterList and corresponding iterator that support the type as well as an implementation of a factory function that creates a pointer to the specialized PrinterList. A pointer to the factory function is what one registers with this general PrinterFactory.

PrinterFactory::factoryFuncPtr defines the form of the factory function:

* PrinterList* (*makePrinterList)(const PropertySet&, const string&)
*

See PrinterList for more details about supporting a new type.

Definition at line 380 of file PropertyPrinter.h.

Member Typedef Documentation

typedef PrinterList*(* lsst::pex::logging::PrinterFactory::factoryFuncPtr)(const lsst::daf::base::PropertySet &, const std::string &)

Definition at line 383 of file PropertyPrinter.h.

typedef std::map<std::string, factoryFuncPtr> lsst::pex::logging::PrinterFactory::Lookup
private

Definition at line 403 of file PropertyPrinter.h.

Constructor & Destructor Documentation

lsst::pex::logging::PrinterFactory::PrinterFactory ( bool  loadDefaults = false)
inline

Definition at line 385 of file PropertyPrinter.h.

385  : _factFuncs() {
386  if (loadDefaults) _loadDefaults();
387  }

Member Function Documentation

void lsst::pex::logging::PrinterFactory::_loadDefaults ( )
private
void lsst::pex::logging::PrinterFactory::add ( const std::type_info &  tp,
factoryFuncPtr  func 
)
inline

Definition at line 389 of file PropertyPrinter.h.

389  {
390  _factFuncs[tp.name()] = func;
391  }
PrinterList* lsst::pex::logging::PrinterFactory::makePrinter ( const lsst::daf::base::PropertySet prop,
const std::string &  name 
) const
inline

Definition at line 393 of file PropertyPrinter.h.

395  {
396  Lookup::const_iterator fi = _factFuncs.find(prop.typeOf(name).name());
397  return (fi == _factFuncs.end()) ? 0 : (*(fi->second))(prop, name);
398  }
table::Key< std::string > name
Definition: ApCorrMap.cc:71
std::type_info const & typeOf(std::string const &name) const
Definition: PropertySet.cc:227

Member Data Documentation

Lookup lsst::pex::logging::PrinterFactory::_factFuncs
private

Definition at line 404 of file PropertyPrinter.h.


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