line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DMTF::CIM::Instance; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use version; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
our $VERSION = qv('0.04'); |
8
|
|
|
|
|
|
|
require DMTF::CIM::_model; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @ISA=qw(DMTF::CIM::_model); |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
563
|
use DMTF::CIM::Instance::Property; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
13
|
1
|
|
|
1
|
|
453
|
use DMTF::CIM::Instance::Method; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
14
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1157
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Module implementation here |
17
|
|
|
|
|
|
|
sub new |
18
|
|
|
|
|
|
|
{ |
19
|
0
|
|
|
0
|
0
|
|
my $class=shift; |
20
|
0
|
|
|
|
|
|
my %args=@_; |
21
|
0
|
|
|
|
|
|
my $self=DMTF::CIM::_model::new($class,$args{parent},$args{class}); |
22
|
0
|
|
0
|
|
|
|
$self->{VALUES}=$args{values} || {}; |
23
|
0
|
|
|
|
|
|
$self->{PROPERTIES}={}; |
24
|
0
|
|
|
|
|
|
$self->{METHODS}={}; |
25
|
0
|
0
|
|
|
|
|
if(defined $args{uri}) { |
26
|
0
|
|
|
|
|
|
$self->{URI}=URI->new($args{uri}); |
27
|
|
|
|
|
|
|
} |
28
|
0
|
|
|
|
|
|
return($self); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub property |
32
|
|
|
|
|
|
|
{ |
33
|
0
|
|
|
0
|
1
|
|
my $self=shift; |
34
|
0
|
|
|
|
|
|
my $name=shift; |
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
if(!defined $name) { |
37
|
0
|
|
|
|
|
|
carp("No property name specified for property() of $self->{DATA}{name}"); |
38
|
0
|
|
|
|
|
|
return; |
39
|
|
|
|
|
|
|
} |
40
|
0
|
0
|
|
|
|
|
return($self->{PROPERTIES}{lc($name)}) if defined $self->{PROPERTIES}{lc($name)}; |
41
|
0
|
|
|
|
|
|
my $propref=$self->{DATA}{properties}{lc($name)}; |
42
|
0
|
0
|
|
|
|
|
if(!defined $propref) { |
43
|
0
|
|
|
|
|
|
$propref=$self->{DATA}{references}{lc($name)}; |
44
|
|
|
|
|
|
|
} |
45
|
0
|
0
|
|
|
|
|
if(!defined $propref) { |
46
|
0
|
|
|
|
|
|
carp("$self->{DATA}{name}.$name is not defined in the model"); |
47
|
0
|
|
|
|
|
|
return; |
48
|
|
|
|
|
|
|
} |
49
|
0
|
0
|
|
|
|
|
$self->{VALUES}{$propref->{name}}=undef unless exists $self->{VALUES}{$propref->{name}}; |
50
|
0
|
|
|
|
|
|
$self->{PROPERTIES}{lc($name)}=DMTF::CIM::Instance::Property->new(parent=>$self,property=>$propref,value=>\$self->{VALUES}{$propref->{name}}); |
51
|
0
|
|
|
|
|
|
return $self->{PROPERTIES}{lc($name)}; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub method |
55
|
|
|
|
|
|
|
{ |
56
|
0
|
|
|
0
|
1
|
|
my $self=shift; |
57
|
0
|
|
|
|
|
|
my $name=shift; |
58
|
|
|
|
|
|
|
|
59
|
0
|
0
|
|
|
|
|
if(!defined $name) { |
60
|
0
|
|
|
|
|
|
carp("No method name specified for method() of $self->{DATA}{name}"); |
61
|
0
|
|
|
|
|
|
return; |
62
|
|
|
|
|
|
|
} |
63
|
0
|
0
|
|
|
|
|
return($self->{METHODS}{lc($name)}) if defined $self->{METHODS}{lc($name)}; |
64
|
0
|
|
|
|
|
|
my $methodref=$self->{DATA}{methods}{lc($name)}; |
65
|
0
|
0
|
|
|
|
|
if(!defined $methodref) { |
66
|
0
|
|
|
|
|
|
carp("$self->{DATA}{name}.$name() is not defined in the model"); |
67
|
0
|
|
|
|
|
|
return; |
68
|
|
|
|
|
|
|
} |
69
|
0
|
|
|
|
|
|
$self->{METHODS}{lc($name)}=DMTF::CIM::Instance::Method->new(parent=>$self,method=>$methodref); |
70
|
0
|
|
|
|
|
|
return $self->{METHODS}{lc($name)}; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub uri |
74
|
|
|
|
|
|
|
{ |
75
|
0
|
|
|
0
|
1
|
|
my $self=shift; |
76
|
0
|
|
|
|
|
|
my $newuri=shift; |
77
|
0
|
0
|
|
|
|
|
if(defined($newuri)) { |
78
|
0
|
|
|
|
|
|
$self->{URI}=URI->new($newuri); |
79
|
|
|
|
|
|
|
} |
80
|
0
|
|
|
|
|
|
my $uri=$self->{URI}->canonical; |
81
|
0
|
0
|
|
|
|
|
if(ref($uri)) { |
82
|
0
|
|
|
|
|
|
return $$uri; |
83
|
|
|
|
|
|
|
} |
84
|
0
|
|
|
|
|
|
return $uri; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# Read-only |
88
|
|
|
|
|
|
|
sub class |
89
|
|
|
|
|
|
|
{ |
90
|
0
|
|
|
0
|
1
|
|
my $self=shift; |
91
|
0
|
|
|
|
|
|
return $self->name; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub is_association |
95
|
|
|
|
|
|
|
{ |
96
|
0
|
|
|
0
|
1
|
|
my $self=shift; |
97
|
|
|
|
|
|
|
|
98
|
0
|
0
|
0
|
|
|
|
return 1 if(defined $self->{DATA}{qualifiers}{association} && $self->{DATA}{qualifiers}{association}{value} eq 'true'); |
99
|
0
|
|
|
|
|
|
return 0; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub defined_properties |
103
|
|
|
|
|
|
|
{ |
104
|
0
|
|
|
0
|
1
|
|
my $self=shift; |
105
|
0
|
|
|
|
|
|
my @ret; |
106
|
0
|
|
|
|
|
|
foreach my $prop (sort keys(%{$self->{VALUES}})) { |
|
0
|
|
|
|
|
|
|
107
|
0
|
0
|
|
|
|
|
if(defined $self->{VALUES}{$prop}) { |
108
|
0
|
|
|
|
|
|
my $newprop=$self->property($prop); |
109
|
0
|
0
|
|
|
|
|
push @ret,$newprop if defined $newprop; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
} |
112
|
0
|
|
|
|
|
|
return @ret; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub all_properties |
116
|
|
|
|
|
|
|
{ |
117
|
0
|
|
|
0
|
1
|
|
my $self=shift; |
118
|
0
|
|
|
|
|
|
my @ret; |
119
|
0
|
|
|
|
|
|
foreach my $prop (sort keys(%{$self->{DATA}{properties}})) { |
|
0
|
|
|
|
|
|
|
120
|
0
|
0
|
|
|
|
|
if(defined $self->{DATA}{properties}{$prop}{name}) { |
121
|
0
|
|
|
|
|
|
my $newprop=$self->property($prop); |
122
|
0
|
0
|
|
|
|
|
push @ret,$newprop if defined $newprop; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
} |
125
|
0
|
|
|
|
|
|
foreach my $prop (sort keys(%{$self->{DATA}{references}})) { |
|
0
|
|
|
|
|
|
|
126
|
0
|
0
|
|
|
|
|
if(defined $self->{DATA}{references}{$prop}{name}) { |
127
|
0
|
|
|
|
|
|
my $newprop=$self->property($prop); |
128
|
0
|
0
|
|
|
|
|
push @ret,$newprop if defined $newprop; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
} |
131
|
0
|
|
|
|
|
|
return(sort { $a->name cmp $b->name } @ret); |
|
0
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub methods |
135
|
|
|
|
|
|
|
{ |
136
|
0
|
|
|
0
|
1
|
|
my $self=shift; |
137
|
0
|
|
|
|
|
|
my @ret; |
138
|
0
|
|
|
|
|
|
foreach my $method (sort keys(%{$self->{DATA}{methods}})) { |
|
0
|
|
|
|
|
|
|
139
|
0
|
0
|
|
|
|
|
if(defined $self->{DATA}{methods}{$method}{name}) { |
140
|
0
|
|
|
|
|
|
my $newmethod=$self->method($method); |
141
|
0
|
0
|
|
|
|
|
push @ret,$newmethod if defined $newmethod; |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
} |
144
|
0
|
|
|
|
|
|
return(sort { $a->name cmp $b->name } @ret); |
|
0
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub superclass |
148
|
|
|
|
|
|
|
{ |
149
|
0
|
|
|
0
|
1
|
|
my $self=shift; |
150
|
0
|
|
|
|
|
|
return $self->{DATA}{superclass}; |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
154
|
|
|
|
|
|
|
__END__ |