NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
config-file.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
25
#ifndef NFD_CORE_CONFIG_FILE_HPP
26
#define NFD_CORE_CONFIG_FILE_HPP
27
28
#include "
common.hpp
"
29
30
#include <boost/property_tree/ptree.hpp>
31
32
namespace
nfd {
33
34
typedef
boost::property_tree::ptree
ConfigSection
;
35
37
typedef
function
<void(
const
ConfigSection
&
/*section*/
,
38
bool
/*isDryRun*/
,
39
const
std::string&
/*filename*/
)>
ConfigSectionHandler
;
40
42
typedef
function
<void(
const
std::string&
/*filename*/
,
43
const
std::string&
/*sectionName*/
,
44
const
ConfigSection
&
/*section*/
,
45
bool
/*isDryRun*/
)>
UnknownConfigSectionHandler
;
46
47
class
ConfigFile
: noncopyable
48
{
49
public
:
50
51
class
Error
:
public
std::runtime_error
52
{
53
public
:
54
explicit
55
Error
(
const
std::string& what)
56
: std::runtime_error(what)
57
{
58
59
}
60
};
61
62
ConfigFile
(
UnknownConfigSectionHandler
unknownSectionCallback =
throwErrorOnUnknownSection
);
63
64
static
void
65
throwErrorOnUnknownSection
(
const
std::string& filename,
66
const
std::string& sectionName,
67
const
ConfigSection
& section,
68
bool
isDryRun);
69
70
static
void
71
ignoreUnknownSection
(
const
std::string& filename,
72
const
std::string& sectionName,
73
const
ConfigSection
& section,
74
bool
isDryRun);
75
77
void
78
addSectionHandler
(
const
std::string& sectionName,
79
ConfigSectionHandler
subscriber);
80
81
88
void
89
parse
(
const
std::string& filename,
bool
isDryRun);
90
98
void
99
parse
(
const
std::string& input,
bool
isDryRun,
const
std::string& filename);
100
107
void
108
parse
(std::istream& input,
bool
isDryRun,
const
std::string& filename);
109
116
void
117
parse
(
const
ConfigSection
& config,
bool
isDryRun,
const
std::string& filename);
118
119
private
:
120
121
void
122
process(
bool
isDryRun,
const
std::string& filename);
123
124
private
:
125
UnknownConfigSectionHandler
m_unknownSectionCallback;
126
127
typedef
std::map<std::string, ConfigSectionHandler> SubscriptionTable;
128
129
SubscriptionTable m_subscriptions;
130
131
ConfigSection
m_global;
132
};
133
134
}
// namespace nfd
135
136
137
#endif // NFD_CORE_CONFIG_FILE_HPP
nfd::ConfigFile
Definition:
config-file.hpp:47
nfd::ConfigSectionHandler
function< void(const ConfigSection &, bool, const std::string &)> ConfigSectionHandler
callback for config file sections
Definition:
config-file.hpp:39
common.hpp
nfd::ConfigFile::Error::Error
Error(const std::string &what)
Definition:
config-file.hpp:55
nfd::ConfigFile::throwErrorOnUnknownSection
static void throwErrorOnUnknownSection(const std::string &filename, const std::string §ionName, const ConfigSection §ion, bool isDryRun)
Definition:
config-file.cpp:36
nfd::ConfigFile::addSectionHandler
void addSectionHandler(const std::string §ionName, ConfigSectionHandler subscriber)
setup notification of configuration file sections
Definition:
config-file.cpp:63
nfd::UnknownConfigSectionHandler
function< void(const std::string &, const std::string &, const ConfigSection &, bool)> UnknownConfigSectionHandler
callback for config file sections without a subscribed handler
Definition:
config-file.hpp:45
nfd::ConfigSection
boost::property_tree::ptree ConfigSection
Definition:
ndn-l3-protocol.hpp:39
nfd::ConfigFile::Error
Definition:
config-file.hpp:51
nfd::ConfigFile::ConfigFile
ConfigFile(UnknownConfigSectionHandler unknownSectionCallback=throwErrorOnUnknownSection)
Definition:
config-file.cpp:57
nfd::ConfigFile::ignoreUnknownSection
static void ignoreUnknownSection(const std::string &filename, const std::string §ionName, const ConfigSection §ion, bool isDryRun)
Definition:
config-file.cpp:49
nfd::ConfigFile::parse
void parse(const std::string &filename, bool isDryRun)
Definition:
config-file.cpp:70
ndnSIM
NFD
core
config-file.hpp
Generated on Wed Feb 18 2015 16:31:16 for ndnSIM by
1.8.7