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 typedef Parent ParentResource;
45 bool isOfType(
const Resource::Index& index)
const override
54 return smtk::common::typeName<Self>() ==
typeName ? true : ParentResource::isOfType(
typeName);
57 int numberOfGenerationsFromBase(
const std::string&
typeName)
const override
60 smtk::common::typeName<Self>() ==
typeName
62 : 1 + ParentResource::numberOfGenerationsFromBase(
typeName));
65 DerivedFrom(
const DerivedFrom&) =
delete;
69 template<
typename... T>
71 : Parent(std::forward<T>(all)...)
79 template<
typename Self,
typename Parent>
81 std::type_index(
typeid(Self)).hash_code();
85 #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:52
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:45
DerivedFrom(T &&... all)
Forward all constructor arguments to the parent class.
Definition: DerivedFrom.h:70
static const Resource::Index type_index
A static index for this resource type.
Definition: DerivedFrom.h:41
std::string typeName()
Return the name of a class.
Definition: TypeName.h:286