summaryrefslogtreecommitdiff
path: root/ACE/TAO/docs/tutorials/Quoter/RTCORBA/docs/nameConsumer.html
blob: 95d20b23aedb0863569edb47a2750c23fb87f674 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!-- $Id$ -->

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title>Stock NameConsumer implementation for the Stock Quoter Publisher/Subscriber Real-time CORBA Service</title>
</head>

<body
 text = "#000000"
 link = "#000fff"
 vLink= "#ff0f0f"
 aLink = "#0000ff"
 bgColor = "#ffffff">

<hr><h2>Stock NameConsumer implementation for the Stock Quoter Publisher/Subscriber Real-time CORBA Service</h2><hr>

<h3>Implementation of StockNameConsumer interface</h3>

This interface is used as a callback interface used by the Stock Distributor server to notify Stock Broker clients 
of updates. This class is ALSO used as a signal handler to catch SIGINT and properly unsubscribe from the Stock 
Distributor server.<P>

The Stock_StockNameConsumer_i class is generated automatically by the IDL compiler (using the -GI flag),
which is a subclass of POA_Stock::StockNameConsumer class. <P>

<h4>Implementing the Constructor</h4>

<PRE>
    Stock_StockNameConsumer_i::Stock_StockNameConsumer_i (Stock_StockBroker_i &context,
                                                          const char *stock_name)
      : context_ (context),
        stock_name_ (stock_name)
</PRE>

The "context_" and "stock_name_" are two private members of the Stock_StockNameConsumer_i class. They stand for the
context of the StockNameConsumer object and the name of the stock to listen to respectively. <P>

<h4>Implementing the push_StockName () member function</h4>

The main steps of this function are described as follows: <P>

<li>Verify this is the correct stock: Check if the StockName parameter in this function is equal to
the "stock_name_" private member. If this is not the stock that we are interested in then we need to stop
and return.</li> <P>

<li>Get the quoter for the connection from the context_ private member.</li>

<PRE>
    Stock::StockQuoter_var quoter = context_->get_connection_quoter_info ();
</PRE>

<li>Request more information from the quoter.</li>

<PRE>
    Stock::StockInfo_var stock_info = quoter->get_stock_info (the_stockname->name());
</PRE>

<h4>Implementing the access operations of the cookie attribute.</h4>

<li>Get the cookie attribute:</li>

<PRE>
    return this->cookie_.in ();
</PRE>

<li>Set the cookie attribute:</li>

<PRE>
    this->cookie_ = cookie;
    cookie->_add_ref ();
</PRE>

<hr><b>Email: </b><a href="mailto:"</a<ADDRESS>shanshan.jiang@vanderbilt.edu</ADDRESS>

</body>

</html>