The ability for the user to modify the user tag sent with object updates and interactions was added to VR-Link 3.12.
This is achieved by providing two base classes: DtObjectTagModifier and DtInteractionTagModifier. These classes can be subclassed, with the modifyTag() method implemented, and registered with the exercise connection. modifyTag() will be called for each update/interaction sent for each object/interaction class that it is registered for.
A typical usage of the user tag modifier may look like this:
#if DtHLA
class DtMyObjectTagModifier : public DtObjectTagModifier
{
public:
DtObjectTagModifier(),
myExConn(exConn) {}
virtual ~DtMyObjectTagModifier() {}
{
DtString execName = myExConn->execName();
#if DtHLA_1516
RTI::VariableLengthData newTag;
newTag.setData(execName.
c_str(), execName.
length() + 1);
msg->setCustomTag(newTag);
#else
msg->setCustomTag(execName);
#endif
}
protected:
};
class DtMyInteractionTagModifier : public DtInteractionTagModifier
{
public:
DtInteractionTagModifier(),
myExConn(exConn) {}
virtual ~DtMyInteractionTagModifier() {}
{
#if DtHLA_1516
RTI::VariableLengthData newTag;
inter->setCustomTag(newTag);
#else
inter->setCustomTag(fedType);
#endif
}
protected:
};
{
DtObjectTagModifierSP objectTagModifier(new DtMyObjectTagModifier(exConn));
DtInteractionTagModifierSP interTagModifier(new DtMyInteractionTagModifier(exConn));
exConn->setObjectTagModifier("ObjectRoot", objectTagModifier);
exConn->setInteractionTagModifier("InteractionRoot", interTagModifier);
}
#endif