1 // Copyright (C) 2011-2016 EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // Authors : Guillaume Boulant (EDF) - 01/03/2011
22 #include "SPADDERPluginTester_i.hxx"
24 #include <SALOME_NamingService.hxx>
25 #include <Utils_SALOME_Exception.hxx>
27 // For standard logging
28 #include "Basics_Utils.hxx"
31 // ==========================================================================
32 // Implementation of the SPADDER component interface
33 // ==========================================================================
38 * Constructor for component "SPADDER" instance
40 SPADDERPluginTester_i::SPADDERPluginTester_i(CORBA::ORB_ptr orb,
41 PortableServer::POA_ptr poa,
42 PortableServer::ObjectId * contId,
43 const char *instanceName,
44 const char *interfaceName)
45 : Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
47 LOG("Activating SPADDERPluginTester_i::SPADDERPluginTester object");
49 _id = _poa->activate_object(_thisObj);
52 //! Destructor for component "SPADDER" instance
53 SPADDERPluginTester_i::~SPADDERPluginTester_i()
55 std::cerr << "SPADDERPluginTester destruction" << std::endl;
59 * This test is just to check the component SPADDER.
61 void SPADDERPluginTester_i::demo(CORBA::Double a,CORBA::Double b,CORBA::Double& c)
63 beginService("SPADDERPluginTester_i::demo");
67 std::cerr << "a: " << a << std::endl;
68 std::cerr << "b: " << b << std::endl;
70 std::cerr << "c: " << c << std::endl;
73 catch ( const SALOME_Exception & ex) {
74 SALOME::ExceptionStruct es;
75 es.text=CORBA::string_dup(ex.what());
76 es.type=SALOME::INTERNAL_ERROR;
77 throw SALOME::SALOME_Exception(es);
79 catch ( const SALOME::SALOME_Exception & ex) {
83 std::cerr << "unknown exception" << std::endl;
84 SALOME::ExceptionStruct es;
85 es.text=CORBA::string_dup(" unknown exception");
86 es.type=SALOME::INTERNAL_ERROR;
87 throw SALOME::SALOME_Exception(es);
89 endService("SPADDERPluginTester_i::demo");
96 #include <SALOME_KernelServices.hxx>
97 #include "SALOME_Launcher.hxx"
98 bool SPADDERPluginTester_i::testkernel()
100 beginService("SPADDERPluginTester_i::testplugin");
102 Engines::SalomeLauncher_ptr salomeLauncher = KERNEL::getSalomeLauncher();
103 if ( salomeLauncher ) salomeLauncher = NULL;
105 endService("SPADDERPluginTester_i::testplugin");
110 #include <SMESH_Gen_i.hxx>
111 #include <SMESH_Gen.hxx>
112 #include <SALOMEconfig.h>
113 #include CORBA_CLIENT_HEADER(SALOMEDS)
115 #include <utilities.h>
118 * This test checks the constructor of the basic classes of the SMESH
121 bool SPADDERPluginTester_i::testsmesh(CORBA::Long studyId)
123 beginService("SPADDERPluginTester_i::testsmesh");
125 // Resolve the SMESH engine and the SALOME study
126 // _WARN_ The SMESH engine should have been loaded first
127 SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
128 CORBA::Object_var anObject = smeshGen_i->GetNS()->Resolve("/myStudyManager");
129 SALOMEDS::StudyManager_var aStudyMgr = SALOMEDS::StudyManager::_narrow(anObject);
130 SALOMEDS::Study_var myStudy = aStudyMgr->GetStudyByID(studyId);
133 // _MEM_ CAUTION: SMESH_Gen define a data structure for local usage
134 // while SMESH_Gen_i is the implementation of the SMESH_Gen IDL
138 endService("SPADDERPluginTester_i::testsmesh");
143 // ==========================================================================
145 // ==========================================================================
149 SPADDERPLUGINTESTERENGINE_EXPORT PortableServer::ObjectId *
150 SPADDERPluginTesterEngine_factory( CORBA::ORB_ptr orb,
151 PortableServer::POA_ptr poa,
152 PortableServer::ObjectId * contId,
153 const char *instanceName,
154 const char *interfaceName)
156 MESSAGE("PortableServer::ObjectId * SPADDERPluginTesterEngine_factory()");
157 SPADDERPluginTester_i * myEngine = new SPADDERPluginTester_i(orb, poa, contId, instanceName, interfaceName);
158 return myEngine->getId() ;