ALMA Computing Group

acsexmplDoorImpl.h

Go to the documentation of this file.
00001 #ifndef acsexmplDoorImpl_h 00002 #define acsexmplDoorImpl_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 * "@(#) $Id: acsexmplDoorImpl.h,v 1.108 2008/10/09 08:41:11 cparedes Exp $" 00025 * 00026 * who when what 00027 * -------- -------- ---------------------------------------------- 00028 * acaproni 2004-04-06 Use the smart pointer for the properties 00029 * david 2002-07-02 added GNU license info 00030 * blopez 2002-04-05 m_poa declaration removed 00031 * blopez 2002-04-04 Modified for ACSDO usage 00032 * blopez 2002-03-27 Comments changed to doxygen format 00033 * blopez 2002-03-11 Created 00034 * 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 <acsexmplBuildingS.h> 00046 00048 #include <baciROdouble.h> 00049 #include <baciRWdouble.h> 00050 #include <baciROlong.h> 00051 #include <baciROstring.h> 00052 00054 #include <baciSmartPropertyPointer.h> 00055 00057 #include <acsThread.h> 00058 00062 class Door; // declaration 00063 00064 // DoorThread - an ACS thread used by the Door class. 00065 // When the reference position changes the door is moved to this 00066 // new position, and the device state is defined. 00067 class DoorThread : public ACS::Thread 00068 { 00069 public: 00070 00071 DoorThread(const ACE_CString &name, Door * door_ptr, 00072 const ACS::TimeInterval& responseTime=ThreadBase::defaultResponseTime, 00073 const ACS::TimeInterval& sleepTime=ThreadBase::defaultSleepTime) : 00074 ACS::Thread(name) 00075 { 00076 door_p = door_ptr; 00077 } 00078 00079 ~DoorThread() 00080 { 00081 ACS_TRACE("DoorThread::~DoorThread"); 00082 } 00083 00084 virtual void onStart(); 00085 00086 virtual void runLoop(); 00087 00088 virtual void onStop(); 00089 00090 private: 00091 Door * door_p; 00092 }; 00093 00102 00157 class Door: public baci::CharacteristicComponentImpl, //Standard component superclass 00158 public virtual POA_acsexmplBuilding::Door, //CORBA servant stub 00159 public baci::ActionImplementator //ACS class used for asynchronous methods 00160 { 00161 friend void DoorThread::runLoop(); 00162 00163 public: 00169 Door( 00170 const ACE_CString& name, 00171 maci::ContainerServices * containerServices); 00172 00176 virtual ~Door(); 00177 00178 /* --------------- [ Action implementator interface ] -------------- */ 00202 virtual baci::ActionRequest 00203 invokeAction (int function, 00204 baci::BACIComponent *component_p, 00205 const int &callbackID, 00206 const CBDescIn &descIn, 00207 baci::BACIValue *value_p, 00208 Completion &completion, 00209 CBDescOut &descOut); 00210 00233 virtual baci::ActionRequest 00234 openAction (baci::BACIComponent *component_p, 00235 const int &callbackID, 00236 const CBDescIn &descIn, 00237 baci::BACIValue *value_p, 00238 Completion &completion, 00239 CBDescOut &descOut); 00240 00263 virtual baci::ActionRequest 00264 closeAction (baci::BACIComponent *component_p, 00265 const int &callbackID, 00266 const CBDescIn &descIn, 00267 baci::BACIValue *value_p, 00268 Completion &completion, 00269 CBDescOut &descOut); 00270 00271 00272 /* --------------------- [ CORBA interface ] ----------------------*/ 00287 virtual void 00288 open (ACS::CBvoid_ptr cb, 00289 const ACS::CBDescIn &desc); 00290 00305 virtual void 00306 close (ACS::CBvoid_ptr cb, 00307 const ACS::CBDescIn &desc); 00308 00320 virtual void 00321 move (CORBA::Double pos); 00322 00331 virtual ACS::ROdouble_ptr 00332 position (); 00333 00342 virtual ACS::RWdouble_ptr 00343 ref_position (); 00344 00353 virtual ACS::ROlong_ptr 00354 substate (); 00355 00364 virtual ACS::ROstring_ptr 00365 version (); 00366 00367 /*Override component lifecycle methods*/ 00381 virtual void execute(); 00382 00383 private: 00395 virtual void 00396 checkSubstate(CompletionImpl *&error_p); 00397 00401 baci::SmartPropertyPointer<baci::RWdouble> m_ref_position_sp; 00402 00406 baci::SmartPropertyPointer<baci::ROdouble> m_position_sp; 00407 00412 baci::SmartPropertyPointer<baci::ROlong> m_substate_sp; 00413 00417 baci::SmartPropertyPointer<baci::ROstring> m_version_sp; 00418 00419 /* 00420 * m_door_thread_p is the pointer to the DoorThread 00421 */ 00422 DoorThread * m_doorThread_p; 00423 00427 void operator=(const Door&); 00428 }; 00429 00430 /*\@}*/ 00431 /*\@}*/ 00432 #endif /* acsexmplDoorImpl_h */ 00433 00434 00435