iMSTK
Interactive Medical Simulation Toolkit
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
imstk::Behaviour< UpdateInfo > Class Template Reference

A Behaviour represents a single component system A template is used here for UpdateInfo to keep the ComponentModel library more general and separable. UpdateInfo could be anything you need from outside to update the component, this would generally be your own struct or just a single primitive such as double timestep. More...

#include <imstkComponent.h>

Inheritance diagram for imstk::Behaviour< UpdateInfo >:
Inheritance graph
[legend]
Collaboration diagram for imstk::Behaviour< UpdateInfo >:
Collaboration graph
[legend]

Public Member Functions

virtual void update (const UpdateInfo &imstkNotUsed(updateData))
 
virtual void visualUpdate (const UpdateInfo &imstkNotUsed(updateData))
 
void initTaskGraphEdges ()
 Setup the edges/connections of the TaskGraph.
 
std::shared_ptr< TaskGraphgetTaskGraph () const
 
- Public Member Functions inherited from imstk::Component
const std::string & getName () const
 
void setName (const std::string &name)
 
std::weak_ptr< EntitygetEntity () const
 Get parent entity.
 
void initialize ()
 Initialize the component, called at a later time after all component construction is complete.
 

Protected Member Functions

 Behaviour (const std::string &name="Behaviour")
 
 Behaviour (const bool useTaskGraph, const std::string &name="Behaviour")
 
virtual void initGraphEdges (std::shared_ptr< TaskNode > imstkNotUsed(source), std::shared_ptr< TaskNode > imstkNotUsed(sink))
 Setup the edges/connections of the TaskGraph. More...
 
- Protected Member Functions inherited from imstk::Component
 Component (const std::string &name="Component")
 
virtual void init ()
 Initialize the component, called at a later time after all component construction is complete.
 

Protected Attributes

std::shared_ptr< TaskGraphm_taskGraph = nullptr
 
- Protected Attributes inherited from imstk::Component
std::string m_name
 
std::weak_ptr< Entitym_entity
 Parent entity this component exists on.
 

Detailed Description

template<typename UpdateInfo>
class imstk::Behaviour< UpdateInfo >

A Behaviour represents a single component system A template is used here for UpdateInfo to keep the ComponentModel library more general and separable. UpdateInfo could be anything you need from outside to update the component, this would generally be your own struct or just a single primitive such as double timestep.

Behaviour provides two ways of defining system logic.

  1. Updating via the normal update & visualUpdate function
  2. Updating via a TaskGraph definition. Both may be used together but normal update's will always occur after all TaskGraph updates. Additionally visualUpdate's occur before renders.

All TaskGraph's are joined into the Scene TaskGraph. If any node is shared (occurs in both) between TaskGraphs, they will join/become one. For example, graphA could define A->B->C. Whilst graphB defines D->B->E. B is shared. This allows one to order calls easily and extensibly.

When dealing with large amounts of similar components one may also consider making a separate system of components. For example, how the Scene is a system of Components. The Renderer is a system of VisualModel components. This is more cache friendly.

Definition at line 89 of file imstkComponent.h.

Member Function Documentation

◆ initGraphEdges()

template<typename UpdateInfo >
virtual void imstk::Behaviour< UpdateInfo >::initGraphEdges ( std::shared_ptr< TaskNode >   imstkNotUsedsource,
std::shared_ptr< TaskNode >   imstkNotUsedsink 
)
inlineprotectedvirtual

Setup the edges/connections of the TaskGraph.

Parameters
sink,lastnode of the graph (does no function)

Definition at line 129 of file imstkComponent.h.


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