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