FNSS C++ library
C++ API for the Fast Network Simulation Setup (FNSS) toolchain
 All Classes Functions Typedefs Pages
traffic-matrix-sequence.h
1 #ifndef TRAFFIC_MATRIX_SEQUENCE_H
2 #define TRAFFIC_MATRIX_SEQUENCE_H
3 
4 #include "traffic-matrix.h"
5 #include "quantity.h"
6 #include "units.h"
7 
8 #include <vector>
9 #include <exception>
10 #include <sstream>
11 
12 namespace fnss {
13 
21 public:
27  TrafficMatrixSequence(const Quantity &interval_ = Quantity("1s", Units::Time));
28 
34  Quantity getInterval() const;
35 
41  void setInterval(const Quantity &interval_);
42 
48  unsigned int size() const;
49 
55  void addMatrix(const TrafficMatrix &matrix);
56 
66  void addMatrix(const TrafficMatrix &matrix, unsigned int index);
67 
76  void removeMatrix(unsigned int index);
77 
85  TrafficMatrix getMatrix(unsigned int index) const;
86 
87 
88  class IndexOutOfBoundsException : public std::exception {
89  public:
90  IndexOutOfBoundsException(unsigned int index) throw() {
91  std::stringstream ss;
92  ss<<"The TrafficMatrixSequence index "<<index<<" was out-of-bounds.";
93  this->exceptionStr = ss.str();
94  }
95 
96  ~IndexOutOfBoundsException() throw() {
97  }
98 
99  const char* what() const throw() {
100  return this->exceptionStr.c_str();
101  }
102 
103  private:
104  std::string exceptionStr;
105  };
106 
107 private:
108  Quantity interval;
109 
110  typedef std::vector<TrafficMatrix> sequenceType;
111  sequenceType sequence;
112 
113 };
114 
115 } //namespace
116 
117 #endif //TRAFFIC_MATRIX_SEQUENCE_H
Definition: traffic-matrix-sequence.h:20
void setInterval(const Quantity &interval_)
Definition: traffic-matrix-sequence.cpp:12
void removeMatrix(unsigned int index)
Definition: traffic-matrix-sequence.cpp:32
unsigned int size() const
Definition: traffic-matrix-sequence.cpp:16
TrafficMatrix getMatrix(unsigned int index) const
Definition: traffic-matrix-sequence.cpp:43
void addMatrix(const TrafficMatrix &matrix)
Definition: traffic-matrix-sequence.cpp:20
Definition: traffic-matrix.h:19
TrafficMatrixSequence(const Quantity &interval_=Quantity("1s", Units::Time))
Definition: traffic-matrix-sequence.cpp:5
Quantity getInterval() const
Definition: traffic-matrix-sequence.cpp:8
Definition: traffic-matrix-sequence.h:88
Definition: quantity.h:16