Aspose.Tasks for C++
BaselineCollection.h
1 #pragma once
2 //-----------------------------------------------------------------------
3 // <copyright file="BaselineCollection.cs" company="Aspose Pty Ltd">
4 // Copyright (c) 2002-2024 Aspose Pty Ltd. All Rights Reserved.
5 // </copyright>
6 //-----------------------------------------------------------------------
7 
8 #include <system/collections/list.h>
9 #include <system/collections/ilist.h>
10 #include <system/array.h>
11 #include <cstdint>
12 
13 #include "aspose.tasks.cpp/aspose_tasks_api_defs.h"
14 
15 namespace Aspose
16 {
17 namespace Tasks
18 {
19 class Baseline;
20 enum class BaselineType;
21 namespace Calculations
22 {
23 class ResourceCostCalculator;
24 class ResourceWorkCalculator;
25 } // namespace Calculations
26 namespace Connectivity
27 {
28 class MpdResourceBaselineMapper;
29 class MpdResourceMapper;
30 } // namespace Connectivity
31 class EVCalculator;
32 namespace IO
33 {
34 namespace Html
35 {
36 class HtmlResourceBaseLineTableReader;
37 } // namespace Html
38 namespace MSProject
39 {
40 class MPPResourceReader;
41 class MPPResourceWriter;
42 } // namespace MSProject
43 namespace Pwa
44 {
45 namespace InternalApi
46 {
47 namespace Mapping
48 {
49 class ProjectResourcesMapper;
50 } // namespace Mapping
51 } // namespace InternalApi
52 } // namespace Pwa
53 namespace Xml
54 {
55 class ResourceNodeReader;
56 } // namespace Xml
57 } // namespace IO
58 class Resource;
59 namespace Saving
60 {
61 class TemplateWriter;
62 } // namespace Saving
63 namespace Util
64 {
65 namespace Fields
66 {
67 class RscFieldToValue;
68 } // namespace Fields
69 } // namespace Util
70 namespace Visualization
71 {
72 class ApsReportBuilder;
73 class ApsReportCostOverrunsBuilder;
74 class ApsReportResourceCostOverviewBuilder;
75 class ApsReportRscOverviewBuilder;
76 class ResourceToColumnText;
77 } // namespace Visualization
78 } // namespace Tasks
79 } // namespace Aspose
80 namespace System
81 {
82 namespace Collections
83 {
84 namespace Generic
85 {
86 template <typename> class IEnumerable;
87 template <typename> class IEnumerator;
88 } // namespace Generic
89 } // namespace Collections
90 } // namespace System
91 
92 namespace Aspose {
93 
94 namespace Tasks {
95 
96 /// <summary>
97 /// Represents a collection of <see cref="Baseline"></see> objects.
98 /// </summary>
99 class ASPOSE_TASKS_SHARED_CLASS BaselineCollection : public System::Collections::Generic::IList<System::SharedPtr<Aspose::Tasks::Baseline>>
100 {
102  typedef System::Collections::Generic::IList<System::SharedPtr<Aspose::Tasks::Baseline>> BaseType;
103 
104  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
105  ASPOSE_TASKS_SHARED_RTTI_INFO_DECL();
106 
107  friend class Aspose::Tasks::Calculations::ResourceCostCalculator;
108  friend class Aspose::Tasks::Calculations::ResourceWorkCalculator;
109  friend class Aspose::Tasks::Resource;
110  friend class Aspose::Tasks::EVCalculator;
111  friend class Aspose::Tasks::Connectivity::MpdResourceBaselineMapper;
112  friend class Aspose::Tasks::Connectivity::MpdResourceMapper;
113  friend class Aspose::Tasks::IO::Html::HtmlResourceBaseLineTableReader;
114  friend class Aspose::Tasks::IO::MSProject::MPPResourceReader;
115  friend class Aspose::Tasks::IO::MSProject::MPPResourceWriter;
116  friend class Aspose::Tasks::IO::Pwa::InternalApi::Mapping::ProjectResourcesMapper;
117  friend class Aspose::Tasks::IO::Xml::ResourceNodeReader;
118  friend class Aspose::Tasks::Visualization::ApsReportBuilder;
119  friend class Aspose::Tasks::Saving::TemplateWriter;
120  friend class Aspose::Tasks::Util::Fields::RscFieldToValue;
121  friend class Aspose::Tasks::Visualization::ApsReportCostOverrunsBuilder;
122  friend class Aspose::Tasks::Visualization::ApsReportResourceCostOverviewBuilder;
123  friend class Aspose::Tasks::Visualization::ApsReportRscOverviewBuilder;
124  friend class Aspose::Tasks::Visualization::ResourceToColumnText;
125 
126 public:
127  /// A collection type whose iterator types is used as iterator types in the current collection.
128  using iterator_holder_type = System::Collections::Generic::List<System::SharedPtr<Baseline>>;
129  /// Iterator type.
130  using iterator = typename iterator_holder_type::iterator;
131  /// Const iterator type.
132  using const_iterator = typename iterator_holder_type::const_iterator;
133  /// Virtualized element type.
134  using virtualized_iterator_element = typename iterator_holder_type::virtualized_iterator_element;
135  /// Virtualized type.
136  using virtualized_iterator = typename iterator_holder_type::virtualized_iterator;
137 
138 public:
139 
140  /// <summary>
141  /// Gets the parent <see cref="Resource"></see> for this collection.
142  /// </summary>
143  ASPOSE_TASKS_SHARED_API System::SharedPtr<Resource> get_ParentResource() const;
144  /// <summary>
145  /// Gets the number of objects contained in this BaselineCollection object.
146  /// </summary>
147  ASPOSE_TASKS_SHARED_API int32_t get_Count() const override;
148 
149  /// <summary>
150  /// Returns the element at the specified index.
151  /// </summary>
152  /// <param name="index">The zero-based index of the element to get.</param>
153  /// <returns>the element at the specified index.</returns>
154  ASPOSE_TASKS_SHARED_API System::SharedPtr<Baseline> idx_get(int32_t index) const override;
155  /// <summary>
156  /// Returns the element at the specified index.
157  /// </summary>
158  /// <param name="index">The zero-based index of the element to get.</param>
159  /// <param name="value">the element at the specified index.</param>
160  ASPOSE_TASKS_SHARED_API void idx_set(int32_t index, System::SharedPtr<Baseline> value) override;
161 
162  /// <summary>
163  /// Returns an enumerator for this collection.
164  /// </summary>
165  /// <returns>an enumerator for this collection.</returns>
166  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::IEnumerator<System::SharedPtr<Baseline>>> GetEnumerator() override;
167  /// <summary>
168  /// This is the stub implementation of ICollection's Add method, that only throws NotSupportedException
169  /// </summary>
170  /// <param name="item">The item to remove.</param>
171  ASPOSE_TASKS_SHARED_API void Add(const System::SharedPtr<Baseline>& item) override;
172  /// <summary>
173  /// Removes baseline from this collection.
174  /// </summary>
175  /// <param name="item">The item to remove.</param>
176  /// <returns>true if <see cref="Baseline"></see> instance has been removed successfully; otherwise, false</returns>
177  ASPOSE_TASKS_SHARED_API bool Remove(const System::SharedPtr<Baseline>& item) override;
178  /// <summary>
179  /// Converts the BaselineCollection object to a list of <see cref="Baseline"></see> objects.
180  /// </summary>
181  /// <returns>List of <see cref="Baseline"></see> objects.</returns>
182  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<Baseline>>> ToList();
183  /// Gets iterator pointing to the first element (if any) of the collection.
184  /// @return An iterator pointing to the first element (if any) of the collection
185  ASPOSE_TASKS_SHARED_API iterator begin() noexcept;
186  /// Gets iterator pointing right after the last element (if any) of the collection.
187  /// @return An iterator pointing right after the last element (if any) of the collection
188  ASPOSE_TASKS_SHARED_API iterator end() noexcept;
189  /// Gets iterator pointing to the first element (if any) of the const-qualified instance of the collection.
190  /// @return An iterator pointing to the first element (if any) of the const-qualified instance of the collection
191  ASPOSE_TASKS_SHARED_API const_iterator begin() const noexcept;
192  /// Gets iterator pointing right after the last element (if any) of the const-qualified instance of the collection.
193  /// @return An iterator pointing right after the last element (if any) of the const-qualified instance of the collection
194  ASPOSE_TASKS_SHARED_API const_iterator end() const noexcept;
195  /// Gets iterator pointing to the first const-qualified element (if any) of the collection.
196  /// @return An iterator pointing to the first const-qualified element (if any) of the collection
197  ASPOSE_TASKS_SHARED_API const_iterator cbegin() const noexcept;
198  /// Gets iterator pointing right after the last const-qualified element (if any) of the collection.
199  /// @return An iterator pointing right after the last const-qualified element (if any) of the collection
200  ASPOSE_TASKS_SHARED_API const_iterator cend() const noexcept;
201  /// Gets iterator pointing to the first element (if any) of the collection.
202  /// @return An iterator pointing to the first element (if any) of the collection
203  /// Provides iterator implementation to container's first element.
204  /// @return Newly-created iterator object.
205  ASPOSE_TASKS_SHARED_API virtualized_iterator* virtualizeBeginIterator() override;
206  /// Gets iterator pointing right after the last element (if any) of the collection.
207  /// @return An iterator pointing right after the last element (if any) of the collection
208  /// Provides iterator implementation to container's end.
209  /// @return Newly-created iterator object.
210  ASPOSE_TASKS_SHARED_API virtualized_iterator* virtualizeEndIterator() override;
211  /// Gets iterator pointing to the first element (if any)of the const-qualified instance of the collection.
212  /// @return An iterator pointing to the first element (if any)of the const-qualified instance of the collection
213  /// Provides const iterator implementation to container's first element.
214  /// @return Newly-created iterator object.
215  ASPOSE_TASKS_SHARED_API virtualized_iterator* virtualizeBeginConstIterator() const override;
216  /// Gets iterator pointing right after the last element (if any)of the const-qualified instance of the collection.
217  /// @return An iterator pointing right after the last element (if any)of the const-qualified instance of the collection
218  /// Provides const iterator implementation to container's end.
219  /// @return Newly-created iterator object.
220  ASPOSE_TASKS_SHARED_API virtualized_iterator* virtualizeEndConstIterator() const override;
221 
222 protected:
223 
224  ASPOSE_TASKS_SHARED_API BaselineCollection(const System::SharedPtr<Resource>& resource);
225 
226  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(BaselineCollection, CODEPORTING_ARGS(const System::SharedPtr<Resource>& resource));
227 
228  ASPOSE_TASKS_SHARED_API BaselineCollection(const System::SharedPtr<Resource>& resource, const System::SharedPtr<System::Collections::Generic::IEnumerable<System::SharedPtr<Baseline>>>& baselines);
229 
230  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(BaselineCollection, CODEPORTING_ARGS(const System::SharedPtr<Resource>& resource, const System::SharedPtr<System::Collections::Generic::IEnumerable<System::SharedPtr<Baseline>>>& baselines));
231  ASPOSE_TASKS_SHARED_API void Sort();
232  ASPOSE_TASKS_SHARED_API System::SharedPtr<Baseline> GetByType(BaselineType baselineType);
233  ASPOSE_TASKS_SHARED_API void AddInternal(const System::SharedPtr<Baseline>& baseline);
234 
235  virtual ASPOSE_TASKS_SHARED_API ~BaselineCollection();
236 
237  #ifdef ASPOSE_GET_SHARED_MEMBERS
238  ASPOSE_TASKS_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
239  #endif
240 
241 
242 private:
243 
244  System::SharedPtr<System::Collections::Generic::List<System::SharedPtr<Baseline>>> baselines;
245  System::WeakPtr<Resource> resource;
246 
247  bool get_IsReadOnly() const override;
248 
249  void RemoveAt(int32_t index) override;
250  void Clear() override;
251  int32_t IndexOf(const System::SharedPtr<Baseline>& item) const override;
252  bool Contains(const System::SharedPtr<Baseline>& item) const override;
253  void CopyTo(System::ArrayPtr<System::SharedPtr<Baseline>> array, int32_t arrayIndex) override;
254  void Insert(int32_t index, const System::SharedPtr<Baseline>& item) override;
255 
256 };
257 
258 } // namespace Tasks
259 } // namespace Aspose
260 
261 
System::Collections::Generic::List< System::SharedPtr< Baseline >> iterator_holder_type
A collection type whose iterator types is used as iterator types in the current collection.
Definition: BaselineCollection.h:128
typename iterator_holder_type::virtualized_iterator_element virtualized_iterator_element
Virtualized element type.
Definition: BaselineCollection.h:134
typename iterator_holder_type::iterator iterator
Iterator type.
Definition: BaselineCollection.h:130
Represents a collection of Baseline objects.
Definition: BaselineCollection.h:99
Represents baseline values of a resource.
Definition: Baseline.h:52
typename iterator_holder_type::virtualized_iterator virtualized_iterator
Virtualized type.
Definition: BaselineCollection.h:136
typename iterator_holder_type::const_iterator const_iterator
Const iterator type.
Definition: BaselineCollection.h:132
Represents a resource in a project.
Definition: Resource.h:206