Skip to content

Commit 9254272

Browse files
authored
Merge pull request #247 from Flamefire/throwInvalid
Throw exception on invalid calls
2 parents c55e4e7 + 2bb3e90 commit 9254272

3 files changed

Lines changed: 61 additions & 48 deletions

File tree

src/ParallelDataCollector.cpp

Lines changed: 52 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -770,33 +770,6 @@ namespace splash
770770
src_dataset.close();
771771
}
772772

773-
void ParallelDataCollector::createReference(int32_t srcID,
774-
const char *srcName,
775-
int32_t dstID,
776-
const char *dstName,
777-
Dimensions /*count*/,
778-
Dimensions /*offset*/,
779-
Dimensions /*stride*/)
780-
throw (DCException)
781-
{
782-
if (srcName == NULL || dstName == NULL)
783-
throw DCException(getExceptionString("createReference", "a parameter was NULL"));
784-
785-
if (fileStatus == FST_CLOSED || fileStatus == FST_READING)
786-
throw DCException(getExceptionString("createReference", "this access is not permitted"));
787-
788-
if (srcID != dstID)
789-
throw DCException(getExceptionString("createReference",
790-
"source and destination ID must be identical", NULL));
791-
792-
if (srcName == dstName)
793-
throw DCException(getExceptionString("createReference",
794-
"a reference must not be identical to the referenced data", srcName));
795-
796-
throw DCException(getExceptionString("createReference",
797-
"feature currently not supported by Parallel HDF5", NULL));
798-
}
799-
800773
/*******************************************************************************
801774
* PROTECTED FUNCTIONS
802775
*******************************************************************************/
@@ -1139,4 +1112,56 @@ namespace splash
11391112
dataset.close();
11401113
}
11411114

1115+
/* UNIMPLEMENTED METHODS FROM DATACOLLECTOR. TODO: Unify interface to remove those */
1116+
void ParallelDataCollector::readGlobalAttribute(const char*, void*, Dimensions*)
1117+
throw (DCException)
1118+
{
1119+
throw DCException(getExceptionString("readGlobalAttribute",
1120+
"feature currently not supported by Parallel HDF5"));
1121+
}
1122+
1123+
void ParallelDataCollector::writeGlobalAttribute(const CollectionType& /*type*/,
1124+
const char* /*name*/, const void* /*data*/) throw (DCException)
1125+
{
1126+
throw DCException(getExceptionString("readGlobalAttribute",
1127+
"feature currently not supported by Parallel HDF5"));
1128+
}
1129+
1130+
void ParallelDataCollector::writeGlobalAttribute(const CollectionType& /*type*/,
1131+
const char* /*name*/, uint32_t /*ndims*/, const Dimensions /*dims*/,
1132+
const void* /*data*/) throw (DCException)
1133+
{
1134+
throw DCException(getExceptionString("readGlobalAttribute",
1135+
"feature currently not supported by Parallel HDF5"));
1136+
}
1137+
1138+
void ParallelDataCollector::append(int32_t /*id*/, const CollectionType& /*type*/,
1139+
size_t /*count*/, const char* /*name*/, const void* /*data*/)
1140+
throw (DCException)
1141+
{
1142+
throw DCException(getExceptionString("readGlobalAttribute",
1143+
"feature currently not supported by Parallel HDF5"));
1144+
}
1145+
1146+
void ParallelDataCollector::append(int32_t /*id*/, const CollectionType& /*type*/,
1147+
size_t /*count*/, size_t /*offset*/, size_t /*stride*/, const char* /*name*/,
1148+
const void* /*data*/) throw (DCException)
1149+
{
1150+
throw DCException(getExceptionString("readGlobalAttribute",
1151+
"feature currently not supported by Parallel HDF5"));
1152+
}
1153+
1154+
void ParallelDataCollector::createReference(int32_t /*srcID*/,
1155+
const char */*srcName*/,
1156+
int32_t /*dstID*/,
1157+
const char */*dstName*/,
1158+
Dimensions /*count*/,
1159+
Dimensions /*offset*/,
1160+
Dimensions /*stride*/)
1161+
throw (DCException)
1162+
{
1163+
throw DCException(getExceptionString("readGlobalAttribute",
1164+
"feature currently not supported by Parallel HDF5"));
1165+
}
1166+
11421167
}

src/include/splash/ParallelDataCollector.hpp

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -355,48 +355,35 @@ namespace splash
355355

356356
private:
357357

358+
/* Invalid methods from DataCollector. Do NOT call! */
359+
358360
void readGlobalAttribute(const char*,
359361
void*,
360-
Dimensions*)
361-
{
362-
363-
}
362+
Dimensions*) throw (DCException);
364363

365364
void writeGlobalAttribute(const CollectionType& /*type*/,
366365
const char* /*name*/,
367-
const void* /*data*/)
368-
{
369-
370-
}
366+
const void* /*data*/) throw (DCException);
371367

372368
void writeGlobalAttribute(const CollectionType& /*type*/,
373369
const char* /*name*/,
374370
uint32_t /*ndims*/,
375371
const Dimensions /*dims*/,
376-
const void* /*data*/)
377-
{
378-
379-
}
372+
const void* /*data*/) throw (DCException);
380373

381374
void append(int32_t /*id*/,
382375
const CollectionType& /*type*/,
383376
size_t /*count*/,
384377
const char* /*name*/,
385-
const void* /*data*/)
386-
{
387-
388-
}
378+
const void* /*data*/) throw (DCException);
389379

390380
void append(int32_t /*id*/,
391381
const CollectionType& /*type*/,
392382
size_t /*count*/,
393383
size_t /*offset*/,
394384
size_t /*stride*/,
395385
const char* /*name*/,
396-
const void* /*data*/)
397-
{
398-
399-
}
386+
const void* /*data*/) throw (DCException);
400387

401388
void createReference(int32_t /*srcID*/,
402389
const char* /*srcName*/,
@@ -406,6 +393,7 @@ namespace splash
406393
Dimensions /*offset*/,
407394
Dimensions /*stride*/) throw (DCException);
408395

396+
/* End invalid methods */
409397

410398
/**
411399
* Internal meta data reading method.

src/include/splash/basetypes/ColTypeDimArray.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace splash
3636

3737
ColTypeDimArray()
3838
{
39-
const hsize_t dim[] = {3};
39+
const hsize_t dim[] = {DSP_DIM_MAX};
4040
this->type = H5Tarray_create(H5T_NATIVE_HSIZE, 1, dim);
4141
}
4242

0 commit comments

Comments
 (0)