Fesapi 2.10.1.0
This project provides C++ classes which allow an easy access in import and export to the Energistics standards.
Loading...
Searching...
No Matches
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#if defined(__clang__)
22#elif defined(__GNUG__) && __GNUC__ > 12 // https://stackoverflow.com/questions/31509434/gcc-does-not-honor-pragma-gcc-diagnostic-to-silence-warnings
23#pragma GCC diagnostic push
24#pragma GCC diagnostic ignored "-Wmisleading-indentation"
25#endif
26#include "../proxies/gsoap_resqml2_0_1H.h"
27#include "../proxies/gsoap_eml2_3H.h"
28#if defined(__clang__)
29#elif defined(__GNUG__) && __GNUC__ > 12
30#pragma GCC diagnostic pop
31#endif
32
33#include "../nsDefinitions.h"
34
35#if defined(_WIN32) && !defined(FESAPI_STATIC)
36#if defined(FesapiCpp_EXPORTS) || defined(FesapiCppUnderDev_EXPORTS)
37#define DLL_IMPORT_OR_EXPORT __declspec(dllexport)
38#else
39#define DLL_IMPORT_OR_EXPORT __declspec(dllimport)
40#endif
41#else
42#define DLL_IMPORT_OR_EXPORT
43#endif
44
45namespace COMMON_NS
46{
47 class AbstractObject;
50 {
51 public:
52
54 DataObjectReference(): dor20(nullptr), dor23(nullptr) {}
55
61 DataObjectReference(gsoap_resqml2_0_1::eml20__DataObjectReference * dor): dor20(dor), dor23(nullptr) {}
62
68 DataObjectReference(gsoap_eml2_3::eml23__DataObjectReference * dor) : dor20(nullptr), dor23(dor) {}
69
75 explicit DataObjectReference(AbstractObject const * dataObj);
76
79
85 DLL_IMPORT_OR_EXPORT bool isEmpty() const {
86 return dor20 == nullptr && dor23 == nullptr;
87 }
88
94 DLL_IMPORT_OR_EXPORT std::string getUuid() const {
95 if (dor20 != nullptr) {
96 return dor20->UUID;
97 }
98 else if (dor23 != nullptr) {
99 return dor23->Uuid;
100 }
101 else {
102 return "";
103 }
104 }
105
111 DLL_IMPORT_OR_EXPORT std::string getTitle() const {
112 if (dor20 != nullptr) {
113 return dor20->Title;
114 }
115 else if (dor23 != nullptr) {
116 return dor23->Title;
117 }
118 else {
119 return "";
120 }
121 }
122
128 DLL_IMPORT_OR_EXPORT std::string getVersion() const {
129 if (dor20 != nullptr) {
130 return dor20->VersionString != nullptr ? *dor20->VersionString : "";
131 }
132 else if (dor23 != nullptr) {
133 return dor23->ObjectVersion != nullptr ? *dor23->ObjectVersion : "";
134 }
135 else {
136 return "";
137 }
138 }
139
145 DLL_IMPORT_OR_EXPORT std::string getContentType() const {
146 if (dor20 != nullptr) {
147 return dor20->ContentType;
148 }
149 else if (dor23 != nullptr) {
150 return dor23->QualifiedType;
151 }
152 else {
153 return "";
154 }
155 }
156
162 DLL_IMPORT_OR_EXPORT std::string getEnergisticsUri() const {
163 if (dor23 != nullptr && dor23->EnergisticsUri != nullptr) {
164 return *dor23->EnergisticsUri;
165 }
166 else {
167 return "";
168 }
169 }
170
177 DLL_IMPORT_OR_EXPORT gsoap_resqml2_0_1::eml20__DataObjectReference* toDor20() const;
178
179 private :
180 gsoap_resqml2_0_1::eml20__DataObjectReference* dor20;
181 gsoap_eml2_3::eml23__DataObjectReference* dor23;
182 };
183
192 inline bool operator==(const DataObjectReference& ldor, const DataObjectReference& rdor)
193 {
194 return ldor.getUuid() == rdor.getUuid() &&
195 ldor.getContentType() == rdor.getContentType() &&
196 ldor.getVersion() == rdor.getVersion();
197 }
198}
An abstract data object.
Definition AbstractObject.h:33
This class wraps an Energistics Data Object Reference whatever its version is.
Definition DataObjectReference.h:50
DataObjectReference(gsoap_resqml2_0_1::eml20__DataObjectReference *dor)
Definition DataObjectReference.h:61
gsoap_resqml2_0_1::eml20__DataObjectReference * toDor20() const
bool isEmpty() const
Definition DataObjectReference.h:85
std::string getUuid() const
Definition DataObjectReference.h:94
std::string getContentType() const
Definition DataObjectReference.h:145
DataObjectReference(gsoap_eml2_3::eml23__DataObjectReference *dor)
Definition DataObjectReference.h:68
DataObjectReference(AbstractObject const *dataObj)
DataObjectReference()
Definition DataObjectReference.h:54
std::string getEnergisticsUri() const
Definition DataObjectReference.h:162
std::string getTitle() const
Definition DataObjectReference.h:111
std::string getVersion() const
Definition DataObjectReference.h:128
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:192