|
SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
SubmitOperationAgent verifies that attributes are valid. More...
#include <SubmitOperationAgent.h>
Classes | |
| struct | ParameterSpec |
| Per-parameter configuration of item values. More... | |
| struct | ParameterSpecRef |
| A reference to a ParameterSpec within m_parameters. More... | |
Public Types | |
| enum | RunStyle { Iteratively, Once, OnCompletion } |
| Specify how users interact with the operation. More... | |
| enum | ConfiguredBy { ConfiguredBy::Static, ConfiguredBy::Port, 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... | |
| enum | PortDataHandler { PortDataHandler::AddObjects, PortDataHandler::SetObjects, PortDataHandler::AssignFromAttribute, PortDataHandler::AssignFromAttributeResource, PortDataHandler::AssignMatchingAttributes } |
| Methods for configuring operation parameters mentioned in port-data. More... | |
| using | State = smtk::task::State |
| using | Configuration = nlohmann::json |
| using | ParameterSpecMap = std::unordered_map< smtk::string::Token, std::unordered_map< smtk::string::Token, std::vector< ParameterSpec > >> |
| All of the ways the operation accepts port-data into its configuration. More... | |
| using | ParameterWatchMap = std::unordered_map< smtk::common::UUID, std::set< ParameterSpecRef > > |
| A set of component UUIDs that provide values to be mapped into parameters. More... | |
| using | ObjectSet = std::unordered_set< smtk::resource::PersistentObject * > |
| A set of objects from which to assign values. | |
| using | ParameterUpdateMap = std::map< ParameterSpecRef, ObjectSet > |
| Used internally to gather objects contributing to the same parameter. | |
Public Types inherited from smtk::task::Agent | |
| enum | CategoryEvaluation { CategoryEvaluation::Pass, CategoryEvaluation::Reject, CategoryEvaluation::Neutral } |
| The set of values that an agent's acceptChildCategories method can return. More... | |
| using | State = smtk::task::State |
| using | Configuration = nlohmann::json |
Public Member Functions | |
| smtkSuperclassMacro (smtk::task::Agent) | |
| smtkTypeMacro (smtk::task::SubmitOperationAgent) | |
| SubmitOperationAgent (Task *owningTask) | |
| State | state () const override |
| Return the current state of the agent. More... | |
| void | configure (const Configuration &config) override |
| Configure the agent based on a provided JSON configuration. | |
| Configuration | configuration () const override |
| Return the agent's current configuration. | |
| std::string | troubleshoot () const override |
| Return user-presentable troubleshooting information. | |
| std::shared_ptr< PortData > | portData (const Port *port) const override |
| Return port data provided by the agent. More... | |
| void | portDataUpdated (const Port *port) override |
| Tell the agent that the data on port has been updated. | |
| 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. | |
| ParameterSpec & | associationSpec () |
| Return the specification for the associations of the operation this task configures. More... | |
| ParameterSpec | associationSpec () const |
| const ParameterSpecMap & | parameterSpecs () const |
| Return the list of operation parameters to copy from an input attribute resource. More... | |
| 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... | |
Public Member Functions inherited from smtk::task::Agent | |
| smtkTypeMacroBase (smtk::task::Agent) | |
| Agent (Task *owningTask) | |
| Task * | parent () const |
| Return the agent's parent task. | |
| virtual bool | getViewData (smtk::common::TypeContainer &configuration) const |
| Insert view-related objects into configuration. More... | |
| smtk::string::Token | name () const |
| Agents may have a name that can be used to distinguish them. More... | |
| virtual CategoryEvaluation | acceptsChildCategories (const std::set< std::string > &cats) const |
| Evaluates a set of categories that are associated with potential children tasks. | |
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) |
| static smtk::string::Token | PortDataHandlerToken (PortDataHandler value) |
| Convert to/from a PortDataHandler enumerant. | |
| static PortDataHandler | PortDataHandlerValue (smtk::string::Token token) |
Protected Member Functions | |
| void | taskStateChanged (State prev, State &next) override |
| Receive notification the parent Task's state has changed. | |
| void | taskStateChanged (Task *task, State prev, State next) override |
| Receive notification that a Task's state has changed. More... | |
| 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 | prepareParameterUpdates (ParameterUpdateMap ¶metersToUpdate, const std::shared_ptr< smtk::attribute::ComponentItem > &components, bool expunging, bool &requireStateCheck) |
| Insert objects that should be mapped to operation parameters into parametersToUpdate. More... | |
| bool | copyToParameters (ParameterUpdateMap ¶metersToUpdate) |
| Invoke copyToParameter on each entry of parametersToUpdate. More... | |
| bool | copyToParameter (const ParameterSpecRef &ref, const std::unordered_set< smtk::resource::PersistentObject * > &objects) |
| Copy values from objects into the referenced parameter (ref ). More... | |
| bool | copyToIntParameter (const ParameterSpec &spec, smtk::attribute::IntItem *targetInt, const ObjectSet &objects) |
| Copy values from objects into targetInt. | |
| bool | copyToDoubleParameter (const ParameterSpec &spec, smtk::attribute::DoubleItem *targetDouble, const ObjectSet &objects) |
| Copy values from objects into targetDouble. | |
| bool | copyToStringParameter (const ParameterSpec &spec, smtk::attribute::StringItem *targetString, const ObjectSet &objects) |
| Copy values from objects into targetString. | |
| bool | copyToReferenceParameter (const ParameterSpec &spec, smtk::attribute::ReferenceItem *targetReference, const ObjectSet &objects) |
| Copy values from objects into targetReference. | |
| virtual State | computeInternalState () |
| Check m_resourcesByRole to see if all requirements are met. | |
Protected Attributes | |
| ParameterSpecMap | m_parameterSpecs |
| ParameterWatchMap | m_watching |
| State | m_internalState { State::Unavailable } |
| smtk::common::Managers::Ptr | m_managers |
| smtk::operation::Observers::Key | m_observer |
| ParameterSpec | m_associationSpec |
| RunStyle | m_runStyle { RunStyle::Iteratively } |
| bool | m_runSinceEdited { false } |
| std::shared_ptr< smtk::operation::Operation > | m_operation |
| smtk::string::Token | m_outputPortName |
| Allow users to name a port+role where this agent produces a set of resources reported as created/modified/expunged by the agent's most recent execution of its operation. More... | |
| smtk::string::Token | m_outputRole |
| std::set< std::weak_ptr< smtk::resource::Resource >, std::owner_less< std::weak_ptr< smtk::resource::Resource > > > | m_outputResources |
Protected Attributes inherited from smtk::task::Agent | |
| smtk::task::Task * | m_parent |
| smtk::string::Token | m_name |
| A name that can be used to distinguish instances of agents. | |
SubmitOperationAgent verifies that attributes are valid.
| using smtk::task::SubmitOperationAgent::ParameterSpecMap = std::unordered_map< smtk::string::Token, std::unordered_map<smtk::string::Token, std::vector<ParameterSpec> >> |
All of the ways the operation accepts port-data into its configuration.
This specifies how port-data should be ingested. When matching port-data is detected (during portDataUpdated()), then entries are added to the ParameterWatchMap.
| using smtk::task::SubmitOperationAgent::ParameterWatchMap = std::unordered_map<smtk::common::UUID, std::set<ParameterSpecRef> > |
A set of component UUIDs that provide values to be mapped into parameters.
This is used by the operation observer to update the operation's configuration.
|
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.
| Enumerator | |
|---|---|
| Static | Static agent configuration (not port data) provides values. |
| Port | Port data is allowed to modify the parameter whenever updated. |
| User | Tasks, ports, and the user are allowed to edit the parameter. |
|
strong |
Methods for configuring operation parameters mentioned in port-data.
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).
|
protected |
Copy values from objects into the referenced parameter (ref ).
This returns true if any parameters were modified.
|
protected |
Invoke copyToParameter on each entry of parametersToUpdate.
In the future, this may fetch other objects from which parameter values should be drawn (when there is a need to combine values from multiple objects to set a single operation-parameter's value).
|
inline |
Return the list of operation parameters to copy from an input attribute resource.
The input attribute resource is expected to be provided via an input port.
|
overridevirtual |
Return port data provided by the agent.
If the agent is not assigned to port, the method returns nullptr.
Reimplemented from smtk::task::Agent.
|
protected |
Insert objects that should be mapped to operation parameters into parametersToUpdate.
The ComponentItem passed should be from an operation result's report of created, modified, or expunged components.
This returns true if any entries were added to parametersToUpdate.
| bool smtk::task::SubmitOperationAgent::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.
|
inlineoverridevirtual |
Return the current state of the agent.
This is Unavailable when no resources/attributes/definitions have been configured for validation; it is Incomplete when at least one attribute is configured for validation but is not in a valid state; and Completable when all the configured attributes are valid.
Implements smtk::task::Agent.
|
overrideprotectedvirtual |
Receive notification that a Task's state has changed.
This method would allow a Task to delegate children state calculation to an SubmitOperationAgent instead
Reimplemented from smtk::task::Agent.
|
protected |
Allow users to name a port+role where this agent produces a set of resources reported as created/modified/expunged by the agent's most recent execution of its operation.
These member variables are assigned by configure() and, if m_outputPortName is invalid, are ignored.
1.8.17