CosNaming_impl.pm untested

filter: Statementstmt 0.0% 0 / 72 Branchbran 0.0% 0 / 18 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 17 Podpod 0.0% 0 / 15 totaltotal 0.0% 0 / 122 CC 10 SCAR 31.8
CC
10
Cov
0%
resolve
72.0
bind
6.0
bind_context
6.0
CRAP 24.2
1 # $Id: CosNaming_impl.pm,v 1.6 1997/07/31 11:03:29 schuller Exp $
2 # Copyright (c) 1997 Lunatech Research / Bart Schuller <schuller@lunatech.com>
3 # See the file "Artistic" in the distribution for licensing and
4 # (lack of) warranties.
5  
6 use COPE::CosNaming_types;
7  
8 # IDL:omg.org/CosNaming/NamingContext:1.0
9 package CosNaming::NamingContext_impl;
10 @CosNaming::NamingContext_impl::ISA=qw();
11 use COPE::CORBA::Exception;
12  
13 sub new {
14 my($class,@args) = @_;
15 my $self = {};
16 return bless $self, $class;
17 }
18  
19 # IDL:omg.org/CosNaming/NamingContext/bind:1.0
20 sub bind {
21 my($self,$n,$obj) = @_;
22 my $component = pop @$n;
23 if (scalar(@$n) > 0) {
24 $self->resolve($n)->bind([$component], $obj);
25 } else {
26 $self->{'objects'}{$component->{'id'}} = [[$component], $obj];
27 }
28 }
29  
30 # IDL:omg.org/CosNaming/NamingContext/rebind:1.0
31 sub rebind {
32 my($self,$n,$obj) = @_;
33 }
34  
35 # IDL:omg.org/CosNaming/NamingContext/bind_context:1.0
36 sub bind_context {
37 my($self,$n,$nc) = @_;
38 my $component = pop @$n;
39 if (scalar(@$n) > 0) {
40 $self->resolve($n)->bind_context([$component], $nc);
41 } else {
42 $self->{'contexts'}{$component->{'id'}} = [[$component], $nc];
43 }
44 }
45  
46 # IDL:omg.org/CosNaming/NamingContext/rebind_context:1.0
47 sub rebind_context {
48 my($self,$n,$nc) = @_;
49 }
50  
51 # IDL:omg.org/CosNaming/NamingContext/resolve:1.0
52 sub resolve {
53 my($self,$n) = @_;
54 if (!@$n) {
55 throw CosNaming::NamingContext::InvalidName;
56 }
57 my $c = pop @$n;
58 my $o;
59 if (exists $self->{'contexts'}{$c->{'id'}}) {
60 $o = $self->{'contexts'}{$c->{'id'}}[1];
61 }
62 if (defined $o) {
63 return @$n ? $o->resolve($n) : $o;
64 }
65 if (exists $self->{'objects'}{$c->{'id'}}) {
66 $o = $self->{'objects'}{$c->{'id'}}[1];
67 }
68 if (defined $o) {
69 if (!@$n) {
70 return $o;
71 } else {
72 throw new CosNaming::NamingContext::NotFound
73 why => CosNaming::NamingContext::NotFoundReason::not_context,
74 rest_of_name => $n;
75 }
76 }
77 throw new CosNaming::NamingContext::NotFound
78 why => CosNaming::NamingContext::NotFoundReason::missing_node,
79 rest_of_name => [$c];
80 }
81  
82 # IDL:omg.org/CosNaming/NamingContext/unbind:1.0
83 sub unbind {
84 my($self,$n) = @_;
85 }
86  
87 # IDL:omg.org/CosNaming/NamingContext/new_context:1.0
88 sub new_context {
89 my($self) = @_;
90 return CosNaming::NamingContext_skel->new();
91 }
92  
93 # IDL:omg.org/CosNaming/NamingContext/bind_new_context:1.0
94 sub bind_new_context {
95 my($self,$n) = @_;
96 my $ctx = $self->new_context();
97 $self->bind_context($n, $ctx);
98 return $ctx;
99 }
100  
101 # IDL:omg.org/CosNaming/NamingContext/destroy:1.0
102 sub destroy {
103 my($self) = @_;
104 }
105  
106 # IDL:omg.org/CosNaming/NamingContext/list:1.0
107 sub list {
108 my($self,$how_many,$bl,$bi) = @_;
109 my $bindinglist = [ map { CosNaming::Binding->new(
110 binding_name => $_->[0],
111 binding_type => CosNaming::BindingType::ncontext
112 ) } values %{$self->{'contexts'}} ];
113 push @$bindinglist, map { CosNaming::Binding->new(
114 binding_name => $_->[0],
115 binding_type => CosNaming::BindingType::nobject
116 ) } values %{$self->{'objects'}};
117 push @$bl, @$bindinglist;
118 $$bi = CORBA::Object->_nil();
119 }
120  
121 # IDL:omg.org/CosNaming/BindingIterator:1.0
122 package CosNaming::BindingIterator_impl;
123 @CosNaming::BindingIterator_impl::ISA=qw();
124 sub new {
125 my($class,@args) = @_;
126 my $self = {};
127 return bless $self, $class;
128 }
129  
130 # IDL:omg.org/CosNaming/BindingIterator/next_one:1.0
131 sub next_one {
132 my($self,$b) = @_;
133 }
134  
135 # IDL:omg.org/CosNaming/BindingIterator/next_n:1.0
136 sub next_n {
137 my($self,$how_many,$bl) = @_;
138 }
139  
140 # IDL:omg.org/CosNaming/BindingIterator/destroy:1.0
141 sub destroy {
142 my($self) = @_;
143 }
144  
145  
146 1;