1 // Copyright (C) 2007-2010 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 #include "SPADDERPluginTester_i.hxx"
21 #include <SALOME_NamingService.hxx>
22 #include <Utils_SALOME_Exception.hxx>
24 // For standard logging
25 #include "Basics_Utils.hxx"
28 // ==========================================================================
29 // Implementation of the SPADDER component interface
30 // ==========================================================================
35 * Constructor for component "SPADDER" instance
37 SPADDERPluginTester_i::SPADDERPluginTester_i(CORBA::ORB_ptr orb,
38 PortableServer::POA_ptr poa,
39 PortableServer::ObjectId * contId,
40 const char *instanceName,
41 const char *interfaceName)
42 : Engines_Component_i(orb, poa, contId, instanceName, interfaceName)
44 LOG("Activating SPADDERPluginTester_i::SPADDERPluginTester object");
46 _id = _poa->activate_object(_thisObj);
49 //! Destructor for component "SPADDER" instance
50 SPADDERPluginTester_i::~SPADDERPluginTester_i()
52 std::cerr << "SPADDERPluginTester destruction" << std::endl;
56 * This test is just to check the component SPADDER.
58 void SPADDERPluginTester_i::demo(CORBA::Double a,CORBA::Double b,CORBA::Double& c)
60 beginService("SPADDERPluginTester_i::demo");
64 std::cerr << "a: " << a << std::endl;
65 std::cerr << "b: " << b << std::endl;
67 std::cerr << "c: " << c << std::endl;
70 catch ( const SALOME_Exception & ex) {
71 SALOME::ExceptionStruct es;
72 es.text=CORBA::string_dup(ex.what());
73 es.type=SALOME::INTERNAL_ERROR;
74 throw SALOME::SALOME_Exception(es);
76 catch ( const SALOME::SALOME_Exception & ex) {
80 std::cerr << "unknown exception" << std::endl;
81 SALOME::ExceptionStruct es;
82 es.text=CORBA::string_dup(" unknown exception");
83 es.type=SALOME::INTERNAL_ERROR;
84 throw SALOME::SALOME_Exception(es);
86 endService("SPADDERPluginTester_i::demo");
93 #include <SALOME_KernelServices.hxx>
94 #include "SALOME_Launcher.hxx"
95 bool SPADDERPluginTester_i::testkernel()
97 beginService("SPADDERPluginTester_i::testplugin");
99 Engines::SalomeLauncher_ptr salomeLauncher = KERNEL::getSalomeLauncher();
101 endService("SPADDERPluginTester_i::testplugin");
106 #include <SMESH_Gen_i.hxx>
107 #include <SMESH_Gen.hxx>
108 #include <SALOMEconfig.h>
109 #include CORBA_CLIENT_HEADER(SALOMEDS)
111 #include <utilities.h>
114 * This test checks the constructor of the basic classes of the SMESH
117 bool SPADDERPluginTester_i::testsmesh(CORBA::Long studyId)
119 beginService("SPADDERPluginTester_i::testsmesh");
121 // Resolve the SMESH engine and the SALOME study
122 // _WARN_ The SMESH engine should have been loaded first
123 SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
124 CORBA::Object_var anObject = smeshGen_i->GetNS()->Resolve("/myStudyManager");
125 SALOMEDS::StudyManager_var aStudyMgr = SALOMEDS::StudyManager::_narrow(anObject);
126 SALOMEDS::Study_var myStudy = aStudyMgr->GetStudyByID(studyId);
129 // _MEM_ CAUTION: SMESH_Gen define a data structure for local usage
130 // while SMESH_Gen_i is the implementation of the SMESH_Gen IDL
134 endService("SPADDERPluginTester_i::testsmesh");
139 // ==========================================================================
141 // ==========================================================================
145 PortableServer::ObjectId * SPADDERPluginTesterEngine_factory( CORBA::ORB_ptr orb,
146 PortableServer::POA_ptr poa,
147 PortableServer::ObjectId * contId,
148 const char *instanceName,
149 const char *interfaceName)
151 MESSAGE("PortableServer::ObjectId * SPADDERPluginTesterEngine_factory()");
152 SPADDERPluginTester_i * myEngine = new SPADDERPluginTester_i(orb, poa, contId, instanceName, interfaceName);
153 return myEngine->getId() ;