Detailed Description

Classes used to managed versioned ARA structs by their structSize member.

Classes

struct  ARA::SizedStruct< member >
 Templated C++ wrapper for ARA's variable-sized structs, ensuring their proper initialization. More...
 
class  ARA::SizedStructPtr< StructType >
 Templated smart pointer to conveniently evaluate pointers to ARA variable-sized structures. More...
 
class  ARA::InterfaceInstance< RefType, Interface >
 Templated base class to ease wrapping ARA interface structure callable into C++ classes. More...
 

Macros

#define ARA_STRUCT_MEMBER(StructType, member)   &ARA::StructType::member
 When dealing with ARA variable-sized structures, this eases defining the related C++ template arguments.
 

Class Documentation

◆ ARA::SizedStruct

struct ARA::SizedStruct

template<auto member>
struct ARA::SizedStruct< member >

Templated C++ wrapper for ARA's variable-sized structs, ensuring their proper initialization.

ARA structs are versioned with a structSize member indicating the last implemented member of the struct. Using SizedStruct will automatically set structSize according to the member template parameter. For example, to declare an ARADocumentControllerInterface struct that implements every function up until ARADocumentControllerInterface::storeObjectsToArchive(), you can declare a SizedStruct like so:

SizedStruct<ARA_STRUCT_MEMBER (ARADocumentControllerInterface, storeObjectsToArchive)> dci;
#define ARA_STRUCT_MEMBER(StructType, member)
When dealing with ARA variable-sized structures, this eases defining the related C++ template argumen...
Definition: ARADispatchBase.h:156
Plug-in interface: document controller. The function pointers in this struct must remain valid until ...
Definition: ARAInterface.h:2416

In this example, dci won't support any function declared after ARADocumentControllerInterface::storeObjectsToArchive(), meaning it won't support ARA Analysis Algorithm selection.

◆ ARA::SizedStructPtr

class ARA::SizedStructPtr

template<typename StructType>
class ARA::SizedStructPtr< StructType >

Templated smart pointer to conveniently evaluate pointers to ARA variable-sized structures.

Wrapping an ARA struct pointer using SizedStructPtr allows easy detection of the struct "version", i.e what members it does and does not support. For example, if we wanted to know whether an ARADocumentControllerInterface instance supports ARA Analysis Algorithm Selection, we could use SizedStructPtr like so:

bool supportsAnalysisAlgorithmSelection (ARADocumentControllerInterface* dci)
{
SizedStructPtr<ARADocumentControllerInterface> sizedStructPtr (dci);
return sizedStructPtr.implements<ARA_STRUCT_MEMBER (ARADocumentControllerInterface, getProcessingAlgorithmsCount)> ();
}

Public Member Functions

 SizedStructPtr (const StructType *ptr) noexcept
 Construct from a pointer to StructType.
 
 operator const StructType * () const noexcept
 Dereference the underlying StructType pointer.
 
const StructType * operator-> () const noexcept
 Access the underlying StructType pointer.
 
template<auto member>
bool implements () const noexcept
 Check if StructType is sized large enough to implement member. ARA uses the StructType::structSize member as a means of versioning - if it is large enough to contain member then this function returns true. This is a C++ version of ARA_IMPLEMENTS_FIELD.
 

◆ ARA::InterfaceInstance

class ARA::InterfaceInstance

template<typename RefType, typename Interface>
class ARA::InterfaceInstance< RefType, Interface >

Templated base class to ease wrapping ARA interface structure callable into C++ classes.

Public Member Functions

RefType getRef () const noexcept
 Retrieve the ARA reference associated with Interface.
 
const SizedStructPtr< Interface > & getInterface () const noexcept
 Retrieve the underlying Interface pointer.
 
bool isProvided () const noexcept
 Returns whether or not an implementation of the interface was provided.
 

Protected Types

using BaseType = InterfaceInstance
 InterfaceInstance alias, to allow derived classes to easily reference their templated base class.
 

Protected Member Functions

 InterfaceInstance (RefType ref, const Interface *ifc) noexcept
 Constructor for derived classes to wrap a ref and interface pointer. The derived classes typically read these values from an instance struct which is passed to their public c'tor.