A Discrete-Event Network Simulator
API
timestamp-tag.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License version 2 as
4  * published by the Free Software Foundation;
5  *
6  * This program is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9  * GNU General Public License for more details.
10  *
11  * You should have received a copy of the GNU General Public License
12  * along with this program; if not, write to the Free Software
13  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14  *
15  * Authors: Joe Kopena <tjkopena@cs.drexel.edu>
16  */
17 
18 #ifndef TIMESTAMP_TAG_H
19 #define TIMESTAMP_TAG_H
20 
21 #include "ns3/nstime.h"
22 #include "ns3/tag-buffer.h"
23 #include "ns3/tag.h"
24 #include "ns3/type-id.h"
25 
26 #include <iostream>
27 
28 namespace ns3
29 {
30 
38 class TimestampTag : public Tag
39 {
40  public:
45  static TypeId GetTypeId();
46  TypeId GetInstanceTypeId() const override;
47 
52 
57  TimestampTag(Time timestamp);
58 
59  void Serialize(TagBuffer i) const override;
60  void Deserialize(TagBuffer i) override;
61  uint32_t GetSerializedSize() const override;
62  void Print(std::ostream& os) const override;
63 
68  Time GetTimestamp() const;
69 
74  void SetTimestamp(Time timestamp);
75 
76  private:
78 };
79 
80 } // namespace ns3
81 
82 #endif // TIMESTAMP_TAG_H
read and write tag data
Definition: tag-buffer.h:52
tag a set of bytes in a packet
Definition: tag.h:39
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Timestamp tag for associating a timestamp with a packet.
Definition: timestamp-tag.h:39
void Deserialize(TagBuffer i) override
Time m_timestamp
Timestamp.
Definition: timestamp-tag.h:77
void SetTimestamp(Time timestamp)
Set the Timestamp object.
void Print(std::ostream &os) const override
uint32_t GetSerializedSize() const override
static TypeId GetTypeId()
Get the type ID.
void Serialize(TagBuffer i) const override
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
TimestampTag()
Construct a new TimestampTag object.
Time GetTimestamp() const
Get the Timestamp object.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.