Launcher.hxx
PyStudyJob.hxx
TPyStudyJob.hxx
+ ydefxExports.hxx
)
SET(ydefx_LINK
//
#ifndef YDEFX_EXCEPTIONS_HXX
#define YDEFX_EXCEPTIONS_HXX
+#include "ydefxExports.hxx"
#include <string>
namespace ydefx
{
-class Exception:public std::exception
+class YDEFX_EXPORT Exception:public std::exception
{
public:
Exception(const std::string& message);
//
#ifndef YDEFX_JOB_H
#define YDEFX_JOB_H
+#include "ydefxExports.hxx"
#include <string>
namespace ydefx
{
-class Job
+class YDEFX_EXPORT Job
{
public:
virtual ~Job(){}
//
#ifndef YDEFX_JOBPARAMETERSPROXY_H
#define YDEFX_JOBPARAMETERSPROXY_H
+#include "ydefxExports.hxx"
#include <string>
#include <list>
#include <map>
namespace ydefx
{
-class JobParametersProxy
+class YDEFX_EXPORT JobParametersProxy
{
public:
JobParametersProxy();
#ifndef YDEFX_LAUNCHER_H
#define YDEFX_LAUNCHER_H
+#include "ydefxExports.hxx"
#include "TMonoPyJob.hxx"
#include "TPyStudyJob.hxx"
namespace ydefx
{
class Job;
-class Launcher
+class YDEFX_EXPORT Launcher
{
public:
Launcher():_lastError(){}
//
#ifndef YDEFX_MONOPYJOB_HXX
#define YDEFX_MONOPYJOB_HXX
+#include "ydefxExports.hxx"
#include "Job.hxx"
#include <py2cpp/PyPtr.hxx>
namespace ydefx
{
-class MonoPyJob : public Job
+class YDEFX_EXPORT MonoPyJob : public Job
{
public:
MonoPyJob();
//
#ifndef YDEFX_PYCONVERSIONS_HXX
#define YDEFX_PYCONVERSIONS_HXX
+#include "ydefxExports.hxx"
#include <py2cpp/PyPtr.hxx>
namespace ydefx
}
namespace py2cpp
{
-PyObject * toPy(const ydefx::JobParametersProxy& jp);
-PyObject * toPy(const ydefx::PyStudyFunction& jp);
+YDEFX_EXPORT PyObject * toPy(const ydefx::JobParametersProxy& jp);
+YDEFX_EXPORT PyObject * toPy(const ydefx::PyStudyFunction& jp);
}
#include <py2cpp/py2cpp.hxx>
//
#ifndef YDEFX_PYSTUDYFUNCTION_H
#define YDEFX_PYSTUDYFUNCTION_H
+#include "ydefxExports.hxx"
#include "StudyFunction.hxx"
#include "PyConversions.hxx"
namespace ydefx
{
-class PyStudyFunction : StudyFunction
+class YDEFX_EXPORT PyStudyFunction : StudyFunction
{
public:
PyStudyFunction();
//
#ifndef YDEFX_PYSTUDYJOB_HXX
#define YDEFX_PYSTUDYJOB_HXX
+#include "ydefxExports.hxx"
#include "Job.hxx"
#include <py2cpp/PyPtr.hxx>
namespace ydefx
{
-class PyStudyJob : public Job
+class YDEFX_EXPORT PyStudyJob : public Job
{
public:
PyStudyJob(const std::string& pymodule_name, const std::string& pyclass_name);
#ifndef YDEFX_SAMPLE_H\r
#define YDEFX_SAMPLE_H\r
\r
+#include "ydefxExports.hxx"\r
#include <vector>\r
#include <string>\r
#include <list>\r
{\r
\r
template <class T>\r
-class VariablesGroup\r
+class YDEFX_EXPORT VariablesGroup\r
{\r
public:\r
VariablesGroup();\r
T _defaultValue;\r
};\r
\r
-enum class ExecutionState {NOTEXECUTED, DONE, ERROR};\r
+enum class YDEFX_EXPORT ExecutionState {NOTEXECUTED, DONE, ERROR};\r
\r
template <class T>\r
-class OneTypeSample\r
+class YDEFX_EXPORT OneTypeSample\r
{\r
public:\r
const VariablesGroup<T>& inputs()const;\r
\r
// no type sample\r
template <>\r
-class Sample<>\r
+class YDEFX_EXPORT Sample<>\r
{\r
public:\r
const std::vector<std::string>& errors()const{return _errors;}\r
\r
// multi type sample\r
template <class T, class... Ts>\r
-class Sample<T, Ts...> : public OneTypeSample<T>, public Sample<Ts...>\r
+class YDEFX_EXPORT Sample<T, Ts...> : public OneTypeSample<T>, public Sample<Ts...>\r
{\r
public:\r
virtual ExecutionState pointState(int index);\r
#ifndef YDEFX_SAMPLEPYCONVERSIONS_HXX
#define YDEFX_SAMPLEPYCONVERSIONS_HXX
+#include "ydefxExports.hxx"
#include <py2cpp/py2cpp.hxx>
#include "Sample.hxx"
#include "Exceptions.hxx"
* list of sample types.
*/
template <class S, class... Ts>
-class SamplePyConverter;
+YDEFX_EXPORT class SamplePyConverter;
/*!
* Convert input variables of a sample to a python dictionary.
* The returned value is NULL in case of error.
*/
template <class ...Ts>
-PyObject* inputToPy(const Sample<Ts...>& sample);
+YDEFX_EXPORT PyObject* inputToPy(const Sample<Ts...>& sample);
/*!
* Fill the input values of the sample from a python dictionary.
* Keys from the python dictionary that do not exist in the sample are ignored.
*/
template <class ...Ts>
-py2cpp::ConversionCheck inputFromPy(PyObject* obj, Sample<Ts...>& sample);
+YDEFX_EXPORT py2cpp::ConversionCheck inputFromPy(PyObject* obj, Sample<Ts...>& sample);
/*!
* Convert output variables of a sample to a python dictionary.
* The returned value is NULL in case of error.
*/
template <class ...Ts>
-PyObject* outputToPy(const Sample<Ts...>& sample);
+YDEFX_EXPORT PyObject* outputToPy(const Sample<Ts...>& sample);
/*!
* Fill the output values of a sample from a python dictionary.
* ignored.
*/
template <class ...Ts>
-py2cpp::ConversionCheck outputFromPy(PyObject* obj, Sample<Ts...>& sample);
+YDEFX_EXPORT py2cpp::ConversionCheck outputFromPy(PyObject* obj, Sample<Ts...>& sample);
/*!
* Fill the error values of a sample from a python list of strings.
* strings.
*/
template <class ...Ts>
-py2cpp::ConversionCheck errorsFromPy(PyObject* obj, Sample<Ts...>& sample);
+YDEFX_EXPORT py2cpp::ConversionCheck errorsFromPy(PyObject* obj, Sample<Ts...>& sample);
/*!
* A python sample object is created and it contains input and output names of
* not copied.
*/
template <class ...Ts>
-py2cpp::PyPtr createPySample(const Sample<Ts...>& sample);
+YDEFX_EXPORT py2cpp::PyPtr createPySample(const Sample<Ts...>& sample);
/*!
* Fetch output values and errors from the python objet.
* function is called.
*/
template <class ...Ts>
-py2cpp::ConversionCheck fetchResults(PyObject* obj, Sample<Ts...>& sample);
+YDEFX_EXPORT py2cpp::ConversionCheck fetchResults(PyObject* obj, Sample<Ts...>& sample);
////////////////////////////////////////////////////////////////////////////////
// Template implementations
////////////////////////////////////////////////////////////////////////////////
template <class S>
-class SamplePyConverter<S>
+class YDEFX_EXPORT SamplePyConverter<S>
{
public:
bool inputToPy(const S& sample, PyObject* result){return true;}
};
template <class S, class T, class... Ts>
-class SamplePyConverter<S,T, Ts...> : public SamplePyConverter<S, Ts...>
+class YDEFX_EXPORT SamplePyConverter<S,T, Ts...> : public SamplePyConverter<S, Ts...>
{
public:
/*! Add sample.inputs<T> to result.
return ok;
}
- py2cpp::ConversionCheck inputFromPy(PyObject* obj, S& sample)
+ YDEFX_EXPORT py2cpp::ConversionCheck inputFromPy(PyObject* obj, S& sample)
{
py2cpp::ConversionCheck check;
std::list<std::string> names = sample.OneTypeSample<T>::inputs().names();
return check;
}
- bool outputToPy(const S& sample, PyObject* result)
+ YDEFX_EXPORT bool outputToPy(const S& sample, PyObject* result)
{
bool ok = true;
std::size_t maxsize = sample.maxSize();
return ok;
}
- py2cpp::ConversionCheck outputFromPy(PyObject* obj, S& sample)
+ YDEFX_EXPORT py2cpp::ConversionCheck outputFromPy(PyObject* obj, S& sample)
{
py2cpp::ConversionCheck check;
std::list<std::string> names = sample.OneTypeSample<T>::outputs().names();
};
template <class ...Ts>
-PyObject* inputToPy(const Sample<Ts...>& sample)
+YDEFX_EXPORT PyObject* inputToPy(const Sample<Ts...>& sample)
{
PyObject * result = PyDict_New();
if(result)
}
template <class ...Ts>
-py2cpp::ConversionCheck inputFromPy(PyObject* obj, Sample<Ts...>& sample)
+YDEFX_EXPORT py2cpp::ConversionCheck inputFromPy(PyObject* obj, Sample<Ts...>& sample)
{
py2cpp::ConversionCheck check;
if(PyDict_Check(obj))
}
template <class ...Ts>
-PyObject* outputToPy(const Sample<Ts...>& sample)
+YDEFX_EXPORT PyObject* outputToPy(const Sample<Ts...>& sample)
{
PyObject * result = PyDict_New();
if(result)
}
template <class ...Ts>
-py2cpp::ConversionCheck outputFromPy(PyObject* obj, Sample<Ts...>& sample)
+YDEFX_EXPORT py2cpp::ConversionCheck outputFromPy(PyObject* obj, Sample<Ts...>& sample)
{
py2cpp::ConversionCheck check;
if(PyDict_Check(obj))
}
template <class ...Ts>
-py2cpp::ConversionCheck errorsFromPy(PyObject* obj, Sample<Ts...>& sample)
+YDEFX_EXPORT py2cpp::ConversionCheck errorsFromPy(PyObject* obj, Sample<Ts...>& sample)
{
py2cpp::ConversionCheck check;
if(PyList_Check(obj))
}
template <class ...Ts>
-py2cpp::PyPtr createPySample(const Sample<Ts...>& sample)
+YDEFX_EXPORT py2cpp::PyPtr createPySample(const Sample<Ts...>& sample)
{
py2cpp::PyFunction sampleConstructor;
sampleConstructor.loadExp("pydefx", "Sample");
}
template <class ...Ts>
-py2cpp::ConversionCheck fetchResults(const py2cpp::PyPtr& obj, Sample<Ts...>& sample)
+YDEFX_EXPORT py2cpp::ConversionCheck fetchResults(const py2cpp::PyPtr& obj, Sample<Ts...>& sample)
{
py2cpp::ConversionCheck check;
check.addError(outputFromPy(obj.getAttr("_output").get(), sample));
//
#ifndef YDEFX_STUDYFUNCTION_H
#define YDEFX_STUDYFUNCTION_H
+#include "ydefxExports.hxx"
#include <string>
#include <list>
namespace ydefx
{
-class StudyFunction
+class YDEFX_EXPORT StudyFunction
{
public:
virtual ~StudyFunction(){}
//
#ifndef YDEFX_TMONOPYJOB_HXX
#define YDEFX_TMONOPYJOB_HXX
+#include "ydefxExports.hxx"
#include "JobParametersProxy.hxx"
#include "MonoPyJob.hxx"
#include "SamplePyConversions.hxx"
namespace ydefx
{
template <class ...Ts>
-class TMonoPyJob : public MonoPyJob
+class YDEFX_EXPORT TMonoPyJob : public MonoPyJob
{
public:
//! Create a new job.
//
#ifndef YDEFX_TPYSTUDYJOB_HXX
#define YDEFX_TPYSTUDYJOB_HXX
+#include "ydefxExports.hxx"
#include "JobParametersProxy.hxx"
#include "PyStudyJob.hxx"
#include "SamplePyConversions.hxx"
namespace ydefx
{
template <class ...Ts>
-class TPyStudyJob : public PyStudyJob
+class YDEFX_EXPORT TPyStudyJob : public PyStudyJob
{
public:
//! Create a new job using the default pystudy class.
//
#ifndef YDEFX_YACSSTUDYFUNCTION_H
#define YDEFX_YACSSTUDYFUNCTION_H
+#include "ydefxExports.hxx"
#include "StudyFunction.hxx"
namespace ydefx
{
//TODO not implemented!
-class YacsStudyFunction : StudyFunction
+class YDEFX_EXPORT YacsStudyFunction : StudyFunction
{
public:
YacsStudyFunction();
--- /dev/null
+// Copyright (C) 2021 EDF 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, or (at your option) any later version.
+//
+// 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/ or email : webmaster.salome@opencascade.com
+//
+
+#pragma once
+
+#ifdef WIN32
+# if defined(ydefx_EXPORTS) || defined(ydefx_EXPORTS)
+# define YDEFX_EXPORT __declspec( dllexport )
+# else
+# define YDEFX_EXPORT __declspec( dllimport )
+# endif
+#else
+# define YDEFX_EXPORT
+#endif