summaryrefslogtreecommitdiff
path: root/TAO/tests/Bug_2560_Regression/Stock_i.cpp
blob: fe0e01c054d9fea9fc3d57f0569be748f044bec3 (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
//
// $Id$
//

#include "Stock_i.h"
#include "ace/OS_NS_unistd.h"

PortableServer::POA_ptr Quoter_Stock_i::_poa ;

Quoter_Stock_i::Quoter_Stock_i (const char *symbol,
                                const char *full_name,
                                CORBA::Double price)
  : symbol_ (symbol)
  , full_name_ (full_name)
  , price_ (price)
{
}

char *
Quoter_Stock_i::symbol () throw (CORBA::SystemException)
{
  return CORBA::string_dup (this->symbol_.c_str ());
}

char *
Quoter_Stock_i::full_name () throw (CORBA::SystemException)
{
  return CORBA::string_dup (this->full_name_.c_str ());
}

CORBA::Double
Quoter_Stock_i::price () throw (CORBA::SystemException)
{
  return this->price_;
}

Quoter::Stock::StockHistory*
Quoter_Stock_i::history () throw (CORBA::SystemException)
{
  Quoter::Stock::StockHistory_var hist = new Quoter::Stock::StockHistory ;

  // delay a little bit so we have chance to kill client
  // before this method returns
  ACE_OS::sleep(5) ;

  const unsigned hsize = 200000 ;
  hist->length(hsize) ;
  for ( unsigned int i = 0 ; i < hsize ; ++ i ) {
    hist[i] = double(i+1) ;
  }

  ACE_DEBUG ((LM_DEBUG, "Returning method in server\n"));
  return hist._retn() ;
}