SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
11 #ifndef smtk_project_Project_h
12 #define smtk_project_Project_h
14 #include "smtk/CoreExports.h"
17 #include "smtk/resource/DerivedFrom.h"
19 #include "smtk/task/Manager.h"
21 #include "smtk/project/OperationFactory.h"
22 #include "smtk/project/ResourceContainer.h"
24 #include <boost/type_index.hpp>
35 template<
typename Self,
typename Parent>
52 static constexpr
const char*
const type_name =
"smtk::project::Project";
53 std::string
typeName()
const override {
return (m_typeName.empty() ? type_name : m_typeName); }
55 std::vector<smtk::string::Token> classHierarchy()
const override
57 static std::vector<smtk::string::Token> baseTypes;
58 if (baseTypes.empty())
60 smtk::common::typeHierarchy<smtk::project::Project>(baseTypes);
62 std::vector<smtk::string::Token> result;
63 result.emplace_back(this->
typeName());
64 result.insert(result.end(), baseTypes.begin(), baseTypes.end());
69 static std::unordered_set<smtk::string::Token> baseTypes;
70 if (baseTypes.empty())
72 smtk::common::typeHierarchy<smtk::project::Project>(baseTypes);
74 return candidate == this->typeToken() || baseTypes.find(candidate) != baseTypes.end();
77 static std::shared_ptr<smtk::project::Project> create(
const std::string&
typeName =
"");
87 m_typeName.empty() ? std::type_index(
typeid(*
this)).hash_code()
88 : std::hash<std::string>{}(m_typeName));
100 const std::string&
version()
const {
return m_version; }
101 void setVersion(
const std::string& version) { m_version = version; }
105 const std::string& query)
const override;
108 void visit(smtk::resource::Component::Visitor&)
const override;
119 bool clean()
const override;
122 Project(
const std::string&
typeName =
"");
125 ResourceContainer m_resources;
126 OperationFactory m_operations;
127 std::string m_typeName;
128 std::string m_version;
130 std::shared_ptr<smtk::task::Manager> m_taskManager;
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
A Project represents an encapsulation of a subset of SMTK's Resources and Operations for the purpose ...
Definition: Project.h:43
#define smtkTypedefs(...)
Used by smtkTypeMacro()
Definition: SharedFromThis.h:24
A task manager is responsible for creating new tasks.
Definition: Manager.h:68
const ResourceContainer & resources() const
Access the Project's Resources.
Definition: Project.h:92
A Manager for projects.
Definition: Manager.h:42
const OperationFactory & operations() const
Access the Project's Operations.
Definition: Project.h:96
#define smtkSharedFromThisMacro(...)
A macro to help with derived classes whose bases enable shared_from_this().
Definition: SharedFromThis.h:250
An OperationFactory is a factory for a Project's Operations.
Definition: OperationFactory.h:28
smtk::common::Singleton< detail::Manager > Manager
The Manager is a singleton interface for registering available plugins to manager instances.
Definition: Manager.h:92
std::string typeName()
Return the name of a class.
Definition: TypeName.h:289
const std::string & version() const
Access the Project's version string.
Definition: Project.h:100
A string token identified by an integer.
Definition: Token.h:29
std::size_t Index
A hash value uniquely representing the project type.
Definition: Project.h:80
const smtk::task::Manager & taskManager() const
Return this project's task manager.
Definition: Project.h:116
Component is the base class for records stored in an smtk::resource::Resource.
Definition: Component.h:43
Index index() const override
Index is a compile-time intrinsic of the derived resource's type; as such, it cannot be set.
Definition: Project.h:84
A ResourceContainer is a container for a Project's Resources.
Definition: ResourceContainer.h:37
An abstract base class for SMTK resources and their components.
Definition: PersistentObject.h:39
smtk::shared_ptr< smtk::resource::Component > ComponentPtr
Definition: PublicPointerDefs.h:304