Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
Version.h
1// trax track library
2// AD 2018
3//
4// "You're forgiven, not forgotten."
5//
6// The Corrs
7//
8// Copyright (c) 2025 Trend Redaktions- und Verlagsgesellschaft mbH
9// Copyright (c) 2019 Marc-Michael Horstmann
10//
11// Permission is hereby granted to any person obtaining a copy of this software
12// and associated source code (the "Software"), to use, view, and study the
13// Software for personal or internal business purposes, subject to the following
14// conditions:
15//
16// 1. Redistribution, modification, sublicensing, or commercial use of the
17// Software is NOT permitted without prior written consent from the copyright
18// holder.
19//
20// 2. The Software is provided "AS IS", without warranty of any kind, express
21// or implied.
22//
23// 3. All copies of the Software must retain this license notice.
24//
25// For further information, please contact: horstmann.marc@trendverlag.de
26
27#pragma once
28
29#include "Configuration.h"
30#include "Units.h"
31
32#include <iostream>
33
34constexpr int TRAX_VERSION_MAJOR = 3;
35constexpr int TRAX_VERSION_MINOR = 1;
36constexpr int TRAX_VERSION_PATCH = 0;
37
38namespace trax{
39
41 class Version{
42 public:
43 Version() = delete;
44 Version& operator=( const Version& ) = delete;
45
46 dclspc static int Major() noexcept;
47 dclspc static int Minor() noexcept;
48 dclspc static int Patch() noexcept;
49
51 dclspc static const char* Readable();
52
54 dclspc static bool IsAtLeast( int major, int minor, int patch ) noexcept;
55
57 dclspc static bool HasFeature( const std::string& name ) noexcept;
58
60 dclspc static int SizeOfReal() noexcept;
61
68 dclspc static const char* LongDescription() noexcept;
69 private:
70 static bool bNeedsInit;
71 static std::string readable;
72 };
73
76 inline bool CheckVersion(){
77 if( TRAX_VERSION_MAJOR != Version::Major() ){
78 std::cerr << "Trax Library Version mismatch: " << "TRAX_VERSION_MAJOR("
79 << TRAX_VERSION_MAJOR << ") != Version::Major()(" << Version::Major() << ") " << std::endl;
80 return false;
81 }
82 if( TRAX_VERSION_MINOR != Version::Minor() ){
83 std::cerr << "Trax Library Version mismatch: " << "TRAX_VERSION_MINOR("
84 << TRAX_VERSION_MINOR << ") != Version::Minor()(" << Version::Minor() << ") " << std::endl;
85 return false;
86 }
87 if( TRAX_VERSION_PATCH != Version::Patch() ){
88 std::cerr << "Trax Library Version mismatch: " << "TRAX_VERSION_PATCH("
89 << TRAX_VERSION_PATCH << ") != Version::Patch()(" << Version::Patch() << ") " << std::endl;
90 return false;
91 }
92 if( sizeof(Real) != Version::SizeOfReal() ){
93 std::cerr << "Trax Library floating point type mismatch: " << "sizeof(Real)"
94 << sizeof(Real) << ") != Version::SizeOfReal()(" << Version::SizeOfReal() << ") " << std::endl;
95
96 return false;
97 }
98
99 return true;
100 }
101
102 inline bool CheckRuntime(){
103 std::string longDescription = Version::LongDescription();
104 return true;
105 // if this crashes, a wrong vcruntime is selected. Try static library or make the calling
106 // process use dll version, too.
107 }
108};
109
static dclspc int SizeOfReal() noexcept
static dclspc int Patch() noexcept
Revision number.
static dclspc const char * Readable()
static dclspc int Major() noexcept
Cardinal version number.
static dclspc bool IsAtLeast(int major, int minor, int patch) noexcept
static dclspc int Minor() noexcept
Subversion number.
static dclspc const char * LongDescription() noexcept
Gives some descriptionary text about the library.
static dclspc bool HasFeature(const std::string &name) noexcept
float Real
Underlying floating point type to be used with the dim library.
Definition DimensionedValues.h:190
STL namespace.
Namespace of all the trax track libraries classes and methods.
Definition Collection.h:17
bool CheckVersion()
Compares the version identifiers returned by the library dll with the header file's version identifie...
Definition Version.h:76