#include <Behavior.h>
Inheritance diagram for mial::Behavior< Type, nDims >:
Public Types | |
typedef Behavior | Self |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer< const Self > | ConstPointer |
typedef itk::WeakPointer< const Self > | ConstWeakPointer |
Public Member Functions | |
virtual bool | run (typename Behavior< Type, nDims >::behaviorIn *i, std::stringstream *s=NULL)=0 |
Public pure virtual function. Implementation required to provide cognitive layer with a method to run the behavior. | |
virtual bool | update ()=0 |
Public pure virtual function. This method allows behaviors to run in multiple stages. | |
virtual void | cleanUp ()=0 |
Public pure virtual function. Method of cleaning up after the behavior. | |
std::string | getName () |
Public accessor to the name string. | |
bool | setPhysLayer (Physics< Type, nDims > *phys) |
Public modifier to set the physics layer the behavior will be run on. | |
Protected Types | |
typedef Physics< Type, nDims > | PhysicsType |
typedef PhysicsType::MatrixType | MatrixType |
typedef PhysicsType::VectorType | VectorType |
Protected Member Functions | |
Behavior (std::string name) | |
Default constructor, must provide a name. | |
Protected Attributes | |
Behavior * | subBehaviors |
List of sub-behaviors available. | |
behaviorIn * | input |
A pointer for the input. | |
std::string | name |
The name of the behavior used to identify it to other organisms, users, and behaviors. | |
Physics< Type, nDims > * | physLayer |
The physics layer used to simulate the actions. | |
Classes | |
struct | behaviorIn |
A structure defining the inputs of a Behavior. More... | |
struct | Error |
The error structure thrown by behaviors run method when an error is encountered. More... |
Behaviors are particular actions or sequences of actions that a deformable organism can perform. They may elicit sensory operations, deformations, and decisions. To ensure meaningful interaction with other organisms and users each behavior has a name. So for example, despite the action "running" being carried out differently by different animals each can always be told to run, or report that it is running. This class is currently classified as unstable.
Sub-behaviors are smaller behaviors performed as part of a larger action. This enables significant levels of abstraction, allowing users to issue single commands and carry out vast and complex sequences of actions, or small exact ones. For example, one could tell the organism to simply inflate, or one could tell it to segment which includes inflation.
Behaviors are responsible for un-marshaling their own run-time arguments.
Upon completion a behavior will set its state to finished.
Error reporting is handled by the Error structure, which reports an error message as well as the name of the behavior involved.
Wherever possible Behaviors should not contain "if" statements, as any such decision should be left up to the control center.
Type | the internal storage type | |
nDims | the number of dimensions |
Definition at line 46 of file Behavior.h.
virtual void mial::Behavior< Type, nDims >::cleanUp | ( | ) | [pure virtual] |
Public pure virtual function. Method of cleaning up after the behavior.
Since behaviors may be ran multiple times before being destructed they must provide a method to clean up for the next run. This method will be ran after the behavior asserts itself as finished.
Implemented in mial::Beh_SearchForObject< Type, TInputImage, nDims >, mial::Beh_TranslateAll< Type, nDims >, and mial::Beh_UniformScale< Type, nDims >.
virtual bool mial::Behavior< Type, nDims >::run | ( | typename Behavior< Type, nDims >::behaviorIn * | i, | |
std::stringstream * | s = NULL | |||
) | [pure virtual] |
Public pure virtual function. Implementation required to provide cognitive layer with a method to run the behavior.
Note: This method will only be ran once per behavior, subsequent calls will be made to the update method.
Note:that this function must take as an argument the basemost behaviorIn class, implementations can then downcast to their derived behaviorIn classes.
i | the input behavior struct. Typically, setting to NULL indicates stream should be used. | |
s | the input stream, typically only used if input struct is NULL. |
virtual bool mial::Behavior< Type, nDims >::update | ( | ) | [pure virtual] |
Public pure virtual function. This method allows behaviors to run in multiple stages.
This method will be ran after the run method, until the isFinished() returns true.
Implemented in mial::Beh_SearchForObject< Type, TInputImage, nDims >, mial::Beh_TranslateAll< Type, nDims >, and mial::Beh_UniformScale< Type, nDims >.