From: mpv Date: Mon, 31 Mar 2014 10:41:03 +0000 (+0400) Subject: Changing ".hxx" to ".h" headers files extensions X-Git-Tag: V_0.1~43^2~1^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7bc80aeb9d0bf426306a47c247a4af44aac6b5b0;p=modules%2Fshaper.git Changing ".hxx" to ".h" headers files extensions --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a43d598d..68d6a4f2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,4 +12,5 @@ ADD_SUBDIRECTORY (src/Model) ADD_SUBDIRECTORY (src/ModelAPI) ADD_SUBDIRECTORY (src/Config) ADD_SUBDIRECTORY (src/PartSet) +ADD_SUBDIRECTORY (src/PartSetPlugin) ADD_SUBDIRECTORY (src/XGUI) diff --git a/src/Config/Config_FeatureMessage.h b/src/Config/Config_FeatureMessage.h index 1a0f99477..64f2881e6 100644 --- a/src/Config/Config_FeatureMessage.h +++ b/src/Config/Config_FeatureMessage.h @@ -3,7 +3,7 @@ #include "Config.h" -#include +#include #include class CONFIG_EXPORT Config_FeatureMessage: public Event_Message @@ -42,4 +42,4 @@ public: void setWorkbenchId(const std::string& workbenchId); }; -#endif // CONFIG_MESSAGE_H \ No newline at end of file +#endif // CONFIG_MESSAGE_H \ No newline at end of file diff --git a/src/Config/Config_FeatureReader.cpp b/src/Config/Config_FeatureReader.cpp index 03e5f3abd..db68af656 100644 --- a/src/Config/Config_FeatureReader.cpp +++ b/src/Config/Config_FeatureReader.cpp @@ -7,7 +7,7 @@ #include -#include +#include #include #include diff --git a/src/Config/Config_XMLReader.cpp b/src/Config/Config_XMLReader.cpp index e9a31e207..83e883a5f 100644 --- a/src/Config/Config_XMLReader.cpp +++ b/src/Config/Config_XMLReader.cpp @@ -7,7 +7,7 @@ #include -#include +#include #include #include diff --git a/src/Event/CMakeLists.txt b/src/Event/CMakeLists.txt index 70b6b3a6d..4b2c1d86e 100644 --- a/src/Event/CMakeLists.txt +++ b/src/Event/CMakeLists.txt @@ -3,10 +3,10 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11) INCLUDE(Common) SET(PROJECT_HEADERS - Event.hxx - Event_Message.hxx - Event_Listener.hxx - Event_Loop.hxx + Event.h + Event_Message.h + Event_Listener.h + Event_Loop.h ) SET(PROJECT_SOURCES diff --git a/src/Event/Event.h b/src/Event/Event.h new file mode 100644 index 000000000..d99cd0046 --- /dev/null +++ b/src/Event/Event.h @@ -0,0 +1,18 @@ +#ifndef EVENT_H +#define EVENT_H + +#if defined EVENT_EXPORTS +#if defined WIN32 +#define EVENT_EXPORT __declspec( dllexport ) +#else +#define EVENT_EXPORT +#endif +#else +#if defined WIN32 +#define EVENT_EXPORT __declspec( dllimport ) +#else +#define EVENT_EXPORT +#endif +#endif + +#endif diff --git a/src/Event/Event.hxx b/src/Event/Event.hxx deleted file mode 100644 index d99cd0046..000000000 --- a/src/Event/Event.hxx +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef EVENT_H -#define EVENT_H - -#if defined EVENT_EXPORTS -#if defined WIN32 -#define EVENT_EXPORT __declspec( dllexport ) -#else -#define EVENT_EXPORT -#endif -#else -#if defined WIN32 -#define EVENT_EXPORT __declspec( dllimport ) -#else -#define EVENT_EXPORT -#endif -#endif - -#endif diff --git a/src/Event/Event_Listener.cxx b/src/Event/Event_Listener.cxx index 633dd4ad8..ffb56c7b6 100644 --- a/src/Event/Event_Listener.cxx +++ b/src/Event/Event_Listener.cxx @@ -2,4 +2,4 @@ // Created: Thu Mar 13 2014 // Author: Mikhail PONIKAROV -#include +#include diff --git a/src/Event/Event_Listener.h b/src/Event/Event_Listener.h new file mode 100644 index 000000000..80719d42d --- /dev/null +++ b/src/Event/Event_Listener.h @@ -0,0 +1,25 @@ +// File: Event_Listener.hxx +// Created: Thu Mar 13 2014 +// Author: Mikhail PONIKAROV + +#ifndef Event_Listener_HeaderFile +#define Event_Listener_HeaderFile + +#include +class Event_Message; + +/**\class Event_Listener + * \ingroup EventLoop + * \brief Base interface for any event listener. + * + * If some object wants to listen some events it must inherit + * this class and register in the Loop. + */ +class EVENT_EXPORT Event_Listener { + +public: + //! This method is called by loop when the event is started to process. + virtual void ProcessEvent(const Event_Message* theMessage) = 0; +}; + +#endif diff --git a/src/Event/Event_Listener.hxx b/src/Event/Event_Listener.hxx deleted file mode 100644 index 87bf0464a..000000000 --- a/src/Event/Event_Listener.hxx +++ /dev/null @@ -1,26 +0,0 @@ -// File: Event_Listener.hxx -// Created: Thu Mar 13 2014 -// Author: Mikhail PONIKAROV - -#ifndef Event_Listener_HeaderFile -#define Event_Listener_HeaderFile - -#include -class Event_Message; - -/**\class Event_Listener - * \ingroup EventLoop - * \brief Base interface for any event listener. - * - * If some object wants to listen some events it must inherit - * this class and register in the Loop. - */ -class EVENT_EXPORT Event_Listener -{ - -public: - //! This method is called by loop when the event is started to process. - virtual void ProcessEvent(const Event_Message* theMessage) = 0; -}; - -#endif diff --git a/src/Event/Event_Loop.cxx b/src/Event/Event_Loop.cxx index 558edd0da..ffcd6c6e5 100644 --- a/src/Event/Event_Loop.cxx +++ b/src/Event/Event_Loop.cxx @@ -2,7 +2,7 @@ // Created: Thu Mar 13 2014 // Author: Mikhail PONIKAROV -#include +#include #include using namespace std; diff --git a/src/Event/Event_Loop.h b/src/Event/Event_Loop.h new file mode 100644 index 000000000..d93b942eb --- /dev/null +++ b/src/Event/Event_Loop.h @@ -0,0 +1,46 @@ +// File: Event_Loop.hxx +// Created: Thu Mar 13 2014 +// Author: Mikhail PONIKAROV + +#ifndef Event_Loop_HeaderFile +#define Event_Loop_HeaderFile + +#include +#include + +#include +#include + +/**\class Event_Lopp + * \ingroup EventLoop + * \brief Base class that manages the receiving and sending of all + * not Qt-events in the application. + * + * One per application, initialized on start. Listeners must register in this loop + * to get events, called by senders. Sending of events is very fast (just adding to container). + * Performing of events is processed in separated thread, so, sender takes + * control back immideately. + */ +class Event_Loop { + std::map > > + myListeners; ///< map from event ID to sender pointer to listeners that must be called for this + + //! The empty constructor, will be called at startup of the application, only once + Event_Loop() {}; +public: + ///! Returns the main object of the loop, one per application. + EVENT_EXPORT static Event_Loop* Loop(); + //! Returns the unique event by the given name. Call this method only on initialization of object + //! to speedup the events processing without parsing of the string. + EVENT_EXPORT static Event_ID EventByName(const char* theName); + + //! Allows to send an event + EVENT_EXPORT void Send(Event_Message& theMessage); + + //! Registers (or adds if such listener is already registered) a listener + //! that will be called on the event and from the defined sender + EVENT_EXPORT void RegisterListener(Event_Listener* theListener, const Event_ID theID, + void* theSender = 0); +}; + +#endif diff --git a/src/Event/Event_Loop.hxx b/src/Event/Event_Loop.hxx deleted file mode 100644 index d50e6633f..000000000 --- a/src/Event/Event_Loop.hxx +++ /dev/null @@ -1,49 +0,0 @@ -// File: Event_Loop.hxx -// Created: Thu Mar 13 2014 -// Author: Mikhail PONIKAROV - -#ifndef Event_Loop_HeaderFile -#define Event_Loop_HeaderFile - -#include -#include - -#include -#include - -/**\class Event_Lopp - * \ingroup EventLoop - * \brief Base class that manages the receiving and sending of all - * not Qt-events in the application. - * - * One per application, initialized on start. Listeners must register in this loop - * to get events, called by senders. Sending of events is very fast (just adding to container). - * Performing of events is processed in separated thread, so, sender takes - * control back immideately. - */ -class Event_Loop -{ - std::map > > myListeners; ///< map from event ID to sender pointer to listeners that must be called for this - - //! The empty constructor, will be called at startup of the application, only once - Event_Loop() - { - } - ; -public: - ///! Returns the main object of the loop, one per application. - EVENT_EXPORT static Event_Loop* Loop(); - //! Returns the unique event by the given name. Call this method only on initialization of object - //! to speedup the events processing without parsing of the string. - EVENT_EXPORT static Event_ID EventByName(const char* theName); - - //! Allows to send an event - EVENT_EXPORT void Send(Event_Message& theMessage); - - //! Registers (or adds if such listener is already registered) a listener - //! that will be called on the event and from the defined sender - EVENT_EXPORT void RegisterListener(Event_Listener* theListener, const Event_ID theID, - void* theSender = 0); -}; - -#endif diff --git a/src/Event/Event_Message.cxx b/src/Event/Event_Message.cxx index 96097b409..ecf88a1e8 100644 --- a/src/Event/Event_Message.cxx +++ b/src/Event/Event_Message.cxx @@ -2,7 +2,7 @@ // Created: Thu Mar 13 2014 // Author: Mikhail PONIKAROV -#include +#include Event_Message::Event_Message(const Event_ID theID, const void* theSender) : myEventId(theID), mySender((void*) theSender) diff --git a/src/Event/Event_Message.h b/src/Event/Event_Message.h new file mode 100644 index 000000000..27608b7bf --- /dev/null +++ b/src/Event/Event_Message.h @@ -0,0 +1,55 @@ +// File: Event_Message.hxx +// Created: Thu Mar 13 2014 +// Author: Mikhail PONIKAROV + +#ifndef Event_Message_HeaderFile +#define Event_Message_HeaderFile + +#include + +/**\class Event_ID + * \ingroup EventLoop + * \brief Identifier of the event kind. + * + * Each event ID is created in main Envent_Loop class + * that stores correspondance between the string-name of the + * identifier and the pointer to the static string that is really + * used as an identifier (this is usefull for debugging of the events + * with log files and in debugger). + */ +class EVENT_EXPORT Event_ID { + char* myID; ///< pointer to the text-identifier of the event, unique pointer for all events of such type + + Event_ID(char* theID) {myID = theID;} + + friend class Event_Loop; +public: + /// Returns the text-identifier of the event (for debugging reasons) + char* EventText() const {return myID;} + /// Allows to compare identifiers + bool operator==(const Event_ID& theID) const {return myID == theID.myID;} +}; + +/**\class Event_Message + * \ingroup EventLoop + * \brief Message for communication between sender and listener of event. + * Normally it is inherited by the higher-level + */ +class EVENT_EXPORT Event_Message { + Event_ID myEventId; ///< identifier of the event + void* mySender; ///< the sender object + +public: + + //! Creates the message + Event_Message(const Event_ID theID, const void* theSender = 0); + virtual ~Event_Message() {} + + //! Returns identifier of the message + const Event_ID& EventID() const {return myEventId;} + + //! Returns sender of the message or NULL if it is anonymous message + void* Sender() {return mySender;} +}; + +#endif diff --git a/src/Event/Event_Message.hxx b/src/Event/Event_Message.hxx deleted file mode 100644 index 66346be3a..000000000 --- a/src/Event/Event_Message.hxx +++ /dev/null @@ -1,74 +0,0 @@ -// File: Event_Message.hxx -// Created: Thu Mar 13 2014 -// Author: Mikhail PONIKAROV - -#ifndef Event_Message_HeaderFile -#define Event_Message_HeaderFile - -#include - -/**\class Event_ID - * \ingroup EventLoop - * \brief Identifier of the event kind. - * - * Each event ID is created in main Envent_Loop class - * that stores correspondance between the string-name of the - * identifier and the pointer to the static string that is really - * used as an identifier (this is usefull for debugging of the events - * with log files and in debugger). - */ -class EVENT_EXPORT Event_ID -{ - char* myID; ///< pointer to the text-identifier of the event, unique pointer for all events of such type - - Event_ID(char* theID) - { - myID = theID; - } - - friend class Event_Loop; -public: - /// Returns the text-identifier of the event (for debugging reasons) - char* EventText() const - { - return myID; - } - /// Allows to compare identifiers - bool operator==(const Event_ID& theID) const - { - return myID == theID.myID; - } -}; - -/**\class Event_Message - * \ingroup EventLoop - * \brief Message for communication between sender and listener of event. - * Normally it is inherited by the higher-level - */ -class EVENT_EXPORT Event_Message -{ - Event_ID myEventId; ///< identifier of the event - void* mySender; ///< the sender object - -public: - - //! Creates the message - Event_Message(const Event_ID theID, const void* theSender = 0); - virtual ~Event_Message() - { - } - - //! Returns identifier of the message - const Event_ID& EventID() const - { - return myEventId; - } - - //! Returns sender of the message or NULL if it is anonymous message - void* Sender() - { - return mySender; - } -}; - -#endif diff --git a/src/Model/CMakeLists.txt b/src/Model/CMakeLists.txt index c7d2585c2..42ee4f4c6 100644 --- a/src/Model/CMakeLists.txt +++ b/src/Model/CMakeLists.txt @@ -5,10 +5,10 @@ INCLUDE(FindCAS) INCLUDE(FindBoost) SET(PROJECT_HEADERS - Model.hxx - Model_Document.hxx - Model_PluginManager.hxx - Model_Feature.hxx + Model.h + Model_Document.h + Model_PluginManager.h + Model_Feature.h ) SET(PROJECT_SOURCES diff --git a/src/Model/Model.h b/src/Model/Model.h new file mode 100644 index 000000000..b7bf7f206 --- /dev/null +++ b/src/Model/Model.h @@ -0,0 +1,18 @@ +#ifndef MODEL_H +#define MODEL_H + +#if defined MODEL_EXPORTS +#if defined WIN32 +#define MODEL_EXPORT __declspec( dllexport ) +#else +#define MODEL_EXPORT +#endif +#else +#if defined WIN32 +#define MODEL_EXPORT __declspec( dllimport ) +#else +#define MODEL_EXPORT +#endif +#endif + +#endif diff --git a/src/Model/Model.hxx b/src/Model/Model.hxx deleted file mode 100644 index b7bf7f206..000000000 --- a/src/Model/Model.hxx +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef MODEL_H -#define MODEL_H - -#if defined MODEL_EXPORTS -#if defined WIN32 -#define MODEL_EXPORT __declspec( dllexport ) -#else -#define MODEL_EXPORT -#endif -#else -#if defined WIN32 -#define MODEL_EXPORT __declspec( dllimport ) -#else -#define MODEL_EXPORT -#endif -#endif - -#endif diff --git a/src/Model/Model_Application.h b/src/Model/Model_Application.h new file mode 100644 index 000000000..77d669257 --- /dev/null +++ b/src/Model/Model_Application.h @@ -0,0 +1,53 @@ +// File: Model_Application.hxx +// Created: 28 Dec 2011 +// Author: Mikhail PONIKAROV +// Copyright: CEA 2011 + +#ifndef Model_Application_HeaderFile +#define Model_Application_HeaderFile + +#include +#include +#include + +// Define handle class +DEFINE_STANDARD_HANDLE(Model_Application, TDocStd_Application) + +/**\class Model_Application + * \ingroup DataModel + * \brief Realization of Open CASCADE application abstraction. Class for internal use only. + * Application supports the formats and document management. It is uses OCAF-lke + * architecture and just implements specific features of the module. + */ +class Model_Application: public TDocStd_Application, public ModelAPI_Application +{ +public: + // useful methods inside of the module + + // CASCADE RTTI + DEFINE_STANDARD_RTTI(Model_Application) + ; + + //! Retuns the application: one per process + MODEL_EXPORT static Handle_Model_Application GetApplication(); + //! Returns the main document (on first call creates it) + MODEL_EXPORT ModelAPI_Document* GetMainDocument(); + +public: + // Redefined OCAF methods + //! Return name of resource (i.e. "Standard") + Standard_CString ResourcesName(); + //! Return format (i.e "MDTV-Standard") + //! \param theFormats sequence of allowed formats for input/output + virtual void Formats(TColStd_SequenceOfExtendedString& theFormats); + //! Constructor + //! Use method GetInstance() method to obtain + //! the static instance of the object (or derive your own application) + Model_Application(); + +private: + + Handle_Model_Document myMainDoc; ///< main document of an application +}; + +#endif diff --git a/src/Model/Model_Application.hxx b/src/Model/Model_Application.hxx deleted file mode 100644 index 77d669257..000000000 --- a/src/Model/Model_Application.hxx +++ /dev/null @@ -1,53 +0,0 @@ -// File: Model_Application.hxx -// Created: 28 Dec 2011 -// Author: Mikhail PONIKAROV -// Copyright: CEA 2011 - -#ifndef Model_Application_HeaderFile -#define Model_Application_HeaderFile - -#include -#include -#include - -// Define handle class -DEFINE_STANDARD_HANDLE(Model_Application, TDocStd_Application) - -/**\class Model_Application - * \ingroup DataModel - * \brief Realization of Open CASCADE application abstraction. Class for internal use only. - * Application supports the formats and document management. It is uses OCAF-lke - * architecture and just implements specific features of the module. - */ -class Model_Application: public TDocStd_Application, public ModelAPI_Application -{ -public: - // useful methods inside of the module - - // CASCADE RTTI - DEFINE_STANDARD_RTTI(Model_Application) - ; - - //! Retuns the application: one per process - MODEL_EXPORT static Handle_Model_Application GetApplication(); - //! Returns the main document (on first call creates it) - MODEL_EXPORT ModelAPI_Document* GetMainDocument(); - -public: - // Redefined OCAF methods - //! Return name of resource (i.e. "Standard") - Standard_CString ResourcesName(); - //! Return format (i.e "MDTV-Standard") - //! \param theFormats sequence of allowed formats for input/output - virtual void Formats(TColStd_SequenceOfExtendedString& theFormats); - //! Constructor - //! Use method GetInstance() method to obtain - //! the static instance of the object (or derive your own application) - Model_Application(); - -private: - - Handle_Model_Document myMainDoc; ///< main document of an application -}; - -#endif diff --git a/src/Model/Model_Document.cxx b/src/Model/Model_Document.cxx index ed000dea6..dd34e598b 100644 --- a/src/Model/Model_Document.cxx +++ b/src/Model/Model_Document.cxx @@ -3,7 +3,7 @@ // Author: Mikhail PONIKAROV // Copyright: CEA 2011 -#include +#include #include diff --git a/src/Model/Model_Document.h b/src/Model/Model_Document.h new file mode 100644 index 000000000..bdd5d8e0c --- /dev/null +++ b/src/Model/Model_Document.h @@ -0,0 +1,79 @@ +// File: Model_Document.hxx +// Created: 28 Dec 2011 +// Author: Mikhail PONIKAROV +// Copyright: CEA 2011 + +#ifndef Model_Document_HeaderFile +#define Model_Document_HeaderFile + +#include +#include +#include + +class Handle_Model_Document; + +/**\class Model_Document + * \ingroup DataModel + * \brief Document for internal data structure of any object storage. Corresponds to the SALOME study. + * Document contains all data of te SALOME Study specific to this module + * that must be written into the HDF file. + * Also it provides acces to this data: open/save, transactions management etc. + * to provide access to all stored data. + */ + +class Model_Document: public TDocStd_Document, public ModelAPI_Document +{ +public: + + DEFINE_STANDARD_RTTI(Model_Document) + ; + + //! Creates new document by the format string of a storage + Model_Document(const TCollection_ExtendedString& theStorageFormat); + //! Deletes all high-level data, managed this document + ~Model_Document(); + + //! Loads the OCAF document from the file. + //! \param theFileName full name of the file to load + //! \param theStudyID identifier of the SALOME study to associate with loaded file + //! \returns true if file was loaded successfully + MODEL_EXPORT bool Load(const char* theFileName); + + //! Saves the OCAF document to the file. + //! \param theFileName full name of the file to store + //! \returns true if file was stored successfully + MODEL_EXPORT bool Save(const char* theFileName); + + //! Removes document data + MODEL_EXPORT void Close(); + + //! Starts a new operation (opens a tansaction) + MODEL_EXPORT void StartOperation(); + //! Finishes the previously started operation (closes the transaction) + MODEL_EXPORT void FinishOperation(); + //! Aborts the operation + MODEL_EXPORT void AbortOperation(); + //! Returns true if operation has been started, but not yet finished or aborted + MODEL_EXPORT bool IsOperation(); + //! Returns true if document was modified (since creation/opening) + MODEL_EXPORT bool IsModified(); + + //! Returns True if there are available Undos + MODEL_EXPORT bool CanUndo(); + //! Undoes last operation + MODEL_EXPORT void Undo(); + //! Returns True if there are available Redos + MODEL_EXPORT bool CanRedo(); + //! Redoes last operation + MODEL_EXPORT void Redo(); + +protected: + +private: + int myTransactionsAfterSave; ///< number of transactions after the last "save" call, used for "IsModified" method +}; + +// Define handle class +DEFINE_STANDARD_HANDLE(Model_Document, TDocStd_Document) + +#endif diff --git a/src/Model/Model_Document.hxx b/src/Model/Model_Document.hxx deleted file mode 100644 index 9a0235f97..000000000 --- a/src/Model/Model_Document.hxx +++ /dev/null @@ -1,79 +0,0 @@ -// File: Model_Document.hxx -// Created: 28 Dec 2011 -// Author: Mikhail PONIKAROV -// Copyright: CEA 2011 - -#ifndef Model_Document_HeaderFile -#define Model_Document_HeaderFile - -#include -#include -#include - -class Handle_Model_Document; - -/**\class Model_Document - * \ingroup DataModel - * \brief Document for internal data structure of any object storage. Corresponds to the SALOME study. - * Document contains all data of te SALOME Study specific to this module - * that must be written into the HDF file. - * Also it provides acces to this data: open/save, transactions management etc. - * to provide access to all stored data. - */ - -class Model_Document: public TDocStd_Document, public ModelAPI_Document -{ -public: - - DEFINE_STANDARD_RTTI(Model_Document) - ; - - //! Creates new document by the format string of a storage - Model_Document(const TCollection_ExtendedString& theStorageFormat); - //! Deletes all high-level data, managed this document - ~Model_Document(); - - //! Loads the OCAF document from the file. - //! \param theFileName full name of the file to load - //! \param theStudyID identifier of the SALOME study to associate with loaded file - //! \returns true if file was loaded successfully - MODEL_EXPORT bool Load(const char* theFileName); - - //! Saves the OCAF document to the file. - //! \param theFileName full name of the file to store - //! \returns true if file was stored successfully - MODEL_EXPORT bool Save(const char* theFileName); - - //! Removes document data - MODEL_EXPORT void Close(); - - //! Starts a new operation (opens a tansaction) - MODEL_EXPORT void StartOperation(); - //! Finishes the previously started operation (closes the transaction) - MODEL_EXPORT void FinishOperation(); - //! Aborts the operation - MODEL_EXPORT void AbortOperation(); - //! Returns true if operation has been started, but not yet finished or aborted - MODEL_EXPORT bool IsOperation(); - //! Returns true if document was modified (since creation/opening) - MODEL_EXPORT bool IsModified(); - - //! Returns True if there are available Undos - MODEL_EXPORT bool CanUndo(); - //! Undoes last operation - MODEL_EXPORT void Undo(); - //! Returns True if there are available Redos - MODEL_EXPORT bool CanRedo(); - //! Redoes last operation - MODEL_EXPORT void Redo(); - -protected: - -private: - int myTransactionsAfterSave; ///< number of transactions after the last "save" call, used for "IsModified" method -}; - -// Define handle class -DEFINE_STANDARD_HANDLE(Model_Document, TDocStd_Document) - -#endif diff --git a/src/Model/Model_Feature.cxx b/src/Model/Model_Feature.cxx index 379beb456..0ff283892 100644 --- a/src/Model/Model_Feature.cxx +++ b/src/Model/Model_Feature.cxx @@ -2,7 +2,7 @@ // Created: 21 Mar 2014 // Author: Mikhail PONIKAROV -#include +#include using namespace std; diff --git a/src/Model/Model_Feature.h b/src/Model/Model_Feature.h new file mode 100644 index 000000000..0b51f725f --- /dev/null +++ b/src/Model/Model_Feature.h @@ -0,0 +1,27 @@ +// File: Model_Feature.hxx +// Created: 21 Mar 2014 +// Author: Mikhail PONIKAROV + +#ifndef Model_Feature_HeaderFile +#define Model_Feature_HeaderFile + +#include "Model.h" +#include + +/**\class Model_Feature + * \ingroup DataModel + * \brief General object of the application that allows + * to get/set attributes from the document and compute result of an operation. + */ + +class Model_Feature: public ModelAPI_Feature +{ + Model_Feature(); + + friend class Model_PluginManager; +public: + /// Returns the kind of a feature (like "Point") + virtual std::string GetKind(); +}; + +#endif diff --git a/src/Model/Model_Feature.hxx b/src/Model/Model_Feature.hxx deleted file mode 100644 index fa632f183..000000000 --- a/src/Model/Model_Feature.hxx +++ /dev/null @@ -1,27 +0,0 @@ -// File: Model_Feature.hxx -// Created: 21 Mar 2014 -// Author: Mikhail PONIKAROV - -#ifndef Model_Feature_HeaderFile -#define Model_Feature_HeaderFile - -#include "Model.hxx" -#include - -/**\class Model_Feature - * \ingroup DataModel - * \brief General object of the application that allows - * to get/set attributes from the document and compute result of an operation. - */ - -class Model_Feature: public ModelAPI_Feature -{ - Model_Feature(); - - friend class Model_PluginManager; -public: - /// Returns the kind of a feature (like "Point") - virtual std::string GetKind(); -}; - -#endif diff --git a/src/Model/Model_PluginManager.cxx b/src/Model/Model_PluginManager.cxx index f84205c7d..e06c66518 100644 --- a/src/Model/Model_PluginManager.cxx +++ b/src/Model/Model_PluginManager.cxx @@ -2,25 +2,47 @@ // Created: 20 Mar 2014 // Author: Mikhail PONIKAROV -#include -#include -#include -#include +#include +#include +#include +#include #include +#include + +#include using namespace std; +static Model_PluginManager* myImpl = new Model_PluginManager(); + boost::shared_ptr Model_PluginManager::CreateFeature(string theFeatureID) { - return boost::shared_ptr(new Model_Feature()); + if (this != myImpl) return myImpl->CreateFeature(theFeatureID); + + LoadPluginsInfo(); + if (myPlugins.find(theFeatureID) != myPlugins.end()) { + string aLibName = myPlugins[theFeatureID]; +#ifdef WIN32 + aLibName += ".dll"; +#else + aLibName += ".so"; +#endif + Standard_CString aLibNameCStr = aLibName.c_str(); + OSD_SharedLibrary aLib(aLibNameCStr); + if (aLib.DlOpen(OSD_RTLD_NOW)) { + OSD_Function aFunc = aLib.DlSymb("CreateFeature"); + } + } + + return boost::shared_ptr(); // return nothing } Model_PluginManager::Model_PluginManager() { + myPluginsInfoLoaded = false; static Event_ID aFeatureEvent = Event_Loop::EventByName("Feature"); - static Model_PluginManager* myImpl = new Model_PluginManager(); - ModelAPI_PluginManager::SetPluginManager(boost::shared_ptr(myImpl)); + ModelAPI_PluginManager::SetPluginManager(boost::shared_ptr(this)); // register the configuration reading listener Event_Loop* aLoop = Event_Loop::Loop(); aLoop->RegisterListener(myImpl, aFeatureEvent); @@ -28,8 +50,25 @@ Model_PluginManager::Model_PluginManager() void Model_PluginManager::ProcessEvent(const Event_Message* theMessage) { - const Config_FeatureMessage* aMsg = dynamic_cast(theMessage); + const Config_FeatureMessage* aMsg = + dynamic_cast( theMessage ); if (aMsg) { // proccess the plugin info, load plugin + if (myPlugins.find(aMsg->id()) == myPlugins.end()) { + myPlugins[aMsg->id()] = "PartSetPlugin"; // TO DO: plugin name must be also imported from XMLs + } } + // plugins information was started to load, so, it will be loaded + myPluginsInfoLoaded = true; +} + +void Model_PluginManager::LoadPluginsInfo() +{ + if (myPluginsInfoLoaded) // nothing to do + return; + + // Read plugins information from XML files + Config_ModuleReader aXMLReader; + aXMLReader.setAutoImport(true); + aXMLReader.readAll(); } diff --git a/src/Model/Model_PluginManager.h b/src/Model/Model_PluginManager.h new file mode 100644 index 000000000..44dbef3b5 --- /dev/null +++ b/src/Model/Model_PluginManager.h @@ -0,0 +1,39 @@ +// File: Model_PluginManager.hxx +// Created: 20 Mar 2014 +// Author: Mikhail PONIKAROV + +#ifndef Model_PluginManager_HeaderFile +#define Model_PluginManager_HeaderFile + +#include "Model.h" +#include +#include +#include + +/**\class Model_PluginManager + * \ingroup DataModel + * \brief Object that knows (from the initial XML file) which + * plugin contains which feature, loads and stores reference to loaded plugins by + * the feature functionality request. + */ + +class Model_PluginManager : public ModelAPI_PluginManager, public Event_Listener +{ + bool myPluginsInfoLoaded; ///< it true if plugins information is loaded + std::map myPlugins; ///< map of feature IDs to plugin name +public: + /// Creates the feature object using plugins functionality + MODEL_EXPORT virtual boost::shared_ptr CreateFeature(std::string theFeatureID); + + /// Processes the configuration file reading + MODEL_EXPORT virtual void ProcessEvent(const Event_Message* theMessage); + + /// Is called only once, on startup of the application + Model_PluginManager(); + +private: + /// Loads (if not done yet) the information about the features and plugins + void LoadPluginsInfo(); +}; + +#endif diff --git a/src/Model/Model_PluginManager.hxx b/src/Model/Model_PluginManager.hxx deleted file mode 100644 index b41ee74e8..000000000 --- a/src/Model/Model_PluginManager.hxx +++ /dev/null @@ -1,33 +0,0 @@ -// File: Model_PluginManager.hxx -// Created: 20 Mar 2014 -// Author: Mikhail PONIKAROV - -#ifndef Model_PluginManager_HeaderFile -#define Model_PluginManager_HeaderFile - -#include "Model.hxx" -#include -#include - -/**\class Model_PluginManager - * \ingroup DataModel - * \brief Object that knows (from the initial XML file) which - * plugin contains which feature, loads and stores reference to loaded plugins by - * the feature functionality request. - */ - -class MODEL_EXPORT Model_PluginManager: public ModelAPI_PluginManager, public Event_Listener -{ -public: - /// Creates the feature object using plugins functionality - virtual boost::shared_ptr CreateFeature(std::string theFeatureID); - - /// Processes the configuration file reading - virtual void ProcessEvent(const Event_Message* theMessage); - -private: - /// Is called only once, on startup of the application - Model_PluginManager(); -}; - -#endif diff --git a/src/ModelAPI/CMakeLists.txt b/src/ModelAPI/CMakeLists.txt index e45b8eece..399d32f8b 100644 --- a/src/ModelAPI/CMakeLists.txt +++ b/src/ModelAPI/CMakeLists.txt @@ -8,11 +8,11 @@ INCLUDE(FindBoost) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) SET(PROJECT_HEADERS - ModelAPI.hxx - ModelAPI_Interface.hxx - ModelAPI_PluginManager.hxx - ModelAPI_Feature.hxx - ModelAPI_Document.hxx + ModelAPI.h + ModelAPI_Interface.h + ModelAPI_PluginManager.h + ModelAPI_Feature.h + ModelAPI_Document.h ) SET(PROJECT_SOURCES diff --git a/src/ModelAPI/ModelAPI.h b/src/ModelAPI/ModelAPI.h new file mode 100644 index 000000000..b9e811215 --- /dev/null +++ b/src/ModelAPI/ModelAPI.h @@ -0,0 +1,18 @@ +#ifndef MODELAPI_H +#define MODELAPI_H + +#if defined MODELAPI_EXPORTS +#if defined WIN32 +#define MODELAPI_EXPORT __declspec( dllexport ) +#else +#define MODELAPI_EXPORT +#endif +#else +#if defined WIN32 +#define MODELAPI_EXPORT __declspec( dllimport ) +#else +#define MODELAPI_EXPORT +#endif +#endif + +#endif diff --git a/src/ModelAPI/ModelAPI.hxx b/src/ModelAPI/ModelAPI.hxx deleted file mode 100644 index b9e811215..000000000 --- a/src/ModelAPI/ModelAPI.hxx +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef MODELAPI_H -#define MODELAPI_H - -#if defined MODELAPI_EXPORTS -#if defined WIN32 -#define MODELAPI_EXPORT __declspec( dllexport ) -#else -#define MODELAPI_EXPORT -#endif -#else -#if defined WIN32 -#define MODELAPI_EXPORT __declspec( dllimport ) -#else -#define MODELAPI_EXPORT -#endif -#endif - -#endif diff --git a/src/ModelAPI/ModelAPI.i b/src/ModelAPI/ModelAPI.i index 1f63f6c29..6deac8560 100644 --- a/src/ModelAPI/ModelAPI.i +++ b/src/ModelAPI/ModelAPI.i @@ -1,10 +1,10 @@ /* ModelAPI.i */ %module ModelAPI %{ - #include "ModelAPI.hxx" - #include "ModelAPI_Document.hxx" - #include "ModelAPI_PluginManager.hxx" - #include "ModelAPI_Feature.hxx" + #include "ModelAPI.h" + #include "ModelAPI_Document.h" + #include "ModelAPI_PluginManager.h" + #include "ModelAPI_Feature.h" %} // to avoid error on this @@ -20,6 +20,6 @@ %shared_ptr(ModelAPI_Feature) // all supported interfaces -%include "ModelAPI_Document.hxx" -%include "ModelAPI_PluginManager.hxx" -%include "ModelAPI_Feature.hxx" +%include "ModelAPI_Document.h" +%include "ModelAPI_PluginManager.h" +%include "ModelAPI_Feature.h" diff --git a/src/ModelAPI/ModelAPI_Document.h b/src/ModelAPI/ModelAPI_Document.h new file mode 100644 index 000000000..e2941745d --- /dev/null +++ b/src/ModelAPI/ModelAPI_Document.h @@ -0,0 +1,65 @@ +// File: Model_Document.hxx +// Created: 28 Dec 2011 +// Author: Mikhail PONIKAROV +// Copyright: CEA 2011 + +#ifndef ModelAPI_Document_HeaderFile +#define ModelAPI_Document_HeaderFile + +#include + +/**\class Model_Document + * \ingroup DataModel + * \brief Document for internal data structure of any object storage. Corresponds to the SALOME study. + * Document contains all data of te SALOME Study specific to this module + * that must be written into the HDF file. + * Also it provides acces to this data: open/save, transactions management etc. + * to provide access to all stored data. + */ + +class ModelAPI_Document +{ +public: + + //! Loads the OCAF document from the file. + //! \param theFileName full name of the file to load + //! \param theStudyID identifier of the SALOME study to associate with loaded file + //! \returns true if file was loaded successfully + MODELAPI_EXPORT virtual bool Load(const char* theFileName) = 0; + + //! Saves the OCAF document to the file. + //! \param theFileName full name of the file to store + //! \returns true if file was stored successfully + MODELAPI_EXPORT virtual bool Save(const char* theFileName) = 0; + + //! Removes document data + MODELAPI_EXPORT virtual void Close() = 0; + + //! Starts a new operation (opens a tansaction) + MODELAPI_EXPORT virtual void StartOperation() = 0; + //! Finishes the previously started operation (closes the transaction) + MODELAPI_EXPORT virtual void FinishOperation() = 0; + //! Aborts the operation + MODELAPI_EXPORT virtual void AbortOperation() = 0; + //! Returns true if operation has been started, but not yet finished or aborted + MODELAPI_EXPORT virtual bool IsOperation() = 0; + //! Returns true if document was modified (since creation/opening) + MODELAPI_EXPORT virtual bool IsModified() = 0; + + //! Returns True if there are available Undos + MODELAPI_EXPORT virtual bool CanUndo() = 0; + //! Undoes last operation + MODELAPI_EXPORT virtual void Undo() = 0; + //! Returns True if there are available Redos + MODELAPI_EXPORT virtual bool CanRedo() = 0; + //! Redoes last operation + MODELAPI_EXPORT virtual void Redo() = 0; + + /// Only for SWIG wrapping it is here + MODELAPI_EXPORT ModelAPI_Document() + { + } + ; +}; + +#endif diff --git a/src/ModelAPI/ModelAPI_Document.hxx b/src/ModelAPI/ModelAPI_Document.hxx deleted file mode 100644 index 5232771a5..000000000 --- a/src/ModelAPI/ModelAPI_Document.hxx +++ /dev/null @@ -1,65 +0,0 @@ -// File: Model_Document.hxx -// Created: 28 Dec 2011 -// Author: Mikhail PONIKAROV -// Copyright: CEA 2011 - -#ifndef ModelAPI_Document_HeaderFile -#define ModelAPI_Document_HeaderFile - -#include - -/**\class Model_Document - * \ingroup DataModel - * \brief Document for internal data structure of any object storage. Corresponds to the SALOME study. - * Document contains all data of te SALOME Study specific to this module - * that must be written into the HDF file. - * Also it provides acces to this data: open/save, transactions management etc. - * to provide access to all stored data. - */ - -class ModelAPI_Document -{ -public: - - //! Loads the OCAF document from the file. - //! \param theFileName full name of the file to load - //! \param theStudyID identifier of the SALOME study to associate with loaded file - //! \returns true if file was loaded successfully - MODELAPI_EXPORT virtual bool Load(const char* theFileName) = 0; - - //! Saves the OCAF document to the file. - //! \param theFileName full name of the file to store - //! \returns true if file was stored successfully - MODELAPI_EXPORT virtual bool Save(const char* theFileName) = 0; - - //! Removes document data - MODELAPI_EXPORT virtual void Close() = 0; - - //! Starts a new operation (opens a tansaction) - MODELAPI_EXPORT virtual void StartOperation() = 0; - //! Finishes the previously started operation (closes the transaction) - MODELAPI_EXPORT virtual void FinishOperation() = 0; - //! Aborts the operation - MODELAPI_EXPORT virtual void AbortOperation() = 0; - //! Returns true if operation has been started, but not yet finished or aborted - MODELAPI_EXPORT virtual bool IsOperation() = 0; - //! Returns true if document was modified (since creation/opening) - MODELAPI_EXPORT virtual bool IsModified() = 0; - - //! Returns True if there are available Undos - MODELAPI_EXPORT virtual bool CanUndo() = 0; - //! Undoes last operation - MODELAPI_EXPORT virtual void Undo() = 0; - //! Returns True if there are available Redos - MODELAPI_EXPORT virtual bool CanRedo() = 0; - //! Redoes last operation - MODELAPI_EXPORT virtual void Redo() = 0; - - /// Only for SWIG wrapping it is here - MODELAPI_EXPORT ModelAPI_Document() - { - } - ; -}; - -#endif diff --git a/src/ModelAPI/ModelAPI_Feature.h b/src/ModelAPI/ModelAPI_Feature.h new file mode 100644 index 000000000..ffa5448c4 --- /dev/null +++ b/src/ModelAPI/ModelAPI_Feature.h @@ -0,0 +1,32 @@ +// File: ModelAPI_Feature.hxx +// Created: 21 Mar 2014 +// Author: Mikhail PONIKAROV + +#ifndef ModelAPI_Feature_HeaderFile +#define ModelAPI_Feature_HeaderFile + +#include "ModelAPI.h" +#include + +class ModelAPI_Feature; + +/**\class ModelAPI_Feature + * \ingroup DataModel + * \brief General object of the application that allows + * to get/set attributes from the document and compute result of an operation. + */ + +class MODELAPI_EXPORT ModelAPI_Feature +{ +public: + /// Returns the kind of a feature (like "Point") + virtual std::string GetKind() = 0; + + /// Use plugin manager for features creation: this method is + /// defined here only for SWIG-wrapping + ModelAPI_Feature() + { + } +}; + +#endif diff --git a/src/ModelAPI/ModelAPI_Feature.hxx b/src/ModelAPI/ModelAPI_Feature.hxx deleted file mode 100644 index f29a3a73c..000000000 --- a/src/ModelAPI/ModelAPI_Feature.hxx +++ /dev/null @@ -1,32 +0,0 @@ -// File: ModelAPI_Feature.hxx -// Created: 21 Mar 2014 -// Author: Mikhail PONIKAROV - -#ifndef ModelAPI_Feature_HeaderFile -#define ModelAPI_Feature_HeaderFile - -#include "ModelAPI.hxx" -#include - -class ModelAPI_Feature; - -/**\class ModelAPI_Feature - * \ingroup DataModel - * \brief General object of the application that allows - * to get/set attributes from the document and compute result of an operation. - */ - -class MODELAPI_EXPORT ModelAPI_Feature -{ -public: - /// Returns the kind of a feature (like "Point") - virtual std::string GetKind() = 0; - - /// Use plugin manager for features creation: this method is - /// defined here only for SWIG-wrapping - ModelAPI_Feature() - { - } -}; - -#endif diff --git a/src/ModelAPI/ModelAPI_Interface.h b/src/ModelAPI/ModelAPI_Interface.h new file mode 100644 index 000000000..8535be86e --- /dev/null +++ b/src/ModelAPI/ModelAPI_Interface.h @@ -0,0 +1,47 @@ +// File: ModelAPI_Interface.hxx +// Created: 20 Mar 2014 +// Author: Mikhail PONIKAROV + +#ifndef ModelAPI_Interface_HeaderFile +#define ModelAPI_Interface_HeaderFile + +#include + +/**\class ModelAPI_Interface + * \ingroup DataModel + * \brief General base class for all interfaces in this package + */ + +class MODELAPI_EXPORT ModelAPI_Interface +{ + void* myImpl; ///< pointer to the internal implementation object + +public: + /// None - constructor + virtual ModelAPI_Interface() + { + myImpl = 0; + } + + /// Constructor by the implementation pointer (used for internal needs) + virtual ModelAPI_Interface(void* theImpl) + { + myImpl = theImpl; + } + + /// Copy-constructor + virtual ModelAPI_Interface(ModelAPI_Interface& theOrig) + { + myImpl = theOrig.theImpl; + Duplicate(); + } + + virtual ModelAPI_Interface& operator=(ModelAPI_Interface& const theOrig) + { myImpl = theOrig.theImpl; Duplicate(); return *this;} + + /// Duplicates the objet pointed by myImpl (loosing the old one) + virtual void Duplicate() = 0; + +}; + +#endif diff --git a/src/ModelAPI/ModelAPI_Interface.hxx b/src/ModelAPI/ModelAPI_Interface.hxx deleted file mode 100644 index 6fdb28dbc..000000000 --- a/src/ModelAPI/ModelAPI_Interface.hxx +++ /dev/null @@ -1,47 +0,0 @@ -// File: ModelAPI_Interface.hxx -// Created: 20 Mar 2014 -// Author: Mikhail PONIKAROV - -#ifndef ModelAPI_Interface_HeaderFile -#define ModelAPI_Interface_HeaderFile - -#include - -/**\class ModelAPI_Interface - * \ingroup DataModel - * \brief General base class for all interfaces in this package - */ - -class MODELAPI_EXPORT ModelAPI_Interface -{ - void* myImpl; ///< pointer to the internal implementation object - -public: - /// None - constructor - virtual ModelAPI_Interface() - { - myImpl = 0; - } - - /// Constructor by the implementation pointer (used for internal needs) - virtual ModelAPI_Interface(void* theImpl) - { - myImpl = theImpl; - } - - /// Copy-constructor - virtual ModelAPI_Interface(ModelAPI_Interface& theOrig) - { - myImpl = theOrig.theImpl; - Duplicate(); - } - - virtual ModelAPI_Interface& operator=(ModelAPI_Interface& const theOrig) - { myImpl = theOrig.theImpl; Duplicate(); return *this;} - - /// Duplicates the objet pointed by myImpl (loosing the old one) - virtual void Duplicate() = 0; - -}; - -#endif diff --git a/src/ModelAPI/ModelAPI_PluginManager.cxx b/src/ModelAPI/ModelAPI_PluginManager.cxx index 2afb0ceb8..cde7f69bf 100644 --- a/src/ModelAPI/ModelAPI_PluginManager.cxx +++ b/src/ModelAPI/ModelAPI_PluginManager.cxx @@ -2,11 +2,24 @@ // Created: 20 Mar 2014 // Author: Mikhail PONIKAROV -#include +#include // to avoid unresolved ModelAPI_Document() -#include +#include // to avoid unresolved ModelAPI_Feature() -#include +#include + +#ifdef WIN32 +#include +#else +#include +#endif + +using namespace std; + +/// loads the library with specific name, appends "lib*.dll" or "*.so" depending on the platform +void loadLibrary(const string theLibName); +/// Converts library name to the operation system file name +string library(const string& theLibName); /// Manager that will be initialized from Model package, one per application boost::shared_ptr MY_MANAGER; @@ -15,12 +28,56 @@ ModelAPI_PluginManager::ModelAPI_PluginManager() { } +void ModelAPI_PluginManager::SetPluginManager( + boost::shared_ptr theManager) +{ + MY_MANAGER = theManager; +} + boost::shared_ptr ModelAPI_PluginManager::Get() { + if (!MY_MANAGER) { // import Model library that implements this interface of ModelAPI + loadLibrary("Model"); + } return MY_MANAGER; } -void ModelAPI_PluginManager::SetPluginManager(boost::shared_ptr theManager) +string library(const string& theLibName) { - MY_MANAGER = theManager; + string aLibName = theLibName; + +#ifndef WIN32 + static string aLibExt( ".so" ); + if (aLibName.size() < 3 || aLibName.substr(0, 3) !="lib") + aLibName = ".lib" + aLibName; +#else + static string aLibExt( ".dll" ); +#endif + + string anExt = aLibName.substr(aLibName.size() - 4); + + if ( anExt != aLibExt) + aLibName += aLibExt; + + return aLibName; +} + +void loadLibrary(const string theLibName) +{ + string aFileName = library(theLibName); + if ( aFileName.empty() ) + { + cerr<<"Library "< +#include + +class ModelAPI_Feature; + +/**\class ModelAPI_PluginManager + * \ingroup DataModel + * \brief Object that knows (from the initial XML file) which + * plugin contains which feature, loads and stores reference to loaded plugins by + * the feature functionality request. + */ + +class MODELAPI_EXPORT ModelAPI_PluginManager +{ +public: + /// Creates the feature object using plugins functionality + virtual boost::shared_ptr CreateFeature(std::string theFeatureID) = 0; + + /// Returns the real implementation (the alone instance per application) of the plugin manager + static boost::shared_ptr Get(); + + /// Is needed for python wrapping by swig, call Get to get an instance + ModelAPI_PluginManager(); + +protected: + static void SetPluginManager(boost::shared_ptr theManager); +}; + +#endif diff --git a/src/ModelAPI/ModelAPI_PluginManager.hxx b/src/ModelAPI/ModelAPI_PluginManager.hxx deleted file mode 100644 index 1d6a2e206..000000000 --- a/src/ModelAPI/ModelAPI_PluginManager.hxx +++ /dev/null @@ -1,37 +0,0 @@ -// File: ModelAPI_PluginManager.hxx -// Created: 20 Mar 2014 -// Author: Mikhail PONIKAROV - -#ifndef ModelAPI_PluginManager_HeaderFile -#define ModelAPI_PluginManager_HeaderFile - -#include "ModelAPI.hxx" -#include -#include - -class ModelAPI_Feature; - -/**\class ModelAPI_PluginManager - * \ingroup DataModel - * \brief Object that knows (from the initial XML file) which - * plugin contains which feature, loads and stores reference to loaded plugins by - * the feature functionality request. - */ - -class MODELAPI_EXPORT ModelAPI_PluginManager -{ -public: - /// Creates the feature object using plugins functionality - virtual boost::shared_ptr CreateFeature(std::string theFeatureID) = 0; - - /// Returns the real implementation (the alone instance per application) of the plugin manager - static boost::shared_ptr Get(); - - /// Is needed for python wrapping by swig, call Get to get an instance - ModelAPI_PluginManager(); - -protected: - static void SetPluginManager(boost::shared_ptr theManager); -}; - -#endif diff --git a/src/PartSet/PartSet_Message.h b/src/PartSet/PartSet_Message.h index 4ceccc1a3..9d15f0863 100644 --- a/src/PartSet/PartSet_Message.h +++ b/src/PartSet/PartSet_Message.h @@ -12,7 +12,7 @@ #include -#include +#include class PARTSET_EXPORT PartSet_Message: public Event_Message { diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 908587d52..447270c9b 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include diff --git a/src/PartSetPlugin/CMakeLists.txt b/src/PartSetPlugin/CMakeLists.txt new file mode 100644 index 000000000..d6d5787f7 --- /dev/null +++ b/src/PartSetPlugin/CMakeLists.txt @@ -0,0 +1,24 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11) + +INCLUDE(Common) +INCLUDE(FindBoost) + +SET(PROJECT_HEADERS + PartSetPlugin.h + PartSetPlugin_NewPart.h +) + +SET(PROJECT_SOURCES + PartSetPlugin.cxx + PartSetPlugin_NewPart.cxx +) + +ADD_DEFINITIONS(-DPARTSETPLUGIN_EXPORTS ${BOOST_DEFINITIONS}) +ADD_LIBRARY(PartSetPlugin SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS}) +TARGET_LINK_LIBRARIES(PartSetPlugin ${PROJECT_LIBRARIES} ModelAPI) + +INCLUDE_DIRECTORIES( + ../ModelAPI +) + +INSTALL(TARGETS PartSetPlugin DESTINATION plugins) diff --git a/src/PartSetPlugin/PartSetPlugin.cxx b/src/PartSetPlugin/PartSetPlugin.cxx new file mode 100644 index 000000000..1b641c3a1 --- /dev/null +++ b/src/PartSetPlugin/PartSetPlugin.cxx @@ -0,0 +1,16 @@ +#include "PartSetPlugin.h" + +#include +#include + +using namespace std; + +/// Standard method of the plugin that creates a specific feature instance by the feature kind +PARTSETPLUGIN_EXPORT boost::shared_ptr CreateFeature(const string& theFeatureKind) +{ + if (theFeatureKind == "new_part") { + return boost::shared_ptr(new PartSetPlugin_NewPart()); + } + // feature of such kind is not found + return boost::shared_ptr(); +} diff --git a/src/PartSetPlugin/PartSetPlugin.h b/src/PartSetPlugin/PartSetPlugin.h new file mode 100644 index 000000000..50b7e8ef0 --- /dev/null +++ b/src/PartSetPlugin/PartSetPlugin.h @@ -0,0 +1,18 @@ +#ifndef PARTSETPLUGIN_H +#define PARTSETPLUGIN_H + +#if defined PARTSETPLUGIN_EXPORTS +#if defined WIN32 +#define PARTSETPLUGIN_EXPORT __declspec( dllexport ) +#else +#define PARTSETPLUGIN_EXPORT +#endif +#else +#if defined WIN32 +#define PARTSETPLUGIN_EXPORT __declspec( dllimport ) +#else +#define PARTSETPLUGIN_EXPORT +#endif +#endif + +#endif diff --git a/src/PartSetPlugin/PartSetPlugin_NewPart.cxx b/src/PartSetPlugin/PartSetPlugin_NewPart.cxx new file mode 100644 index 000000000..7959ef044 --- /dev/null +++ b/src/PartSetPlugin/PartSetPlugin_NewPart.cxx @@ -0,0 +1,9 @@ +// File: PartSetPlugin_NewPart.cxx +// Created: 27 Mar 2014 +// Author: Mikhail PONIKAROV + +#include "PartSetPlugin_NewPart.hxx" + +PartSetPlugin_NewPart::PartSetPlugin_NewPart() +{ +} diff --git a/src/PartSetPlugin/PartSetPlugin_NewPart.h b/src/PartSetPlugin/PartSetPlugin_NewPart.h new file mode 100644 index 000000000..9b824c0ee --- /dev/null +++ b/src/PartSetPlugin/PartSetPlugin_NewPart.h @@ -0,0 +1,26 @@ +// File: PartSetPlugin_NewPart.hxx +// Created: 27 Mar 2014 +// Author: Mikhail PONIKAROV + +#ifndef PartSetPlugin_NewPart_HeaderFile +#define PartSetPlugin_NewPart_HeaderFile + +#include "PartSetPlugin.h" +#include + +/**\class PartSetPlugin_NewPart + * \ingroup DataModel + * \brief Feature for creation of the new part in PartSet. + */ + +class PartSetPlugin_NewPart: public ModelAPI_Feature +{ +public: + /// Returns the kind of a feature + PARTSETPLUGIN_EXPORT virtual std::string GetKind() {return "new_part";} + + /// Use plugin manager for features creation + PartSetPlugin_NewPart(); +}; + +#endif diff --git a/src/PartSetPlugin/PartSetPlugin_NewPart.hxx b/src/PartSetPlugin/PartSetPlugin_NewPart.hxx new file mode 100644 index 000000000..9b824c0ee --- /dev/null +++ b/src/PartSetPlugin/PartSetPlugin_NewPart.hxx @@ -0,0 +1,26 @@ +// File: PartSetPlugin_NewPart.hxx +// Created: 27 Mar 2014 +// Author: Mikhail PONIKAROV + +#ifndef PartSetPlugin_NewPart_HeaderFile +#define PartSetPlugin_NewPart_HeaderFile + +#include "PartSetPlugin.h" +#include + +/**\class PartSetPlugin_NewPart + * \ingroup DataModel + * \brief Feature for creation of the new part in PartSet. + */ + +class PartSetPlugin_NewPart: public ModelAPI_Feature +{ +public: + /// Returns the kind of a feature + PARTSETPLUGIN_EXPORT virtual std::string GetKind() {return "new_part";} + + /// Use plugin manager for features creation + PartSetPlugin_NewPart(); +}; + +#endif diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index be82600eb..50208485c 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -9,7 +9,7 @@ #include "XGUI_Viewer.h" #include -#include +#include #include #include diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index f25f355fb..aa115e9bd 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -1,8 +1,8 @@ #ifndef XGUI_WORKSHOP_H #define XGUI_WORKSHOP_H -#include -#include +#include +#include #include #include