INTRODUCTION Overview Download and Install Quick Start Documentation Publications NONFRAMEWORK CODE Driver Interfaces Drivers Libraries Utilities FRAMEWORK CODE Interfaces Components Libraries Utilities Full Software Listings DEVELOPER Tutorials Examples Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
clock.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp 00005 * 00006 * This copy of Orca is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 00011 #ifndef ORCA_LOCALNAV_CLOCK_H 00012 #define ORCA_LOCALNAV_CLOCK_H 00013 00014 #include <gbxsickacfr/gbxiceutilacfr/store.h> 00015 #include <hydrotime/time.h> 00016 00017 namespace orcalocalnav { 00018 00019 // 00020 // A thread-safe clock. 00021 // This is used instead of the processor's clock because we might be running in simulation. 00022 // So we read time of our incoming data rather than any global reference. 00023 // 00024 // @author Alex Brooks 00025 // 00026 class Clock 00027 { 00028 00029 public: 00030 00031 Clock( const hydrotime::Time &initialTime ) 00032 { setTime( initialTime ); } 00033 00034 void setTime( const hydrotime::Time &time ) 00035 { 00036 timeStore_.set( time ); 00037 } 00038 hydrotime::Time time() const 00039 { 00040 hydrotime::Time t; 00041 timeStore_.get( t ); 00042 return t; 00043 } 00044 00045 private: 00046 00047 mutable gbxiceutilacfr::Store<hydrotime::Time> timeStore_; 00048 }; 00049 00050 } 00051 00052 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)