21#include <unordered_map>
25#include "../proxies/gsoap_witsml1_4H.h"
27#include "DataObjectRepository.h"
36 enum hdfDatatypeEnum { UNKNOWN = 0, DOUBLE = 1, FLOAT = 2, LONG_64 = 3, ULONG_64 = 4, INT = 5, UINT = 6, SHORT = 7, USHORT = 8, CHAR = 9, UCHAR = 10};
49 DLL_IMPORT_OR_EXPORT
virtual bool isTopLevelElement()
const {
return true; }
60 DLL_IMPORT_OR_EXPORT std::string
getUuid()
const;
71 DLL_IMPORT_OR_EXPORT std::string
getTitle()
const;
205 DLL_IMPORT_OR_EXPORT
void setTitle(
const std::string & title);
217 DLL_IMPORT_OR_EXPORT
void setEditor(
const std::string & editor);
301 DLL_IMPORT_OR_EXPORT
static void setFormat(
const std::string & vendor,
const std::string & applicationName,
const std::string & applicationVersionNumber);
325 DLL_IMPORT_OR_EXPORT
void setVersion(
const std::string & version);
353 DLL_IMPORT_OR_EXPORT
void setMetadata(
const std::string & title,
const std::string & editor, time_t creation,
const std::string & originator,
354 const std::string & description, time_t lastUpdate,
const std::string & descriptiveKeywords);
371 gsoap_resqml2_0_1::eml20__AbstractCitedDataObject*
getEml20GsoapProxy()
const {
return gsoapProxy2_0_1; }
377 void setGsoapProxy(gsoap_resqml2_0_1::eml20__AbstractCitedDataObject* gsoapProxy) { gsoapProxy2_0_1 = gsoapProxy; }
390 void setGsoapProxy(gsoap_eml2_1::eml21__AbstractObject* gsoapProxy) { gsoapProxy2_1 = gsoapProxy; }
403 void setGsoapProxy(gsoap_eml2_2::eml22__AbstractObject* gsoapProxy) { gsoapProxy2_2 = gsoapProxy; }
416 void setGsoapProxy(gsoap_eml2_3::eml23__AbstractObject* gsoapProxy) { gsoapProxy2_3 = gsoapProxy; }
446 DLL_IMPORT_OR_EXPORT gsoap_eml2_1::eml21__DataObjectReference*
newEmlReference()
const;
481 DLL_IMPORT_OR_EXPORT COMMON_NS::DataObjectRepository*
getRepository()
const {
return repository;}
495 DLL_IMPORT_OR_EXPORT
virtual std::string
getXmlTag()
const = 0;
542 DLL_IMPORT_OR_EXPORT
void addAlias(
const std::string & authority,
const std::string & title);
609 DLL_IMPORT_OR_EXPORT EML2_NS::Activity*
getActivity(
unsigned int index)
const;
639 DLL_IMPORT_OR_EXPORT std::vector<std::string>
getExtraMetadata(
const std::string & key)
const;
678 DLL_IMPORT_OR_EXPORT std::string
buildEtp12Uri()
const {
return uriSource_ +
"/" + getQualifiedType() +
"(" + getUuid() +
")"; }
683 DLL_IMPORT_OR_EXPORT
void setUriSource(
const std::string & uriSource) { uriSource_ = uriSource; }
688 DLL_IMPORT_OR_EXPORT
const std::string&
getUriSource()
const {
return uriSource_; }
695 if (uriSource_.find(
".epc") != uriSource_.size() - 4 &&
696 uriSource_.find(
".EPC") != uriSource_.size() - 4) {
700 const size_t slashPos = uriSource_.find_last_of(
"/\\");
701 return slashPos != std::string::npos ? uriSource_.substr(0, slashPos + 1) :
"";
717 gsoap_resqml2_0_1::eml20__DataObjectReference* partialObject;
720 gsoap_witsml1_4::witsml14__obj_USCOREtrajectory* gsoapProxyTraj1_4;
723 gsoap_resqml2_0_1::eml20__AbstractCitedDataObject* gsoapProxy2_0_1;
726 gsoap_eml2_1::eml21__AbstractObject* gsoapProxy2_1;
729 gsoap_eml2_2::eml22__AbstractObject* gsoapProxy2_2;
732 gsoap_eml2_3::eml23__AbstractObject* gsoapProxy2_3;
735 COMMON_NS::DataObjectRepository* repository;
741 partialObject(nullptr), gsoapProxyTraj1_4(nullptr),
742 gsoapProxy2_0_1(nullptr),
743 gsoapProxy2_1(nullptr),
744 gsoapProxy2_2(nullptr),
745 gsoapProxy2_3(nullptr),
746 repository(nullptr) {}
753 AbstractObject(gsoap_resqml2_0_1::eml20__DataObjectReference* partialObject_) :
754 partialObject(partialObject_), gsoapProxyTraj1_4(nullptr),
755 gsoapProxy2_0_1(nullptr),
756 gsoapProxy2_1(nullptr),
757 gsoapProxy2_2(nullptr),
758 gsoapProxy2_3(nullptr),
759 repository(nullptr) {}
760 AbstractObject(
const DataObjectReference& dor) :
761 partialObject(dor.toDor20()), gsoapProxyTraj1_4(nullptr),
762 gsoapProxy2_0_1(nullptr),
763 gsoapProxy2_1(nullptr),
764 gsoapProxy2_2(nullptr),
765 gsoapProxy2_3(nullptr),
766 repository(nullptr) {}
773 AbstractObject(gsoap_witsml1_4::witsml14__obj_USCOREtrajectory* proxy) :
774 partialObject(nullptr), gsoapProxyTraj1_4(proxy),
775 gsoapProxy2_0_1(nullptr),
776 gsoapProxy2_1(nullptr),
777 gsoapProxy2_2(nullptr),
778 gsoapProxy2_3(nullptr),
779 repository(nullptr) {}
786 AbstractObject(gsoap_resqml2_0_1::eml20__AbstractCitedDataObject* proxy) :
787 partialObject(nullptr), gsoapProxyTraj1_4(nullptr),
788 gsoapProxy2_0_1(proxy),
789 gsoapProxy2_1(nullptr),
790 gsoapProxy2_2(nullptr),
791 gsoapProxy2_3(nullptr),
792 repository(nullptr) {}
799 AbstractObject(gsoap_eml2_1::eml21__AbstractObject* proxy) :
800 partialObject(nullptr), gsoapProxyTraj1_4(nullptr),
801 gsoapProxy2_0_1(nullptr),
802 gsoapProxy2_1(proxy),
803 gsoapProxy2_2(nullptr),
804 gsoapProxy2_3(nullptr),
805 repository(nullptr) {}
812 AbstractObject(gsoap_eml2_2::eml22__AbstractObject* proxy) :
813 partialObject(nullptr), gsoapProxyTraj1_4(nullptr),
814 gsoapProxy2_0_1(nullptr),
815 gsoapProxy2_1(nullptr),
816 gsoapProxy2_2(proxy),
817 gsoapProxy2_3(nullptr),
818 repository(nullptr) {}
825 AbstractObject(gsoap_eml2_3::eml23__AbstractObject* proxy) :
826 partialObject(nullptr), gsoapProxyTraj1_4(nullptr),
827 gsoapProxy2_0_1(nullptr),
828 gsoapProxy2_1(nullptr),
829 gsoapProxy2_2(nullptr),
830 gsoapProxy2_3(proxy),
831 repository(nullptr) {}
834 friend bool COMMON_NS::DataObjectRepository::addDataObject(COMMON_NS::AbstractObject* proxy);
835 friend COMMON_NS::AbstractObject* COMMON_NS::DataObjectRepository::addOrReplaceDataObject(AbstractObject* proxy,
bool replaceOnlyContent);
841 void initMandatoryMetadata();
859 void setMetadata(
const std::string & guid,
const std::string & title,
const std::string & editor, time_t creation,
const std::string & originator,
860 const std::string & description, time_t lastUpdate,
const std::string & descriptiveKeywords);
863 void cannotBePartial()
const;
872 void readArrayNdOfDoubleValues(gsoap_resqml2_0_1::resqml20__AbstractDoubleArray * arrayInput,
double * arrayOutput)
const;
881 void readArrayNdOfDoubleValues(gsoap_eml2_3::eml23__AbstractFloatingPointArray * arrayInput,
double * arrayOutput)
const;
884 void readArrayNdOfNonHdf5IntegerValues(gsoap_resqml2_0_1::resqml20__AbstractIntegerArray
const * arrayInput, T * arrayOutput)
const {
885 switch (arrayInput->soap_type()) {
886 case SOAP_TYPE_gsoap_resqml2_0_1_resqml20__IntegerRangeArray:
888 gsoap_resqml2_0_1::resqml20__IntegerRangeArray
const* rangeArray =
static_cast<gsoap_resqml2_0_1::resqml20__IntegerRangeArray
const *
>(arrayInput);
889 if (rangeArray->Value + rangeArray->Count > (std::numeric_limits<T>::max)()) {
890 throw std::range_error(
"The range integer values are superior to unsigned int maximum value.");
892 for (
unsigned int i = 0; i < static_cast<T>(rangeArray->Count); ++i) {
893 arrayOutput[i] = i +
static_cast<T
>(rangeArray->Value);
897 case SOAP_TYPE_gsoap_resqml2_0_1_resqml20__IntegerConstantArray:
899 gsoap_resqml2_0_1::resqml20__IntegerConstantArray
const* constantArray =
static_cast<gsoap_resqml2_0_1::resqml20__IntegerConstantArray const*
>(arrayInput);
900 if (constantArray->Value > (std::numeric_limits<T>::max)()) {
901 throw std::range_error(
"The constant integer value is superior to unsigned int maximum value.");
903 for (
size_t i = 0; i < constantArray->Count; ++i) {
904 arrayOutput[i] =
static_cast<T
>(constantArray->Value);
908 case SOAP_TYPE_gsoap_resqml2_0_1_resqml20__IntegerLatticeArray:
910 gsoap_resqml2_0_1::resqml20__IntegerLatticeArray
const* latticeArray =
static_cast<gsoap_resqml2_0_1::resqml20__IntegerLatticeArray const*
>(arrayInput);
911 if (latticeArray->Offset.size() > 1) {
912 throw std::invalid_argument(
"The integer lattice array contains more than one offset.");
914 for (
size_t i = 0; i <= latticeArray->Offset[0]->Count; ++i) {
915 arrayOutput[i] = latticeArray->StartValue + (i * latticeArray->Offset[0]->Value);
920 throw std::invalid_argument(
"The integer array type is not supported yet.");
925 void readArrayNdOfNonHdf5IntegerValues(gsoap_eml2_3::eml23__AbstractIntegerArray
const * arrayInput, T * arrayOutput)
const {
926 switch (arrayInput->soap_type()) {
927 case SOAP_TYPE_gsoap_eml2_3_eml23__IntegerRangeArray:
929 gsoap_eml2_3::eml23__IntegerRangeArray
const* rangeArray =
static_cast<gsoap_eml2_3::eml23__IntegerRangeArray const*
>(arrayInput);
930 if (rangeArray->Value + rangeArray->Count > (std::numeric_limits<T>::max)()) {
931 throw std::range_error(
"The range integer values are superior to unsigned int maximum value.");
933 for (
unsigned int i = 0; i < static_cast<T>(rangeArray->Count); ++i) {
934 arrayOutput[i] = i +
static_cast<T
>(rangeArray->Value);
938 case SOAP_TYPE_gsoap_eml2_3_eml23__IntegerConstantArray:
940 gsoap_eml2_3::eml23__IntegerConstantArray
const* constantArray =
static_cast<gsoap_eml2_3::eml23__IntegerConstantArray const*
>(arrayInput);
941 if (constantArray->Value > (std::numeric_limits<T>::max)()) {
942 throw std::range_error(
"The constant integer value is superior to unsigned int maximum value.");
944 std::fill(arrayOutput, arrayOutput + constantArray->Count,
static_cast<T
>(constantArray->Value));
947 case SOAP_TYPE_gsoap_eml2_3_eml23__IntegerLatticeArray:
949 gsoap_eml2_3::eml23__IntegerLatticeArray
const* latticeArray =
static_cast<gsoap_eml2_3::eml23__IntegerLatticeArray const*
>(arrayInput);
950 if (latticeArray->Offset.size() > 1) {
951 throw std::invalid_argument(
"The integer lattice array contains more than one offset.");
953 for (
size_t i = 0; i <= latticeArray->Offset[0]->Count; ++i) {
954 arrayOutput[i] = latticeArray->StartValue + (i * latticeArray->Offset[0]->Value);
958 default:
throw std::invalid_argument(
"The integer array type is not supported yet.");
971 uint8_t readArrayNdOfUInt8Values(gsoap_resqml2_0_1::resqml20__AbstractIntegerArray
const * arrayInput, uint8_t * arrayOutput)
const;
982 uint8_t readArrayNdOfUInt8Values(gsoap_eml2_3::eml23__AbstractIntegerArray
const * arrayInput, uint8_t * arrayOutput)
const;
993 uint16_t readArrayNdOfUInt16Values(gsoap_resqml2_0_1::resqml20__AbstractIntegerArray
const * arrayInput, uint16_t * arrayOutput)
const;
1004 uint16_t readArrayNdOfUInt16Values(gsoap_eml2_3::eml23__AbstractIntegerArray
const * arrayInput, uint16_t * arrayOutput)
const;
1015 uint32_t readArrayNdOfUInt32Values(gsoap_resqml2_0_1::resqml20__AbstractIntegerArray
const * arrayInput, uint32_t * arrayOutput)
const;
1026 uint32_t readArrayNdOfUInt32Values(gsoap_eml2_3::eml23__AbstractIntegerArray
const * arrayInput, uint32_t * arrayOutput)
const;
1037 uint64_t readArrayNdOfUInt64Values(gsoap_resqml2_0_1::resqml20__AbstractIntegerArray
const * arrayInput, uint64_t * arrayOutput)
const;
1048 uint64_t readArrayNdOfUInt64Values(gsoap_eml2_3::eml23__AbstractIntegerArray
const * arrayInput, uint64_t * arrayOutput)
const;
1059 int64_t readArrayNdOfInt64Values(gsoap_resqml2_0_1::resqml20__AbstractIntegerArray
const * arrayInput, int64_t * arrayOutput)
const;
1070 int64_t readArrayNdOfInt64Values(gsoap_eml2_3::eml23__AbstractIntegerArray
const * arrayInput, int64_t * arrayOutput)
const;
1079 uint64_t getCountOfIntegerArray(gsoap_resqml2_0_1::resqml20__AbstractIntegerArray * arrayInput)
const;
1088 uint64_t getCountOfIntegerArray(gsoap_eml2_3::eml23__AbstractIntegerArray * arrayInput)
const;
1095 void convertDorIntoRel(
const DataObjectReference& dor);
1106 template <
class valueType>
1107 void convertDorIntoRel(
const DataObjectReference& dor)
1109 valueType * targetObj = getRepository()->getDataObjectByUuid<valueType>(dor.getUuid());
1110 if (targetObj ==
nullptr) {
1111 getRepository()->createPartial(dor);
1112 targetObj = getRepository()->getDataObjectByUuid<valueType>(dor.getUuid());
1113 if (targetObj ==
nullptr) {
1114 throw std::invalid_argument(
"The DOR looks invalid.");
1116 targetObj->setUriSource(getUriSource());
1118 getRepository()->addRelationship(
this, targetObj);
1132 EML2_NS::AbstractHdfProxy* getHdfProxyFromDataset(gsoap_resqml2_0_1::eml20__Hdf5Dataset
const * dataset,
bool throwException =
true)
const;
1145 EML2_NS::AbstractHdfProxy* getHdfProxyFromDataset(gsoap_eml2_3::eml23__ExternalDatasetPart
const * dataset,
bool throwException =
true)
const;
1150 std::string getHdfGroup()
const {
1151 return "/" + getXmlNamespace() +
"/" + getUuid();
1154 gsoap_resqml2_0_1::resqml20__IndexableElements mapIndexableElement(gsoap_eml2_3::resqml22__IndexableElement toMap)
const;
1158 static char citationFormat[];
1163 std::string uriSource_;
1172 void setUuid(
const std::string & uuid);
An abstract data object.
Definition: AbstractObject.h:33
gsoap_eml2_2::eml22__DataObjectReference * newEml22Reference() const
soap * getGsoapContext() const
gsoap_eml2_1::eml21__DataObjectReference * newEmlReference() const
void setGsoapProxy(gsoap_eml2_2::eml22__AbstractObject *gsoapProxy)
Definition: AbstractObject.h:403
void setCreation(const tm &creation)
void setGsoapProxy(gsoap_eml2_3::eml23__AbstractObject *gsoapProxy)
Definition: AbstractObject.h:416
void setVersion(const std::string &version)
unsigned int getAliasCount() const
std::string getVersion() const
virtual std::string getContentType() const
void setTitle(const std::string &title)
std::unordered_map< std::string, std::string > getExtraMetadataSet() const
time_t getCreation() const
virtual void loadTargetRelationships()=0
std::string getExtraMetadataStringValueAtIndex(unsigned int index) const
gsoap_eml2_3::resqml22__ContactElement * newContactElementReference2_2() const
std::string serializeIntoString()
std::string buildEtp12Uri() const
Definition: AbstractObject.h:678
unsigned int getExtraMetadataCount() const
std::string getDescriptiveKeywords() const
gsoap_resqml2_0_1::eml20__DataObjectReference * newResqmlReference() const
virtual std::string getXmlNamespaceVersion() const
common::DataObjectRepository * getRepository() const
Definition: AbstractObject.h:481
void setUriSource(const std::string &uriSource)
Definition: AbstractObject.h:683
std::string getEditor() const
void changeToPartialObject()
gsoap_eml2_3::eml23__DataObjectReference * newEml23Reference() const
void setGsoapProxy(gsoap_eml2_1::eml21__AbstractObject *gsoapProxy)
Definition: AbstractObject.h:390
std::string getAliasTitleAtIndex(unsigned int index) const
virtual std::string getQualifiedType() const
void setEditor(const std::string &editor)
void setLastUpdate(time_t lastUpdate)
std::string getUuid() const
std::string getAliasAuthorityAtIndex(unsigned int index) const
void setDescription(const std::string &description)
gsoap_eml2_1::eml21__AbstractObject * getEml21GsoapProxy() const
Definition: AbstractObject.h:384
gsoap_eml2_2::eml22__AbstractObject * getEml22GsoapProxy() const
Definition: AbstractObject.h:397
void serializeIntoStream(std::ostream *stream)
void setDescriptiveKeywords(const std::string &descriptiveKeywords)
virtual std::string getXmlNamespace() const =0
void setCreation(time_t creation)
gsoap_resqml2_0_1::resqml20__ContactElementReference * newContactElementReference2_0_1() const
void pushBackExtraMetadata(const std::string &key, const std::string &value)
const std::string & getUriSource() const
Definition: AbstractObject.h:688
void setLastUpdate(const tm &lastUpdate)
eml2::Activity * getActivity(unsigned int index) const
gsoap_resqml2_0_1::eml20__AbstractCitedDataObject * getEml20GsoapProxy() const
Definition: AbstractObject.h:371
gsoap_eml2_3::eml23__AbstractObject * getEml23GsoapProxy() const
Definition: AbstractObject.h:410
std::vector< std::string > getExtraMetadata(const std::string &key) const
std::string getOriginator() const
void setGsoapProxy(gsoap_resqml2_0_1::eml20__AbstractCitedDataObject *gsoapProxy)
Definition: AbstractObject.h:377
tm getCreationAsTimeStructure() const
std::string getEpcSourceFolder() const
Definition: AbstractObject.h:694
tm getLastUpdateAsTimeStructure() const
void setMetadata(const std::string &title, const std::string &editor, time_t creation, const std::string &originator, const std::string &description, time_t lastUpdate, const std::string &descriptiveKeywords)
void setOriginator(const std::string &originator)
virtual std::string getPartNameInEpcDocument() const
std::string getDescription() const
time_t getLastUpdate() const
static void setFormat(const std::string &vendor, const std::string &applicationName, const std::string &applicationVersionNumber)
virtual std::string getXmlTag() const =0
void addAlias(const std::string &authority, const std::string &title)
unsigned int getActivityCount() const
std::string getTitle() const
std::vector< eml2::Activity * > getActivitySet() const
std::string getFormat() const
std::string getExtraMetadataKeyAtIndex(unsigned int index) const