About
maxon::DataDescriptionObjectInterface is an interface that can be used as a base for custom interfaces. It allows to add data descriptions to the reference object.
Interface
The maxon::DataDescriptionObjectInterface defines the maxon::DataDescriptionObjectInterface::GetObjectDescription() function. This function can be used to access the description from the given object. The needed argument can be constructed with maxon::CreateDataDictionaryReferenceObject().
const DescriptionElementRef element = DescriptionElementClass().Create()
iferr_return;
element.SetAttributeCount(2);
maxon::DataDescription description;
maxon::DataDictionary settings;
description = element.GetObjectDescription(category, language, dataRef)
iferr_return;
const auto attributes = description.GetEntries()
iferr_return;
for (const auto& attribute : attributes)
{
DiagnosticOutput(
"Attribute \"@\", of type @. Default value: @", ID, dataType, defaultData);
}
Another function is maxon::DataDescriptionObjectInterface::GetObjectName(), which returns the name of the objects (maxon::OBJECT::BASE::NAME) for the given language.
Implementation
A custom interface can be based on maxon::DataDescriptionObjectInterface. The resulting reference object will store a data description. The default implementation of maxon::DataDescriptionObjectInterface is maxon::DataDescriptionObjectClass.
A custom implementation can re-implement maxon::DataDescriptionObjectInterface::GetObjectDescription() to modify the returned description.
class DescriptionElementImpl :
public maxon::Component<DescriptionElementImpl, DescriptionElementInterface>
{
public:
{
_count = count;
}
{
maxon::DataDescription description = super.GetObjectDescription(category, language, objectData)
iferr_return;
{
{
const maxon::String identifier(
"net.maxonexample.class.descriptionElement.dynamic_"_s + number);
const maxon::Id stringDataType = maxon::GetDataType<maxon::String>()->GetId();
maxon::DataDictionary dynamicAttribute;
dynamicAttribute.Set(maxon::DESCRIPTION::BASE::IDENTIFIER, dynamicID)
iferr_return;
dynamicAttribute.Set(maxon::DESCRIPTION::DATA::BASE::DATATYPE, stringDataType)
iferr_return;
}
}
return description;
}
private:
};
Further Reading