rtiddsgen2 customization for C++

2 posts / 0 new
Last post
Offline
Last seen: 8 years 1 month ago
Joined: 02/26/2013
Posts: 9
rtiddsgen2 customization for C++

Hello,

I have in one IDL file several structures and also the following structure

struct QuantityZ
{
    double  qty;
    double  Z;
};


Is it possible to customize the rtiddsgen2 via templates so that just for this structure to somehow "insert" in the generated header file
the following equality operator :

  bool operator == (const QuantityZ &a) const
    {
        return qty==a.qty && Z == a.Z;
    }

Many thanks,
Daniel

Organization:
Offline
Last seen: 5 years 10 months ago
Joined: 01/17/2013
Posts: 23

Hi David,

It will be easy to customize that in the templates of rtiddsgen2. You just need to include an if checking if the name of the structure is the one you want, adding something like this in the header template (c/typeHeader) :

#if($node.nativeFQNameInModule.equals("QuantityZ"))
bool operator == (const QuantityZ &a) const
{
return qty==a.qty && Z == a.Z;
}
#end

You could add it for example at the end of the file just after the call to the macro #declareTypeFunctions($node)

Regards,

Aída