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

Go to the SVN repository for this file.

1 /* $Id: ProjectFolder.hpp 62363 2014-04-02 21:18:04Z 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 ProjectFolder.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 /// 'gbproj.asn'.
34 ///
35 /// New methods or data members can be added to it if needed.
36 /// See also: ProjectFolder_.hpp
37 
38 
39 #ifndef OBJECTS_GBPROJ_PROJECTFOLDER_HPP
40 #define OBJECTS_GBPROJ_PROJECTFOLDER_HPP
41 
42 
43 // generated includes
45 
46 // generated classes
47 #include <corelib/ncbicntr.hpp>
49 
51 
52 BEGIN_objects_SCOPE // namespace ncbi::objects::
53 
54 /////////////////////////////////////////////////////////////////////////////
56 {
58 public:
60 
62  {
63  public:
64  virtual bool Visit(objects::CProjectItem& item) = 0;
65  virtual ~IProjectItemVisitor() {};
66  };
67 
68 public:
69  // constructor
70  CProjectFolder(void);
71  // destructor
72  ~CProjectFolder(void);
73 
74  TId GetId() const { return m_Id; }
75 
78 
79  const CProjectItem* GetProjectItem(CProjectItem::TId id) const;
80  CProjectItem* GetProjectItem(CProjectItem::TId id);
81 
82  const CProjectFolder* GetProjectFolder(CProjectFolder::TId id) const;
83  CProjectFolder* GetProjectFolder(CProjectFolder::TId id);
84 
85  CProjectItem* FindProjectItemById(CProjectItem::TId id);
86  const CProjectItem* FindProjectItemById(CProjectItem::TId id) const;
87 
88  CProjectItem* FindProjectItemByLabel(const string& label);
89  CProjectItem* FindProjectItemByData(const CSerialObject& object, bool recursive);
90 
91  CProjectFolder* FindChildFolderByTitle(const string& title);
92 
93  const CProjectFolder* FindChildFolderById(TId id) const;
94  CProjectFolder* FindChildFolderById(TId id);
95 
96  const CProjectFolder* FindProjectItemFolder(CProjectItem::TId id) const;
97  CProjectFolder* FindProjectItemFolder(CProjectItem::TId id);
98 
99  CRef<CProjectFolder> RemoveProjectFolder(CProjectFolder::TId id);
100 
101  void AddChildItem(CProjectItem& child_item);
102  bool RemoveChildItem(CProjectItem& child_item);
103  bool RemoveChildItem(CProjectItem::TId id);
104  void RemoveAllChildItems();
105 
106  void AddChildFolder(CProjectFolder& child_folder);
107  void RemoveChildFolder(CProjectFolder& child_folder);
108  void RemoveChildFolder(CProjectFolder::TId folder_id);
109 
110  /// applies the given visitor to all project items until the visitor returns false
111  bool ForEachProjectItem(IProjectItemVisitor& visitor, bool recursive);
112 
113 private:
114  // Prohibit copy constructor and assignment operator
117 
118 protected:
120 
122 };
123 
124 /////////////////// CProjectFolder inline methods
125 
126 // constructor
127 inline
129 {
130  m_Id = m_IdCounter.Add(1) - 1;
131 }
132 
133 
134 /////////////////// end of CProjectFolder inline methods
135 
136 
137 END_objects_SCOPE // namespace ncbi::objects::
138 
140 
141 
142 #endif // OBJECTS_GBPROJ_PROJECTFOLDER_HPP
143 /* Original file checksum: lines: 86, chars: 2486, CRC32: 1d8505d9 */
Data storage class.
User-defined methods of the data storage class.
CAtomicCounter –.
Definition: ncbicntr.hpp:71
virtual bool Visit(objects::CProjectItem &item)=0
CProjectFolder_Base –.
CProjectFolder * GetParentFolder()
static CAtomicCounter m_IdCounter
CAtomicCounter::TValue TId
void SetParentFolder(CProjectFolder *)
CProjectFolder(const CProjectFolder &value)
TId GetId() const
CProjectFolder & operator=(const CProjectFolder &value)
CProjectFolder_Base Tparent
Base class for all serializable objects.
Definition: serialbase.hpp:150
#define NCBI_GBPROJ_EXPORT
Definition: gbproj_export.h:69
TNCBIAtomicValue TValue
Alias TValue for TNCBIAtomicValue.
Definition: ncbicntr.hpp:73
TValue Add(int delta) THROWS_NONE
Atomically add value (=delta), and return new counter value.
Definition: ncbicntr.hpp:278
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static const char label[]
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Wed May 22 11:28:24 2024 by modify_doxy.py rev. 669887