A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
timestamp-tag.cc
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: GPL-2.0-only
3 *
4 * Authors: Joe Kopena <tjkopena@cs.drexel.edu>
5 */
6
7#include "timestamp-tag.h"
8
9#include "ns3/nstime.h"
10#include "ns3/tag-buffer.h"
11#include "ns3/tag.h"
12#include "ns3/type-id.h"
13#include "ns3/uinteger.h"
14
15namespace ns3
16{
17
18NS_OBJECT_ENSURE_REGISTERED(TimestampTag);
19
21
23 : m_timestamp(timestamp)
24{
25}
26
29{
30 static TypeId tid = TypeId("ns3::TimestampTag")
31 .SetParent<Tag>()
32 .SetGroupName("Network")
33 .AddConstructor<TimestampTag>();
34 return tid;
35}
36
39{
40 return GetTypeId();
41}
42
45{
46 return 8;
47}
48
49void
54
55void
60
61void
62TimestampTag::Print(std::ostream& os) const
63{
64 os << "timestamp=" << m_timestamp.As(Time::S);
65}
66
67Time
69{
70 return m_timestamp;
71}
72
73void
75{
76 m_timestamp = timestamp;
77}
78
79} // namespace ns3
read and write tag data
Definition tag-buffer.h:41
void WriteU64(uint64_t v)
Definition tag-buffer.cc:93
uint64_t ReadU64()
tag a set of bytes in a packet
Definition tag.h:28
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition time.cc:404
@ S
second
Definition nstime.h:105
int64_t GetTimeStep() const
Get the raw time value, in the current resolution unit.
Definition nstime.h:434
Timestamp tag for associating a timestamp with a packet.
void Deserialize(TagBuffer i) override
Time m_timestamp
Timestamp.
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:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.