/*
- Copyright (C) 1998-99 Paul Barton-Davis
+ Copyright (C) 1998-99 Paul Barton-Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <vector>
-#include <pbd/receiver.h>
-#include <pbd/transmitter.h>
+#include "pbd/receiver.h"
+#include "pbd/transmitter.h"
+using namespace std;
using namespace sigc;
Receiver::Receiver () {}
void
Receiver::hangup ()
{
- vector<sigc::connection *>::iterator i;
-
- for (i = connections.begin(); i != connections.end (); i++) {
- (*i)->disconnect ();
- delete *i;
- }
-
- connections.erase (connections.begin(), connections.end());
+ connections.drop_connections ();
}
void
Receiver::listen_to (Transmitter &transmitter)
{
- sigc::connection *c = new sigc::connection;
-
- (*c) = transmitter.sender().connect(mem_fun(*this, &Receiver::receive));
+ /* odd syntax here because boost's placeholders (_1, _2) are in an
+ anonymous namespace which causes ambiguity with sigc++ (and will also
+ do so with std::placeholder in the C++11 future
+ */
+ transmitter.sender().connect_same_thread (connections, boost::bind (&Receiver::receive, this, boost::arg<1>(), boost::arg<2>()));
- connections.push_back (c);
}