Version: 9.16.0
SalomeHPComponent.cxx
Go to the documentation of this file.
1// Copyright (C) 2006-2026 CEA, EDF
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
26#include "CORBANode.hxx"
27
28#ifdef SALOME_KERNEL
29#include "SALOME_LifeCycleCORBA.hxx"
30#endif
31
32#include <omniORB4/CORBA.h>
33#include <iostream>
34#include <sstream>
35
36//#define _DEVDEBUG_
37#include "YacsTrace.hxx"
38
39using namespace YACS::ENGINE;
40using namespace std;
41
42const char SalomeHPComponent::KIND[]="HPSalome";
43
44SalomeHPComponent::SalomeHPComponent(const std::string& name): ComponentInstance(name)
45{
46 _objComponent=CORBA::Object::_nil();
47}
48
50{
51 _objComponent=CORBA::Object::_nil();
52}
53
55{
56}
57
58std::string SalomeHPComponent::getKind() const
59{
60 return KIND;
61}
62
64{
66}
67
70{
71 //Not implemented
72 std::cerr << "SalomeHPComponent::unload : not implemented " << std::endl;
73}
74
76bool SalomeHPComponent::isLoaded(Task *askingNode) const
77{
78 return false;
79}
80
81//#ifdef SALOME_KERNEL
84{
85 if(_container)
86 {
87 SalomeHPContainer *salomeContainer(dynamic_cast<SalomeHPContainer *>(_container));
88 if(salomeContainer)
89 {
91 _objComponent=tmpCont->loadComponent(askingNode);
92 return ;
93 }
94 throw Exception("Unrecognized type of Container ! Only Salome and HPSalome container are supported by the Salome components !");
95 }
96 else
97 throw Exception("No container on HP component ! Impossible to load !");
98}
99/*#else
100void SalomeComponent::load(Task *askingNode)
101{
102 throw Exception("YACS has been built without SALOME support");
103}
104#endif*/
105
107
112{
113 SalomeNode* node(new SalomeNode(name));
114 node->setComponent(this);
115 return node;
116}
117
120{
122 {
123 incrRef();
124 return (ComponentInstance*) (this);
125 }
126 else
127 return new SalomeHPComponent(*this);
128}
129
131{
132 return new SalomeHPComponent(*this);
133}
134
136{
137 ostringstream stream;
138 stream << "<component>" << getCompoName() << "</component>";
139 return stream.str();
140}
141
143{
144 if(!dynamic_cast<SalomeHPContainer *>(cont))
145 throw Exception("SalomeHPComponent::setContainer : a Salome HP component must be attached to a Salome HP container !");
147 {
148 if(_container)
150 return true;
151 }
152 else
153 return false;
154}
155
157{
158 DEBTRACE("SalomeHPComponent::shutdown " << level);
159 if(_container)
160 _container->shutdown(level);
161}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
Base class for all component instances.
virtual bool setContainer(Container *cont)
const std::string & getCompoName() const
std::string _compoName
WARNING : _compoName identify only the component type.
virtual void shutdown(int level)=0
virtual void addComponentName(const std::string &name)=0
static SalomeContainerTmpForHP * BuildFrom(const SalomeHPContainer *cont, const Task *askingNode)
virtual std::string getKind() const
Return the component kind.
virtual ComponentInstance * cloneAlways() const
SalomeHPComponent(const std::string &name)
virtual std::string getFileRepr() const
For dump in file.
virtual std::string getKindForNode() const
virtual bool setContainer(Container *cont)
virtual void load(Task *askingNode)
Load the component.
virtual ComponentInstance * clone() const
Clone the component instance.
virtual bool isLoaded(Task *askingNode) const
Is the component instance already loaded ?
virtual ServiceNode * createNode(const std::string &name)
Create a ServiceNode with this component instance and no input or output port.
virtual void shutdown(int level)
virtual void unload(Task *askingNode)
Unload the component.
Class for Salome component Service Node.
Definition: CORBANode.hxx:68
Class for calculation node associated with a component service.
Definition: ServiceNode.hxx:35
virtual void setComponent(ComponentInstance *compo)
Associate an existing component instance to this service node AND check the consistency regarding the...