GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 9 / 0 / 9
Functions: 100.0% 1 / 0 / 1
Branches: 100.0% 6 / 0 / 6

src/utilities/sql/SqlFileDataDictionary.hpp
Line Branch Exec Source
1 /***********************************************************************************************************************
2 * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC.
3 * See also https://openstudio.net/license
4 ***********************************************************************************************************************/
5
6 #ifndef UTILITIES_SQL_SQLFILEDATADICTIONARY_HPP
7 #define UTILITIES_SQL_SQLFILEDATADICTIONARY_HPP
8
9 #include "../data/TimeSeries.hpp"
10
11 #include <boost/multi_index_container.hpp>
12 #include <boost/multi_index/member.hpp>
13 #include <boost/multi_index/ordered_index.hpp>
14 #include <boost/multi_index/hashed_index.hpp>
15 #include <boost/multi_index/composite_key.hpp>
16
17 namespace openstudio {
18 namespace detail {
19
20 /// stores metadata from meter and variable data dictionaries
21 struct UTILITIES_API DataDictionaryItem
22 {
23 int recordIndex;
24 int envPeriodIndex;
25 std::string name;
26 std::string keyValue;
27 std::string envPeriod;
28 std::string reportingFrequency;
29 std::string units;
30 std::string table;
31 openstudio::TimeSeries timeSeries;
32
33 2125 DataDictionaryItem(int recordIndex_, int envPeriodIndex_, const std::string& name_, const std::string& keyValue_, const std::string& envPeriod_,
34 const std::string& reportingFrequency_, const std::string& units_, const std::string& table_)
35 2125 : recordIndex(recordIndex_),
36 2125 envPeriodIndex(envPeriodIndex_),
37 2125 name(name_),
38
1/1
✓ Branch 1 taken 2125 times.
2125 keyValue(keyValue_),
39
1/1
✓ Branch 1 taken 2125 times.
2125 envPeriod(envPeriod_),
40
1/1
✓ Branch 1 taken 2125 times.
2125 reportingFrequency(reportingFrequency_),
41
1/1
✓ Branch 1 taken 2125 times.
2125 units(units_),
42
2/2
✓ Branch 1 taken 2125 times.
✓ Branch 4 taken 2125 times.
2125 table(table_) {}
43 };
44
45 /// tags for accessing DataDictionaryItems
46 struct id
47 {
48 };
49 struct name
50 {
51 };
52 struct keyValue
53 {
54 };
55 struct reportingFrequency
56 {
57 };
58 struct envPeriod
59 {
60 };
61 struct envPeriodSet
62 {
63 };
64 struct envPeriodReportingFrequencyNameKeyValue
65 {
66 };
67
68 /// Define a multi_index_container of DataDictionaryItems with following indices:
69 /// a unique index sorted by dataDictionary::recordIndex and dataDictionary::envPeriodIndex
70 /// a non-unique index sorted by dataDictionary::name,
71 using DataDictionaryTable = boost::multi_index_container<
72 DataDictionaryItem,
73 boost::multi_index::indexed_by<
74 boost::multi_index::ordered_unique<
75 boost::multi_index::tag<id>,
76 boost::multi_index::composite_key<DataDictionaryItem, boost::multi_index::member<DataDictionaryItem, int, &DataDictionaryItem::recordIndex>,
77 boost::multi_index::member<DataDictionaryItem, int, &DataDictionaryItem::envPeriodIndex>>>,
78 boost::multi_index::ordered_non_unique<boost::multi_index::tag<name>,
79 ::boost::multi_index::member<DataDictionaryItem, std::string, &DataDictionaryItem::name>>,
80 boost::multi_index::ordered_non_unique<boost::multi_index::tag<keyValue>,
81 ::boost::multi_index::member<DataDictionaryItem, std::string, &DataDictionaryItem::keyValue>>,
82 boost::multi_index::ordered_non_unique<boost::multi_index::tag<reportingFrequency>,
83 ::boost::multi_index::member<DataDictionaryItem, std::string, &DataDictionaryItem::reportingFrequency>>,
84 boost::multi_index::ordered_non_unique<boost::multi_index::tag<envPeriod>,
85 ::boost::multi_index::member<DataDictionaryItem, std::string, &DataDictionaryItem::envPeriod>>,
86 boost::multi_index::ordered_non_unique<
87 boost::multi_index::tag<envPeriodReportingFrequencyNameKeyValue>,
88 boost::multi_index::composite_key<DataDictionaryItem,
89 boost::multi_index::member<DataDictionaryItem, std::string, &DataDictionaryItem::envPeriod>,
90 boost::multi_index::member<DataDictionaryItem, std::string, &DataDictionaryItem::reportingFrequency>,
91 boost::multi_index::member<DataDictionaryItem, std::string, &DataDictionaryItem::name>,
92 boost::multi_index::member<DataDictionaryItem, std::string, &DataDictionaryItem::keyValue>>>>>;
93
94 } // namespace detail
95 } // namespace openstudio
96
97 #endif // UTILITIES_SQL_SQLFILEDATADICTIONARY_HPP
98