9 #ifndef STK_UTIL_ENVIRONMENT_LOGCONTROL_HPP 10 #define STK_UTIL_ENVIRONMENT_LOGCONTROL_HPP 17 #include <stk_util/util/string_case_compare.hpp> 48 virtual bool next() = 0;
95 struct LogControlRuleInterval :
public LogControlRule
103 LogControlRuleInterval(
int interval);
109 virtual ~LogControlRuleInterval()
117 virtual LogControlRule *clone()
const {
118 return new LogControlRuleInterval(*
this);
140 typedef std::map<std::string, LogControlRule *, LessCase> Map;
147 for (Map::iterator it = m_ruleMap.begin(); it != m_ruleMap.end(); ++it)
151 void addLogControlRule(
const std::string &rule_name,
const LogControlRule &rule) {
152 Map::iterator it = m_ruleMap.find(rule_name);
153 if (it != m_ruleMap.end())
156 m_ruleMap[rule_name] = rule.clone();
159 LogControlRule *getLogControlRule(
const std::string &rule_name) {
160 Map::iterator it = m_ruleMap.find(rule_name);
162 if (it != m_ruleMap.end())
166 std::pair<Map::iterator, bool> result = m_ruleMap.insert(Map::value_type(rule_name,
new LogControlRuleAlways));
167 return (*result.first).second;
224 LogControl(std::ostream &log_stream,
const std::string &rule_name);
252 std::ostream & m_logStream;
253 std::streambuf * m_logStreambuf;
254 std::ostringstream m_cacheStream;
263 #endif // STK_UTIL_ENVIRONMENT_LOGCONTROL_HPP virtual bool next()=0
Member function next returns true if the log stream should write to the log file, and false if the lo...
virtual LogControlRule * clone() const =0
Member function clone creates a clone of the rule.
Output is to be written to the cache stream.
Class LogControl provides a mechanism for reducing excessive output. The output is redirected to a ca...
Interface LogControlRule describes the interface to a log control rule.
virtual LogControlRule * clone() const
Member function clone creates a duplicate LogControlRuleAlways object.
virtual ~LogControlRuleAlways()
virtual bool next()
Member function next returns true to indicate that the log stream should write to the log file...
Output is to be written to the log stream.
State
Enumeration State describes the current state of the caching for this controller. ...
virtual ~LogControlRule()
Class LogControlRuleAlways is a log control rule that always wants to write to the log file...