Robotsystem from Robot Group Leipzig: compatsim.cpp Source File

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

# compatsim.cpp

Go to the documentation of this file.

    00001 /***************************************************************************
    00002  *   Copyright (C) 2005 by Robot Group Leipzig                             *
    00003  *    martius@informatik.uni-leipzig.de                                    *
    00004  *    fhesse@informatik.uni-leipzig.de                                     *
    00005  *    der@informatik.uni-leipzig.de                                        *
    00006  *    frankguettler@gmx.de                                                 *
    00007  *                                                                         *
    00008  *   This program is free software; you can redistribute it and/or modify  *
    00009  *   it under the terms of the GNU General Public License as published by  *
    00010  *   the Free Software Foundation; either version 2 of the License, or     *
    00011  *   (at your option) any later version.                                   *
    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                         *
    00020  *   Free Software Foundation, Inc.,                                       *
    00021  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
    00022  *                                                                         *
    00023  *   $Log: compatsim.cpp,v $
    00024  *   Revision 1.1.2.1  2005/12/06 10:13:23  martius
    00025  *   openscenegraph integration started
    00026  *
    00027  *                                                                 *
    00028  ***************************************************************************/
    00029
    00030 #include "compatsim.h"
    00031
    00032 namespace lpzrobots {
    00033
    00034
    00035 CompatSim::CompatSim(void (*startFun)(const OdeHandle&, const OsgHandle&, GlobalData& globalData),
    00036                      void (*endFun)(GlobalData& globalData),
    00037                      void (*configFun)(GlobalData& globalData),
    00038                      void (*commandFun)(const OdeHandle&, const OsgHandle&, GlobalData& globalData, int key),
    00039                      void (*collCallbackFun)(const OdeHandle&, void* data, dGeomID o1, dGeomID o2),
    00040                      void (*addCallbackFun)(GlobalData& globalData, bool draw, bool pause))
    00041   : startFun(startFun), endFun(endFun), configFun(configFun), commandFun(commandFun),
    00042     collCallbackFun(collCallbackFun), addCallbackFun(addCallbackFun) {
    00043 }
    00044
    00045 CompatSim::~CompatSim() {}
    00046
    00047
    00048 void CompatSim::start(const OdeHandle& odeHandle, const OsgHandle& osgHandle, GlobalData& globalData){
    00049   if(startFun) startFun(odeHandle, osgHandle, globalData);
    00050 }
    00051
    00052 void CompatSim::end(GlobalData& globalData){
    00053   if(endFun) endFun(globalData);
    00054 };
    00055
    00056 void CompatSim::config(GlobalData& globalData){
    00057   if(configFun) configFun(globalData);
    00058 }
    00059
    00060 void CompatSim::command(const OdeHandle& odeHandle, const OsgHandle& osgHandle,
    00061                         GlobalData& globalData, int key) {
    00062   if(commandFun) commandFun(odeHandle, osgHandle, globalData, key);
    00063 }
    00064
    00065 bool CompatSim::collCallback(const OdeHandle& odeHandle, void* data, dGeomID o1, dGeomID o2) {
    00066   if(collCallbackFun){
    00067     collCallbackFun(odeHandle, data, o1, o2);
    00068     return true;
    00069   } else
    00070     return false;
    00071 }
    00072
    00073 void CompatSim::addCallback(GlobalData& globalData, bool draw, bool pause) {
    00074   if(addCallbackFun)
    00075     addCallbackFun(globalData, draw, pause);
    00076 }
    00077
    00078 }