time.hh

00001 //********************************************************************
00002 //*** POSIX/time.hh
00003 //*** Copyright (c) 2003-2009 by Markus Winand <mws@fatalmind.com>
00004 //*** $Id: time.hh,v 1.17 2009-03-02 14:16:43 mws Exp $
00005 //********************************************************************
00006 
00007 #ifndef POSIX_TIME_HH
00008 #define POSIX_TIME_HH
00009 
00010 #include <time.h>
00011 #include <iosfwd>
00012 
00013 #ifndef POSIX_TIMEFWD_HH
00014 #include "timeFwd.hh"
00015 #endif
00016 
00017 #ifndef INCLUDED_THREAD_LOCK_HH
00018 #include "Thread/Lock.hh"
00019 #endif
00020 
00021 //using namespace fatalmind;
00022 
00023 namespace fatalmind {
00024 namespace POSIX {
00025 
00026 // forward declarations
00027 template<class ThreadingModel>
00028 bool operator<(const timespec<ThreadingModel>& lho, const int rho);
00029 
00030 template<class ThreadingModel>
00031 std::ostream& operator<<(std::ostream&, const timespec<ThreadingModel>&);
00032 
00033 
00034 template<class ThreadingModel>
00035 class timespec: public ::timespec {
00036     public:
00037         timespec(); 
00038         timespec(float);
00039         timespec(time_t sec, long nsec);
00040         timespec(::timespec);   
00041         timespec(const timespec<ThreadingModel>& t);
00042         ~timespec();
00043 
00044         timespec<ThreadingModel>& operator+=(const timespec<ThreadingModel>&);
00045         timespec<ThreadingModel>& operator-=(const timespec<ThreadingModel>&);
00046     
00047 
00048         operator float() const;
00049 
00050     friend 
00051         std::ostream& operator<< <>(std::ostream&, const timespec<ThreadingModel>&);
00052     friend 
00053         bool operator< <>(const timespec<ThreadingModel>& lho, const int rho);
00054     private:
00055         typedef typename ThreadingModel::FastLock lock_t;
00056         mutable lock_t _lk;
00057 };
00058 
00059 
00060 
00061 } // namespace POSIX
00062 } // namespace fatalmind
00063 
00064 #ifndef INCLUDED_THREAD_LOCK_HH
00065 #include "Thread/Lock.hh"
00066 #endif
00067 
00068 
00069 #endif

Generated on Mon Nov 9 16:21:24 2009 for ResourcePool by  doxygen 1.5.3