summaryrefslogtreecommitdiffstats
path: root/src/Net/Signals
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2009-06-09 19:01:02 +0200
committerMatthias Schiffer <matthias@gamezock.de>2009-06-09 19:01:02 +0200
commit766c56a693e8b1bd4293459bb256abdc0515a0b5 (patch)
treeda8e51003cf801344e22b0b2b2e28a48d6a8b74c /src/Net/Signals
parent452320b5ec31447a526735016fa07589cb848032 (diff)
downloadmad-766c56a693e8b1bd4293459bb256abdc0515a0b5.tar
mad-766c56a693e8b1bd4293459bb256abdc0515a0b5.zip
Teile der Namespaces Common und Net in den neuen Namespace Core verschoben
Diffstat (limited to 'src/Net/Signals')
-rw-r--r--src/Net/Signals/Connection.h53
-rw-r--r--src/Net/Signals/GenericSignal.h61
-rw-r--r--src/Net/Signals/Signal0.h46
-rw-r--r--src/Net/Signals/Signal1.h47
-rw-r--r--src/Net/Signals/Signal2.h47
-rw-r--r--src/Net/Signals/SignalBase.h53
-rw-r--r--src/Net/Signals/Signals.h27
7 files changed, 0 insertions, 334 deletions
diff --git a/src/Net/Signals/Connection.h b/src/Net/Signals/Connection.h
deleted file mode 100644
index 7730e13..0000000
--- a/src/Net/Signals/Connection.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Connection.h
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * 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 the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MAD_NET_SIGNALS_CONNECTION_H_
-#define MAD_NET_SIGNALS_CONNECTION_H_
-
-namespace Mad {
-namespace Net {
-namespace Signals {
-
-class SignalBase;
-
-class Connection {
- private:
- friend class SignalBase;
-
- SignalBase *signal;
- unsigned long id;
-
- Connection(SignalBase *signal0, unsigned long id0)
- : signal(signal0), id(id0) {}
-
- public:
- bool operator==(const Connection &o) const {
- return (signal == o.signal && id == o.id);
- }
-
- bool operator<(const Connection &o) const {
- return (signal != o.signal) ? (signal < o.signal) : (id < o.id);
- }
-};
-
-}
-}
-}
-
-#endif /* MAD_NET_SIGNALS_CONNECTION_H_ */
diff --git a/src/Net/Signals/GenericSignal.h b/src/Net/Signals/GenericSignal.h
deleted file mode 100644
index aa6cfa1..0000000
--- a/src/Net/Signals/GenericSignal.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * GenericSignal.h
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * 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 the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MAD_NET_SIGNALS_GENERICSIGNAL_H_
-#define MAD_NET_SIGNALS_GENERICSIGNAL_H_
-
-#include "SignalBase.h"
-
-#include <map>
-#include <boost/thread/locks.hpp>
-
-namespace Mad {
-namespace Net {
-namespace Signals {
-
-template <typename FunctionType>
-class GenericSignal : protected SignalBase {
- public:
- typedef FunctionType slot_type;
-
- protected:
- std::map<Connection, slot_type> handlers;
-
- public:
- Connection connect(const slot_type &slot) {
- boost::lock_guard<boost::mutex> lock(mutex);
-
- Connection con = getNewConnection();
- handlers.insert(std::make_pair(con, slot));
-
- return con;
- }
-
- bool disconnect(const Connection &connection) {
- boost::lock_guard<boost::mutex> lock(mutex);
-
- return handlers.erase(connection);
- }
-};
-
-}
-}
-}
-
-#endif /* MAD_NET_SIGNALS_GENERICSIGNAL_H_ */
diff --git a/src/Net/Signals/Signal0.h b/src/Net/Signals/Signal0.h
deleted file mode 100644
index 5c0a691..0000000
--- a/src/Net/Signals/Signal0.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Signal0.h
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * 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 the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MAD_NET_SIGNALS_SIGNAL0_H_
-#define MAD_NET_SIGNALS_SIGNAL0_H_
-
-#include "GenericSignal.h"
-#include <Net/ThreadManager.h>
-
-#include <boost/function.hpp>
-
-namespace Mad {
-namespace Net {
-namespace Signals {
-
-class Signal0 : public GenericSignal<boost::function0<void> > {
- public:
- void emit() {
- boost::lock_guard<boost::mutex> lock(mutex);
-
- for(std::map<Connection, slot_type>::iterator handler = handlers.begin(); handler != handlers.end(); ++handler)
- Net::ThreadManager::get()->pushWork(handler->second);
- }
-};
-
-}
-}
-}
-
-#endif /* MAD_NET_SIGNALS_SIGNAL0_H_ */
diff --git a/src/Net/Signals/Signal1.h b/src/Net/Signals/Signal1.h
deleted file mode 100644
index 331c5cb..0000000
--- a/src/Net/Signals/Signal1.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Signal1.h
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * 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 the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MAD_NET_SIGNALS_SIGNAL1_H_
-#define MAD_NET_SIGNALS_SIGNAL1_H_
-
-#include "GenericSignal.h"
-#include <Net/ThreadManager.h>
-
-#include <boost/function.hpp>
-
-namespace Mad {
-namespace Net {
-namespace Signals {
-
-template <typename T1>
-class Signal1 : public GenericSignal<boost::function1<void, T1> > {
- public:
- void emit(T1 arg1) {
- boost::lock_guard<boost::mutex> lock(this->mutex);
-
- for(typename std::map<Connection, typename GenericSignal<boost::function1<void, T1> >::slot_type>::iterator handler = this->handlers.begin(); handler != this->handlers.end(); ++handler)
- Net::ThreadManager::get()->pushWork(boost::bind(handler->second, arg1));
- }
-};
-
-}
-}
-}
-
-#endif /* MAD_NET_SIGNALS_SIGNAL1_H_ */
diff --git a/src/Net/Signals/Signal2.h b/src/Net/Signals/Signal2.h
deleted file mode 100644
index 3fb9315..0000000
--- a/src/Net/Signals/Signal2.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Signal2.h
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * 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 the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MAD_NET_SIGNALS_SIGNAL2_H_
-#define MAD_NET_SIGNALS_SIGNAL2_H_
-
-#include "GenericSignal.h"
-#include <Net/ThreadManager.h>
-
-#include <boost/function.hpp>
-
-namespace Mad {
-namespace Net {
-namespace Signals {
-
-template <typename T1, typename T2>
-class Signal2 : public GenericSignal<boost::function2<void, T1, T2> > {
- public:
- void emit(T1 arg1, T2 arg2) {
- boost::lock_guard<boost::mutex> lock(this->mutex);
-
- for(typename std::map<Connection, typename GenericSignal<boost::function2<void, T1, T2> >::slot_type>::iterator handler = this->handlers.begin(); handler != this->handlers.end(); ++handler)
- Net::ThreadManager::get()->pushWork(boost::bind(handler->second, arg1, arg2));
- }
-};
-
-}
-}
-}
-
-#endif /* MAD_NET_SIGNALS_SIGNAL2_H_ */
diff --git a/src/Net/Signals/SignalBase.h b/src/Net/Signals/SignalBase.h
deleted file mode 100644
index ea1b1e9..0000000
--- a/src/Net/Signals/SignalBase.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * SignalBase.h
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * 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 the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MAD_SIGNALS_SIGNALBASE_H_
-#define MAD_SIGNALS_SIGNALBASE_H_
-
-#include "Connection.h"
-
-#include <set>
-#include <boost/thread/mutex.hpp>
-
-namespace Mad {
-namespace Net {
-namespace Signals {
-
-class SignalBase : private boost::noncopyable {
- private:
- friend class Connection;
-
- unsigned long connectionId;
-
- protected:
- boost::mutex mutex;
-
- Connection getNewConnection() {
- return Connection(this, connectionId++);
- }
-
- SignalBase() : connectionId(0) {}
- virtual ~SignalBase() {}
-};
-
-}
-}
-}
-
-#endif /* MAD_SIGNALS_SIGNALBASE_H_ */
diff --git a/src/Net/Signals/Signals.h b/src/Net/Signals/Signals.h
deleted file mode 100644
index 4ee4f95..0000000
--- a/src/Net/Signals/Signals.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Signals.h
- *
- * Copyright (C) 2009 Matthias Schiffer <matthias@gamezock.de>
- *
- * 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 the
- * Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MAD_SIGNALS_SIGNALS_H_
-#define MAD_SIGNALS_SIGNALS_H_
-
-#include "Signal0.h"
-#include "Signal1.h"
-#include "Signal2.h"
-
-#endif /* MAD_SIGNALS_SIGNALS_H_ */