Actions
Support Request #11618
closedReceiving name of current filter instance
Status:
Closed
Priority:
Normal
Customer:
AUDI
Department:
EF
Requester's Priority:
Normal
Support Level:
2nd Level
Resolution:
Solved Issue
Product Issue Numbers:
Affected Products:
Platform:
Other Linux 64bit
Topic:
ADTF::Common
FAQ Links:
Description
Supportanfrage
I was trying to get the instance name of a filter using the recommend way in
https://support.digitalwerk.net/issues/11254
but unfortunately it did not work. The macro is not resolved. And I get the literal string "$(THIS_OBJECT_NAME)".
I tried this in the constructor and in Init() StageGraphReady.
Any suggestion? complete example how this works?
ADTF version is: 3.6.3 (still not the latest)
Lösung
Getting full Session name (path):
tResult cMyFilter::Init(tInitStage eStage)
{
RETURN_IF_FAILED(cFilter::Init(eStage)); // Note: Always call the ::Init from your base class (e.g. cQtUIFilter) at the beginning, this case cFilter
if (eStage == StageGraphReady)
{
auto strNameUsingGlobalFunction = get_named_graph_object_full_name(*this);
LOG_INFO("Instance name: %s", strNameUsingGlobalFunction.GetPtr());
}
RETURN_NOERROR;
}
Receiving a short instance name:
Use INamedGraphObject::GetName(...)
member function of your filter
Alternate way (but public):
RegisterPropertyVariable("name_property", m_strName);
and set "$(THIS_OBJECT_NAME"
for cString property variable m_strName
Related issues
Actions