00001 #ifndef _Beh_UniformScale_txx
00002 #define _Beh_UniformScale_txx
00003
00004 #include "Beh_UniformScale.h"
00005
00006 namespace mial {
00007
00008 template<class Type, int nDims>
00009 Beh_UniformScale<Type,nDims>::Beh_UniformScale()
00010 :Behavior<Type,nDims>("Beh_UniformScale")
00011 {
00012
00013 startTime =0;
00014 endTime =0;
00015 }
00016 template<class Type, int nDims>
00017 bool Beh_UniformScale<Type,nDims>::run(typename Behavior<Type,nDims>::behaviorIn * i,std::stringstream *s)
00018 {
00019
00020 typename behaviorIn::Pointer in;
00021
00022 if(i != NULL && s != NULL)
00023 {
00024 Error e;
00025 e.msg = "Only one of struct or stream input may be provided.";
00026 e.name = "Beh_UniformScale";
00027 throw e;
00028 }
00029 else if(i != NULL)
00030 in = reinterpret_cast<behaviorIn *>(i);
00031 else if( s!= NULL)
00032 {
00033 in = behaviorIn::New();
00034 in->fillFromStream(*s);
00035 }
00036 else
00037 {
00038 Error e;
00039 e.msg = "Either struct or stream input must be provided.";
00040 e.name = "Beh_UniformScale";
00041 throw e;
00042 }
00043
00044
00045 startTime = this->physLayer->getTime();
00046 endTime = startTime+in->duration;
00047 std::stringstream defArgs;
00048 defArgs << in->scaleAmount;
00049 std::cout << "Runing Beh_UniformScale" << std::endl;
00050 this->physLayer->runDeformation("Def_UniformScale",NULL,&defArgs);
00051
00052 return false;
00053 }
00054
00055 template<class Type, int nDims>
00056 void Beh_UniformScale<Type,nDims>::cleanUp()
00057 {
00058 startTime =0;
00059 endTime =0;
00060 }
00061 }
00062
00063 #endif