00001 #ifndef fridgeImpl_h 00002 #define fridgeImpl_h 00003 /******************************************************************************* 00004 * ALMA - Atacama Large Millimiter Array 00005 * (c) European Southern Observatory, 2002 00006 * Copyright by ESO (in the framework of the ALMA collaboration) 00007 * and Cosylab 2002, All rights reserved 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 2.1 of the License, or (at your option) any later version. 00013 * 00014 * This library is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public 00020 * License along with this library; if not, write to the Free Software 00021 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 * 00023 * 00024 * 00025 * "@(#) $Id: acsexmplFridgeImpl.h,v 1.112 2006/03/24 13:02:19 vwang Exp $" 00026 * 00027 * who when what 00028 * -------- -------- ----------------------------------------------\ 00029 * acaproni 2004-04-06 Use of smart pointer for properties 00030 * david 2002-07-02 added GNU license info 00031 * gchiozzi 2002-03-18 Replaced includes of fridge*.* with acsexmplFridge*.* 00032 * gchiozzi 2001-02-15 Added declaration of get_interface() method for Object Explorer 00033 * gchiozzi 2001-02-15 created created standard header 00034 * msekoran 2001-03-10 integrated with new BACI; ALMA coding convention used; doc. 00035 */ 00036 00037 #ifndef __cplusplus 00038 #error This is a C++ include file and cannot be used from plain C 00039 #endif 00040 00042 #include <baciCharacteristicComponentImpl.h> 00043 00045 #include <acsexmplFridgeS.h> 00046 00048 #include <baciRWdouble.h> 00049 #include <baciROdouble.h> 00050 #include <enumpropROImpl.h> 00051 00053 #include <acsncSimpleSupplier.h> 00054 00056 #include <baciSmartPropertyPointer.h> 00057 00059 #include <acsThread.h> 00060 00061 using namespace baci; 00062 using ACS::ThreadBase; 00063 00102 // forward declaration 00103 class FridgeControl; 00104 00109 class FridgeThread : public ACS::Thread 00110 { 00111 public: 00112 FridgeThread(const ACE_CString& name, 00113 FridgeControl * fridgeControl, 00114 const ACS::TimeInterval& responseTime=ThreadBase::defaultResponseTime, 00115 const ACS::TimeInterval& sleepTime=ThreadBase::defaultSleepTime) : 00116 ACS::Thread(name) 00117 { 00118 ACS_TRACE("FridgeThread::FridgeThread"); 00119 loopCounter_m = 0; 00120 fridgeControl_p = fridgeControl; 00121 } 00122 00123 ~FridgeThread() { ACS_TRACE("FridgeThread::~FridgeThread"); } 00124 00125 virtual void runLoop(); 00126 00127 protected: 00128 int loopCounter_m; 00129 FridgeControl * fridgeControl_p; 00130 }; 00131 00142 class FridgeControl: public CharacteristicComponentImpl, //Standard component superclass 00143 public virtual POA_FRIDGE::FridgeControl //CORBA servant stub 00144 { 00145 public: 00146 00153 FridgeControl( 00154 const ACE_CString& name, 00155 maci::ContainerServices * containerServices); 00156 00160 virtual ~FridgeControl(); 00161 00162 /*Override component lifecycle methods*/ 00193 virtual void cleanUp(); 00194 00202 void updateTemperature(); 00203 00204 /* --------------------- [ CORBA interface ] ----------------------*/ 00212 virtual void 00213 on () 00214 throw (CORBA::SystemException); 00215 00223 virtual void 00224 off () 00225 throw (CORBA::SystemException); 00226 00234 virtual void 00235 open () 00236 throw (CORBA::SystemException); 00237 00245 virtual void 00246 close () 00247 throw (CORBA::SystemException); 00248 00256 virtual ACS::RWdouble_ptr 00257 refTemperature () 00258 throw (CORBA::SystemException); 00259 00267 virtual FRIDGE::ROOnOffStates_ptr 00268 powerStatus () 00269 throw (CORBA::SystemException); 00270 00278 virtual FRIDGE::ROOpClStates_ptr 00279 doorStatus () 00280 throw (CORBA::SystemException); 00281 00289 virtual ACS::ROdouble_ptr 00290 currTemperature () 00291 throw (CORBA::SystemException); 00292 00293 private: 00302 virtual void 00303 loadData(); 00304 00308 SmartPropertyPointer<RWdouble> m_refTemperature_sp; 00309 00313 SmartPropertyPointer<ROEnumImpl< 00314 ACS_ENUM_T(FRIDGE::OnOffStates), POA_FRIDGE::ROOnOffStates> 00315 > m_powerStatus_sp; 00316 00320 SmartPropertyPointer< 00321 ROEnumImpl<ACS_ENUM_T(FRIDGE::OpClStates), POA_FRIDGE::ROOpClStates> 00322 > m_doorStatus_sp; 00323 00327 SmartPropertyPointer<ROdouble> m_currTemperature_sp; 00328 00335 FridgeThread *m_controlLoop_p; 00336 00340 nc::SimpleSupplier *m_FridgeSupplier_p; 00341 00345 void operator=(const FridgeControl&); 00346 }; 00347 00348 #endif /* acsexmplFridgeImpl_h */ 00349 00350 00351
1.3.6