1 // Copyright (C) 2011-2012 CEA/DEN, 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.
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
19 // Authors : Guillaume Boulant (EDF) - 01/03/2011
21 #include "SPADDERPluginTester_i.hxx"
23 #include <SALOME_NamingService.hxx>
24 #include <Utils_SALOME_Exception.hxx>
26 // For standard logging
27 #include "Basics_Utils.hxx"
30 // ==========================================================================
31 // Implementation of the SPADDER component interface
32 // ==========================================================================
37 * Constructor for component "SPADDER" instance
39 SPADDERPluginTester_i::SPADDERPluginTester_i(CORBA::ORB_ptr orb,
40 PortableServer::POA_ptr poa,
41 PortableServer::ObjectId * contId,
42 const char *instanceName,
43 const char *interfaceName)
44 : Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
46 LOG("Activating SPADDERPluginTester_i::SPADDERPluginTester object");
48 _id = _poa->activate_object(_thisObj);
51 //! Destructor for component "SPADDER" instance
52 SPADDERPluginTester_i::~SPADDERPluginTester_i()
54 std::cerr << "SPADDERPluginTester destruction" << std::endl;
58 * This test is just to check the component SPADDER.
60 void SPADDERPluginTester_i::demo(CORBA::Double a,CORBA::Double b,CORBA::Double& c)
62 beginService("SPADDERPluginTester_i::demo");
66 std::cerr << "a: " << a << std::endl;
67 std::cerr << "b: " << b << std::endl;
69 std::cerr << "c: " << c << std::endl;
72 catch ( const SALOME_Exception & ex) {
73 SALOME::ExceptionStruct es;
74 es.text=CORBA::string_dup(ex.what());
75 es.type=SALOME::INTERNAL_ERROR;
76 throw SALOME::SALOME_Exception(es);
78 catch ( const SALOME::SALOME_Exception & ex) {
82 std::cerr << "unknown exception" << std::endl;
83 SALOME::ExceptionStruct es;
84 es.text=CORBA::string_dup(" unknown exception");
85 es.type=SALOME::INTERNAL_ERROR;
86 throw SALOME::SALOME_Exception(es);
88 endService("SPADDERPluginTester_i::demo");
95 #include <SALOME_KernelServices.hxx>
96 #include "SALOME_Launcher.hxx"
97 bool SPADDERPluginTester_i::testkernel()
99 beginService("SPADDERPluginTester_i::testplugin");
101 Engines::SalomeLauncher_ptr salomeLauncher = KERNEL::getSalomeLauncher();
103 endService("SPADDERPluginTester_i::testplugin");
108 #include <SMESH_Gen_i.hxx>
109 #include <SMESH_Gen.hxx>
110 #include <SALOMEconfig.h>
111 #include CORBA_CLIENT_HEADER(SALOMEDS)
113 #include <utilities.h>
116 * This test checks the constructor of the basic classes of the SMESH
119 bool SPADDERPluginTester_i::testsmesh(CORBA::Long studyId)
121 beginService("SPADDERPluginTester_i::testsmesh");
123 // Resolve the SMESH engine and the SALOME study
124 // _WARN_ The SMESH engine should have been loaded first
125 SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
126 CORBA::Object_var anObject = smeshGen_i->GetNS()->Resolve("/myStudyManager");
127 SALOMEDS::StudyManager_var aStudyMgr = SALOMEDS::StudyManager::_narrow(anObject);
128 SALOMEDS::Study_var myStudy = aStudyMgr->GetStudyByID(studyId);
131 // _MEM_ CAUTION: SMESH_Gen define a data structure for local usage
132 // while SMESH_Gen_i is the implementation of the SMESH_Gen IDL
136 endService("SPADDERPluginTester_i::testsmesh");
141 // ==========================================================================
143 // ==========================================================================
147 PortableServer::ObjectId * SPADDERPluginTesterEngine_factory( CORBA::ORB_ptr orb,
148 PortableServer::POA_ptr poa,
149 PortableServer::ObjectId * contId,
150 const char *instanceName,
151 const char *interfaceName)
153 MESSAGE("PortableServer::ObjectId * SPADDERPluginTesterEngine_factory()");
154 SPADDERPluginTester_i * myEngine = new SPADDERPluginTester_i(orb, poa, contId, instanceName, interfaceName);
155 return myEngine->getId() ;