last update 20 Sep 2009 |
#include <cvrChannelProcessingInterface.h>
Public Member Functions | |
virtual | ~channelProcessingInterface () |
virtual bool | apply (channel_type &srcdest) const =0 |
virtual bool | apply (const channel_type &src, channel_type &dest) const =0 |
Very simple interface to allow virtualization of classes that transform a channel into another one of the same type.
Note that it is required that the apply methods do not alter the internal state of the class.
virtual cvr::channelProcessingInterface< T >::~channelProcessingInterface | ( | ) | [inline, virtual] |
Virtual destructor.
virtual bool cvr::channelProcessingInterface< T >::apply | ( | const channel_type & | src, | |
channel_type & | dest | |||
) | const [pure virtual] |
virtual bool cvr::channelProcessingInterface< T >::apply | ( | channel_type & | srcdest | ) | const [pure virtual] |
On-place processing apply.
The inherited methods should take the srcdest channel, process it in some way, and on the same channel leave the result. No restrictions are imposed on whether the memory block of the resulting channel will be the same that the one in the original channel. As a matter of fact, it usually won't be.
If you need to ensure the memory constancy, and assuming the resulting channel will always have the same size than the original one, then you can use the following code:
channelProcessingInterfaceInheritedClass<T> theFunctor; channel<T> tmp; theFunctor.apply(srcdest,tmp); srcdest.fill(tmp)
which of course will be slower as it requires to copy all the data of the result in the original channel.
srcdest | channel with the source data. The result will be left here too. |