# $Id: Anything_impl.pm 1206 2006-05-31 07:11:53Z rvosa $ # Generated on Sun Sep 26 16:02:02 1999 by idl2perl 1.31 with command: # bin/idl2perl -impl Data.idl use COPE::CORBA::Any; use COPE::Data::Anything_types; use COPE::Data::Anything_skel; # interface Data::Anything (IDL:cope/Data/Anything:1.0) package Data::Anything_impl; use COPE::CORBA::TCKind; use COPE::CORBA::Servant; @Data::Anything_impl::ISA=qw(CORBA::BOA::_Servant); sub _skelname($) { 'Data::Anything_skel' } # Receive an Any value and send back the previous one. # Store some aspects of this value in the object hash. sub one_thing ($$) { my($self, $thing, $nested) = @_; my $retval = $self->{'last'}; my ($type, $value); if (!defined($retval)) { # This is the first call $retval = new CORBA::Any; $self->{'number'} = 0; $self->{'story'} = ''; } if ($nested) { $type = $thing->type(); $value = $thing->value(); } else { $self->{'last'} = $thing->new; # Makes a copy $type = $thing->type($retval->type); $value = $thing->value($retval->value); } my $kind = $type->kind; if ($kind == tk_short || $kind == tk_long || $kind == tk_ulong || $kind == tk_float || $kind == tk_double || $kind == tk_longlong) { $self->{'number'} += $value; } elsif ($kind == tk_string) { $self->{'story'} .= $value; } elsif ($kind == tk_sequence || $kind == tk_array) { my $ct = $type->content_type; map { $self->one_thing(new CORBA::Any($ct, $_), 1); } @$value; } elsif ($kind == tk_any) { $self->one_thing($value, 1); } elsif ($kind == tk_struct) { my $count = $type->member_count; for (my $i = 0; $i < $count; ++$i) { $self->one_thing(new CORBA::Any($type->member_type($i), $value->{$type->member_name($i)} ), 1); } } } # operation summary (IDL:cope/Data/Anything/summary:1.0) sub summary ($$) { my($self,$thing) = @_; $self->one_thing($thing); return [ { 'name' => 'last', 'stuff' => $self->{'last'} }, { 'name' => 'number', 'stuff' => new CORBA::Any($CORBA::_tc_double, $self->{'number'}) }, { 'name' => 'story', 'stuff' => new CORBA::Any($CORBA::_tc_string0, $self->{'story'}) } ]; } 1;