You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef VPE_CALLBACK_H__
-#define VPE_CALLBACK_H__
+#ifndef CALLBACK_H__
+#define CALLBACK_H__
template<class R>
class callback0 {
struct object { };
void *obj;
- R (object::*meth)();
+ R (object::*meth) ();
/* a proxy is a kind of recipe on how to call a specific class method */
struct proxy_base {
- virtual R call (void *obj, R (object::*meth)()) = 0;
+ virtual R call (void *obj, R (object::*meth) ()) = 0;
};
template<class O1, class O2>
struct proxy : proxy_base {
- virtual R call (void *obj, R (object::*meth)())
+ virtual R call (void *obj, R (object::*meth) ())
{
- ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)()>(meth)))
+ ((reinterpret_cast<O1 *> (obj)) ->* (reinterpret_cast<R (O2::*) ()> (meth)))
();
}
};
public:
template<class O1, class O2>
- callback0 (O1 *object, R (O2::*method)())
+ callback0 (O1 *object, R (O2::*method) ())
{
static proxy<O1,O2> p;
- obj = reinterpret_cast<void *>(object);
- meth = reinterpret_cast<R (object::*)()>(method);
+ obj = reinterpret_cast<void *> (object);
+ meth = reinterpret_cast<R (object::*) ()> (method);
prxy = &p;
}
- R call() const
+ R call () const
{
return prxy->call (obj, meth);
}
- R operator ()() const
+ R operator () () const
{
return call ();
}
struct object { };
void *obj;
- R (object::*meth)(A1);
+ R (object::*meth) (A1);
/* a proxy is a kind of recipe on how to call a specific class method */
struct proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1), A1 a1) = 0;
+ virtual R call (void *obj, R (object::*meth) (A1), A1 a1) = 0;
};
template<class O1, class O2>
struct proxy : proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1), A1 a1)
+ virtual R call (void *obj, R (object::*meth) (A1), A1 a1)
{
- ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1)>(meth)))
+ ((reinterpret_cast<O1 *> (obj)) ->* (reinterpret_cast<R (O2::*) (A1)> (meth)))
(a1);
}
};
public:
template<class O1, class O2>
- callback1 (O1 *object, R (O2::*method)(A1))
+ callback1 (O1 *object, R (O2::*method) (A1))
{
static proxy<O1,O2> p;
- obj = reinterpret_cast<void *>(object);
- meth = reinterpret_cast<R (object::*)(A1)>(method);
+ obj = reinterpret_cast<void *> (object);
+ meth = reinterpret_cast<R (object::*) (A1)> (method);
prxy = &p;
}
- R call(A1 a1) const
+ R call (A1 a1) const
{
return prxy->call (obj, meth, a1);
}
- R operator ()(A1 a1) const
+ R operator () (A1 a1) const
{
return call (a1);
}
struct object { };
void *obj;
- R (object::*meth)(A1, A2);
+ R (object::*meth) (A1, A2);
/* a proxy is a kind of recipe on how to call a specific class method */
struct proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2), A1 a1, A2 a2) = 0;
+ virtual R call (void *obj, R (object::*meth) (A1, A2), A1 a1, A2 a2) = 0;
};
template<class O1, class O2>
struct proxy : proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2), A1 a1, A2 a2)
+ virtual R call (void *obj, R (object::*meth) (A1, A2), A1 a1, A2 a2)
{
- ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2)>(meth)))
+ ((reinterpret_cast<O1 *> (obj)) ->* (reinterpret_cast<R (O2::*) (A1, A2)> (meth)))
(a1, a2);
}
};
public:
template<class O1, class O2>
- callback2 (O1 *object, R (O2::*method)(A1, A2))
+ callback2 (O1 *object, R (O2::*method) (A1, A2))
{
static proxy<O1,O2> p;
- obj = reinterpret_cast<void *>(object);
- meth = reinterpret_cast<R (object::*)(A1, A2)>(method);
+ obj = reinterpret_cast<void *> (object);
+ meth = reinterpret_cast<R (object::*) (A1, A2)> (method);
prxy = &p;
}
- R call(A1 a1, A2 a2) const
+ R call (A1 a1, A2 a2) const
{
return prxy->call (obj, meth, a1, a2);
}
- R operator ()(A1 a1, A2 a2) const
+ R operator () (A1 a1, A2 a2) const
{
return call (a1, a2);
}
struct object { };
void *obj;
- R (object::*meth)(A1, A2, A3);
+ R (object::*meth) (A1, A2, A3);
/* a proxy is a kind of recipe on how to call a specific class method */
struct proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2, A3), A1 a1, A2 a2, A3 a3) = 0;
+ virtual R call (void *obj, R (object::*meth) (A1, A2, A3), A1 a1, A2 a2, A3 a3) = 0;
};
template<class O1, class O2>
struct proxy : proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2, A3), A1 a1, A2 a2, A3 a3)
+ virtual R call (void *obj, R (object::*meth) (A1, A2, A3), A1 a1, A2 a2, A3 a3)
{
- ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3)>(meth)))
+ ((reinterpret_cast<O1 *> (obj)) ->* (reinterpret_cast<R (O2::*) (A1, A2, A3)> (meth)))
(a1, a2, a3);
}
};
public:
template<class O1, class O2>
- callback3 (O1 *object, R (O2::*method)(A1, A2, A3))
+ callback3 (O1 *object, R (O2::*method) (A1, A2, A3))
{
static proxy<O1,O2> p;
- obj = reinterpret_cast<void *>(object);
- meth = reinterpret_cast<R (object::*)(A1, A2, A3)>(method);
+ obj = reinterpret_cast<void *> (object);
+ meth = reinterpret_cast<R (object::*) (A1, A2, A3)> (method);
prxy = &p;
}
- R call(A1 a1, A2 a2, A3 a3) const
+ R call (A1 a1, A2 a2, A3 a3) const
{
return prxy->call (obj, meth, a1, a2, a3);
}
- R operator ()(A1 a1, A2 a2, A3 a3) const
+ R operator () (A1 a1, A2 a2, A3 a3) const
{
return call (a1, a2, a3);
}
struct object { };
void *obj;
- R (object::*meth)(A1, A2, A3, A4);
+ R (object::*meth) (A1, A2, A3, A4);
/* a proxy is a kind of recipe on how to call a specific class method */
struct proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4), A1 a1, A2 a2, A3 a3, A4 a4) = 0;
+ virtual R call (void *obj, R (object::*meth) (A1, A2, A3, A4), A1 a1, A2 a2, A3 a3, A4 a4) = 0;
};
template<class O1, class O2>
struct proxy : proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4), A1 a1, A2 a2, A3 a3, A4 a4)
+ virtual R call (void *obj, R (object::*meth) (A1, A2, A3, A4), A1 a1, A2 a2, A3 a3, A4 a4)
{
- ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3, A4)>(meth)))
+ ((reinterpret_cast<O1 *> (obj)) ->* (reinterpret_cast<R (O2::*) (A1, A2, A3, A4)> (meth)))
(a1, a2, a3, a4);
}
};
public:
template<class O1, class O2>
- callback4 (O1 *object, R (O2::*method)(A1, A2, A3, A4))
+ callback4 (O1 *object, R (O2::*method) (A1, A2, A3, A4))
{
static proxy<O1,O2> p;
- obj = reinterpret_cast<void *>(object);
- meth = reinterpret_cast<R (object::*)(A1, A2, A3, A4)>(method);
+ obj = reinterpret_cast<void *> (object);
+ meth = reinterpret_cast<R (object::*) (A1, A2, A3, A4)> (method);
prxy = &p;
}
- R call(A1 a1, A2 a2, A3 a3, A4 a4) const
+ R call (A1 a1, A2 a2, A3 a3, A4 a4) const
{
return prxy->call (obj, meth, a1, a2, a3, a4);
}
- R operator ()(A1 a1, A2 a2, A3 a3, A4 a4) const
+ R operator () (A1 a1, A2 a2, A3 a3, A4 a4) const
{
return call (a1, a2, a3, a4);
}
struct object { };
void *obj;
- R (object::*meth)(A1, A2, A3, A4, A5);
+ R (object::*meth) (A1, A2, A3, A4, A5);
/* a proxy is a kind of recipe on how to call a specific class method */
struct proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) = 0;
+ virtual R call (void *obj, R (object::*meth) (A1, A2, A3, A4, A5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) = 0;
};
template<class O1, class O2>
struct proxy : proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
+ virtual R call (void *obj, R (object::*meth) (A1, A2, A3, A4, A5), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
{
- ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3, A4, A5)>(meth)))
+ ((reinterpret_cast<O1 *> (obj)) ->* (reinterpret_cast<R (O2::*) (A1, A2, A3, A4, A5)> (meth)))
(a1, a2, a3, a4, a5);
}
};
public:
template<class O1, class O2>
- callback5 (O1 *object, R (O2::*method)(A1, A2, A3, A4, A5))
+ callback5 (O1 *object, R (O2::*method) (A1, A2, A3, A4, A5))
{
static proxy<O1,O2> p;
- obj = reinterpret_cast<void *>(object);
- meth = reinterpret_cast<R (object::*)(A1, A2, A3, A4, A5)>(method);
+ obj = reinterpret_cast<void *> (object);
+ meth = reinterpret_cast<R (object::*) (A1, A2, A3, A4, A5)> (method);
prxy = &p;
}
- R call(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
+ R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
{
return prxy->call (obj, meth, a1, a2, a3, a4, a5);
}
- R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
+ R operator () (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const
{
return call (a1, a2, a3, a4, a5);
}
struct object { };
void *obj;
- R (object::*meth)(A1, A2, A3, A4, A5, A6);
+ R (object::*meth) (A1, A2, A3, A4, A5, A6);
/* a proxy is a kind of recipe on how to call a specific class method */
struct proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5, A6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) = 0;
+ virtual R call (void *obj, R (object::*meth) (A1, A2, A3, A4, A5, A6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) = 0;
};
template<class O1, class O2>
struct proxy : proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5, A6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
+ virtual R call (void *obj, R (object::*meth) (A1, A2, A3, A4, A5, A6), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
{
- ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3, A4, A5, A6)>(meth)))
+ ((reinterpret_cast<O1 *> (obj)) ->* (reinterpret_cast<R (O2::*) (A1, A2, A3, A4, A5, A6)> (meth)))
(a1, a2, a3, a4, a5, a6);
}
};
public:
template<class O1, class O2>
- callback6 (O1 *object, R (O2::*method)(A1, A2, A3, A4, A5, A6))
+ callback6 (O1 *object, R (O2::*method) (A1, A2, A3, A4, A5, A6))
{
static proxy<O1,O2> p;
- obj = reinterpret_cast<void *>(object);
- meth = reinterpret_cast<R (object::*)(A1, A2, A3, A4, A5, A6)>(method);
+ obj = reinterpret_cast<void *> (object);
+ meth = reinterpret_cast<R (object::*) (A1, A2, A3, A4, A5, A6)> (method);
prxy = &p;
}
- R call(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
+ R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
{
return prxy->call (obj, meth, a1, a2, a3, a4, a5, a6);
}
- R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
+ R operator () (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const
{
return call (a1, a2, a3, a4, a5, a6);
}
struct object { };
void *obj;
- R (object::*meth)(A1, A2, A3, A4, A5, A6, A7);
+ R (object::*meth) (A1, A2, A3, A4, A5, A6, A7);
/* a proxy is a kind of recipe on how to call a specific class method */
struct proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5, A6, A7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) = 0;
+ virtual R call (void *obj, R (object::*meth) (A1, A2, A3, A4, A5, A6, A7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) = 0;
};
template<class O1, class O2>
struct proxy : proxy_base {
- virtual R call (void *obj, R (object::*meth)(A1, A2, A3, A4, A5, A6, A7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
+ virtual R call (void *obj, R (object::*meth) (A1, A2, A3, A4, A5, A6, A7), A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
{
- ((reinterpret_cast<O1 *>(obj)) ->* (reinterpret_cast<R (O2::*)(A1, A2, A3, A4, A5, A6, A7)>(meth)))
+ ((reinterpret_cast<O1 *> (obj)) ->* (reinterpret_cast<R (O2::*) (A1, A2, A3, A4, A5, A6, A7)> (meth)))
(a1, a2, a3, a4, a5, a6, a7);
}
};
public:
template<class O1, class O2>
- callback7 (O1 *object, R (O2::*method)(A1, A2, A3, A4, A5, A6, A7))
+ callback7 (O1 *object, R (O2::*method) (A1, A2, A3, A4, A5, A6, A7))
{
static proxy<O1,O2> p;
- obj = reinterpret_cast<void *>(object);
- meth = reinterpret_cast<R (object::*)(A1, A2, A3, A4, A5, A6, A7)>(method);
+ obj = reinterpret_cast<void *> (object);
+ meth = reinterpret_cast<R (object::*) (A1, A2, A3, A4, A5, A6, A7)> (method);
prxy = &p;
}
- R call(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
+ R call (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
{
return prxy->call (obj, meth, a1, a2, a3, a4, a5, a6, a7);
}
- R operator ()(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
+ R operator () (A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const
{
return call (a1, a2, a3, a4, a5, a6, a7);
}