SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
smtk::task::Worklet Class Reference

Worklet represents a set of tasks created to reuse a set of workflow logic in multiple workflows. More...

#include <Worklet.h>

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

Public Types

using Configuration = nlohmann::json
 Worklets are configured with arbitrary JSON objects, though this may change.
 
- Public Types inherited from smtk::resource::Component
typedef std::function< void(const ComponentPtr &)> Visitor
 
typedef detail::ComponentLinks Links
 
typedef detail::ComponentProperties Properties
 

Public Member Functions

 smtkTypeMacro (smtk::task::Worklet)
 
 smtkSuperclassMacro (smtk::resource::Component)
 
 smtkCreateMacro (smtk::task::Worklet)
 
 Worklet (const Configuration &config, Manager &taskManager, const std::shared_ptr< smtk::common::Managers > &managers=nullptr)
 
void configure (const Configuration &config, Manager &taskManager)
 A method called by all constructors passed Configuration information. More...
 
const Configurationconfiguration () const
 Return the worklet's configuration.
 
const common::UUIDid () const override
 Set/get the worklet's unique identifier.
 
bool setId (const common::UUID &newId) override
 Assign an ID to this object (used by readers; not for arbitrary reuse). More...
 
std::string name () const override
 Return the worklet's name.
 
const std::shared_ptr< resource::Resourceresource () const override
 Return the resource that owns the worklet.
 
const std::string & schema () const
 Return the schema used by the worklet.
 
int version () const
 Return the version of the worklet.
 
const std::string & operationName () const
 Return the operation name to be used to instantiate the worklet If none is specified in the worklet's configuration, then smtk::task::EmplaceWorklet will be used.
 
const std::string & description () const
 Return the description of the worklet.
 
std::shared_ptr< Managermanager () const
 Return the Task Manager managing the worklet.
 
void setCategories (const std::set< std::string > &cats)
 Set/Get the categories associated with this worklet. More...
 
const std::set< std::string > & categories () const
 Set/Get the categories associated with this worklet. More...
 
- Public Member Functions inherited from smtk::resource::Component
 smtkTypeMacro (smtk::resource::Component)
 
 smtkSuperclassMacro (smtk::resource::PersistentObject)
 
 smtkSharedFromThisMacro (smtk::resource::PersistentObject)
 
ResourceparentResource () const override
 Return a raw (not shared) pointer to the resource that owns this component. More...
 
template<typename ResourceType >
ResourceType * parentResourceAs () const
 This variant of parentResource casts the result to the given ResourceType.
 
Linkslinks () override
 Return the links that connect this component to external resources/components.
 
const Linkslinks () const override
 
Propertiesproperties () override
 Return properties defined on this component.
 
const Propertiesproperties () const override
 
- Public Member Functions inherited from smtk::resource::PersistentObject
 smtkTypeMacroBase (smtk::resource::PersistentObject)
 
template<typename T >
T::Ptr as ()
 Attempt to cast this object to a subclass.
 
template<typename T >
T::ConstPtr as () const
 Attempt to cast this object to a subclass.
 

Protected Member Functions

void setName (const std::string &newName)
 Sets the name of the Worklet - to be used via the smtk::task::Gallery.
 

Protected Attributes

std::string m_name
 Worklet's name to present to the user.
 
smtk::common::UUID m_id
 Worklet's UUID.
 
std::string m_schema
 Worklet's schema.
 
int m_version = 0
 Worklet's version.
 
std::string m_operationName
 Worklet's operation name.
 
std::string m_description
 Worklet's description string.
 
std::weak_ptr< smtk::task::Managerm_manager
 If this worklet is being managed, this will refer to its manager.
 
Configuration m_configuration
 The JSON configuration of the worklet.
 
std::set< std::string > m_categories
 Categories associated with the worklet.
 

Friends

class Gallery
 

Detailed Description

Worklet represents a set of tasks created to reuse a set of workflow logic in multiple workflows.

Member Function Documentation

◆ categories()

const std::set<std::string>& smtk::task::Worklet::categories ( ) const
inline

Set/Get the categories associated with this worklet.

These categories are used by category expressions associated with a task's agents to see if the tasks generated from the worklet would be appropriate children tasks, or with the task manager to see if the generated tasks would be appropriate top-level tasks.

◆ configure()

void smtk::task::Worklet::configure ( const Configuration config,
Manager taskManager 
)

A method called by all constructors passed Configuration information.

Calling this outside of the constructor will reconfigure the worklet

◆ setCategories()

void smtk::task::Worklet::setCategories ( const std::set< std::string > &  cats)

Set/Get the categories associated with this worklet.

These categories are used by category expressions associated with a task's agents to see if the tasks generated from the worklet would be appropriate children tasks, or with the task manager to see if the generated tasks would be appropriate top-level tasks.

◆ setId()

bool smtk::task::Worklet::setId ( const common::UUID myID)
overridevirtual

Assign an ID to this object (used by readers; not for arbitrary reuse).

TODO: care must be taken to modify the recorded ID in all links that connect to this object (see Resource::setId and its treatment of manager registration for reference).

Implements smtk::resource::PersistentObject.


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