FNSS C++ library
C++ API for the Fast Network Simulation Setup (FNSS) toolchain
 All Classes Functions Typedefs Pages
node.h
1 #ifndef NODE_H
2 #define NODE_H
3 
4 #include "property-container.h"
5 #include "protocol-stack.h"
6 #include "application.h"
7 
8 #include <string>
9 #include <map>
10 #include <exception>
11 
12 namespace fnss {
13 
23 class Node : public PropertyContainer {
24 public:
30  Node(const ProtocolStack &stack = ProtocolStack());
31 
38 
44  void setProtocolStack(const ProtocolStack &stack);
45 
54  Application getApplication(const std::string &name) const;
55 
65  // Application getApplication(const std::string &name, bool &found) const;
66 
72  void setApplication(const Application &application);
73 
82  Application removeApplication(const std::string &name);
83 
93  // Application removeApplication(const std::string &name, bool &found);
94 
101  std::set <std::string> getAllApplications() const;
102 
103  class ApplicationNotFoundException : public std::exception {
104  public:
105  ApplicationNotFoundException(const std::string &name) throw() {
106  this->exceptionStr = "The application named " + name + " was not found.";
107  }
108 
109  ~ApplicationNotFoundException() throw() {
110  }
111 
112  const char* what() const throw() {
113  return this->exceptionStr.c_str();
114  }
115 
116  private:
117  std::string exceptionStr;
118  };
119 
120 private:
124  typedef std::map <std::string, Application> ApplicationsType;
125  std::map <std::string, Application> applications;
126 
130  ProtocolStack stack;
131 };
132 
133 } //namespace
134 
135 #endif //NODE_H
void setApplication(const Application &application)
Definition: node.cpp:39
void setProtocolStack(const ProtocolStack &stack)
Definition: node.cpp:11
Definition: application.h:19
ProtocolStack getProtocolStack() const
Definition: node.cpp:7
Definition: protocol-stack.h:18
Application getApplication(const std::string &name) const
Definition: node.cpp:15
Node(const ProtocolStack &stack=ProtocolStack())
Definition: node.cpp:5
Definition: node.h:23
std::set< std::string > getAllApplications() const
Definition: node.cpp:70
Definition: property-container.h:15
Application removeApplication(const std::string &name)
Definition: node.cpp:43