@@ -84,108 +84,70 @@ COMMON_NS::AbstractObject::numericalDatatypeEnum AbstractValuesProperty::getValu
8484 return hdfProxy->getNumericalDatatype (dsPath);
8585}
8686
87- uint64_t AbstractValuesProperty::getValuesCountOfDimensionOfPatch ( uint64_t dimIndex, uint64_t patchIndex) const
87+ std::vector< uint32_t > AbstractValuesProperty::getValuesCountPerDimensionOfPatch ( uint64_t patchIndex) const
8888{
8989 cannotBePartial ();
9090
9191 if (gsoapProxy2_0_1 != nullptr ) {
92- gsoap_resqml2_0_1::resqml20__PatchOfValues* patch = static_cast <gsoap_resqml2_0_1::resqml20__AbstractValuesProperty*>(gsoapProxy2_0_1)->PatchOfValues [patchIndex];
92+ gsoap_resqml2_0_1::resqml20__PatchOfValues const * patch = static_cast <gsoap_resqml2_0_1::resqml20__AbstractValuesProperty*>(gsoapProxy2_0_1)->PatchOfValues [patchIndex];
9393
9494 switch (patch->Values ->soap_type ()) {
9595 case SOAP_TYPE_gsoap_resqml2_0_1_resqml20__DoubleConstantArray:
9696 {
97- return static_cast <gsoap_resqml2_0_1::resqml20__DoubleConstantArray*>(patch->Values )->Count ;
97+ return std::vector< uint32_t >( 1 , static_cast <gsoap_resqml2_0_1::resqml20__DoubleConstantArray*>(patch->Values )->Count ) ;
9898 }
9999 case SOAP_TYPE_gsoap_resqml2_0_1_resqml20__DoubleLatticeArray:
100100 {
101- return static_cast <gsoap_resqml2_0_1::resqml20__DoubleLatticeArray*>(patch->Values )->Offset [dimIndex]->Count + 1 ;
101+ auto const * arrayDef = static_cast <gsoap_resqml2_0_1::resqml20__DoubleLatticeArray*>(patch->Values );
102+ std::vector<uint32_t > result;
103+ for (auto offset : arrayDef->Offset ) {
104+ result.push_back (offset->Count + 1 );
105+ }
106+ return result;
102107 }
103108 case SOAP_TYPE_gsoap_resqml2_0_1_resqml20__IntegerConstantArray:
104109 {
105- return static_cast <gsoap_resqml2_0_1::resqml20__IntegerConstantArray*>(patch->Values )->Count ;
110+ return std::vector< uint32_t >( 1 , static_cast <gsoap_resqml2_0_1::resqml20__IntegerConstantArray*>(patch->Values )->Count ) ;
106111 }
107112 case SOAP_TYPE_gsoap_resqml2_0_1_resqml20__IntegerLatticeArray:
108113 {
109- return static_cast <gsoap_resqml2_0_1::resqml20__IntegerLatticeArray*>(patch->Values )->Offset [dimIndex]->Count + 1 ;
114+ auto const * arrayDef = static_cast <gsoap_resqml2_0_1::resqml20__IntegerLatticeArray*>(patch->Values );
115+ std::vector<uint32_t > result;
116+ for (auto offset : arrayDef->Offset ) {
117+ result.push_back (offset->Count + 1 );
118+ }
119+ return result;
110120 }
111121 }
112122 }
113123 else if (gsoapProxy2_3 != nullptr ) {
114- auto patch = static_cast <gsoap_eml2_3::resqml22__AbstractValuesProperty*>(gsoapProxy2_3)->ValuesForPatch [patchIndex];
124+ auto const * patch = static_cast <gsoap_eml2_3::resqml22__AbstractValuesProperty*>(gsoapProxy2_3)->ValuesForPatch [patchIndex];
115125 switch (patch->soap_type ()) {
116126 case SOAP_TYPE_gsoap_eml2_3_eml23__FloatingPointConstantArray:
117127 {
118- return static_cast <gsoap_eml2_3::eml23__FloatingPointConstantArray*>(patch)->Count ;
128+ return std::vector< uint32_t >( 1 , static_cast <gsoap_eml2_3::eml23__FloatingPointConstantArray const *>(patch)->Count ) ;
119129 }
120130 case SOAP_TYPE_gsoap_eml2_3_eml23__FloatingPointLatticeArray:
121131 {
122- return static_cast <gsoap_eml2_3::eml23__FloatingPointLatticeArray*>(patch)->Offset [dimIndex]->Count + 1 ;
123- }
124- case SOAP_TYPE_gsoap_eml2_3_eml23__IntegerConstantArray:
125- {
126- return static_cast <gsoap_eml2_3::eml23__IntegerConstantArray*>(patch)->Count ;
127- }
128- case SOAP_TYPE_gsoap_eml2_3_eml23__IntegerLatticeArray:
129- {
130- return static_cast <gsoap_eml2_3::eml23__IntegerLatticeArray*>(patch)->Offset [dimIndex]->Count + 1 ;
131- }
132- }
133- }
134- else {
135- throw logic_error (" Only RESQML 2.2 and 2.0.1 are supported for now." );
136- }
137-
138- int64_t nullValue = (numeric_limits<int64_t >::min)();
139- std::string dsPath;
140- EML2_NS ::AbstractHdfProxy * hdfProxy = getDatasetOfPatch (patchIndex, nullValue, dsPath);
141-
142- std::vector<uint32_t > dims = hdfProxy->getElementCountPerDimension (dsPath);
143-
144- if (dimIndex < dims.size ()) {
145- return dims[dimIndex];
146- }
147-
148- throw out_of_range (" The dim index to get the count is out of range." );
149- }
150-
151- uint64_t AbstractValuesProperty::getDimensionsCountOfPatch (uint64_t patchIndex) const
152- {
153- cannotBePartial ();
154-
155- if (gsoapProxy2_0_1 != nullptr ) {
156- gsoap_resqml2_0_1::resqml20__PatchOfValues* patch = static_cast <gsoap_resqml2_0_1::resqml20__AbstractValuesProperty*>(gsoapProxy2_0_1)->PatchOfValues [patchIndex];
157-
158- switch (patch->Values ->soap_type ()) {
159- case SOAP_TYPE_gsoap_resqml2_0_1_resqml20__DoubleConstantArray:
160- case SOAP_TYPE_gsoap_resqml2_0_1_resqml20__IntegerConstantArray:
161- {
162- return 1 ;
163- }
164- case SOAP_TYPE_gsoap_resqml2_0_1_resqml20__DoubleLatticeArray:
165- {
166- return static_cast <gsoap_resqml2_0_1::resqml20__DoubleLatticeArray*>(patch->Values )->Offset .size ();
132+ auto const * arrayDef = static_cast <gsoap_eml2_3::eml23__FloatingPointLatticeArray const *>(patch);
133+ std::vector<uint32_t > result;
134+ for (auto offset : arrayDef->Offset ) {
135+ result.push_back (offset->Count + 1 );
136+ }
137+ return result;
167138 }
168- case SOAP_TYPE_gsoap_resqml2_0_1_resqml20__IntegerLatticeArray:
169- {
170- return static_cast <gsoap_resqml2_0_1::resqml20__IntegerLatticeArray*>(patch->Values )->Offset .size ();
171- }
172- }
173- }
174- else if (gsoapProxy2_3 != nullptr ) {
175- auto patch = static_cast <gsoap_eml2_3::resqml22__AbstractValuesProperty*>(gsoapProxy2_3)->ValuesForPatch [patchIndex];
176- switch (patch->soap_type ()) {
177- case SOAP_TYPE_gsoap_eml2_3_eml23__FloatingPointConstantArray:
178139 case SOAP_TYPE_gsoap_eml2_3_eml23__IntegerConstantArray:
179140 {
180- return 1 ;
181- }
182- case SOAP_TYPE_gsoap_eml2_3_eml23__FloatingPointLatticeArray:
183- {
184- return static_cast <gsoap_eml2_3::eml23__FloatingPointLatticeArray*>(patch)->Offset .size ();
141+ return std::vector<uint32_t >(1 , static_cast <gsoap_eml2_3::eml23__IntegerConstantArray const *>(patch)->Count );
185142 }
186143 case SOAP_TYPE_gsoap_eml2_3_eml23__IntegerLatticeArray:
187144 {
188- return static_cast <gsoap_eml2_3::eml23__IntegerLatticeArray*>(patch)->Offset .size ();
145+ auto const * arrayDef = static_cast <gsoap_eml2_3::eml23__IntegerLatticeArray const *>(patch);
146+ std::vector<uint32_t > result;
147+ for (auto offset : arrayDef->Offset ) {
148+ result.push_back (offset->Count + 1 );
149+ }
150+ return result;
189151 }
190152 }
191153 }
@@ -195,19 +157,15 @@ uint64_t AbstractValuesProperty::getDimensionsCountOfPatch(uint64_t patchIndex)
195157
196158 int64_t nullValue = (numeric_limits<int64_t >::min)();
197159 std::string dsPath;
198- EML2_NS ::AbstractHdfProxy * hdfProxy = getDatasetOfPatch (patchIndex, nullValue, dsPath);
160+ EML2_NS ::AbstractHdfProxy* hdfProxy = getDatasetOfPatch (patchIndex, nullValue, dsPath);
199161
200- return hdfProxy->getDimensionCount (dsPath);
162+ return hdfProxy->getElementCountPerDimension (dsPath);
201163}
202164
203- EML2_NS ::AbstractHdfProxy * AbstractValuesProperty::getDatasetOfPatch (uint64_t patchIndex, int64_t & nullValue, std::string & dsPath) const
165+ EML2_NS ::AbstractHdfProxy * AbstractValuesProperty::getDatasetOfPatch (uint64_t patchIndex, int64_t & nullValue, std::string& dsPath) const
204166{
205- if (patchIndex >= getPatchCount ()) {
206- throw out_of_range (" The values property patch is out of range" );
207- }
208-
209167 if (gsoapProxy2_0_1 != nullptr ) {
210- gsoap_resqml2_0_1::resqml20__PatchOfValues* patch = static_cast <gsoap_resqml2_0_1::resqml20__AbstractValuesProperty*>(gsoapProxy2_0_1)->PatchOfValues [ patchIndex] ;
168+ gsoap_resqml2_0_1::resqml20__PatchOfValues const * patch = static_cast <gsoap_resqml2_0_1::resqml20__AbstractValuesProperty*>(gsoapProxy2_0_1)->PatchOfValues . at ( patchIndex) ;
211169
212170 nullValue = (numeric_limits<int64_t >::min)();
213171 int valuesType = patch->Values ->soap_type ();
@@ -234,7 +192,7 @@ EML2_NS::AbstractHdfProxy * AbstractValuesProperty::getDatasetOfPatch(uint64_t p
234192 }
235193 else if (gsoapProxy2_3 != nullptr ) {
236194 nullValue = (numeric_limits<int64_t >::min)();
237- auto patch = static_cast <gsoap_eml2_3::resqml22__AbstractValuesProperty*>(gsoapProxy2_3)->ValuesForPatch [ patchIndex] ;
195+ auto patch = static_cast <gsoap_eml2_3::resqml22__AbstractValuesProperty*>(gsoapProxy2_3)->ValuesForPatch . at ( patchIndex) ;
238196 if (dynamic_cast <gsoap_eml2_3::eml23__FloatingPointExternalArray*>(patch) != nullptr ) {
239197 dsPath = static_cast <gsoap_eml2_3::eml23__FloatingPointExternalArray*>(patch)->Values ->ExternalDataArrayPart [0 ]->PathInExternalFile ;
240198 return getOrCreateHdfProxyFromDataArrayPart (static_cast <gsoap_eml2_3::eml23__FloatingPointExternalArray*>(patch)->Values ->ExternalDataArrayPart [0 ]);
0 commit comments