]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Added a factory methods to convert CORBA SALOMEDS objects to SALOMEDSClient wrappers
authorsrn <srn@opencascade.com>
Mon, 20 Feb 2006 11:21:54 +0000 (11:21 +0000)
committersrn <srn@opencascade.com>
Mon, 20 Feb 2006 11:21:54 +0000 (11:21 +0000)
src/SALOMEDS/SALOMEDS.cxx

index ae488ad0a7421c26faf12a33d44c5e809a4a9310..4a35577e12f33e2a9988df814177a7faed6b20ac 100644 (file)
 //  Module : SALOME
 //  $Header$
 
-
 #ifndef WNT
 #include <SALOMEDS.hxx>
+#include <SALOMEDS_StudyManager.hxx>
+#include <SALOMEDS_Study.hxx>
+#include <SALOMEDS_SObject.hxx>
+#include <SALOMEDS_SComponent.hxx>
+#include <SALOMEDSClient.hxx>
+#include <SALOMEDS_StudyManager_i.hxx>
 #else
 #include "SALOMEDS.hxx"
+#include "SALOMEDS_StudyManager.hxx"
+#include "SALOMEDS_Study.hxx"
+#include "SALOMEDS_SObject.hxx"
+#include "SALOMEDS_SComponent.hxx"
+#include "SALOMEDSClient.hxx"
+#include "SALOMEDS_StudyManager_i.hxx"
 #endif
 
+// IDL headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SALOMEDS)
+
 using namespace SALOMEDS;
 
 // PAL8065: san -- Global recursive mutex for SALOMEDS methods
@@ -55,3 +70,48 @@ void SALOMEDS::unlock()
 {
   Locker::MutexDS.unlock();
 }
+
+
+
+// srn: Added new library methods that create basic SALOMEDS objects (StudyManager, Study, SComponent, SObject)
+
+//=============================================================================
+/*!
+ * C factory, accessible with dlsym, after dlopen
+ */
+//=============================================================================
+
+
+extern "C"
+{
+
+SALOMEDSClient_StudyManager* StudyManagerFactory()
+{
+  return new SALOMEDS_StudyManager();
+}
+
+SALOMEDSClient_Study* StudyFactory(SALOMEDS::Study_ptr theStudy)
+{
+  return new SALOMEDS_Study(theStudy);
+}
+
+SALOMEDSClient_SObject* SObjectFactory(SALOMEDS::SObject_ptr theSObject)
+{
+  return new SALOMEDS_SObject(theSObject);
+}
+
+SALOMEDSClient_SComponent* SComponentFactory(SALOMEDS::SComponent_ptr theSComponent)
+{
+  return new SALOMEDS_SComponent(theSComponent);
+}
+
+SALOMEDSClient_StudyManager* CreateStudyManager(CORBA::ORB_ptr orb, PortableServer::POA_ptr root_poa)
+{
+  SALOMEDS_StudyManager_i * aStudyManager_i = new  SALOMEDS_StudyManager_i(orb, root_poa);
+  // Activate the objects.  This tells the POA that the objects are ready to accept requests.
+  PortableServer::ObjectId_var aStudyManager_iid =  root_poa->activate_object(aStudyManager_i);
+  aStudyManager_i->register_name("/myStudyManager");
+  return new SALOMEDS_StudyManager();
+}
+
+}