|
SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
FillOutAttributesAgent verifies that attributes are valid. More...
#include <FillOutAttributesAgent.h>
Classes | |
| struct | AttributeSet |
| A predicate used to collect resources that fit a given role. More... | |
| struct | ResourceAttributes |
| Per-resource sets of validated attributes. More... | |
Public Types | |
| enum | PortDataObjects { PortDataObjects::Resources, PortDataObjects::Attributes, PortDataObjects::Both } |
| Which objects should be broadcast as output port-data. More... | |
| using | State = smtk::task::State |
| using | Configuration = nlohmann::json |
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::FillOutAttributesAgent) | |
| FillOutAttributesAgent (Task *parent) | |
| 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. More... | |
| std::shared_ptr< PortData > | portData (const Port *port) const override |
| Return the port data from the agent. More... | |
| void | portDataUpdated (const Port *port) override |
| Tell the agent that the data on port has been updated. | |
| bool | getViewData (smtk::common::TypeContainer &configuration) const override |
| Insert an attribute resource pointer into configuration. | |
| const std::vector< AttributeSet > & | attributeSets () const |
| Provide read-only access to the agent's configuration. | |
| Port * | inputPort () const |
| The port (if any) that the agent accepts configuration data from. | |
| Port * | outputPort () const |
| The port (if any) that the agent pushes its configured attribute resources. | |
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 std::string | troubleshoot () const |
| Return a description of actions users must take to make the agent's state completable. 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 | PortDataObjectsToken (PortDataObjects value) |
| Convert to/from a PortDataObjects enumerant. | |
| static PortDataObjects | PortDataObjectsValue (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... | |
| bool | initializeResources () |
| Initialize with a list of resources from manager in m_managers. | |
| bool | updateResourceEntry (smtk::attribute::Resource &resource, const AttributeSet &predicate, ResourceAttributes &entry) |
| Update a single resource in a predicate. | |
| 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 | hasRelevantInformation (const smtk::resource::ManagerPtr &resourceManager, bool &foundResources) const |
| Return true if the agent is configured with resources to validate. More... | |
| virtual State | computeInternalState () |
| Check m_resourcesByRole to see if all requirements are met. | |
Static Protected Member Functions | |
| static bool | testValidity (const smtk::attribute::AttributePtr &attribute, ResourceAttributes &resourceAtts) |
| Determine if an attribute needs to be tested for its validity. More... | |
Protected Attributes | |
| State | m_internalState { State::Unavailable } |
| Current agent state. More... | |
| smtk::operation::Observers::Key | m_observer |
| Observe operations for changes to relevant attributes. | |
| std::vector< AttributeSet > | m_attributeSets |
| The list of resources/attributes that are relevant to this agent's state. | |
| Port * | m_inputPort { nullptr } |
| Points to the input port (if runtime configuration is allowed); may be null. | |
| Port * | m_outputPort { nullptr } |
| Points to the output port (if configured to provide configuration data). More... | |
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. | |
FillOutAttributesAgent verifies that attributes are valid.
This agent accepts an input attribute resource (configured by hand or by PortData of type ObjectsInRoles) and observes an operation manager to determine when relevant attributes have been modified. Once all attributes identify are valid, the agent becomes completable. Otherwise, the task will remain (or become) incomplete. The agent is unavailable if there are no resources or attributes to validate.
FillOutAttributesAgent accepts a single input and output port, both of which pass PortData of type ObjectsInRoles. The agent itself is configured with AttributeSet instances that specify a role and the port-data is searched for these roles in order to configure attributes to be filled out.
The output port contains only the attribute(s) configured by this task and does not include upstream port information so that when the output port is marked as modified it is possible for downstream tasks to be certain that it is the attributes in question that have been updated.
|
overridevirtual |
Return the agent's current configuration.
Record port mapping from parent task.
Reimplemented from smtk::task::Agent.
|
protected |
Return true if the agent is configured with resources to validate.
Resources are only counted as relevant if they contain definition names or attribute instance-names that match the agent's configuration.
|
overridevirtual |
Return the port data from the agent.
If the agent is not assigned to port, the method returns nullptr.
Reimplemented from smtk::task::Agent.
|
overridevirtual |
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 FillOutAttributesAgent instead
Reimplemented from smtk::task::Agent.
|
staticprotected |
Determine if an attribute needs to be tested for its validity.
Returns true if the attribute was not already contained in resourceAtts.
|
protected |
Current agent state.
This is set by computeInternalState and to be used when calling m_parent->updateTaskState().
|
protected |
Points to the output port (if configured to provide configuration data).
If null, updates to the configuration are not propagated downstream.
1.8.17