My interface declarations usually (always?) Follow the same pattern. Here is an example:
class Output
{
public:
virtual ~Output() { }
virtual void write( const std::vector<char> &data ) = 0;
protected:
Output() { }
private:
Output( const Output &rhs );
void operator=( const Output &other );
};
The template is always the same: a public virtual destructor, a few simple virtual methods that make up the actual interface. default protected ctor, disabled copy and copy destination. I started using two small helper macros that can be used to simplify the above.
ABSTRACT_BASECLASS_BEGIN(Output)
virtual void write( const std::vector<char> &data ) = 0;
ABSTRACT_BASECLASS_END(Output)
Unfortunately, I did not find a good way to do this with just one macro. Even better, I would like to completely avoid macros. However, the only thing that occurred to me was the code generator, which is a bit overloaded for me.
++ - . , .