MCPcopy Create free account
hub / github.com/ARM-software/armnn / Version

Class Version

profiling/common/include/EncodeVersion.hpp:29–73  ·  view source on GitHub ↗

Encodes a semantic version https://semver.org/ into a 32 bit integer in the following fashion bits 22:31 major: Unsigned 10-bit integer. Major component of the schema version number. bits 12:21 minor: Unsigned 10-bit integer. Minor component of the schema version number. bits 0:11 patch: Unsigned 12-bit integer. Patch component of the schema version number.

Source from the content-addressed store, hash-verified

27// bits 0:11 patch: Unsigned 12-bit integer. Patch component of the schema version number.
28//
29class Version
30{
31public:
32 Version(uint32_t encodedValue)
33 {
34 m_Major = (encodedValue >> 22) & 1023;
35 m_Minor = (encodedValue >> 12) & 1023;
36 m_Patch = encodedValue & 4095;
37 }
38
39 Version(uint32_t major, uint32_t minor, uint32_t patch) :
40 m_Major(major),
41 m_Minor(minor),
42 m_Patch(patch)
43 {}
44
45 uint32_t GetEncodedValue()
46 {
47 return EncodeVersion(m_Major, m_Minor, m_Patch);
48 }
49
50 uint32_t GetMajor() { return m_Major; }
51 uint32_t GetMinor() { return m_Minor; }
52 uint32_t GetPatch() { return m_Patch; }
53
54 bool operator==(const Version& other) const
55 {
56 return m_Major == other.m_Major && m_Minor == other.m_Minor && m_Patch == other.m_Patch;
57 }
58
59 std::string ToString() const
60 {
61 constexpr char separator = '.';
62
63 std::stringstream stringStream;
64 stringStream << m_Major << separator << m_Minor << separator << m_Patch;
65
66 return stringStream.str();
67 }
68
69private:
70 uint32_t m_Major;
71 uint32_t m_Minor;
72 uint32_t m_Patch;
73};
74
75inline std::ostream& operator<<(std::ostream& os, const Version& version)
76{

Callers 1

ResolvePacketVersionMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected