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
PvtSpecification.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#include <limits>
21
22#include "../proxies/gsoap_eml2_3H.h"
23
24#include "../nsDefinitions.h"
25
26#if defined(_WIN32) && !defined(FESAPI_STATIC)
27#if defined(FesapiCpp_EXPORTS) || defined(FesapiCppUnderDev_EXPORTS)
28#define DLL_IMPORT_OR_EXPORT __declspec(dllexport)
29#else
30#define DLL_IMPORT_OR_EXPORT __declspec(dllimport)
31#endif
32#else
33#define DLL_IMPORT_OR_EXPORT
34#endif
35
36#include "../MacroDefinitions.h"
37
38namespace PRODML2_2_NS
39{
42 {
43 public:
45 gsoap_eml2_3::prodml22__AbstractPvtModel* gsoapProxy;
46
52 PvtSpecification(gsoap_eml2_3::prodml22__AbstractPvtModel* fromGsoap): gsoapProxy(fromGsoap){}
53
55 virtual ~PvtSpecification() = default;
56
64 DLL_IMPORT_OR_EXPORT unsigned int getCoefficientCount() const {
65 if (static_cast<gsoap_eml2_3::prodml22__AbstractPvtModel*>(gsoapProxy)->PvtModelParameterSet == nullptr) {
66 return 0;
67 }
68
69 size_t count = static_cast<gsoap_eml2_3::prodml22__AbstractPvtModel*>(gsoapProxy)->PvtModelParameterSet->Coefficient.size();
70 if (count > (std::numeric_limits<unsigned int>::max)()) {
71 throw std::out_of_range("There are too much coefficient");
72 }
73 return static_cast<unsigned int>(count);
74 }
75
85 DLL_IMPORT_OR_EXPORT double getCoefficientValue(unsigned int index) const
86 {
87 if (index >= getCoefficientCount()) {
88 throw std::out_of_range("The index is out of range");
89 }
90
91 return static_cast<gsoap_eml2_3::prodml22__AbstractPvtModel*>(gsoapProxy)->PvtModelParameterSet->Coefficient[index]->__item;
92 }
93
101 DLL_IMPORT_OR_EXPORT gsoap_eml2_3::prodml22__PvtModelParameterKind getCoefficientKind(unsigned int index) const;
102
112 DLL_IMPORT_OR_EXPORT bool hasCoefficientName(unsigned int index) const
113 {
114 if (index >= getCoefficientCount()) {
115 throw std::out_of_range("The index is out of range");
116 }
117
118 return static_cast<gsoap_eml2_3::prodml22__AbstractPvtModel*>(gsoapProxy)->PvtModelParameterSet->Coefficient[index]->name != nullptr;
119 }
120
130 DLL_IMPORT_OR_EXPORT std::string getCoefficientName(unsigned int index) const
131 {
132 if (!hasCoefficientName(index)) {
133 throw std::invalid_argument("Ther is no coefficient name at this index");
134 }
135
136 return *static_cast<gsoap_eml2_3::prodml22__AbstractPvtModel*>(gsoapProxy)->PvtModelParameterSet->Coefficient[index]->name;
137 }
138
146 DLL_IMPORT_OR_EXPORT void pushBackCoefficient(double value, gsoap_eml2_3::prodml22__PvtModelParameterKind kind, const std::string & name = "");
147 };
148}
Definition PvtSpecification.h:42
std::string getCoefficientName(unsigned int index) const
Definition PvtSpecification.h:130
gsoap_eml2_3::prodml22__AbstractPvtModel * gsoapProxy
Definition PvtSpecification.h:45
virtual ~PvtSpecification()=default
unsigned int getCoefficientCount() const
Definition PvtSpecification.h:64
bool hasCoefficientName(unsigned int index) const
Definition PvtSpecification.h:112
void pushBackCoefficient(double value, gsoap_eml2_3::prodml22__PvtModelParameterKind kind, const std::string &name="")
PvtSpecification(gsoap_eml2_3::prodml22__AbstractPvtModel *fromGsoap)
Definition PvtSpecification.h:52
gsoap_eml2_3::prodml22__PvtModelParameterKind getCoefficientKind(unsigned int index) const
double getCoefficientValue(unsigned int index) const
Definition PvtSpecification.h:85