Borland(R) Enterprise Server VisiBroker(R) デベロッパーズガイド
Clientプログラムは,bankのアカウントの現在の残高を取得するクライアントアプリケーションをインプリメントします。bankクライアントプログラムは次の手順を実行します。
#include "Bank_c.hh" int main(int argc, char* const* argv) { try { // Initialize the ORB. CORBA::ORB_ptr orb = CORBA::ORB_init(argc, argv); // Get the manager Id PortableServer::ObjectId_var managerId = PortableServer::string_to_ObjectId("BankManager"); // Locate an account manager. Give the full POA name and // the servant ID. Bank::AccountManager_ptr manager = Bank::AccountManager::_bind( "/bank_agent_poa", managerId); // use argv[1] as the account name, or a default. const char* name = argc > 1 ? argv[1] : "Jack B. Quick"; // Request the account manager to open a named account. Bank::Account_ptr account = manager->open(name); // Get the balance of the account. float balance = account->balance(); // Print out the balance. cout << "The balance in "<< name << "'s account is $" << balance << endl; } catch(const CORBA::Exception& e) { cerr << e << endl; } }
All Rights Reserved. Copyright (C) 2006, Hitachi, Ltd.
COPYRIGHT (C) 1992-2004 Borland Software Corporation. All rights reserved.