• Classes
  • Modules
  • Namespaces
  • Files
  • Related Pages
  • File List
  • File Members

acsThreadTest.h

Go to the documentation of this file.
00001 #ifndef _ACS_THREAD_TEST_H
00002 #define _ACS_THREAD_TEST_H
00003 /*******************************************************************************
00004 * ALMA - Atacama Large Millimiter Array
00005 * (c) European Southern Observatory, 2005 
00006 * 
00007 * This library is free software; you can redistribute it and/or
00008 * modify it under the terms of the GNU Lesser General Public
00009 * License as published by the Free Software Foundation; either
00010 * version 2.1 of the License, or (at your option) any later version.
00011 * 
00012 * This library is distributed in the hope that it will be useful,
00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 * Lesser General Public License for more details.
00016 * 
00017 * You should have received a copy of the GNU Lesser General Public
00018 * License along with this library; if not, write to the Free Software
00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00020 *
00021 * "@(#) $Id: acsThreadTest.h,v 1.4 2006/03/24 12:12:49 vwang Exp $"
00022 *
00023 * Classes used in ACS Thread modular tests
00024 *
00025 */
00026 
00027 #include "acsThread.h"
00028 
00029 
00030 class TestACSThread :public ACS::Thread
00031 {
00032   public:
00033     TestACSThread(const ACE_CString& name, 
00034                   const ACS::TimeInterval& responseTime=ThreadBase::defaultResponseTime, 
00035                   const ACS::TimeInterval& sleepTime=ThreadBase::defaultSleepTime,
00036                   bool del=false
00037         ) :
00038         ACS::Thread(name, responseTime, sleepTime, del)
00039         {
00040             ACS_TRACE("TestACSThread::TestACSThread");
00041             loopCounter_m = 0;
00042         }
00043 
00044     TestACSThread(const ACE_CString& name,
00045                   const ACS::TimeInterval& responseTime, 
00046                   const ACS::TimeInterval& sleepTime,
00047                   bool del,
00048                   const long _thrFlags
00049         ) :
00050         ACS::Thread(name, responseTime, sleepTime, del, _thrFlags)
00051         {
00052             ACS_TRACE("TestACSThread::TestACSThread");
00053             loopCounter_m = 0;
00054         }
00055 
00074     ~TestACSThread() 
00075         { 
00076             ACS_TRACE("TestACSThread::~TestACSThread"); 
00077 
00078             terminate(); 
00079         }
00080 
00085     virtual void runLoop()
00086         {
00087             if (loopCounter_m==10)
00088             {
00089                 exit();
00090             }
00091             
00092             ACS_LOG(LM_SOURCE_INFO,
00093                     "TestACSThread::runLoop", 
00094                     (LM_INFO, "%s: runLoop (%d)", getName().c_str(), loopCounter_m));
00095             ++ loopCounter_m;
00096         }
00097 
00098   protected:
00099     int loopCounter_m;
00100 
00101 };
00102 
00103 #endif /* end _ACS_THREAD_TEST_H */

Generated on Thu Jan 12 2012 23:13:50 for ACS-10.0 C++ API by  doxygen 1.7.0