Version: 8.3.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
SalomeHPComponent.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 "
SalomeHPComponent.hxx
"
21
#include "
RuntimeSALOME.hxx
"
22
#include "
SalomeContainer.hxx
"
23
#include "
SalomeHPContainer.hxx
"
24
#include "
SalomeComponent.hxx
"
// for KIND
25
#include "
SalomeContainerTmpForHP.hxx
"
26
#include "
CORBANode.hxx
"
27
28
#ifdef SALOME_KERNEL
29
#include "SALOME_NamingService.hxx"
30
#include "SALOME_LifeCycleCORBA.hxx"
31
#endif
32
33
#include <omniORB4/CORBA.h>
34
#include <iostream>
35
#include <sstream>
36
37
//#define _DEVDEBUG_
38
#include "
YacsTrace.hxx
"
39
40
using namespace
YACS::ENGINE;
41
using namespace
std;
42
43
const
char
SalomeHPComponent::KIND
[]=
"HPSalome"
;
44
45
SalomeHPComponent::SalomeHPComponent
(
const
std::string& name):
ComponentInstance
(name)
46
{
47
_objComponent
=CORBA::Object::_nil();
48
}
49
50
SalomeHPComponent::SalomeHPComponent
(
const
SalomeHPComponent
& other):
ComponentInstance
(other)
51
{
52
_objComponent
=CORBA::Object::_nil();
53
}
54
55
SalomeHPComponent::~SalomeHPComponent
()
56
{
57
}
58
59
std::string
SalomeHPComponent::getKind
()
const
60
{
61
return
KIND
;
62
}
63
64
std::string
SalomeHPComponent::getKindForNode
()
const
65
{
66
return
SalomeComponent::KIND
;
67
}
68
70
void
SalomeHPComponent::unload
(
Task
*askingNode)
71
{
72
//Not implemented
73
std::cerr <<
"SalomeHPComponent::unload : not implemented "
<< std::endl;
74
}
75
77
bool
SalomeHPComponent::isLoaded
(
Task
*askingNode)
const
78
{
79
return
false
;
80
}
81
82
//#ifdef SALOME_KERNEL
84
void
SalomeHPComponent::load
(
Task
*askingNode)
85
{
86
if
(
_container
)
87
{
88
SalomeHPContainer
*salomeContainer(dynamic_cast<SalomeHPContainer *>(
_container
));
89
if
(salomeContainer)
90
{
91
YACS::BASES::AutoCppPtr<SalomeContainerTmpForHP>
tmpCont(
SalomeContainerTmpForHP::BuildFrom
(salomeContainer,askingNode));
92
_objComponent
=tmpCont->
loadComponent
(askingNode);
93
return ;
94
}
95
throw
Exception
(
"Unrecognized type of Container ! Only Salome and HPSalome container are supported by the Salome components !"
);
96
}
97
else
98
throw
Exception
(
"No container on HP component ! Impossible to load !"
);
99
}
100
/*#else
101
void SalomeComponent::load(Task *askingNode)
102
{
103
throw Exception("YACS has been built without SALOME support");
104
}
105
#endif*/
106
108
112
ServiceNode
*
SalomeHPComponent::createNode
(
const
std::string& name)
113
{
114
SalomeNode
* node(
new
SalomeNode
(name));
115
node->
setComponent
(
this
);
116
return
node;
117
}
118
120
ComponentInstance
*
SalomeHPComponent::clone
()
const
121
{
122
if
(
_isAttachedOnCloning
)
123
{
124
incrRef
();
125
return
(
ComponentInstance
*) (
this
);
126
}
127
else
128
return
new
SalomeHPComponent
(*
this
);
129
}
130
131
ComponentInstance
*
SalomeHPComponent::cloneAlways
()
const
132
{
133
return
new
SalomeHPComponent
(*
this
);
134
}
135
136
std::string
SalomeHPComponent::getFileRepr
()
const
137
{
138
ostringstream stream;
139
stream <<
"<component>"
<<
getCompoName
() <<
"</component>"
;
140
return
stream.str();
141
}
142
143
bool
SalomeHPComponent::setContainer
(
Container
*cont)
144
{
145
if
(!dynamic_cast<SalomeHPContainer *>(cont))
146
throw
Exception
(
"SalomeHPComponent::setContainer : a Salome HP component must be attached to a Salome HP container !"
);
147
if
(
ComponentInstance::setContainer
(cont))
148
{
149
if
(
_container
)
150
_container
->
addComponentName
(
_compoName
);
151
return
true
;
152
}
153
else
154
return
false
;
155
}
156
157
void
SalomeHPComponent::shutdown
(
int
level)
158
{
159
DEBTRACE
(
"SalomeHPComponent::shutdown "
<< level);
160
if
(
_container
)
161
_container
->
shutdown
(level);
162
}
src
runtime
SalomeHPComponent.cxx
Copyright © 2006-2017 CEA/DEN, EDF R&D