SALOMEDSClient_UseCaseBuilder.hxx \
SALOMEDSClient_UseCaseIterator.hxx \
SALOMEDSClient_ClientFactory.hxx \
+ SALOMEDSClient_IParameters.hxx \
SALOMEDSClient.hxx
#
#define SOBJECT_FACTORY "SObjectFactory"
#define SCOMPONENT_FACTORY "SComponentFactory"
#define STUDY_FACTORY "StudyFactory"
+#define BUILDER_FACTORY "BuilderFactory"
#define STUDYMANAGER_FACTORY "StudyManagerFactory"
#define STUDYMANAGER_CREATE "CreateStudyManager"
+#define GET_PARAMETERS "GetIParameters"
+#define CONVERT_SOBJECT "ConvertSObject"
+#define CONVERT_STUDY "ConvertStudy"
+#define CONVERT_BUILDER "ConvertBuilder"
typedef SALOMEDSClient_SObject* (*SOBJECT_FACTORY_FUNCTION) (SALOMEDS::SObject_ptr);
typedef SALOMEDSClient_SComponent* (*SCOMPONENT_FACTORY_FUNCTION) (SALOMEDS::SComponent_ptr);
typedef SALOMEDSClient_Study* (*STUDY_FACTORY_FUNCTION) (SALOMEDS::Study_ptr);
typedef SALOMEDSClient_StudyManager* (*STUDYMANAGER_FACTORY_FUNCTION) ();
+typedef SALOMEDSClient_StudyBuilder* (*BUILDER_FACTORY_FUNCTION) (SALOMEDS::StudyBuilder_ptr);
typedef SALOMEDSClient_StudyManager* (*STUDYMANAGER_CREATE_FUNCTION) (CORBA::ORB_ptr, PortableServer::POA_ptr);
+typedef SALOMEDSClient_IParameters* (*GET_PARAMETERS_FACTORY) (const _PTR(AttributeParameter)&);
+typedef SALOMEDS::SObject_ptr (*CONVERT_SOBJECT_FUNCTION) (const _PTR(SObject)&);
+typedef SALOMEDS::Study_ptr (*CONVERT_STUDY_FUNCTION) (const _PTR(Study)&);
+typedef SALOMEDS::StudyBuilder_ptr (*CONVERT_BUILDER_FUNCTION) (const _PTR(StudyBuilder)&);
+
static SOBJECT_FACTORY_FUNCTION aSObjectFactory = NULL;
static SCOMPONENT_FACTORY_FUNCTION aSComponentFactory = NULL;
static STUDY_FACTORY_FUNCTION aStudyFactory = NULL;
+static BUILDER_FACTORY_FUNCTION aBuilderFactory = NULL;
static STUDYMANAGER_FACTORY_FUNCTION aManagerFactory = NULL;
static STUDYMANAGER_CREATE_FUNCTION aCreateFactory = NULL;
+static GET_PARAMETERS_FACTORY aGetIParameters = NULL;
+static CONVERT_SOBJECT_FUNCTION aConvertSObject = NULL;
+static CONVERT_STUDY_FUNCTION aConvertStudy = NULL;
+static CONVERT_BUILDER_FUNCTION aConvertBuilder = NULL;
using namespace std;
return _PTR(Study)(study);
}
+_PTR(StudyBuilder) ClientFactory::StudyBuilder(SALOMEDS::StudyBuilder_ptr theStudyBuilder)
+{
+ SALOMEDSClient_StudyBuilder* studyBuilder = NULL;
+
+#ifdef WIN32
+ if(!_libHandle) _libHandle = ::LoadLibrary(SALOMEDS_LIB_NAME);
+ if(!aBuilderFactory) aBuilderFactory = (BUILDER_FACTORY_FUNCTION)::GetProcAddress(_libHandle, BUILDER_FACTORY);
+#else
+ if(!_libHandle) _libHandle = dlopen(SALOMEDS_LIB_NAME, RTLD_LAZY | RTLD_GLOBAL);
+ if(!aBuilderFactory) aBuilderFactory = (BUILDER_FACTORY_FUNCTION) dlsym(_libHandle, BUILDER_FACTORY);
+#endif
+
+ if(aBuilderFactory) studyBuilder = aBuilderFactory(theStudyBuilder);
+ return _PTR(StudyBuilder)(studyBuilder);
+}
+
_PTR(StudyManager) ClientFactory::StudyManager()
{
SALOMEDSClient_StudyManager* manager = NULL;
return _PTR(StudyManager)(manager);
}
+_PTR(IParameters) ClientFactory::getIParameters(const _PTR(AttributeParameter)& ap)
+{
+ SALOMEDSClient_IParameters* interface = NULL;
+
+#ifdef WIN32
+ if(!_libHandle) _libHandle = ::LoadLibrary(SALOMEDS_LIB_NAME);
+ if(!aGetIParameters) aGetIParameters = (GET_PARAMETERS_FACTORY)::GetProcAddress(_libHandle, GET_PARAMETERS);
+#else
+ if(!_libHandle) _libHandle = dlopen(SALOMEDS_LIB_NAME, RTLD_LAZY | RTLD_GLOBAL);
+ if(!aGetIParameters) aGetIParameters = (GET_PARAMETERS_FACTORY) dlsym(_libHandle, GET_PARAMETERS);
+#endif
+
+ if(aGetIParameters) interface = aGetIParameters(ap);
+ return _PTR(IParameters)(interface);
+}
+
+SALOMEDS::SObject_ptr ClientFactory::crbSObject(const _PTR(SObject)& theSObject)
+{
+ SALOMEDS::SObject_var so;
+
+#ifdef WIN32
+ if(!_libHandle) _libHandle = ::LoadLibrary(SALOMEDS_LIB_NAME);
+ if(!aConvertSObject) aConvertSObject = (CONVERT_SOBJECT_FUNCTION)::GetProcAddress(_libHandle, CONVERT_SOBJECT);
+#else
+ if(!_libHandle) _libHandle = dlopen(SALOMEDS_LIB_NAME, RTLD_LAZY | RTLD_GLOBAL);
+ if(!aConvertSObject) aConvertSObject = (CONVERT_SOBJECT_FUNCTION) dlsym(_libHandle, CONVERT_SOBJECT);
+#endif
+
+ if(aConvertSObject) so = aConvertSObject(theSObject);
+
+ if(CORBA::is_nil(so)) return SALOMEDS::SObject::_nil();
+ return so._retn();
+}
+
+
+SALOMEDS::Study_ptr ClientFactory::crbStudy(const _PTR(Study)& theStudy)
+{
+ SALOMEDS::Study_var study;
+
+#ifdef WIN32
+ if(!_libHandle) _libHandle = ::LoadLibrary(SALOMEDS_LIB_NAME);
+ if(!aConvertStudy) aConvertStudy = (CONVERT_STUDY_FUNCTION)::GetProcAddress(_libHandle, CONVERT_STUDY);
+#else
+ if(!_libHandle) _libHandle = dlopen(SALOMEDS_LIB_NAME, RTLD_LAZY | RTLD_GLOBAL);
+ if(!aConvertStudy) aConvertStudy = (CONVERT_STUDY_FUNCTION) dlsym(_libHandle, CONVERT_STUDY);
+#endif
+
+ if(aConvertStudy) study = aConvertStudy(theStudy);
+
+ if(CORBA::is_nil(study)) return SALOMEDS::Study::_nil();
+ return study._retn();
+}
+
+SALOMEDS::StudyBuilder_ptr ClientFactory::crbStudyBuilder(const _PTR(StudyBuilder)& theStudyBuilder)
+{
+ SALOMEDS::StudyBuilder_var studyBuilder;
+
+#ifdef WIN32
+ if(!_libHandle) _libHandle = ::LoadLibrary(SALOMEDS_LIB_NAME);
+ if(!aConvertBuilder)aConvertBuilder = (CONVERT_BUILDER_FUNCTION)::GetProcAddress(_libHandle, CONVERT_BUILDER);
+#else
+ if(!_libHandle) _libHandle = dlopen(SALOMEDS_LIB_NAME, RTLD_LAZY | RTLD_GLOBAL);
+ if(!aConvertBuilder) aConvertBuilder = (CONVERT_BUILDER_FUNCTION) dlsym(_libHandle, CONVERT_BUILDER);
+#endif
+
+ if(aConvertBuilder) studyBuilder = aConvertBuilder(theStudyBuilder);
+
+ if(CORBA::is_nil(studyBuilder)) return SALOMEDS::StudyBuilder::_nil();
+ return studyBuilder._retn();
+}
#include "SALOMEDSClient_SComponent.hxx"
#include "SALOMEDSClient_Study.hxx"
#include "SALOMEDSClient_StudyManager.hxx"
+#include "SALOMEDSClient_IParameters.hxx"
#include <string>
*/
static _PTR(Study) Study(SALOMEDS::Study_ptr theStudy);
+ /*!
+ * Returns a client StudyBuilder wrapper that corresponds %theStudy
+ */
+ static _PTR(StudyBuilder) StudyBuilder(SALOMEDS::StudyBuilder_ptr theBuilder);
+
/*!
* Returns a client StudyManager wrapper
*/
*/
static _PTR(StudyManager) createStudyManager(CORBA::ORB_ptr orb, PortableServer::POA_ptr poa);
-
+ /*!
+ * Returns an IParameters interface
+ */
+ static _PTR(IParameters) getIParameters(const _PTR(AttributeParameter)& ap);
+
+
+ /*!
+ * Returns a CORBA SObject that corresponds %theStudy
+ */
+ static SALOMEDS::SObject_ptr crbSObject(const _PTR(SObject)& theSObject);
+
+ /*!
+ * Returns a CORBA Study that corresponds %theStudy
+ */
+ static SALOMEDS::Study_ptr crbStudy(const _PTR(Study)& theStudy);
+
+ /*!
+ * Returns a CORBA StudyBuilder that corresponds %theStudyBuilder
+ */
+ static SALOMEDS::StudyBuilder_ptr crbStudyBuilder(const _PTR(StudyBuilder)& theStudyBuilder);
+
};
#endif
--- /dev/null
+// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// 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.salome-platform.org/
+//
+#ifndef SALOMEDSClient_IParameters_H
+#define SALOMEDSClient_IParameters_H
+
+#include <string>
+#include <vector>
+#include <map>
+
+#include "SALOMEDSClient_definitions.hxx"
+#include "SALOMEDSClient_AttributeParameter.hxx"
+
+/*!
+ Class which an interface to store the parameters of the objects
+*/
+class SALOMEDSClient_IParameters
+{
+public:
+
+ virtual ~SALOMEDSClient_IParameters() {}
+
+ /*!
+ Appends a string value to a named list.
+ Returns a number of the added value.
+ Note: the name of the list MUST be unique
+ */
+ virtual int append(const std::string& listName, const std::string& value) = 0;
+
+ /*!
+ Returns a number elements in the list
+ */
+ virtual int nbValues(const std::string& listName) = 0;
+
+ /*!
+ Returns a list of values in the list
+ */
+ virtual std::vector<std::string> getValues(const std::string& listName) = 0;
+
+ /*!
+ Returns a value with given %index, where %index is in range [0:nbValues-1]
+ */
+ virtual std::string getValue(const std::string& listName, int index) = 0;
+
+ /*!
+ Returns a list all entries lists
+ */
+ virtual std::vector<std::string> getLists() = 0;
+
+ /*!
+ Sets a new named parameter value for the given entry
+ */
+ virtual void setParameter(const std::string& entry, const std::string& parameterName, const std::string& value) = 0;
+
+ /*!
+ Gets a named parameter value for the given entry
+ */
+ virtual std::string getParameter(const std::string& entry, const std::string& parameterName) = 0;
+
+ /*!
+ Returns all parameter names of the given entry
+ */
+ virtual std::vector<std::string> getAllParameterNames(const std::string& entry) = 0;
+
+ /*!
+ Returns all parameter values of the given entry
+ */
+ virtual std::vector<std::string> getAllParameterValues(const std::string& entry) = 0;
+
+ /*!
+ Returns a number of parameters of the given entry
+ */
+ virtual int getNbParameters(const std::string& entry) = 0;
+
+ /*!
+ Returns a list all entries
+ */
+ virtual std::vector<std::string> getEntries() = 0;
+
+ /*!
+ Sets a global named property value
+ */
+ virtual void setProperty(const std::string& name, const std::string& value) = 0;
+
+ /*!
+ Gets a value of global named property
+ */
+ virtual std::string getProperty(const std::string& name) = 0;
+
+ /*!
+ Returns a list all properties
+ */
+ virtual std::vector<std::string> getProperties() = 0;
+
+ /*!
+ Breaks a value string in two parts which is divided by %separator.
+ If fromEnd is True the search of separator starts from the end of the string
+ */
+ virtual std::vector<std::string> parseValue(const std::string& value, const char separator, bool fromEnd = true) = 0;
+
+
+ /*!
+ Returns encoded entry that is a relative entry for the component
+ */
+ virtual std::string encodeEntry(const std::string& entry, const std::string& compName) = 0;
+
+ /*!
+ Returns decoded entry that is an absolute entry
+ */
+ virtual std::string decodeEntry(const std::string& entry) = 0;
+
+ /*!
+ Enables/Disables the dumping visual parameters, static implementation is supposed
+ */
+ virtual void setDumpPython(_PTR(Study) study, const std::string& theID = "") = 0;
+
+ /*!
+ Returns whether there is the dumping visual parameters, static implementation is supposed
+ */
+ virtual bool isDumpPython(_PTR(Study) study, const std::string& theID = "") = 0;
+
+ /*!
+ Returns a default name of the component where the visula parameters are stored.
+ Static implementation is supposed
+ */
+ virtual std::string getDefaultVisualComponent() = 0;
+
+};
+
+
+#endif