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 Member Functions | Private Attributes | List of all members
lsst::pex::logging::threshold::Memory Class Reference

#include <Memory.h>

Public Member Functions

 Memory (const std::string &delims=".")
 
int getThresholdFor (const std::string &name)
 
void setThresholdFor (const std::string &name, int threshold)
 
int getRootThreshold ()
 
void setRootThreshold (int threshold)
 
void forgetAllNames ()
 
void printThresholds (std::ostream &out)
 

Private Attributes

Family _tree
 
boost::char_separator< char > _sep
 

Detailed Description

a container for keeping track of the threshold data for a family of Logs. The actually mappings of log names to remembered threshold values is stored internally (privately) as a Family instance. One Memory instance shared by all the Log instances in a Log hierarchy, created first by the root log and passed (by shared pointer) to child logs as they are created.

Definition at line 171 of file Memory.h.

Constructor & Destructor Documentation

lsst::pex::logging::threshold::Memory::Memory ( const std::string &  delims = ".")

Definition at line 171 of file Memory.cc.

172  : _tree(), _sep(delims.c_str())
173 { }
boost::char_separator< char > _sep
Definition: Memory.h:223

Member Function Documentation

void lsst::pex::logging::threshold::Memory::forgetAllNames ( )
inline

reset the memory

Definition at line 213 of file Memory.h.

int lsst::pex::logging::threshold::Memory::getRootThreshold ( )
inline

return the default threshold value associated with the root of the hierarchy.

Definition at line 202 of file Memory.h.

int lsst::pex::logging::threshold::Memory::getThresholdFor ( const std::string &  name)
inline

return the threshold value associated with a given name

Definition at line 179 of file Memory.h.

179  {
180  if (name.length() == 0) return getRootThreshold();
181  tokenizer fields(name, _sep);
182  return _tree.getThresholdFor(fields.begin(), fields.end());
183  }
table::Key< std::string > name
Definition: ApCorrMap.cc:71
int getThresholdFor(tokenizer::iterator toptoken, const tokenizer::iterator &end) const
Definition: Memory.h:86
boost::tokenizer< boost::char_separator< char > > tokenizer
Definition: Memory.h:46
boost::char_separator< char > _sep
Definition: Memory.h:223
void lsst::pex::logging::threshold::Memory::printThresholds ( std::ostream &  out)

print the thresholds stored in this Memory that are not set to INHERIT.

Definition at line 178 of file Memory.cc.

178  {
179  out << "(root) ";
180  int top = _tree.getThreshold();
181  if (top < 10 && top >= 0) out << ' ';
182  out << top << endl;
183 
184  _tree.printDescThresholds(out, " ");
185 }
void printDescThresholds(std::ostream &out, const std::string &prefix) const
Definition: Memory.cc:146
void lsst::pex::logging::threshold::Memory::setRootThreshold ( int  threshold)
inline

return the default threshold value associated with the root of the hierarchy.

Definition at line 208 of file Memory.h.

208 { _tree.setThreshold(threshold); }
void setThreshold(int threshold)
Definition: Memory.h:81
void lsst::pex::logging::threshold::Memory::setThresholdFor ( const std::string &  name,
int  threshold 
)
inline

set the threshold value associated with a given name

Definition at line 188 of file Memory.h.

188  {
189  if (name.length() == 0) {
190  setRootThreshold(threshold);
191  }
192  else {
193  tokenizer fields(name, _sep);
194  _tree.setThresholdFor(fields.begin(), fields.end(), threshold);
195  }
196  }
void setThresholdFor(tokenizer::iterator toptoken, const tokenizer::iterator &end, int threshold)
Definition: Memory.cc:108
void setRootThreshold(int threshold)
Definition: Memory.h:208
table::Key< std::string > name
Definition: ApCorrMap.cc:71
boost::tokenizer< boost::char_separator< char > > tokenizer
Definition: Memory.h:46
boost::char_separator< char > _sep
Definition: Memory.h:223

Member Data Documentation

boost::char_separator<char> lsst::pex::logging::threshold::Memory::_sep
private

Definition at line 223 of file Memory.h.

Family lsst::pex::logging::threshold::Memory::_tree
private

Definition at line 222 of file Memory.h.


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