A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
timestamp-tag.h
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
#ifndef TIMESTAMP_TAG_H
8
#define TIMESTAMP_TAG_H
9
10
#include "ns3/nstime.h"
11
#include "ns3/tag-buffer.h"
12
#include "ns3/tag.h"
13
#include "ns3/type-id.h"
14
15
#include <iostream>
16
17
namespace
ns3
18
{
19
20
/**
21
* Timestamp tag for associating a timestamp with a packet.
22
*
23
* It would have been more realistic to include this info in
24
* a header. Here we show how to avoid the extra overhead in
25
* a simulation.
26
*/
27
class
TimestampTag
:
public
Tag
28
{
29
public
:
30
/**
31
* \brief Get the type ID.
32
* \return the object TypeId
33
*/
34
static
TypeId
GetTypeId
();
35
TypeId
GetInstanceTypeId
()
const override
;
36
37
/**
38
* \brief Construct a new TimestampTag object
39
*/
40
TimestampTag
();
41
42
/**
43
* \brief Construct a new TimestampTag object with the given timestamp
44
* \param timestamp The timestamp
45
*/
46
TimestampTag
(
Time
timestamp);
47
48
void
Serialize
(
TagBuffer
i)
const override
;
49
void
Deserialize
(
TagBuffer
i)
override
;
50
uint32_t
GetSerializedSize
()
const override
;
51
void
Print
(std::ostream& os)
const override
;
52
53
/**
54
* \brief Get the Timestamp object
55
* \return Time for this tag
56
*/
57
Time
GetTimestamp
()
const
;
58
59
/**
60
* \brief Set the Timestamp object
61
* \param timestamp Timestamp to assign to tag
62
*/
63
void
SetTimestamp
(
Time
timestamp);
64
65
private
:
66
Time
m_timestamp
{0};
//!< Timestamp
67
};
68
69
}
// namespace ns3
70
71
#endif
// TIMESTAMP_TAG_H
ns3::TagBuffer
read and write tag data
Definition
tag-buffer.h:41
ns3::Tag
tag a set of bytes in a packet
Definition
tag.h:28
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:94
ns3::TimestampTag
Timestamp tag for associating a timestamp with a packet.
Definition
timestamp-tag.h:28
ns3::TimestampTag::Deserialize
void Deserialize(TagBuffer i) override
Definition
timestamp-tag.cc:56
ns3::TimestampTag::m_timestamp
Time m_timestamp
Timestamp.
Definition
timestamp-tag.h:66
ns3::TimestampTag::SetTimestamp
void SetTimestamp(Time timestamp)
Set the Timestamp object.
Definition
timestamp-tag.cc:74
ns3::TimestampTag::Print
void Print(std::ostream &os) const override
Definition
timestamp-tag.cc:62
ns3::TimestampTag::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition
timestamp-tag.cc:44
ns3::TimestampTag::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
timestamp-tag.cc:28
ns3::TimestampTag::Serialize
void Serialize(TagBuffer i) const override
Definition
timestamp-tag.cc:50
ns3::TimestampTag::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition
timestamp-tag.cc:38
ns3::TimestampTag::TimestampTag
TimestampTag()
Construct a new TimestampTag object.
ns3::TimestampTag::GetTimestamp
Time GetTimestamp() const
Get the Timestamp object.
Definition
timestamp-tag.cc:68
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
network
utils
timestamp-tag.h
Generated on Fri Nov 8 2024 13:59:05 for ns-3 by
1.11.0