Models.h
1 //##################################################################################################
2 //
3 // Ceetron Desktop Components
4 // Component: App
5 //
6 // --------------------------------------------------------------------------------------------
7 // Copyright (C) 2011, Ceetron AS
8 // This is UNPUBLISHED PROPRIETARY SOURCE CODE of Ceetron AS. The contents of this file may
9 // not be disclosed to third parties, copied or duplicated in any form, in whole or in part,
10 // without the prior written permission of Ceetron AS.
11 //##################################################################################################
12 
13 #pragma once
14 
15 #include "CeeApp/Base.h"
16 #include "CeeCore/Base.h"
17 #include "CeeCore/RefCountedObject.h"
18 #include "CeeVisualization/Model.h"
19 #include "CeeUnstructGrid/UnstructGridModel.h"
20 #include "CeeUnstructGrid/SimulationInfo.h"
21 
22 #include <map>
23 
24 
25 namespace cee {
26 
27 namespace ug
28 {
29  class UnstructGridModel;
30  class Error;
31 }
32 
33 namespace app {
34 
35 //==================================================================================================
36 //
37 // Class for UnstructGridModel management
38 //
39 //==================================================================================================
40 class CEE_APP_EXPORT Models : public RefCountedObject
41 {
42 
43 public:
44  static Models* instance();
45 
46  size_t count() const;
47 
48  cee::ug::UnstructGridModel* current() const;
49  cee::ug::SimulationInfo currentInfo() const;
50  void setCurrent(cee::ug::UnstructGridModel* model);
51 
52  size_t currentIndex() const;
53  void setCurrentIndex(size_t index);
54 
55  size_t indexOf(const cee::ug::UnstructGridModel* model) const;
56  cee::ug::UnstructGridModel* get(size_t index) const;
57 
58  cee::ug::SimulationInfo info(size_t index) const;
59  cee::ug::SimulationInfo info(const cee::ug::UnstructGridModel* model) const;
60 
61  size_t add(cee::ug::UnstructGridModel* model);
62 
63  cee::ug::UnstructGridModel* open(const cee::Str& filename, cee::ug::Error* error);
64  cee::ug::UnstructGridModel* open(const cee::Str& filename, const cee::Str& password, cee::ug::Error* error);
65  cee::ug::UnstructGridModel* open(const std::vector<cee::Str>& filenameArr, cee::ug::Error* error);
66  cee::ug::UnstructGridModel* open(const std::vector<cee::Str>& filenameArr, const cee::Str& password, cee::ug::Error* error);
67  bool reopen(cee::ug::UnstructGridModel* model, const cee::Str& filename, cee::ug::Error* error);
68  bool reopen(size_t index, const cee::Str& filename, cee::ug::Error* error);
69  bool openSecondary(const cee::Str& filename, cee::ug::Error* error);
70 
71  void close(size_t index);
72  void close(cee::ug::UnstructGridModel* model);
73  bool closeCurrent();
74  void closeAll();
75 
76 private:
77  Models();
78  virtual ~Models();
79  CEE_PRIVATE_IMPL(Models);
80  CEE_DISALLOW_COPY_AND_ASSIGN(Models);
81 
82 };
83 
84 } // namespace cee
85 } // namespace app
Namespace cee contains all functionality and structures under the Core component. ...
Definition: AppComponent.cpp:26
A general unicode based string class.
Definition: Str.h:28
Base class for all reference counted objects with built-in support for intrusive reference counting...
Definition: RefCountedObject.h:34
Class to manage the list of UnstructGridModel instances in the application.
Definition: Models.h:40
Error object for simple error management
Definition: Error.h:27
UnstructGridModel is a subclass of Model which adds specific model structure and functionality for re...
Definition: UnstructGridModel.h:72
Simple class containing metadata info for the simulation that produced the model database.
Definition: SimulationInfo.h:26