41 enum class numericalDatatypeEnum { UNKNOWN = 0, DOUBLE = 1, FLOAT = 2, INT64 = 3, UINT64 = 4, INT32 = 5, UINT32 = 6, INT16 = 7, UINT16 = 8, INT8 = 9, UINT8 = 10};
68 DLL_IMPORT_OR_EXPORT std::string
getUuid()
const;
79 DLL_IMPORT_OR_EXPORT std::string
getTitle()
const;
213 DLL_IMPORT_OR_EXPORT
void setTitle(
const std::string & title);
225 DLL_IMPORT_OR_EXPORT
void setEditor(
const std::string & editor);
309 DLL_IMPORT_OR_EXPORT
static void setFormat(
const std::string & vendor,
const std::string & applicationName,
const std::string & applicationVersionNumber);
333 DLL_IMPORT_OR_EXPORT
void setVersion(
const std::string & version);
361 DLL_IMPORT_OR_EXPORT
void setMetadata(
const std::string & title,
const std::string & editor, time_t creation,
const std::string & originator,
362 const std::string & description, time_t lastUpdate,
const std::string & descriptiveKeywords);
379 gsoap_resqml2_0_1::eml20__AbstractCitedDataObject*
getEml20GsoapProxy()
const {
return gsoapProxy2_0_1; }
385 void setGsoapProxy(gsoap_resqml2_0_1::eml20__AbstractCitedDataObject* gsoapProxy) { gsoapProxy2_0_1 = gsoapProxy; }
398 void setGsoapProxy(gsoap_eml2_3::eml23__AbstractObject* gsoapProxy) { gsoapProxy2_3 = gsoapProxy; }
449 DLL_IMPORT_OR_EXPORT COMMON_NS::DataObjectRepository*
getRepository()
const {
return repository;}
463 DLL_IMPORT_OR_EXPORT
virtual std::string
getXmlTag()
const = 0;
510 DLL_IMPORT_OR_EXPORT
void addAlias(
const std::string & authority,
const std::string & title);
575 DLL_IMPORT_OR_EXPORT EML2_NS::Activity*
getActivity(uint64_t index)
const;
605 DLL_IMPORT_OR_EXPORT std::vector<std::string>
getExtraMetadata(
const std::string & key)
const;
646 std::string tmp = uriSource_.empty() ?
"eml:///" : uriSource_;
653 DLL_IMPORT_OR_EXPORT
void setUriSource(
const std::string & uriSource) { uriSource_ = uriSource; }
658 DLL_IMPORT_OR_EXPORT
const std::string&
getUriSource()
const {
return uriSource_; }
665 if (uriSource_.find(
".epc") != uriSource_.size() - 4 &&
666 uriSource_.find(
".EPC") != uriSource_.size() - 4) {
670 const size_t slashPos = uriSource_.find_last_of(
"/\\");
671 return slashPos != std::string::npos ? uriSource_.substr(0, slashPos + 1) :
"";
687 gsoap_resqml2_0_1::eml20__DataObjectReference* partialObject;
690 gsoap_resqml2_0_1::eml20__AbstractCitedDataObject* gsoapProxy2_0_1;
693 gsoap_eml2_3::eml23__AbstractObject* gsoapProxy2_3;
696 COMMON_NS::DataObjectRepository* repository;
702 partialObject(nullptr),
703 gsoapProxy2_0_1(nullptr),
704 gsoapProxy2_3(nullptr),
705 repository(nullptr) {}
712 AbstractObject(gsoap_resqml2_0_1::eml20__DataObjectReference* partialObject_) :
713 partialObject(partialObject_),
714 gsoapProxy2_0_1(nullptr),
715 gsoapProxy2_3(nullptr),
716 repository(nullptr) {}
717 AbstractObject(
const DataObjectReference& dor) :
718 partialObject(dor.toDor20()),
719 gsoapProxy2_0_1(nullptr),
720 gsoapProxy2_3(nullptr),
721 repository(nullptr) {}
728 AbstractObject(gsoap_resqml2_0_1::eml20__AbstractCitedDataObject* proxy) :
729 partialObject(nullptr),
730 gsoapProxy2_0_1(proxy),
731 gsoapProxy2_3(nullptr),
732 repository(nullptr) {}
739 AbstractObject(gsoap_eml2_3::eml23__AbstractObject* proxy) :
740 partialObject(nullptr),
741 gsoapProxy2_0_1(nullptr),
742 gsoapProxy2_3(proxy),
743 repository(nullptr) {}
746 AbstractObject(
const AbstractObject&) =
delete;
747 AbstractObject& operator=(
const AbstractObject&) =
delete;
749 friend bool COMMON_NS::DataObjectRepository::addDataObject(std::unique_ptr<COMMON_NS::AbstractObject> proxy);
750 friend COMMON_NS::AbstractObject* COMMON_NS::DataObjectRepository::addOrReplaceDataObject(std::unique_ptr<COMMON_NS::AbstractObject> proxy,
bool replaceOnlyContent);
756 void initMandatoryMetadata();
774 void setMetadata(
const std::string & guid,
const std::string & title,
const std::string & editor, time_t creation,
const std::string & originator,
775 const std::string & description, time_t lastUpdate,
const std::string & descriptiveKeywords);
778 DLL_IMPORT_OR_EXPORT
void cannotBePartial()
const;
787 DLL_IMPORT_OR_EXPORT
void readArrayNdOfFloatValues(gsoap_resqml2_0_1::resqml20__AbstractDoubleArray
const* arrayInput,
float* arrayOutput)
const;
796 DLL_IMPORT_OR_EXPORT
void readArrayNdOfFloatValues(gsoap_eml2_3::eml23__AbstractFloatingPointArray
const* arrayInput,
float* arrayOutput)
const;
805 DLL_IMPORT_OR_EXPORT
void readArrayNdOfDoubleValues(gsoap_resqml2_0_1::resqml20__AbstractDoubleArray
const* arrayInput,
double * arrayOutput)
const;
814 DLL_IMPORT_OR_EXPORT
void readArrayNdOfDoubleValues(gsoap_eml2_3::eml23__AbstractFloatingPointArray
const* arrayInput,
double * arrayOutput)
const;
817 T readArrayNdOfNonHdf5IntegerValues(gsoap_resqml2_0_1::resqml20__AbstractValueArray
const * arrayInput, T * arrayOutput)
const {
818 switch (arrayInput->soap_type()) {
819 case SOAP_TYPE_gsoap_resqml2_0_1_resqml20__IntegerRangeArray:
821 gsoap_resqml2_0_1::resqml20__IntegerRangeArray
const* rangeArray =
static_cast<gsoap_resqml2_0_1::resqml20__IntegerRangeArray
const *
>(arrayInput);
822 if constexpr (std::is_signed_v<T>) {
823 if (rangeArray->Value < (std::numeric_limits<T>::min)()) {
824 throw std::overflow_error(
"Too low integers in XML for the C++ chosen datatype");
828 if (rangeArray->Value < 0 ) {
829 throw std::underflow_error(
"Cannot deal with negative values when using unsigned integer");
832 if (rangeArray->Value + rangeArray->Count >
static_cast<uint64_t
>((std::numeric_limits<T>::max)())) {
833 throw std::overflow_error(
"The range integer values are superior to maximum value of read datatype.");
835 for (T i = 0; i < static_cast<T>(rangeArray->Count); ++i) {
836 arrayOutput[i] = i +
static_cast<T
>(rangeArray->Value);
838 return (std::numeric_limits<T>::max)();
840 case SOAP_TYPE_gsoap_resqml2_0_1_resqml20__IntegerConstantArray:
842 gsoap_resqml2_0_1::resqml20__IntegerConstantArray
const* constantArray =
static_cast<gsoap_resqml2_0_1::resqml20__IntegerConstantArray const*
>(arrayInput);
844 if constexpr (std::is_signed_v<T>) {
845 value =
static_cast<T
>(std::clamp(constantArray->Value,
846 static_cast<int64_t
>((std::numeric_limits<T>::min)()),
static_cast<int64_t
>((std::numeric_limits<T>::max)())));
849 value = constantArray->Value > 0
850 ?
static_cast<T
>(std::clamp(
static_cast<uint64_t
>(constantArray->Value),
static_cast<uint64_t
>(0),
static_cast<uint64_t
>((std::numeric_limits<T>::max)())))
851 : (std::numeric_limits<T>::max)();
853 std::fill(arrayOutput, arrayOutput + constantArray->Count, value);
854 return (std::numeric_limits<T>::max)();
856 case SOAP_TYPE_gsoap_resqml2_0_1_resqml20__BooleanConstantArray:
858 gsoap_resqml2_0_1::resqml20__BooleanConstantArray
const* constantArray =
static_cast<gsoap_resqml2_0_1::resqml20__BooleanConstantArray const*
>(arrayInput);
859 std::fill(arrayOutput, arrayOutput + constantArray->Count,
static_cast<T
>(constantArray->Value));
860 return (std::numeric_limits<T>::max)();
862 case SOAP_TYPE_gsoap_resqml2_0_1_resqml20__IntegerLatticeArray:
864 gsoap_resqml2_0_1::resqml20__IntegerLatticeArray
const* latticeArray =
static_cast<gsoap_resqml2_0_1::resqml20__IntegerLatticeArray const*
>(arrayInput);
865 if (latticeArray->Offset.size() > 1) {
866 throw std::invalid_argument(
"The integer lattice array contains more than one offset.");
868 if constexpr (std::is_signed_v<T>) {
869 if (latticeArray->StartValue < (std::numeric_limits<T>::min)() || latticeArray->Offset[0]->Value < (std::numeric_limits<T>::min)()) {
870 throw std::underflow_error(
"Too low integers in XML for the C++ chosen datatype");
872 if (latticeArray->StartValue > (std::numeric_limits<T>::max)() ||
873 latticeArray->Offset[0]->Value > (std::numeric_limits<T>::max)()) {
874 throw std::overflow_error(
"Too big integers in XML for the C++ chosen datatype");
878 if (latticeArray->StartValue < 0 || latticeArray->Offset[0]->Value < 0) {
879 throw std::underflow_error(
"Cannot deal with negative values when using unsigned integer");
881 if (
static_cast<uint64_t
>(latticeArray->StartValue) > (std::numeric_limits<T>::max)() ||
882 static_cast<uint64_t
>(latticeArray->Offset[0]->Value) > (std::numeric_limits<T>::max)()) {
883 throw std::overflow_error(
"Too big integers in XML for the C++ chosen datatype");
886 for (uint64_t i = 0; i <= latticeArray->Offset[0]->Count; ++i) {
887 arrayOutput[i] =
static_cast<T
>(latticeArray->StartValue) + (i *
static_cast<T
>(latticeArray->Offset[0]->Value));
889 return (std::numeric_limits<T>::max)();
892 throw std::invalid_argument(
"The integer array type is not supported yet.");
897 T readArrayNdOfNonHdf5IntegerValues(gsoap_eml2_3::eml23__AbstractValueArray
const * arrayInput, T * arrayOutput)
const {
898 switch (arrayInput->soap_type()) {
899 case SOAP_TYPE_gsoap_eml2_3_eml23__IntegerConstantArray:
901 gsoap_eml2_3::eml23__IntegerConstantArray
const* constantArray =
static_cast<gsoap_eml2_3::eml23__IntegerConstantArray const*
>(arrayInput);
902 if constexpr (std::is_signed_v<T>) {
903 if (constantArray->Value < (std::numeric_limits<T>::min)()) {
904 throw std::underflow_error(
"Too low integers in XML for the C++ chosen datatype");
906 if (constantArray->Value > (std::numeric_limits<T>::max)()) {
907 throw std::overflow_error(
"Too big integers in XML for the C++ chosen datatype");
911 if (constantArray->Value < 0) {
912 throw std::underflow_error(
"Cannot deal with negative values when using unsigned integer");
914 if (
static_cast<uint64_t
>(constantArray->Value) > (std::numeric_limits<T>::max)()) {
915 throw std::overflow_error(
"Too big integers in XML for the C++ chosen datatype");
918 std::fill(arrayOutput, arrayOutput + constantArray->Count,
static_cast<T
>(constantArray->Value));
919 return (std::numeric_limits<T>::max)();
921 case SOAP_TYPE_gsoap_eml2_3_eml23__BooleanConstantArray:
923 gsoap_eml2_3::eml23__BooleanConstantArray
const* constantArray =
static_cast<gsoap_eml2_3::eml23__BooleanConstantArray const*
>(arrayInput);
924 std::fill(arrayOutput, arrayOutput + constantArray->Count,
static_cast<T
>(constantArray->Value));
925 return (std::numeric_limits<T>::max)();
927 case SOAP_TYPE_gsoap_eml2_3_eml23__IntegerLatticeArray:
929 gsoap_eml2_3::eml23__IntegerLatticeArray
const* latticeArray =
static_cast<gsoap_eml2_3::eml23__IntegerLatticeArray const*
>(arrayInput);
930 if (latticeArray->Offset.empty() || latticeArray->Offset.size() > 1) {
931 throw std::invalid_argument(
"The integer lattice array of UUID " + getUuid() +
" contains zero or more than one offset.");
933 if (latticeArray->Offset[0]->Count < 0) {
934 throw std::invalid_argument(
"The count of the integer lattice array of UUID " + getUuid() +
" is negative which is not valid.");
937 for (
size_t i = 0; i <= static_cast<size_t>(latticeArray->Offset[0]->Count); ++i) {
938 arrayOutput[i] = latticeArray->StartValue + (i * latticeArray->Offset[0]->Value);
940 return (std::numeric_limits<T>::max)();
942 case SOAP_TYPE_gsoap_eml2_3_eml23__IntegerXmlArray:
944 gsoap_eml2_3::eml23__IntegerXmlArray
const * xmlArray =
static_cast<gsoap_eml2_3::eml23__IntegerXmlArray const*
>(arrayInput);
945 const std::regex ws_re(
"\\s+");
946 std::sregex_token_iterator it(xmlArray->Values.begin(), xmlArray->Values.end(), ws_re, -1);
947 std::sregex_token_iterator endToken;
949 while (it != endToken) {
950 arrayOutput[index++] = std::stoll(*it++);
952 return (std::numeric_limits<T>::max)();
954 default:
throw std::invalid_argument(
"The integer array type is not supported yet.");
967 void readArrayNdOfBooleanValues(gsoap_eml2_3::eml23__BooleanExternalArray
const * arrayInput, int8_t * arrayOutput)
const;
979 T readArrayNdOfIntegerValues(gsoap_resqml2_0_1::resqml20__AbstractValueArray
const* arrayInput, T* arrayOutput)
const;
991 T readArrayNdOfIntegerValues(gsoap_eml2_3::eml23__AbstractValueArray
const* arrayInput, T* arrayOutput)
const;
1000 uint64_t getCountOfArray(gsoap_resqml2_0_1::resqml20__AbstractValueArray
const* arrayInput)
const;
1009 uint64_t getCountOfArray(gsoap_eml2_3::eml23__AbstractValueArray
const * arrayInput)
const;
1016 void convertDorIntoRel(
const DataObjectReference& dor);
1027 template <
class valueType>
1028 void convertDorIntoRel(
const DataObjectReference& dor)
1030 valueType * targetObj = getRepository()->getDataObjectByUuid<valueType>(dor.getUuid());
1031 if (targetObj ==
nullptr) {
1032 getRepository()->createPartial(dor);
1033 targetObj = getRepository()->getDataObjectByUuid<valueType>(dor.getUuid());
1034 if (targetObj ==
nullptr) {
1035 throw std::invalid_argument(
"The DOR looks invalid.");
1037 targetObj->setUriSource(getUriSource());
1039 getRepository()->addRelationship(
this, targetObj);
1053 EML2_NS::AbstractHdfProxy* getHdfProxyFromDataset(gsoap_resqml2_0_1::eml20__Hdf5Dataset
const * dataset,
bool throwException =
true)
const;
1065 EML2_NS::AbstractHdfProxy* getOrCreateHdfProxyFromDataArrayPart(gsoap_eml2_3::eml23__ExternalDataArrayPart
const * dataArrayPart)
const;
1070 std::string getHdfGroup()
const {
1071 return "/" + getXmlNamespace() +
"/" + getUuid();
1077 gsoap_eml2_3::eml23__ExternalDataArrayPart* createExternalDataArrayPart(
const std::string& datasetName, LONG64 count, EML2_NS::AbstractHdfProxy* proxy =
nullptr)
const;
1079 gsoap_resqml2_0_1::resqml20__IndexableElements mapIndexableElement(gsoap_eml2_3::eml23__IndexableElement toMap)
const;
1083 static char citationFormat[];
1088 std::string uriSource_;
1097 void setUuid(
const std::string & uuid);