NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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
34
class
ConfigFile
: noncopyable
35
{
36
public
:
37
38
class
Error
:
public
std::runtime_error
39
{
40
public
:
41
Error
(
const
std::string& what)
42
:
std
::runtime_error(what)
43
{
44
45
}
46
};
47
48
typedef
boost::property_tree::ptree
Parsed
;
49
55
ConfigFile
();
56
57
~ConfigFile
();
58
59
const
boost::filesystem::path&
60
getPath
()
const
;
61
62
const
Parsed&
63
getParsedConfiguration
()
const
;
64
65
private
:
66
67
bool
68
open();
69
70
void
71
close();
72
82
const
Parsed&
83
parse();
84
95
boost::filesystem::path
96
findConfigFile();
97
98
private
:
99
boost::filesystem::path m_path;
// absolute path to active configuration file (if any)
100
std::ifstream m_input;
101
Parsed m_config;
102
};
103
104
inline
const
boost::filesystem::path&
105
ConfigFile::getPath
()
const
106
{
107
return
m_path;
108
}
109
110
inline
const
ConfigFile::Parsed
&
111
ConfigFile::getParsedConfiguration
()
const
112
{
113
return
m_config;
114
}
115
116
}
// namespace ndn
117
118
119
#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:48
ndn::ConfigFile::~ConfigFile
~ConfigFile()
Definition:
config-file.cpp:39
ndn::ConfigFile
Definition:
config-file.hpp:34
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:105
ndn::ConfigFile::Error::Error
Error(const std::string &what)
Definition:
config-file.hpp:41
ndn::ConfigFile::Error
Definition:
config-file.hpp:38
ndn::ConfigFile::getParsedConfiguration
const Parsed & getParsedConfiguration() const
Definition:
config-file.hpp:111
ndnSIM
ndn-cxx
src
util
config-file.hpp
Generated on Sat Nov 12 2016 16:02:53 for ndnSIM by
1.8.12