1 #include "Persistent_Client.h"
2 #include "ace/Get_Opt.h"
3 #include "ace/Read_Buffer.h"
5 // This is the interface program that accesses the remote object
8 Persistent_Client_i::Persistent_Client_i (void)
16 Persistent_Client_i::~Persistent_Client_i (void)
22 Persistent_Client_i::parse_args (int argc
,
25 // Parses some of the options that are specific to this example
26 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("dk:f:xw:h:r"));
29 while ((c
= get_opts ()) != -1)
34 this->width_
= (u_int
) ACE_OS::atoi (get_opts
.opt_arg ());
37 this->height_
= (u_int
) ACE_OS::atoi (get_opts
.opt_arg ());
49 Persistent_Client_i::run (const char *name
,
53 // Initialize the client.
54 if (client
.init (name
, argc
, argv
) == -1)
57 if (this->parse_args (argc
, argv
) == -1)
64 Grid_ptr grid
= client
->make_grid (width_
,
68 "(%P|%t) Made the grid successfully\n"));
71 for (CORBA::Short index_
= 0; index_
< height_
; index_
++)
73 for (CORBA::Short ctr
= 0; ctr
< width_
; ctr
++)
75 CORBA::Long ret_val
= grid
->get (index_
,
79 "Grid value [%d][%d] = %d\n",index_
, ctr
,ret_val
));
83 if (client
.shutdown () == 1) {
87 if (this->remove_
== 1) {
91 catch (const CORBA::UserException
& range_ex
)
93 range_ex
._tao_print_exception ("\tFrom get and set grid");
96 catch (const CORBA::SystemException
& memex
)
98 memex
._tao_print_exception ("Cannot make grid as Memory exhausted");