nx_server_plugin_sdk 1.0 Server Plugin SDK

Public Member Functions | Protected Member Functions | List of all members
nx::sdk::Interface< DerivedInterface, BaseInterface > Class Template Reference

`#include <interface.h>`

Inheritance diagram for nx::sdk::Interface< DerivedInterface, BaseInterface >:

## Public Member Functions
virtual IRefCountable * | queryInterface (const InterfaceId *id)
template<class Interface >
Ptr< Interface > | queryInterface ()
template<class Interface >
Ptr< const Interface > | queryInterface () const

## Protected Member Functions
virtual IRefCountable * | queryInterface (const IRefCountable::InterfaceId *id) override
IRefCountable * | queryInterfaceSupportingDeprecatedId (const IRefCountable::InterfaceId *id, const Uuid &deprecatedInterfaceId)

## Detailed Description

### template<class DerivedInterface, class BaseInterface = IRefCountable>
class nx::sdk::Interface< DerivedInterface, BaseInterface >

Helper class to define interfaces: provides the appropriate queryInterface().

Usage:

class MyInterface: public nx::sdk::Interface<MyInterface, MyBaseInterface>
{
public:
static auto interfaceId() { return makeId("my_namespace::MyInterface"); }
... // pure virtual methods
};

NOTE: For binary compatibility, when an interface needs to be extended with new methods, instead of adding virtual methods to the interface class, define a new descendant class with the new methods, and use the following naming scheme for class names and interface ids:

// Version 0 (the original):
class ISomething("my_namespace::ISomething") { <original-virtual-methods> }
// Version 1 (first evolution step):
class ISomething0("my_namespace::ISomething") { <original-virtual-methods> }
class ISomething("my_namespace::ISomething1") { <step1-added-virtual-methods> }
// Version 2 (second evolution step):
class ISomething0("my_namespace::ISomething") { <original-virtual-methods> }
class ISomething1("my_namespace::ISomething1") { <step1-added-virtual-methods> }
class ISomething("my_namespace::ISomething2") { <step2-added-virtual-methods> }

Such naming scheme implies the following:

- The interface id for the particular VMT never changes, though the C++ class may be renamed.
- If both the interface id and the interface class have a number appended, the numbers coincide.
- The class of the latest interface version always has the original name without a number.

## Member Function Documentation

## ◆ queryInterface()

template<class DerivedInterface, class BaseInterface = IRefCountable>

virtual IRefCountable* nx::sdk::IRefCountable::queryInterface
| inline

VMT #1.

Intended to be called indirectly, via queryInterface<Interface>(), hence `protected`.

Returns
  Object that requires releaseRef() by the caller when it no longer needs it, or null if the requested interface is not implemented.

## ◆ queryInterfaceSupportingDeprecatedId()

template<class DerivedInterface, class BaseInterface = IRefCountable>

IRefCountable* nx::sdk::Interface< DerivedInterface, BaseInterface >::queryInterfaceSupportingDeprecatedId | ( | const IRefCountable::InterfaceId * | id,
|  | const Uuid & | deprecatedInterfaceId
| ) |  |
| inlineprotected

Call from DerivedInterface::queryInterface() to support interface id from the old SDK.

The documentation for this class was generated from the following file:

- src/nx/sdk/interface.h