nx_cloud_storage_sdk  1.0
Cloud Storage 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 IRefCountablequeryInterface (const InterfaceId *id)
 
template<class Interface >
Ptr< InterfacequeryInterface ()
 
template<class Interface >
Ptr< const InterfacequeryInterface () const
 

Protected Member Functions

virtual IRefCountablequeryInterface (const IRefCountable::InterfaceId *id) override
 
IRefCountablequeryInterfaceSupportingDeprecatedId (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:

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: