![]() | ![]() | ![]() | Libplanner Reference Manual | ![]() |
---|
MrpTask — represents a task in the project.
#include <libplanner/planner.h> struct MrpTaskPriv; struct MrpTask; struct MrpConstraint; enum MrpConstraintType; MrpTask* mrp_task_new (void); void mrp_task_set_name (MrpTask *task, const gchar *name); const gchar* mrp_task_get_name (MrpTask *task); MrpRelation* mrp_task_add_predecessor (MrpTask *task, MrpTask *predecessor, MrpRelationType type, glong lag, GError **error); void mrp_task_remove_predecessor (MrpTask *task, MrpTask *predecessor); MrpRelation* mrp_task_get_relation (MrpTask *task_a, MrpTask *task_b); MrpRelation* mrp_task_get_predecessor_relation (MrpTask *task, MrpTask *predecessor); MrpRelation* mrp_task_get_successor_relation (MrpTask *task, MrpTask *successor); GList* mrp_task_get_predecessor_relations (MrpTask *task); GList* mrp_task_get_successor_relations (MrpTask *task); gboolean mrp_task_has_relation_to (MrpTask *task_a, MrpTask *task_b); gboolean mrp_task_has_relation (MrpTask *task); MrpTask* mrp_task_get_parent (MrpTask *task); MrpTask* mrp_task_get_first_child (MrpTask *task); MrpTask* mrp_task_get_next_sibling (MrpTask *task); guint mrp_task_get_n_children (MrpTask *task); MrpTask* mrp_task_get_nth_child (MrpTask *task, guint n); gint mrp_task_get_position (MrpTask *task); mrptime mrp_task_get_start (MrpTask *task); mrptime mrp_task_get_work_start (MrpTask *task); mrptime mrp_task_get_finish (MrpTask *task); mrptime mrp_task_get_latest_start (MrpTask *task); mrptime mrp_task_get_latest_finish (MrpTask *task); gint mrp_task_get_duration (MrpTask *task); gint mrp_task_get_work (MrpTask *task); GList* mrp_task_get_assignments (MrpTask *task); MrpAssignment* mrp_task_get_assignment (MrpTask *task, MrpResource *resource); void mrp_task_reset_constraint (MrpTask *task); gfloat mrp_task_get_cost (MrpTask *task); GList* mrp_task_get_assigned_resources (MrpTask *task); gint mrp_task_compare (gconstpointer a, gconstpointer b);
"constraint" MrpConstraint : Read / Write "critical" gboolean : Read / Write "duration" gint : Read / Write "finish" glong : Read "latest-finish" glong : Read "latest-start" glong : Read "name" gchararray : Read / Write "note" gchararray : Read / Write "percent-complete" gint : Read / Write "priority" gint : Read / Write "sched" MrpTaskSched : Read / Write "start" glong : Read "type" MrpTaskType : Read / Write "work" gint : Read / Write
"assignment-added" void user_function (MrpTask *mrptask, MrpAssignment *arg1, gpointer user_data); "assignment-removed" void user_function (MrpTask *mrptask, MrpAssignment *arg1, gpointer user_data); "child-added" void user_function (MrpTask *mrptask, gpointer user_data); "child-removed" void user_function (MrpTask *mrptask, gpointer user_data); "relation-added" void user_function (MrpTask *mrptask, gpointer arg1, gpointer user_data); "relation-removed" void user_function (MrpTask *mrptask, gpointer arg1, gpointer user_data); "task-moved" void user_function (MrpTask *mrptask, MrpTask *arg1, gint arg2, gpointer user_data);
struct MrpTaskPriv;
A private struct for internal use only. The definition of this structure is not publically available.
struct MrpConstraint { MrpConstraintType type; mrptime time; };
A struct representing a scheduling constraint on a task.
typedef enum { MRP_CONSTRAINT_ASAP = 0, /* as-soon-as-possible */ MRP_CONSTRAINT_ALAP, /* as-late-as-possible */ MRP_CONSTRAINT_SNET, /* start-no-earlier-than */ MRP_CONSTRAINT_FNLT, /* finish-no-later-than */ MRP_CONSTRAINT_MSO, /* must-start-on */ } MrpConstraintType;
The type of constraint for the task. The default is MRP_CONSTRAINT_ASAP.
MRP_CONSTRAINT_ASAP | as soon as possible |
MRP_CONSTRAINT_ALAP | as late as possible (unimplemented) |
MRP_CONSTRAINT_SNET | start no eariler than |
MRP_CONSTRAINT_FNLT | finish no later than (unimplemented) |
MRP_CONSTRAINT_MSO | must start on |
MrpTask* mrp_task_new (void);
Create a new task.
Returns : | the newly created MrpTask. |
void mrp_task_set_name (MrpTask *task, const gchar *name);
Sets the name of task.
task : | an MrpResource |
name : | new name of task |
const gchar* mrp_task_get_name (MrpTask *task);
Retrives the name of task.
task : | an MrpTask |
Returns : | the name |
MrpRelation* mrp_task_add_predecessor (MrpTask *task, MrpTask *predecessor, MrpRelationType type, glong lag, GError **error);
Adds a predecessor task to a task. Depending on type, the predecessor must be started or finished before task can be started or finished, with an optional lag/lead time.
task : | an MrpTask |
predecessor : | the predecessor |
type : | type of relation |
lag : | lag time, if negative, it means lead time |
error : | location to store error, or NULL |
Returns : | the relation that represents the predecessor/successor link. |
void mrp_task_remove_predecessor (MrpTask *task, MrpTask *predecessor);
Removes a predecessor previously added to task.
task : | an MrpTask |
predecessor : | the predecessor to remove |
MrpRelation* mrp_task_get_relation (MrpTask *task_a, MrpTask *task_b);
Fetches a relation between two tasks if it exists.
task_a : | an MrpTask |
task_b : | an MrpTask |
Returns : | a MrpRelation representing the relation between task_a and task_b or NULL if they don't have any relation. |
MrpRelation* mrp_task_get_predecessor_relation (MrpTask *task, MrpTask *predecessor);
Fetches a predecessor relation between task and it's predecessor.
task : | an MrpTask |
predecessor : | an MrpTask |
Returns : | the MrpRelation if it exists, otherwise NULL |
MrpRelation* mrp_task_get_successor_relation (MrpTask *task, MrpTask *successor);
Fetches a successor relation between task and it's successor.
task : | an MrpTask |
successor : | an MrpTask |
Returns : | the MrpRelation if it exists, otherwise NULL |
GList* mrp_task_get_predecessor_relations (MrpTask *task);
Fetches a list of predecessor relations to task.
task : | an MrpTask |
Returns : | the list of predecessor relations to task |
GList* mrp_task_get_successor_relations (MrpTask *task);
Fetches a list of successor relations to task.
task : | an MrpTask |
Returns : | a list of successor relations to task |
gboolean mrp_task_has_relation_to (MrpTask *task_a, MrpTask *task_b);
Checks if a and b has a relation, i.e. if a is a predecessor or successor of b.
gboolean mrp_task_has_relation (MrpTask *task);
Checks if a task has any relations, i.e. predecessors or successors.
task : | an MrpTask |
Returns : | TRUE if there are any relations. |
MrpTask* mrp_task_get_parent (MrpTask *task);
Fetches the parent of task.
task : | an MrpTask |
Returns : | the parent of task, or NULL if there is no parent.. |
MrpTask* mrp_task_get_first_child (MrpTask *task);
Fetches the first child of task.
task : | an MrpTask |
Returns : | the first child of task, or NULL if there are no children. |
MrpTask* mrp_task_get_next_sibling (MrpTask *task);
Fetches the next sibling of task.
task : | an MrpTask |
Returns : | the next sibling of task, or NULL if there is no next sibling. |
guint mrp_task_get_n_children (MrpTask *task);
Fetches the number of children task has.
task : | an MrpTask |
Returns : | the number of children task has |
MrpTask* mrp_task_get_nth_child (MrpTask *task, guint n);
Fetches the nth child of task.
task : | an MrpTask |
n : | the index of the child to get |
Returns : | the nth child of task, or NULL if there is no such child. |
gint mrp_task_get_position (MrpTask *task);
Fetches the index or position of task among its siblings.
task : | an MrpTask |
Returns : | the position of task among its siblings. |
mrptime mrp_task_get_start (MrpTask *task);
Fetches the start time of task.
task : | an MrpTask |
Returns : | the start time of task. |
mrptime mrp_task_get_work_start (MrpTask *task);
Retrieves the first time where work is performed of task. This might be different from the start time, if the start time is during non-working time. In that case, the work start would be right after the non-working interval.
task : | an MrpTask |
Returns : | The work start time of task. |
mrptime mrp_task_get_finish (MrpTask *task);
Fetches the finish time of task.
task : | an MrpTask |
Returns : | the finish time of task. |
mrptime mrp_task_get_latest_start (MrpTask *task);
Retrieves the latest start time of task, i.e. the latest time the task can start without delaying the project.
task : | an MrpTask |
Returns : | The latest start time of task. |
mrptime mrp_task_get_latest_finish (MrpTask *task);
Retrieves the latest finish time of task, i.e. the latest time the task can finish without delaying the project.
task : | an MrpTask |
Returns : | The latest finish time of task. |
gint mrp_task_get_duration (MrpTask *task);
Fetches the duration of task. This differs from the calendar duration that is retrieved by (finish - start).
task : | an MrpTask |
Returns : | The duration of task. |
gint mrp_task_get_work (MrpTask *task);
Retrieves the amount of work of task.
task : | an MrpTask |
Returns : | The work of task. |
GList* mrp_task_get_assignments (MrpTask *task);
Fetches a list of MrpAssignment.
task : | an MrpTask |
Returns : | the list of assignments. |
MrpAssignment* mrp_task_get_assignment (MrpTask *task, MrpResource *resource);
retrieves the MrpAssignment associated with task and resource if the resource is assigned to task, or NULL if there is no such assignment.
task : | an MrpTask |
resource : | an MrpResource |
Returns : | The assignment if it exists, otherwise NULL. |
void mrp_task_reset_constraint (MrpTask *task);
Sets the contraint type to MRP_CONTRAINT_ASAP and notifies listeners.
task : | an MrpTask |
gfloat mrp_task_get_cost (MrpTask *task);
Calculates the cost to complete task.
task : | an MrpTask |
Returns : | The cost to complete task. |
GList* mrp_task_get_assigned_resources (MrpTask *task);
Fetches a list of resources assigned to task. The list needs to be freed with g_list_free() by caller.
task : | an MrpTask |
Returns : | A newly created list of MrpResource. |
gint mrp_task_compare (gconstpointer a, gconstpointer b);
Compares the name of the tasks, by calling strcmp() on the names.
"constraint" (MrpConstraint : Read / Write) | Task scheduling constraint. |
"critical" (gboolean : Read / Write) | In critical path. |
"duration" (gint : Read / Write) | Duration of the task. |
"finish" (glong : Read) | Task finish time. |
"latest-finish" (glong : Read) | Latest task finish time. |
"latest-start" (glong : Read) | Latest task start time. |
"name" (gchararray : Read / Write) | Name of the task. |
"note" (gchararray : Read / Write) | Note attached to the task. |
"percent-complete" (gint : Read / Write) | Percent completed of task. |
"priority" (gint : Read / Write) | Priority of the task. |
"sched" (MrpTaskSched : Read / Write) | Task scheduling type. |
"start" (glong : Read) | Task Start time. |
"type" (MrpTaskType : Read / Write) | Task type. |
"work" (gint : Read / Write) | Task work. |
void user_function (MrpTask *mrptask, MrpAssignment *arg1, gpointer user_data);
mrptask : | the object which received the signal. |
arg1 : | |
user_data : | user data set when the signal handler was connected. |
void user_function (MrpTask *mrptask, MrpAssignment *arg1, gpointer user_data);
mrptask : | the object which received the signal. |
arg1 : | |
user_data : | user data set when the signal handler was connected. |
void user_function (MrpTask *mrptask, gpointer user_data);
mrptask : | the object which received the signal. |
user_data : | user data set when the signal handler was connected. |
void user_function (MrpTask *mrptask, gpointer user_data);
mrptask : | the object which received the signal. |
user_data : | user data set when the signal handler was connected. |
void user_function (MrpTask *mrptask, gpointer arg1, gpointer user_data);
mrptask : | the object which received the signal. |
arg1 : | |
user_data : | user data set when the signal handler was connected. |
void user_function (MrpTask *mrptask, gpointer arg1, gpointer user_data);
mrptask : | the object which received the signal. |
arg1 : | |
user_data : | user data set when the signal handler was connected. |
<< MrpResource | MrpError >> |