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

baciTest.h

Go to the documentation of this file.
00001 #ifndef _BACITEST__H_
00002 #define _BACITEST__H_
00003 
00004 /*******************************************************************************
00005 * ALMA - Atacama Large Millimiter Array
00006 * (c) European Southern Observatory, 2004 
00007 *
00008 *This library is free software; you can redistribute it and/or
00009 *modify it under the terms of the GNU Lesser General Public
00010 *License as published by the Free Software Foundation; either
00011 *version 2.1 of the License, or (at your option) any later version.
00012 *
00013 *This library is distributed in the hope that it will be useful,
00014 *but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 *Lesser General Public License for more details.
00017 *
00018 *You should have received a copy of the GNU Lesser General Public
00019 *License along with this library; if not, write to the Free Software
00020 *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00021 *
00022 * "@(#) $Id: baciTest.h,v 1.93 2005/02/09 16:08:25 bjeram Exp $"
00023 *
00024 * who       when      what
00025 * --------  --------  ----------------------------------------------
00026 * rlemke    30/08/01  created
00027 */
00028 
00034 #ifndef __cplusplus
00035 #error This is a C++ include file and cannot be used from plain C
00036 #endif
00037 
00038 #define ACS_TEST_INIT_LOGGING \
00039 { \
00040   LoggingProxy::init (m_logger); \
00041   ACS_SHORT_LOG((LM_INFO, "Logging proxy successfully created !")); \
00042 }
00043 
00044 #define ACS_TEST_INIT_CORBA \
00045 { \
00046    ACE_TRY_EX (orb_block) \
00047     { \
00048       ACS_DEBUG("ACS_TEST_INIT_CORBA", "Initialising ORB ... "); \
00049       orb = CORBA::ORB_init (argc, argv, 0); \
00050       ACE_TRY_CHECK_EX (orb_block); \
00051       ACS_DEBUG ("ACS_TEST_INIT_CORBA", "ORB initialised !"); \
00052     } \
00053   ACE_CATCHANY \
00054     { \
00055       ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Failed to initalise ORB"); \
00056       return -1; \
00057     } \
00058   ACE_ENDTRY; \
00059 }
00060 
00061 #define ACS_TEST_RESOLV_NAMING_SERVICE \
00062 { \
00063   ACE_TRY_EX (ce_log_block) \
00064     { \
00065       ACS_DEBUG ("errorServer", "Resolving  Naming service ... "); \
00066       CORBA::Object_var naming_obj = \
00067         orb->resolve_initial_references ("NameService"); \
00068       ACE_TRY_CHECK_EX (ce_log_block); \
00069       if (!CORBA::is_nil (naming_obj.in ())) \
00070         { \
00071           CosNaming::NamingContext_var naming_context = \
00072             CosNaming::NamingContext::_narrow (naming_obj.in ()); \
00073           ACE_TRY_CHECK_EX (ce_log_block); \
00074           ACS_DEBUG ("errorServer", "Naming Service resolved !"); \
00075           ACS_DEBUG ("erorServer", "Resolving Logging Service from Naming service .... "); \
00076           CosNaming::Name name; \
00077           name.length(1); \
00078           name[0].id = CORBA::string_dup("Log"); \
00079           CORBA::Object_var log_obj = naming_context->resolve(name); \
00080           ACE_TRY_CHECK_EX (ce_log_block); \
00081           if (!CORBA::is_nil (log_obj.in())) \
00082             { \
00083               DsLogAdmin::Log_var logger = DsLogAdmin::Log::_narrow(log_obj.in()); \
00084               ACE_TRY_CHECK_EX (ce_log_block); \
00085               ACS_DEBUG ("errorServer", "Logging Service resolved !"); \
00086               m_logger->setCentralizedLogger(logger.in()); \
00087             } \
00088           else \
00089             { \
00090               ACS_DEBUG ("errorServer", "Failed to initialise the Logging Service!"); \
00091             } \
00092         } \
00093       else \
00094         { \
00095           ACS_DEBUG ("errorServer", "Failed to initialise the NameService!"); \
00096         } \
00097     } \
00098   ACE_CATCHANY \
00099     { \
00100       ACE_PRINT_EXCEPTION(ACE_ANY_EXCEPTION, "Failed to get and set the centralized logger"); \
00101     } \
00102   ACE_ENDTRY; \
00103 }
00104 
00105 #endif
00106 
00107 

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