A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
version.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2018 Lawrence Livermore National Laboratory
4
*
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
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
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
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Authors: Mathew Bielejeski <bielejeski1@llnl.gov>
19
*/
20
21
#include "
version.h
"
22
#include "ns3/version-defines.h"
23
#include <sstream>
24
31
namespace
ns3
{
32
33
std::string
34
Version::VersionTag
(
void
)
35
{
36
return
NS3_VERSION_TAG;
37
}
38
39
std::string
40
Version::ClosestAncestorTag
(
void
)
41
{
42
return
NS3_VERSION_CLOSEST_TAG;
43
}
44
45
uint32_t
46
Version::Major
(
void
)
47
{
48
return
NS3_VERSION_MAJOR;
49
}
50
51
uint32_t
52
Version::Minor
(
void
)
53
{
54
return
NS3_VERSION_MINOR;
55
}
56
57
uint32_t
58
Version::Patch
(
void
)
59
{
60
return
NS3_VERSION_PATCH;
61
}
62
63
std::string
64
Version::ReleaseCandidate
(
void
)
65
{
66
return
std::string{NS3_VERSION_RELEASE_CANDIDATE};
67
}
68
69
uint32_t
70
Version::TagDistance
(
void
)
71
{
72
return
NS3_VERSION_TAG_DISTANCE;
73
}
74
75
bool
76
Version::DirtyWorkingTree
(
void
)
77
{
78
return
static_cast<
bool
>
(NS3_VERSION_DIRTY_FLAG);
79
}
80
81
std::string
82
Version::CommitHash
(
void
)
83
{
84
return
std::string{NS3_VERSION_COMMIT_HASH};
85
}
86
87
std::string
88
Version::BuildProfile
(
void
)
89
{
90
return
std::string{NS3_VERSION_BUILD_PROFILE};
91
}
92
93
std::string
94
Version::ShortVersion
(
void
)
95
{
96
std::ostringstream ostream;
97
ostream <<
VersionTag
();
98
99
auto
ancestorTag =
ClosestAncestorTag
();
100
if
( ( !ancestorTag.empty () && (ancestorTag !=
VersionTag
()) )
101
||
TagDistance
() > 0)
102
{
103
ostream <<
"+"
;
104
}
105
if
(
DirtyWorkingTree
())
106
{
107
ostream <<
"*"
;
108
}
109
110
return
ostream.str ();
111
}
112
113
std::string
114
Version::BuildSummary
(
void
)
115
{
116
std::ostringstream ostream;
117
ostream <<
ClosestAncestorTag
();
118
119
if
(
TagDistance
() > 0)
120
{
121
ostream <<
"+"
;
122
}
123
if
(
DirtyWorkingTree
())
124
{
125
ostream <<
"*"
;
126
}
127
128
return
ostream.str ();
129
}
130
131
std::string
132
Version::LongVersion
(
void
)
133
{
134
std::ostringstream ostream;
135
ostream <<
VersionTag
();
136
137
auto
ancestorTag =
ClosestAncestorTag
();
138
if
( !ancestorTag.empty () && (ancestorTag !=
VersionTag
()) )
139
{
140
ostream <<
'+'
<< ancestorTag;
141
}
142
143
auto
tagDistance =
TagDistance
();
144
145
if
( tagDistance > 0 )
146
{
147
ostream <<
'+'
<< tagDistance;
148
}
149
150
ostream <<
'@'
<<
CommitHash
();
151
152
if
(
DirtyWorkingTree
() )
153
{
154
ostream <<
"-dirty"
;
155
}
156
157
ostream <<
'-'
<<
BuildProfile
();
158
159
return
ostream.str ();
160
}
161
162
}
// namespace ns3
163
ns3::Version::VersionTag
static std::string VersionTag(void)
Returns the ns-3 version tag of the closest ancestor commit.
Definition:
version.cc:34
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Version::DirtyWorkingTree
static bool DirtyWorkingTree(void)
Indicates whether there were uncommitted changes during the build.
Definition:
version.cc:76
ns3::Version::LongVersion
static std::string LongVersion(void)
Constructs a string containing all of the build details.
Definition:
version.cc:132
ns3::Version::ReleaseCandidate
static std::string ReleaseCandidate(void)
Release candidate component of the build version.
Definition:
version.cc:64
ns3::Version::CommitHash
static std::string CommitHash(void)
Hash of the most recent commit.
Definition:
version.cc:82
ns3::Version::Minor
static uint32_t Minor(void)
Minor component of the build version.
Definition:
version.cc:52
ns3::Version::BuildSummary
static std::string BuildSummary(void)
Constructs a string containing the most recent tag and status flags.
Definition:
version.cc:114
version.h
class ns3::Version definition
ns3::Version::Patch
static uint32_t Patch(void)
Patch component of the build version.
Definition:
version.cc:58
ns3::Version::ClosestAncestorTag
static std::string ClosestAncestorTag(void)
Returns the closest tag that is attached to a commit that is an ancestor of the current branch head.
Definition:
version.cc:40
ns3::Version::ShortVersion
static std::string ShortVersion(void)
Constructs a string containing the ns-3 major and minor version components, and indication of additio...
Definition:
version.cc:94
ns3::Version::BuildProfile
static std::string BuildProfile(void)
Indicates the type of build that was performed (debug/release/optimized).
Definition:
version.cc:88
ns3::Version::Major
static uint32_t Major(void)
Major component of the build version.
Definition:
version.cc:46
ns3::Version::TagDistance
static uint32_t TagDistance(void)
The number of commits between the current commit and the tag returned by ClosestAncestorTag().
Definition:
version.cc:70
src
core
model
version.cc
Generated on Fri Oct 1 2021 17:02:59 for ns-3 by
1.8.20