1 // Copyright (C) 2007-2019 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 SIGNALSComponent : example of component that devides two numbers
24 // File : SIGNALSComponent.cxx
25 // Author : MARC TAJCHMAN, CEA
26 // Module : SuperVisionTest
36 //#include "utilities.h"
37 #include "SIGNALSComponent_Impl.hxx"
38 #include "COMPONENT_version.h"
42 SIGNALSComponent_Impl::SIGNALSComponent_Impl( CORBA::ORB_ptr orb,
43 PortableServer::POA_ptr poa,
44 PortableServer::ObjectId * contId,
45 const char *instanceName,
46 const char *interfaceName) :
47 Engines_Component_i(orb, poa, contId, instanceName, interfaceName,1,true)
49 MESSAGE("SIGNALSComponent_Impl::SIGNALSComponent_Impl activate object instanceName("
50 << instanceName << ") interfaceName(" << interfaceName << ")" )
52 _id = _poa->activate_object(_thisObj);
56 SIGNALSComponent_Impl::SIGNALSComponent_Impl() :
62 SIGNALSComponent_Impl::~SIGNALSComponent_Impl()
66 char* SIGNALSComponent_Impl::getVersion()
68 #if COMPONENT_DEVELOPMENT
69 return CORBA::string_dup(COMPONENT_VERSION_STR"dev");
71 return CORBA::string_dup(COMPONENT_VERSION_STR);
75 CORBA::Long SIGNALSComponent_Impl::SIGSEGVfunc() {
76 beginService( " SIGNALSComponent_Impl::SIGSEGVfunc" );
78 cout << pthread_self() << "SIGNALSComponent_Impl::SIGSEGVfunc" << endl ;
80 cout << pthread_self().p << "SIGNALSComponent_Impl::SIGSEGVfunc" << endl ;
82 int S = 1+(int) (15.0*rand()/(RAND_MAX+1.0));
91 long _nullptr = *NULLPTR ;
92 endService( " SIGNALSComponent_Impl::SIGSEGVfunc" );
96 CORBA::Long SIGNALSComponent_Impl::SIGFPEfunc( CORBA::Long a , CORBA::Long b ) {
97 beginService( " SIGNALSComponent_Impl::SIGFPEfunc" );
99 cout << pthread_self() << "SIGNALSComponent_Impl::SIGFPEfunc" << endl ;
101 cout << pthread_self().p << "SIGNALSComponent_Impl::SIGFPEfunc" << endl ;
103 int S = 1+(int) (15.0*rand()/(RAND_MAX+1.0));
112 endService( " SIGNALSComponent_Impl::SIGFPEfunc" );
116 void SIGNALSComponent_Impl::MethodToKill() {
117 beginService( " SIGNALSComponent_Impl::MethodToKill" );
126 endService( " SIGNALSComponent_Impl::MethodToKill" );
130 void * RunMethodToKill( void * ptr ) {
131 SIGNALSComponent_Impl * mySIGNALSComponent ;
132 mySIGNALSComponent = ( SIGNALSComponent_Impl * ) ptr ;
133 mySIGNALSComponent->MethodToKill() ;
137 void SIGNALSComponent_Impl::WaitKill() {
139 pthread_create( &T , NULL , RunMethodToKill , this ) ;
140 pthread_join( T , NULL ) ;
145 PortableServer::ObjectId * SIGNALSComponentEngine_factory
147 PortableServer::POA_ptr poa,
148 PortableServer::ObjectId * contId,
149 const char *instanceName,
150 const char *interfaceName)
152 MESSAGE("SIGNALSComponentEngine_factory SIGNALSComponent_Impl("
153 << instanceName << "," << interfaceName << ")");
154 SIGNALSComponent_Impl * mySIGNALSComponent
155 = new SIGNALSComponent_Impl(orb, poa, contId, instanceName, interfaceName);
156 return mySIGNALSComponent->getId() ;