Hi,

I would like to create an abstract communication class which can be specialized for different communication subsystems. The communication class should be able to send special image data. The image class, however, is templated (over PixelType and Dimension). Therefore I have to use templates for my send method. I DO NOT want to use templates at class level, i.e.

template <class ImageType>
class Communicator {
...
}

, because of two reasons:
1) The communicator should be usable also in environments where no images have to be sent (and where they don't even exist).
2) One single instance of the communicator class may have to send different images (with different PixelTypes). I don't want to list all of them as class templates (template <class ImageType1, class ImageType2, ..., class ImageTypeN>), even though the maximum number of N is known (at least for the current application, it might be different when the communicator class is used in other applications...).

Usually (i.e. with non templated images), I would just define a send method in the abstract communicator class which uses the image superclass (let's call it ImageSuperclass) as a parameter:

virtual void Send(ImageSuperclass* image, ...) = 0;

This method could then send any derived image classes, say Short2DImage, Char3DImage, ...

Then I would derive my specialized Communicator class, say MPICommunicator, and this class would override the send method in the abstract class. However, since the image class is templated, my method has to look something like

template <class ImageType>
void Send(ImageType* image, ...)

Unfortunately, templated member functions cannot be declared as virtual, and can therefore not be overwritten by my derived MPICommunicator class.

Can anybody explain me how I can define an abstract communicator class that defines a send method for my templated images and from which I can derive different implementations of communicator classes (MPICommunicator, SocketCommunicator, ...). The derived classes obviously somehow have to reimplement the send method of the abstract superclass.

Thanks for any help,

Michael