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

PortData is a base class for all types of information passed through Ports. More...

#include <PortData.h>

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

Public Member Functions

 smtkTypeMacroBase (smtk::task::PortData)
 
 smtkCreateMacro (smtk::task::PortData)
 
virtual ~PortData ()=default
 This default virtual destructor forces PortData to be polymorphic.
 
virtual bool merge (const PortData *data)
 Merge another data instance with this one. More...
 

Detailed Description

PortData is a base class for all types of information passed through Ports.

Port objects are passed as keys to Task objects to fetch PortData.

PortData objects are intended to be lightweight and refer to large data by reference. PortData does not inherit smtk::resource::PersistentObject but frequently needs to refer to persistent data. The base Port class has a virtual method defined that allows ports to construct an appropriate PortData subclass from a persistent object.

PortData objects should not be held by objects. They should be consumed and then discarded by tasks requesting them; objects in PortData subclasses are generally referenced by raw pointer, so holding a PortData beyond the life of the function consuming the data may result in stale pointers being dereferenced.

Member Function Documentation

◆ merge()

virtual bool smtk::task::PortData::merge ( const PortData data)
inlinevirtual

Merge another data instance with this one.

Some subclasses of PortData may provide the ability to merge with other PortData objects. If so, they should implement this method.

The default is for merging to fail (returning false).

Reimplemented in smtk::task::ObjectsInRoles.


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