Fesapi 2.14.0.0
This project provides C++ classes which allow an easy access in import and export to the Energistics standards.
Loading...
Searching...
No Matches
ContinuousProperty.h
1/*-----------------------------------------------------------------------
2Licensed to the Apache Software Foundation (ASF) under one
3or more contributor license agreements. See the NOTICE file
4distributed with this work for additional information
5regarding copyright ownership. The ASF licenses this file
6to you under the Apache License, Version 2.0 (the
7"License"; you may not use this file except in compliance
8with the License. You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12Unless required by applicable law or agreed to in writing,
13software distributed under the License is distributed on an
14"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15KIND, either express or implied. See the License for the
16specific language governing permissions and limitations
17under the License.
18-----------------------------------------------------------------------*/
19#pragma once
20
21#include "../resqml2/ContinuousProperty.h"
22#include "../eml2/AbstractHdfProxy.h"
23
24#include <stdexcept>
25#include <sstream>
26
27namespace RESQML2_2_NS
28{
36 class ContinuousProperty final : public RESQML2_NS::ContinuousProperty
37 {
38 public:
39
45 DLL_IMPORT_OR_EXPORT ContinuousProperty(gsoap_resqml2_0_1::eml20__DataObjectReference* partialObject) : RESQML2_NS::ContinuousProperty(partialObject) {}
46
69 ContinuousProperty(RESQML2_NS::AbstractRepresentation * rep, const std::string & guid, const std::string & title,
70 unsigned int dimension, gsoap_eml2_3::eml23__IndexableElement attachmentKind, gsoap_resqml2_0_1::resqml20__ResqmlUom uom, EML2_NS::PropertyKind * propKind);
71
92 ContinuousProperty(RESQML2_NS::AbstractRepresentation * rep, const std::string & guid, const std::string & title,
93 unsigned int dimension, gsoap_eml2_3::eml23__IndexableElement attachmentKind, const std::string & nonStandardUom, EML2_NS::PropertyKind * propKind);
94
100 ContinuousProperty(gsoap_eml2_3::_resqml22__ContinuousProperty* fromGsoap): RESQML2_NS::ContinuousProperty(fromGsoap) {}
101
104
105 DLL_IMPORT_OR_EXPORT gsoap_resqml2_0_1::resqml20__ResqmlUom getUom() const final;
106
107 DLL_IMPORT_OR_EXPORT std::string getUomAsString() const final;
108
109 DLL_IMPORT_OR_EXPORT double getMinimumValue(uint64_t index = 0) const final;
110
111 DLL_IMPORT_OR_EXPORT double getMaximumValue(uint64_t index = 0) const final;
112
113 DLL_IMPORT_OR_EXPORT void setMinimumValue(double value, uint64_t index = 0) const final;
114
115 DLL_IMPORT_OR_EXPORT void setMaximumValue(double value, uint64_t index = 0) const final;
116
117 bool validatePropertyKindAssociation(EML2_NS::PropertyKind*) final { return true; }
118
119 bool validatePropertyKindAssociation(gsoap_resqml2_0_1::resqml20__ResqmlPropertyKind) final { return true; }
120
121 DLL_IMPORT_OR_EXPORT COMMON_NS::NumberArrayStatistics<float> getFloatStatistics(uint64_t patchIndex) const final {
122 return getStats<float>(patchIndex);
123 }
124 DLL_IMPORT_OR_EXPORT COMMON_NS::NumberArrayStatistics<double> getDoubleStatistics(uint64_t patchIndex) const final {
125 return getStats<double>(patchIndex);
126 }
127
131 DLL_IMPORT_OR_EXPORT static const char* XML_NS;
132
136 DLL_IMPORT_OR_EXPORT std::string getXmlNamespace() const final { return XML_NS; }
137
138 private:
139
150 void init(RESQML2_NS::AbstractRepresentation * rep, const std::string & guid, const std::string & title,
151 unsigned int dimension, gsoap_eml2_3::eml23__IndexableElement attachmentKind);
152
153 size_t getMinimumValueSize() const { return 1; }
154 size_t getMaximumValueSize() const { return 1; }
155
156 template<typename T>
157 COMMON_NS::NumberArrayStatistics<T> getStats(uint64_t patchIndex) const {
158 COMMON_NS::NumberArrayStatistics<T> result;
159
160 const auto* valuesforPatch = static_cast<gsoap_eml2_3::_resqml22__ContinuousProperty*>(gsoapProxy2_3)->ValuesForPatch.at(patchIndex);
161 auto const* xmlArray = dynamic_cast<gsoap_eml2_3::eml23__AbstractFloatingPointArray const*>(valuesforPatch);
162 if (xmlArray == nullptr) return result;
163
164 for (size_t i = 0; i < xmlArray->Statistics.size(); ++i) {
165 auto const* stats = xmlArray->Statistics[i];
166 if (stats->MaximumValue) {
167 result.setMaximum(*stats->MaximumValue, i);
168 }
169 if (stats->MinimumValue) {
170 result.setMinimum(*stats->MinimumValue, i);
171 }
172 if (stats->ModePercentage) {
173 result.setModePercentage(*stats->ModePercentage, i);
174 }
175 if (stats->ValidValueCount) {
176 result.setValidValueCount(*stats->ValidValueCount, i);
177 }
178 if (stats->ValuesMedian) {
179 result.setMedian(*stats->ValuesMedian, i);
180 }
181 if (stats->ValuesMode) {
182 result.setMode(*stats->ValuesMode, i);
183 }
184 if (stats->ValuesMean) {
185 result.setMean(*stats->ValuesMean, i);
186 }
187 if (stats->ValuesStandardDeviation) {
188 result.setStandardDeviation(*stats->ValuesStandardDeviation, i);
189 }
190 }
191
192 return result;
193 }
194 };
195}
ContinuousProperty(gsoap_resqml2_0_1::eml20__DataObjectReference *partialObject)
Definition ContinuousProperty.h:45
ContinuousProperty(resqml2::AbstractRepresentation *rep, const std::string &guid, const std::string &title, unsigned int dimension, gsoap_eml2_3::eml23__IndexableElement attachmentKind, const std::string &nonStandardUom, eml2::PropertyKind *propKind)
double getMinimumValue(uint64_t index=0) const final
Gets the minimum value of a non vector property or the minimum value of one given value of a vector p...
gsoap_resqml2_0_1::resqml20__ResqmlUom getUom() const final
static const char * XML_NS
Definition ContinuousProperty.h:131
void setMinimumValue(double value, uint64_t index=0) const final
Sets the minimum value of a non vector property or the minimum value of one given value of a vector p...
std::string getXmlNamespace() const final
Definition ContinuousProperty.h:136
void setMaximumValue(double value, uint64_t index=0) const final
Sets the maximum value of a non vector property or the maximum value of one given value of a vector p...
bool validatePropertyKindAssociation(gsoap_resqml2_0_1::resqml20__ResqmlPropertyKind) final
Definition ContinuousProperty.h:119
ContinuousProperty(resqml2::AbstractRepresentation *rep, const std::string &guid, const std::string &title, unsigned int dimension, gsoap_eml2_3::eml23__IndexableElement attachmentKind, gsoap_resqml2_0_1::resqml20__ResqmlUom uom, eml2::PropertyKind *propKind)
double getMaximumValue(uint64_t index=0) const final
Gets the maximum value of a non vector property or the maximum value of one given value of a vector p...
std::string getUomAsString() const final
ContinuousProperty(gsoap_eml2_3::_resqml22__ContinuousProperty *fromGsoap)
Definition ContinuousProperty.h:100
bool validatePropertyKindAssociation(eml2::PropertyKind *) final
Definition ContinuousProperty.h:117