Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

phTimeStamp.h

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------
00002     Phission : 
00003         Realtime Vision Processing System
00004 
00005     Copyright (C) 2003-2006 Philip D.S. Thoren (pthoren@cs.uml.edu)
00006     University of Massachusetts at Lowell,
00007     Laboratory for Artificial Intelligence and Robotics
00008 
00009     This file is part of Phission.
00010 
00011     Phission is free software; you can redistribute it and/or modify
00012     it under the terms of the GNU Lesser General Public License as published by
00013     the Free Software Foundation; either version 2 of the License, or
00014     (at your option) any later version.
00015 
00016     Phission is distributed in the hope that it will be useful,
00017     but WITHOUT ANY WARRANTY; without even the implied warranty of
00018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019     GNU Lesser General Public License for more details.
00020 
00021     You should have received a copy of the GNU Lesser General Public License
00022     along with Phission; if not, write to the Free Software
00023     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024 
00025  ---------------------------------------------------------------------------*/
00026 #ifndef _PHTIMESTAMP_H
00027 #define _PHTIMESTAMP_H
00028 
00029 #include <phStandard.h>
00030 #include <phStdint.h>
00031 #include <phMutex.h>
00032 
00033 /* TODO: Implement the CLOCK_ID timestamp stuff below.
00034  *          Using the regular gettimeofday functions. */
00035 
00036 /* ---------------------------------------------------------------------- */
00040 /* ---------------------------------------------------------------------- */
00046 PHAPI(class) phTimeStamp : public phObject
00047 {
00048 private:
00049     double  m_stamp_val;
00050     int64_t m_priv;
00051 
00052 public:
00053     phTimeStamp();
00054     phTimeStamp( const phTimeStamp &stamp );
00055     ~phTimeStamp();
00056 
00061     double    getStampValue     () const;
00062     uint32_t  getSeconds        () const;
00063     uint32_t  getMilliseconds   () const;
00064     uint32_t  getMicroseconds   () const;
00065     uintmax_t getNanoseconds    () const;
00066 
00067     int setFromSeconds      ( uint32_t sec   );
00068     int setFromMilliseconds ( uint32_t milli );
00069     int setFromMicroseconds ( uint32_t micro );
00070     int setFromNanoseconds  ( uintmax_t nano  );
00071     
00072     void stamp();
00073     void clear();
00074 
00075     /* comparison operators */
00076     bool operator ==( const phTimeStamp &right ) const;
00077     bool operator < ( const phTimeStamp &right ) const;
00078     bool operator !=( const phTimeStamp &right ) const;
00079     bool operator <=( const phTimeStamp &right ) const;
00080     bool operator > ( const phTimeStamp &right ) const;
00081     bool operator >=( const phTimeStamp &right ) const;
00082 
00083     /* Assignment operator */
00084     phTimeStamp &operator = ( const phTimeStamp &right );
00085 
00086     /* Addition operators */
00087     phTimeStamp &operator +=( const phTimeStamp &right );
00088     phTimeStamp  operator + ( const phTimeStamp &right );
00089 
00090     /* Subtraction operators */
00091     phTimeStamp &operator -=( const phTimeStamp &right );
00092     phTimeStamp  operator - ( const phTimeStamp &right );
00093 
00094     void report( char *label = NULL, FILE *file_desc = NULL );
00095 };
00096 
00097 #endif /* _PHTIMESTAMP_H */




Copyright (C) 2002 - 2007 Philip D.S. Thoren ( pthoren@users.sourceforge.net )
University Of Massachusetts at Lowell
Robotics Lab
SourceForge.net Logo

Generated on Sat Jun 16 02:44:02 2007 for phission by  doxygen 1.4.4