2 #include "StockNameConsumer_i.h"
5 // Implementation skeleton constructor
6 Stock_StockNameConsumer_i::Stock_StockNameConsumer_i (Stock_StockBroker_i
&context
,
7 const char *stock_name
)
9 stock_name_ (stock_name
)
13 // Implementation skeleton destructor
14 Stock_StockNameConsumer_i::~Stock_StockNameConsumer_i (void)
18 void Stock_StockNameConsumer_i::push_StockName (::Stock::StockNames
*the_stockname
)
20 for (CORBA::ULong i
= 0;
21 i
< the_stockname
->names ().length ();
24 if (ACE_OS::strcmp (this->stock_name_
.in (),
25 the_stockname
->names ()[i
]) == 0)
27 // Get the quoter for the connection from the <context_>.
29 "*** message: getting the quoter connection\n"));
30 Stock::StockQuoter_var quoter
=
31 this->context_
.get_connection_quoter_info ();
35 // Request more information from the StockQuoter.
37 "*** message: requesting the stock info from the quoter\n"));
38 Stock::StockInfo_var stock_info
=
39 quoter
->get_stock_info (the_stockname
->names()[i
]);
41 // Display the current value of the stock.
43 "Current value of %s is $%d\n",
44 stock_info
->name
.in (),
47 catch (Stock::Invalid_Stock
&e
)
49 e
._tao_print_exception ("Stock exception: invalid stock name: ");
51 catch (const CORBA::Exception
&ex
)
53 ex
._tao_print_exception ("Stock_StockNameConsumer_i::push_StockName: ");
60 Stock_StockNameConsumer_i::cookie_ ()
62 return this->cookie__
.in ();
66 Stock_StockNameConsumer_i::cookie_ (::Stock::Cookie
*cookie
)
68 this->cookie__
= cookie
;