11/* *
2- * Copyright 2015 Carlchristian Eckert
2+ * Copyright 2015-2016 Carlchristian Eckert, Alexander Grund
33 *
44 * This file is part of libSplash.
55 *
@@ -32,7 +32,7 @@ namespace splash
3232
3333/* *
3434 * Checks if a datatype_id (from an outer scope) can be used to generate a
35- * specific CollectionType derivate .
35+ * specific CollectionType instance .
3636 *
3737 * If the call to the genType member function of a specific collection type
3838 * is successful, it will return the pointer to an instance of this type.
@@ -43,7 +43,8 @@ namespace splash
4343#define TRY_COLTYPE (_name ) \
4444{ \
4545 CollectionType* t = ColType##_name::genType (datatype_id); \
46- if (t != NULL && typeid (*t) == typeid (ColType##_name)) return t; \
46+ assert (t == NULL || typeid (*t) == typeid (ColType##_name)); \
47+ if (t != NULL ) return t; \
4748} \
4849
4950
@@ -53,10 +54,11 @@ namespace splash
5354 * @param datatype_id the H5 datatype_id that should be converted into a
5455 * CollectionType
5556 *
56- * @return A pointer to a heap-allocated CollectionType, if a matching
57- * CollectionType could be determined. The allocated object must be
58- * freed by the caller at the end of its lifetime.
59- * If no matching CollectionType was found, returns NULL.
57+ * @return A pointer to a heap-allocated CollectionType.
58+ * The allocated object must be freed by the caller at the end of its
59+ * lifetime.
60+ * If no matching CollectionType was found, returns a ColTypeUnknown
61+ * instance.
6062 */
6163CollectionType* generateCollectionType (hid_t datatype_id)
6264{
@@ -123,6 +125,7 @@ CollectionType* generateCollectionType(hid_t datatype_id)
123125 return new ColTypeUnknown;
124126}
125127
128+ #undef TRY_COLTYPE
126129
127130} /* namespace splash */
128131
0 commit comments