[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Usata-commits] Changes to usata2/src/input-system.cpp
From: |
David Lau |
Subject: |
[Usata-commits] Changes to usata2/src/input-system.cpp |
Date: |
Tue, 25 Jan 2005 03:28:28 -0500 |
Index: usata2/src/input-system.cpp
diff -u usata2/src/input-system.cpp:1.1 usata2/src/input-system.cpp:1.2
--- usata2/src/input-system.cpp:1.1 Fri Jan 21 23:02:37 2005
+++ usata2/src/input-system.cpp Tue Jan 25 08:28:27 2005
@@ -10,8 +10,99 @@
// included in the software distribution, or visit
// http://www.fsf.org/licenses/gpl.html.
//
-// $Id: input-system.cpp,v 1.1 2005/01/21 23:02:37 skunix Exp $
-
+// $Id: input-system.cpp,v 1.2 2005/01/25 08:28:27 skunix Exp $
+#include <vector>
+#include <algorithm>
+#include <boost/shared_ptr.hpp>
+#include <boost/bind.hpp>
#include "input-system.hpp"
+namespace usata
+{
+namespace input
+{
+
+typedef boost::shared_ptr<Driver> Driver_sp;
+
+
+Event::Event(int type_)
+: mType (type_)
+{
+
+}
+Driver::Driver(const std::string& name)
+: mName(name)
+{
+}
+
+Driver::~Driver() throw()
+{
+ return;
+}
+
+Manager::Manager()
+{
+
+}
+
+void
+Manager::trim()
+{
+
+ mDrivers.swap(mDrivers);
+}
+
+void
+Manager::process()
+{
+ std::for_each(mDrivers.begin(), mDrivers.end(),
+ boost::bind(&Driver::update,
boost::bind(&Driver_sp::get,_1)));
+
+ DriversV::iterator it = mDrivers.begin(), it_end=mDrivers.end();
+
+ Event *ne;
+
+ while (it!= it_end)
+ {
+ while (1)
+ {
+ ne = (*it)->next();
+ if (ne == 0)
+ break;
+
+ if (ne->type() == input::Type::SYSTEM)
+ {
+ SystemEvent *se =
dynamic_cast<SystemEvent*>(ne);
+ if (se)
+ {
+ if (se->se_type()==SystemEvent::QUIT)
+ quit_signal();
+ }
+ }
+
+ delete ne;
+
+ }
+
+ ++it;
+ }
+
+
+
+ return;
+}
+void
+Manager::add_driver(Driver*drv)
+{
+ mDrivers.push_back(Driver_sp(drv));
+ return;
+}
+
+Manager::~Manager()
+{
+
+}
+
+}
+}