Version: 8.3.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
YACS
Introduction
Features
Packages
Building
TODOs
Base classes
Engine
SALOME Runtime
XML file loader
GUI design
Python wrapping
PMMLlib C++ examples
Configuring and Installing PMML from sources
PMMLlib
PMMLlib Python examples
Modules
Namespaces
Classes
Files
File List
idl
src
bases
engine
Plugin
AbstractPoint.cxx
AbstractPoint.hxx
Any.cxx
Any.hxx
AnyInputPort.cxx
AnyInputPort.hxx
AnyOutputPort.cxx
AnyOutputPort.hxx
BagPoint.cxx
BagPoint.hxx
Bloc.cxx
Bloc.hxx
BlocPoint.cxx
BlocPoint.hxx
Catalog.cxx
Catalog.hxx
ComponentDefinition.cxx
ComponentDefinition.hxx
ComponentInstance.cxx
ComponentInstance.hxx
ComposedNode.cxx
ComposedNode.hxx
ConditionInputPort.cxx
ConditionInputPort.hxx
Container.cxx
Container.hxx
ConversionException.cxx
ConversionException.hxx
DataFlowPort.cxx
DataFlowPort.hxx
DataNode.cxx
DataNode.hxx
DataPort.cxx
DataPort.hxx
DataStreamPort.cxx
DataStreamPort.hxx
DeploymentTree.cxx
DeploymentTree.hxx
Dispatcher.cxx
Dispatcher.hxx
DynParaLoop.cxx
DynParaLoop.hxx
ElementaryNode.cxx
ElementaryNode.hxx
ElementaryPoint.cxx
ElementaryPoint.hxx
Executor.cxx
Executor.hxx
ForEachLoop.cxx
ForEachLoop.hxx
ForkBlocPoint.cxx
ForkBlocPoint.hxx
ForLoop.cxx
ForLoop.hxx
HomogeneousPoolContainer.cxx
HomogeneousPoolContainer.hxx
InGate.cxx
InGate.hxx
InlineNode.cxx
InlineNode.hxx
InPort.cxx
InPort.hxx
InPropertyPort.cxx
InPropertyPort.hxx
InputDataStreamPort.cxx
InputDataStreamPort.hxx
InputPort.cxx
InputPort.hxx
InvalidExtractionException.cxx
InvalidExtractionException.hxx
LinkedBlocPoint.cxx
LinkedBlocPoint.hxx
LinkInfo.cxx
LinkInfo.hxx
Logger.cxx
Logger.hxx
LogRecord.cxx
LogRecord.hxx
Loop.cxx
Loop.hxx
Node.cxx
Node.hxx
OptimizerAlg.cxx
OptimizerAlg.hxx
OptimizerLoop.cxx
OptimizerLoop.hxx
OutGate.cxx
OutGate.hxx
OutPort.cxx
OutPort.hxx
OutputDataStreamPort.cxx
OutputDataStreamPort.hxx
OutputPort.cxx
OutputPort.hxx
Pool.cxx
Pool.hxx
Port.cxx
Port.hxx
Proc.cxx
Proc.hxx
PropertyInterface.cxx
PropertyInterface.hxx
RefCounter.cxx
RefCounter.hxx
Runtime.cxx
Runtime.hxx
Scheduler.cxx
Scheduler.hxx
ServerNode.cxx
ServerNode.hxx
ServiceInlineNode.cxx
ServiceInlineNode.hxx
ServiceNode.cxx
ServiceNode.hxx
SetOfPoints.cxx
SetOfPoints.hxx
SharedPtr.hxx
StaticDefinedComposedNode.cxx
StaticDefinedComposedNode.hxx
Switch.cxx
Switch.hxx
Task.cxx
Task.hxx
TypeCode.cxx
TypeCode.hxx
Visitor.cxx
Visitor.hxx
VisitorSaveSchema.cxx
VisitorSaveSchema.hxx
VisitorSaveState.cxx
VisitorSaveState.hxx
WhileLoop.cxx
WhileLoop.hxx
YACSlibEngineExport.hxx
genericgui
hmi
pmml
pyqt
runtime
salomegui
salomewrap
yacsloader
yacsorb
File Members
InputPort.cxx
Go to the documentation of this file.
1
// Copyright (C) 2006-2016 CEA/DEN, EDF R&D
2
//
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.
7
//
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.
12
//
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
//
17
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18
//
19
20
#include "
InputPort.hxx
"
21
#include "
OutPort.hxx
"
22
#include "
ComposedNode.hxx
"
23
24
#include <sstream>
25
#include <iostream>
26
#include <cassert>
27
28
//#define _DEVDEBUG_
29
#include "
YacsTrace.hxx
"
30
31
using namespace
YACS::ENGINE;
32
using namespace
std;
33
34
const
char
InputPort::NAME
[]=
"InputPort"
;
35
36
InputPort::InputPort
(
const
InputPort
& other,
Node
*newHelder)
37
:
DataFlowPort
(other, newHelder),
38
InPort
(other, newHelder),
39
DataPort
(other, newHelder),
40
Port
(other, newHelder),
41
_initValue(0),
42
_canBeNull(other._canBeNull)
43
{
44
if
(other.
_initValue
)
45
_initValue
=other.
_initValue
->
clone
();
46
}
47
48
InputPort::InputPort
(
const
std::string& name,
Node
*node,
TypeCode
* type,
bool
canBeNull)
49
:
DataFlowPort
(name, node, type),
50
InPort
(name, node, type),
51
DataPort
(name, node, type),
52
Port
(node),
53
_initValue(0),
54
_canBeNull(canBeNull)
55
{
56
}
57
58
string
InputPort::getNameOfTypeOfCurrentInstance
()
const
59
{
60
return
NAME
;
61
}
62
63
void
InputPort::exInit
(
bool
start)
64
{
65
checkBasicConsistency
();
66
if
(start)
67
exRestoreInit
();
68
}
69
70
bool
InputPort::isEmpty
()
71
{
72
return
get
()==0;
73
}
74
76
bool
InputPort::edIsManuallyInitialized
()
const
77
{
78
return
_initValue
!=0;
79
}
80
84
bool
InputPort::edIsInitialized
()
const
85
{
86
return
(
edIsManuallyInitialized
() ||
_backLinks
.size()!=0 );
87
}
88
89
InputPort::~InputPort
()
90
{
91
if
(
_initValue
)
92
_initValue
->
decrRef
();
93
}
94
95
void
InputPort::edInit
(
Any
*value)
96
{
97
InputPort
*manuallySet=
getRuntime
()->
adapt
(
this
,
98
Runtime::RUNTIME_ENGINE_INTERACTION_IMPL_NAME
,
_type
,
true
);
99
try
100
{
101
manuallySet->
put
((
const
void
*) value);
102
if
(manuallySet!=
this
)
103
delete
manuallySet;
104
}
105
catch
(
ConversionException
&)
106
{
107
if
(manuallySet!=
this
)
108
delete
manuallySet;
109
throw
;
110
}
111
exSaveInit
();
112
modified
();
113
}
114
116
120
void
InputPort::edInit
(
const
std::string& impl,
const
void
* value)
121
{
122
InputPort
*manuallySet=
getRuntime
()->
adapt
(
this
,impl,
_type
,
true
);
123
try
124
{
125
manuallySet->
put
(value);
126
if
(manuallySet!=
this
)
127
delete
manuallySet;
128
}
129
catch
(
ConversionException
&)
130
{
131
if
(manuallySet!=
this
)
132
delete
manuallySet;
133
throw
;
134
}
135
exSaveInit
();
136
modified
();
137
}
138
140
void
InputPort::edRemoveManInit
()
141
{
142
if
(
_initValue
)
143
_initValue
->
decrRef
();
144
_initValue
=0;
145
}
146
148
void
InputPort::checkBasicConsistency
()
const
throw(
YACS
::
Exception
)
149
{
150
if
(!
_canBeNull
&& !
edIsManuallyInitialized
() &&
_backLinks
.size()==0 )
151
{
152
ostringstream stream;
153
stream <<
"InputPort::checkBasicConsistency : Port "
<<
_name
<<
" of node with name "
<<
_node
->
getName
() <<
" neither initialized nor linked back"
;
154
throw
Exception(stream.str());
155
}
156
}
157
158
std::string
InputPort::dump
()
159
{
160
string
xmldump =
"<value><error> NO_SERIALISATION_AVAILABLE </error></value>"
;
161
return
xmldump;
162
}
163
164
std::string
InputPort::getHumanRepr
()
165
{
166
return
dump
();
167
}
168
169
void
InputPort::setStringRef
(std::string strRef)
170
{
171
_stringRef
= strRef;
172
}
173
174
bool
InputPort::canBeNull
()
const
175
{
176
return
_canBeNull
;
177
}
178
179
ProxyPort::ProxyPort
(
InputPort
*
p
):
InputPort
(
"Convertor"
, p->getNode(), p->edGetType()),
DataPort
(
"Convertor"
, p->getNode(), p->edGetType()),
180
Port
( p->getNode())
181
{
182
_port
=
p
;
183
}
184
185
ProxyPort::~ProxyPort
()
186
{
187
//For the moment, there is no case in YACS we have a proxy port in a proxy port
188
//So don't test that. _port may be already deleted. The test is not sure.
189
/*
190
if(_port->isIntermediate())
191
delete _port;
192
*/
193
}
194
195
void
ProxyPort::edRemoveAllLinksLinkedWithMe
() throw(
YACS
::
Exception
)
196
{
197
_port
->
edRemoveAllLinksLinkedWithMe
();
198
}
199
204
InputPort
*
ProxyPort::clone
(
Node
*newHelder)
const
205
{
206
throw
Exception
(
"ProxyPort::clone : internal error - should never happened"
);
207
}
208
209
void
ProxyPort::edNotifyReferencedBy
(
OutPort
*fromPort)
210
{
211
_port
->
edNotifyReferencedBy
(fromPort);
212
}
213
214
void
ProxyPort::edNotifyDereferencedBy
(
OutPort
*fromPort)
215
{
216
_port
->
edNotifyDereferencedBy
(fromPort);
217
}
218
219
std::set<OutPort *>
ProxyPort::edSetOutPort
()
const
220
{
221
return
_port
->
edSetOutPort
();
222
}
223
224
int
ProxyPort::edGetNumberOfLinks
()
const
225
{
226
return
_port
->
edGetNumberOfLinks
();
227
}
228
229
void
ProxyPort::exRestoreInit
()
230
{
231
_port
->
exRestoreInit
();
232
}
233
234
void
ProxyPort::exSaveInit
()
235
{
236
_port
->
exSaveInit
();
237
}
238
239
#ifdef NOCOVARIANT
240
InPort
*
ProxyPort::getPublicRepresentant
()
241
#else
242
InputPort
*
ProxyPort::getPublicRepresentant
()
243
#endif
244
{
245
return
_port->
getPublicRepresentant
();
246
}
247
248
void
*
ProxyPort::get
()
const
249
{
250
return
_port
->
get
();
251
}
252
253
void
ProxyPort::put
(
const
void
*data)
throw
(
ConversionException
)
254
{
255
_port->put(data);
256
}
257
258
void
ProxyPort::getAllRepresentants
(std::set<InPort *>& repr)
const
259
{
260
DEBTRACE
(
"ProxyPort::getAllRepresentants"
);
261
_port
->
getAllRepresentants
(repr);
262
}
src
engine
InputPort.cxx
Copyright © 2006-2017 CEA/DEN, EDF R&D