NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
config-file.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#ifndef NDN_MANAGEMENT_CONFIG_FILE_HPP
23
#define NDN_MANAGEMENT_CONFIG_FILE_HPP
24
25
#include "../common.hpp"
26
27
#include <fstream>
28
29
#include <boost/property_tree/ptree.hpp>
30
#include <boost/filesystem.hpp>
31
32
namespace
ndn
{
33
48
class
ConfigFile
: noncopyable
49
{
50
public
:
51
52
class
Error
:
public
std::runtime_error
53
{
54
public
:
55
Error
(
const
std::string& what)
56
:
std
::runtime_error(what)
57
{
58
59
}
60
};
61
62
typedef
boost::property_tree::ptree
Parsed
;
63
69
ConfigFile
();
70
71
~ConfigFile
();
72
73
const
boost::filesystem::path&
74
getPath
()
const
;
75
76
const
Parsed&
77
getParsedConfiguration
()
const
;
78
79
private
:
80
81
bool
82
open();
83
84
void
85
close();
86
97
const
Parsed&
98
parse();
99
112
boost::filesystem::path
113
findConfigFile();
114
115
private
:
116
boost::filesystem::path m_path;
// absolute path to active configuration file (if any)
117
std::ifstream m_input;
118
Parsed m_config;
119
};
120
121
inline
const
boost::filesystem::path&
122
ConfigFile::getPath
()
const
123
{
124
return
m_path;
125
}
126
127
inline
const
ConfigFile::Parsed
&
128
ConfigFile::getParsedConfiguration
()
const
129
{
130
return
m_config;
131
}
132
133
}
// namespace ndn
134
135
136
#endif // NDN_MANAGEMENT_CONFIG_FILE_HPP
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
std
STL namespace.
ndn::ConfigFile::Parsed
boost::property_tree::ptree Parsed
Definition:
config-file.hpp:62
ndn::ConfigFile::~ConfigFile
~ConfigFile()
Definition:
config-file.cpp:39
ndn::ConfigFile
System configuration file for NDN platform.
Definition:
config-file.hpp:48
ndn::ConfigFile::ConfigFile
ConfigFile()
Locate, open, and parse a library configuration file.
Definition:
config-file.cpp:29
ndn::ConfigFile::getPath
const boost::filesystem::path & getPath() const
Definition:
config-file.hpp:122
ndn::ConfigFile::Error::Error
Error(const std::string &what)
Definition:
config-file.hpp:55
ndn::ConfigFile::Error
Definition:
config-file.hpp:52
ndn::ConfigFile::getParsedConfiguration
const Parsed & getParsedConfiguration() const
Definition:
config-file.hpp:128
ndnSIM
ndn-cxx
src
util
config-file.hpp
Generated on Wed Jan 11 2017 18:17:15 for ndnSIM by
1.8.13