Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# bind.h

Go to the documentation of this file.

    00001 /*  Inti: Integrated Foundation Classes
    00002  *  Copyright (C) 2002 The Inti Development Team.
    00003  *  Copyright (C) 2000 Red Hat, Inc.
    00004  *
    00005  *  This program is free software; you can redistribute it and/or modify
    00006  *  it under the terms of the GNU General Public License as published by
    00007  *  the Free Software Foundation; either version 2 of the License, or
    00008  *  (at your option) any later version.
    00009  *
    00010  *  This program is distributed in the hope that it will be useful,
    00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00013  *  GNU Library General Public License for more details.
    00014  *
    00015  *  You should have received a copy of the GNU Library General Public License
    00016  *  along with this program; if not, write to the Free Software
    00017  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00018  */
    00019
    00027
    00028 #ifndef INTI_BOUND_SLOT_H
    00029 #define INTI_BOUND_SLOT_H
    00030
    00031 #ifndef INTI_SLOT_H
    00032 #include <inti/slot.h>
    00033 #endif
    00034
    00035 namespace Inti {
    00036
    00039
    00042
    00043 template<typename R, typename P1>
    00044 class BoundSlot0_1 : public Slot0<R>
    00045 {
    00046         Slot1<R, P1> *original_slot;
    00047         P1 p;
    00048
    00049 public:
    00050         BoundSlot0_1(Slot1<R, P1> *slot, P1 p1) : original_slot(slot), p(p1) {}
    00054
    00055         virtual ~BoundSlot0_1() { original_slot->unref(); }
    00057
    00058         virtual R call() const { return original_slot->call(p); }
    00060 };
    00061
    00072
    00073 template<typename R, typename P1>
    00074 inline Slot0<R>*
    00075 bind(Slot1<R, P1> *s, P1 p1)
    00076 {
    00077         return new BoundSlot0_1<R, P1>(s, p1);
    00078 }
    00079
    00082
    00083 template<typename R, typename P1, typename P2>
    00084 class BoundSlot1_2 : public Slot1<R, P1>
    00085 {
    00086         Slot2<R, P1, P2> *original_slot;
    00087         P2 p;
    00088
    00089 public:
    00090         BoundSlot1_2(Slot2<R, P1, P2> *slot, P2 p2) : original_slot(slot), p(p2) {}
    00094
    00095         virtual ~BoundSlot1_2() { original_slot->unref(); }
    00097
    00098         virtual R call(P1 p1) const { return original_slot->call(p1, p); }
    00100 };
    00101
    00112
    00113 template<typename R, typename P1, typename P2>
    00114 inline Slot1<R, P1>*
    00115 bind(Slot2<R, P1, P2> *s, P2 p2)
    00116 {
    00117         return new BoundSlot1_2<R, P1, P2>(s, p2);
    00118 }
    00119
    00122
    00123 template<typename R, typename P1, typename P2, typename P3>
    00124 class BoundSlot2_3 : public Slot2<R, P1, P2>
    00125 {
    00126         Slot3<R, P1, P2, P3> *original_slot;
    00127         P3 p;
    00128
    00129 public:
    00130         BoundSlot2_3(Slot3<R, P1, P2, P3> *slot, P3 p3) : original_slot(slot), p(p3) {}
    00134
    00135         virtual ~BoundSlot2_3() { original_slot->unref(); }
    00137
    00138         virtual R call(P1 p1, P2 p2) const { return original_slot->call(p1, p2, p); }
    00140 };
    00141
    00152
    00153 template<typename R, typename P1, typename P2, typename P3>
    00154 inline Slot2<R, P1, P2>*
    00155 bind(Slot3<R, P1, P2, P3> *s, P3 p3)
    00156 {
    00157         return new BoundSlot2_3<R, P1, P2, P3>(s, p3);
    00158 }
    00159
    00162
    00163 template<typename R, typename P1, typename P2, typename P3, typename P4>
    00164 class BoundSlot3_4 : public Slot3<R, P1, P2, P3>
    00165 {
    00166         Slot4<R, P1, P2, P3, P4> *original_slot;
    00167         P4 p;
    00168
    00169 public:
    00170         BoundSlot3_4(Slot4<R, P1, P2, P3, P4> *slot, P4 p4) : original_slot(slot), p(p4) {}
    00174
    00175         virtual ~BoundSlot3_4() { original_slot->unref(); }
    00177
    00178         virtual R call(P1 p1, P2 p2, P3 p3) const { return original_slot->call(p1, p2, p3, p); }
    00180 };
    00181
    00192
    00193 template<typename R, typename P1, typename P2, typename P3, typename P4>
    00194 inline Slot3<R, P1, P2, P3>*
    00195 bind(Slot4<R, P1, P2, P3, P4> *s, P4 p4)
    00196 {
    00197         return new BoundSlot3_4<R, P1, P2, P3, P4>(s, p4);
    00198 }
    00199
    00202
    00203 template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5>
    00204 class BoundSlot4_5 : public Slot4<R, P1, P2, P3, P4>
    00205 {
    00206         Slot5<R, P1, P2, P3, P4, P5> *original_slot;
    00207         P5 p;
    00208
    00209 public:
    00210         BoundSlot4_5(Slot5<R, P1, P2, P3, P4, P5> *slot, P5 p5) : original_slot(slot), p(p5) {}
    00214
    00215         virtual ~BoundSlot4_5() { original_slot->unref(); }
    00217
    00218         virtual R call(P1 p1, P2 p2, P3 p3, P4 p4) const { return original_slot->call(p1, p2, p3, p4, p); }
    00220 };
    00221
    00232
    00233 template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5>
    00234 inline Slot4<R, P1, P2, P3, P4>*
    00235 bind(Slot5<R, P1, P2, P3, P4, P5> *s, P5 p5)
    00236 {
    00237         return new BoundSlot4_5<R, P1, P2, P3, P4, P5>(s, p5);
    00238 }
    00239
    00242
    00243 template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
    00244 class BoundSlot5_6 : public Slot5<R, P1, P2, P3, P4, P5>
    00245 {
    00246         Slot6<R, P1, P2, P3, P4, P5, P6> *original_slot;
    00247         P6 p;
    00248
    00249 public:
    00250         BoundSlot5_6(Slot6<R, P1, P2, P3, P4, P5, P6> *slot, P6 p6) : original_slot(slot), p(p6) {}
    00254
    00255         virtual ~BoundSlot5_6() { original_slot->unref(); }
    00257
    00258         virtual R call(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) const { return original_slot->call(p1, p2, p3, p4, p5, p); }
    00260 };
    00261
    00272
    00273 template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
    00274 inline Slot5<R, P1, P2, P3, P4, P5>*
    00275 bind(Slot6<R, P1, P2, P3, P4, P5, P6> *s, P6 p6)
    00276 {
    00277         return new BoundSlot5_6<R, P1, P2, P3, P4, P5, P6>(s, p6);
    00278 }
    00279
    00281
    00282 } // namespace Inti
    00283
    00284 #endif // INTI_BOUND_SLOT_H
    00285

Main Page - Footer