]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Add ConnectorAPI
authorspo <sergey.pokhodenko@opencascade.com>
Thu, 16 Jun 2016 13:51:57 +0000 (16:51 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Fri, 17 Jun 2016 11:41:12 +0000 (14:41 +0300)
CMakeLists.txt
src/ConnectorAPI/CMakeLists.txt [new file with mode: 0644]
src/ConnectorAPI/ConnectorAPI.h [new file with mode: 0644]
src/ConnectorAPI/ConnectorAPI.i [new file with mode: 0644]
src/ConnectorAPI/ConnectorAPI_Connector.cpp [new file with mode: 0644]
src/ConnectorAPI/ConnectorAPI_Connector.h [new file with mode: 0644]
src/ConnectorAPI/ConnectorAPI_swig.h [new file with mode: 0644]
src/PythonAPI/model/connection/__init__.py

index 30b0198828c596566a1feb065dd1578c3eee1aa7..7ecfbf08c64ba955d26578c4d7f94fe0a6abd38e 100644 (file)
@@ -96,6 +96,7 @@ ADD_SUBDIRECTORY (src/PythonAddons)
 ADD_SUBDIRECTORY (src/PythonAPI)
 # High Level C++/Python API
 ADD_SUBDIRECTORY (src/ModelHighAPI)
+ADD_SUBDIRECTORY (src/ConnectorAPI)
 ADD_SUBDIRECTORY (src/ConstructionAPI)
 ADD_SUBDIRECTORY (src/ExchangeAPI)
 ADD_SUBDIRECTORY (src/FeaturesAPI)
diff --git a/src/ConnectorAPI/CMakeLists.txt b/src/ConnectorAPI/CMakeLists.txt
new file mode 100644 (file)
index 0000000..4c68777
--- /dev/null
@@ -0,0 +1,69 @@
+## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+INCLUDE(Common)
+
+SET(PROJECT_HEADERS
+  ConnectorAPI.h
+  ConnectorAPI_Connector.h
+)
+
+SET(PROJECT_SOURCES
+  ConnectorAPI_Connector.cpp
+)
+
+SET(PROJECT_LIBRARIES
+  ModelAPI
+  ModelHighAPI
+)
+
+INCLUDE_DIRECTORIES(
+  ${PROJECT_SOURCE_DIR}/src/Events
+  ${PROJECT_SOURCE_DIR}/src/ModelAPI
+  ${PROJECT_SOURCE_DIR}/src/ModelHighAPI
+)
+
+# Plugin headers dependency
+INCLUDE_DIRECTORIES(
+  # TODO(spo): modify ConnectorPlugin headers to remove dependency on GeomAPI headers
+  ${PROJECT_SOURCE_DIR}/src/GeomAPI
+  # TODO(spo): it is for *_swig.h files. Can we eliminate it?
+  ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
+  ${PROJECT_SOURCE_DIR}/src/ConnectorPlugin
+)
+
+#TODO(spo): is ${CAS_DEFINITIONS} necessary?
+ADD_DEFINITIONS(-DCONSTRUCTIONAPI_EXPORTS ${CAS_DEFINITIONS})
+ADD_LIBRARY(ConnectorAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+TARGET_LINK_LIBRARIES(ConnectorAPI ${PROJECT_LIBRARIES})
+
+# SWIG wrapper
+
+INCLUDE(PythonAPI)
+
+SET_SOURCE_FILES_PROPERTIES(ConnectorAPI.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(ConnectorAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+
+#TODO(spo): is ModelAPI necessary or it could be received by INTERFACE_ (may require modern CMake)?
+SET(SWIG_LINK_LIBRARIES
+  ConnectorAPI
+  ModelHighAPI
+  ModelAPI
+  ${PYTHON_LIBRARIES}
+)
+
+SET(SWIG_MODULE_ConnectorAPI_EXTRA_DEPS ${SWIG_MODULE_ConnectorAPI_EXTRA_DEPS}
+  ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i
+  doxyhelp.i
+  ${PROJECT_HEADERS}
+)
+
+SWIG_ADD_MODULE(ConnectorAPI python ConnectorAPI.i ${PROJECT_HEADERS})
+SWIG_LINK_LIBRARIES(ConnectorAPI ${SWIG_LINK_LIBRARIES})
+
+IF(WIN32)
+  SET_TARGET_PROPERTIES(_ConnectorAPI PROPERTIES DEBUG_OUTPUT_NAME _ConnectorAPI_d)
+ENDIF(WIN32)
+
+INSTALL(TARGETS _ConnectorAPI DESTINATION ${SHAPER_INSTALL_SWIG})
+INSTALL(TARGETS ConnectorAPI DESTINATION ${SHAPER_INSTALL_BIN})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ConnectorAPI.py DESTINATION ${SHAPER_INSTALL_SWIG})
diff --git a/src/ConnectorAPI/ConnectorAPI.h b/src/ConnectorAPI/ConnectorAPI.h
new file mode 100644 (file)
index 0000000..7b2391a
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef CONNECTORAPI_H
+#define CONNECTORAPI_H
+
+#if defined CONNECTORAPI_EXPORTS
+#if defined WIN32
+#define CONNECTORAPI_EXPORT __declspec( dllexport )
+#else
+#define CONNECTORAPI_EXPORT
+#endif
+#else
+#if defined WIN32
+#define CONNECTORAPI_EXPORT __declspec( dllimport )
+#else
+#define CONNECTORAPI_EXPORT
+#endif
+#endif
+
+#endif
diff --git a/src/ConnectorAPI/ConnectorAPI.i b/src/ConnectorAPI/ConnectorAPI.i
new file mode 100644 (file)
index 0000000..ba3165c
--- /dev/null
@@ -0,0 +1,22 @@
+/* ConnectorAPI.i */
+
+%module ConnectorAPI
+
+%{
+  #include "ConnectorAPI_swig.h"
+%}
+
+%include "doxyhelp.i"
+
+// import other modules
+%import "ModelHighAPI.i"
+
+// to avoid error on this
+#define CONNECTORAPI_EXPORT
+
+// standard definitions
+%include "typemaps.i"
+%include "std_shared_ptr.i"
+
+// all supported interfaces
+%include "ConnectorAPI_Connector.h"
diff --git a/src/ConnectorAPI/ConnectorAPI_Connector.cpp b/src/ConnectorAPI/ConnectorAPI_Connector.cpp
new file mode 100644 (file)
index 0000000..2a48f70
--- /dev/null
@@ -0,0 +1,18 @@
+// Name   : ConnectorAPI_Connector.cpp
+// Purpose: 
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "ConnectorAPI_Connector.h"
+//--------------------------------------------------------------------------------------
+#include <ModelAPI_Document.h>
+#include <ModelAPI_Feature.h>
+//--------------------------------------------------------------------------------------
+void exportToGEOM(const std::shared_ptr<ModelAPI_Document> & thePart)
+{
+  // TODO(spo): check that theConnector is not empty
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature("ExportToGEOM");
+  aFeature->execute();
+}
diff --git a/src/ConnectorAPI/ConnectorAPI_Connector.h b/src/ConnectorAPI/ConnectorAPI_Connector.h
new file mode 100644 (file)
index 0000000..5ddf0bf
--- /dev/null
@@ -0,0 +1,25 @@
+// Name   : ConnectorAPI_Connector.h
+// Purpose: 
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_CONNECTORAPI_CONNECTORAPI_PART_H_
+#define SRC_CONNECTORAPI_CONNECTORAPI_PART_H_
+
+//--------------------------------------------------------------------------------------
+#include "ConnectorAPI.h"
+//--------------------------------------------------------------------------------------
+#include <memory>
+//--------------------------------------------------------------------------------------
+class ModelAPI_Document;
+//--------------------------------------------------------------------------------------
+/**\ingroup CPPHighAPI
+ * \brief Export to GEOM
+ */
+CONNECTORAPI_EXPORT
+void exportToGEOM(const std::shared_ptr<ModelAPI_Document> & thePart);
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_CONNECTORAPI_CONNECTORAPI_PART_H_ */
diff --git a/src/ConnectorAPI/ConnectorAPI_swig.h b/src/ConnectorAPI/ConnectorAPI_swig.h
new file mode 100644 (file)
index 0000000..a94542d
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:    ConnectorAPI_swig.h
+// Created: 16/06/16
+// Author:  Sergey POKHODENKO
+
+#ifndef SRC_CONNECTORAPI_CONNECTORAPI_SWIG_H_
+#define SRC_CONNECTORAPI_CONNECTORAPI_SWIG_H_
+
+  #include <ModelHighAPI_swig.h>
+
+  #include "ConnectorAPI_Connector.h"
+
+#endif /* SRC_CONNECTORAPI_CONNECTORAPI_SWIG_H_ */
index 514b7f9ee1435b9f74dd7745492cddda069e684d..1b5a6587efd1eb6952ed7576f5ce3aedb1000c69 100644 (file)
@@ -1,4 +1,4 @@
 """Package for Connection plugin for the Parametric Geometry API of the Modeler.
 """
 
-from connection import exportToGEOM
\ No newline at end of file
+from ConnectorAPI import exportToGEOM
\ No newline at end of file