# ClockFactory.cc

Go to the documentation of this file.

    00001 // ----------------------------------------------------------------------------
    00002 // CERTI - HLA RunTime Infrastructure
    00003 // Copyright (C) 2002-2005  ONERA
    00004 //
    00005 // This program is free software ; you can redistribute it and/or
    00006 // modify it under the terms of the GNU Lesser General Public License
    00007 // as published by the Free Software Foundation ; either version 2 of
    00008 // the License, or (at your option) any later version.
    00009 //
    00010 // This program is distributed in the hope that it will be useful, but
    00011 // WITHOUT ANY WARRANTY ; without even the implied warranty of
    00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    00013 // Lesser General Public License for more details.
    00014 //
    00015 // You should have received a copy of the GNU Lesser General Public
    00016 // License along with this program ; if not, write to the Free Software
    00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    00018 // ----------------------------------------------------------------------------
    00019
    00020 #include "config.h"
    00021 #include "Clock.hh"
    00022
    00023 #ifdef HAVE_TSC_CLOCK
    00024 #include "TSCClock.hh"
    00025 #endif
    00026 #ifdef HAVE_POSIX_CLOCK
    00027 #include "PosixClock.hh"
    00028 #endif
    00029
    00030 #ifdef HAVE_WIN_CLOCK
    00031 #include "WinClock.hh"
    00032 #include "WinPerfClock.hh"
    00033 #endif
    00034
    00035 namespace certi {
    00036
    00037   Clock * Clock::getBestClock () {
    00038 #ifdef _WIN32
    00039 #ifdef HAVE_WIN_CLOCK
    00040     return new WinPerfClock ( ) ;
    00041 #else
    00042     return new WinClock() ;
    00043 #endif
    00044 #else
    00045 #ifdef HAVE_TSC_CLOCK
    00046     return new TSCClock () ;
    00047 #else
    00048
    00049 #ifdef HAVE_POSIX_CLOCK
    00050     return new PosixClock () ;
    00051 #else
    00052     return NULL ;
    00053 #endif
    00054 #endif
    00055 #endif
    00056   } /* end of getBestClock */
    00057 }