1 // Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SuperVisionTest SubComponent : example of component that sunstracts one number from another
24 // File : SubComponentEngine.cxx
25 // Author : MARC TAJCHMAN, CEA
26 // Module : SuperVisionTest
36 #include "COMPONENT_version.h"
37 #include "SubComponent.hxx"
41 SubComponentEngine::SubComponentEngine( CORBA::ORB_ptr orb,
42 PortableServer::POA_ptr poa,
43 PortableServer::ObjectId * contId,
44 const char *instanceName,
45 const char *interfaceName, bool withRegistry) :
46 Engines_Component_i(orb, poa, contId, instanceName, interfaceName,1,withRegistry)
48 // MESSAGE("SubComponentEngine::SubComponentEngine activate object instanceName("
49 // << instanceName << ") interfaceName(" << interfaceName << ")" )
51 _id = _poa->activate_object(_thisObj);
55 SubComponentEngine::SubComponentEngine()
59 SubComponentEngine::~SubComponentEngine()
63 char* SubComponentEngine::getVersion()
65 #if COMPONENT_DEVELOPMENT
66 return CORBA::string_dup(COMPONENT_VERSION_STR"dev");
68 return CORBA::string_dup(COMPONENT_VERSION_STR);
72 void SubComponentEngine::Sub( double x , double y , double & z ) {
73 beginService( " SubComponentEngine::Sub" );
77 sendMessage(NOTIF_STEP, "Sub is Computing");
78 // S = 1+(int) (15.0*rand()/(RAND_MAX+1.0));
87 MESSAGE( "SubComponentEngine::Sub( " << x << " , " << y << " , " << z
88 << " ) after " << S << " seconds" );
89 endService( " SubComponentEngine::Sub" );
94 PortableServer::ObjectId * SubComponentEngine_factory
96 PortableServer::POA_ptr poa,
97 PortableServer::ObjectId * contId,
98 const char *instanceName,
99 const char *interfaceName)
101 MESSAGE("SubComponentEngine_factory SubComponentEngine ("
102 << instanceName << "," << interfaceName << ")");
103 SubComponentEngine * mySubComponent = nullptr;
104 CORBA::Object_var o = poa->id_to_reference(*contId);
105 Engines::Container_var cont = Engines::Container::_narrow(o);
106 if(cont->is_SSL_mode())
108 mySubComponent = new SubComponentEngine_SSL(orb, poa, contId, instanceName, interfaceName);
112 mySubComponent = new SubComponentEngine_No_SSL(orb, poa, contId, instanceName, interfaceName);
114 return mySubComponent->getId() ;