#if defined (_MSC_VER) && (_MSC_VER >= 1000) #pragma once #endif #ifndef _INC_BEH_TRANSLATEALL #define _INC_BEH_TRANSLATEALL #include "Behavior.h" namespace mial{ /*! A derived class of the behavioral ABC this class performs a translation with user provided direction and magnitude of the organism. The power of the framework is demonstrated here in that by eliciting its attached physics layer's translate deformation this behavior may be performed on any physics layer providing that deformation. This behavior does not have any sub-behaviors. \param Type the internal type used for storage \param nDims the number of dimensions */ template class Beh_TranslateAll : public Behavior { public: //Smart pointers typedef Beh_TranslateAll Self; typedef itk::SmartPointer Pointer; typedef itk::SmartPointer ConstPointer; typedef itk::WeakPointer ConstWeakPointer; itkNewMacro(Self); typedef typename Behavior::Error Error; //! A structure defining the inputs for the behavior. /*! Since structures support public inheritance derived class must inherit from this class in their definitions of behaviorIn. */ struct behaviorIn: public Behavior::behaviorIn{ //Setup the smart pointer typedef behaviorIn Self; typedef itk::SmartPointer Pointer; typedef itk::SmartPointer ConstPointer; typedef itk::WeakPointer ConstWeakPointer; itkNewMacro(Self); //Define all custom here //! The amount in each dimension to translate by double translateAmount[nDims]; //! The duration of the translation in deformable organism time. int duration; //! A method for converting stream-based arguments into the structures members (marshalling). /*! Stream is expected as "duration xAmount yAmount zAmount(3d only)" */ bool fillFromStream(std::stringstream &args){ args>> duration; for(int i=0;i> translateAmount[i];} return true;}; protected: behaviorIn(){}; }; //! Internal recording of when the behavior started running. double startTime; //! Internal recording of when the behavior is set to end. double endTime; virtual bool run(typename Behavior::behaviorIn * i, std::stringstream *s); bool isFinished(){return (this->physLayer->getTime()>endTime);}; virtual bool update(); virtual void cleanUp(); protected: Beh_TranslateAll(); typename behaviorIn::Pointer input; }; }//end mial #include "Beh_TranslateAll.cxx" #endif /* _INC_BEH_TRANSLATEALL_42E452A7009C_INCLUDED */