//
// C++ Interface: slot
//
// Description:
//
//
// Author: Messenger of death aka Denis A. Birukov <messengerofdeath@gmail.com>, (C) 2008
//
// Copyright: See COPYING file that comes with this distribution
//
//

#ifndef SLOT_H
#define SLOT_H
#include "abstractslot.h"

template<class SlotClass, class SlotMethod> class Slot : public AbstractSlot
{
    public:
        virtual bool _invoke( SlotArgs *params ) throw( SlotAssert )
        {
            return ( _slot_class_->*_slot_method_ )( params );
        }
        Slot( SlotClass *t_class, SlotMethod t_method) : _slot_class_( t_class ), _slot_method_( t_method ){};
    private:
        SlotClass *_slot_class_;
        SlotMethod _slot_method_;
};
		
#define DECLARE_SLOT(class, name) Slot<class, bool (class::*)(SlotArgs*)> name; \
virtual bool slot_##name( SlotArgs *args)

#define DEFINE_SLOT(class, name) bool class::slot_##name( SlotArgs *args)
#define VIRTUAL_SLOT(name) bool slot_##name( SlotArgs *args)
#define INIT_SLOT(class, object, name) name( object, &class::slot_##name)

#endif
