Aspose.Tasks for C++
TaskLink.h
1 #pragma once
2 //-----------------------------------------------------------------------
3 // <copyright file="TaskLink.cs" company="Aspose Pty Ltd">
4 // Copyright (c) 2002-2024 Aspose Pty Ltd. All Rights Reserved.
5 // </copyright>
6 //-----------------------------------------------------------------------
7 
8 #include <system/string.h>
9 #include <system/iequatable.h>
10 #include <system/guid.h>
11 #include <cstdint>
12 
13 #include "aspose.tasks.cpp/NullableBool.h"
14 #include "aspose.tasks.cpp/aspose_tasks_api_defs.h"
15 
16 namespace Aspose
17 {
18 namespace Tasks
19 {
20 namespace Calculations
21 {
22 class TaskSlackCalculator;
23 } // namespace Calculations
24 namespace Connectivity
25 {
26 class MpdTaskLinkMapper;
27 class MspTaskLinksMapper;
28 class PmTaskRelationMapper;
29 } // namespace Connectivity
30 namespace IO
31 {
32 namespace Html
33 {
34 class HtmlTaskTableReader;
35 } // namespace Html
36 namespace Mpx
37 {
38 class MpxReader;
39 } // namespace Mpx
40 namespace MSProject
41 {
42 class MPP12Reader;
43 class MPP14Reader;
44 class MPP9Reader;
45 class MPPTaskLinksReader;
46 } // namespace MSProject
47 namespace PrimaveraXml
48 {
49 class PrimaveraRelationshipNodeReader;
50 } // namespace PrimaveraXml
51 namespace Pwa
52 {
53 namespace InternalApi
54 {
55 namespace Mapping
56 {
57 class TaskLinkEntityMapper;
58 class TaskLinkToRawValuesMapper;
59 } // namespace Mapping
60 } // namespace InternalApi
61 } // namespace Pwa
62 namespace Xer
63 {
64 class XerRelationReader;
65 } // namespace Xer
66 namespace Xml
67 {
68 class TaskLinksNodeReader;
69 class TaskLinksNodeWriter;
70 } // namespace Xml
71 } // namespace IO
72 namespace Saving
73 {
74 class PrimaveraRelationshipNodeWriter;
75 class XerRelationTable;
76 } // namespace Saving
77 namespace Scheduling
78 {
79 class ConstraintSolver;
80 class TopologicalSort;
81 class TopsortCriticalPath;
82 } // namespace Scheduling
83 class Task;
84 class TaskLinkCollection;
85 enum class TaskLinkType;
86 class TaskWarningCalculator;
87 enum class TimeUnitType : int8_t;
88 namespace Visualization
89 {
90 class ApsFFVerticalLinkBuilder;
91 class ApsFSVerticalLinkBuilder;
92 class ApsLinksBuilder;
93 class ApsSFVerticalLinkBuilder;
94 class ApsSSVerticalLinkBuilder;
95 class TaskToColumnText;
96 } // namespace Visualization
97 } // namespace Tasks
98 } // namespace Aspose
99 namespace System
100 {
101 namespace Collections
102 {
103 namespace Generic
104 {
105 template <typename> class Stack;
106 } // namespace Generic
107 } // namespace Collections
108 class TimeSpan;
109 } // namespace System
110 
111 namespace Aspose {
112 
113 namespace Tasks {
114 
115 /// <summary>
116 /// Represents a predecessor link.
117 /// </summary>
118 class ASPOSE_TASKS_SHARED_CLASS TaskLink final : public System::IEquatable<System::SharedPtr<Aspose::Tasks::TaskLink>>
119 {
120  typedef TaskLink ThisType;
121  typedef System::IEquatable<System::SharedPtr<Aspose::Tasks::TaskLink>> BaseType;
122 
123  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
124  ASPOSE_TASKS_SHARED_RTTI_INFO_DECL();
125 
126  friend class Aspose::Tasks::Calculations::TaskSlackCalculator;
127  friend class Aspose::Tasks::IO::PrimaveraXml::PrimaveraRelationshipNodeReader;
128  friend class Aspose::Tasks::Task;
129  friend class Aspose::Tasks::IO::Pwa::InternalApi::Mapping::TaskLinkToRawValuesMapper;
130  friend class Aspose::Tasks::Connectivity::MpdTaskLinkMapper;
131  friend class Aspose::Tasks::Connectivity::MspTaskLinksMapper;
132  friend class Aspose::Tasks::Connectivity::PmTaskRelationMapper;
133  friend class Aspose::Tasks::IO::Html::HtmlTaskTableReader;
134  friend class Aspose::Tasks::IO::MSProject::MPP12Reader;
135  friend class Aspose::Tasks::IO::MSProject::MPP14Reader;
136  friend class Aspose::Tasks::IO::MSProject::MPPTaskLinksReader;
137  friend class Aspose::Tasks::IO::MSProject::MPP9Reader;
138  friend class Aspose::Tasks::IO::Mpx::MpxReader;
139  friend class Aspose::Tasks::IO::Xer::XerRelationReader;
140  friend class Aspose::Tasks::IO::Pwa::InternalApi::Mapping::TaskLinkEntityMapper;
141  friend class Aspose::Tasks::IO::Xml::TaskLinksNodeReader;
142  friend class Aspose::Tasks::IO::Xml::TaskLinksNodeWriter;
143  friend class Aspose::Tasks::TaskWarningCalculator;
144  friend class Aspose::Tasks::Saving::XerRelationTable;
145  friend class Aspose::Tasks::Saving::PrimaveraRelationshipNodeWriter;
146  friend class Aspose::Tasks::Scheduling::ConstraintSolver;
147  friend class Aspose::Tasks::Scheduling::TopsortCriticalPath;
148  friend class Aspose::Tasks::Scheduling::TopologicalSort;
150  friend class Aspose::Tasks::Visualization::ApsFFVerticalLinkBuilder;
151  friend class Aspose::Tasks::Visualization::ApsLinksBuilder;
152  friend class Aspose::Tasks::Visualization::ApsFSVerticalLinkBuilder;
153  friend class Aspose::Tasks::Visualization::ApsSFVerticalLinkBuilder;
154  friend class Aspose::Tasks::Visualization::ApsSSVerticalLinkBuilder;
155  friend class Aspose::Tasks::Visualization::TaskToColumnText;
156 
157 public:
158 
159  /// <summary>
160  /// Gets a value indicating whether a predecessor is part of another project.
161  /// </summary>
162  ASPOSE_TASKS_SHARED_API bool get_IsCrossProject() const;
163  /// <summary>
164  /// Sets a value indicating whether a predecessor is part of another project.
165  /// </summary>
166  ASPOSE_TASKS_SHARED_API void set_IsCrossProject(bool value);
167  /// <summary>
168  /// Gets the external predecessor project.
169  /// </summary>
170  ASPOSE_TASKS_SHARED_API System::String get_CrossProjectName() const;
171  /// <summary>
172  /// Sets the external predecessor project.
173  /// </summary>
174  ASPOSE_TASKS_SHARED_API void set_CrossProjectName(const System::String& value);
175  /// <summary>
176  /// Gets the lag in tenths of a minute or percentage.
177  /// </summary>
178  ASPOSE_TASKS_SHARED_API int32_t get_LinkLag() const;
179  /// <summary>
180  /// Sets the lag in tenths of a minute or percentage.
181  /// </summary>
182  ASPOSE_TASKS_SHARED_API void set_LinkLag(int32_t value);
183  /// <summary>
184  /// Gets lag duration, depending on LagFormat.
185  /// </summary>
186  /// <remarks>Link lag can be a percentage value (LagFormat is TimeUnitType.Percent).
187  /// In this case the duration is calculated as a percentage of PredTask's duration.
188  /// Otherwise the method returns TimeSpan value representing TaskLink's lag.</remarks>
189  /// <exception cref="ArgumentException">When trying to set the value for TaskLinks where LagFormat is TimeUnitType.Percent.</exception>
190  ASPOSE_TASKS_SHARED_API System::TimeSpan get_LinkLagTimeSpan();
191  /// <summary>
192  /// Sets lag duration, depending on LagFormat.
193  /// </summary>
194  /// <remarks>Link lag can be a percentage value (LagFormat is TimeUnitType.Percent).
195  /// In this case the duration is calculated as a percentage of PredTask's duration.
196  /// Otherwise the method returns TimeSpan value representing TaskLink's lag.</remarks>
197  /// <exception cref="ArgumentException">When trying to set the value for TaskLinks where LagFormat is TimeUnitType.Percent.</exception>
198  ASPOSE_TASKS_SHARED_API void set_LinkLagTimeSpan(System::TimeSpan value);
199  /// <summary>
200  /// Gets the format for expressing the lag format.
201  /// </summary>
202  ASPOSE_TASKS_SHARED_API TimeUnitType get_LagFormat() const;
203  /// <summary>
204  /// Sets the format for expressing the lag format.
205  /// </summary>
206  ASPOSE_TASKS_SHARED_API void set_LagFormat(TimeUnitType value);
207  /// <summary>
208  /// Gets the predecessor task.
209  /// </summary>
210  ASPOSE_TASKS_SHARED_API const System::SharedPtr<Task>& get_PredTask() const;
211  /// <summary>
212  /// Sets the predecessor task.
213  /// </summary>
214  ASPOSE_TASKS_SHARED_API void set_PredTask(const System::SharedPtr<Task>& value);
215  /// <summary>
216  /// Gets the successor task.
217  /// </summary>
218  ASPOSE_TASKS_SHARED_API const System::SharedPtr<Task>& get_SuccTask() const;
219  /// <summary>
220  /// Sets the successor task.
221  /// </summary>
222  ASPOSE_TASKS_SHARED_API void set_SuccTask(const System::SharedPtr<Task>& value);
223  /// <summary>
224  /// Gets the type of a link.
225  /// </summary>
226  ASPOSE_TASKS_SHARED_API TaskLinkType get_LinkType() const;
227  /// <summary>
228  /// Sets the type of a link.
229  /// </summary>
230  ASPOSE_TASKS_SHARED_API void set_LinkType(TaskLinkType value);
231 
232  /// <summary>
233  /// Returns a hash code value for the instance of the <see cref="TaskLink"></see> class.
234  /// </summary>
235  /// <returns>returns a hash code value for this object.</returns>
236  ASPOSE_TASKS_SHARED_API int32_t GetHashCode() const override;
237  /// <summary>
238  /// Returns a value indicating whether this instance is equal to a specified object.
239  /// </summary>
240  /// <param name="other">The specified instance of the <see cref="TaskLink"></see> class to compare with this instance.</param>
241  /// <returns><b>True</b> if the specified instance of the <see cref="TaskLink"></see> class has the same predecessor and successor tasks as this instance; otherwise, <b>false</b>.</returns>
242  ASPOSE_TASKS_SHARED_API bool Equals(System::SharedPtr<TaskLink> other) override;
243  /// <summary>
244  /// Returns string representation of a TaskLink.
245  /// The exact details of the representation are unspecified and subject to change.
246  /// </summary>
247  /// <returns>string which represents TaskLink object.</returns>
248  ASPOSE_TASKS_SHARED_API System::String ToString() const override;
249  /// <summary>
250  /// Returns a value indicating whether this instance is equal to a specified object.
251  /// </summary>
252  /// <param name="obj">The object to compare with this instance.</param>
253  /// <returns><b>True</b> if the specified object is a TaskLink that has the same predecessor and successor
254  /// as this instance; otherwise, <b>false</b>.</returns>
255  ASPOSE_TASKS_SHARED_API bool Equals(System::SharedPtr<System::Object> obj) override;
256 
257 protected:
258 
259  ASPOSE_TASKS_SHARED_API NullableBool get_NullableCrossProject() const;
260  ASPOSE_TASKS_SHARED_API void set_NullableCrossProject(NullableBool value);
261  ASPOSE_TASKS_SHARED_API bool get_IsDummy() const;
262  ASPOSE_TASKS_SHARED_API int32_t get_Uid() const;
263  ASPOSE_TASKS_SHARED_API void set_Uid(int32_t value);
264  ASPOSE_TASKS_SHARED_API System::Guid get_Guid() const;
265  ASPOSE_TASKS_SHARED_API void set_Guid(System::Guid value);
266  ASPOSE_TASKS_SHARED_API bool get_IsNegativeLag();
267  ASPOSE_TASKS_SHARED_API bool get_PredecessorFinishLinked();
268 
269  /// <summary>
270  /// Initializes a new instance of the <see cref="TaskLink"></see> class.
271  /// </summary>
272  /// <param name="predTask">
273  /// Predecessor task.
274  /// </param>
275  /// <param name="succTask">
276  /// Successor task.
277  /// </param>
278  /// <param name="linkType">
279  /// Type of the link.
280  /// </param>
281  ASPOSE_TASKS_SHARED_API TaskLink(const System::SharedPtr<Task>& predTask, const System::SharedPtr<Task>& succTask, TaskLinkType linkType);
282 
283  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(TaskLink, CODEPORTING_ARGS(const System::SharedPtr<Task>& predTask, const System::SharedPtr<Task>& succTask, TaskLinkType linkType));
284 
285  ASPOSE_TASKS_SHARED_API TaskLink(const System::SharedPtr<Task>& predTask, const System::SharedPtr<Task>& succTask, TaskLinkType linkType, bool isDummy);
286 
287  ASPOSE_TASKS_SHARED_API MEMBER_FUNCTION_MAKE_OBJECT_DECLARATION(TaskLink, CODEPORTING_ARGS(const System::SharedPtr<Task>& predTask, const System::SharedPtr<Task>& succTask, TaskLinkType linkType, bool isDummy));
288  ASPOSE_TASKS_SHARED_API void AddRelation();
289  ASPOSE_TASKS_SHARED_API void RemoveRelation();
290  ASPOSE_TASKS_SHARED_API System::TimeSpan GetLagDuration() const;
291  ASPOSE_TASKS_SHARED_API System::String GetTaskLinkString(int32_t taskUid);
292 
293  virtual ASPOSE_TASKS_SHARED_API ~TaskLink();
294 
295  #ifdef ASPOSE_GET_SHARED_MEMBERS
296  ASPOSE_TASKS_SHARED_API void GetSharedMembers(System::Object::shared_members_type& result) const override;
297  #endif
298 
299 
300 private:
301 
302  System::Guid internalGuid;
303  bool isDummy;
304  TaskLinkType linkType;
305  System::String pr_CrossProjectName;
306  int32_t pr_LinkLag;
307  TimeUnitType pr_LagFormat;
308  System::WeakPtr<Task> pr_PredTask;
309  System::WeakPtr<Task> pr_SuccTask;
310  NullableBool pr_NullableCrossProject;
311  int32_t pr_Uid;
312  System::Guid pr_Guid;
313 
314  bool get_Invalid() const;
315 
316  System::String GetLagString() const;
317  void CheckTwiceLinked();
318  void CheckCircuits();
319  void CheckCircuits(const System::SharedPtr<Task>& temp, const System::SharedPtr<System::Collections::Generic::Stack<System::SharedPtr<Task>>>& predecessors);
320  void CheckLink();
321 
322 };
323 
324 } // namespace Tasks
325 } // namespace Aspose
326 
327 
Represents a task in a project.
Definition: Task.h:383
A class for boolean values with possibility to check whether the value was defined or not...
Definition: NullableBool.h:21