NCBI C++ ToolKit
GBProjectHandle.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: GBProjectHandle.hpp 39250 2017-08-29 19:00:48Z katargir $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  */
27 
28 /// @file GBProjectHandle.hpp
29 /// User-defined methods of the data storage class.
30 ///
31 /// This file was originally generated by application DATATOOL
32 /// using the following specifications:
33 /// 'gui_project.asn'.
34 ///
35 /// New methods or data members can be added to it if needed.
36 /// See also: GBProjectHandle_.hpp
37 
38 
39 #ifndef GUI_OBJECTS_GUI_PROJECT_GBPROJECTHANDLE_HPP
40 #define GUI_OBJECTS_GUI_PROJECT_GBPROJECTHANDLE_HPP
41 
42 
43 // generated includes
47 
48 #include <corelib/ncbistd.hpp>
49 #include <corelib/ncbimtx.hpp>
50 
51 #include <set>
52 
53 
54 // generated classes
55 
57 
58 class ICanceled;
59 
60 BEGIN_objects_SCOPE // namespace ncbi::objects::
61 
62 class CGBProject;
63 class CGBProject_ver2;
64 class CWorkspaceFolder;
65 class CScope;
66 
67 /////////////////////////////////////////////////////////////////////////////
69 {
71 public:
76 
77 public:
78  static TId sm_NullId;
79 
80  CGBProjectHandle(void);
82 
83  virtual ~CGBProjectHandle(void);
84 
85  /// @name Named serialization interface
86  /// @{
87  const IGBProject& GetProject() const;
88  IGBProject& SetProject();
89 
90  /// check to see if our project is loaded
91  bool IsLoaded() const;
92  void SetLoaded(bool loaded = true);
93 
94  bool IsDirty() const;
95  void SetDirty(bool dirty = true);
96 
97  bool GetDataModified() const;
98  void SetDataModified(bool modified = true);
99 
100  /// force a project to be loaded from an external stream
101  bool Load(CNcbiIstream& istr, ICanceled* canceledCallback);
102 
103  /// Serialize to a stream in a given format
104  void Save(CNcbiOstream& ostr, ESerialDataFormat fmt) const;
105 
106  /// establish a tie to the object manager via a scope
107  virtual void SetScope(CScope* scope);
108  //virtual CScope* GetScope();
109  virtual CScope* GetScope() const;
110  /// @}
111 
112  /// @name State Management and Inspection
113  /// @{
114  /// ID already defined in projects
115  TId GetId() const; /// Retrieve the unique ID for our project
116 
117  static TId GetNextId();
118 
119  /// retrieve our project's descriptor set
120  const CProjectDescr& GetDescr() const;
121  CProjectDescr& SetDescr();
122 
123  /// Get a description of our contents.
124  /// This is suitable for display in a GUI component such as a list view.
125  const string& GetTitle(void) const;
126  const string& GetShortTitle(void) const;
127 
128  /// Clear project
129  virtual void Clear(void);
130 
131  bool IsProjectItemLabelUnique(const string& label) const;
132 
133  /// Create a unique label for a project item
134  string MakeUniqueItemLabel(const string& label) const;
135 
136  /// Create a label for a folder that will be unique in the scope
137  /// of the parent folder
138  string MakeUniqueFolderLabel(const string& label,
139  objects::CProjectFolder& parent_folder) const;
140 
141  /// Create a unique label for a data loader
142  string MakeUniqueDataLoaderLabel(const string& label) const;
143  /// @}
144 
145  /// retrieve this project's version
146  /// this is fixed per subclass
147  IGBProject::EProjectVersion GetVersion() const;
148 
149  void AddDataLoader(CLoaderDescriptor& loader);
150  const TDataLoaders& GetDataLoaders() const;
151  TDataLoaders& GetDataLoaders();
152 
153  CRef<CLoaderDescriptor> FindDataLoaderByLabel(const string& label);
154 
155  CProjectFolder* FindProjectFolderById(CProjectFolder::TId id);
156  CProjectItem* FindProjectItemById(CProjectItem::TId id);
157 
158  string GetViewSettings(const string& view_type,
159  const string& view_ins_id) const;
160 
161  void SaveViewSettings(const string& view_type,
162  const string& view_ins_id, const string& settings);
163 
164 
165  /// @name IGBProject forwarded interface
166  /// @{
167  void AddItem(CProjectItem& item, CProjectFolder& parent_folder);
168 
169  /// retrieve our project's data, in the form of a project folder
170  /// this may be a contrived entity, and it is up to a project to determine
171  /// what parts belong where
172  const CProjectFolder& GetData() const;
173  CProjectFolder& SetData();
174 
175  /// retrieve a set of annotations for this project
176  bool IsSetAnnot() const;
177  const IGBProject::TAnnot& GetAnnot() const;
178  IGBProject::TAnnot& SetAnnot();
179 
180  /// SetCreateDate() will add a descriptor for creation date
181  void SetCreateDate(const CDate& date);
182 
183  /// SetModifiedDate() will add a descriptor for the update date
184  void SetModifiedDate(const CDate& date);
185  /// @}
186 
187 protected:
188  void x_LinkChildFolders(CProjectFolder& folder);
189  void x_FixIdGenerator(CGBProject_ver2& project);
190 
191 private:
192  // Prohibit copy constructor and assignment operator
195 
196 protected:
197  /// auto incremented ID counter
199 
200  /// the pointer to the actual project
202 
203  /// unique runtime identifier for this project
205 
206  /// Dirty flag indicates whether the project has unsaved changes
207  bool m_Dirty;
208  bool m_DataModified = false;
210 
211  CRef<CScope> m_Scope; /// the Scope associated with the Project
212 
213  /// titles for this project, one brief the other longer
214  mutable string m_Title;
215  mutable string m_ShortTitle;
216 };
217 
218 /////////////////// end of CGBProjectHandle inline methods
219 
220 END_objects_SCOPE // namespace ncbi::objects::
221 
223 
224 
225 #endif // GUI_OBJECTS_GUI_PROJECT_GBPROJECTHANDLE_HPP
226 /* Original file checksum: lines: 86, chars: 2569, CRC32: ef33c3f2 */
Data storage class.
User-defined methods of the data storage class.
CAtomicCounter_WithAutoInit –.
Definition: ncbicntr.hpp:120
CAtomicCounter –.
Definition: ncbicntr.hpp:71
Definition: Date.hpp:53
A project handle is an abstraction that binds all possible versions This is stored in a workspace; th...
IGBProject::TDataLoaders TDataLoaders
CGBProjectHandle_Base Tparent
CGBProjectHandle(const CGBProjectHandle &value)
CGBProjectHandle & operator=(const CGBProjectHandle &value)
IGBProject::TAnnot TAnnot
CRef< CScope > m_Scope
CIRef< IGBProject > m_Project
the pointer to the actual project
CAtomicCounter::TValue TId
static CAtomicCounter sm_Counter
auto incremented ID counter
TId m_Id
unique runtime identifier for this project
CAtomicCounter_WithAutoInit m_Loaded
bool m_Dirty
Dirty flag indicates whether the project has unsaved changes.
string m_Title
the Scope associated with the Project
IGBProject::TData TData
CLoaderDescriptor –.
CAtomicCounter::TValue TId
CRef –.
Definition: ncbiobj.hpp:618
CScope –.
Definition: scope.hpp:92
Interface for testing cancellation request in a long lasting operation.
Definition: icanceled.hpp:51
IGBProject - abstract interface for a project used by CGBProjectHandle.
Definition: igbproject.hpp:57
list< CRef< CLoaderDescriptor > > TDataLoaders
Definition: igbproject.hpp:70
list< CRef< CProjectAnnot > > TAnnot
Definition: igbproject.hpp:68
Include a standard set of the NCBI C++ Toolkit most basic headers.
TNCBIAtomicValue TValue
Alias TValue for TNCBIAtomicValue.
Definition: ncbicntr.hpp:73
ESerialDataFormat
Data file format.
Definition: serialdef.hpp:71
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
NCBI_XOBJUTIL_EXPORT string GetTitle(const CBioseq_Handle &hnd, TGetTitleFlags flags=0)
Definition: seqtitle.cpp:106
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:149
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
Definition: ncbistre.hpp:146
#define NCBI_GUIOBJECTS_EXPORT
Definition: gui_export.h:511
static const char label[]
CProject * GetProject(wxTreeCtrl &treeCtrl, const CItem &item)
Definition: pt_utils.cpp:77
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Multi-threading – mutexes; rw-locks; semaphore.
CScope & GetScope()
Modified on Fri Sep 20 14:57:25 2024 by modify_doxy.py rev. 669887