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