line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# This class presents common functionality between package real parts (OPC::Part), and |
2
|
|
|
|
|
|
|
# it's root (OPC::Root) |
3
|
|
|
|
|
|
|
package OPC::Node; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
8
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
7
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
772
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
0
|
|
|
0
|
0
|
|
my( $Class, %Params ) = @_; |
11
|
|
|
|
|
|
|
|
12
|
0
|
0
|
0
|
|
|
|
if( !exists($Params{package}) || !defined( $Params{package} )) { |
13
|
0
|
|
|
|
|
|
Carp::confess 'Must specify package of the part in argument "package"'; |
14
|
|
|
|
|
|
|
} |
15
|
0
|
|
|
|
|
|
my $Package = $Params{package}; |
16
|
0
|
0
|
|
|
|
|
unless( $Package->isa( 'OPC' )) { |
17
|
0
|
|
|
|
|
|
Carp::confess 'Package must be instance of OPC'; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
0
|
0
|
0
|
|
|
|
if( !exists($Params{name}) || !defined( $Params{name} )) { |
21
|
0
|
|
|
|
|
|
Carp::confess 'Must specify name of the node in argument "name"'; |
22
|
|
|
|
|
|
|
} |
23
|
0
|
|
|
|
|
|
my $Name = $Params{name}; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
return bless { |
26
|
|
|
|
|
|
|
package => $Package, |
27
|
|
|
|
|
|
|
name => $Name, |
28
|
|
|
|
|
|
|
}, $Class; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
0
|
0
|
|
sub Name { $_[0]->{name} } |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
0
|
0
|
|
sub Package { $_[0]->{package} } |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub RelatedPart { |
36
|
0
|
|
|
0
|
0
|
|
my( $self, %RelationParams ) = @_; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my @Parts = $self->RelatedParts( %RelationParams ); |
39
|
0
|
0
|
|
|
|
|
unless( @Parts ) { |
40
|
0
|
|
|
|
|
|
Carp::confess "No parts with given params found"; |
41
|
|
|
|
|
|
|
} |
42
|
0
|
0
|
|
|
|
|
if( @Parts > 1 ) { |
43
|
0
|
|
|
|
|
|
Carp::confess "Requested only part with given params but found ".scalar(@Parts)." parts"; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
0
|
0
|
|
|
|
|
return @Parts ? $Parts[0] : undef; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub RelatedParts { |
50
|
0
|
|
|
0
|
0
|
|
my( $self, %RelationParams ) = @_; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
return |
53
|
0
|
|
|
|
|
|
map $self->{package}->Part( name => $_->{TargetFullName} ), |
54
|
|
|
|
|
|
|
$self->Relations( %RelationParams ); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub Relations { |
58
|
0
|
|
|
0
|
0
|
|
my( $self, %RelationParams ) = @_; |
59
|
0
|
|
|
|
|
|
return $self->{package}->Relations( $self->RelsName, %RelationParams ); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub CreateRelationsID { |
63
|
0
|
|
|
0
|
0
|
|
my( $self, %RelationParams ) = @_; |
64
|
0
|
|
|
|
|
|
return $self->{package}->CreateRelationsID( $self->RelsName, %RelationParams ); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub RemoveRelations { |
68
|
0
|
|
|
0
|
0
|
|
my( $self, %RelationParams ) = @_; |
69
|
0
|
|
|
|
|
|
$self->{package}->RemoveRelations( $self->RelsName, %RelationParams ); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub AddRelation { |
73
|
0
|
|
|
0
|
0
|
|
my( $self, %RelationParams ) = @_; |
74
|
0
|
|
|
|
|
|
$self->{package}->AddRelation( $self->RelsName, %RelationParams ); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub RelsName { |
78
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
79
|
0
|
0
|
|
|
|
|
unless( exists $self->{rels_name} ) { |
80
|
0
|
|
|
|
|
|
my $RelsName = $self->Name; |
81
|
0
|
|
|
|
|
|
$RelsName =~ s/^(.*)\/([^\/]*)$/$1\/\_rels\/$2\.rels/; |
82
|
0
|
0
|
|
|
|
|
unless( $self->Package->HasPart( $RelsName )) { |
83
|
0
|
|
|
|
|
|
Carp::confess 'Requested rels part for '.$self->Name.' doesn\'t exist'; |
84
|
|
|
|
|
|
|
} |
85
|
0
|
|
|
|
|
|
$self->{rels_name} = $RelsName; |
86
|
|
|
|
|
|
|
} |
87
|
0
|
|
|
|
|
|
return $self->{rels_name}; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub RelsXML { |
91
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
92
|
0
|
|
|
|
|
|
return $self->{package}->PartContents( $self->RelsName ); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub Content { |
96
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
97
|
0
|
|
|
|
|
|
return $self->{package}->PartContents( $self->Name ); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub ContentType { |
101
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
102
|
0
|
|
|
|
|
|
return $self->{package}->PartContentType( $self->Name ); |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
1; |