cgma
CAEntityName Class Reference

#include <CAEntityName.hpp>

Inheritance diagram for CAEntityName:
CubitAttrib

List of all members.

Public Member Functions

virtual ~CAEntityName ()
 CAEntityName (RefEntity *, const CubitSimpleAttrib &)
CubitStatus actuate ()
CubitStatus update ()
CubitStatus reset ()
CubitSimpleAttrib split_owner ()
void merge_owner (CubitAttrib *deletable_attrib)
CubitSimpleAttrib cubit_simple_attrib ()
int int_attrib_type ()
void print ()

Private Attributes

DLIList< CubitStringentityNames

Detailed Description

Definition at line 17 of file CAEntityName.hpp.


Constructor & Destructor Documentation

Definition at line 50 of file CAEntityName.cpp.

{
  PRINT_DEBUG_94("Deleting ENTITY_NAME attribute\n");
}
CAEntityName::CAEntityName ( RefEntity new_attrib_owner,
const CubitSimpleAttrib csa_ptr 
)

Definition at line 19 of file CAEntityName.cpp.

        : CubitAttrib(new_attrib_owner)
{
  if(!csa_ptr.isEmpty())
  {
    PRINT_DEBUG_94( "Creating ENTITY_NAME attribute from CSA for %s %d\n",
                (attribOwnerEntity ? attribOwnerEntity->class_name() : "(none)"),
                (attribOwnerEntity ? attribOwnerEntity->id() : 0));

    const std::vector<CubitString>& cs_list = csa_ptr.string_data_list();

      // step over the attribute type

      // now read name / option pairs
    for (size_t i = 1; i<cs_list.size(); i++)
    {
      CubitString cs = cs_list[i];
      if (cs.length() == 0)
        PRINT_WARNING("Empty name attribute for %s %d.\n",
                      attribOwnerEntity->class_name(),
                      attribOwnerEntity->id());
      else
        entityNames.append(cs);
    }

    if (entityNames.size() == 0)
      deleteAttrib = CUBIT_TRUE;
  }
}

Member Function Documentation

Implements CubitAttrib.

Definition at line 159 of file CAEntityName.cpp.

{
  PRINT_DEBUG_94("CAEntityName::cubit_simple_attrib()\n");
  
  std::vector<CubitString> cs_list;

    // pack the string list:
    // character type of this CA
  cs_list.push_back(att_internal_name());

    // name, option pairs
  int i;
  for ( i = entityNames.size(); i > 0; i--) {
    cs_list.push_back(entityNames.get_and_step());
  }

  return CubitSimpleAttrib(&cs_list, NULL, NULL);
}
int CAEntityName::int_attrib_type ( ) [inline, virtual]

Implements CubitAttrib.

Definition at line 43 of file CAEntityName.hpp.

{return CA_ENTITY_NAME;}
void CAEntityName::merge_owner ( CubitAttrib deletable_attrib) [virtual]

Reimplemented from CubitAttrib.

Definition at line 144 of file CAEntityName.cpp.

{
    // if this entity is to be merged, copy names over from deletable entity
  CAEntityName *caen_ptr = CAST_TO(deletable_attrib, CAEntityName);
  if (caen_ptr)
  {
    DLIList<CubitString> &other_names = caen_ptr->entityNames;
    other_names.reset();
    for (int i = other_names.size(); i--; )
    {
      entityNames.append(other_names.get_and_step());
    }
  }
}
void CAEntityName::print ( ) [virtual]

Reimplemented from CubitAttrib.

Definition at line 179 of file CAEntityName.cpp.

{
    // print info on this attribute
  entityNames.reset();
  
  PRINT_INFO("CAEntityName: owner = %s %d; names: ",
             attribOwnerEntity->class_name(), attribOwnerEntity->id());
  for (int i = entityNames.size(); i > 0; i--)
    PRINT_INFO("%s ", entityNames.get_and_step().c_str());

  PRINT_INFO("\n");
}

Implements CubitAttrib.

Definition at line 120 of file CAEntityName.cpp.

{
  PRINT_DEBUG_94("CAEntityName::reset()\n");
  
  //- reset function, cleans out name list
  entityNames.clean_out();

    // need to reset hasUpdated flag too, so next update will do something
  hasUpdated = CUBIT_FALSE;
  return CUBIT_SUCCESS;
}

Reimplemented from CubitAttrib.

Definition at line 132 of file CAEntityName.cpp.

{
    // if this entity is to be split, pass back a simple attribute with
    // duplicate name data to be put on new entity
  PRINT_DEBUG_94("CAEntityName::split_owner()\n");
  update();
  if( deleteAttrib )
    return CubitSimpleAttrib();
  else
    return cubit_simple_attrib();
}

Implements CubitAttrib.

Definition at line 74 of file CAEntityName.cpp.

{
  if (hasUpdated) return CUBIT_SUCCESS;
  
  PRINT_DEBUG_94( "Updating ENTITY_NAME attribute for %s %d\n",
              attribOwnerEntity->class_name(), attribOwnerEntity->id());

    // set the updated flag
  hasUpdated = CUBIT_TRUE;

    // first, remove this attrib in its old form from the geometry entity
  if (hasWritten == CUBIT_TRUE) {
    attribOwnerEntity->remove_attrib_geometry_entity(this);
    hasWritten = CUBIT_FALSE;
  }
  
  DLIList<CubitString> names;
  int num_names = RefEntityName::instance()->
      get_refentity_name(attribOwnerEntity,names);
  if( num_names == 0)
  {
    delete_attrib(CUBIT_TRUE);
    return CUBIT_SUCCESS;
  }
  else
  {
      // get the names; since RefEntityName passes back pointers to
      // its own strings, create new ones here
    int i;

      // first, delete all the old names on the list
    entityNames.clean_out();
    
    for (i = names.size(); i > 0; i--) {
      entityNames.append(names.get_and_step());
    }
    
      // reset the delete flag if it was set before
    delete_attrib(CUBIT_FALSE);
    
      // now, write to geometry entity
    attribOwnerEntity->write_specific_cubit_attrib(this);
  }
  return CUBIT_SUCCESS;
}

Member Data Documentation

Definition at line 21 of file CAEntityName.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines