MAK RTIspy API Documentation for HLA 4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
6 - Subclassing DtRtiAmbassadorImplementor

You will probably not want to completely override the way particular RTI services are implemented by DtRtiAmbassadorImplementor.

It is more likely that you will want to allow the default logic to be executed and just alter the way some of the specific tasks are handled. For example, to change the way the RTI communicates, you can subclass DtConnectionMgr. But the basic logic, for example, the fact that a call to updateAttributeValues() causes us to check various exception conditions, and then create and send one or more messages, remains the same.

However, if you want to override RTI service implementations wholesale, so that you can have full control over how the services are implemented, you can. DtRtiAmbassadorImplementor's interface mirrors that of the real RTI::RTIambassador class, except that all of its functions are virtual, and therefore can be overridden in a derived class. If you want to re-implement RTI Ambassador functions, the process is essentially the same as for overriding managers, discussed in Creating Custom RTI Managers.

  1. Create a subclass of DtRtiAmbassadorImplementor and override the functions you choose:

    class MyImplementor : public DtRtiAmbassadorImplementor
    {
    public:
    // Overridden versions of any RTI Ambassador services you choose.
    // ...
    };

  2. Use SetPluginCreators() to tell the RTI to use an instance of your subclass instead of the default implementor:

    // Register your new implementor subclass's creator function with the RTI
    DtRtiAmbassadorImplementor::setCreatorFunction(MyImplementor::create);

Remember that when you override implementations of RTI services, you must keep the RTI's internal state correct and consistent, otherwise other services may fail to work properly.

Note
You do not need to override the implementation of a service to be notified that it has been called. If you just want some code of yours to be executed whenever particular RTI services are invoked, please see Monitoring RTI Service Invocations.

[<< Creating Custom RTI Managers] [Home] [Top of Page] [Communicating with Remote LRCs and the rtiexec >>]


Document ID: Generated on Sun Jul 20 16:15:30 EDT 2025 from SVN revision 277985
Copyright © 2005-2025 MAK Technologies Inc. All Rights Reserved (www.mak.com)