SHAPER 9.16.0
Model_Application.h
1// Copyright (C) 2014-2026 CEA, EDF
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef Model_Application_H_
21#define Model_Application_H_
22
23#include <Model_Document.h>
24#include <TDocStd_Application.hxx>
25#include <map>
26
27// Define handle class
28DEFINE_STANDARD_HANDLE(Model_Application, TDocStd_Application)
29
30
38{
39public:
40 // useful methods inside of the module
41
42 // CASCADE RTTI
46
47
48 MODEL_EXPORT static Handle(Model_Application) getApplication();
51 MODEL_EXPORT std::shared_ptr<Model_Document> document(const int theDocID);
53 MODEL_EXPORT bool hasDocument(const int theDocID);
55 MODEL_EXPORT bool hasRoot();
57 MODEL_EXPORT std::shared_ptr<Model_Document> rootDocument();
59 MODEL_EXPORT void deleteDocument(const int theDocID);
61 MODEL_EXPORT void deleteAllDocuments();
64 MODEL_EXPORT void createDocument(const int theDocID);
69 MODEL_EXPORT bool loadDocument(const std::wstring theDocName, const int theDocID);
70
72 void setLoadPath(std::string thePath);
74 const std::string& loadPath() const;
76 void setLoadByDemand(std::wstring theID, const int theDocID);
78 bool isLoadByDemand(std::wstring theID, const int theDocIndex);
79
81 int generateDocumentId();
82
83 public:
84 // Redefined OCAF methods
86 Standard_CString ResourcesName();
89 virtual void Formats(TColStd_SequenceOfExtendedString& theFormats);
94
95 private:
97 std::map<int, std::shared_ptr<Model_Document> > myDocs;
99 std::string myPath;
101 std::map<std::wstring, int> myLoadedByDemand;
102};
103
104#endif
Realization of Open CASCADE application abstraction.
Definition: Model_Application.h:38
DEFINE_STANDARD_RTTIEXT(Model_Application, TDocStd_Application) MODEL_EXPORT static Handle getApplication()
Definition of "Handles" usage.