SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
10 #ifndef smtk_task_GatherResources_h
11 #define smtk_task_GatherResources_h
13 #include "smtk/resource/Manager.h"
14 #include "smtk/resource/Observer.h"
15 #include "smtk/resource/Resource.h"
16 #include "smtk/task/Task.h"
41 using Entry = std::weak_ptr<smtk::resource::Resource>;
67 const smtk::common::Managers::Ptr& managers =
nullptr);
71 const smtk::common::Managers::Ptr& managers =
nullptr);
89 bool addResourceInRole(
90 const std::shared_ptr<smtk::resource::Resource>& resource,
91 const std::string& role);
100 State computeInternalState()
const;
102 bool m_autoconfigure =
false;
103 smtk::common::Managers::Ptr m_managers;
104 smtk::resource::Observers::Key m_observer;
105 std::map<std::string, ResourceSet> m_resourcesByRole;
110 #endif // smtk_task_GatherResources_h
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
std::string m_type
The resource typename regex; typically just a resource typename.
Definition: GatherResources.h:55
unsigned int m_minimumCount
The minimum number of resources that must be collected to satisfy the requirement.
Definition: GatherResources.h:47
GatherResources is a task that requires resources from a resource manager.
Definition: GatherResources.h:31
nlohmann::json Configuration
Tasks are configured with arbitrary JSON objects, though this may change.
Definition: Task.h:84
std::function< smtk::common::Visit(const ResourceSet &)> ResourceSetVisitor
Signature of functors that visit resources-by-role predicates.
Definition: GatherResources.h:62
A predicate used to collect resources that fit a given role.
Definition: GatherResources.h:39
std::set< Ptr > PassedDependencies
A task's dependencies are other tasks passed as shared pointers.
Definition: Task.h:82
std::function< bool(const smtk::resource::Resource &, const ResourceSet &)> m_validator
A lambda used to determine whether the given resource is acceptable.
Definition: GatherResources.h:57
State
The set of states that a task may take on.
Definition: State.h:29
EventType
Enumerate events that the resource manager may encounter.
Definition: Observer.h:32
#define smtkCreateMacro(...)
Add static create() methods to a class.
Definition: SharedFromThis.h:113
Visit
Return values common to most visitor methods.
Definition: Visit.h:23
int m_maximumCount
The maximum number of resources that can be collected while still satisfying the requirement.
Definition: GatherResources.h:53
std::set< Entry, std::owner_less< Entry > > m_resources
The set of resources being managed that are selected by the validator.
Definition: GatherResources.h:59
#define smtkTypeMacro(...)
Add typedefs to a class for identifcation.
Definition: SharedFromThis.h:51
#define smtkSuperclassMacro(...)
Add a typedef to the superclass of this class.
Definition: SharedFromThis.h:87
An abstract base class for SMTK resources.
Definition: Resource.h:59
Task is a base class for all SMTK tasks.
Definition: Task.h:69
std::string m_role
The required role. If empty, any role is allowed.
Definition: GatherResources.h:43