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
build-version-example.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
* Author: Peter D. Barnes, Jr. <pdbarnes@llnl.gov>
7
*/
8
9
#include "ns3/command-line.h"
10
#include "ns3/version.h"
11
12
#include <iomanip>
13
#include <iostream>
14
#include <string>
15
16
/**
17
* \file
18
* \ingroup core-examples
19
* Example program illustrating use of ns3::Version.
20
*/
21
22
using namespace
ns3
;
23
24
int
25
main(
int
argc,
char
* argv[])
26
{
27
CommandLine
cmd
(__FILE__);
28
cmd
.Usage(
"Version class example program.\n"
29
"\n"
30
"This program demonstrates the various outputs from the Version class"
);
31
cmd
.Parse(argc, argv);
32
33
std::cout << std::endl;
34
std::cout <<
cmd
.GetName() <<
":"
<< std::endl;
35
36
// Print the source version used to build this example
37
std::cout <<
"Program Version (according to CommandLine): "
;
38
cmd
.PrintVersion(std::cout);
39
std::cout << std::endl;
40
41
Version
version
;
42
std::cout <<
"Version fields:\n"
43
<<
"LongVersion: "
<<
version
.LongVersion() <<
"\n"
44
<<
"ShortVersion: "
<<
version
.ShortVersion() <<
"\n"
45
<<
"BuildSummary: "
<<
version
.BuildSummary() <<
"\n"
46
<<
"VersionTag: "
<<
version
.VersionTag() <<
"\n"
47
<<
"Major: "
<<
version
.Major() <<
"\n"
48
<<
"Minor: "
<<
version
.Minor() <<
"\n"
49
<<
"Patch: "
<<
version
.Patch() <<
"\n"
50
<<
"ReleaseCandidate: "
<<
version
.ReleaseCandidate() <<
"\n"
51
<<
"ClosestAncestorTag: "
<<
version
.ClosestAncestorTag() <<
"\n"
52
<<
"TagDistance: "
<<
version
.TagDistance() <<
"\n"
53
<<
"CommitHash: "
<<
version
.CommitHash() <<
"\n"
54
<<
"BuildProfile: "
<<
version
.BuildProfile() <<
"\n"
55
<<
"WorkingTree: "
<< (
version
.DirtyWorkingTree() ?
"dirty"
:
"clean"
)
56
<< std::endl;
57
58
return
0;
59
}
ns3::CommandLine
Parse command-line arguments.
Definition
command-line.h:221
ns3::Version
Helper class providing functions to access various parts of the version string, as well as functions ...
Definition
version.h:91
conf.version
str version
Definition
conf.py:52
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
second.cmd
cmd
Definition
second.py:29
src
core
examples
build-version-example.cc
Generated on Fri Nov 8 2024 13:58:59 for ns-3 by
1.11.0