SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Types | Public Member Functions | Static Public Member Functions | List of all members
smtk::task::Manager Class Reference

A task manager is responsible for creating new tasks. More...

#include <Manager.h>

Inheritance diagram for smtk::task::Manager:
[legend]
Collaboration diagram for smtk::task::Manager:
[legend]

Public Types

using ResourceObjectMap = std::map< smtk::resource::Resource *, std::unordered_set< smtk::resource::PersistentObject * > >
 A map of objects grouped by their parent resource. More...
 
using TaskInstances = smtk::task::Instances
 Managed instances of Task objects (and a registry of Task classes).
 
using AdaptorInstances = smtk::task::adaptor::Instances
 Managed instances of Adaptor objects (and a registry of Adaptor classes).
 
using PortInstances = smtk::task::PortInstances
 Managed instances of Port objects (and a registry od Port subclasses).
 
using AgentFactory = smtk::common::Factory< smtk::task::Agent, Task * >
 The signatures the agent factory uses to construct agents.
 

Public Member Functions

 smtkTypeMacroBase (smtk::task::Manager)
 
 smtkCreateMacro (smtk::task::Manager)
 
 Manager (smtk::resource::Resource *parent)
 
 Manager (const Manager &)=delete
 
void operator= (const Manager &)=delete
 
TaskInstancestaskInstances ()
 Return the set of managed task instances. More...
 
const TaskInstancestaskInstances () const
 
Activeactive ()
 Return a tracker for the active task.
 
const Activeactive () const
 
AdaptorInstancesadaptorInstances ()
 Return the set of managed adaptor instances. More...
 
const AdaptorInstancesadaptorInstances () const
 
PortInstancesportInstances ()
 Return the set of managed task-port instances. More...
 
const PortInstancesportInstances () const
 
const AgentFactoryagentFactory () const
 Return a factory to create agents for tasks.
 
AgentFactoryagentFactory ()
 
smtk::common::Managers::Ptr managers () const
 Return the managers instance that contains this manager, if it exists.
 
void setManagers (const smtk::common::Managers::Ptr &managers)
 
nlohmann::json getStyle (const smtk::string::Token &styleClass) const
 Given a style key, return a style config.
 
nlohmann::json getStyles () const
 
void setStyles (const nlohmann::json &styles)
 Overwrite this task-manager's styles with the provided styles.
 
void addStyles (const nlohmann::json &styles, std::unordered_map< smtk::string::Token, smtk::string::Token > &styleMap)
 Append styles into this task manager. More...
 
smtk::resource::Resourceresource () const
 If this manager is owned by a resource (typically a project), return it.
 
ResourceObjectMap workflowObjects (const nlohmann::json &spec, Task *task=nullptr)
 Given a filter spec, return a set of objects grouped by their parent resources. More...
 
ResourceObjectMap workflowObjects (const smtk::view::Configuration::Component &spec, Task *task=nullptr)
 
bool isResourceRelevant (const std::shared_ptr< smtk::resource::Resource > &resource, const nlohmann::json &spec)
 Return true if the resource matches the filter spec provided.
 
bool isResourceRelevant (smtk::resource::Resource *resource, const nlohmann::json &spec)
 
bool isResourceRelevant (const std::shared_ptr< smtk::resource::Resource > &resource, const smtk::view::Configuration::Component &spec)
 
bool isResourceRelevant (smtk::resource::Resource *resource, const smtk::view::Configuration::Component &spec)
 
Gallerygallery ()
 Return a gallery of Task Worklets.
 
const Gallerygallery () const
 
smtk::common::Categories::ExpressiontoplevelExpression ()
 Return the category expression constraint for placing worklets at the top-level of the workflow.
 
const smtk::common::Categories::ExpressiontoplevelExpression () const
 
TaskManagerTaskObserverstaskObservers ()
 Return the set of observers of task events (so you can insert/remove an observer).
 
TaskManagerAdaptorObserversadaptorObservers ()
 Return the set of observers of adaptor events (so you can insert/remove an observer).
 
TaskManagerWorkflowObserversworkflowObservers ()
 Return the set of observers of workflow events (so you can insert/remove an observer).
 
bool changePortId (Port *port, std::function< bool()> fp)
 Change the ID of a Port. More...
 
bool changePortName (Port *port, const std::string &newName, std::function< bool()> fp)
 Change the Name of a Port. More...
 

Static Public Member Functions

static constexpr smtk::operation::Observers::Priority operationObserverPriority ()
 Use an elevated priority for the task-manager's observation of operations. More...
 

Detailed Description

A task manager is responsible for creating new tasks.

Eventually, the task manager will also hold an inventory of created tasks and be a clearinghouse for task state transitions.

Member Typedef Documentation

◆ ResourceObjectMap

A map of objects grouped by their parent resource.

If a resource itself is intended for selection, one entry of its target set of objects will be the null pointer.

Member Function Documentation

◆ adaptorInstances()

AdaptorInstances& smtk::task::Manager::adaptorInstances ( )
inline

Return the set of managed adaptor instances.

This class also acts as a registrar for Adaptor subclasses.

◆ addStyles()

void smtk::task::Manager::addStyles ( const nlohmann::json &  styles,
std::unordered_map< smtk::string::Token, smtk::string::Token > &  styleMap 
)

Append styles into this task manager.

In the event of a name collision (where the content for styles of the same name is different), the name is made unique and an entry is added to the styleMap from the original name to the uniquified name.

◆ changePortId()

bool smtk::task::Manager::changePortId ( Port port,
std::function< bool()>  fp 
)

Change the ID of a Port.

This method is used to update internal data structures. Please use task::Port::setId to change the name of the Port - it will call this method with an appropriate lambda.

◆ changePortName()

bool smtk::task::Manager::changePortName ( Port port,
const std::string &  newName,
std::function< bool()>  fp 
)

Change the Name of a Port.

This method is used to update internal data structures. Please use task::Port::setName to change the name of the Port - it will call this method with an appropriate lambda.

◆ operationObserverPriority()

static constexpr smtk::operation::Observers::Priority smtk::task::Manager::operationObserverPriority ( )
inlinestaticconstexpr

Use an elevated priority for the task-manager's observation of operations.

This is done so that task-related events are emitted before other ordinary-priority operation observations (especially hint-processing).

◆ portInstances()

PortInstances& smtk::task::Manager::portInstances ( )
inline

Return the set of managed task-port instances.

This class also acts as a registrar for Port subclasses.

◆ taskInstances()

TaskInstances& smtk::task::Manager::taskInstances ( )
inline

Return the set of managed task instances.

This class also acts as a registrar for Task subclasses.

◆ workflowObjects()

Manager::ResourceObjectMap smtk::task::Manager::workflowObjects ( const nlohmann::json &  spec,
Task task = nullptr 
)

Given a filter spec, return a set of objects grouped by their parent resources.

The objects are drawn – according to the spec – from either ports of the active task or resources owned by the parent of this task manager (assuming it is a project). If a resource itself is intended to be part of the result, one of the object pointers in that resource's target set will be the null pointer.

The variant that accepts a JSON spec is for use inside task-manager style. The variant that accepts a Configuration::Component spec is for use inside view-configuration XML. The two forms of spec are similar but not identical in order to improve readability and reduce maintenance overhead.


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