// -*- c++ -*- /* This is a generated file, do not edit. Generated from ../sigc++/macros/retbind.h.m4 */ /* This was also shamelessly copied, hacked, munched, and carefully * tweaked from KNelson's original bind.h.m4 * CJN 3.22.00 */ #ifndef SIGCXX_RETBIND_H #define SIGCXX_RETBIND_H /* SigC::retbind ------------- retbind() alters a Slot by fixing the return value to certain values Return value fixing ignores any slot return value. The slot is destroyed in the process and a new one is created, so references holding onto the slot will no longer be valid. Typecasting may be necessary to match arguments between the slot and the binding return value. Types must be an exact match. To insure the proper type, the type can be explicitly specified on template instantation. Simple Sample usage: void f(int,int); Slot2 s1=slot(f); Slot1 s2=retbind(s1,1); // s1 is invalid cout << "s2: " << s2(2,1) << endl; Type specified usage: struct A {}; struct B :public A {}; B* b; Slot1 s1; Slot0 s2=retbind(s1,b); // B* must be told to match A* */ #include #include #ifdef SIGC_CXX_NAMESPACES namespace SigC { #endif /**************************************************************** ***** Adaptor RetBind Slot 0 arguments ****************************************************************/ template struct AdaptorRetBindSlot0: public AdaptorSlot_ { #ifdef SIGC_CXX_PARTIAL_SPEC typedef Ret RType; #else typedef typename Trait::type RType; #endif typedef Slot0 SlotType; typedef Slot0 InSlotType; struct Node:public AdaptorNode { Ret ret_; }; typedef CallDataObj2 CallData; static RType callback(void* d) { CallData* data=(CallData*)d; Node* node=data->obj; ((typename InSlotType::Callback&)(node->data_))(); return node->ret_; } static SlotData* create(SlotData *s,Ret ret) { SlotData* tmp=(SlotData*)s; Node *node=new Node(); copy_callback(tmp,node); node->ret_ = ret; CallData &data=reinterpret_cast(tmp->data_); data.callback=&callback; data.obj=node; return tmp; } }; #ifndef SIGC_CXX_VOID_RETURN #ifdef SIGC_CXX_PARTIAL_SPEC template struct AdaptorRetBindSlot0 : public AdaptorSlot_ { #ifdef SIGC_CXX_PARTIAL_SPEC typedef Ret RType; #else typedef typename Trait::type RType; #endif typedef Slot0 SlotType; typedef Slot0 InSlotType; struct Node:public AdaptorNode { Ret ret_; }; typedef CallDataObj2 CallData; static RType callback(void* d) { CallData* data=(CallData*)d; Node* node=data->obj; ((typename InSlotType::Callback&)(node->data_))(); return node->ret_; } static SlotData* create(SlotData *s,Ret ret) { SlotData* tmp=(SlotData*)s; Node *node=new Node(); copy_callback(tmp,node); node->ret_ = ret; CallData &data=reinterpret_cast(tmp->data_); data.callback=&callback; data.obj=node; return tmp; } }; #endif #endif template Slot0 retbind(const Slot0 &s, Ret ret) {return AdaptorRetBindSlot0::create(s.data(),ret); } /**************************************************************** ***** Adaptor RetBind Slot 1 arguments ****************************************************************/ template struct AdaptorRetBindSlot1: public AdaptorSlot_ { #ifdef SIGC_CXX_PARTIAL_SPEC typedef Ret RType; #else typedef typename Trait::type RType; #endif typedef Slot1 SlotType; typedef Slot1 InSlotType; struct Node:public AdaptorNode { Ret ret_; }; typedef CallDataObj2 CallData; static RType callback(void* d,P1 p1) { CallData* data=(CallData*)d; Node* node=data->obj; ((typename InSlotType::Callback&)(node->data_))(p1); return node->ret_; } static SlotData* create(SlotData *s,Ret ret) { SlotData* tmp=(SlotData*)s; Node *node=new Node(); copy_callback(tmp,node); node->ret_ = ret; CallData &data=reinterpret_cast(tmp->data_); data.callback=&callback; data.obj=node; return tmp; } }; #ifndef SIGC_CXX_VOID_RETURN #ifdef SIGC_CXX_PARTIAL_SPEC template struct AdaptorRetBindSlot1 : public AdaptorSlot_ { #ifdef SIGC_CXX_PARTIAL_SPEC typedef Ret RType; #else typedef typename Trait::type RType; #endif typedef Slot1 SlotType; typedef Slot1 InSlotType; struct Node:public AdaptorNode { Ret ret_; }; typedef CallDataObj2 CallData; static RType callback(void* d,P1 p1) { CallData* data=(CallData*)d; Node* node=data->obj; ((typename InSlotType::Callback&)(node->data_))(p1); return node->ret_; } static SlotData* create(SlotData *s,Ret ret) { SlotData* tmp=(SlotData*)s; Node *node=new Node(); copy_callback(tmp,node); node->ret_ = ret; CallData &data=reinterpret_cast(tmp->data_); data.callback=&callback; data.obj=node; return tmp; } }; #endif #endif template Slot1 retbind(const Slot1 &s, Ret ret) {return AdaptorRetBindSlot1::create(s.data(),ret); } /**************************************************************** ***** Adaptor RetBind Slot 2 arguments ****************************************************************/ template struct AdaptorRetBindSlot2: public AdaptorSlot_ { #ifdef SIGC_CXX_PARTIAL_SPEC typedef Ret RType; #else typedef typename Trait::type RType; #endif typedef Slot2 SlotType; typedef Slot2 InSlotType; struct Node:public AdaptorNode { Ret ret_; }; typedef CallDataObj2 CallData; static RType callback(void* d,P1 p1,P2 p2) { CallData* data=(CallData*)d; Node* node=data->obj; ((typename InSlotType::Callback&)(node->data_))(p1,p2); return node->ret_; } static SlotData* create(SlotData *s,Ret ret) { SlotData* tmp=(SlotData*)s; Node *node=new Node(); copy_callback(tmp,node); node->ret_ = ret; CallData &data=reinterpret_cast(tmp->data_); data.callback=&callback; data.obj=node; return tmp; } }; #ifndef SIGC_CXX_VOID_RETURN #ifdef SIGC_CXX_PARTIAL_SPEC template struct AdaptorRetBindSlot2 : public AdaptorSlot_ { #ifdef SIGC_CXX_PARTIAL_SPEC typedef Ret RType; #else typedef typename Trait::type RType; #endif typedef Slot2 SlotType; typedef Slot2 InSlotType; struct Node:public AdaptorNode { Ret ret_; }; typedef CallDataObj2 CallData; static RType callback(void* d,P1 p1,P2 p2) { CallData* data=(CallData*)d; Node* node=data->obj; ((typename InSlotType::Callback&)(node->data_))(p1,p2); return node->ret_; } static SlotData* create(SlotData *s,Ret ret) { SlotData* tmp=(SlotData*)s; Node *node=new Node(); copy_callback(tmp,node); node->ret_ = ret; CallData &data=reinterpret_cast(tmp->data_); data.callback=&callback; data.obj=node; return tmp; } }; #endif #endif template Slot2 retbind(const Slot2 &s, Ret ret) {return AdaptorRetBindSlot2::create(s.data(),ret); } /**************************************************************** ***** Adaptor RetBind Slot 3 arguments ****************************************************************/ template struct AdaptorRetBindSlot3: public AdaptorSlot_ { #ifdef SIGC_CXX_PARTIAL_SPEC typedef Ret RType; #else typedef typename Trait::type RType; #endif typedef Slot3 SlotType; typedef Slot3 InSlotType; struct Node:public AdaptorNode { Ret ret_; }; typedef CallDataObj2 CallData; static RType callback(void* d,P1 p1,P2 p2,P3 p3) { CallData* data=(CallData*)d; Node* node=data->obj; ((typename InSlotType::Callback&)(node->data_))(p1,p2,p3); return node->ret_; } static SlotData* create(SlotData *s,Ret ret) { SlotData* tmp=(SlotData*)s; Node *node=new Node(); copy_callback(tmp,node); node->ret_ = ret; CallData &data=reinterpret_cast(tmp->data_); data.callback=&callback; data.obj=node; return tmp; } }; #ifndef SIGC_CXX_VOID_RETURN #ifdef SIGC_CXX_PARTIAL_SPEC template struct AdaptorRetBindSlot3 : public AdaptorSlot_ { #ifdef SIGC_CXX_PARTIAL_SPEC typedef Ret RType; #else typedef typename Trait::type RType; #endif typedef Slot3 SlotType; typedef Slot3 InSlotType; struct Node:public AdaptorNode { Ret ret_; }; typedef CallDataObj2 CallData; static RType callback(void* d,P1 p1,P2 p2,P3 p3) { CallData* data=(CallData*)d; Node* node=data->obj; ((typename InSlotType::Callback&)(node->data_))(p1,p2,p3); return node->ret_; } static SlotData* create(SlotData *s,Ret ret) { SlotData* tmp=(SlotData*)s; Node *node=new Node(); copy_callback(tmp,node); node->ret_ = ret; CallData &data=reinterpret_cast(tmp->data_); data.callback=&callback; data.obj=node; return tmp; } }; #endif #endif template Slot3 retbind(const Slot3 &s, Ret ret) {return AdaptorRetBindSlot3::create(s.data(),ret); } /**************************************************************** ***** Adaptor RetBind Slot 4 arguments ****************************************************************/ template struct AdaptorRetBindSlot4: public AdaptorSlot_ { #ifdef SIGC_CXX_PARTIAL_SPEC typedef Ret RType; #else typedef typename Trait::type RType; #endif typedef Slot4 SlotType; typedef Slot4 InSlotType; struct Node:public AdaptorNode { Ret ret_; }; typedef CallDataObj2 CallData; static RType callback(void* d,P1 p1,P2 p2,P3 p3,P4 p4) { CallData* data=(CallData*)d; Node* node=data->obj; ((typename InSlotType::Callback&)(node->data_))(p1,p2,p3,p4); return node->ret_; } static SlotData* create(SlotData *s,Ret ret) { SlotData* tmp=(SlotData*)s; Node *node=new Node(); copy_callback(tmp,node); node->ret_ = ret; CallData &data=reinterpret_cast(tmp->data_); data.callback=&callback; data.obj=node; return tmp; } }; #ifndef SIGC_CXX_VOID_RETURN #ifdef SIGC_CXX_PARTIAL_SPEC template struct AdaptorRetBindSlot4 : public AdaptorSlot_ { #ifdef SIGC_CXX_PARTIAL_SPEC typedef Ret RType; #else typedef typename Trait::type RType; #endif typedef Slot4 SlotType; typedef Slot4 InSlotType; struct Node:public AdaptorNode { Ret ret_; }; typedef CallDataObj2 CallData; static RType callback(void* d,P1 p1,P2 p2,P3 p3,P4 p4) { CallData* data=(CallData*)d; Node* node=data->obj; ((typename InSlotType::Callback&)(node->data_))(p1,p2,p3,p4); return node->ret_; } static SlotData* create(SlotData *s,Ret ret) { SlotData* tmp=(SlotData*)s; Node *node=new Node(); copy_callback(tmp,node); node->ret_ = ret; CallData &data=reinterpret_cast(tmp->data_); data.callback=&callback; data.obj=node; return tmp; } }; #endif #endif template Slot4 retbind(const Slot4 &s, Ret ret) {return AdaptorRetBindSlot4::create(s.data(),ret); } /**************************************************************** ***** Adaptor RetBind Slot 5 arguments ****************************************************************/ template struct AdaptorRetBindSlot5: public AdaptorSlot_ { #ifdef SIGC_CXX_PARTIAL_SPEC typedef Ret RType; #else typedef typename Trait::type RType; #endif typedef Slot5 SlotType; typedef Slot5 InSlotType; struct Node:public AdaptorNode { Ret ret_; }; typedef CallDataObj2 CallData; static RType callback(void* d,P1 p1,P2 p2,P3 p3,P4 p4,P5 p5) { CallData* data=(CallData*)d; Node* node=data->obj; ((typename InSlotType::Callback&)(node->data_))(p1,p2,p3,p4,p5); return node->ret_; } static SlotData* create(SlotData *s,Ret ret) { SlotData* tmp=(SlotData*)s; Node *node=new Node(); copy_callback(tmp,node); node->ret_ = ret; CallData &data=reinterpret_cast(tmp->data_); data.callback=&callback; data.obj=node; return tmp; } }; #ifndef SIGC_CXX_VOID_RETURN #ifdef SIGC_CXX_PARTIAL_SPEC template struct AdaptorRetBindSlot5 : public AdaptorSlot_ { #ifdef SIGC_CXX_PARTIAL_SPEC typedef Ret RType; #else typedef typename Trait::type RType; #endif typedef Slot5 SlotType; typedef Slot5 InSlotType; struct Node:public AdaptorNode { Ret ret_; }; typedef CallDataObj2 CallData; static RType callback(void* d,P1 p1,P2 p2,P3 p3,P4 p4,P5 p5) { CallData* data=(CallData*)d; Node* node=data->obj; ((typename InSlotType::Callback&)(node->data_))(p1,p2,p3,p4,p5); return node->ret_; } static SlotData* create(SlotData *s,Ret ret) { SlotData* tmp=(SlotData*)s; Node *node=new Node(); copy_callback(tmp,node); node->ret_ = ret; CallData &data=reinterpret_cast(tmp->data_); data.callback=&callback; data.obj=node; return tmp; } }; #endif #endif template Slot5 retbind(const Slot5 &s, Ret ret) {return AdaptorRetBindSlot5::create(s.data(),ret); } /**************************************************************** ***** Adaptor RetBind Slot 6 arguments ****************************************************************/ template struct AdaptorRetBindSlot6: public AdaptorSlot_ { #ifdef SIGC_CXX_PARTIAL_SPEC typedef Ret RType; #else typedef typename Trait::type RType; #endif typedef Slot6 SlotType; typedef Slot6 InSlotType; struct Node:public AdaptorNode { Ret ret_; }; typedef CallDataObj2 CallData; static RType callback(void* d,P1 p1,P2 p2,P3 p3,P4 p4,P5 p5,P6 p6) { CallData* data=(CallData*)d; Node* node=data->obj; ((typename InSlotType::Callback&)(node->data_))(p1,p2,p3,p4,p5,p6); return node->ret_; } static SlotData* create(SlotData *s,Ret ret) { SlotData* tmp=(SlotData*)s; Node *node=new Node(); copy_callback(tmp,node); node->ret_ = ret; CallData &data=reinterpret_cast(tmp->data_); data.callback=&callback; data.obj=node; return tmp; } }; #ifndef SIGC_CXX_VOID_RETURN #ifdef SIGC_CXX_PARTIAL_SPEC template struct AdaptorRetBindSlot6 : public AdaptorSlot_ { #ifdef SIGC_CXX_PARTIAL_SPEC typedef Ret RType; #else typedef typename Trait::type RType; #endif typedef Slot6 SlotType; typedef Slot6 InSlotType; struct Node:public AdaptorNode { Ret ret_; }; typedef CallDataObj2 CallData; static RType callback(void* d,P1 p1,P2 p2,P3 p3,P4 p4,P5 p5,P6 p6) { CallData* data=(CallData*)d; Node* node=data->obj; ((typename InSlotType::Callback&)(node->data_))(p1,p2,p3,p4,p5,p6); return node->ret_; } static SlotData* create(SlotData *s,Ret ret) { SlotData* tmp=(SlotData*)s; Node *node=new Node(); copy_callback(tmp,node); node->ret_ = ret; CallData &data=reinterpret_cast(tmp->data_); data.callback=&callback; data.obj=node; return tmp; } }; #endif #endif template Slot6 retbind(const Slot6 &s, Ret ret) {return AdaptorRetBindSlot6::create(s.data(),ret); } /**************************************************************** ***** Adaptor RetBind Slot 7 arguments ****************************************************************/ template struct AdaptorRetBindSlot7: public AdaptorSlot_ { #ifdef SIGC_CXX_PARTIAL_SPEC typedef Ret RType; #else typedef typename Trait::type RType; #endif typedef Slot7 SlotType; typedef Slot7 InSlotType; struct Node:public AdaptorNode { Ret ret_; }; typedef CallDataObj2 CallData; static RType callback(void* d,P1 p1,P2 p2,P3 p3,P4 p4,P5 p5,P6 p6,P7 p7) { CallData* data=(CallData*)d; Node* node=data->obj; ((typename InSlotType::Callback&)(node->data_))(p1,p2,p3,p4,p5,p6,p7); return node->ret_; } static SlotData* create(SlotData *s,Ret ret) { SlotData* tmp=(SlotData*)s; Node *node=new Node(); copy_callback(tmp,node); node->ret_ = ret; CallData &data=reinterpret_cast(tmp->data_); data.callback=&callback; data.obj=node; return tmp; } }; #ifndef SIGC_CXX_VOID_RETURN #ifdef SIGC_CXX_PARTIAL_SPEC template struct AdaptorRetBindSlot7 : public AdaptorSlot_ { #ifdef SIGC_CXX_PARTIAL_SPEC typedef Ret RType; #else typedef typename Trait::type RType; #endif typedef Slot7 SlotType; typedef Slot7 InSlotType; struct Node:public AdaptorNode { Ret ret_; }; typedef CallDataObj2 CallData; static RType callback(void* d,P1 p1,P2 p2,P3 p3,P4 p4,P5 p5,P6 p6,P7 p7) { CallData* data=(CallData*)d; Node* node=data->obj; ((typename InSlotType::Callback&)(node->data_))(p1,p2,p3,p4,p5,p6,p7); return node->ret_; } static SlotData* create(SlotData *s,Ret ret) { SlotData* tmp=(SlotData*)s; Node *node=new Node(); copy_callback(tmp,node); node->ret_ = ret; CallData &data=reinterpret_cast(tmp->data_); data.callback=&callback; data.obj=node; return tmp; } }; #endif #endif template Slot7 retbind(const Slot7 &s, Ret ret) {return AdaptorRetBindSlot7::create(s.data(),ret); } #ifdef SIGC_CXX_NAMESPACES } // namespace #endif #endif