vector_time.hpp

Go to the documentation of this file.
00001 /* libobby - Network text editing library
00002  * Copyright (C) 2005 0x539 dev group
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public
00015  * License along with this program; if not, write to the Free
00016  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017  */
00018 
00019 #ifndef _OBBY_VECTOR_TIME_HPP_
00020 #define _OBBY_VECTOR_TIME_HPP_
00021 
00022 namespace obby
00023 {
00024 
00027 template<typename time_type>
00028 class basic_vector_time
00029 {
00030 public:
00031         basic_vector_time(time_type local, time_type remote);
00032 
00033         bool operator==(const basic_vector_time& other);
00034         bool operator!=(const basic_vector_time& other);
00035 
00036         time_type get_local() const;
00037         time_type get_remote() const;
00038 
00039         void inc_local();
00040         void inc_remote();
00041 
00042 protected:
00043         time_type m_local;
00044         time_type m_remote;
00045 };
00046 
00047 typedef basic_vector_time<unsigned int> vector_time;
00048 
00049 template<typename time_type>
00050 basic_vector_time<time_type>::
00051 	basic_vector_time(time_type local, time_type remote)
00052  : m_local(local), m_remote(remote)
00053 {
00054 }
00055 
00056 template<typename time_type>
00057 bool basic_vector_time<time_type>::operator==(const basic_vector_time& other)
00058 {
00059         return m_local == other.m_local && m_remote == other.m_remote;
00060 }
00061 
00062 template<typename time_type>
00063 bool basic_vector_time<time_type>::operator!=(const basic_vector_time& other)
00064 {
00065         return m_local != other.m_local || m_remote != other.m_remote;
00066 }
00067 
00068 template<typename time_type>
00069 time_type basic_vector_time<time_type>::get_local() const
00070 {
00071         return m_local;
00072 }
00073 
00074 template<typename time_type>
00075 time_type basic_vector_time<time_type>::get_remote() const
00076 {
00077         return m_remote;
00078 }
00079 
00080 template<typename time_type>
00081 void basic_vector_time<time_type>::inc_local()
00082 {
00083         ++ m_local;
00084 }
00085 
00086 template<typename time_type>
00087 void basic_vector_time<time_type>::inc_remote()
00088 {
00089         ++ m_remote;
00090 }
00091 
00092 } // namespace obby
00093 
00094 #endif // _OBBY_VECTOR_TIME_HPP_

Generated on Fri Jan 11 10:01:32 2008 for obby by  doxygen 1.5.1