Fesapi 2.3.0.0
This project provides C++ classes which allow an easy access in import and export to the Energistics standards.
ChannelMetaDataObject.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 "../witsml2/WellboreObject.h"
22
23#include <stdexcept>
24
25#include "../eml2/PropertyKind.h"
26
27namespace WITSML2_0_NS
28{
36 template <class T>
38 {
39 public:
40
48 DLL_IMPORT_OR_EXPORT ChannelMetaDataObject(gsoap_resqml2_0_1::eml20__DataObjectReference* partialObject) : WellboreObject(partialObject) {}
49
51 ChannelMetaDataObject() : WITSML2_NS::WellboreObject() {}
52
58 ChannelMetaDataObject(gsoap_eml2_1::eml21__AbstractObject* fromGsoap) : WITSML2_NS::WellboreObject(fromGsoap) {}
59
61 virtual ~ChannelMetaDataObject() = default;
62
68 COMMON_NS::DataObjectReference getWellboreDor() const
69 {
70 return COMMON_NS::DataObjectReference(static_cast<T*>(gsoapProxy2_1)->Wellbore);
71 }
72
80 DLL_IMPORT_OR_EXPORT void setWellbore(WITSML2_NS::Wellbore* witsmlWellbore)
81 {
82 if (witsmlWellbore == nullptr) {
83 throw std::invalid_argument("Cannot set a null witsml wellbore to a witsml trajectory");
84 }
85
86 static_cast<T*>(gsoapProxy2_1)->Wellbore = witsmlWellbore->newEmlReference();
87
88 getRepository()->addRelationship(this, witsmlWellbore);
89 }
90
94 COMMON_NS::DataObjectReference getPropertyKindDor() const
95 {
96 return COMMON_NS::DataObjectReference(static_cast<T*>(gsoapProxy2_1)->ChannelClass);
97 }
98
104 EML2_NS::PropertyKind* getPropertyKind() const
105 {
106 return getRepository()->template getDataObjectByUuid<EML2_NS::PropertyKind>(getPropertyKindDor().getUuid());
107 }
108
116 void setPropertyKind(EML2_NS::PropertyKind* propKind)
117 {
118 if (propKind == nullptr) {
119 throw std::invalid_argument("Cannot set a null witsml propKind to a witsml log/channelset/channel");
120 }
121
122 static_cast<T*>(gsoapProxy2_1)->ChannelClass = propKind->newEmlReference();
123
124 getRepository()->addRelationship(this, propKind);
125 }
126
134#define GETTER_AND_SETTER_GENERIC_OPTIONAL_ATTRIBUTE_TEMPLATE(attributeDatatype, attributeName, constructor)\
135 DLL_IMPORT_OR_EXPORT virtual void set##attributeName(const attributeDatatype & attributeName) = 0;\
136 std::string get##attributeName() const {\
137 if (static_cast<T*>(gsoapProxy2_1)->attributeName == nullptr) { throw std::invalid_argument("The attribute does not exist"); }\
138 return *static_cast<T*>(gsoapProxy2_1)->attributeName;\
139 }\
140 bool has##attributeName() const { return static_cast<T*>(gsoapProxy2_1)->attributeName != nullptr; }
141
142 GETTER_AND_SETTER_GENERIC_OPTIONAL_ATTRIBUTE_TEMPLATE(std::string, TimeDepth, gsoap_eml2_1::soap_new_std__string)
143 GETTER_AND_SETTER_GENERIC_OPTIONAL_ATTRIBUTE_TEMPLATE(std::string, RunNumber, gsoap_eml2_1::soap_new_std__string)
144 GETTER_AND_SETTER_GENERIC_OPTIONAL_ATTRIBUTE_TEMPLATE(std::string, PassNumber, gsoap_eml2_1::soap_new_std__string)
145 GETTER_AND_SETTER_GENERIC_OPTIONAL_ATTRIBUTE_TEMPLATE(std::string, LoggingCompanyName, gsoap_eml2_1::soap_new_std__string)
146 GETTER_AND_SETTER_GENERIC_OPTIONAL_ATTRIBUTE_TEMPLATE(std::string, LoggingCompanyCode, gsoap_eml2_1::soap_new_std__string)
147 GETTER_AND_SETTER_GENERIC_OPTIONAL_ATTRIBUTE_TEMPLATE(std::string, ToolName, gsoap_eml2_1::soap_new_std__string)
148 GETTER_AND_SETTER_GENERIC_OPTIONAL_ATTRIBUTE_TEMPLATE(std::string, ToolClass, gsoap_eml2_1::soap_new_std__string)
149 };
150
158 template<> inline std::string ChannelMetaDataObject<gsoap_eml2_1::witsml20__Channel>::getTimeDepth() const {
159 return static_cast<gsoap_eml2_1::witsml20__Channel*>(gsoapProxy2_1)->TimeDepth;
160 }
161
169 template<> inline bool ChannelMetaDataObject<gsoap_eml2_1::witsml20__Channel>::hasTimeDepth() const {
170 return true;
171 }
172
180 template<> inline std::string ChannelMetaDataObject<gsoap_eml2_1::witsml20__Channel>::getLoggingCompanyName() const {
181 return static_cast<gsoap_eml2_1::witsml20__Channel*>(gsoapProxy2_1)->LoggingCompanyName;
182 }
183
191 template<> inline bool ChannelMetaDataObject<gsoap_eml2_1::witsml20__Channel>::hasLoggingCompanyName() const {
192 return true;
193 }
194}
A wellbore represents the path from surface to a unique bottomhole location.
Definition: Wellbore.h:46
Definition: WellboreObject.h:32
gsoap_eml2_1::eml21__DataObjectReference * newEmlReference() const
Definition: ChannelMetaDataObject.h:38
eml2::PropertyKind * getPropertyKind() const
Definition: ChannelMetaDataObject.h:104
ChannelMetaDataObject(gsoap_resqml2_0_1::eml20__DataObjectReference *partialObject)
Definition: ChannelMetaDataObject.h:48
virtual ~ChannelMetaDataObject()=default
void setWellbore(WITSML2_NS::Wellbore *witsmlWellbore)
Definition: ChannelMetaDataObject.h:80
common::DataObjectReference getWellboreDor() const
Gets wellbore dor.
Definition: ChannelMetaDataObject.h:68
void setPropertyKind(eml2::PropertyKind *propKind)
Definition: ChannelMetaDataObject.h:116
common::DataObjectReference getPropertyKindDor() const
Definition: ChannelMetaDataObject.h:94
ChannelMetaDataObject(gsoap_eml2_1::eml21__AbstractObject *fromGsoap)
Definition: ChannelMetaDataObject.h:58
ChannelMetaDataObject()
Definition: ChannelMetaDataObject.h:51
A wellbore represents the path from surface to a unique bottomhole location.
Definition: Wellbore.h:29