1 # Copyright (C) 2010 Richard Lincoln
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA, USA
17 from CIM14
.Dynamics
.MetaBlockConnectable
import MetaBlockConnectable
19 class MetaBlockOutput(MetaBlockConnectable
):
20 """Output state of a block. This is a public interface external to the block. One or more block outputs should be specified in order to link blocks together. Certain block kinds might require a specific output. For example, an exciter block might require an output called 'Ea'.
23 def __init__(self
, BlockOutputReference
=None, MemberOf_MetaBlock
=None, blockUsageOutputReference0
=None, blockOutputType0
=None, *args
, **kw_args
):
24 """Initialises a new 'MetaBlockOutput' instance.
26 @param BlockOutputReference: A block output reference for the block output. The output of the block is passed to the block output reference which is a block connectable and thus can be connected at the dynamics metadata level to another block.
27 @param MemberOf_MetaBlock: The block that contains the output.
28 @param blockUsageOutputReference0:
29 @param blockOutputType0:
31 self
._BlockOutputReference
= []
32 self
.BlockOutputReference
= [] if BlockOutputReference
is None else BlockOutputReference
34 self
._MemberOf
_MetaBlock
= None
35 self
.MemberOf_MetaBlock
= MemberOf_MetaBlock
37 self
._blockUsageOutputReference
0 = []
38 self
.blockUsageOutputReference0
= [] if blockUsageOutputReference0
is None else blockUsageOutputReference0
40 self
._blockOutputType
0 = None
41 self
.blockOutputType0
= blockOutputType0
43 super(MetaBlockOutput
, self
).__init
__(*args
, **kw_args
)
49 _refs
= ["BlockOutputReference", "MemberOf_MetaBlock", "blockUsageOutputReference0", "blockOutputType0"]
50 _many_refs
= ["BlockOutputReference", "blockUsageOutputReference0"]
52 def getBlockOutputReference(self
):
53 """A block output reference for the block output. The output of the block is passed to the block output reference which is a block connectable and thus can be connected at the dynamics metadata level to another block.
55 return self
._BlockOutputReference
57 def setBlockOutputReference(self
, value
):
58 for x
in self
._BlockOutputReference
:
59 x
._metaBlockOutput
0 = None
61 y
._metaBlockOutput
0 = self
62 self
._BlockOutputReference
= value
64 BlockOutputReference
= property(getBlockOutputReference
, setBlockOutputReference
)
66 def addBlockOutputReference(self
, *BlockOutputReference
):
67 for obj
in BlockOutputReference
:
68 obj
._metaBlockOutput
0 = self
69 self
._BlockOutputReference
.append(obj
)
71 def removeBlockOutputReference(self
, *BlockOutputReference
):
72 for obj
in BlockOutputReference
:
73 obj
._metaBlockOutput
0 = None
74 self
._BlockOutputReference
.remove(obj
)
76 def getMemberOf_MetaBlock(self
):
77 """The block that contains the output.
79 return self
._MemberOf
_MetaBlock
81 def setMemberOf_MetaBlock(self
, value
):
82 if self
._MemberOf
_MetaBlock
is not None:
83 filtered
= [x
for x
in self
.MemberOf_MetaBlock
.MetaBlockOutput
if x
!= self
]
84 self
._MemberOf
_MetaBlock
._MetaBlockOutput
= filtered
86 self
._MemberOf
_MetaBlock
= value
87 if self
._MemberOf
_MetaBlock
is not None:
88 self
._MemberOf
_MetaBlock
._MetaBlockOutput
.append(self
)
90 MemberOf_MetaBlock
= property(getMemberOf_MetaBlock
, setMemberOf_MetaBlock
)
92 def getblockUsageOutputReference0(self
):
94 return self
._blockUsageOutputReference
0
96 def setblockUsageOutputReference0(self
, value
):
97 for x
in self
._blockUsageOutputReference
0:
98 x
._metaBlockOutput
0 = None
100 y
._metaBlockOutput
0 = self
101 self
._blockUsageOutputReference
0 = value
103 blockUsageOutputReference0
= property(getblockUsageOutputReference0
, setblockUsageOutputReference0
)
105 def addblockUsageOutputReference0(self
, *blockUsageOutputReference0
):
106 for obj
in blockUsageOutputReference0
:
107 obj
._metaBlockOutput
0 = self
108 self
._blockUsageOutputReference
0.append(obj
)
110 def removeblockUsageOutputReference0(self
, *blockUsageOutputReference0
):
111 for obj
in blockUsageOutputReference0
:
112 obj
._metaBlockOutput
0 = None
113 self
._blockUsageOutputReference
0.remove(obj
)
115 def getblockOutputType0(self
):
117 return self
._blockOutputType
0
119 def setblockOutputType0(self
, value
):
120 if self
._blockOutputType
0 is not None:
121 filtered
= [x
for x
in self
.blockOutputType0
.metaBlockOutput0
if x
!= self
]
122 self
._blockOutputType
0._metaBlockOutput
0 = filtered
124 self
._blockOutputType
0 = value
125 if self
._blockOutputType
0 is not None:
126 self
._blockOutputType
0._metaBlockOutput
0.append(self
)
128 blockOutputType0
= property(getblockOutputType0
, setblockOutputType0
)