SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
11 #ifndef smtk_resource_DerivedFrom_h
12 #define smtk_resource_DerivedFrom_h
16 #include "smtk/resource/Resource.h"
31 template<
typename Self,
typename Parent>
35 using ParentResource = Parent;
36 using Superclass = Parent;
49 bool isOfType(
const Resource::Index& index)
const override
58 return smtk::common::typeName<Self>() ==
typeName ? true : ParentResource::isOfType(
typeName);
61 int numberOfGenerationsFromBase(
const std::string&
typeName)
const override
64 smtk::common::typeName<Self>() ==
typeName
66 : 1 + ParentResource::numberOfGenerationsFromBase(
typeName));
69 DerivedFrom(
const DerivedFrom&) =
delete;
73 template<
typename... T>
75 : Parent(std::forward<T>(all)...)
83 template<
typename Self,
typename Parent>
85 std::type_index(
typeid(Self)).hash_code();
89 #endif // smtk_resource_DerivedFrom_h
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
Derived resources are subclassed from smtk::resource::Resource.
Definition: DerivedFrom.h:32
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 resourc...
Definition: DerivedFrom.h:56
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 descri...
Definition: DerivedFrom.h:49
DerivedFrom(T &&... all)
Forward all constructor arguments to the parent class.
Definition: DerivedFrom.h:74
static const Resource::Index type_index
A static index for this resource type.
Definition: DerivedFrom.h:45
std::string typeName()
Return the name of a class.
Definition: TypeName.h:289