1 /* $Id: ProjectFolder.hpp 431328 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
44 #include <objects/gbproj/ProjectFolder_.hpp>
45 
46 // generated classes
47 #include <corelib/ncbicntr.hpp>
48 #include <objects/gbproj/ProjectItem.hpp>
49 
50 BEGIN_NCBI_SCOPE
51 
52 BEGIN_objects_SCOPE // namespace ncbi::objects::
53 
54 /////////////////////////////////////////////////////////////////////////////
55 class NCBI_GBPROJ_EXPORT CProjectFolder : public CProjectFolder_Base
56 {
57     typedef CProjectFolder_Base Tparent;
58 public:
59     typedef CAtomicCounter::TValue TId;
60 
61     class IProjectItemVisitor
62     {
63     public:
64         virtual bool Visit(objects::CProjectItem& item) = 0;
~IProjectItemVisitor()65         virtual ~IProjectItemVisitor()    {};
66     };
67 
68 public:
69     // constructor
70     CProjectFolder(void);
71     // destructor
72     ~CProjectFolder(void);
73 
GetId() const74     TId GetId() const { return m_Id; }
75 
SetParentFolder(CProjectFolder *)76     void    SetParentFolder(CProjectFolder*) {}
GetParentFolder()77     CProjectFolder* GetParentFolder() { return 0; }
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
115     CProjectFolder(const CProjectFolder& value);
116     CProjectFolder& operator=(const CProjectFolder& value);
117 
118 protected:
119     static CAtomicCounter   m_IdCounter;
120 
121     TId m_Id;
122 };
123 
124 /////////////////// CProjectFolder inline methods
125 
126 // constructor
127 inline
CProjectFolder(void)128 CProjectFolder::CProjectFolder(void)
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 
139 END_NCBI_SCOPE
140 
141 
142 #endif // OBJECTS_GBPROJ_PROJECTFOLDER_HPP
143 /* Original file checksum: lines: 86, chars: 2486, CRC32: 1d8505d9 */
144