📄 gpr_replica_class_instances.h
字号:
{ if (NULL != ptr->requestor) free(ptr->requestor);}/* define instance of opal_class_t */OBJ_CLASS_INSTANCE( orte_gpr_replica_requestor_t, /* type name */ opal_object_t, /* parent "class" name */ orte_gpr_replica_requestor_construct, /* constructor */ orte_gpr_replica_requestor_destructor); /* destructor *//* SUBSCRIPTION *//* constructor - used to initialize state of subscription instance */static void orte_gpr_replica_subscription_construct(orte_gpr_replica_subscription_t* sub){ sub->index = 0; sub->idtag = ORTE_GPR_SUBSCRIPTION_ID_MAX; sub->name = NULL; sub->active = false; sub->processing = false; sub->cleanup = false; sub->action = ORTE_GPR_REPLICA_NO_ACTION; sub->num_values = 0; orte_pointer_array_init(&(sub->values), (orte_std_cntr_t)orte_gpr_array_block_size, (orte_std_cntr_t)orte_gpr_array_max_size, (orte_std_cntr_t)orte_gpr_array_block_size); sub->num_requestors = 0; orte_pointer_array_init(&(sub->requestors), (orte_std_cntr_t)orte_gpr_array_block_size, (orte_std_cntr_t)orte_gpr_array_max_size, (orte_std_cntr_t)orte_gpr_array_block_size);}/* destructor - used to free any resources held by instance */static void orte_gpr_replica_subscription_destructor(orte_gpr_replica_subscription_t* sub){ orte_gpr_replica_requestor_t **ptr; orte_gpr_replica_ivalue_t **ivals; orte_std_cntr_t i, k; if (NULL != sub->name) free(sub->name); if (NULL != sub->requestors) { ptr = (orte_gpr_replica_requestor_t**)((sub->requestors)->addr); for (i=0, k=0; k < sub->num_requestors && i < (sub->requestors)->size; i++) { if (NULL != ptr[i]) { k++; OBJ_RELEASE(ptr[i]); } } OBJ_RELEASE(sub->requestors); } if (NULL != sub->values) { ivals = (orte_gpr_replica_ivalue_t**)((sub->values)->addr); for (i=0, k=0; k < sub->num_values && i < (sub->values)->size; i++) { if (NULL != ivals[i]) { k++; OBJ_RELEASE(ivals[i]); } } OBJ_RELEASE(sub->values); }}/* define instance of opal_class_t */OBJ_CLASS_INSTANCE( orte_gpr_replica_subscription_t, /* type name */ opal_object_t, /* parent "class" name */ orte_gpr_replica_subscription_construct, /* constructor */ orte_gpr_replica_subscription_destructor); /* destructor *//* TRIGGER REQUESTOR *//* constructor - used to initialize state of instance */static void orte_gpr_replica_trigger_requestor_construct(orte_gpr_replica_trigger_requestor_t* ptr){ ptr->index = 0; ptr->idtag = ORTE_GPR_TRIGGER_ID_MAX; ptr->requestor = NULL; ptr->idtag = 0;}/* destructor - used to free any resources held by instance */static void orte_gpr_replica_trigger_requestor_destructor(orte_gpr_replica_trigger_requestor_t* ptr){ if (NULL != ptr->requestor) free(ptr->requestor);}/* define instance of opal_class_t */OBJ_CLASS_INSTANCE( orte_gpr_replica_trigger_requestor_t, /* type name */ opal_object_t, /* parent "class" name */ orte_gpr_replica_trigger_requestor_construct, /* constructor */ orte_gpr_replica_trigger_requestor_destructor); /* destructor *//* TRIGGER *//* constructor - used to initialize state of trigger instance */static void orte_gpr_replica_trigger_construct(orte_gpr_replica_trigger_t* trig){ trig->name = NULL; trig->index = 0; trig->idtag = ORTE_GPR_TRIGGER_ID_MAX; trig->num_attached = 0; orte_pointer_array_init(&(trig->attached), (orte_std_cntr_t)orte_gpr_array_block_size, (orte_std_cntr_t)orte_gpr_array_max_size, (orte_std_cntr_t)orte_gpr_array_block_size); trig->master = NULL;; trig->action = ORTE_GPR_REPLICA_NO_ACTION; trig->one_shot_fired = false; trig->processing = false; trig->num_counters = 0; orte_pointer_array_init(&(trig->counters), (orte_std_cntr_t)orte_gpr_array_block_size, (orte_std_cntr_t)orte_gpr_array_max_size, (orte_std_cntr_t)orte_gpr_array_block_size); trig->num_subscriptions = 0; orte_pointer_array_init(&(trig->subscriptions), (orte_std_cntr_t)orte_gpr_array_block_size, (orte_std_cntr_t)orte_gpr_array_max_size, (orte_std_cntr_t)orte_gpr_array_block_size);}/* destructor - used to free any resources held by instance */static void orte_gpr_replica_trigger_destructor(orte_gpr_replica_trigger_t* trig){ orte_std_cntr_t i, cnt; orte_gpr_replica_counter_t **cntrs; orte_gpr_replica_trigger_requestor_t **att; if (NULL != trig->name) { free(trig->name); } /* must go through the array of atached and release * the memory for each one prior to releasing the array */ if (NULL != trig->attached) { att = (orte_gpr_replica_trigger_requestor_t**)((trig->attached)->addr); cnt = 0; for (i=0; cnt < trig->num_attached && i < (trig->attached)->size; i++) { if (NULL != att[i]) { cnt++; OBJ_RELEASE(att[i]); } } OBJ_RELEASE(trig->attached); } /* must go through the array of counters and release * the memory for each one prior to releasing the array */ if (NULL != trig->counters) { cntrs = (orte_gpr_replica_counter_t**)((trig->counters)->addr); cnt = 0; for (i=0; cnt < trig->num_counters && i < (trig->counters)->size; i++) { if (NULL != cntrs[i]) { cnt++; OBJ_RELEASE(cntrs[i]); } } OBJ_RELEASE(trig->counters); } /* the array of subscriptions is separately maintained, so we * do NOT release the subscription memory here. We only release * the array of pointers we were using to reference into the * subscription array */ if (NULL != trig->subscriptions) { OBJ_RELEASE(trig->subscriptions); }}/* define instance of opal_class_t */OBJ_CLASS_INSTANCE( orte_gpr_replica_trigger_t, /* type name */ opal_object_t, /* parent "class" name */ orte_gpr_replica_trigger_construct, /* constructor */ orte_gpr_replica_trigger_destructor); /* destructor *//* ACTION_TAKEN *//* constructor - used to initialize state of action_take instance */static void orte_gpr_replica_action_taken_construct(orte_gpr_replica_action_taken_t* ptr){ ptr->action = ORTE_GPR_REPLICA_NO_ACTION; ptr->seg = NULL; ptr->cptr = NULL; ptr->iptr = NULL;}/* destructor - used to free any resources held by instance */static void orte_gpr_replica_action_taken_destructor(orte_gpr_replica_action_taken_t* ptr){ /* since we did a "RETAIN" on the objects pointed to by this object, * we need to "RELEASE" them to indicate we are done with them */ if (NULL != ptr->seg) OBJ_RELEASE(ptr->seg); if (NULL != ptr->cptr) OBJ_RELEASE(ptr->cptr); if (NULL != ptr->iptr) OBJ_RELEASE(ptr->iptr);}/* define instance of opal_class_t */OBJ_CLASS_INSTANCE( orte_gpr_replica_action_taken_t, /* type name */ opal_object_t, /* parent "class" name */ orte_gpr_replica_action_taken_construct, /* constructor */ orte_gpr_replica_action_taken_destructor); /* destructor *//* CALLBACKS *//* constructor - used to initialize state of callback list instance */static void orte_gpr_replica_callbacks_construct(orte_gpr_replica_callbacks_t* cb){ cb->message = NULL; cb->requestor = NULL;}/* destructor - used to free any resources held by instance */static void orte_gpr_replica_callbacks_destructor(orte_gpr_replica_callbacks_t* cb){ if (NULL != cb->message) OBJ_RELEASE(cb->message); if (NULL != cb->requestor) { free(cb->requestor); }}/* define instance of opal_class_t */OBJ_CLASS_INSTANCE( orte_gpr_replica_callbacks_t, /* type name */ opal_list_item_t, /* parent "class" name */ orte_gpr_replica_callbacks_construct, /* constructor */ orte_gpr_replica_callbacks_destructor); /* destructor *//* REPLICA LIST - NOT IMPLEMENTED YET! *//* constructor - used to initialize state of replica list instance */static void orte_gpr_replica_list_construct(orte_gpr_replica_list_t* replica){ replica->replica = NULL;}/* destructor - used to free any resources held by instance */static void orte_gpr_replica_list_destructor(orte_gpr_replica_list_t* replica){ if (NULL != replica->replica) { free(replica->replica); replica->replica = NULL; }}/* define instance of opal_class_t */OBJ_CLASS_INSTANCE( orte_gpr_replica_list_t, /* type name */ opal_list_item_t, /* parent "class" name */ orte_gpr_replica_list_construct, /* constructor */ orte_gpr_replica_list_destructor); /* destructor *//* WRITE INVALIDATE - NOT IMPLEMENTED YET! *//* define instance of opal_class_t */OBJ_CLASS_INSTANCE( orte_gpr_replica_write_invalidate_t, /* type name */ opal_list_item_t, /* parent "class" name */ NULL, /* constructor */ NULL); /* destructor */#endif /* _GPR_REPLICA_CLASS_INSTANCES_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -