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
genericgui
hmi
pmml
pyqt
runtime
AutoGIL.hxx
CalStreamPort.cxx
CalStreamPort.hxx
CORBAComponent.cxx
CORBAComponent.hxx
CORBACORBAConv.cxx
CORBACORBAConv.hxx
CORBACppConv.cxx
CORBACppConv.hxx
CORBANeutralConv.cxx
CORBANeutralConv.hxx
CORBANode.cxx
CORBANode.hxx
CORBAPorts.cxx
CORBAPorts.hxx
CORBAPythonConv.cxx
CORBAPythonConv.hxx
CORBAXMLConv.cxx
CORBAXMLConv.hxx
CppComponent.cxx
CppComponent.hxx
CppContainer.cxx
CppContainer.hxx
CppCORBAConv.cxx
CppCORBAConv.hxx
CppCppConv.cxx
CppCppConv.hxx
CppNeutralConv.cxx
CppNeutralConv.hxx
CppNode.cxx
CppNode.hxx
CppPorts.cxx
CppPorts.hxx
CppPythonConv.cxx
CppPythonConv.hxx
CppXMLConv.cxx
CppXMLConv.hxx
DistributedPythonNode.cxx
DistributedPythonNode.hxx
NeutralCORBAConv.cxx
NeutralCORBAConv.hxx
NeutralCppConv.cxx
NeutralCppConv.hxx
NeutralInitConv.cxx
NeutralInitConv.hxx
NeutralPythonConv.cxx
NeutralPythonConv.hxx
NeutralXMLConv.cxx
NeutralXMLConv.hxx
OutNode.cxx
OutNode.hxx
PresetNode.cxx
PresetNode.hxx
PresetPorts.cxx
PresetPorts.hxx
PyOptimizerAlg.cxx
PyOptimizerAlg.hxx
PyStdout.cxx
PyStdout.hxx
PythonCORBAConv.cxx
PythonCORBAConv.hxx
PythonCppConv.cxx
PythonCppConv.hxx
PythonInitConv.cxx
PythonInitConv.hxx
PythonNeutralConv.cxx
PythonNeutralConv.hxx
PythonNode.cxx
PythonNode.hxx
PythonPorts.cxx
PythonPorts.hxx
PythonXMLConv.cxx
PythonXMLConv.hxx
RuntimeSALOME.cxx
RuntimeSALOME.hxx
SalomeComponent.cxx
SalomeComponent.hxx
SalomeContainer.cxx
SalomeContainer.hxx
SalomeContainerHelper.cxx
SalomeContainerHelper.hxx
SalomeContainerTmpForHP.cxx
SalomeContainerTmpForHP.hxx
SalomeContainerTools.cxx
SalomeContainerTools.hxx
SALOMEDispatcher.cxx
SALOMEDispatcher.hxx
SalomeHPComponent.cxx
SalomeHPComponent.hxx
SalomeHPContainer.cxx
SalomeHPContainer.hxx
SalomeHPContainerTools.cxx
SalomeHPContainerTools.hxx
SalomeOptimizerLoop.cxx
SalomeOptimizerLoop.hxx
SalomeProc.cxx
SalomeProc.hxx
SalomePythonComponent.cxx
SalomePythonComponent.hxx
SalomePythonNode.cxx
SalomePythonNode.hxx
SessionCataLoader.cxx
SessionCataLoader.hxx
StudyNodes.cxx
StudyNodes.hxx
StudyPorts.cxx
StudyPorts.hxx
TypeConversions.cxx
TypeConversions.hxx
VisitorSalomeSaveState.cxx
VisitorSalomeSaveState.hxx
VisitorSaveSalomeSchema.cxx
VisitorSaveSalomeSchema.hxx
XMLCORBAConv.cxx
XMLCORBAConv.hxx
XMLCppConv.cxx
XMLCppConv.hxx
XMLNeutralConv.cxx
XMLNeutralConv.hxx
XMLNode.cxx
XMLNode.hxx
XMLPorts.cxx
XMLPorts.hxx
XMLPythonConv.cxx
XMLPythonConv.hxx
YACSRuntimeSALOMEExport.hxx
salomegui
salomewrap
yacsloader
yacsorb
File Members
CppPorts.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 "
TypeConversions.hxx
"
21
#include "
CppPorts.hxx
"
22
#include "
Node.hxx
"
23
#include "
TypeCode.hxx
"
24
25
#include <iostream>
26
#include <sstream>
27
28
//#define _DEVDEBUG_
29
#include "
YacsTrace.hxx
"
30
31
using namespace
YACS::ENGINE;
32
using namespace
std;
33
34
InputCppPort::InputCppPort
(
const
std::string& name,
Node
*node,
TypeCode
* type)
35
:
InputPort
(name, node, type),
DataPort
(name, node, type),
Port
(node), _data(NULL),_initData(NULL)
36
{
37
}
38
39
InputCppPort::~InputCppPort
()
40
{
41
if
(
_data
)
42
{
43
DEBTRACE
(
"_data ref count: "
<<
_data
->
getRefCnt
());
44
_data
->
decrRef
();
45
}
46
}
47
48
InputCppPort::InputCppPort
(
const
InputCppPort
& other,
Node
*newHelder):
InputPort
(other,newHelder),
DataPort
(other,newHelder),
Port
(other,newHelder)
49
{
50
_initData
=other.
_initData
;
51
_data
=other.
_data
;
52
}
53
54
bool
InputCppPort::edIsManuallyInitialized
()
const
55
{
56
return
_initData
!= NULL;
57
}
58
59
void
InputCppPort::edRemoveManInit
()
60
{
61
_initData
=NULL;
62
InputPort::edRemoveManInit
();
63
}
64
65
void
InputCppPort::put
(
const
void
*data)
throw
(
ConversionException
)
66
{
67
put((
YACS::ENGINE::Any
*)data);
68
}
69
70
void
InputCppPort::put
(
YACS::ENGINE::Any
*data)
throw
(
ConversionException
)
71
{
72
if
(_data)
73
_data->decrRef();
74
_data=data;
75
_data->incrRef();
76
DEBTRACE
(
"value ref count: "
<< _data->getRefCnt());
77
}
78
79
InputPort
*
InputCppPort::clone
(
Node
*newHelder)
const
80
{
81
return
new
InputCppPort
(*
this
,newHelder);
82
}
83
84
YACS::ENGINE::Any
*
InputCppPort::getCppObj
()
const
85
{
86
return
_data
;
87
}
88
89
void
*
InputCppPort::get
()
const
throw(
YACS
::
Exception
)
90
{
91
return
(
void
*)
_data
;
92
}
93
94
bool
InputCppPort::isEmpty
()
95
{
96
return
_data
== NULL;
97
}
98
100
103
void
InputCppPort::exSaveInit
()
104
{
105
_initData
=
_data
;
106
//DEBTRACE("_initData.ob refcnt: " << _initData->ob_refcnt);
107
//DEBTRACE("_data.ob refcnt: " << _data->ob_refcnt);
108
}
109
111
114
void
InputCppPort::exRestoreInit
()
115
{
116
if
(!
_initData
)
return
;
117
_data
=
_initData
;
118
//DEBTRACE("_initData.ob refcnt: " << _initData->ob_refcnt);
119
//DEBTRACE("_data.ob refcnt: " << _data->ob_refcnt);
120
}
121
122
std::string
InputCppPort::dump
()
123
{
124
if
(
_data
== NULL)
125
return
"<value>None</value>"
;
126
127
if
(
edGetType
()->kind() !=
YACS::ENGINE::Objref
)
128
return
convertNeutralXml
(
edGetType
(),
_data
);
129
//return convertCppXml(edGetType(), _data);
130
if
(!
_stringRef
.empty())
131
return
_stringRef
;
132
else
133
return
convertNeutralXml
(
edGetType
(),
_data
);
134
// {
135
// stringstream msg;
136
// msg << "Cannot retreive init reference string for port " << _name
137
// << " on node " << _node->getName();
138
// throw Exception(msg.str());
139
// }
140
}
141
142
143
OutputCppPort::OutputCppPort
(
const
std::string& name,
Node
*node,
TypeCode
* type)
144
:
OutputPort
(name, node, type),
DataPort
(name, node, type),
Port
(node)
145
{
146
_data
= NULL;
147
}
148
149
OutputCppPort::~OutputCppPort
()
150
{
151
if
(
_data
)
152
{
153
DEBTRACE
(
"_data ref count: "
<<
_data
->
getRefCnt
());
154
_data
->
decrRef
();
155
}
156
}
157
158
OutputCppPort::OutputCppPort
(
const
OutputCppPort
& other,
Node
*newHelder):
OutputPort
(other,newHelder),
DataPort
(other,newHelder),
Port
(other,newHelder),
159
_data(NULL)
160
{
161
}
162
163
void
OutputCppPort::put
(
const
void
*data)
throw
(
ConversionException
)
164
{
165
put((
YACS::ENGINE::Any
*)data);
166
}
167
168
void
OutputCppPort::put
(
YACS::ENGINE::Any
*data)
throw
(
ConversionException
)
169
{
170
InputPort
*
p
;
171
if
(_data)
172
_data->decrRef();
173
_data = data;
174
if
(_data)
175
_data->incrRef();
176
OutputPort::put
(data);
177
}
178
179
OutputPort
*
OutputCppPort::clone
(
Node
*newHelder)
const
180
{
181
return
new
OutputCppPort
(*
this
,newHelder);
182
}
183
184
YACS::ENGINE::Any
*
OutputCppPort::get
()
const
185
{
186
return
_data
;
187
}
188
189
std::string
OutputCppPort::dump
()
190
{
191
if
(
_data
== NULL)
192
return
"<value>None</value>"
;
193
string
xmldump =
convertNeutralXml
(
edGetType
(),
_data
);
194
return
xmldump;
195
}
196
src
runtime
CppPorts.cxx
Copyright © 2006-2017 CEA/DEN, EDF R&D