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
version.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2018 Lawrence Livermore National Laboratory
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Authors: Mathew Bielejeski <bielejeski1@llnl.gov>
7
*/
8
9
#include "
version.h
"
10
11
#include "ns3/version-defines.h"
12
13
#include <sstream>
14
15
/**
16
* \file
17
* \ingroup buildversion
18
* ns3::Version implementation
19
*/
20
21
namespace
ns3
22
{
23
24
std::string
25
Version::VersionTag
()
26
{
27
return
NS3_VERSION_TAG;
28
}
29
30
std::string
31
Version::ClosestAncestorTag
()
32
{
33
return
NS3_VERSION_CLOSEST_TAG;
34
}
35
36
uint32_t
37
Version::Major
()
38
{
39
return
NS3_VERSION_MAJOR;
40
}
41
42
uint32_t
43
Version::Minor
()
44
{
45
return
NS3_VERSION_MINOR;
46
}
47
48
uint32_t
49
Version::Patch
()
50
{
51
return
NS3_VERSION_PATCH;
52
}
53
54
std::string
55
Version::ReleaseCandidate
()
56
{
57
return
std::string{NS3_VERSION_RELEASE_CANDIDATE};
58
}
59
60
uint32_t
61
Version::TagDistance
()
62
{
63
return
NS3_VERSION_TAG_DISTANCE;
64
}
65
66
bool
67
Version::DirtyWorkingTree
()
68
{
69
return
static_cast<
bool
>
(NS3_VERSION_DIRTY_FLAG);
70
}
71
72
std::string
73
Version::CommitHash
()
74
{
75
return
std::string{NS3_VERSION_COMMIT_HASH};
76
}
77
78
std::string
79
Version::BuildProfile
()
80
{
81
return
std::string{NS3_VERSION_BUILD_PROFILE};
82
}
83
84
std::string
85
Version::ShortVersion
()
86
{
87
std::ostringstream ostream;
88
ostream <<
VersionTag
();
89
90
auto
ancestorTag =
ClosestAncestorTag
();
91
if
((!ancestorTag.empty() && (ancestorTag !=
VersionTag
())) ||
TagDistance
() > 0)
92
{
93
ostream <<
"+"
;
94
}
95
if
(
DirtyWorkingTree
())
96
{
97
ostream <<
"*"
;
98
}
99
100
return
ostream.str();
101
}
102
103
std::string
104
Version::BuildSummary
()
105
{
106
std::ostringstream ostream;
107
ostream <<
ClosestAncestorTag
();
108
109
if
(
TagDistance
() > 0)
110
{
111
ostream <<
"+"
;
112
}
113
if
(
DirtyWorkingTree
())
114
{
115
ostream <<
"*"
;
116
}
117
118
return
ostream.str();
119
}
120
121
std::string
122
Version::LongVersion
()
123
{
124
std::ostringstream ostream;
125
ostream <<
VersionTag
();
126
127
auto
ancestorTag =
ClosestAncestorTag
();
128
if
(!ancestorTag.empty() && (ancestorTag !=
VersionTag
()))
129
{
130
ostream <<
'+'
<< ancestorTag;
131
}
132
133
auto
tagDistance =
TagDistance
();
134
135
if
(tagDistance > 0)
136
{
137
ostream <<
'+'
<< tagDistance;
138
}
139
140
ostream <<
'@'
<<
CommitHash
();
141
142
if
(
DirtyWorkingTree
())
143
{
144
ostream <<
"-dirty"
;
145
}
146
147
ostream <<
'-'
<<
BuildProfile
();
148
149
return
ostream.str();
150
}
151
152
}
// namespace ns3
ns3::Version::Patch
static uint32_t Patch()
Patch component of the build version.
Definition
version.cc:49
ns3::Version::CommitHash
static std::string CommitHash()
Hash of the most recent commit.
Definition
version.cc:73
ns3::Version::Major
static uint32_t Major()
Major component of the build version.
Definition
version.cc:37
ns3::Version::TagDistance
static uint32_t TagDistance()
The number of commits between the current commit and the tag returned by ClosestAncestorTag().
Definition
version.cc:61
ns3::Version::BuildProfile
static std::string BuildProfile()
Indicates the type of build that was performed (debug/release/optimized).
Definition
version.cc:79
ns3::Version::ReleaseCandidate
static std::string ReleaseCandidate()
Release candidate component of the build version.
Definition
version.cc:55
ns3::Version::Minor
static uint32_t Minor()
Minor component of the build version.
Definition
version.cc:43
ns3::Version::BuildSummary
static std::string BuildSummary()
Constructs a string containing the most recent tag and status flags.
Definition
version.cc:104
ns3::Version::DirtyWorkingTree
static bool DirtyWorkingTree()
Indicates whether there were uncommitted changes during the build.
Definition
version.cc:67
ns3::Version::ShortVersion
static std::string ShortVersion()
Constructs a string containing the ns-3 major and minor version components, and indication of additio...
Definition
version.cc:85
ns3::Version::LongVersion
static std::string LongVersion()
Constructs a string containing all of the build details.
Definition
version.cc:122
ns3::Version::VersionTag
static std::string VersionTag()
Returns the ns-3 version tag of the closest ancestor commit.
Definition
version.cc:25
ns3::Version::ClosestAncestorTag
static std::string ClosestAncestorTag()
Returns the closest tag that is attached to a commit that is an ancestor of the current branch head.
Definition
version.cc:31
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
version.h
class ns3::Version definition
src
core
model
version.cc
Generated on Fri Nov 8 2024 13:58:59 for ns-3 by
1.11.0