• Classes
  • Modules
  • Namespaces
  • Files
  • Related Pages
  • File List
  • File Members

basencHelper.h

Go to the documentation of this file.
00001 #ifndef basenc_helper_H
00002 #define basenc_helper_H
00003 /*******************************************************************************
00004 * ALMA - Atacama Large Millimiter Array
00005 * (c) National Research Council of Canada, 2005 
00006 * 
00007 * This library is free software; you can redistribute it and/or
00008 * modify it under the terms of the GNU Lesser General Public
00009 * License as published by the Free Software Foundation; either
00010 * version 2.1 of the License, or (at your option) any later version.
00011 * 
00012 * This library is distributed in the hope that it will be useful,
00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 * Lesser General Public License for more details.
00016 * 
00017 * You should have received a copy of the GNU Lesser General Public
00018 * License along with this library; if not, write to the Free Software
00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00020 *
00021 * "@(#) $Id: basencHelper.h,v 1.7 2012/10/15 12:35:34 bjeram Exp $"
00022 *
00023 * who       when      what
00024 * --------  --------  ----------------------------------------------
00025 * dfugate  2005-11-15  created
00026 */
00027 
00028 #ifndef __cplusplus
00029 #error This is a C++ include file and cannot be used from plain C
00030 #endif
00031 
00032 #include <orbsvcs/CosNotifyChannelAdminS.h>
00033 #include <orbsvcs/CosNamingC.h>
00034 #include <acsncC.h>
00035 #include <cdbDALC.h>
00036 
00041 class BaseHelper
00042 {
00043   public:
00044   
00051         static char*  getNotificationFactoryNameForChannel(CDB::DAL_ptr dal, const char* channelName, const char* domainName = 0);
00052 
00059         static std::string combineChannelAndDomainName(const std::string &channelName, const std::string &domainName);
00060 
00066         inline std::string getCombinedChannelAndDomainName() const
00067         {
00068                 return channelAndDomainName_m;
00069         }
00070   
00071   protected:
00072     
00078     BaseHelper(const char* channelName, const char* acsNCDomainName = 0);
00079     
00085     virtual void
00086     init(CosNaming::NamingContext_ptr nc_p);
00087 
00091     virtual void done();
00092 
00096     virtual ~BaseHelper();
00097     
00102     virtual void 
00103     disconnect();
00104 
00113     virtual const char* 
00114     getChannelKind()
00115         {return acscommon::NC_KIND;}
00116 
00124     virtual const char*
00125     getChannelDomain() 
00126         {return acscommon::ALMADOMAIN;}
00127 
00133     virtual const char*
00134     getNotificationFactoryName()
00135         {
00136                 if (!notificationServiceName_mp)
00137                 {
00138                         // @todo temporary implementation, containerServices to be used
00139                         CDB::DAL_var cdb;
00140                         
00141                     //Common name sequence. This little object defines the name of 
00142                     //channel as registered with the CORBA Naming Service.
00143                     CosNaming::Name name(1);
00144                     name.length(1);
00145                     
00146                     //name of the CDB mapping in the naming service
00147                     name[0].id   = CORBA::string_dup("CDB");
00148                     //kind of the CDB mapping in the naming service
00149                     name[0].kind = CORBA::string_dup("");
00150                 
00151                     try 
00152                         {
00153                                 //use the naming service to get our object
00154                                 CORBA::Object_var dal_obj =  namingContext_m->resolve(name);
00155                                 
00156                                 //narrow it
00157                                 cdb = CDB::DAL::_narrow(dal_obj.in());
00158                         }
00159                     catch(CosNaming::NamingContext::NotFound ex)
00160                         {
00161                         // noop
00162                         }
00163 
00164                         notificationServiceName_mp = getNotificationFactoryNameForChannel(cdb.in(), channelName_mp, acsNCDomainName_mp);
00165                         if (!notificationServiceName_mp)
00166                                 notificationServiceName_mp = CORBA::string_dup(acscommon::NOTIFICATION_FACTORY_NAME);
00167                 }
00168                 
00169                 return notificationServiceName_mp;
00170         }
00171 
00178     virtual const CosNotification::QoSProperties
00179     getQoSProps();
00180     
00187     virtual const CosNotification::AdminProperties 
00188     getAdminProps();
00189 
00198     virtual void 
00199     createNotificationChannel();
00200 
00210     virtual void
00211     getNotifyService();
00212 
00221     virtual void
00222     attachChannelToNS();
00223 
00231     virtual void 
00232     destroyNotificationChannel();
00233 
00234     //--members-------------------------------------------------------------------------
00238     CosNaming::NamingContext_var namingContext_m;
00239 
00243     CosNotifyChannelAdmin::EventChannelFactory_var notifyFactory_m;
00244 
00249     CosNotifyChannelAdmin::ChannelID channelID_m;
00250     
00257     CosNotifyChannelAdmin::InterFilterGroupOperator ifgop_m;
00258 
00264     CosNotifyChannelAdmin::EventChannel_var notifyChannel_m;
00265 
00269     char* channelName_mp;
00270 
00274     char *acsNCDomainName_mp;
00275     
00279     char *notificationServiceName_mp;
00280 
00284     std::string channelAndDomainName_m;
00285 
00289     bool initCalled_m;
00290 };
00291 
00292 #endif 

Generated on Mon May 4 2015 08:27:42 for ACS-2015.4 C++ API by  doxygen 1.7.0