SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
smtk::resource::DerivedFrom< Self, Parent > Class Template Reference

Derived resources are subclassed from smtk::resource::Resource. More...

#include <DerivedFrom.h>

Inheritance diagram for smtk::resource::DerivedFrom< Self, Parent >:
[legend]
Collaboration diagram for smtk::resource::DerivedFrom< Self, Parent >:
[legend]

Public Types

using ParentResource = Parent
 
using Superclass = Parent
 
using DirectSuperclass = DerivedFrom< Self, Parent >
 

Public Member Functions

bool isOfType (const Resource::Index &index) const override
 given a resource index, return whether or not this resource is or is derived from the resource described by the index.
 
bool isOfType (const std::string &typeName) const override
 given a resource's unique name, return whether or not this resource is or is derived from the resource described by the name.
 
int numberOfGenerationsFromBase (const std::string &typeName) const override
 
 DerivedFrom (const DerivedFrom &)=delete
 

Static Public Attributes

static const Resource::Index type_index
 A static index for this resource type. More...
 

Protected Member Functions

template<typename... T>
 DerivedFrom (T &&... all)
 Forward all constructor arguments to the parent class.
 
 DerivedFrom (DerivedFrom &&rhs) noexcept=default
 

Detailed Description

template<typename Self, typename Parent>
class smtk::resource::DerivedFrom< Self, Parent >

Derived resources are subclassed from smtk::resource::Resource.

Queries concerning the relationship between a derived resource and its parent resources are made using the methods smtk::resource::Resource::isOfType(). To ensure that these methods reflect the proper inheritance of a Resource, derived resources do not directly derive from smtk::resource::Resource; instead, they derive from smtk::resource::DerivedFrom<Self, Parent>, where Self is the class being defined and Parent is either smtk::resource::Resource or one of its derived classes.

Member Data Documentation

◆ type_index

template<typename Self , typename Parent >
const Resource::Index smtk::resource::DerivedFrom< Self, Parent >::type_index
static
Initial value:
=
std::type_index(typeid(Self)).hash_code()

A static index for this resource type.

NOTE: because we are using CRTP, it is possible to make this value static and redefined for each resource type, regardless of inheritance.


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