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

acsImpBaseHandlerImpl.h

Go to the documentation of this file.
00001 #ifndef _ACS_IMP_BASE_HANDLER_IMPL_H_ 00002 #define _ACS_IMP_BASE_HANDLER_IMPL_H_ 00003 00004 /******************************************************************************* 00005 * ALMA - Atacama Large Millimiter Array 00006 * (c) European Southern Observatory, 2002 00007 * Copyright by ESO (in the framework of the ALMA collaboration) 00008 * and Cosylab 2002, All rights reserved 00009 * 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 2.1 of the License, or (at your option) any later version. 00014 * 00015 * This library is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public 00021 * License along with this library; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 * 00024 * "@(#) $Id: acsImpBaseHandlerImpl.h,v 1.3 2008/11/10 20:04:46 msekoran Exp $" 00025 * 00026 * who when what 00027 * -------- -------- ---------------------------------------------- 00028 * azagar 2008-09-30 created 00029 */ 00030 00031 #ifndef __cplusplus 00032 #error This is a C++ include file and cannot be used from plain C 00033 #endif 00034 00035 #include "acsDaemonImpl.h" 00036 #include "acsRequest.h" 00037 #include "acsServiceController.h" 00038 00039 00040 00041 template <class T> class ACSImpBaseHandlerImpl : public virtual POA_acsdaemon::ImpBase { 00042 00043 public: 00044 00048 ACSImpBaseHandlerImpl(ACSServiceType iservice) : service(iservice) { 00049 context = new ACSDaemonContext(acsServices[service].impname); 00050 } 00051 00055 virtual ~ACSImpBaseHandlerImpl() { 00056 ACS_SHORT_LOG((LM_DEBUG, "DESTROYING ACSImpHandlerImpl!")); 00057 delete context; 00058 } 00059 00063 void setService(ACSDaemonServiceImpl<T> *serviceimpl) 00064 { 00065 serviceimpl = serviceimpl; 00066 } 00067 00071 void initialize(CORBA::ORB_ptr orb) { 00072 context->initialize(orb); 00073 } 00074 00078 void dispose(CORBA::ORB_ptr orb) { 00079 context->dispose(orb); 00080 } 00081 00085 std::string getName() { 00086 return acsServices[service].impname; 00087 } 00088 00092 std::string getType() { 00093 return acsServices[service].imptype; 00094 } 00095 00099 std::string getPort() { 00100 return acsServices[service].impport; 00101 } 00102 00103 /*************************** CORBA interface *****************************/ 00104 00105 void shutdown() { 00106 if (serviceimpl->isProtected()) 00107 { 00108 throw ::maciErrType::NoPermissionEx(); 00109 } 00110 ACS_SHORT_LOG ((LM_INFO, "Shutting down the ACS Imp on remote request...")); 00111 serviceimpl->shutdown(false); 00112 } 00113 00114 bool ping() { 00115 return true; 00116 } 00117 00118 void set_manager_reference( 00119 const char * ref 00120 ) 00121 { 00122 if (context) 00123 context->setManagerReference(ref); 00124 } 00125 00126 protected: 00127 ACSServiceType service; 00128 ACSDaemonServiceImpl<T> *serviceimpl; // ACS daemon service 00129 ACSDaemonContext *context; 00130 }; 00131 00132 00133 00134 #endif

Generated on Thu Apr 30 02:30:49 2009 for ACS C++ API by doxygen 1.3.8