1 # Copyright (C) 2010-2011 Richard Lincoln
3 # Permission is hereby granted, free of charge, to any person obtaining a copy
4 # of this software and associated documentation files (the "Software"), to
5 # deal in the Software without restriction, including without limitation the
6 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7 # sell copies of the Software, and to permit persons to whom the Software is
8 # furnished to do so, subject to the following conditions:
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 from CIM14
.IEC61970
.Core
.IdentifiedObject
import IdentifiedObject
23 class BlockInputReference(IdentifiedObject
):
24 """Used at the meta dynamics level. This is how the internal definiton of a block references the input of another block.
27 def __init__(self
, metaBlockReference0
=None, metaBlockInput0
=None, BlockConnectable
=None, *args
, **kw_args
):
28 """Initialises a new 'BlockInputReference' instance.
30 @param metaBlockReference0:
31 @param metaBlockInput0: References the idenfiied input for the block reference.
32 @param BlockConnectable: Each block reference input is usually tied to one (sometimes zero for optional inputs) external block inputs or internal block reference outputs.
34 self
._metaBlockReference
0 = None
35 self
.metaBlockReference0
= metaBlockReference0
37 self
._metaBlockInput
0 = None
38 self
.metaBlockInput0
= metaBlockInput0
40 self
._BlockConnectable
= None
41 self
.BlockConnectable
= BlockConnectable
43 super(BlockInputReference
, self
).__init
__(*args
, **kw_args
)
49 _refs
= ["metaBlockReference0", "metaBlockInput0", "BlockConnectable"]
52 def getmetaBlockReference0(self
):
54 return self
._metaBlockReference
0
56 def setmetaBlockReference0(self
, value
):
57 if self
._metaBlockReference
0 is not None:
58 filtered
= [x
for x
in self
.metaBlockReference0
.blockInputReference0
if x
!= self
]
59 self
._metaBlockReference
0._blockInputReference
0 = filtered
61 self
._metaBlockReference
0 = value
62 if self
._metaBlockReference
0 is not None:
63 if self
not in self
._metaBlockReference
0._blockInputReference
0:
64 self
._metaBlockReference
0._blockInputReference
0.append(self
)
66 metaBlockReference0
= property(getmetaBlockReference0
, setmetaBlockReference0
)
68 def getmetaBlockInput0(self
):
69 """References the idenfiied input for the block reference.
71 return self
._metaBlockInput
0
73 def setmetaBlockInput0(self
, value
):
74 if self
._metaBlockInput
0 is not None:
75 filtered
= [x
for x
in self
.metaBlockInput0
.blockInputReference0
if x
!= self
]
76 self
._metaBlockInput
0._blockInputReference
0 = filtered
78 self
._metaBlockInput
0 = value
79 if self
._metaBlockInput
0 is not None:
80 if self
not in self
._metaBlockInput
0._blockInputReference
0:
81 self
._metaBlockInput
0._blockInputReference
0.append(self
)
83 metaBlockInput0
= property(getmetaBlockInput0
, setmetaBlockInput0
)
85 def getBlockConnectable(self
):
86 """Each block reference input is usually tied to one (sometimes zero for optional inputs) external block inputs or internal block reference outputs.
88 return self
._BlockConnectable
90 def setBlockConnectable(self
, value
):
91 if self
._BlockConnectable
is not None:
92 filtered
= [x
for x
in self
.BlockConnectable
.BlockInputReference
if x
!= self
]
93 self
._BlockConnectable
._BlockInputReference
= filtered
95 self
._BlockConnectable
= value
96 if self
._BlockConnectable
is not None:
97 if self
not in self
._BlockConnectable
._BlockInputReference
:
98 self
._BlockConnectable
._BlockInputReference
.append(self
)
100 BlockConnectable
= property(getBlockConnectable
, setBlockConnectable
)