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
salomegui
salomewrap
yacsloader
pmml
blocParsers.hxx
codeParsers.cxx
codeParsers.hxx
componentinstanceParsers.cxx
componentinstanceParsers.hxx
containerParsers.cxx
containerParsers.hxx
dataParsers.cxx
dataParsers.hxx
debugger.cxx
driver.cxx
ExampleOfObserversPluginForDriver.cxx
factory.cxx
factory.hxx
inlineParsers.hxx
linkParsers.hxx
LoadState.cxx
LoadState.hxx
loopParsers.hxx
nodeParsers.hxx
outputParsers.hxx
parserBase.cxx
parserBase.hxx
parsers.cxx
parsers.hxx
portParsers.hxx
presetParsers.hxx
ProcCataLoader.cxx
ProcCataLoader.hxx
procParsers.hxx
propertyParsers.cxx
propertyParsers.hxx
remoteParsers.hxx
resume.cxx
rootParser.cxx
rootParser.hxx
serverParsers.hxx
serviceParsers.hxx
sinlineParsers.hxx
switchParsers.hxx
typeParsers.cxx
typeParsers.hxx
xmlParserBase.cxx
xmlParserBase.hxx
xmlrpcParsers.cxx
xmlrpcParsers.hxx
YACSloaderExport.hxx
yacsorb
File Members
linkParsers.hxx
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
#ifndef _LINKPARSERS_HXX_
21
#define _LINKPARSERS_HXX_
22
23
#include "
parserBase.hxx
"
24
#include "
dataParsers.hxx
"
25
#include "
propertyParsers.hxx
"
26
27
#include "
factory.hxx
"
28
29
namespace
YACS
30
{
31
template
<
class
T=mycontrol>
32
struct
controltypeParser
:
parser
33
{
34
static
controltypeParser<T>
controlParser
;
35
36
virtual
void
onStart
(
const
XML_Char
* el,
const
XML_Char
** attr)
37
{
38
std::string element(el);
39
parser
* pp=&
parser::main_parser
;
40
this->
maxcount
(
"fromnode"
,1,element);
41
this->
maxcount
(
"tonode"
,1,element);
42
if
(element ==
"fromnode"
)pp=&
stringtypeParser::stringParser
;
43
else
if
(element ==
"tonode"
)pp=&
stringtypeParser::stringParser
;
44
this->
SetUserDataAndPush
(pp);
45
pp->
init
();
46
pp->
pre
();
47
pp->
buildAttr
(attr);
48
}
49
virtual
void
onEnd
(
const
char
*el,
parser
* child)
50
{
51
std::string element(el);
52
if
(element ==
"fromnode"
)
fromnode
(((
stringtypeParser
*)child)->
post
());
53
else
if
(element ==
"tonode"
)
tonode
(((
stringtypeParser
*)child)->
post
());
54
}
55
virtual
void
pre
()
56
{
57
_link
.clear();
58
}
59
virtual
void
fromnode
(
const
std::string& name)
60
{
61
_link
.fromnode(name);
62
}
63
virtual
void
tonode
(
const
std::string& name)
64
{
65
_link
.tonode(name);
66
}
67
virtual
void
property
(
const
myprop
& prop)
68
{
69
DEBTRACE
(
"property_set: "
<< prop.
_name
<< prop.
_value
)
70
_link
.setProperty(prop.
_name
,prop.
_value
);
71
}
72
virtual
T&
post
()
73
{
74
mincount
(
"fromnode"
,1);
75
mincount
(
"tonode"
,1);
76
return
_link
;
77
}
78
T
_link
;
79
};
80
81
template
<
class
T=mylink>
82
struct
linktypeParser
:
controltypeParser
<T>
83
{
84
static
linktypeParser<T>
linkParser
;
85
86
virtual
void
onStart
(
const
XML_Char
* el,
const
XML_Char
** attr)
87
{
88
std::string element(el);
89
this->
maxcount
(
"fromnode"
,1,element);
90
this->
maxcount
(
"tonode"
,1,element);
91
this->
maxcount
(
"fromport"
,1,element);
92
this->
maxcount
(
"toport"
,1,element);
93
parser
* pp=&
parser::main_parser
;
94
if
(element ==
"fromnode"
)pp=&
stringtypeParser::stringParser
;
95
else
if
(element ==
"tonode"
)pp=&
stringtypeParser::stringParser
;
96
else
if
(element ==
"toport"
)pp=&
stringtypeParser::stringParser
;
97
else
if
(element ==
"fromport"
)pp=&
stringtypeParser::stringParser
;
98
else
if
(element ==
"property"
)pp=&
propertytypeParser::propertyParser
;
99
this->
SetUserDataAndPush
(pp);
100
pp->
init
();
101
pp->
pre
();
102
pp->
buildAttr
(attr);
103
}
104
virtual
void
onEnd
(
const
char
*el,
parser
* child)
105
{
106
std::string element(el);
107
if
(element ==
"fromnode"
)this->
fromnode
(((
stringtypeParser
*)child)->
post
());
108
else
if
(element ==
"tonode"
)this->
tonode
(((
stringtypeParser
*)child)->
post
());
109
else
if
(element ==
"toport"
)
toport
(((
stringtypeParser
*)child)->
post
());
110
else
if
(element ==
"fromport"
)
fromport
(((
stringtypeParser
*)child)->
post
());
111
else
if
(element ==
"property"
)this->
property
(((
propertytypeParser
*)child)->
post
());
112
}
113
virtual
void
buildAttr
(
const
XML_Char
** attr)
114
{
115
if
(!attr)
116
return
;
117
for
(
int
i
= 0; attr[
i
];
i
+= 2)
118
{
119
if
((std::string(attr[
i
]) ==
"control"
)
120
&& (std::string(attr[i+1]) ==
"false"
))
121
this->
_link
._withControl=
false
;
122
}
123
}
124
virtual
void
fromport
(
const
std::string& name)
125
{
126
this->
_link
.fromport(name);
127
}
128
virtual
void
toport
(
const
std::string& name)
129
{
130
this->
_link
.toport(name);
131
}
132
virtual
T&
post
()
133
{
134
this->
mincount
(
"fromnode"
,1);
135
this->
mincount
(
"tonode"
,1);
136
this->
mincount
(
"fromport"
,1);
137
this->
mincount
(
"toport"
,1);
138
return
this->
_link
;
139
}
140
};
141
142
template
<
class
T=mystream>
143
struct
streamtypeParser
:
linktypeParser
<T>
144
{
145
static
streamtypeParser<T>
streamParser
;
146
};
147
148
template
<
class
T>
streamtypeParser<T>
streamtypeParser<T>::streamParser
;
149
template
<
class
T>
controltypeParser<T>
controltypeParser<T>::controlParser
;
150
template
<
class
T>
linktypeParser<T>
linktypeParser<T>::linkParser
;
151
152
}
153
154
#endif
src
yacsloader
linkParsers.hxx
Copyright © 2006-2017 CEA/DEN, EDF R&D