Fesapi 2.9.0.1
This project provides C++ classes which allow an easy access in import and export to the Energistics standards.
Loading...
Searching...
No Matches
CompositionalSpecification.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 "PvtSpecification.h"
22
23#include <limits>
24
32#define GETTER_AND_SETTER_FLUID_COMPONENT_PROPERTY_OPTIONAL_ATTRIBUTE(vectorName, attributeName, attributeDatatype)\
33 DLL_IMPORT_OR_EXPORT void set##vectorName##attributeName(unsigned int index, const attributeDatatype& value);\
34 DLL_IMPORT_OR_EXPORT bool has##vectorName##attributeName(unsigned int index) const {\
35 return static_cast<gsoap_eml2_3::prodml22__AbstractCompositionalModel*>(gsoapProxy)->ComponentPropertySet != nullptr &&\
36 static_cast<gsoap_eml2_3::prodml22__AbstractCompositionalModel*>(gsoapProxy)->ComponentPropertySet->vectorName.size() > index &&\
37 static_cast<gsoap_eml2_3::prodml22__AbstractCompositionalModel*>(gsoapProxy)->ComponentPropertySet->vectorName[index]->attributeName != nullptr;\
38 }\
39 DLL_IMPORT_OR_EXPORT attributeDatatype get##vectorName##attributeName(unsigned int index) const {\
40 if (!has##vectorName##attributeName(index)) { throw std::out_of_range("The index is out of range"); }\
41 return *static_cast<gsoap_eml2_3::prodml22__AbstractCompositionalModel*>(gsoapProxy)->ComponentPropertySet->vectorName[index]->attributeName;\
42 }
43
51#define GETTER_AND_SETTER_FLUID_COMPONENT_PROPERTY_MEASURE_ATTRIBUTE(vectorName, attributeName, uomDatatype)\
52 DLL_IMPORT_OR_EXPORT void set##vectorName##attributeName(unsigned int index, double value, uomDatatype uom);\
53 DLL_IMPORT_OR_EXPORT double has##vectorName##attributeName(unsigned int index) const {\
54 return static_cast<gsoap_eml2_3::prodml22__AbstractCompositionalModel*>(gsoapProxy)->ComponentPropertySet != nullptr &&\
55 static_cast<gsoap_eml2_3::prodml22__AbstractCompositionalModel*>(gsoapProxy)->ComponentPropertySet->vectorName.size() > index &&\
56 static_cast<gsoap_eml2_3::prodml22__AbstractCompositionalModel*>(gsoapProxy)->ComponentPropertySet->vectorName[index]->attributeName != nullptr;\
57 }\
58 DLL_IMPORT_OR_EXPORT double get##vectorName##attributeName##Value(unsigned int index) const {\
59 if (!has##vectorName##attributeName(index)) { throw std::out_of_range("The index is out of range"); }\
60 return static_cast<gsoap_eml2_3::prodml22__AbstractCompositionalModel*>(gsoapProxy)->ComponentPropertySet->vectorName[index]->attributeName->__item;\
61 }\
62 DLL_IMPORT_OR_EXPORT uomDatatype get##vectorName##attributeName##Uom(unsigned int index) const {\
63 if (!has##vectorName##attributeName(index)) { throw std::out_of_range("The index is out of range"); }\
64 return static_cast<gsoap_eml2_3::prodml22__AbstractCompositionalModel*>(gsoapProxy)->ComponentPropertySet->vectorName[index]->attributeName->uom;\
65 }
66
67namespace PRODML2_2_NS
68{
71 {
72 public:
73
79 CompositionalSpecification(gsoap_eml2_3::prodml22__AbstractCompositionalModel* fromGsoap):PvtSpecification(fromGsoap) {}
80
82 virtual ~CompositionalSpecification() = default;
83
89 DLL_IMPORT_OR_EXPORT bool hasMixingRule() const { return static_cast<gsoap_eml2_3::prodml22__AbstractCompositionalModel*>(gsoapProxy)->MixingRule != nullptr; }
90
98 DLL_IMPORT_OR_EXPORT gsoap_eml2_3::prodml22__MixingRule getMixingRule() const {
99 if (!hasMixingRule()) { throw std::invalid_argument("There is no mixing rule to get"); }
100 return *static_cast<gsoap_eml2_3::prodml22__AbstractCompositionalModel*>(gsoapProxy)->MixingRule;
101 }
102
108 DLL_IMPORT_OR_EXPORT void setMixingRule(gsoap_eml2_3::prodml22__MixingRule mixingRule);
109
117 DLL_IMPORT_OR_EXPORT unsigned int getBinaryInteractionCoefficientCount() const {
118 if (static_cast<gsoap_eml2_3::prodml22__AbstractCompositionalModel*>(gsoapProxy)->BinaryInteractionCoefficientSet == nullptr) {
119 return 0;
120 }
121
122 size_t count = static_cast<gsoap_eml2_3::prodml22__AbstractCompositionalModel*>(gsoapProxy)->BinaryInteractionCoefficientSet->BinaryInteractionCoefficient.size();
123 if (count > (std::numeric_limits<unsigned int>::max)()) {
124 throw std::out_of_range("There are too much coefficient");
125 }
126 return static_cast<unsigned int>(count);
127 }
128
138 DLL_IMPORT_OR_EXPORT std::string getBinaryInteractionCoefficientFluidComponent1Reference(unsigned int index) const
139 {
140 if (index >= getBinaryInteractionCoefficientCount()) {
141 throw std::out_of_range("The index is out of range");
142 }
143
144 return static_cast<gsoap_eml2_3::prodml22__AbstractCompositionalModel*>(gsoapProxy)->BinaryInteractionCoefficientSet->BinaryInteractionCoefficient[index]->fluidComponent1Reference;
145 }
146
156 DLL_IMPORT_OR_EXPORT bool hasBinaryInteractionCoefficientFluidComponent2Reference(unsigned int index) const
157 {
158 if (index >= getBinaryInteractionCoefficientCount()) {
159 throw std::out_of_range("The index is out of range");
160 }
161
162 return static_cast<gsoap_eml2_3::prodml22__AbstractCompositionalModel*>(gsoapProxy)->BinaryInteractionCoefficientSet->BinaryInteractionCoefficient[index]->fluidComponent2Reference != nullptr;
163 }
164
174 DLL_IMPORT_OR_EXPORT std::string getBinaryInteractionCoefficientFluidComponent2Reference(unsigned int index) const
175 {
176 if (!hasBinaryInteractionCoefficientFluidComponent2Reference(index)) {
177 throw std::out_of_range("There is no FluidComponent2Reference at this index");
178 }
179
180 return *static_cast<gsoap_eml2_3::prodml22__AbstractCompositionalModel*>(gsoapProxy)->BinaryInteractionCoefficientSet->BinaryInteractionCoefficient[index]->fluidComponent2Reference;
181 }
182
190 DLL_IMPORT_OR_EXPORT void pushBackBinaryInteractionCoefficient(double value, const std::string & fluidComponent1Reference, const std::string & fluidComponent2Reference = "");
191
199 DLL_IMPORT_OR_EXPORT unsigned int getFluidComponentPropertyCount() const {
200 if (static_cast<gsoap_eml2_3::prodml22__AbstractCompositionalModel*>(gsoapProxy)->ComponentPropertySet == nullptr) {
201 return 0;
202 }
203
204 size_t count = static_cast<gsoap_eml2_3::prodml22__AbstractCompositionalModel*>(gsoapProxy)->ComponentPropertySet->FluidComponentProperty.size();
205 if (count > (std::numeric_limits<unsigned int>::max)()) {
206 throw std::out_of_range("There are too much component property");
207 }
208 return static_cast<unsigned int>(count);
209 }
210
216 DLL_IMPORT_OR_EXPORT void pushBackFluidComponentProperty(const std::string & fluidComponentReference);
217
227 DLL_IMPORT_OR_EXPORT std::string getFluidComponentPropertyFluidComponentReference(unsigned int index) const{
228 if (static_cast<gsoap_eml2_3::prodml22__AbstractCompositionalModel*>(gsoapProxy)->ComponentPropertySet == nullptr ||
229 static_cast<gsoap_eml2_3::prodml22__AbstractCompositionalModel*>(gsoapProxy)->ComponentPropertySet->FluidComponentProperty.size() <= index) {
230 throw std::out_of_range("The FluidComponentProperty at this index does not exist");
231 }
232
233 return static_cast<gsoap_eml2_3::prodml22__AbstractCompositionalModel*>(gsoapProxy)->ComponentPropertySet->FluidComponentProperty[index]->fluidComponentReference;
234 }
235
236 GETTER_AND_SETTER_FLUID_COMPONENT_PROPERTY_OPTIONAL_ATTRIBUTE(FluidComponentProperty, AcentricFactor, double)
237 GETTER_AND_SETTER_FLUID_COMPONENT_PROPERTY_OPTIONAL_ATTRIBUTE(FluidComponentProperty, OmegaA, double)
238 GETTER_AND_SETTER_FLUID_COMPONENT_PROPERTY_OPTIONAL_ATTRIBUTE(FluidComponentProperty, OmegaB, double)
239 GETTER_AND_SETTER_FLUID_COMPONENT_PROPERTY_OPTIONAL_ATTRIBUTE(FluidComponentProperty, VolumeShiftParameter, double)
240 GETTER_AND_SETTER_FLUID_COMPONENT_PROPERTY_OPTIONAL_ATTRIBUTE(FluidComponentProperty, Parachor, double)
241 GETTER_AND_SETTER_FLUID_COMPONENT_PROPERTY_OPTIONAL_ATTRIBUTE(FluidComponentProperty, Remark, std::string)
242
243 GETTER_AND_SETTER_FLUID_COMPONENT_PROPERTY_MEASURE_ATTRIBUTE(FluidComponentProperty, CriticalPressure, std::string)
244 GETTER_AND_SETTER_FLUID_COMPONENT_PROPERTY_MEASURE_ATTRIBUTE(FluidComponentProperty, CriticalTemperature, gsoap_eml2_3::eml23__ThermodynamicTemperatureUom)
245 GETTER_AND_SETTER_FLUID_COMPONENT_PROPERTY_MEASURE_ATTRIBUTE(FluidComponentProperty, ReferenceTemperatureZJ, gsoap_eml2_3::eml23__ThermodynamicTemperatureUom)
246 GETTER_AND_SETTER_FLUID_COMPONENT_PROPERTY_MEASURE_ATTRIBUTE(FluidComponentProperty, CriticalViscosity, gsoap_eml2_3::eml23__DynamicViscosityUom)
247 GETTER_AND_SETTER_FLUID_COMPONENT_PROPERTY_MEASURE_ATTRIBUTE(FluidComponentProperty, CompactVolume, std::string)
248 GETTER_AND_SETTER_FLUID_COMPONENT_PROPERTY_MEASURE_ATTRIBUTE(FluidComponentProperty, CriticalVolume, gsoap_eml2_3::eml23__MolarVolumeUom)
249 GETTER_AND_SETTER_FLUID_COMPONENT_PROPERTY_MEASURE_ATTRIBUTE(FluidComponentProperty, PartialMolarVolume, gsoap_eml2_3::eml23__MolarVolumeUom)
250 GETTER_AND_SETTER_FLUID_COMPONENT_PROPERTY_MEASURE_ATTRIBUTE(FluidComponentProperty, MassDensity, std::string)
251 GETTER_AND_SETTER_FLUID_COMPONENT_PROPERTY_MEASURE_ATTRIBUTE(FluidComponentProperty, PartialMolarDensity, std::string)
252 GETTER_AND_SETTER_FLUID_COMPONENT_PROPERTY_MEASURE_ATTRIBUTE(FluidComponentProperty, ReferenceDensityZJ, std::string)
253 GETTER_AND_SETTER_FLUID_COMPONENT_PROPERTY_MEASURE_ATTRIBUTE(FluidComponentProperty, ReferenceGravityZJ, gsoap_eml2_3::eml23__APIGravityUom)
254 GETTER_AND_SETTER_FLUID_COMPONENT_PROPERTY_MEASURE_ATTRIBUTE(FluidComponentProperty, ViscousCompressibility, gsoap_eml2_3::eml23__ReciprocalPressureUom)
255 };
256}
Definition CompositionalSpecification.h:71
void setMixingRule(gsoap_eml2_3::prodml22__MixingRule mixingRule)
unsigned int getBinaryInteractionCoefficientCount() const
Definition CompositionalSpecification.h:117
void pushBackFluidComponentProperty(const std::string &fluidComponentReference)
std::string getFluidComponentPropertyFluidComponentReference(unsigned int index) const
Definition CompositionalSpecification.h:227
void pushBackBinaryInteractionCoefficient(double value, const std::string &fluidComponent1Reference, const std::string &fluidComponent2Reference="")
gsoap_eml2_3::prodml22__MixingRule getMixingRule() const
Definition CompositionalSpecification.h:98
bool hasMixingRule() const
Definition CompositionalSpecification.h:89
std::string getBinaryInteractionCoefficientFluidComponent1Reference(unsigned int index) const
Definition CompositionalSpecification.h:138
std::string getBinaryInteractionCoefficientFluidComponent2Reference(unsigned int index) const
Definition CompositionalSpecification.h:174
virtual ~CompositionalSpecification()=default
CompositionalSpecification(gsoap_eml2_3::prodml22__AbstractCompositionalModel *fromGsoap)
Definition CompositionalSpecification.h:79
unsigned int getFluidComponentPropertyCount() const
Definition CompositionalSpecification.h:199
bool hasBinaryInteractionCoefficientFluidComponent2Reference(unsigned int index) const
Definition CompositionalSpecification.h:156
Definition PvtSpecification.h:42