00001
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "GizmoEventStandard.hpp"
00030 #include "GizmoLinuxInputDevice.hpp"
00031 #include "../libH/Debug.hpp"
00032 #include "../libH/Exception.hpp"
00033 #include "../libH/Util.hpp"
00034 #include <boost/shared_ptr.hpp>
00035 #include <boost/bind.hpp>
00036
00037 using namespace std;
00038 using namespace boost;
00039 using namespace H;
00040 using namespace Gizmod;
00041
00043
00045
00047
00049
00053 GizmoEventStandard::GizmoEventStandard() : GizmoEvent(GIZMO_EVENTCLASS_STANDARD, false) {
00054 }
00055
00059 GizmoEventStandard::GizmoEventStandard(struct input_event const & InputEvent, bool IsRemote) : GizmoEvent(GIZMO_EVENTCLASS_STANDARD, IsRemote), GizmoLinuxInputEvent(InputEvent) {
00060 }
00061
00065 GizmoEventStandard::~GizmoEventStandard() {
00066 }
00067
00069
00071
00078 void GizmoEventStandard::buildEventsVectorFromBuffer(std::vector< boost::shared_ptr<GizmoEventStandard> > & EventVector, H::DynamicBuffer<char> const & Buffer, bool SendNullEvents) {
00079 std::vector<struct input_event> InputEvents;
00080 GizmoLinuxInputDevice::buildInputEventsVectorFromBuffer(InputEvents, Buffer);
00081 apply_static_func_args(InputEvents, GizmoEventStandard::buildEventsVectorFromBufferFunctor, &EventVector, SendNullEvents);
00082 }
00083
00087 void GizmoEventStandard::buildEventsVectorFromBufferFunctor(struct input_event & InputEvent, std::vector< boost::shared_ptr<GizmoEventStandard> > * pEventVector, bool SendNullEvents) {
00088 if ( (!SendNullEvents) && (InputEvent.type == 0) && (InputEvent.code == 0) && (InputEvent.value == 0) )
00089 return;
00090 pEventVector->push_back(boost::shared_ptr<GizmoEventStandard>(new GizmoEventStandard(InputEvent)));
00091 }