Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

inputserver_c.cpp

Go to the documentation of this file.
00001 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
00002 
00003    this file is part of rcssserver3D
00004    Fri May 9 2003
00005    Copyright (C) 2002,2003 Koblenz University
00006    Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group
00007    $Id: inputserver_c.cpp,v 1.5 2004/04/11 11:22:57 rollmark Exp $
00008 
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; version 2 of the License.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00021 */
00022 #include "inputserver.h"
00023 
00024 using namespace boost;
00025 using namespace kerosin;
00026 using namespace zeitgeist;
00027 using namespace std;
00028 
00029 FUNCTION(InputServer,init)
00030 {
00031     string inInputSysName;
00032 
00033     return (
00034             (in.GetSize() == 1) &&
00035             (in.GetValue(in.begin(), inInputSysName)) &&
00036             (obj->Init(inInputSysName))
00037             );
00038 }
00039 
00040 FUNCTION(InputServer,createDevice)
00041 {
00042     string inDeviceName;
00043 
00044     return (
00045             (in.GetSize() == 1) &&
00046             (in.GetValue(in.begin(), inDeviceName)) &&
00047             (obj->CreateDevice(inDeviceName))
00048             );
00049 }
00050 
00051 FUNCTION(InputServer,reset)
00052 {
00053     obj->Reset();
00054     return true;
00055 }
00056 
00057 FUNCTION(InputServer,bindCommand)
00058 {
00059     string inDesc;
00060     int inCmd;
00061 
00062     return(
00063            (in.GetSize() == 2) &&
00064            (in.GetValue(in[0], inDesc)) &&
00065            (in.GetValue(in[1], inCmd)) &&
00066            (obj->BindCommand(inDesc,inCmd))
00067            );
00068 }
00069 
00070 FUNCTION(InputServer,setScanCodeMapping)
00071 {
00072     string inName;
00073 
00074     if (
00075         (in.GetSize() != 1) ||
00076         (! in.GetValue(in.begin(),inName))
00077         )
00078         {
00079             return false;
00080         }
00081 
00082     obj->SetScanCodeMapping(inName);
00083     return true;
00084 }
00085 
00086 FUNCTION(InputServer,addCode)
00087 {
00088     int inIc;
00089     string inName;
00090     int inNoMod;
00091     int inShiftMod;
00092     int inAltMod;
00093 
00094     if (
00095         (in.GetSize() != 5) ||
00096         (! in.GetValue(in[0],inIc)) ||
00097         (! in.GetValue(in[1],inName)) ||
00098         (! in.GetValue(in[2],inNoMod)) ||
00099         (! in.GetValue(in[3],inShiftMod)) ||
00100         (! in.GetValue(in[4],inAltMod))
00101         )
00102         {
00103             return  false;
00104         }
00105 
00106     obj->AddCode(inIc,inName,inNoMod,inShiftMod,inAltMod);
00107     return true;
00108 }
00109 
00110 void CLASS(InputServer)::DefineClass()
00111 {
00112     DEFINE_BASECLASS(zeitgeist/Node);
00113     DEFINE_FUNCTION(init);
00114     DEFINE_FUNCTION(createDevice);
00115     DEFINE_FUNCTION(reset);
00116     DEFINE_FUNCTION(bindCommand);
00117     DEFINE_FUNCTION(setScanCodeMapping);
00118     DEFINE_FUNCTION(addCode);
00119 }

Generated on Thu Apr 6 15:25:38 2006 for rcssserver3d by  doxygen 1.4.4