container_t PJ_container_new (const char *name, e_container_types kind, container_t father)
{
+ if (name == NULL){
+ THROWF (tracing_error, 0, "can't create a container with a NULL name");
+ }
+
static long long int container_id = 0;
char id_str[INSTR_DEFAULT_STR_SIZE];
snprintf (id_str, INSTR_DEFAULT_STR_SIZE, "%lld", container_id++);
case INSTR_SMPI: snprintf (typename, INSTR_DEFAULT_STR_SIZE, "MPI"); break;
case INSTR_MSG_PROCESS: snprintf (typename, INSTR_DEFAULT_STR_SIZE, "MSG_PROCESS"); break;
case INSTR_MSG_TASK: snprintf (typename, INSTR_DEFAULT_STR_SIZE, "MSG_TASK"); break;
- default: xbt_die ("Congratulations, you have found a bug on newContainer function of instr_routing.c"); break;
+ default: THROWF (tracing_error, 0, "new container kind is unknown."); break;
}
type_t type = PJ_type_get (typename, new->father->type);
if (type == NULL){
void PJ_container_remove_from_parent (container_t child)
{
+ if (child == NULL){
+ THROWF (tracing_error, 0, "can't remove from parent with a NULL child");
+ }
+
container_t parent = child->father;
if (parent){
XBT_DEBUG("removeChildContainer (%s) FromContainer (%s) ",
void PJ_container_free (container_t container)
{
+ if (container == NULL){
+ THROWF (tracing_error, 0, "trying to free a NULL container");
+ }
XBT_DEBUG("destroy container %s", container->name);
//obligation to dump previous events because they might
static void recursiveDestroyContainer (container_t container)
{
+ if (container == NULL){
+ THROWF (tracing_error, 0, "trying to recursively destroy a NULL container");
+ }
XBT_DEBUG("recursiveDestroyContainer %s", container->name);
xbt_dict_cursor_t cursor = NULL;
container_t child;
void PJ_container_free_all ()
{
- if (PJ_container_get_root()) recursiveDestroyContainer (PJ_container_get_root());
+ container_t root = PJ_container_get_root();
+ if (root == NULL){
+ THROWF (tracing_error, 0, "trying to free all containers, but root is NULL");
+ }
+ recursiveDestroyContainer (root);
rootContainer = NULL;
//checks
static type_t newType (const char *typename, const char *key, const char *color, e_entity_types kind, type_t father)
{
+ if (typename == NULL || key == NULL){
+ THROWF(tracing_error, 0, "can't create a new type with name or key equal NULL");
+ }
+
type_t ret = xbt_new0(s_type_t, 1);
ret->name = xbt_strdup (typename);
ret->father = father;
static type_t recursiveGetType (const char *name, type_t root)
{
+ if (name == NULL || root == NULL){
+ THROWF (tracing_error, 0, "can't get type with a NULL name (or a NULL father given)");
+ }
+
if (strcmp (root->name, name) == 0) return root;
xbt_dict_cursor_t cursor = NULL;
type_t PJ_type_container_new (const char *name, type_t father)
{
+ if (name == NULL){
+ THROWF (tracing_error, 0, "can't create a container type with a NULL name");
+ }
+
type_t ret = (type_t)xbt_dict_get_or_null (allTypes, name);
if (ret){
THROWF(tracing_error, 1, "container type with name %s already exists", name);
type_t PJ_type_event_new (const char *name, const char *color, type_t father)
{
+ if (name == NULL){
+ THROWF (tracing_error, 0, "can't create an event type with a NULL name");
+ }
+
type_t ret = (type_t)xbt_dict_get_or_null (allTypes, name);
if (ret){
THROWF(tracing_error, 1, "event type with name %s already exists", name);
type_t PJ_type_variable_new (const char *name, const char *color, type_t father)
{
+ if (name == NULL){
+ THROWF (tracing_error, 0, "can't create a variable type with a NULL name");
+ }
+
type_t ret = (type_t)xbt_dict_get_or_null (allTypes, name);
if (ret){
THROWF(tracing_error, 1, "variable type with name %s already exists", name);
type_t PJ_type_link_new (const char *name, type_t father, type_t source, type_t dest)
{
+ if (name == NULL){
+ THROWF (tracing_error, 0, "can't create a link type with a NULL name");
+ }
+
type_t ret = (type_t)xbt_dict_get_or_null (allTypes, name);
if (ret){
THROWF(tracing_error, 1, "link type with name %s already exists", name);
type_t PJ_type_state_new (const char *name, type_t father)
{
+ if (name == NULL){
+ THROWF (tracing_error, 0, "can't create a state type with a NULL name");
+ }
+
type_t ret = (type_t)xbt_dict_get_or_null (allTypes, name);
if (ret){
THROWF(tracing_error, 1, "state type with name %s already exists", name);
val_t PJ_value_new (const char *name, const char *color, type_t father)
{
+ if (name == NULL || father == NULL){
+ THROWF (tracing_error, 0, "can't create a value with a NULL name (or a NULL father)");
+ }
+
val_t ret = xbt_new0(s_val_t, 1);
ret->name = xbt_strdup (name);
ret->father = father;
val_t PJ_value_get (const char *name, type_t father)
{
+ if (name == NULL || father == NULL){
+ THROWF (tracing_error, 0, "can't get a value with a NULL name (or a NULL father)");
+ }
+
if (father->kind == TYPE_VARIABLE) return NULL; //Variables can't have different values
val_t ret = (val_t)xbt_dict_get_or_null (father->values, name);
if (ret == NULL){