Use =default for skeleton copy constructor
[ACE_TAO.git] / TAO / tests / Bug_2560_Regression / client.cpp
blobc6d21dbae1d9af7159b237b268e1cb4df20de829
2 // Include the generated names....
3 #include "QuoterC.h"
4 #include "ace/streams.h"
6 int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
8 try {
9 // First initialize the ORB, that will remove some arguments...
10 CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
12 // There must be at least two arguments, the first is the factory
13 // name, the rest are the names of the stock symbols we want to
14 // get quotes for.
15 if (argc < 3) {
16 cerr << "Usage: " << argv[0] << " Factory_IOR symbol symbol..." << endl;
17 return 1;
20 // Use the first argument to create the factory object reference,
21 // in real applications we use the naming service, but let's do
22 // the easy part first!
23 CORBA::Object_var factory_object = orb->string_to_object (argv[1]);
25 // Now downcast the object reference to the appropriate type
26 Quoter::Stock_Factory_var factory = Quoter::Stock_Factory::_narrow (factory_object.in ());
28 // Now get the full name and price of the other arguments:
29 for (int i = 2; i != argc; ++i) {
30 try {
31 // Get the stock object
32 Quoter::Stock_var stock = factory->get_stock (ACE_TEXT_ALWAYS_CHAR (argv[i]));
34 // Get its name, put it on a _var so it is automatically
35 // released!
36 CORBA::String_var full_name = stock->full_name ();
38 // Now get the price
39 CORBA::Double price = stock->price ();
41 Quoter::Stock::StockHistory_var history = stock->history();
43 cout << "The price of a stock in \"" << full_name.in () << "\" is $" << price << endl;
44 cout << " history: " << history[0] << " " << history[1] << " ... " << history[history->length()-1] << endl;
45 } catch (Quoter::Invalid_Stock_Symbol &) {
46 cerr << "Invalid stock symbol <" << argv[i] << ">" << endl;
50 // Finally destroy the ORB
51 orb->destroy ();
53 catch (const CORBA::Exception& e) {
54 cerr << "CORBA exception raised: " << e << endl;
56 return 0;