summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/Notify/lib/Peer.cpp
blob: f6e11655d4094f4bedeef5d4ce868330605272ac (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// $Id$

#include "Peer.h"

#if ! defined (__ACE_INLINE__)
#include "Peer.inl"
#endif /* __ACE_INLINE__ */

ACE_RCSID (lib, 
           TAO_Peer, 
           "$Id$")

#include "ace/Arg_Shifter.h"
#include "Name.h"
#include "LookupManager.h"
#include "Options_Parser.h"
#include "orbsvcs/orbsvcs/NotifyExtC.h"

TAO_Notify_Tests_Peer::TAO_Notify_Tests_Peer (void)
  : poa_name_ (TAO_Notify_Tests_Name::root_poa)
  , ifgop_ (CosNotifyChannelAdmin::OR_OP)
{
}

TAO_Notify_Tests_Peer::~TAO_Notify_Tests_Peer ()
{
}

void
TAO_Notify_Tests_Peer::init (PortableServer::POA_ptr poa  ACE_ENV_ARG_DECL_NOT_USED)
{
  this->default_POA_ = PortableServer::POA::_duplicate (poa);
}

int
TAO_Notify_Tests_Peer::init_state (ACE_Arg_Shifter& arg_shifter)
{
  while (arg_shifter.is_anything_left ())
    {
      if (arg_shifter.cur_arg_strncasecmp ("-Admin") == 0)
        {
          arg_shifter.consume_arg ();

          this->admin_name_ = arg_shifter.get_current ();
          arg_shifter.consume_arg ();
        }
      else if (arg_shifter.cur_arg_strncasecmp ("-Proxy") == 0)
        {
          arg_shifter.consume_arg ();

          this->proxy_name_ = arg_shifter.get_current ();
          arg_shifter.consume_arg ();
        }
      // Is a POA name specified?
      else if (arg_shifter.cur_arg_strncasecmp ("-POA") == 0)
        {
          arg_shifter.consume_arg ();

          this->poa_name_ = arg_shifter.get_current ();
          arg_shifter.consume_arg ();
        }
      else if (arg_shifter.cur_arg_strncasecmp ("-Set_QoS") == 0) // -Set_QoS [Qos Options]
        {
          arg_shifter.consume_arg ();

          TAO_Notify_Tests_Options_Parser qos_parser;
          qos_parser.execute (this->qos_, arg_shifter);
        }
      else
        {
          break;
        }
    } /* while */

  return 0;
}

void
TAO_Notify_Tests_Peer::set_name (ACE_CString& name)
{
  this->name_ = name;
}

const ACE_CString&
TAO_Notify_Tests_Peer::get_name (void)
{
  return this->name_;
}

void
TAO_Notify_Tests_Peer::set_poa (PortableServer::POA_ptr poa  ACE_ENV_ARG_DECL_NOT_USED)
{
  this->default_POA_ = PortableServer::POA::_duplicate (poa);
}