Esempio n. 1
0
/**
 * mrp_assignment_get_units:
 * @assignment: an #MrpAssignment
 *
 * Retrieves the number of units that the resource is assigned with to the
 * task. 100 means 100%, etc.
 *
 * Return value: number of units of the assignment.
 **/
gint
mrp_assignment_get_units (MrpAssignment *assignment)
{
	g_return_val_if_fail (MRP_IS_ASSIGNMENT (assignment), -1);

	return assignment->priv->units;
}
Esempio n. 2
0
/**
 * mrp_assignment_get_task:
 * @assignment: an #MrpAssignment
 *
 * Retrieves the #MrpTask associated with @assignment.
 *
 * Return value: the task associated with the assignment object. The reference
 * count of the task is not increased.
 **/
MrpTask *
mrp_assignment_get_task (MrpAssignment *assignment)
{
	g_return_val_if_fail (MRP_IS_ASSIGNMENT (assignment), NULL);

	return assignment->priv->task;
}
Esempio n. 3
0
/**
 * mrp_assignment_get_resource:
 * @assignment: an #MrpAssignment
 *
 * Retrieves the #MrpResource associated with @assignment.
 *
 * Return value: the resource associated with the assignment object. The reference
 * count of the resource is not increased.
 **/
MrpResource *
mrp_assignment_get_resource (MrpAssignment *assignment)
{
	g_return_val_if_fail (MRP_IS_ASSIGNMENT (assignment), NULL);

	return assignment->priv->resource;
}
Esempio n. 4
0
static void
mpp_write_assignment (MrpParser     *parser,
		      xmlNodePtr     parent,
		      MrpAssignment *assignment)
{
	xmlNodePtr   node;
	MrpTask     *task;
	MrpResource *resource;
	NodeEntry   *resource_entry;
	NodeEntry   *task_entry;
	gint         assigned_units;

	g_return_if_fail (MRP_IS_ASSIGNMENT (assignment));

	node = xmlNewChild (parent,
                            NULL,
			    "allocation",
			    NULL);

	g_object_get (assignment,
		      "task", &task,
		      "resource", &resource,
		      "units", &assigned_units,
		      NULL);

	task_entry = g_hash_table_lookup (parser->task_hash, task);
	resource_entry = g_hash_table_lookup (parser->resource_hash, resource);

	mpp_xml_set_int (node, "task-id", task_entry->id);
	mpp_xml_set_int (node, "resource-id", resource_entry->id);
	mpp_xml_set_int (node, "units", assigned_units);
}