FNSS ns-3 adapter
ns-3 adapter for the Fast Network Simulation Setup (FNSS) toolchain
 All Classes Files Functions Typedefs Pages
property-container.h
1 #ifndef PROPERTY_CONTAINER_H
2 #define PROPERTY_CONTAINER_H
3 
4 #include <string>
5 #include <map>
6 #include <set>
7 
8 namespace fnss {
9 
16 public:
25  std::string getProperty(const std::string &name) const;
26 
35  // std::string getProperty(const std::string &name, bool &found) const;
36 
43  void setProperty(const std::string &name, const std::string &value = "");
44 
50  bool hasProperty(const std::string &name) const;
51 
57  void addProperties(const PropertyContainer &other);
58 
67  std::string removeProperty(const std::string &name);
68 
77  // std::string removeProperty(const std::string &name, bool &found);
78 
84  std::set<std::string> getAllProperties() const;
85 
86  class PropertyNotFoundException : public std::exception {
87  public:
88  PropertyNotFoundException(const std::string &name) throw() {
89  this->exceptionStr = "The property named " + name + " was not found.";
90  }
91 
92  ~PropertyNotFoundException() throw() {
93  }
94 
95  const char* what() const throw() {
96  return this->exceptionStr.c_str();
97  }
98 
99  private:
100  std::string exceptionStr;
101  };
102 
103 private:
107  typedef std::map <std::string, std::string> propertiesType;
108  propertiesType properties;
109 };
110 
111 } //namespace
112 
113 #endif //PROPERTY_CONTAINER_H
Definition: property-container.h:86
void setProperty(const std::string &name, const std::string &value="")
Definition: property-container.cpp:29
void addProperties(const PropertyContainer &other)
Definition: property-container.cpp:43
std::string getProperty(const std::string &name) const
Definition: property-container.cpp:5
std::set< std::string > getAllProperties() const
Definition: property-container.cpp:77
std::string removeProperty(const std::string &name)
Definition: property-container.cpp:49
Definition: property-container.h:15
bool hasProperty(const std::string &name) const
Definition: property-container.cpp:34