Version: 8.3.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
PresetNode.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 "
PresetPorts.hxx
"
21
#include "
PresetNode.hxx
"
22
#include "
Visitor.hxx
"
23
24
#include <iostream>
25
#include <set>
26
#include <cassert>
27
28
//#define _DEVDEBUG_
29
#include "
YacsTrace.hxx
"
30
31
using namespace
YACS::ENGINE;
32
using namespace
std;
33
40
const
char
PresetNode::IMPL_NAME
[]=
"XML"
;
41
42
PresetNode::PresetNode
(
const
std::string& name)
43
:
DataNode
(name)
44
{
45
_implementation
=
IMPL_NAME
;
46
}
47
48
PresetNode::PresetNode
(
const
PresetNode
& other,
ComposedNode
*father)
49
:
DataNode
(other, father)
50
{
51
}
52
53
OutputPort
*
PresetNode::createOutputPort
(
const
std::string& outputPortName,
TypeCode
* type)
54
{
55
return
new
OutputPresetPort
(outputPortName,
this
, type);
56
}
57
58
void
PresetNode::execute
()
59
{
60
DEBTRACE
(
"+++++++ PresetNode::execute +++++++++++"
);
61
list<OutputPort *>::const_iterator iter;
62
for
(iter =
_setOfOutputPort
.begin(); iter !=
_setOfOutputPort
.end(); iter++)
63
{
64
OutputPresetPort
*outp =
dynamic_cast<
OutputPresetPort
*
>
(*iter);
65
YASSERT
(outp);
66
string
data = outp->
getData
();
67
DEBTRACE
(
"data: "
<< data );
68
outp->
put
(data.c_str());
69
}
70
DEBTRACE
(
"+++++++ end PresetNode::execute +++++++++++"
);
71
}
72
73
void
PresetNode::accept
(
Visitor
*visitor)
74
{
75
visitor->
visitPresetNode
(
this
);
76
}
77
78
void
PresetNode::setData
(
OutputPort
* port,
const
std::string& data)
79
{
80
OutputPresetPort
*outp =
dynamic_cast<
OutputPresetPort
*
>
(port);
81
outp->
setData
(data);
82
}
83
84
void
PresetNode::checkBasicConsistency
()
const
throw(
YACS
::
Exception
)
85
{
86
DEBTRACE
(
"PresetNode::checkBasicConsistency"
);
87
if
(!
_setOfInputPort
.empty())
88
{
89
string
what =
"PresetNode "
;
90
what +=
getName
();
91
what +=
" only accepts OutputPresetPorts, no InputPorts"
;
92
throw
Exception(what);
93
}
94
95
list<OutputPort *>::const_iterator iter;
96
for
(iter=
_setOfOutputPort
.begin();iter!=
_setOfOutputPort
.end();iter++)
97
{
98
OutputPresetPort
*preset =
dynamic_cast<
OutputPresetPort
*
>
(*iter);
99
if
(!preset)
100
{
101
string
what(
"Output port: "
);
102
what += (*iter)->getName();
103
what +=
" is not an OutputPresetPort. PresetNode "
;
104
what +=
getName
();
105
what +=
"only accepts OutputPresetPorts"
;
106
throw
Exception(what);
107
}
108
preset->
checkBasicConsistency
();
109
}
110
}
111
112
Node
*
PresetNode::simpleClone
(
ComposedNode
*father,
bool
editionOnly)
const
113
{
114
return
new
PresetNode
(*
this
,father);
115
}
src
runtime
PresetNode.cxx
Copyright © 2006-2017 CEA/DEN, EDF R&D