Template Class AbstractDataStructure¶
- Defined in File abstract_data_structure.h
Class Documentation¶
-
template <typename DataStructure>
classAbstractDataStructure
¶ -
The AbstractDataStructure serves as base class for all the SHAD ‘global’ data structures. It implements the Create and Destroy methods for the data structures, and allows accessing them on any locality through Global Identifiers, internally managed and maintained.
The inheriting class constructor can accept aribitrary memcpyable arguments (args): the create method of
AbstractDataStructure can be called from the subclass using the same arguments (args) of the constructor. It is recommended to implement the constructor as private/protected.- Warning
- Subclasses SUBC of AbstractDataStructure MUST implement the constructor SUBC(ObjectID oid, Args … args) and the GetGlobalID() method.
- Template Parameters
DataStructure
: DataStructure inheriting from AbstractDataStructure.
Public Types
-
template<>
usingObjectID
= ObjectIdentifier<DataStructure>¶ Global Object Identifier.
SharedPtr to DataStructure.
Public Functions
-
AbstractDataStructure
()¶ Default constructor.
-
virtual ObjectID
GetGlobalID
() const = 0¶ DataStructure identifier getter.
Returns the global object identifier associated to a DataStructure instance.
- Warning
- It must be implemented in the inheriting DataStructure.
Public Static Functions
-
template <typename... Args>
static SharedPtrCreate
(Args... args)¶ Create method.
Creates a global instance of DataStructure, and associates to it a unique global identifier. The Create method can be called within the inheriting class using the arguments args as in the constructor.
- Warning
- The Create method assumes that DataStructure implements a constructor with signature: with arbitrary memcpyable arguments.
DataStructure(ObjectID oid, Args ... args);
- Return
- A shared_ptr to the newly created DataStructure instance.
- Parameters
args
: Arguments to the DataStructure constructor.
-
static void
Destroy
(const ObjectID &oid)¶ Destroy method.
Destroys a global instance of DataStructure, and invalidates its unique global identifier.
- Parameters
oid
: Global object identifier of the DataStructure instance to destroy.
-
static SharedPtr
GetPtr
(ObjectID oid)¶ DataStructure Shared pointer getter.
Returns the shared_ptr of the DataStructure associated to the global identifier oid. Allows accessing a DataStructure instance on any locality.
- Warning
- shared_ptrs are valid ONLY in the locality where it is obtained, via GetPtr or Create methods. In case of remote execution, use oids to retrieve a valid shared_ptr via the GetPtr operation.
- Return
- A shared_ptr to the DataStructure instance associared to oid.
- Parameters
oid
: The global identifier of the DataStructure instance.
Protected Static Functions
-
template <typename... Args>
static voidUpdateCatalogAndConstruct
(const ObjectID &oid, Args&&... args)¶
-
template <typename... Args, std::size_t... is>
static voidCreateFunInnerWrapper
(const std::tuple<Args...> &&tuple, std::index_sequence<is...>)¶
-
template <typename... Args>
static voidCreateFunWrapper
(const std::tuple<Args...> &args)¶