Exemple #1
0
CubitStatus CAUniqueId::actuate()
{

  if (hasActuated == CUBIT_TRUE) return CUBIT_SUCCESS;

    // create a TDUniqueId for the entity, if it doesn't already
    // exist
  TDUniqueId *uid = (TDUniqueId *) attrib_owner()->get_TD(&TDUniqueId::is_unique_id);

  if (uid != NULL) {
      // check to make sure it's the same unique id
    if (uid->unique_id() != uniqueId) {
      PRINT_ERROR("Different unique id found for %s %d.\n",
                  attrib_owner()->class_name(), attrib_owner()->id());
      return CUBIT_FAILURE;
    }
  }
  else {
      // else make a new one
    uid = new TDUniqueId(attrib_owner(), uniqueId);
  }
  
  delete_attrib(CUBIT_TRUE);
  hasActuated = CUBIT_TRUE;
  
  return CUBIT_SUCCESS;
}
Exemple #2
0
int TDUniqueId::get_unique_id(ToolDataUser *owner,
                              const CubitBoolean create_new)
{
  assert(owner != 0);
  TDUniqueId *uid = (TDUniqueId *) owner->get_TD(&TDUniqueId::is_unique_id);
  if (!uid && create_new == CUBIT_TRUE) {
    uid = new TDUniqueId(owner);
  }

  return (uid ? uid->unique_id() : 0);
}