[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[certi-cvs] certi libCERTI/CMakeLists.txt libCERTI/Clock.hh...
From: |
certi-cvs |
Subject: |
[certi-cvs] certi libCERTI/CMakeLists.txt libCERTI/Clock.hh... |
Date: |
Tue, 25 Nov 2008 15:13:58 +0000 |
CVSROOT: /sources/certi
Module name: certi
Changes by: JL Bussenot <bussenotjl> 08/11/25 15:13:58
Modified files:
libCERTI : CMakeLists.txt Clock.hh
test/utility : CertiUtilTests.cc
Added files:
libCERTI : ClockFactory.cc
Log message:
Add clock factory method
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/CMakeLists.txt?cvsroot=certi&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/Clock.hh?cvsroot=certi&r1=4.8&r2=4.9
http://cvs.savannah.gnu.org/viewcvs/certi/libCERTI/ClockFactory.cc?cvsroot=certi&rev=4.1
http://cvs.savannah.gnu.org/viewcvs/certi/test/utility/CertiUtilTests.cc?cvsroot=certi&r1=1.14&r2=1.15
Patches:
Index: libCERTI/CMakeLists.txt
===================================================================
RCS file: /sources/certi/certi/libCERTI/CMakeLists.txt,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- libCERTI/CMakeLists.txt 1 Nov 2008 23:59:00 -0000 1.18
+++ libCERTI/CMakeLists.txt 25 Nov 2008 15:13:57 -0000 1.19
@@ -69,6 +69,7 @@
AuditLine.cc AuditLine.hh
BasicMessage.cc BasicMessage.hh
Clock.cc Clock.hh
+ClockFactory.cc
MessageBuffer.cc MessageBuffer.hh
Message.cc Message_R.cc Message_W.cc Message.hh
NetworkMessage.cc NetworkMessage_RW.cc NetworkMessage.hh
Index: libCERTI/Clock.hh
===================================================================
RCS file: /sources/certi/certi/libCERTI/Clock.hh,v
retrieving revision 4.8
retrieving revision 4.9
diff -u -b -r4.8 -r4.9
--- libCERTI/Clock.hh 13 Oct 2008 19:07:30 -0000 4.8
+++ libCERTI/Clock.hh 25 Nov 2008 15:13:58 -0000 4.9
@@ -89,9 +89,13 @@
*/
virtual double getDeltaNanoSecond(const uint64_t previousTicks);
-
-
virtual ~Clock();
+
+ /**
+ * Retrieve the best possible clock.
+ * @return the obtained clock
+ */
+ static Clock* getBestClock ();
protected:
std::string name;
};
Index: test/utility/CertiUtilTests.cc
===================================================================
RCS file: /sources/certi/certi/test/utility/CertiUtilTests.cc,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- test/utility/CertiUtilTests.cc 5 Nov 2008 20:41:26 -0000 1.14
+++ test/utility/CertiUtilTests.cc 25 Nov 2008 15:13:58 -0000 1.15
@@ -279,6 +279,9 @@
clockTests(WinPerfClk);
#endif
+ certi::Clock *myClock = certi::Clock::getBestClock () ;
+ clockTests(*myClock);
+ delete myClock ;
cout << "CERTI Utility Test->END." <<endl;
/* getchar(); */
return 0;
Index: libCERTI/ClockFactory.cc
===================================================================
RCS file: libCERTI/ClockFactory.cc
diff -N libCERTI/ClockFactory.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ libCERTI/ClockFactory.cc 25 Nov 2008 15:13:58 -0000 4.1
@@ -0,0 +1,57 @@
+// ----------------------------------------------------------------------------
+// CERTI - HLA RunTime Infrastructure
+// Copyright (C) 2002-2005 ONERA
+//
+// This program is free software ; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation ; either version 2 of
+// the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY ; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program ; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// ----------------------------------------------------------------------------
+
+#include "config.h"
+#include "Clock.hh"
+
+#ifdef HAVE_TSC_CLOCK
+#include "TSCClock.hh"
+#endif
+#ifdef HAVE_POSIX_CLOCK
+#include "PosixClock.hh"
+#endif
+
+#ifdef HAVE_WIN_CLOCK
+#include "WinClock.hh"
+#include "WinPerfClock.hh"
+#endif
+
+namespace certi {
+
+ Clock * Clock::getBestClock () {
+#ifdef _WIN32
+#ifdef HAVE_WIN_CLOCK
+ return new WinPerfClock ( ) ;
+#else
+ return new WinClock() ;
+#endif
+#else
+#ifdef HAVE_TSC_CLOCK
+ return new TSCClock () ;
+#else
+
+#ifdef HAVE_POSIX_CLOCK
+ return new PosixClock () ;
+#else
+ return NULL ;
+#endif
+#endif
+#endif
+ } /* end of getBestClock */
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [certi-cvs] certi libCERTI/CMakeLists.txt libCERTI/Clock.hh...,
certi-cvs <=