ALMA Computing Group

acsexmplClientTower.cpp

Go to the documentation of this file.
00001 /******************************************************************************* 00002 * ALMA - Atacama Large Millimiter Array 00003 * (c) European Southern Observatory, 2002 00004 * Copyright by ESO (in the framework of the ALMA collaboration) 00005 * and Cosylab 2002, All rights reserved 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 * 00022 * "@(#) $Id: acsexmplClientTower.cpp,v 1.8 2005/09/21 13:14:49 vwang Exp $" 00023 * 00024 * who when what 00025 * -------- -------- ---------------------------------------------- 00026 * oat 2002-12-17 templatization of the client.get_object method 00027 * david 2002-06-17 changed client.init(argc,argv) for improved error checking 00028 * gchiozzi 2002-02-13 cleane up 00029 * msekoran 2001/07/13 created 00030 */ 00031 00064 #include <vltPort.h> 00065 #include <acsutil.h> 00066 00067 #include <maciSimpleClient.h> 00068 #include <acsexmplBuildingC.h> 00069 #include <baciS.h> 00070 00071 using namespace maci; 00072 ACE_RCSID(acsexmplClientTower, acsexmpClientTower, "$Id: acsexmplClientTower.cpp,v 1.8 2005/09/21 13:14:49 vwang Exp $") 00073 /*******************************************************************************/ 00074 int main(int argc, char *argv[]) 00075 { 00076 if (argc < 2) 00077 return -1; 00078 00079 SimpleClient client; 00080 00081 if (client.init(argc,argv) == 0) 00082 { 00083 ACE_DEBUG((LM_DEBUG,"Cannot init client")); 00084 return -1; 00085 } 00086 client.login(); 00087 00088 00089 try 00090 { 00091 ACS_SHORT_LOG((LM_INFO, "Getting COB: %s", argv[1])); 00092 acsexmplBuilding::Building_var tower = client.get_object<acsexmplBuilding::Building>(argv[1], 0, true); 00093 00094 00095 if (!CORBA::is_nil(tower.in())) 00096 { 00097 ACS_SHORT_LOG((LM_INFO, "Got COB: %s", argv[1])); 00098 } 00099 else 00100 { 00101 ACS_SHORT_LOG((LM_INFO, "Unable to access COB: %s", argv[1])); 00102 } 00103 } 00104 catch( CORBA::Exception &ex ) 00105 { 00106 ACE_PRINT_EXCEPTION (ex, "main"); 00107 } 00108 00109 try 00110 { 00111 ACS_SHORT_LOG((LM_INFO,"Releasing...")); 00112 client.manager()->release_component(client.handle(), argv[1]); 00113 client.logout(); 00114 } 00115 catch( CORBA::Exception &_ex ) 00116 { 00117 ACE_PRINT_EXCEPTION (_ex, "main"); 00118 } 00119 00120 ACE_OS::sleep(3); 00121 return 0; 00122 } 00123 /*___oOo___*/ 00124 00125 00126 00127