Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

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.104 2006/05/11 15:03:19 bjeram 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 
00059 using namespace baci;
00060 
00064 class Door; // declaration
00065 
00066 // DoorThread - an ACS thread used by the Door class.
00067 // When the reference position changes the door is moved to this
00068 // new position, and the device state is defined.
00069 class DoorThread : public ACS::Thread
00070 {
00071         public: 
00072 
00073         DoorThread(const ACE_CString &name, Door * door_ptr, 
00074                 const ACS::TimeInterval& responseTime=ThreadBase::defaultResponseTime, 
00075                 const ACS::TimeInterval& sleepTime=ThreadBase::defaultSleepTime) :
00076                 ACS::Thread(name) 
00077         {
00078                 door_p = door_ptr;
00079         }
00080 
00081         ~DoorThread() 
00082         { 
00083                 ACS_TRACE("DoorThread::~DoorThread"); 
00084         }
00085     
00086         virtual void onStart();
00087 
00088         virtual void runLoop();
00089 
00090     virtual void onStop();
00091         
00092         private:
00093                 Door * door_p;
00094 };
00095 
00147 class Door: public CharacteristicComponentImpl,     //Standard component superclass
00148             public virtual POA_acsexmplBuilding::Door,    //CORBA servant stub
00149             public ActionImplementator    //ACS class used for asynchronous methods
00150 {
00151   friend void DoorThread::runLoop();
00152 
00153   public:   
00159     Door(
00160          const ACE_CString& name,
00161          maci::ContainerServices * containerServices);
00162     
00166     virtual ~Door();
00167     
00168     /* --------------- [ Action implementator interface ] -------------- */
00192     virtual ActionRequest 
00193     invokeAction (int function,
00194                   BACIComponent *component_p, 
00195                   const int &callbackID, 
00196                   const CBDescIn &descIn, 
00197                   BACIValue *value_p, 
00198                   Completion &completion, 
00199                   CBDescOut &descOut);
00200     
00223     virtual ActionRequest 
00224     openAction (BACIComponent *component_p, 
00225                 const int &callbackID,
00226                 const CBDescIn &descIn, 
00227                 BACIValue *value_p,
00228                 Completion &completion, 
00229                 CBDescOut &descOut);
00230 
00253     virtual ActionRequest 
00254     closeAction (BACIComponent *component_p, 
00255                  const int &callbackID,
00256                  const CBDescIn &descIn, 
00257                  BACIValue *value_p,
00258                  Completion &completion, 
00259                  CBDescOut &descOut);
00260     
00261 
00262     /* --------------------- [ CORBA interface ] ----------------------*/
00277     virtual void
00278     open (ACS::CBvoid_ptr cb,
00279           const ACS::CBDescIn &desc)
00280         throw (CORBA::SystemException);
00281     
00296     virtual void 
00297     close (ACS::CBvoid_ptr cb,
00298            const ACS::CBDescIn &desc)
00299         throw (CORBA::SystemException);
00300     
00312     virtual void 
00313     move (CORBA::Double pos)
00314         throw (CORBA::SystemException);
00315     
00324     virtual ACS::ROdouble_ptr 
00325     position ()
00326         throw (CORBA::SystemException);
00327     
00336     virtual ACS::RWdouble_ptr
00337     ref_position ()
00338         throw (CORBA::SystemException);
00339     
00348     virtual ACS::ROlong_ptr 
00349     substate ()
00350         throw (CORBA::SystemException);
00351     
00360     virtual ACS::ROstring_ptr 
00361     version ()
00362         throw (CORBA::SystemException);
00363 
00364     /*Override component lifecycle methods*/
00377     virtual void execute()
00378         throw (ACSErr::ACSbaseExImpl);
00379     
00380   private:
00392     virtual void 
00393     checkSubstate(CompletionImpl *&error_p);
00394     
00398      SmartPropertyPointer<RWdouble> m_ref_position_sp;
00399 
00403      SmartPropertyPointer<ROdouble> m_position_sp;
00404 
00409      SmartPropertyPointer<ROlong> m_substate_sp;
00410 
00414      SmartPropertyPointer<ROstring> m_version_sp;
00415 
00416     /*
00417      * m_door_thread_p is the pointer to the DoorThread
00418      */
00419      DoorThread * m_doorThread_p;
00420 
00424     void operator=(const Door&);
00425 }; 
00426 
00427 #endif   /* acsexmplDoorImpl_h */
00428 
00429 
00430 

Generated on Sun Oct 29 02:26:25 2006 for ACS C++ API by doxygen 1.3.6