OpenAssetIO [beta]
An abstract API for generalising interactions between a host application and an asset management system
EntityReferencePagerInterface Class Referenceabstract

Deals with the retrieval of paginated data from the backend at the behest of the host. More...

#include <EntityReferencePagerInterface.hpp>

Public Types

using Ptr = EntityReferencePagerInterfacePtr
 
using ConstPtr = EntityReferencePagerInterfaceConstPtr
 
using Page = std::vector< EntityReference >
 

Public Member Functions

 EntityReferencePagerInterface ()=default
 Defaulted default constructor. More...
 
 EntityReferencePagerInterface (const EntityReferencePagerInterface &)=delete
 Deleted copy constructor. More...
 
EntityReferencePagerInterfaceoperator= (const EntityReferencePagerInterface &)=delete
 Deleted copy assignment operator. More...
 
 EntityReferencePagerInterface (EntityReferencePagerInterface &&) noexcept=default
 Defaulted move constructor. More...
 
EntityReferencePagerInterfaceoperator= (EntityReferencePagerInterface &&) noexcept=default
 Defaulted move assignment operator. More...
 
virtual ~EntityReferencePagerInterface ()=default
 Manager should override destructor to be notified when query has finished. More...
 
virtual bool hasNext (const HostSessionPtr &)=0
 Returns whether or not there is more data accessible by advancing the page. More...
 
virtual Page get (const HostSessionPtr &)=0
 Return the current page of data. More...
 
virtual void next (const HostSessionPtr &)=0
 Advance the page. More...
 
virtual void close (const HostSessionPtr &hostSession)
 Close the paging query. More...
 

Detailed Description

Deals with the retrieval of paginated data from the backend at the behest of the host.

The manager is expected to extend this type, and store data necessary to perform the paging operations on the extended object, utilizing caching when possible to reduce redundant queries.

Thread-safety of operations is not expected. Hosts will synchronize calls themselves, if required.

This is a non-copyable object that will be held in a shared_ptr, meaning multiple references may be held, but only to a single instance of the ongoing query, whose destructor will be called when all references are released. As such, the destructor of this class is a good place to place any complex cleanup operations (e.g. closing open connections).

To support as wide array of possible backends as possible, OpenAssetIO places no restraints on the behaviour of this type concerning performance, however, it is considered friendly to document the performance characteristics of your Pager implementation.

Member Typedef Documentation

using Page = std::vector<EntityReference>

Constructor & Destructor Documentation

Defaulted default constructor.

Deleted copy constructor.

Copying of pagers is disallowed, for convenience of implementation.

However, be aware that multiple references to the pager may be held.

Defaulted move constructor.

virtual ~EntityReferencePagerInterface ( )
virtualdefault

Manager should override destructor to be notified when query has finished.

Member Function Documentation

virtual void close ( const HostSessionPtr hostSession)
virtual

Close the paging query.

Signals that the host is finished with the paging query, allowing for any potential cleanup that may need to be performed. This method is guaranteed to be called only once, and no other interface methods will be called by the host thereafter.

This method is called from a destructor. Thrown exceptions will be caught and logged as errors if possible. Despite that, throwing from this function is nonetheless discouraged.

virtual Page get ( const HostSessionPtr )
pure virtual

Return the current page of data.

If the current page has advanced beyond the last page, an empty list should be returned.

Returns
The current page's list of entity references.
virtual bool hasNext ( const HostSessionPtr )
pure virtual

Returns whether or not there is more data accessible by advancing the page.

The mechanism to acquire this information is variable, and left up to the specifics of the backend implementation.

Returns
true if another page is available, false otherwise.
virtual void next ( const HostSessionPtr )
pure virtual

Advance the page.

If currently on the last page of results, calling next should logically advance to the page after the last page, in analogy with std::end. Subsequent calls should then be a no-op. In this state, hasNext should continue to return false and get should return an empty page.

Deleted copy assignment operator.

Copying of pagers is disallowed, for convenience of implementation.

However, be aware that multiple references to the pager may be held.

EntityReferencePagerInterface& operator= ( EntityReferencePagerInterface &&  )
defaultnoexcept

Defaulted move assignment operator.


The documentation for this class was generated from the following file:
  • /src/src/openassetio-core/include/openassetio/managerApi/EntityReferencePagerInterface.hpp