00001 00012 /* 00013 00014 Copyright (c) 2007, Tim Burrell 00015 Licensed under the Apache License, Version 2.0 (the "License"); 00016 you may not use this file except in compliance with the License. 00017 You may obtain a copy of the License at 00018 00019 http://www.apache.org/licenses/LICENSE-2.0 00020 00021 Unless required by applicable law or agreed to in writing, software 00022 distributed under the License is distributed on an "AS IS" BASIS, 00023 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00024 See the License for the specific language governing permissions and 00025 limitations under the License. 00026 00027 */ 00028 00029 #include "Gizmo.hpp" 00030 #include "../libH/Debug.hpp" 00031 #include "../libH/Exception.hpp" 00032 #include <boost/shared_ptr.hpp> 00033 00034 using namespace std; 00035 using namespace boost; 00036 using namespace H; 00037 using namespace Gizmod; 00038 00040 // Type Defs 00042 00047 #define GIZMO_TYPE_UNSPECIFIED "Unspecified" 00048 00050 // Construction 00052 00056 Gizmo::Gizmo(GizmoClass Class, const H::DeviceInfo & deviceInfo, int DeviceID, int DeviceClassID) : DeviceInfo(deviceInfo) { 00057 mClass = Class; 00058 mDeviceID = DeviceID; 00059 mDeviceClassID = DeviceClassID; 00060 memset(mKeyState, 0, sizeof(int) * GIZMO_KEY_MAX); 00061 } 00062 00066 Gizmo::Gizmo() { 00067 } 00068 00072 Gizmo::~Gizmo() { 00073 } 00074 00076 // Class Body 00078 00086 GizmoClass Gizmo::getClass() { 00087 return mClass; 00088 } 00089 00096 int Gizmo::getDeviceID() { 00097 return mDeviceID; 00098 } 00099 00108 int Gizmo::getDeviceClassID() { 00109 return mDeviceClassID; 00110 } 00111 00117 int Gizmo::getKeyState(GizmoKey Key) { 00118 return mKeyState[Key]; 00119 } 00120 00128 std::string Gizmo::getType() { 00129 return GIZMO_TYPE_UNSPECIFIED; 00130 } 00131 00137 bool Gizmo::processEvent(GizmoEvent * pEvent) { 00138 // override me 00139 return true; 00140 } 00141 00147 void Gizmo::setKeyState(GizmoKey Key, int State) { 00148 mKeyState[Key] = State; 00149 }