• 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.10 2012/01/21 22:48:11 tstaig 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 #include <archiveeventsExport.h>
00045 
00054 class ArchiveSupplier : public BaseSupplier
00055 {
00056   public:
00060     ArchiveSupplier();
00061 
00065     virtual ~ArchiveSupplier();
00066 
00081     template <class T> 
00082     void 
00083     sendEvent(CORBA::Short priority,
00084               ACS::Time timeStamp,
00085               const std::string& component,
00086               const std::string& property,
00087               T value,
00088               const std::string& container="")
00089         {
00090             CORBA::Any any;
00091             any <<= value;
00092 
00093                  try{
00094                          this->send_event(priority,
00095                                          timeStamp,
00096                                          component,
00097                                          property,
00098                                          any,
00099                                          container);
00100                  }
00101                  catch(ACSErrTypeCORBA::CORBAReferenceNilExImpl& ex1)
00102                  {
00103                          acsncErrType::PublishEventFailureExImpl
00104                                  ex2 (__FILE__, __LINE__, "ArchiveSupplier::send_event");
00105                          ex2.setEventName("archiving_event");
00106                          ex2.setChannelName(channelName_mp);
00107                          throw ex2;
00108                  }
00109                  catch(ACSErrTypeCORBA::NarrowFailedExImpl& ex1)
00110                  {
00111                          acsncErrType::PublishEventFailureExImpl
00112                                  ex2 (__FILE__, __LINE__, "ArchiveSupplier::send_event");
00113                          ex2.setEventName("archiving_event");
00114                          ex2.setChannelName(channelName_mp);
00115                          throw ex2;
00116                  }
00117                  catch(ACSErrTypeCORBA::FailedToResolveServiceExImpl& ex1)
00118                  {
00119                          acsncErrType::PublishEventFailureExImpl
00120                                  ex2 (__FILE__, __LINE__, "ArchiveSupplier::send_event");
00121                          ex2.setEventName("archiving_event");
00122                          ex2.setChannelName(channelName_mp);
00123                          throw ex2;
00124                  }
00125         }
00126     
00141     void 
00142     send_event(CORBA::Short priority,
00143                ACS::Time timeStamp,
00144                const std::string& component,
00145                const std::string& property,
00146                CORBA::Any value,
00147                const std::string& container);
00148 
00149   protected:
00150     
00154     virtual const char*
00155     getNotificationFactoryName()
00156         {return acscommon::ARCHIVE_NOTIFICATION_FACTORY_NAME;}
00157 
00161     virtual const char*
00162     getEventType()
00163         { return ""; }
00164     
00165 };
00166 
00171 #ifdef __CYGWIN__
00172 template class ARCHIVEEVENTS_Export Loki::SingletonHolder<ArchiveSupplier,
00173                Loki::CreateUsingNew,
00174                Loki::PhoenixSingleton,
00175                Loki::SingleThreaded>;
00176 #endif
00177 typedef Loki::SingletonHolder<ArchiveSupplier, 
00178                               Loki::CreateUsingNew, 
00179                               Loki::PhoenixSingleton, 
00180                               Loki::SingleThreaded> ArchiveSupplierSingleton;
00181 
00182 #endif

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