Inviwo 0.9.12-pre
Inviwo documentation
|
A traits class for getting information about a data object. This provides a customization point if one wants to generate the information dynamically, by specializing the traits for your kind of Data: More...
#include <datatraits.h>
Static Public Member Functions | |
static constexpr std::string_view | classIdentifier () |
static constexpr std::string_view | dataName () |
static constexpr uvec3 | colorCode () |
static Document | info (const T &data) |
A traits class for getting information about a data object. This provides a customization point if one wants to generate the information dynamically, by specializing the traits for your kind of Data:
template <> struct DataTraits<MyDataType> { static std::string_view classIdentifier() { static constexpr std::string_view id{"org.something.mydatatype"}; return id; } static std::string_view dataName() { static constexpr std::string_view name{"MyDataType"}; return name; } static uvec3 colorCode() { return uvec3{55,66,77}; } static Document info(const MyDataType& data) { Document doc; doc.append("p", data.someInfo()); return doc; } };
The default behavior uses the static members "classIdentifier", "dataName", "colorCode" and "getInfo()".
|
inlinestaticconstexpr |
The Class Identifier has to be globally unique. Use a reverse DNS naming scheme. Example: "org.someorg.mydatatype" The default implementation will look for a static std::string / std::string_view member T::classIdentifier. In case it is not found an empty string will be returned. An empty class identifier will be considered an error in various factories.
|
inlinestaticconstexpr |
Should return a color that will be used to identify ports of this data type The default implementation will look for a static uvec3 member T::colorCode. In case it is not found black will be returned.
|
inlinestaticconstexpr |
Should return a user friendly version of the above identifier, "MyDataType" for example. Does not have to be unique, and usually shorter then the class identifier. The default implementation will look for a static std::string / std::string_view member T::dataName. In case it is not found the classIdentifier will be returned.
|
inlinestatic |
Should return a document with information describing the data. The default implementation will look for a static function Document T::getInfo(const T& data). In case it is not found a Document only containing the dataName() will be returned.