Inviwo
0.9.10.1
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 std::string | classIdentifier () |
static std::string | dataName () |
static 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 classIdentifier() { return "org.something.mydatatype"; } static std::string dataName() { return "MyDataType"; } 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()".
|
inlinestatic |
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 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.
|
inlinestatic |
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.
|
inlinestatic |
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 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.