33 #include <boost/enable_shared_from_this.hpp>
34 #include <boost/function.hpp>
35 #include <boost/shared_ptr.hpp>
55 class LoggerTreeNode:
public boost::enable_shared_from_this<LoggerTreeNode> {
99 typedef boost::function<
boost::shared_ptr< LoggerProxy > LoggerProxyPtr
LoggerTreeNodePtr getParent() const
Visitor interface to operate on the tree.
A simple tree representation for loggers.
void setAssignedLevel(boost::shared_ptr< Logger::Level > level)
LoggerTreeNodePtr getChild(const std::string &name) const
LoggerTreeNodeWeakPtr parent
void setLoggerProxy(LoggerProxyPtr loggerProxy)
std::vector< std::string > NamePath
A unique representation of a name.
Level
Possible logging levels.
LoggerProxyPtr getLoggerProxy() const
LoggerProxyPtr loggerProxy
std::string name
New name part of this node.
LoggerTreeNode(const std::string &name, LoggerTreeNodeWeakPtr parent)
Creates a new node without an assigned LoggerProxy.
bool hasChild(const std::string &name) const
boost::shared_ptr< Logger::Level > getAssignedLevel() const
boost::shared_ptr< LoggerTreeNode > LoggerTreeNodePtr
boost::shared_ptr< Visitor > VisitorPtr
virtual bool visit(const NamePath &path, LoggerTreeNodePtr node, const Logger::Level &parentLevel)=0
Called for each node in the tree.
boost::shared_ptr< Logger::Level > assignedLevel
std::string getName() const
std::map< std::string, LoggerTreeNodePtr > children
bool hasAssignedLevel() const
void visit(VisitorPtr visitor, const NamePath &thisPath=NamePath())
Visits every sub-node excluding this node.
boost::function< LoggerProxyPtr(const NamePath &name, LoggerTreeNodePtr node)> CreateFunction
boost::weak_ptr< LoggerTreeNode > LoggerTreeNodeWeakPtr
static std::string pathToName(const NamePath &path)
static NamePath nameToPath(const std::string &name)
Converts a string name of the form a.test.string to a hierarchical logger path representation.
LoggerTreeNodePtr addChildren(const NamePath &path, CreateFunction createFn, const NamePath &processedPath=NamePath())
Retrieves an (indirect) child and creates required ancestors of this child using a custom callback me...
bool addChild(LoggerTreeNodePtr child)
Adds a child if it does not exist so far.