Aspose.Tasks for C++
AvailabilityPeriodCollection.h
1 #pragma once
2 //-----------------------------------------------------------------------
3 // <copyright file="AvailabilityPeriodCollection.cs" company="Aspose Pty Ltd">
4 // Copyright (c) 2002-2024 Aspose Pty Ltd. All Rights Reserved.
5 // </copyright>
6 //-----------------------------------------------------------------------
7 
8 #include <system/collections/ilist.h>
9 #include <system/array.h>
10 #include <cstdint>
11 
12 #include "aspose.tasks.cpp/aspose_tasks_api_defs.h"
13 
14 namespace Aspose
15 {
16 namespace Tasks
17 {
18 class AvailabilityPeriod;
19 namespace Calculations
20 {
21 class ResourceOverAllocationCalculator;
22 } // namespace Calculations
23 namespace IO
24 {
25 namespace Xml
26 {
27 class ResourceNodeReader;
28 } // namespace Xml
29 } // namespace IO
30 class Resource;
31 } // namespace Tasks
32 } // namespace Aspose
33 namespace System
34 {
35 namespace Collections
36 {
37 namespace Generic
38 {
39 template <typename> class IEnumerator;
40 } // namespace Generic
41 } // namespace Collections
42 class DateTime;
43 } // namespace System
44 
45 namespace Aspose {
46 
47 namespace Tasks {
48 
49 /// <summary>
50 /// Represents a collection which contains <see cref="AvailabilityPeriod"></see> objects.
51 /// </summary>
52 class ASPOSE_TASKS_SHARED_CLASS AvailabilityPeriodCollection : public System::Collections::Generic::IList<System::SharedPtr<Aspose::Tasks::AvailabilityPeriod>>
53 {
55  typedef System::Collections::Generic::IList<System::SharedPtr<Aspose::Tasks::AvailabilityPeriod>> BaseType;
56 
57  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
58  ASPOSE_TASKS_SHARED_RTTI_INFO_DECL();
59 
60  friend class Aspose::Tasks::Calculations::ResourceOverAllocationCalculator;
61  friend class Aspose::Tasks::Resource;
62  friend class Aspose::Tasks::IO::Xml::ResourceNodeReader;
63 
64 public:
65 
66  /// <summary>
67  /// Gets the parent <see cref="Resource"></see> for this object.
68  /// <returns>Parent <see cref="Resource"></see> object for this collection.</returns>
69  /// </summary>
70  ASPOSE_TASKS_SHARED_API System::SharedPtr<Resource> get_ParentResource() const;
71  /// <summary>
72  /// Gets the number of elements contained in this collection.
73  /// </summary>
74  ASPOSE_TASKS_SHARED_API int32_t get_Count() const override;
75  /// <summary>
76  /// Gets a value indicating whether this collection is read-only; otherwise, false.
77  /// </summary>
78  ASPOSE_TASKS_SHARED_API bool get_IsReadOnly() const override;
79 
80  /// <summary>
81  /// Returns the element at the specified index.
82  /// </summary>
83  /// <param name="index">The zero-based index of the element to get or set.</param>
84  /// <returns>the element at the specified index.</returns>
85  ASPOSE_TASKS_SHARED_API System::SharedPtr<AvailabilityPeriod> idx_get(int32_t index) const override;
86  /// <summary>
87  /// Sets the element at the specified index.
88  /// </summary>
89  /// <param name="index">The zero-based index of the element to get or set.</param>
90  /// <param name="value">the element at the specified index.</param>
91  ASPOSE_TASKS_SHARED_API void idx_set(int32_t index, System::SharedPtr<AvailabilityPeriod> value) override;
92 
93  /// <summary>
94  /// Returns an enumerator for this collection.
95  /// </summary>
96  /// <returns>an enumerator for this collection.</returns>
97  ASPOSE_TASKS_SHARED_API System::SharedPtr<System::Collections::Generic::IEnumerator<System::SharedPtr<AvailabilityPeriod>>> GetEnumerator() override;
98  /// <summary>
99  /// Adds the specified item to this collection.
100  /// </summary>
101  /// <param name="item">the specified item to add to this collection.</param>
102  ASPOSE_TASKS_SHARED_API void Add(const System::SharedPtr<AvailabilityPeriod>& item) override;
103  /// <summary>
104  /// Removes all items from this collection.
105  /// </summary>
106  ASPOSE_TASKS_SHARED_API void Clear() override;
107  /// <summary>
108  /// Returns true if the specified item is found in this collection; otherwise, false.
109  /// </summary>
110  /// <param name="item">the specified item to find.</param>
111  /// <returns>true if the specified item is found in this collection; otherwise, false.</returns>
112  ASPOSE_TASKS_SHARED_API bool Contains(const System::SharedPtr<AvailabilityPeriod>& item) const override;
113  /// <summary>
114  /// Copies the elements of this collection to the specified array, starting at the specified array index.
115  /// </summary>
116  /// <param name="array">the specified one-dimensional array to copy elements to</param>
117  /// <param name="arrayIndex">the zero-based index of the specified array at which copying begins.</param>
118  ASPOSE_TASKS_SHARED_API void CopyTo(System::ArrayPtr<System::SharedPtr<AvailabilityPeriod>> array, int32_t arrayIndex) override;
119  /// <summary>
120  /// Removes the first occurrence of a specific object from this collection.
121  /// </summary>
122  /// <param name="item">the specified object to remove.</param>
123  /// <returns>true if the specified object was successfully removed from this collection; otherwise, false.</returns>
124  ASPOSE_TASKS_SHARED_API bool Remove(const System::SharedPtr<AvailabilityPeriod>& item) override;
125  /// <summary>
126  /// Determines the index of the specified item in this collection.
127  /// </summary>
128  /// <param name="item">the specified item to locate in this collection.</param>
129  /// <returns>the index of the specified item if found; otherwise, -1.</returns>
130  ASPOSE_TASKS_SHARED_API int32_t IndexOf(const System::SharedPtr<AvailabilityPeriod>& item) const override;
131  /// <summary>
132  /// Inserts the specified item at the specified index.
133  /// </summary>
134  /// <param name="index">the specified zero-based index at which the item should be inserted.</param>
135  /// <param name="item">the specified item to insert to this collection.</param>
136  ASPOSE_TASKS_SHARED_API void Insert(int32_t index, const System::SharedPtr<AvailabilityPeriod>& item) override;
137  /// <summary>
138  /// Removes an item at the specified index.
139  /// </summary>
140  /// <param name="index">the specified zero-based index to remove an item at.</param>
141  ASPOSE_TASKS_SHARED_API void RemoveAt(int32_t index) override;
142 
143 protected:
144 
145  ASPOSE_TASKS_SHARED_API AvailabilityPeriodCollection(const System::SharedPtr<Resource>& parentRsc);
146 
147  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(AvailabilityPeriodCollection, CODEPORTING_ARGS(const System::SharedPtr<Resource>& parentRsc));
148 
149  ASPOSE_TASKS_SHARED_API AvailabilityPeriodCollection(const System::SharedPtr<Resource>& parentRsc, const System::SharedPtr<System::Collections::Generic::IList<System::SharedPtr<AvailabilityPeriod>>>& periods);
150 
151  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(AvailabilityPeriodCollection, CODEPORTING_ARGS(const System::SharedPtr<Resource>& parentRsc, const System::SharedPtr<System::Collections::Generic::IList<System::SharedPtr<AvailabilityPeriod>>>& periods));
152  ASPOSE_TASKS_SHARED_API double GetMinAvailability(System::DateTime intervalStart, System::DateTime intervalEnd);
153 
154  virtual ASPOSE_TASKS_SHARED_API ~AvailabilityPeriodCollection();
155 
156  #ifdef ASPOSE_GET_SHARED_MEMBERS
157  ASPOSE_TASKS_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
158  #endif
159 
160 
161 private:
162 
163  System::SharedPtr<System::Collections::Generic::IList<System::SharedPtr<AvailabilityPeriod>>> periods;
164  System::WeakPtr<Resource> resource;
165 
166 };
167 
168 } // namespace Tasks
169 } // namespace Aspose
170 
171 
Represents a collection which contains AvailabilityPeriod objects.
Definition: AvailabilityPeriodCollection.h:53
void Add(const System::SharedPtr< AvailabilityPeriod > &item) override
Adds the specified item to this collection.
void RemoveAt(int32_t index) override
Removes an item at the specified index.
void Clear() override
Removes all items from this collection.
bool Contains(const System::SharedPtr< AvailabilityPeriod > &item) const override
Returns true if the specified item is found in this collection; otherwise, false.
int32_t IndexOf(const System::SharedPtr< AvailabilityPeriod > &item) const override
Determines the index of the specified item in this collection.
System::SharedPtr< System::Collections::Generic::IEnumerator< System::SharedPtr< AvailabilityPeriod > > > GetEnumerator() override
Returns an enumerator for this collection.
bool get_IsReadOnly() const override
Gets a value indicating whether this collection is read-only; otherwise, false.
void CopyTo(System::ArrayPtr< System::SharedPtr< AvailabilityPeriod >> array, int32_t arrayIndex) override
Copies the elements of this collection to the specified array, starting at the specified array index.
void Insert(int32_t index, const System::SharedPtr< AvailabilityPeriod > &item) override
Inserts the specified item at the specified index.
int32_t get_Count() const override
Gets the number of elements contained in this collection.
System::SharedPtr< AvailabilityPeriod > idx_get(int32_t index) const override
Returns the element at the specified index.
void idx_set(int32_t index, System::SharedPtr< AvailabilityPeriod > value) override
Sets the element at the specified index.
bool Remove(const System::SharedPtr< AvailabilityPeriod > &item) override
Removes the first occurrence of a specific object from this collection.
System::SharedPtr< Resource > get_ParentResource() const
Gets the parent Resource for this object. Parent Resource object for this collection.
Represents a resource in a project.
Definition: Resource.h:206
Definition: Asn.h:13