Left: | ||
Right: |
OLD | NEW |
---|---|
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2011 Bucknell University | 3 * Copyright (c) 2011 Bucknell University |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with this program; if not, write to the Free Software | 15 * along with this program; if not, write to the Free Software |
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 * Authors: Tiago G. Rodrigues (tgr002@bucknell.edu) | 18 * Authors: Tiago G. Rodrigues (tgr002@bucknell.edu) |
19 */ | 19 */ |
20 | 20 |
21 #ifndef DATA_COLLECTION_OBJECT_H | 21 #ifndef DATA_COLLECTION_OBJECT_H |
22 #define DATA_COLLECTION_OBJECT_H | 22 #define DATA_COLLECTION_OBJECT_H |
23 | 23 |
24 #include <string> | 24 #include <string> |
25 #include "ns3/object.h" | 25 #include "ns3/object.h" |
26 #include "ns3/nstime.h" | |
26 | 27 |
27 namespace ns3 { | 28 namespace ns3 { |
28 | 29 |
29 /** | 30 /** |
30 * \ingroup aggregator | 31 * \ingroup aggregator |
31 * | 32 * |
32 * Base class for data collection framework objects. | 33 * Base class for data collection framework objects. |
33 * | 34 * |
34 * All data collection objects have 1) a string name, and 2) enabled | 35 * All data collection objects have 1) a string name, and 2) enabled |
35 * or disabled status. | 36 * or disabled status. |
36 */ | 37 */ |
37 class DataCollectionObject : public Object | 38 class DataCollectionObject : public Object |
38 { | 39 { |
39 public: | 40 public: |
40 /** | 41 /** |
41 * \brief Get the type ID. | 42 * \brief Get the type ID. |
42 * \return the object TypeId | 43 * \return the object TypeId |
43 */ | 44 */ |
44 static TypeId GetTypeId (); | 45 static TypeId GetTypeId (); |
45 | 46 |
46 DataCollectionObject (); | 47 DataCollectionObject (); |
47 virtual ~DataCollectionObject (); | 48 virtual ~DataCollectionObject (); |
48 | 49 |
49 /// Set the status of an individual object. | 50 /// Set the status of an individual object. |
50 void Enable (void); | 51 virtual void Enable (void); |
51 /// Unset the status of an individual object. | 52 /// Unset the status of an individual object. |
52 void Disable (void); | 53 virtual void Disable (void); |
53 | 54 |
54 /// Check the status of an individual object. | 55 /// Check the status of an individual object. |
55 virtual bool IsEnabled (void) const; | 56 virtual bool IsEnabled (void) const; |
56 | 57 |
57 /// Get the object's name. | 58 /// Get the object's name. |
58 std::string GetName (void) const; | 59 std::string GetName (void) const; |
59 | 60 |
60 /// Set the object's name. All spaces are replaced by underscores. | 61 /// Set the object's name. All spaces are replaced by underscores. |
61 void SetName (std::string name); | 62 void SetName (std::string name); |
62 | 63 |
64 /// Define the Collector callback function signature. This is used | |
65 /// in the AddTraceSource() function in Collector class. | |
66 typedef void (* CollectorTraceCallback) (const double timeStamp, const bool va lue); | |
67 | |
68 /** | |
69 * \param startTime the time the DataCollectionObject is enabled | |
70 * \param endTime the time the DataCollectionObject is disabled | |
71 * | |
72 * \brief set the time period in which the collector will be enabled. | |
73 * | |
74 * Note that once this method is called, you do not need to explicitly call | |
75 * Collector::Enable() or Collector::Disable() again. The Collector class | |
buherman
2015/06/23 13:30:03
Collector -> DataCollectionObject
| |
76 * will take care of everything for you. | |
77 * | |
78 * A good pratice will be that after calling SetEnabledPeriod(), do not | |
buherman
2015/06/23 13:30:03
pratice -> practice
| |
79 * mess around with Enable() and Disable() anymore. This function takes | |
80 * care of everything for you. | |
81 */ | |
82 void SetEnabledPeriod (Time startTime, Time endTime); | |
buherman
2015/06/23 13:30:03
Time -> const Time &
| |
83 | |
84 /** | |
85 * \brief Disable the enabled period so that you can control the collector | |
86 * manually with Enable() and Disable() | |
87 */ | |
88 void UnsetEnabledPeriod (void); | |
89 | |
90 /** | |
91 * \brief Get the starting time of the DataCollectionObject | |
92 * | |
93 * \return the starting time of the DataCollectionObject | |
94 */ | |
95 Time GetStartTime (void) | |
96 { | |
97 return m_startTime; | |
98 } | |
99 | |
100 /** | |
101 * \brief Get the ending time of the DataCollectionObject | |
102 * | |
103 * \return the ending time of the DataCollectionObject | |
104 */ | |
105 Time GetEndTime (void) | |
106 { | |
107 return m_endTime; | |
108 } | |
109 | |
110 | |
111 /** | |
112 * Return whether or not the enabled period is set | |
113 * | |
114 * \return a boolean value indicating whether or not the enabled period is set | |
115 */ | |
116 bool IsEnabledPeriodSet (void) | |
117 { | |
118 return isEnabledPeriodSet; | |
119 } | |
120 | |
121 | |
63 protected: | 122 protected: |
64 /// Object's activation state. | 123 /// Object's activation state. |
65 bool m_enabled; | 124 bool m_enabled; |
66 | 125 |
67 /// Name of the object within the data collection framework | 126 /// Name of the object within the data collection framework |
68 std::string m_name; | 127 std::string m_name; |
69 | 128 |
129 /// Report Data to downstream objects | |
130 void ReportData (void); | |
buherman
2015/06/23 13:30:03
This method is not implemented in the .cc file. I
| |
131 | |
132 /// The starting time of the DataCollectionObject | |
133 Time m_startTime; | |
134 | |
135 /// The ending time of the DataCollectionObject | |
136 Time m_endTime; | |
137 | |
138 /// Whether or not the enabled period is set | |
139 bool isEnabledPeriodSet; | |
70 }; | 140 }; |
71 | 141 |
72 } // namespace ns3 | 142 } // namespace ns3 |
73 | 143 |
74 #endif // DATA_COLLECTION_OBJECT_H | 144 #endif // DATA_COLLECTION_OBJECT_H |
OLD | NEW |