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
ChannelIndexDataObject.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
10http://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 "ChannelMetaDataObject.h"
22
23#include <limits>
24
25namespace WITSML2_1_NS
26{
34 template <class T>
36 {
37 public:
38
46 DLL_IMPORT_OR_EXPORT ChannelIndexDataObject(gsoap_resqml2_0_1::eml20__DataObjectReference* partialObject) : ChannelMetaDataObject<T>(partialObject) {}
47
50
56 ChannelIndexDataObject(gsoap_eml2_3::eml23__AbstractObject* fromGsoap) : ChannelMetaDataObject<T>(fromGsoap) {}
57
59 virtual ~ChannelIndexDataObject() = default;
60
69 DLL_IMPORT_OR_EXPORT virtual void pushBackChannelIndex(gsoap_eml2_3::eml23__DataIndexKind indexKind, gsoap_eml2_3::eml23__UnitOfMeasure uom, const std::string & mnemonic, bool isIncreasing = true) = 0;
70
76 unsigned int getChannelIndexCount() const {
77 const size_t result = static_cast<T*>(this->gsoapProxy2_3)->Index.size();
78 if (result > (std::numeric_limits<unsigned int>::max)()) {
79 throw std::range_error("There are too much channel index.");
80 }
81
82 return static_cast<unsigned int>(result);
83 }
84
94 gsoap_eml2_3::eml23__DataIndexKind getChannelIndexKind(unsigned int index) {
95 if (index >= getChannelIndexCount()) {
96 throw std::out_of_range("The channel index is out of range");
97 }
98 return static_cast<T*>(this->gsoapProxy2_3)->Index[index]->IndexKind;
99 }
100
110 std::string getChannelIndexUom(unsigned int index) {
111 if (index >= getChannelIndexCount()) {
112 throw std::out_of_range("The channel index is out of range");
113 }
114 return static_cast<T*>(this->gsoapProxy2_3)->Index[index]->Uom;
115 }
116
126 bool getChannelIndexIsIncreasing(unsigned int index) {
127 if (index >= getChannelIndexCount()) {
128 throw std::out_of_range("The channel index is out of range");
129 }
130 return static_cast<T*>(this->gsoapProxy2_3)->Index[index]->Direction == gsoap_eml2_3::eml23__IndexDirection::increasing;
131 }
132
142 std::string getChannelIndexMnemonic(unsigned int index) {
143 if (index >= getChannelIndexCount()) {
144 throw std::out_of_range("The channel index is out of range");
145 }
146 return static_cast<T*>(this->gsoapProxy2_3)->Index[index]->Mnemonic;
147 }
148 };
149}
Definition ChannelIndexDataObject.h:36
bool getChannelIndexIsIncreasing(unsigned int index)
Definition ChannelIndexDataObject.h:126
gsoap_eml2_3::eml23__DataIndexKind getChannelIndexKind(unsigned int index)
Definition ChannelIndexDataObject.h:94
ChannelIndexDataObject(gsoap_eml2_3::eml23__AbstractObject *fromGsoap)
Definition ChannelIndexDataObject.h:56
unsigned int getChannelIndexCount() const
Definition ChannelIndexDataObject.h:76
virtual ~ChannelIndexDataObject()=default
std::string getChannelIndexUom(unsigned int index)
Definition ChannelIndexDataObject.h:110
virtual void pushBackChannelIndex(gsoap_eml2_3::eml23__DataIndexKind indexKind, gsoap_eml2_3::eml23__UnitOfMeasure uom, const std::string &mnemonic, bool isIncreasing=true)=0
std::string getChannelIndexMnemonic(unsigned int index)
Definition ChannelIndexDataObject.h:142
ChannelIndexDataObject()
Definition ChannelIndexDataObject.h:49
ChannelIndexDataObject(gsoap_resqml2_0_1::eml20__DataObjectReference *partialObject)
Definition ChannelIndexDataObject.h:46
Definition ChannelMetaDataObject.h:38