@@ -420,6 +420,11 @@ inline size_t toBits(Datatype d)
420420 return toBytes (d) * CHAR_BIT;
421421}
422422
423+ /* * Check if a Datatype is a signed type
424+ *
425+ * @param d Datatype to test
426+ * @return true if signed type (integer, floating point, complex), else false
427+ */
423428constexpr bool isSigned (Datatype d);
424429
425430/* * Compare if a Datatype is a vector type
@@ -602,6 +607,13 @@ inline bool isSameFloatingPoint(Datatype d)
602607 return isSameFloatingPoint (d, determineDatatype<T_FP>());
603608}
604609
610+ /* * Compare if two Datatypes are equivalent floating point types
611+ *
612+ * @param d1 First Datatype to compare
613+ * @param d2 Second Datatype to compare
614+ * @return true if both types are floating point and have same bitness, else
615+ * false
616+ */
605617inline bool isSameFloatingPoint (Datatype d1, Datatype d2)
606618{
607619 // template
@@ -629,6 +641,13 @@ inline bool isSameComplexFloatingPoint(Datatype d)
629641 return isSameComplexFloatingPoint (d, determineDatatype<T_CFP>());
630642}
631643
644+ /* * Compare if two Datatypes are equivalent complex floating point types
645+ *
646+ * @param d1 First Datatype to compare
647+ * @param d2 Second Datatype to compare
648+ * @return true if both types are complex floating point and have same bitness,
649+ * else false
650+ */
632651inline bool isSameComplexFloatingPoint (Datatype d1, Datatype d2)
633652{
634653 // template
@@ -656,6 +675,13 @@ inline bool isSameInteger(Datatype d)
656675 return isSameInteger (d, determineDatatype<T_Int>());
657676}
658677
678+ /* * Compare if two Datatypes are equivalent integer types
679+ *
680+ * @param d1 First Datatype to compare
681+ * @param d2 Second Datatype to compare
682+ * @return true if both types are integers, same signedness and same bitness,
683+ * else false
684+ */
659685inline bool isSameInteger (Datatype d1, Datatype d2)
660686{
661687 // template
@@ -708,13 +734,24 @@ constexpr bool isChar(Datatype d)
708734template <typename T_Char>
709735constexpr bool isSameChar (Datatype d);
710736
737+ /* * Compare if two Datatypes are equivalent char types
738+ *
739+ * @param d1 First Datatype to compare
740+ * @param d2 Second Datatype to compare
741+ * @return true if both types are chars with same signedness and size, else
742+ * false
743+ */
711744constexpr bool isSameChar (Datatype d1, Datatype d2);
712745
713746/* * Comparison for two Datatypes
714747 *
715748 * Besides returning true for the same types, identical implementations on
716749 * some platforms, e.g. if long and long long are the same or double and
717750 * long double will also return true.
751+ *
752+ * @param d First Datatype to compare
753+ * @param e Second Datatype to compare
754+ * @return true if the datatypes are equivalent
718755 */
719756constexpr bool isSame (openPMD::Datatype d, openPMD::Datatype e);
720757
@@ -726,14 +763,33 @@ constexpr bool isSame(openPMD::Datatype d, openPMD::Datatype e);
726763 */
727764Datatype basicDatatype (Datatype dt);
728765
766+ /* * Convert a scalar Datatype to its vector variant
767+ *
768+ * @param dt Scalar Datatype to convert
769+ * @return Vector Datatype (e.g., INT becomes VEC_INT)
770+ */
729771Datatype toVectorType (Datatype dt);
730772
773+ /* * Convert a Datatype to its string representation
774+ *
775+ * @param dt Datatype to convert
776+ * @return String representation of the Datatype
777+ */
731778std::string datatypeToString (Datatype dt);
732779
780+ /* * Convert a string to a Datatype
781+ *
782+ * @param s String representation of a Datatype
783+ * @return The corresponding Datatype
784+ */
733785Datatype stringToDatatype (const std::string &s);
734786
735- void warnWrongDtype (std::string const &key, Datatype store, Datatype request);
736-
787+ /* * Stream operator for Datatype
788+ *
789+ * @param os Output stream
790+ * @param dt Datatype to output
791+ * @return Reference to the stream
792+ */
737793std::ostream &operator <<(std::ostream &, openPMD::Datatype const &);
738794
739795template <typename T>
0 commit comments