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

This object provides applications a way to configure a task using information adapted from its dependencies. More...

#include <Adaptor.h>

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

Public Types

using Configuration = nlohmann::json
 Task adaptors are configured using JSON.
 
- 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::Adaptor)
 
 smtkSuperclassMacro (smtk::resource::Component)
 
 smtkSharedFromThisMacro (smtk::resource::PersistentObject)
 
 Adaptor ()
 Construct an unconfigured adaptor.
 
 Adaptor (const Configuration &config)
 
 Adaptor (const Configuration &config, Task *from, Task *to)
 
 ~Adaptor () override=default
 Destructor must be virtual.
 
const smtk::resource::ResourcePtr resource () const override
 Components are required to return their owning resource (if any). More...
 
std::string name () const override
 Return the name of the object - by default it will return the UUID but that can be overridden.
 
const common::UUIDid () const override
 Return a unique identifier for the object which will be persistent across sessions.
 
bool setId (const common::UUID &uid) override
 Assign an ID to this object (used by readers; not for arbitrary reuse). More...
 
virtual bool updateDownstreamTask (State upstreamPrev, State upstreamNext)=0
 Subclasses must override this method and respond to changes in the state of the upstream task as provided. More...
 
Taskfrom () const
 The task this adaptor uses to fetch configuration parameters.
 
Taskto () const
 The task to which this adaptor applies configuration parameters.
 
- 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 configureId (const Configuration &config)
 

Protected Attributes

smtk::common::UUID m_id
 
Taskm_from { nullptr }
 
Taskm_to { nullptr }
 
smtk::task::Task::Observers::Key m_observer
 

Detailed Description

This object provides applications a way to configure a task using information adapted from its dependencies.

Member Function Documentation

◆ resource()

const smtk::resource::ResourcePtr smtk::task::Adaptor::resource ( ) const
overridevirtual

Components are required to return their owning resource (if any).

Components may not have an owning resource at some points in their lifecycle, so be sure to verify the returned value is non-null.

Implements smtk::resource::Component.

◆ setId()

bool smtk::task::Adaptor::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.

◆ updateDownstreamTask()

virtual bool smtk::task::Adaptor::updateDownstreamTask ( State  upstreamPrev,
State  upstreamNext 
)
pure virtual

Subclasses must override this method and respond to changes in the state of the upstream task as provided.

Note this method replaces reconfigureTask() method which has been removed.

Implemented in smtk::task::adaptor::ConfigureOperation, and smtk::task::adaptor::ResourceAndRole.


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