FWCore
Utilities
src
ReleaseVersion.cc
Go to the documentation of this file.
1
#include "
FWCore/Utilities/interface/ReleaseVersion.h
"
2
3
#include "boost/algorithm/string.hpp"
4
#include "boost/lexical_cast.hpp"
5
6
#include <algorithm>
7
#include <cassert>
8
#include <cctype>
9
#include <vector>
10
11
namespace
edm
{
12
namespace
releaseversion {
13
14
struct
IsNotDigit
{
15
bool
operator()
(
char
const
c
)
const
{
return
!isdigit(
c
); }
16
};
17
18
struct
IsEmpty
{
19
bool
operator()
(
std::string
const
&
s
)
const
{
return
s
.empty(); }
20
};
21
22
DecomposedReleaseVersion::DecomposedReleaseVersion
(
std::string
releaseVersion)
23
: irregular_(
true
), major_(0), minor_(0)
/*, point_(0), patch_(0), pre_(0)*/
{
24
try
{
25
std::vector<std::string>
parts
;
26
parts
.reserve(releaseVersion.size());
27
boost::algorithm::split
(
parts
, releaseVersion,
IsNotDigit
(), boost::algorithm::token_compress_on);
28
parts
.erase(remove_if(
parts
.begin(),
parts
.end(),
IsEmpty
()),
parts
.end());
29
30
if
(
parts
.size() < 3) {
31
return
;
32
}
33
/*
34
if(parts.size() == 4) {
35
if(releaseVersion.find("patch") != std::string::npos) {
36
patch_ = boost::lexical_cast<unsigned int>(parts[3]);
37
} else if(releaseVersion.find("pre") != std::string::npos) {
38
pre_ = boost::lexical_cast<unsigned int>(parts[3]);
39
} else {
40
return;
41
}
42
}
43
*/
44
major_
= boost::lexical_cast<unsigned int>(
parts
[0]);
45
minor_
= boost::lexical_cast<unsigned int>(
parts
[1]);
46
// point_ = boost::lexical_cast<unsigned int>(parts[2]);
47
irregular_
=
false
;
48
}
catch
(
std::exception
const
&) {
49
}
50
}
51
52
bool
DecomposedReleaseVersion::operator<
(
DecomposedReleaseVersion
const
&
other
)
const
{
53
if
(
irregular_
||
other
.irregular_)
54
return
false
;
55
if
(
major_
<
other
.major_)
56
return
true
;
57
if
(
major_
>
other
.major_)
58
return
false
;
59
if
(
minor_
<
other
.minor_)
60
return
true
;
61
// if(minor_ > other.minor_) return false;
62
// if(point_ < other.point_) return true;
63
// if(point_ > other.point_) return false;
64
// if(patch_ < other.patch_) return true;
65
// if(patch_ > other.patch_) return false;
66
// if(pre_ < other.pre_) return true;
67
return
false
;
68
}
69
70
bool
isEarlierRelease
(
std::string
const
&
a
,
std::string
const
&
b
) {
71
return
(
DecomposedReleaseVersion
(
a
) <
DecomposedReleaseVersion
(
b
));
72
}
73
74
bool
isEarlierRelease
(
DecomposedReleaseVersion
const
&
a
,
std::string
const
&
b
) {
75
return
(
a
<
DecomposedReleaseVersion
(
b
));
76
}
77
78
bool
isEarlierRelease
(
std::string
const
&
a
,
DecomposedReleaseVersion
const
&
b
) {
79
return
(
DecomposedReleaseVersion
(
a
) <
b
);
80
}
81
82
bool
isEarlierRelease
(
DecomposedReleaseVersion
const
&
a
,
DecomposedReleaseVersion
const
&
b
) {
return
(
a
<
b
); }
83
84
}
// namespace releaseversion
85
}
// namespace edm
edm::releaseversion::DecomposedReleaseVersion::operator<
bool operator<(DecomposedReleaseVersion const &other) const
Definition:
ReleaseVersion.cc:52
edm::releaseversion::IsEmpty
Definition:
ReleaseVersion.cc:18
edm
HLT enums.
Definition:
AlignableModifier.h:19
contentValuesFiles.parts
parts
Definition:
contentValuesFiles.py:58
alignCSCRings.s
s
Definition:
alignCSCRings.py:92
edm::releaseversion::IsNotDigit::operator()
bool operator()(char const c) const
Definition:
ReleaseVersion.cc:15
edm::releaseversion::DecomposedReleaseVersion::DecomposedReleaseVersion
DecomposedReleaseVersion(std::string releaseVersion)
Definition:
ReleaseVersion.cc:22
submitPVValidationJobs.split
def split(sequence, size)
Definition:
submitPVValidationJobs.py:352
edm::releaseversion::DecomposedReleaseVersion::major_
unsigned int major_
Definition:
ReleaseVersion.h:16
trackingPlots.other
other
Definition:
trackingPlots.py:1464
b
double b
Definition:
hdecay.h:118
cppFunctionSkipper.exception
exception
Definition:
cppFunctionSkipper.py:10
funct::true
true
Definition:
Factorize.h:173
ReleaseVersion.h
a
double a
Definition:
hdecay.h:119
edm::releaseversion::DecomposedReleaseVersion
Definition:
ReleaseVersion.h:9
edm::releaseversion::IsNotDigit
Definition:
ReleaseVersion.cc:14
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
edm::releaseversion::isEarlierRelease
bool isEarlierRelease(std::string const &a, std::string const &b)
Definition:
ReleaseVersion.cc:70
edm::releaseversion::DecomposedReleaseVersion::minor_
unsigned int minor_
Definition:
ReleaseVersion.h:17
edm::releaseversion::IsEmpty::operator()
bool operator()(std::string const &s) const
Definition:
ReleaseVersion.cc:19
c
auto & c
Definition:
CAHitNtupletGeneratorKernelsImpl.h:56
edm::releaseversion::DecomposedReleaseVersion::irregular_
bool irregular_
Definition:
ReleaseVersion.h:15
Generated for CMSSW Reference Manual by
1.8.16