1 // File: Model_Application.hxx
2 // Created: 28 Dec 2011
3 // Author: Mikhail PONIKAROV
6 #ifndef Model_Application_HeaderFile
7 #define Model_Application_HeaderFile
9 #include <Model_Document.h>
10 #include <TDocStd_Application.hxx>
13 // Define handle class
14 DEFINE_STANDARD_HANDLE(Model_Application, TDocStd_Application)
16 /**\class Model_Application
18 * \brief Realization of Open CASCADE application abstraction. Class for internal use only.
19 * Application supports the formats and document management. It is uses OCAF-lke
20 * architecture and just implements specific features of the module.
22 class Model_Application: public TDocStd_Application
25 // useful methods inside of the module
28 DEFINE_STANDARD_RTTI(Model_Application);
30 //! Retuns the application: one per process
31 MODEL_EXPORT static Handle_Model_Application getApplication();
32 //! Returns the main document (on first call creates it) by the string identifier
33 MODEL_EXPORT const std::shared_ptr<Model_Document>& getDocument(std::string theDocID);
34 //! Returns true if document has been created
35 MODEL_EXPORT bool hasDocument(std::string theDocID);
36 //! Deletes the document from the application
37 MODEL_EXPORT void deleteDocument(std::string theDocID);
40 // Redefined OCAF methods
41 //! Return name of resource (i.e. "Standard")
42 Standard_CString ResourcesName();
43 //! Return format (i.e "MDTV-Standard")
44 //! \param theFormats sequence of allowed formats for input/output
45 virtual void Formats(TColStd_SequenceOfExtendedString& theFormats);
47 //! Use method GetInstance() method to obtain
48 //! the static instance of the object (or derive your own application)
52 /// Map from string identifiers to created documents of an application
53 std::map<std::string, std::shared_ptr<Model_Document> > myDocs;