Generate doxygen list of all LogComponents
This commit is contained in:
@@ -39,8 +39,8 @@ namespace ns3 {
|
||||
static LogTimePrinter g_logTimePrinter = 0;
|
||||
static LogNodePrinter g_logNodePrinter = 0;
|
||||
|
||||
typedef std::map<std::string, LogComponent *> ComponentList;
|
||||
typedef std::map<std::string, LogComponent *>::iterator ComponentListI;
|
||||
typedef LogComponent::ComponentList ComponentList;
|
||||
typedef ComponentList::iterator ComponentListI;
|
||||
|
||||
static class PrintList
|
||||
{
|
||||
@@ -48,8 +48,9 @@ public:
|
||||
PrintList ();
|
||||
} g_printList;
|
||||
|
||||
static
|
||||
ComponentList *GetComponentList (void)
|
||||
/* static */
|
||||
LogComponent::ComponentList *
|
||||
LogComponent::GetComponentList (void)
|
||||
{
|
||||
static ComponentList components;
|
||||
return &components;
|
||||
@@ -85,8 +86,9 @@ PrintList::PrintList ()
|
||||
|
||||
|
||||
LogComponent::LogComponent (const std::string & name,
|
||||
const std::string & file,
|
||||
const enum LogLevel mask /* = 0 */)
|
||||
: m_levels (0), m_mask (mask), m_name (name)
|
||||
: m_levels (0), m_mask (mask), m_name (name), m_file (file)
|
||||
{
|
||||
EnvVarCheck ();
|
||||
|
||||
@@ -278,6 +280,12 @@ LogComponent::Name (void) const
|
||||
return m_name.c_str ();
|
||||
}
|
||||
|
||||
std::string
|
||||
LogComponent::File (void) const
|
||||
{
|
||||
return m_file;
|
||||
}
|
||||
|
||||
/* static */
|
||||
std::string
|
||||
LogComponent::GetLevelLabel(const enum LogLevel level)
|
||||
@@ -317,7 +325,7 @@ LogComponent::GetLevelLabel(const enum LogLevel level)
|
||||
void
|
||||
LogComponentEnable (char const *name, enum LogLevel level)
|
||||
{
|
||||
ComponentList *components = GetComponentList ();
|
||||
ComponentList *components = LogComponent::GetComponentList ();
|
||||
ComponentListI i;
|
||||
for (i = components->begin ();
|
||||
i != components->end ();
|
||||
@@ -341,7 +349,7 @@ LogComponentEnable (char const *name, enum LogLevel level)
|
||||
void
|
||||
LogComponentEnableAll (enum LogLevel level)
|
||||
{
|
||||
ComponentList *components = GetComponentList ();
|
||||
ComponentList *components = LogComponent::GetComponentList ();
|
||||
for (ComponentListI i = components->begin ();
|
||||
i != components->end ();
|
||||
i++)
|
||||
@@ -353,7 +361,7 @@ LogComponentEnableAll (enum LogLevel level)
|
||||
void
|
||||
LogComponentDisable (char const *name, enum LogLevel level)
|
||||
{
|
||||
ComponentList *components = GetComponentList ();
|
||||
ComponentList *components = LogComponent::GetComponentList ();
|
||||
for (ComponentListI i = components->begin ();
|
||||
i != components->end ();
|
||||
i++)
|
||||
@@ -369,7 +377,7 @@ LogComponentDisable (char const *name, enum LogLevel level)
|
||||
void
|
||||
LogComponentDisableAll (enum LogLevel level)
|
||||
{
|
||||
ComponentList *components = GetComponentList ();
|
||||
ComponentList *components = LogComponent::GetComponentList ();
|
||||
for (ComponentListI i = components->begin ();
|
||||
i != components->end ();
|
||||
i++)
|
||||
@@ -381,7 +389,7 @@ LogComponentDisableAll (enum LogLevel level)
|
||||
void
|
||||
LogComponentPrintList (void)
|
||||
{
|
||||
ComponentList *components = GetComponentList ();
|
||||
ComponentList *components = LogComponent::GetComponentList ();
|
||||
for (ComponentListI i = components->begin ();
|
||||
i != components->end ();
|
||||
i++)
|
||||
@@ -453,7 +461,7 @@ LogComponentPrintList (void)
|
||||
static bool ComponentExists(std::string componentName)
|
||||
{
|
||||
char const*name=componentName.c_str();
|
||||
ComponentList *components = GetComponentList ();
|
||||
ComponentList *components = LogComponent::GetComponentList ();
|
||||
ComponentListI i;
|
||||
for (i = components->begin ();
|
||||
i != components->end ();
|
||||
|
||||
@@ -186,7 +186,7 @@ void LogComponentDisableAll (enum LogLevel level);
|
||||
* \param name a string
|
||||
*/
|
||||
#define NS_LOG_COMPONENT_DEFINE(name) \
|
||||
static ns3::LogComponent g_log = ns3::LogComponent (name)
|
||||
static ns3::LogComponent g_log = ns3::LogComponent (name, __FILE__)
|
||||
|
||||
/**
|
||||
* \ingroup logging
|
||||
@@ -199,7 +199,7 @@ void LogComponentDisableAll (enum LogLevel level);
|
||||
* \param mask the default mask
|
||||
*/
|
||||
#define NS_LOG_COMPONENT_DEFINE_MASK(name, mask) \
|
||||
static ns3::LogComponent g_log = ns3::LogComponent (name, mask)
|
||||
static ns3::LogComponent g_log = ns3::LogComponent (name, __FILE__, mask)
|
||||
|
||||
/**
|
||||
* \ingroup logging
|
||||
@@ -289,7 +289,9 @@ public:
|
||||
* a log level helps prevent recursion by logging in
|
||||
* functions which help implement the logging facility.
|
||||
*/
|
||||
LogComponent (const std::string & name, const enum LogLevel mask = LOG_NONE);
|
||||
LogComponent (const std::string & name,
|
||||
const std::string & file,
|
||||
const enum LogLevel mask = LOG_NONE);
|
||||
/**
|
||||
* Check if this LogComponent is enabled for \pname{level}
|
||||
*
|
||||
@@ -321,6 +323,10 @@ public:
|
||||
* \return the name of this LogComponent.
|
||||
*/
|
||||
char const *Name (void) const;
|
||||
/**
|
||||
* Get the compilation unit defining this LogComponent.
|
||||
*/
|
||||
std::string File (void) const;
|
||||
/**
|
||||
* Get the string label for the given LogLevel.
|
||||
*
|
||||
@@ -334,6 +340,30 @@ public:
|
||||
* \param level the LogLevel to block
|
||||
*/
|
||||
void SetMask (const enum LogLevel level);
|
||||
|
||||
/**
|
||||
* LogComponent name map.
|
||||
*
|
||||
* \internal
|
||||
* This should really be considered an internal API.
|
||||
* It is exposed here to allow print-introspected-doxygen.cc
|
||||
* to generate a list of all LogComponents.
|
||||
*/
|
||||
typedef std::map<std::string, LogComponent *> ComponentList;
|
||||
|
||||
/**
|
||||
* Get the list of LogComponnents.
|
||||
*
|
||||
* \internal
|
||||
* This should really be considered an internal API.
|
||||
* It is exposed here to allow print-introspected-doxygen.cc
|
||||
* to generate a list of all LogComponents.
|
||||
*
|
||||
* \returns The list of LogComponents.
|
||||
*/
|
||||
static ComponentList *GetComponentList (void);
|
||||
|
||||
|
||||
private:
|
||||
/**
|
||||
* Parse the `NS_LOG` environment variable for options relating to this
|
||||
@@ -344,6 +374,7 @@ private:
|
||||
int32_t m_levels; //!< Enabled LogLevels
|
||||
int32_t m_mask; //!< Blocked LogLevels
|
||||
std::string m_name; //!< LogComponent name
|
||||
std::string m_file; //!< File defining this LogComponent
|
||||
|
||||
}; // class LogComponent
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("ns3::ArfWifiManager");
|
||||
NS_LOG_COMPONENT_DEFINE ("ArfWifiManager");
|
||||
|
||||
/**
|
||||
* \brief hold per-remote-station state for ARF Wifi manager.
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2007 INRIA
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
@@ -39,9 +59,7 @@ namespace
|
||||
std::string listLineStop; ///< end unordered list item
|
||||
std::string listStart; ///< start unordered list
|
||||
std::string listStop; ///< end unordered list
|
||||
std::string pageAttributeList; ///< start Attributes list
|
||||
std::string pageGlobalValueList; ///< start GlobalValue page
|
||||
std::string pageTraceSourceList; ///< start Trace sources page
|
||||
std::string page; ///< start a separate page
|
||||
std::string reference; ///< reference tag
|
||||
std::string sectionStart; ///< start of a section or group
|
||||
std::string subSectionStart; ///< start a new subsection
|
||||
@@ -76,9 +94,7 @@ SetMarkup (bool outputText)
|
||||
headingStart = "";
|
||||
headingStop = "";
|
||||
indentHtmlOnly = "";
|
||||
pageAttributeList = "";
|
||||
pageGlobalValueList = "";
|
||||
pageTraceSourceList = "";
|
||||
page = "Page ";
|
||||
listStart = "";
|
||||
listStop = "";
|
||||
listLineStart = " * ";
|
||||
@@ -106,9 +122,7 @@ SetMarkup (bool outputText)
|
||||
headingStart = "<h3>";
|
||||
headingStop = "</h3>";
|
||||
indentHtmlOnly = " ";
|
||||
pageAttributeList = "\\page AttributesList ";
|
||||
pageGlobalValueList = "\\page GlobalValueList ";
|
||||
pageTraceSourceList = "\\page TraceSourceList ";
|
||||
page = "\\page ";
|
||||
listStart = "<ul>";
|
||||
listStop = "</ul>";
|
||||
listLineStart = "<li>";
|
||||
@@ -351,7 +365,7 @@ PrintTraceSources (std::ostream & os, const TypeId tid)
|
||||
void
|
||||
PrintAllTraceSources (std::ostream & os)
|
||||
{
|
||||
os << commentStart << pageTraceSourceList << "All TraceSources\n"
|
||||
os << commentStart << page << "TraceSourceList All TraceSources\n"
|
||||
<< std::endl;
|
||||
|
||||
for (uint32_t i = 0; i < TypeId::GetRegisteredN (); ++i)
|
||||
@@ -390,8 +404,7 @@ p */
|
||||
void
|
||||
PrintAllAttributes (std::ostream & os)
|
||||
{
|
||||
|
||||
os << commentStart << pageAttributeList << "All Attributes\n"
|
||||
os << commentStart << page << "AttributeList All Attributes\n"
|
||||
<< std::endl;
|
||||
|
||||
for (uint32_t i = 0; i < TypeId::GetRegisteredN (); ++i)
|
||||
@@ -430,8 +443,7 @@ PrintAllAttributes (std::ostream & os)
|
||||
void
|
||||
PrintAllGlobals (std::ostream & os)
|
||||
{
|
||||
|
||||
os << commentStart << pageGlobalValueList << "All GlobalValues\n"
|
||||
os << commentStart << page << "GlobalValueList All GlobalValues\n"
|
||||
<< std::endl;
|
||||
|
||||
os << listStart << std::endl;
|
||||
@@ -458,6 +470,38 @@ PrintAllGlobals (std::ostream & os)
|
||||
} // PrintAllGlobals ()
|
||||
|
||||
|
||||
/**
|
||||
* Print the list of all LogComponents.
|
||||
*
|
||||
* \param [in,out] os The output stream.
|
||||
*/
|
||||
void
|
||||
PrintAllLogComponents (std::ostream & os)
|
||||
{
|
||||
os << commentStart << page << "LogComponentList All LogComponents\n"
|
||||
<< std::endl;
|
||||
|
||||
os << listStart << std::endl;
|
||||
LogComponent::ComponentList * logs = LogComponent::GetComponentList ();
|
||||
LogComponent::ComponentList::const_iterator it;
|
||||
for (it = logs->begin (); it != logs->end (); ++it)
|
||||
{
|
||||
std::string file = it->second->File ();
|
||||
if (file.find ("../") == 0)
|
||||
{
|
||||
file = file.substr (3);
|
||||
}
|
||||
|
||||
os << listLineStart
|
||||
<< boldStart << it->first << boldStop << ": " << file
|
||||
<< listLineStop
|
||||
<< std::endl;
|
||||
}
|
||||
os << listStop << std::endl;
|
||||
os << commentStop << std::endl;
|
||||
} // PrintAllLogComponents
|
||||
|
||||
|
||||
/**
|
||||
* Gather aggregation and configuration path information from registered types.
|
||||
*/
|
||||
@@ -864,6 +908,14 @@ int main (int argc, char *argv[])
|
||||
NodeContainer c;
|
||||
c.Create (1);
|
||||
|
||||
// mode-line: helpful when debugging introspected-doxygen.h
|
||||
if (!outputText)
|
||||
{
|
||||
std::cout << "/* -*- Mode:C++; c-file-style:\"gnu\"; "
|
||||
"indent-tabs-mode:nil; -*- */\n"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
// Get typical aggregation relationships.
|
||||
StaticInformation info = GetTypicalAggregations ();
|
||||
|
||||
@@ -897,9 +949,10 @@ int main (int argc, char *argv[])
|
||||
} // class documentation
|
||||
|
||||
|
||||
PrintAllTraceSources (std::cout);
|
||||
PrintAllAttributes (std::cout);
|
||||
PrintAllGlobals (std::cout);
|
||||
PrintAllLogComponents (std::cout);
|
||||
PrintAllTraceSources (std::cout);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user