From 287a363d4d12aa3c54a8143ab44f5959c92e2c68 Mon Sep 17 00:00:00 2001 From: rahuel Date: Wed, 19 Oct 2005 09:41:31 +0000 Subject: [PATCH] New component for instances of components --- .../AdditionComponent_CheckOfUndefined.cxx | 37 +++ .../AdditionComponent_Impl.cxx | 248 ++++++++++++++++++ .../AdditionComponent_Impl.hxx | 91 +++++++ src/AdditionComponent/Addition_Adder_Impl.cxx | 183 +++++++++++++ src/AdditionComponent/Addition_Adder_Impl.hxx | 75 ++++++ src/AdditionComponent/Makefile.in | 63 +++++ 6 files changed, 697 insertions(+) create mode 100644 src/AdditionComponent/AdditionComponent_CheckOfUndefined.cxx create mode 100644 src/AdditionComponent/AdditionComponent_Impl.cxx create mode 100644 src/AdditionComponent/AdditionComponent_Impl.hxx create mode 100644 src/AdditionComponent/Addition_Adder_Impl.cxx create mode 100644 src/AdditionComponent/Addition_Adder_Impl.hxx create mode 100755 src/AdditionComponent/Makefile.in diff --git a/src/AdditionComponent/AdditionComponent_CheckOfUndefined.cxx b/src/AdditionComponent/AdditionComponent_CheckOfUndefined.cxx new file mode 100644 index 0000000..2bba7f4 --- /dev/null +++ b/src/AdditionComponent/AdditionComponent_CheckOfUndefined.cxx @@ -0,0 +1,37 @@ +// SuperVisionTest AddComponent : example of component that adds two numbers +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : AddComponent_CheckOfUndefined.cxx +// Module : SuperVisionTest + +using namespace std; +#include +#include +#include + +#include "AdditionComponent_Impl.hxx" + +int main(int argc, char **argv) { + return 0; +} + diff --git a/src/AdditionComponent/AdditionComponent_Impl.cxx b/src/AdditionComponent/AdditionComponent_Impl.cxx new file mode 100644 index 0000000..e6f7391 --- /dev/null +++ b/src/AdditionComponent/AdditionComponent_Impl.cxx @@ -0,0 +1,248 @@ +// SuperVisionTest AdditionComponent : example of component that adds two numbers +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : AdditionComponent_Impl.cxx +// Author : Jean Rahuel, CEA +// Module : SuperVisionTest + +using namespace std; +#include +#include +#include +#include +#include + +#include "utilities.h" +#include "Utils_ORB_INIT.hxx" +#include "Utils_SINGLETON.hxx" +#include "SALOME_NamingService.hxx" +#include "SALOME_LifeCycleCORBA.hxx" + +#include "AdditionComponent_Impl.hxx" +#include "Adder_Impl.hxx" + +AdditionInterface_Impl::AdditionInterface_Impl( CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) : + Engines_Component_i(orb, poa, contId, instanceName, interfaceName,1,true) { + MESSAGE("AdditionInterface_Impl::AdditionInterface_Impl this " << hex << this << dec + << "activate object instanceName(" + << instanceName << ") interfaceName(" << interfaceName << ")" ) + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + LastAddition = 0 ; +} + +AdditionInterface_Impl::AdditionInterface_Impl() { + LastAddition = 0 ; +} + +AdditionInterface_Impl::~AdditionInterface_Impl() { +} + +double AdditionInterface_Impl::Add( double x , double y , double & z ) { + beginService( " AdditionInterface_Impl::Add" ); + z = x + y ; + int S; + + sendMessage(NOTIF_STEP, "AdditionInterface_Impl::Add is Computing"); +// S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); + S = 5 ; + while ( S ) { + S = sleep(S); + } + MESSAGE( "AdditionInterface_Impl::Add( " << x << " , " << y << " , " << z + << " ) returns " << (x - y) << " after " << S << " seconds" ) + LastAddition = z ; + endService( " AdditionInterface_Impl::Add" ); + return (x - y) ; +} + +double AdditionInterface_Impl::AddWithoutSleep( double x , double y , double & z ) { + beginService( " AdditionInterface_Impl::AddWithoutSleep" ); + z = x + y ; + LastAddition = z ; + endService( " AdditionInterface_Impl::AddWithoutSleep" ); + return (x - y) ; +} + +long AdditionInterface_Impl::Sigma( long n ) { + long sigma = 0 ; + int i , j ; + beginService( " AdditionInterface_Impl::Sigma" ); + for ( j = 0 ; j < 1000000 ; j++ ) { + sigma = 0 ; + for ( i = 1 ; i <= n ; i++ ) { + sigma = sigma + i ; + } + } + endService( " AdditionInterface_Impl::Sigma" ); + return sigma ; +} + +void AdditionInterface_Impl::Setx( double x ) { + int S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); + while ( S ) { + S = sleep(S); + } + xx = x ; +} + +void AdditionInterface_Impl::Sety( double y ) { + int S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); + while ( S ) { + S = sleep(S); + } + yy = y ; +} + +double AdditionInterface_Impl::Addxy() { + int S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); + while ( S ) { + S = sleep(S); + } + double zz = xx + yy ; + LastAddition = zz ; + return zz; +} + +double AdditionInterface_Impl::AddyTox( double y ) { + int S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); + while ( S ) { + S = sleep(S); + } + double zz = xx + y ; + LastAddition = zz ; + return zz; +} + +double AdditionInterface_Impl::LastResult() { + beginService( " AdditionInterface_Impl::LastResult" ); + sendMessage(NOTIF_STEP, "AdditionInterface_Impl::LastResult is Computing"); + endService( " AdditionInterface_Impl::LastResult" ); + return LastAddition ; +} + +AdditionComponent::Adder_ptr AdditionInterface_Impl::Addition() { + beginService( "AdditionInterface_Impl::Addition" ); + sendMessage(NOTIF_STEP, "AdditionInterface_Impl creates Adder_Impl"); + Adder_Impl * myAdder ; + myAdder = new Adder_Impl( _orb , _poa, _contId, + instanceName() , interfaceName() , + graphName() , nodeName() ) ; + AdditionComponent::Adder_var iobject ; + PortableServer::ObjectId * id = myAdder->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject = AdditionComponent::Adder::_narrow(obj) ; + endService( "AdditionInterface_Impl::Addition" ); + return iobject._retn() ; +// return AdditionComponent::Adder::_duplicate(iobject) ; +} + +bool AdditionInterface_Impl::AdditionObjRef1( AdditionComponent::Adder_out aAdder ) { + beginService( "AdditionInterface_Impl::Addition" ); + sendMessage(NOTIF_STEP, "AdditionInterface_Impl creates Adder_Impl"); + Adder_Impl * myAdder ; + myAdder = new Adder_Impl( _orb , _poa, _contId, + instanceName() , interfaceName() , + graphName() , nodeName() ) ; + AdditionComponent::Adder_var iobject ; + PortableServer::ObjectId * id = myAdder->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject = AdditionComponent::Adder::_narrow(obj) ; + endService( "AdditionInterface_Impl::Addition" ); + aAdder = AdditionComponent::Adder::_duplicate(iobject) ; + return true ; +} + +void AdditionInterface_Impl::AdditionObjRef2( bool & FuncValue , + AdditionComponent::Adder_out aAdder ) { + beginService( "AdditionInterface_Impl::Addition" ); + sendMessage(NOTIF_STEP, "AdditionInterface_Impl creates Adder_Impl"); + Adder_Impl * myAdder ; + myAdder = new Adder_Impl( _orb , _poa, _contId, + instanceName() , interfaceName() , + graphName() , nodeName() ) ; + AdditionComponent::Adder_var iobject ; + PortableServer::ObjectId * id = myAdder->getId() ; + CORBA::Object_var obj = _poa->id_to_reference(*id); + iobject = AdditionComponent::Adder::_narrow(obj) ; + endService( "AdditionInterface_Impl::Addition" ); + aAdder = AdditionComponent::Adder::_duplicate(iobject) ; + FuncValue = true ; +} + +bool AdditionInterface_Impl::AdditionObjRefs( const AdditionComponent::AdditionInterface_ptr AdditionInterface1 , + const AdditionComponent::AdditionInterface_ptr Adder2 , + const AdditionComponent::AdditionInterface_ptr Adder3 , + AdditionComponent::AdditionInterface_out RetAdditionInterface1 , + AdditionComponent::AdditionInterface_out RetAdder2 , + AdditionComponent::AdditionInterface_out RetAdder3 ) { + bool RetVal = true ; + beginService( "AdditionInterface_Impl::AdditionObjRefs" ); + cout << "beginService AdditionInterface_Impl::AdditionObjRefs" << endl ; + ORB_INIT &init = *SINGLETON_::Instance() ; + ASSERT(SINGLETON_::IsAlreadyExisting()); + CORBA::ORB_var orb = init(0 , 0 ) ; + char * IOR = orb->object_to_string( AdditionInterface1 ); + cout << "AdditionInterface_Impl::AdditionObjRefs AdditionInterface1 " << AdditionInterface1 << " IOR " + << IOR << " nil " << CORBA::is_nil( AdditionInterface1 ) << endl ; + RetAdditionInterface1 = AdditionComponent::AdditionInterface::_duplicate( AdditionInterface1 ) ; + IOR = orb->object_to_string( Adder2 ); + cout << "AdditionInterface_Impl::AdditionObjRefs Adder2 " << Adder2 << " IOR " << IOR << " nil " + << CORBA::is_nil( Adder2 ) << endl ; + RetAdder2 = AdditionComponent::AdditionInterface::_duplicate( Adder2 ) ; + IOR = orb->object_to_string( Adder3 ); + cout << "AdditionInterface_Impl::AdditionObjRefs Adder3 " << Adder3 << " IOR " << IOR << " nil " + << CORBA::is_nil( Adder3 ) << endl ; + RetAdder3 = AdditionComponent::AdditionInterface::_duplicate( Adder3 ) ; + if ( CORBA::is_nil( AdditionInterface1 ) || CORBA::is_nil( Adder2 ) || + CORBA::is_nil( Adder3 ) || CORBA::is_nil( RetAdditionInterface1 ) || + CORBA::is_nil( RetAdder2 ) || CORBA::is_nil( RetAdder3 ) ) { + RetVal = false ; + } + cout << "endService AdditionInterface_Impl::AdditionObjRefs" << endl ; + endService( "AdditionInterface_Impl::AdditionObjRefs" ); + return RetVal ; +} + +//AdditionComponentEngine_factory +extern "C" +{ + PortableServer::ObjectId * AdditionComponentEngine_factory + (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) + { + MESSAGE("AdditionComponentEngine_factory AdditionInterfaceEngine (" + << instanceName << "," << interfaceName << "," << getpid() << ")"); + AdditionInterface_Impl * myAdditionInterface + = new AdditionInterface_Impl(orb, poa, contId, instanceName, interfaceName); + return myAdditionInterface->getId() ; + } +} + diff --git a/src/AdditionComponent/AdditionComponent_Impl.hxx b/src/AdditionComponent/AdditionComponent_Impl.hxx new file mode 100644 index 0000000..a151b09 --- /dev/null +++ b/src/AdditionComponent/AdditionComponent_Impl.hxx @@ -0,0 +1,91 @@ +// SuperVisionTest AdditionComponent : example of component that adds two numbers +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : AdditionComponent_Impl.hxx +// Author : Jean Rahuel, CEA +// Module : SuperVisionTest +// $Header: + +#ifndef _ADDITIONINTERFACE_IMPL_HXX_ +#define _ADDITIONINTERFACE_IMPL_HXX_ + +//#include +#include +#include CORBA_SERVER_HEADER(AdditionComponent) +#include CORBA_SERVER_HEADER(SALOME_Component) +#include "SALOME_Component_i.hxx" + +class AdditionInterface_Impl : public POA_AdditionComponent::AdditionInterface , + public Engines_Component_i { +public: + AdditionInterface_Impl() ; + AdditionInterface_Impl( CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName); + + virtual ~AdditionInterface_Impl(); + + virtual double Add( double x , double y , double & z ) ; + virtual double AddWithoutSleep( double x , double y , double & z ) ; + + virtual void Setx( double x ) ; + virtual void Sety( double y ) ; + virtual double Addxy() ; + virtual double AddyTox( double y ) ; + + virtual long Sigma( long n ) ; + + virtual double LastResult() ; + + virtual AdditionComponent::Adder_ptr Addition() ; + + virtual bool AdditionObjRef1( AdditionComponent::Adder_out ) ; + + virtual void AdditionObjRef2( bool & FuncValue , AdditionComponent::Adder_out ) ; + + virtual bool AdditionObjRefs( const AdditionComponent::AdditionInterface_ptr AdditionInterface1 , + const AdditionComponent::AdditionInterface_ptr Adder2 , + const AdditionComponent::AdditionInterface_ptr Adder3 , + AdditionComponent::AdditionInterface_out RetAdditionInterface1 , + AdditionComponent::AdditionInterface_out RetAdder2 , + AdditionComponent::AdditionInterface_out RetAdder3 ) ; + +private: + + double xx ; + double yy ; + double LastAddition ; + +}; + +extern "C" + PortableServer::ObjectId * AdditionInterfaceEngine_factory + ( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName ) ; + +#endif diff --git a/src/AdditionComponent/Addition_Adder_Impl.cxx b/src/AdditionComponent/Addition_Adder_Impl.cxx new file mode 100644 index 0000000..e2aa0e8 --- /dev/null +++ b/src/AdditionComponent/Addition_Adder_Impl.cxx @@ -0,0 +1,183 @@ +// SuperVisionTest AddComponent : example of component that adds two numbers +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : AddComponent_Impl.cxx +// Author : Jean Rahuel, CEA +// Module : SuperVisionTest + +using namespace std; +#include +#include +#include +#include +#include + +#include "utilities.h" +#include "Utils_ORB_INIT.hxx" +#include "Utils_SINGLETON.hxx" +#include "SALOME_NamingService.hxx" +#include "SALOME_LifeCycleCORBA.hxx" + +#include "Addition_Adder_Impl.hxx" + +Adder_Impl::Adder_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char * instanceName , + const char * interfaceName , + const char * graphName , + const char * nodeName ) : + Engines_Component_i(orb, poa, contId, instanceName, interfaceName,1,true) { + Names( graphName , nodeName ) ; + MESSAGE("Adder_Impl::Adder_Impl activate object instanceName(" + << instanceName << ") interfaceName(" << interfaceName << ") --> " + << hex << (void *) this << dec ) + beginService( "Adder_Impl::Adder_Impl" ); + _thisObj = this ; + _id = _poa->activate_object(_thisObj); + LastAddition = 0 ; + sendMessage(NOTIF_STEP, "Adder_Impl is Created"); + endService( "Adder_Impl::Adder_Impl" ); +} + +Adder_Impl::Adder_Impl() { + LastAddition = 0 ; +} + +Adder_Impl::~Adder_Impl() { + beginService( "Adder_Impl::~Adder_Impl" ); + endService( "Adder_Impl::~Adder_Impl" ); +} + +void Adder_Impl::destroy() { + _poa->deactivate_object(*_id) ; + CORBA::release(_poa) ; + delete(_id) ; + _thisObj->_remove_ref(); +} + +double Adder_Impl::Add( double x , double y , double & z ) { + beginService( " Adder_Impl::Add" ); + z = x + y ; + int S; + + sendMessage(NOTIF_STEP, "Adder_Impl::Add is Computing"); +// S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); + S = 5 ; + while ( S ) { + S = sleep(S); + } + MESSAGE( "Adder_Impl::Add( " << x << " , " << y << " , " << z + << " ) returns " << -(x - y) << " after " << S << " seconds" ) + LastAddition = z ; + endService( " Adder_Impl::Add" ); + return -(x - y) ; +} + +double Adder_Impl::AddWithoutSleep( double x , double y , double & z ) { + beginService( " Adder_Impl::AddWithoutSleep" ); + z = x + y ; + endService( " Adder_Impl::AddWithoutSleep" ); + return -(x - y) ; +} + +double Adder_Impl::AddAndCompare( const double x , const double y , + const AdditionComponent::Adder_ptr anOtherAdder , + double & z ) { + beginService( " Adder_Impl::AddAndCompare" ); + z = x + y ; + int S; + + sendMessage(NOTIF_STEP, "Adder_Impl::AddAndCompare is Computing"); +// S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); + S = 5 ; + while ( S ) { + S = sleep(S); + } + MESSAGE( "Adder_Impl::AddAndCompare( " << x << " , " << y << " , " << z + << " ) returns " << -(x - y) << " after " << S << " seconds" ) + LastAddition = z ; + double ValFunc ; + sendMessage(NOTIF_TRACE, "Adder_Impl::AddAndCompare will call anOtherAdder->LastValue()"); + double RetVal ; + anOtherAdder->LastResult( RetVal ) ; + if ( RetVal > 0 ) { + ValFunc = (x - y) ; + } + else { + ValFunc = -(x - y) ; + } + sendMessage(NOTIF_TRACE, "Adder_Impl::AddAndCompare has called anOtherAdder->LastValue()"); + sendMessage(NOTIF_STEP, "Adder_Impl::AddAndCompare is Finished"); + endService( " Adder_Impl::AddAndCompare" ); + return ValFunc ; +} + +void Adder_Impl::SetLastResult( double z ) { + beginService( " Adder_Impl::SetLastResult" ); + sendMessage(NOTIF_STEP, "Adder_Impl::SetLastResult is Computing"); + int S; +// S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); + S = 5 ; + while ( S ) { + S = sleep(S); + } + LastAddition = z ; + endService( " Adder_Impl::SetLastResult" ); + return ; +} + +void Adder_Impl::LastResult( double & z ) { + beginService( " Adder_Impl::LastResult" ); + sendMessage(NOTIF_STEP, "Adder_Impl::LastResult is Computing"); + int S; +// S = 1+(int) (15.0*rand()/(RAND_MAX+1.0)); + S = 5 ; + while ( S ) { + S = sleep(S); + } + z = LastAddition ; + endService( " Adder_Impl::LastResult" ); + return ; +} + +Engines::Component_ptr Adder_Impl::LccAdditionInterface( const char * aContainer , + const char * aComponentName ) { + beginService( "Adder_Impl::LccAddComponent" ); + Engines::Component_ptr objComponent ; + objComponent = Engines::Component::_nil() ; + + ORB_INIT &init = *SINGLETON_::Instance() ; + ASSERT(SINGLETON_::IsAlreadyExisting()); + CORBA::ORB_var orb = init(0 , 0 ) ; + SALOME_NamingService *_NS ; + _NS = new SALOME_NamingService(); + _NS->init_orb( CORBA::ORB::_duplicate(orb) ) ; + + SALOME_LifeCycleCORBA LCC( _NS ) ; + objComponent = LCC.FindOrLoad_Component( aContainer , + aComponentName ); + endService( "Adder_Impl::LccAddComponent" ); + return objComponent ; +} + diff --git a/src/AdditionComponent/Addition_Adder_Impl.hxx b/src/AdditionComponent/Addition_Adder_Impl.hxx new file mode 100644 index 0000000..6ebb5d4 --- /dev/null +++ b/src/AdditionComponent/Addition_Adder_Impl.hxx @@ -0,0 +1,75 @@ +// SuperVisionTest AddComponent : example of component that adds two numbers +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : Adder_Impl.hxx +// Author : Jean Rahuel, CEA +// Module : SuperVisionTest +// $Header: + +#ifndef _ADDITION_ADDER_IMPL_HXX_ +#define _ADDITION_ADDER_IMPL_HXX_ + +#include +#include +#include CORBA_SERVER_HEADER(AdditionComponent) +#include CORBA_SERVER_HEADER(SALOME_Component) +#include "SALOME_Component_i.hxx" + +class Adder_Impl : public POA_AdditionComponent::Adder , + public Engines_Component_i { + public: + Adder_Impl() ; + Adder_Impl( CORBA::ORB_ptr orb , + PortableServer::POA_ptr poa , + PortableServer::ObjectId * contId , + const char *instanceName , + const char *interfaceName , + const char * graphName , + const char * nodeName ); + + virtual ~Adder_Impl(); + + virtual void destroy() ; + + virtual double Add( double x , double y , double & z ) ; + + virtual double AddWithoutSleep( double x , double y , double & z ) ; + + virtual double AddAndCompare( const double x , const double y , + const AdditionComponent::Adder_ptr anOtherAdder , + double & z ) ; + + virtual void SetLastResult( double z ) ; + + virtual void LastResult( double & z ) ; + + virtual Engines::Component_ptr LccAdditionInterface( const char * aContainer , + const char * aComponentName ) ; + + private: + + double LastAddition ; + +}; + +#endif diff --git a/src/AdditionComponent/Makefile.in b/src/AdditionComponent/Makefile.in new file mode 100755 index 0000000..b1780fd --- /dev/null +++ b/src/AdditionComponent/Makefile.in @@ -0,0 +1,63 @@ +# SuperVisionTest AddComponent : example of component that adds two numbers +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# +# +# File : Makefile.in +# Author : , CEA +# Module : SuperVisionTest +# $Header$ + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +EXPORT_HEADERS = \ + AdditionComponent_Impl.hxx \ + Addition_Adder_Impl.hxx + +# Libraries targets +LIB = libAdditionComponentEngine.la +LIB_SRC = \ + AdditionComponent_Impl.cxx \ + Addition_Adder_Impl.cxx + +LIB_SERVER_IDL = SALOME_ContainerManager.idl \ + SALOME_Component.idl \ + AdditionComponent.idl + +# Executables targets +BIN = AdditionComponent_CheckOfUndefined +BIN_SRC = +BIN_SERVER_IDL = + +CPPFLAGS+= $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS= -g -D_DEBUG_ -D__x86__ -D__linux__ $(PYTHON_INCLUDES) -ftemplate-depth-42 -Wall -I${KERNEL_ROOT_DIR}/include/salome +LDFLAGS+= -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeContainer -lSalomeNS -lOpUtil -lRegistry -lSalomeNotification -lSALOMELocalTrace -lSalomeNS -lSalomeLifeCycleCORBA + +LDFLAGSFORBIN+= -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeContainer -lSalomeNS -lOpUtil -lRegistry -lSalomeNotification -lSALOMELocalTrace + +@CONCLUDE@ + -- 2.39.2