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.115 2008/10/01 04:30:47 cparedes 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 ACS::ThreadBase; 00062 00069 00073 00111 // forward declaration 00112 class FridgeControl; 00113 00118 class FridgeThread : public ACS::Thread 00119 { 00120 public: 00121 FridgeThread(const ACE_CString& name, 00122 FridgeControl * fridgeControl, 00123 const ACS::TimeInterval& responseTime=ThreadBase::defaultResponseTime, 00124 const ACS::TimeInterval& sleepTime=ThreadBase::defaultSleepTime) : 00125 ACS::Thread(name) 00126 { 00127 ACS_TRACE("FridgeThread::FridgeThread"); 00128 loopCounter_m = 0; 00129 fridgeControl_p = fridgeControl; 00130 } 00131 00132 ~FridgeThread() { ACS_TRACE("FridgeThread::~FridgeThread"); } 00133 00134 virtual void runLoop(); 00135 00136 protected: 00137 int loopCounter_m; 00138 FridgeControl * fridgeControl_p; 00139 }; 00140 00152 class FridgeControl: public baci::CharacteristicComponentImpl, //Standard component superclass 00153 public virtual POA_FRIDGE::FridgeControl //CORBA servant stub 00154 { 00155 public: 00156 00163 FridgeControl( 00164 const ACE_CString& name, 00165 maci::ContainerServices * containerServices); 00166 00170 virtual ~FridgeControl(); 00171 00172 /*Override component lifecycle methods*/ 00203 virtual void cleanUp(); 00204 00212 void updateTemperature(); 00213 00214 /* --------------------- [ CORBA interface ] ----------------------*/ 00222 virtual void 00223 on (); 00224 00232 virtual void 00233 off (); 00234 00242 virtual void 00243 open (); 00244 00252 virtual void 00253 close (); 00254 00262 virtual ACS::RWdouble_ptr 00263 refTemperature (); 00264 00272 virtual FRIDGE::ROOnOffStates_ptr 00273 powerStatus (); 00274 00282 virtual FRIDGE::ROOpClStates_ptr 00283 doorStatus (); 00284 00292 virtual ACS::ROdouble_ptr 00293 currTemperature (); 00294 00295 private: 00304 virtual void 00305 loadData(); 00306 00310 baci::SmartPropertyPointer<baci::RWdouble> m_refTemperature_sp; 00311 00315 baci::SmartPropertyPointer<ROEnumImpl< 00316 ACS_ENUM_T(FRIDGE::OnOffStates), POA_FRIDGE::ROOnOffStates> 00317 > m_powerStatus_sp; 00318 00322 baci::SmartPropertyPointer< 00323 ROEnumImpl<ACS_ENUM_T(FRIDGE::OpClStates), POA_FRIDGE::ROOpClStates> 00324 > m_doorStatus_sp; 00325 00329 baci::SmartPropertyPointer<baci::ROdouble> m_currTemperature_sp; 00330 00337 FridgeThread *m_controlLoop_p; 00338 00342 nc::SimpleSupplier *m_FridgeSupplier_p; 00343 00347 void operator=(const FridgeControl&); 00348 }; 00349 /*\@}*/ 00350 /*\@}*/ 00351 00352 #endif /* acsexmplFridgeImpl_h */ 00353 00354 00355