cgma
TDCAGE Class Reference

#include <TDCAGE.hpp>

Inheritance diagram for TDCAGE:
ToolData

List of all members.

Public Member Functions

 TDCAGE (int unique_id)
 ~TDCAGE ()
int unique_id ()
void unique_id (int id)
 SetDynamicMemoryAllocation (memoryManager) static void set_memory_allocation_increment(int increment=0)
int td_sequence_number (const RefGroup *group)
void insert_group (RefGroup *group, const int seq_num)
void initialize_group_sequence_list (RefEntity *entity)

Static Public Member Functions

static int is_cage (const ToolData *td)
static void destroy_memory ()
static int group_sequence_number (RefGroup *group, const RefEntity *entity)
static void insert_entity (RefEntity *entity, const int seq_num, RefGroup *into_group)

Private Attributes

int uniqueId
DLIList< RefGroup * > groupList
DLIList< int > sequenceList

Static Private Attributes

static MemoryManager memoryManager

Detailed Description

Definition at line 18 of file TDCAGE.hpp.


Constructor & Destructor Documentation

TDCAGE::TDCAGE ( int  unique_id) [inline]

Definition at line 74 of file TDCAGE.hpp.

TDCAGE::~TDCAGE ( ) [inline]

Definition at line 79 of file TDCAGE.hpp.

{
  //- empty
}

Member Function Documentation

static void TDCAGE::destroy_memory ( ) [inline, static]

Definition at line 52 of file TDCAGE.hpp.

int TDCAGE::group_sequence_number ( RefGroup group,
const RefEntity entity 
) [static]

Definition at line 74 of file TDCAGE.cpp.

{
    //- return the sequence number of the given entity in the given group

    // built for speed; don't accumulate index, use loop counter for that
  group->entityList.reset();
  for (int i = group->entityList.size(); i > 0; i--) {
    if (group->entityList.get_and_step() == entity)
        // index in reverse direction, so subtract to get real index
      return group->entityList.size() - i;
  }
  
  return -1;
}

Definition at line 89 of file TDCAGE.cpp.

{
    //- get the groups owning entity and build the sequence lists
  DLIList<RefGroup*> ref_groups;
  RefGroup::get_groups_within(entity, ref_groups, CUBIT_FALSE);

  groupList.clean_out();
  sequenceList.clean_out();
  
  for (int i = ref_groups.size(); i > 0; i--) {
    RefGroup *ref_group = ref_groups.get_and_step();
    groupList.append(ref_group);
    sequenceList.append(group_sequence_number(ref_group, entity));
  }
}
void TDCAGE::insert_entity ( RefEntity entity,
const int  seq_num,
RefGroup into_group 
) [static]

Definition at line 29 of file TDCAGE.cpp.

{
    //- insert the entity into the group following the sequence number
    //- given
  TDCAGE *td_cage;
  CubitBoolean inserted = CUBIT_FALSE;
  DLIList<RefEntity*> copy_group_list;
  copy_group_list = into_group->entityList;
  
  into_group->entityList.last();
  for (int i = into_group->entityList.size(); i > 0; i--) {
    RefEntity *into_entity = into_group->entityList.get();
    td_cage = (TDCAGE *) into_entity->get_TD(&TDCAGE::is_cage);
    if (td_cage && td_cage->td_sequence_number(into_group) < seq_num) {
      if ( !copy_group_list.move_to(entity) )
        into_group->entityList.insert(entity);
      inserted = CUBIT_TRUE;
      break;
    }
    else into_group->entityList.back();
  }
  
    // if we got here and didn't insert, either the list is empty
    // or it isn't and our seq_num is less than all items; either
    // way, we insert at beginning
  if (inserted == CUBIT_FALSE){
      if ( !copy_group_list.move_to(entity) )
        into_group->entityList.insert_first(entity);
  }

    // now register the observable entity in the group
  into_group->register_observable(entity);

    // now, make sure the inserted entity has a td_cage and this group
    // and seq number are registered
  td_cage = (TDCAGE *) entity->get_TD(&TDCAGE::is_cage);
  if (!td_cage) {
    td_cage = new TDCAGE(-1);
    entity->add_TD(td_cage);
  }
  
  td_cage->insert_group(into_group, seq_num);
}
void TDCAGE::insert_group ( RefGroup group,
const int  seq_num 
) [inline]

Definition at line 84 of file TDCAGE.hpp.

{
  groupList.append(group);
  sequenceList.append(seq_num);
}
int TDCAGE::is_cage ( const ToolData td) [static]

Definition at line 7 of file TDCAGE.cpp.

{
  return (CAST_TO(const_cast<ToolData*>(td), TDCAGE) != NULL);
}
TDCAGE::SetDynamicMemoryAllocation ( memoryManager  ) [inline, pure virtual]

Definition at line 45 of file TDCAGE.hpp.

int TDCAGE::td_sequence_number ( const RefGroup group)

Definition at line 13 of file TDCAGE.cpp.

{
    // go through the group list and get the sequence number;
    // return -1 if the group isn't in the list

  groupList.reset();
  sequenceList.reset();
  for (int i = groupList.size(); i > 0; i--) {
    if (group == groupList.get_and_step()) return sequenceList.get();

    else sequenceList.step();
  }
  
  return -1;
}
int TDCAGE::unique_id ( ) [inline]

Definition at line 41 of file TDCAGE.hpp.

{return uniqueId;}
void TDCAGE::unique_id ( int  id) [inline]

Definition at line 42 of file TDCAGE.hpp.

{uniqueId = id;}

Member Data Documentation

Definition at line 27 of file TDCAGE.hpp.

Definition at line 22 of file TDCAGE.hpp.

DLIList<int> TDCAGE::sequenceList [private]

Definition at line 30 of file TDCAGE.hpp.

int TDCAGE::uniqueId [private]

Definition at line 25 of file TDCAGE.hpp.


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