DataDescription Manual
A DataDescription contains settings that describe the attributes of a data type. While a maxon::DataDescriptionDefinitionInterface contains the "raw" definition the maxon::DataDescriptionInterface includes the complete, resolved description.
The data in a DataDescription is stored as a DataDictionary.
General information ( maxon::DESCRIPTION::DATA::INFO ) is accessed with:
The various attribute descriptions in the description are stored as DataDictionaries:
// data type ID const maxon::Id dataType { "net.maxonexample.class.descriptionElement" };
// load description data maxon::Id category = maxon::DATADESCRIPTION_CATEGORY_DATA ; const maxon::DataDescription descriptionData = maxon::DataDescriptionDatabaseInterface::LoadDescription (category, maxon::LanguageRef(), dataType) iferr_return ;
// load description string data category = maxon::DATADESCRIPTION_CATEGORY_STRING ; const maxon::LanguageRef language = maxon::Resource::GetDefaultLanguage (); const maxon::DataDescription descriptionStrings = maxon::DataDescriptionDatabaseInterface::LoadDescription (category, language, dataType) iferr_return ;
// list all attributes
// get localized attribute name ifnoerr ( const maxon::DataDictionary attributeString = descriptionStrings.GetEntry(ID)) { const maxon::String translatedString = attributeString.Get(maxon::DESCRIPTION::STRING::BASE::TRANSLATEDSTRING) iferr_return ; DiagnosticOutput ( "Name: \"@\" (@)" , translatedString, language.GetName()); } }
It is possible to compare two descriptions with:
The data descriptions are stored in the maxon::DataDescriptionDatabaseInterface database.
// get all registered descriptions const maxon::Id category = maxon::DATADESCRIPTION_CATEGORY_DATA ; const maxon::Id descriptionID { "net.maxonexample.class.descriptionElement" };
// load description const maxon::DataDescription description = maxon::DataDescriptionDatabaseInterface::LoadDescription (category, maxon::LanguageRef(), descriptionID) iferr_return ;
// get number of attributes const maxon::Int count = description.GetEntryCount(); DiagnosticOutput ( "Data type @ has @ attributes." , descriptionID, count);