X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPluginsBase%2FRotNRawDataFunctor.cxx;fp=lib%2FcpPluginsBase%2FRotNRawDataFunctor.cxx;h=17a47458bcec817c5737965da702673be1e82922;hb=2e142df11d6f312a2a2b5097b8da73571ed523e8;hp=0000000000000000000000000000000000000000;hpb=61b3659afe961ed248f30e26f9ca8f28fcfafddc;p=cpPlugins.git diff --git a/lib/cpPluginsBase/RotNRawDataFunctor.cxx b/lib/cpPluginsBase/RotNRawDataFunctor.cxx new file mode 100644 index 0000000..17a4745 --- /dev/null +++ b/lib/cpPluginsBase/RotNRawDataFunctor.cxx @@ -0,0 +1,78 @@ +// ========================================================================= +// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co) +// ========================================================================= + +#include +#include + +// ------------------------------------------------------------------------- +unsigned char cpPluginsBase::RotNRawDataFunctor:: +Evaluate( const unsigned char& c ) const +{ + static const TNatural s = + TNatural( std::numeric_limits< unsigned char >::max( ) ) + 1; + TNatural d = TNatural( this->GetInValue( "Delta" ) ); + if( TBool( this->GetInValue( "Invert" ) ) ) + { + } + else + return( ( unsigned char )( ( TNatural( c ) + d ) % s ) ); +} + +// ------------------------------------------------------------------------- +cpPluginsBase::RotNRawDataFunctor:: +RotNRawDataFunctor( ) + : Superclass( ) +{ +} + +// ------------------------------------------------------------------------- +cpPluginsBase::RotNRawDataFunctor:: +~RotNRawDataFunctor( ) +{ +} + +// ------------------------------------------------------------------------- +void cpPluginsBase::RotNRawDataFunctor:: +_Configure( ) +{ + this->ConfigureInValue( "Delta", TNatural( 13 ) ); + this->ConfigureInValue( "Invert", TBool( false ) ); +} + +// ------------------------------------------------------------------------- +void cpPluginsBase::RotNRawDataFunctor:: +_GenerateData( ) +{ +} + +// ------------------------------------------------------------------------- +/* TODO + void cpPluginsBase::RotNRawDataFunctor:: + _GenerateData( ) + { + typedef cpPluginsBase::RawData _TData; + + unsigned int N = this->GetNumberOfInputs( "Input" ); + std::size_t size = 0; + for( unsigned int i = 0; i < N; ++i ) + { + const _TData* input = this->_GetInput< _TData >( "Input", i ); + size += input->GetSize( ); + + } // rof + + char* buffer = new char[ size ]; + size = 0; + for( unsigned int i = 0; i < N; ++i ) + { + const _TData* input = this->_GetInput< _TData >( "Input", i ); + std::memcpy( buffer + size, input->GetBuffer( ), input->GetSize( ) ); + size += input->GetSize( ); + + } // rof + this->_GetOutput< _TData >( "Output" )->TakeOwnership( buffer, size ); + } +*/ + +// eof - $RCSfile$