Linux GNU 11.4.0 Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 5 / 0 / 5
Functions: 100.0% 1 / 1 / 2
Branches: 35.5% 11 / 0 / 31

OMCompiler/SimulationRuntime/cpp/Core/Utils/extension/impl/typeinfo.hpp
Line Branch Exec Source
1 /*
2 * Boost.Extension / typeinfo:
3 * implementations name management with RTTI
4 *
5 * (C) Copyright Jeremy Pack 2008
6 * Distributed under the Boost Software License, Version 1.0. (See
7 * accompanying file LICENSE_1_0.txt or copy at
8 * http://www.boost.org/LICENSE_1_0.txt)
9 *
10 * See http://www.boost.org/ for latest version.
11 */
12
13
14 #ifndef BOOST_EXTENSION_TYPEINFO_HPP
15 #define BOOST_EXTENSION_TYPEINFO_HPP
16 #include <typeinfo>
17 namespace boost { namespace extensions {
18 template <class TypeInfo, class ClassType>
19 struct type_info_handler {
20 static TypeInfo get_class_type();
21 };
22
23 class default_type_info {
24 public:
25 default_type_info() : type_(&typeid(void)) {
26 }
27
6/8
✓ Branch 0 taken 333 times.
✓ Branch 1 taken 595 times.
✓ Branch 2 taken 333 times.
✓ Branch 3 taken 275 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 108 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 108 times.
1752 default_type_info(const std::type_info& new_type) : type_(&new_type) {
28 }
29
3/19
✓ Branch 0 taken 40 times.
✓ Branch 0 taken 293 times.
✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 1 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 2 taken 333 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 3 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 4 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1332 default_type_info(const default_type_info& first) : type_(first.type_) {
30 }
31 const std::type_info& type() const {
32
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5710 times.
5710 return *type_;
33 }
34 default_type_info& operator=(const default_type_info& first) {
35 type_ = first.type_;
36 return *this;
37 }
38 private:
39 const std::type_info* type_;
40 };
41 template <class ClassType>
42 struct type_info_handler<default_type_info, ClassType>
43 {
44 static default_type_info get_class_type() {
45 return default_type_info(typeid(ClassType));
46 }
47 };
48 }}
49
50
51
52 #if defined(__MINGW32__) || defined(__GNUC__)
53 #include <cstring>
54 namespace boost { namespace extensions {
55
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5710 times.
5710 inline bool operator<(const default_type_info& first,
56 const default_type_info& second) {
57 5710 return std::strcmp(first.type().name(), second.type().name()) < 0;
58 }
59
60 inline bool operator==(const default_type_info& first,
61 const default_type_info& second) {
62 return std::strcmp(first.type().name(), second.type().name()) == 0;
63 }
64
65 inline bool operator>(const default_type_info& first,
66 const default_type_info& second) {
67 return std::strcmp(first.type().name(), second.type().name()) > 0;
68 }
69 }}
70 #else
71 // This list should be expanded to all platforms that successfully
72 // compare type_info across shared library boundaries.
73 #if defined(__APPLE__) || \
74 defined(BOOST_EXTENSION_FORCE_FAST_TYPEINFO)
75 namespace boost {
76 namespace extensions {
77 inline bool operator<(const default_type_info& first,
78 const default_type_info& second) {
79 return &first.type() < &second.type();
80 }
81
82 inline bool operator==(const default_type_info& first,
83 const default_type_info& second) {
84 return &first.type() == &second.type();
85 }
86
87 inline bool operator>(const default_type_info& first,
88 const default_type_info& second) {
89 return &first.type() > &second.type();
90 }
91 }}
92 #else
93 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
94 #include <string>
95 namespace boost { namespace extensions {
96 inline bool operator<(const default_type_info& first,
97 const default_type_info& second) {
98 return std::strcmp(first.type().raw_name(), second.type().raw_name()) < 0;
99 }
100
101 inline bool operator==(const default_type_info& first,
102 const default_type_info& second) {
103 return std::strcmp(first.type().raw_name(), second.type().raw_name()) == 0;
104 }
105
106 inline bool operator>(const default_type_info& first,
107 const default_type_info& second) {
108 return std::strcmp(first.type().raw_name(), second.type().raw_name()) > 0;
109 }
110 } // namespace extensions
111 } // namespace boost
112 #else // OTHER OS
113 #include <string>
114 namespace boost { namespace extensions {
115 inline bool operator<(const default_type_info& first,
116 const default_type_info& second) {
117 return std::strcmp(first.type().name(), second.type().name()) < 0;
118 }
119
120 inline bool operator==(const default_type_info& first,
121 const default_type_info& second) {
122 return std::strcmp(first.type().name(), second.type().name()) == 0;
123 }
124
125 inline bool operator>(const default_type_info& first,
126 const default_type_info& second) {
127 return std::strcmp(first.type().name(), second.type().name()) > 0;
128 }
129 } // namespace extensions
130 } // namespace boost
131 #endif
132 #endif // WINDOWS
133 #endif // OS X
134 #endif // BOOST_EXTENSION_TYPEINFO_HPP
135