Fesapi 2.3.0.0
This project provides C++ classes which allow an easy access in import and export to the Energistics standards.
DataObjectReference.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 "../proxies/gsoap_resqml2_0_1H.h"
22#include "../proxies/gsoap_eml2_1H.h"
23#include "../proxies/gsoap_eml2_2H.h"
24#include "../proxies/gsoap_eml2_3H.h"
25
26#include "../nsDefinitions.h"
27
28#if defined(_WIN32) && !defined(FESAPI_STATIC)
29#if defined(FesapiCpp_EXPORTS) || defined(FesapiCppUnderDev_EXPORTS)
30#define DLL_IMPORT_OR_EXPORT __declspec(dllexport)
31#else
32#define DLL_IMPORT_OR_EXPORT __declspec(dllimport)
33#endif
34#else
35#define DLL_IMPORT_OR_EXPORT
36#endif
37
38namespace COMMON_NS
39{
40 class AbstractObject;
43 {
44 public:
45
47 DataObjectReference(): dor20(nullptr), dor21(nullptr), dor22(nullptr), dor23(nullptr) {}
48
54 DataObjectReference(gsoap_resqml2_0_1::eml20__DataObjectReference * dor): dor20(dor), dor21(nullptr), dor22(nullptr), dor23(nullptr) {}
55
61 DataObjectReference(gsoap_eml2_1::eml21__DataObjectReference * dor) : dor20(nullptr), dor21(dor), dor22(nullptr), dor23(nullptr) {}
62
68 DataObjectReference(gsoap_eml2_2::eml22__DataObjectReference * dor) : dor20(nullptr), dor21(nullptr), dor22(dor), dor23(nullptr) {}
69
75 DataObjectReference(gsoap_eml2_3::eml23__DataObjectReference * dor) : dor20(nullptr), dor21(nullptr), dor22(nullptr), dor23(dor) {}
76
83
86
92 DLL_IMPORT_OR_EXPORT bool isEmpty() const {
93 return dor20 == nullptr && dor21 == nullptr && dor22 == nullptr && dor23 == nullptr;
94 }
95
101 DLL_IMPORT_OR_EXPORT std::string getUuid() const {
102 if (dor20 != nullptr) {
103 return dor20->UUID;
104 }
105 else if (dor21 != nullptr) {
106 return dor21->Uuid;
107 }
108 else if (dor22 != nullptr) {
109 return dor22->Uuid;
110 }
111 else if (dor23 != nullptr) {
112 return dor23->Uuid;
113 }
114 else {
115 return "";
116 }
117 }
118
124 DLL_IMPORT_OR_EXPORT std::string getTitle() const {
125 if (dor20 != nullptr) {
126 return dor20->Title;
127 }
128 else if (dor21 != nullptr) {
129 return dor21->Title;
130 }
131 else if (dor22 != nullptr) {
132 return dor22->Title;
133 }
134 else if (dor23 != nullptr) {
135 return dor23->Title;
136 }
137 else {
138 return "";
139 }
140 }
141
147 DLL_IMPORT_OR_EXPORT std::string getVersion() const {
148 if (dor20 != nullptr) {
149 return dor20->VersionString != nullptr ? *dor20->VersionString : "";
150 }
151 else if (dor21 != nullptr) {
152 return dor21->VersionString != nullptr ? *dor21->VersionString : "";
153 }
154 else if (dor22 != nullptr) {
155 return dor22->ObjectVersion != nullptr ? *dor22->ObjectVersion : "";
156 }
157 else if (dor23 != nullptr) {
158 return dor23->ObjectVersion != nullptr ? *dor23->ObjectVersion : "";
159 }
160 else {
161 return "";
162 }
163 }
164
170 DLL_IMPORT_OR_EXPORT std::string getContentType() const {
171 if (dor20 != nullptr) {
172 return dor20->ContentType;
173 }
174 else if (dor21 != nullptr) {
175 return dor21->ContentType;
176 }
177 else if (dor22 != nullptr) {
178 return dor22->ContentType;
179 }
180 else if (dor23 != nullptr) {
181 return dor23->ContentType;
182 }
183 else {
184 return "";
185 }
186 }
187
193 DLL_IMPORT_OR_EXPORT std::string getEnergisticsUri() const {
194 if (dor21 != nullptr && dor21->Uri != nullptr) {
195 return *dor21->Uri;
196 }
197 else if (dor22 != nullptr && dor22->Uri != nullptr) {
198 return *dor22->Uri;
199 }
200 else if (dor23 != nullptr && dor23->Uri != nullptr) {
201 return *dor23->Uri;
202 }
203 else {
204 return "";
205 }
206 }
207
214 DLL_IMPORT_OR_EXPORT gsoap_resqml2_0_1::eml20__DataObjectReference* toDor20() const;
215
216 private :
217 gsoap_resqml2_0_1::eml20__DataObjectReference* dor20;
218 gsoap_eml2_1::eml21__DataObjectReference* dor21;
219 gsoap_eml2_2::eml22__DataObjectReference* dor22;
220 gsoap_eml2_3::eml23__DataObjectReference* dor23;
221 };
222
231 inline bool operator==(const DataObjectReference& ldor, const DataObjectReference& rdor)
232 {
233 return ldor.getUuid() == rdor.getUuid() &&
234 ldor.getContentType() == rdor.getContentType() &&
235 ldor.getVersion() == rdor.getVersion();
236 }
237}
An abstract data object.
Definition: AbstractObject.h:33
This class wraps an Energistics Data Object Reference whatever its version is.
Definition: DataObjectReference.h:43
DataObjectReference(gsoap_resqml2_0_1::eml20__DataObjectReference *dor)
Definition: DataObjectReference.h:54
gsoap_resqml2_0_1::eml20__DataObjectReference * toDor20() const
bool isEmpty() const
Definition: DataObjectReference.h:92
std::string getUuid() const
Definition: DataObjectReference.h:101
DataObjectReference(gsoap_eml2_2::eml22__DataObjectReference *dor)
Definition: DataObjectReference.h:68
std::string getContentType() const
Definition: DataObjectReference.h:170
DataObjectReference(gsoap_eml2_3::eml23__DataObjectReference *dor)
Definition: DataObjectReference.h:75
DataObjectReference(AbstractObject const *dataObj)
DataObjectReference()
Definition: DataObjectReference.h:47
std::string getEnergisticsUri() const
Definition: DataObjectReference.h:193
DataObjectReference(gsoap_eml2_1::eml21__DataObjectReference *dor)
Definition: DataObjectReference.h:61
std::string getTitle() const
Definition: DataObjectReference.h:124
std::string getVersion() const
Definition: DataObjectReference.h:147
bool operator==(const DataObjectReference &ldor, const DataObjectReference &rdor)
Title is not part of the real identifier of a dataobject. This is just a hint.
Definition: DataObjectReference.h:231