SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
SubmitOperation helps users prepare and optionally run an operation. More...
#include <SubmitOperation.h>
Classes | |
struct | ParameterSpec |
Per-parameter configuration of item values. More... | |
Public Types | |
enum | RunStyle { Iteratively, Once, OnCompletion } |
Specify how users interact with the operation. More... | |
enum | ConfiguredBy { ConfiguredBy::Task, ConfiguredBy::Adaptor, ConfiguredBy::User } |
Specify what is allowed to configure an operation parameter. More... | |
enum | ItemVisibility { ItemVisibility::Off, ItemVisibility::RecursiveOff, ItemVisibility::On } |
Specify whether an item and its children should be visible to users. More... | |
using | ParameterSpecVisitor = std::function< smtk::common::Visit(ParameterSpec &)> |
Signatures of functors that visit resources-by-role predicates. | |
using | ConstParameterSpecVisitor = std::function< smtk::common::Visit(const ParameterSpec &)> |
Public Types inherited from smtk::task::Task | |
enum | RelatedTasks { RelatedTasks::Depend, RelatedTasks::Child } |
The types of related tasks to visit. More... | |
using | Observer = std::function< void(Task &, State, State)> |
A task's state changes may be observed. | |
using | Observers = smtk::common::Observers< Observer > |
The collection of all observers of this task instance. | |
using | Dependencies = std::map< WeakPtr, typename Observers::Key, std::owner_less< WeakPtr > > |
A task's dependencies are other tasks stored as weak pointers. | |
using | PassedDependencies = std::set< Ptr > |
A task's dependencies are other tasks passed as shared pointers. | |
using | Configuration = nlohmann::json |
Tasks are configured with arbitrary JSON objects, though this may change. | |
using | Visitor = std::function< smtk::common::Visit(Task &)> |
Signature of functions invoked when visiting dependencies or children while allowing early termination. | |
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::SubmitOperation) | |
smtkSuperclassMacro (smtk::task::Task) | |
smtkCreateMacro (smtk::task::Task) | |
SubmitOperation (const Configuration &config, Manager &taskManager, const smtk::common::Managers::Ptr &managers=nullptr) | |
SubmitOperation (const Configuration &config, const PassedDependencies &dependencies, Manager &taskManager, const smtk::common::Managers::Ptr &managers=nullptr) | |
void | configure (const Configuration &config) |
Parse configuration information to initialize this instance. | |
bool | markCompleted (bool completed) override |
We override this method in order to launch the operation when the task's RunStyle is OnCompletion. | |
smtk::operation::Operation * | operation () const |
Return the operation this task requires users to configure and submit. | |
RunStyle | runStyle () const |
Return the manner in which this task expects users to submit the operation. | |
smtk::common::Visit | visitParameterSpecs (ConstParameterSpecVisitor visitor) const |
Visit the specification for each item this task potentially configures. | |
smtk::common::Visit | visitParameterSpecs (ParameterSpecVisitor visitor) |
ParameterSpec & | associationSpec () |
Return the specification for the associations of the operation this task configures. More... | |
ParameterSpec | associationSpec () const |
void | configureHiddenItems (smtk::view::ConfigurationPtr view, const nlohmann::json &jItemArray) const |
Modify view to hide items specified in task's style. | |
bool | runSinceEdited () const |
True if the operation has successfully run since its parameters were last edited. | |
bool | setNeedsToRun () |
Force the task into an incomplete state because its input parameters have changed. More... | |
bool | editableCompletion () const override |
Return whether or not users are allowed to mark a task completed. More... | |
Public Member Functions inherited from smtk::task::Task | |
smtkTypeMacro (smtk::task::Task) | |
smtkSuperclassMacro (smtk::resource::Component) | |
smtkCreateMacro (smtk::task::Task) | |
Task (const Configuration &config, Manager &taskManager, const std::shared_ptr< smtk::common::Managers > &managers=nullptr) | |
Task (const Configuration &config, const PassedDependencies &dependencies, Manager &taskManager, const std::shared_ptr< smtk::common::Managers > &managers=nullptr) | |
const common::UUID & | id () const override |
Set/get the task'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 task's name. | |
virtual void | setName (const std::string &name) |
const std::shared_ptr< resource::Resource > | resource () const override |
Components are required to return their owning resource (if any). More... | |
void | configure (const Configuration &config) |
A method called by all constructors passed Configuration information. More... | |
const std::string & | title () const |
Return the title of the task (if one was provided). | |
void | setTitle (const std::string &title) |
Set the title of the task to be presented to users. More... | |
const std::set< smtk::string::Token > & | style () const |
Set/get style classes for the task. More... | |
bool | addStyle (const smtk::string::Token &styleClass) |
bool | removeStyle (const smtk::string::Token &styleClass) |
bool | clearStyle () |
virtual bool | getViewData (smtk::common::TypeContainer &configuration) const |
Populate a type-container with view-related data for configuration. More... | |
virtual State | state () const |
Get the state. More... | |
bool | areDependenciesStrict () const |
Return true if this task has been configured with strict dependency enforcement. More... | |
PassedDependencies | dependencies () const |
Return the tasks which this task depends upon. More... | |
bool | canAddDependency (const std::shared_ptr< Task > &dependency) |
Check whether inserting a dependency would induce a cycle. More... | |
bool | addDependency (const std::shared_ptr< Task > &dependency) |
Add a dependency. More... | |
template<typename Container > | |
bool | addDependencies (const Container &tasks) |
Add a container of task-pointers as dependencies. More... | |
bool | removeDependency (const std::shared_ptr< Task > &dependency) |
Remove a dependency. More... | |
template<typename Container > | |
bool | removeDependencies (const Container &tasks) |
Remove a container of task-pointers as dependencies. More... | |
Task * | parent () const |
Return a parent task if one exists; null otherwise. | |
virtual bool | hasChildren () const |
Return whether or not the task has children. More... | |
virtual smtk::common::Visit | visit (RelatedTasks relation, Visitor visitor) const |
Visit children. More... | |
Observers & | observers () |
Return this object's observers so other classes may insert themselves. | |
State | internalState () const |
Return the internal state of the task. More... | |
Manager * | manager () const |
Return the tasks's manager (or null if unmanaged). | |
Public Member Functions inherited from smtk::resource::Component | |
smtkTypeMacro (smtk::resource::Component) | |
smtkSuperclassMacro (smtk::resource::PersistentObject) | |
smtkSharedFromThisMacro (smtk::resource::PersistentObject) | |
virtual Resource * | parentResource () const |
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. | |
Links & | links () override |
Return the links that connect this component to external resources/components. | |
const Links & | links () const override |
Properties & | properties () override |
Return properties defined on this component. | |
const Properties & | properties () 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. | |
Static Public Member Functions | |
static smtk::string::Token | ConfiguredByToken (ConfiguredBy value) |
Convert to/from a ConfigureBy enumerant. | |
static ConfiguredBy | ConfiguredByValue (smtk::string::Token token) |
static smtk::string::Token | ItemVisibilityToken (ItemVisibility value) |
Convert to/from an ItemVisibility enumerant. | |
static ItemVisibility | ItemVisibilityValue (smtk::string::Token token) |
static smtk::string::Token | RunStyleToken (RunStyle value) |
Convert to/from a RunStyle enumerant. | |
static RunStyle | RunStyleValue (smtk::string::Token token) |
Protected Member Functions | |
int | update (const smtk::operation::Operation &op, smtk::operation::EventType event, smtk::operation::Operation::Result result) |
Respond to operations that may change task state. | |
bool | applyParameterSpecifications () |
Apply the task's parameter specifications to the operation. | |
bool | applyParameterSpecification (const ParameterSpec &spec, const std::shared_ptr< smtk::attribute::Item > &item) |
Apply a parameter specification to the given item. | |
State | computeInternalState () const |
Check m_resourcesByRole to see if all requirements are met. | |
Protected Member Functions inherited from smtk::task::Task | |
bool | changeState (State previous, State next) |
Indicate the state has changed. More... | |
virtual bool | updateState (Task &dependency, State prev, State next) |
Update our state because a dependent task has changed state or a subclass has marked the internal state as changed. More... | |
bool | internalStateChanged (State next) |
Update the internal state, possibly transitioning the task's final state. More... | |
Protected Attributes | |
smtk::common::Managers::Ptr | m_managers |
smtk::operation::Observers::Key | m_observer |
std::vector< ParameterSpec > | m_parameterSpecs |
ParameterSpec | m_associationSpec |
RunStyle | m_runStyle { RunStyle::Iteratively } |
bool | m_runSinceEdited { false } |
std::shared_ptr< smtk::operation::Operation > | m_operation |
Protected Attributes inherited from smtk::task::Task | |
std::string | m_name |
A task name to present to the user. | |
std::set< smtk::string::Token > | m_style |
The set of style classes for this task. | |
bool | m_completed = false |
Whether the user has marked the task completed or not. | |
std::map< WeakPtr, Observers::Key, std::owner_less< WeakPtr > > | m_dependencies |
A set of dependent tasks and the keys used to observe their state so that this task can update its state in response. | |
bool | m_strictDependencies = false |
Should dependencies be strictly enforced? | |
std::set< WeakPtr, std::owner_less< WeakPtr > > | m_dependents |
Tasks upon which this task depends. More... | |
Observers | m_observers |
The set of observers of this task's state. | |
Task * | m_parent = nullptr |
If this task is the child of another task, this pointer references its parent. More... | |
std::weak_ptr< smtk::task::Manager > | m_manager |
If this task is being managed, this will refer to its manager. | |
smtk::common::UUID | m_id |
The unique identifier for this task. | |
Friends | |
class | adaptor::ResourceAndRole |
class | adaptor::ConfigureOperation |
SubmitOperation helps users prepare and optionally run an operation.
This task creates an operation, optionally pre-configures a subset of its parameters, and may allow users to run the operation once or repeatedly. See the user's guide for more information on how to configure this operation.
|
strong |
Specify what is allowed to configure an operation parameter.
Note that this enumeration does not include a value for specifying that an item may only be configured by a user. For that behavior, simply omit the item's path from the task configuration.
|
strong |
Specify how users interact with the operation.
|
inline |
Return the specification for the associations of the operation this task configures.
Note that if the operation is not intended to auto-configure the associations, the m_itemPath member of the parameters should be set to "-ignore-" (rather than empty or populated with the name of the association's ReferenceItem).
|
overridevirtual |
Return whether or not users are allowed to mark a task completed.
User interfaces (e.g., qtDiagramView) should check this to decide whether to enable UI elements that accept user completion. Subclasses of Task that automate completion (e.g., SubmitOperation when RunStyle is set to Once) can override this method to prevent users from explicitly marking completion. The default implementation returns true when the task state is completable or completed.
Reimplemented from smtk::task::Task.
bool smtk::task::SubmitOperation::setNeedsToRun | ( | ) |
Force the task into an incomplete state because its input parameters have changed.
This is invoked by configureHiddenItems() if any items are modified. The returned value is true if the call had any effect (i.e., m_runSinceEdited was true before the call and false afterward).
Calling this method will generally result in a state change (to Incomplete) if true is returned.