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

archiveeventsArchiveSupplier.h

Go to the documentation of this file.
00001 #ifndef archive_event_supplier_H
00002 #define archive_event_supplier_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  * "@(#) $Id: archiveeventsArchiveSupplier.h,v 1.9 2009/05/22 16:21:26 javarias Exp $"
00024  *
00025  * who       when        what
00026  * --------  ----------  ----------------------------------------------
00027  * msekoran  2001-06-17  created
00028  */
00029 
00030 #ifndef __cplusplus
00031 #error This is a C++ include file and cannot be used from plain C
00032 #endif
00033 
00038 #include <lokiSingleton.h>
00039 #include <baciC.h>
00040 
00041 #include <basencSupplier.h>
00042 #include <ACSErrTypeCORBA.h>
00043 #include <acsncErrType.h>
00044 
00053 class ArchiveSupplier : public BaseSupplier
00054 {
00055   public:
00059     ArchiveSupplier();
00060 
00064     virtual ~ArchiveSupplier();
00065 
00080     template <class T> 
00081     void 
00082     sendEvent(CORBA::Short priority,
00083               ACS::Time timeStamp,
00084               const std::string& component,
00085               const std::string& property,
00086               T value,
00087               const std::string& container="")
00088         {
00089             CORBA::Any any;
00090             any <<= value;
00091 
00092                  try{
00093                          this->send_event(priority,
00094                                          timeStamp,
00095                                          component,
00096                                          property,
00097                                          any,
00098                                          container);
00099                  }
00100                  catch(ACSErrTypeCORBA::CORBAReferenceNilExImpl& ex1)
00101                  {
00102                          acsncErrType::PublishEventFailureExImpl
00103                                  ex2 (__FILE__, __LINE__, "ArchiveSupplier::send_event");
00104                          ex2.setEventName("archiving_event");
00105                          ex2.setChannelName(channelName_mp);
00106                          throw ex2;
00107                  }
00108                  catch(ACSErrTypeCORBA::NarrowFailedExImpl& ex1)
00109                  {
00110                          acsncErrType::PublishEventFailureExImpl
00111                                  ex2 (__FILE__, __LINE__, "ArchiveSupplier::send_event");
00112                          ex2.setEventName("archiving_event");
00113                          ex2.setChannelName(channelName_mp);
00114                          throw ex2;
00115                  }
00116                  catch(ACSErrTypeCORBA::FailedToResolveServiceExImpl& ex1)
00117                  {
00118                          acsncErrType::PublishEventFailureExImpl
00119                                  ex2 (__FILE__, __LINE__, "ArchiveSupplier::send_event");
00120                          ex2.setEventName("archiving_event");
00121                          ex2.setChannelName(channelName_mp);
00122                          throw ex2;
00123                  }
00124         }
00125     
00140     void 
00141     send_event(CORBA::Short priority,
00142                ACS::Time timeStamp,
00143                const std::string& component,
00144                const std::string& property,
00145                CORBA::Any value,
00146                const std::string& container);
00147 
00148   protected:
00149     
00153     virtual const char*
00154     getNotificationFactoryName()
00155         {return acscommon::ARCHIVE_NOTIFICATION_FACTORY_NAME;}
00156 
00160     virtual const char*
00161     getChannelDomain() 
00162         {return acscommon::ARCHIVING_DOMAIN;}
00163 
00167     virtual const char* 
00168     getChannelKind() 
00169         { return acscommon::ARCHIVING_CHANNEL_KIND; }
00170 
00174     virtual const char*
00175     getEventType()
00176         { return ""; }
00177     
00178 };
00179 
00184 typedef Loki::SingletonHolder<ArchiveSupplier, 
00185                               Loki::CreateUsingNew, 
00186                               Loki::PhoenixSingleton, 
00187                               Loki::SingleThreaded> ArchiveSupplierSingleton;
00188 
00189 #endif

Generated on Thu Jan 12 2012 23:13:50 for ACS-10.0 C++ API by  doxygen 1.7.0