A Discrete-Event Network Simulator
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
22using namespace ns3;
23
24int
25main(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
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}
Parse command-line arguments.
Helper class providing functions to access various parts of the version string, as well as functions ...
Definition version.h:91
str version
Definition conf.py:52
Every class exported by the ns3 library is enclosed in the ns3 namespace.