Biomechanical Joint Model
 Author: Anderson Maciel

cometimemanager.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2003 by Anderson Maciel                                 *
00003  *   andi.maciel@gmail.com                                                 *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  **************************************************************************/
00020 
00031 
00032 #include <general/cometimemanager.h>
00033 
00035 // Construction/Destruction
00037 
00038 COME_TimeManager::COME_TimeManager(){
00039 
00040         addTimer( COME_Timer( 0.0, 420000, 1.0f/15.0f, 0.0 ) );
00041 
00042 }
00043 
00044 COME_TimeManager::~COME_TimeManager()
00045 {
00046 
00047 }
00048 
00049 void
00050 COME_TimeManager::run(){
00051         
00052         for( unsigned long int count = 0; /*forever*/ ; count++ ) { // loop up to 4 Giga times = to 119 hours of simulation.
00053                 
00054                 for( int i = 0; i < clocks.size(); i++ ){
00055                         
00056                         if( count >= ( ( clocks[i].getCurrent() + clocks[i].getStep() ) * 1000000 ) ){
00057 
00058                                 clocks[i].goStep();
00059                         }
00060 
00061                 }
00062 
00063                 //qt// usleep( 100 );   // sleep 1/10'000 seconds
00064     }
00065 }
00066 
00067 void
00068 COME_TimeManager::addTimer( COME_Timer t ){
00069 
00070         clocks.push_back( t );
00071 }

Generated on Thu Dec 1 10:13:36 2005 for COME - Biomechanical Joint Model by  doxygen 1.4.5