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

GatherObjectsAgent broadcasts programmatically-provided data on an output port. More...

#include <GatherObjectsAgent.h>

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

Public Types

using State = smtk::task::State
 
using Configuration = nlohmann::json
 
using DataMap = std::unordered_map< smtk::string::Token, std::unordered_map< smtk::common::UUID, std::unordered_set< smtk::common::UUID > >>
 
- 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::GatherObjectsAgent)
 
 GatherObjectsAgent (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 JSON configuration for this agent's current state.
 
std::shared_ptr< PortDataportData (const Port *port) const override
 Return the port data from the agent. More...
 
bool addObjectInRole (smtk::resource::PersistentObject *object, smtk::string::Token role, bool signal=false)
 Add a persistent object to this port's output in the given role. More...
 
bool removeObjectFromRole (smtk::resource::PersistentObject *object, smtk::string::Token role, bool signal=false)
 Remove a persistent object from this port's output for the given role. More...
 
bool clearOutputPort (bool signal=false)
 Clear the data to be reported on the output port. More...
 
PortoutputPort () const
 Return this agent's output port (or null).
 
const DataMap & data () const
 Return this agent's configuration data.
 
- Public Member Functions inherited from smtk::task::Agent
 smtkTypeMacroBase (smtk::task::Agent)
 
 Agent (Task *owningTask)
 
virtual void portDataUpdated (const Port *port)
 Tell the agent that the data on port has been updated. More...
 
Taskparent () 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...
 
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.
 

Protected Attributes

smtk::string::Token m_outputPortName
 The name of the parent-task's port this agent should provided data for.
 
DataMap m_objects
 The data to present on the specified output port. More...
 
- Protected Attributes inherited from smtk::task::Agent
smtk::task::Taskm_parent
 
smtk::string::Token m_name
 A name that can be used to distinguish instances of agents.
 

Additional Inherited Members

- Protected Member Functions inherited from smtk::task::Agent
virtual void taskStateChanged (State prev, State &next)
 Receive notification the parent Task's state has changed.
 
virtual void taskStateChanged (Task *task, State prev, State next)
 Receive notification that a Task's state has changed. More...
 

Detailed Description

GatherObjectsAgent broadcasts programmatically-provided data on an output port.

Member Function Documentation

◆ addObjectInRole()

bool smtk::task::GatherObjectsAgent::addObjectInRole ( smtk::resource::PersistentObject object,
smtk::string::Token  role,
bool  signal = false 
)

Add a persistent object to this port's output in the given role.

This returns true if the object was added. If the port was modified and signal is true, then Task::portDataUpdated() is invoked for this agent's port.

◆ clearOutputPort()

bool smtk::task::GatherObjectsAgent::clearOutputPort ( bool  signal = false)

Clear the data to be reported on the output port.

If the port was modified and signal is true, then Task::portDataUpdated() is invoked for this agent's port.

◆ portData()

std::shared_ptr< PortData > smtk::task::GatherObjectsAgent::portData ( const Port port) const
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.

◆ removeObjectFromRole()

bool smtk::task::GatherObjectsAgent::removeObjectFromRole ( smtk::resource::PersistentObject object,
smtk::string::Token  role,
bool  signal = false 
)

Remove a persistent object from this port's output for the given role.

This returns true if the object was removed. If the port was modified and signal is true, then Task::portDataUpdated() is invoked for this agent's port.

◆ state()

State smtk::task::GatherObjectsAgent::state ( ) const
overridevirtual

Return the current state of the agent.

This agent is always completable.

Implements smtk::task::Agent.

Member Data Documentation

◆ m_objects

DataMap smtk::task::GatherObjectsAgent::m_objects
protected

The data to present on the specified output port.

This is kept in the form of UUIDs so we can avoid the need to monitor operations and clean the map as operations expunge objects. If an object is missing, it will not be reported in the port-data.


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