cgma
|
#include <GroupingEntity.hpp>
Definition at line 52 of file GroupingEntity.hpp.
GroupingEntity::GroupingEntity | ( | ) | [inline] |
Definition at line 166 of file GroupingEntity.hpp.
: myParent(0), nextInParent(0), prevInParent(0), firstSenseEntity(0), lastSenseEntity(0) {}
GroupingEntity::~GroupingEntity | ( | ) | [virtual] |
Definition at line 44 of file GroupingEntity.cpp.
{ if (myParent) myParent->remove_grouping_entity(this); while (firstSenseEntity && remove_sense_entity(firstSenseEntity)); assert (!myParent && !nextInParent && !firstSenseEntity); }
GroupingEntity::GroupingEntity | ( | const GroupingEntity & | ) | [private] |
CubitStatus GroupingEntity::add_sense_entity | ( | SenseEntity * | sense_entity_ptr, |
SenseEntity * | after_this = 0 |
||
) |
Definition at line 92 of file GroupingEntity.cpp.
{ // Check to make sure that we are getting the correct type of // SenseEntity. if ( dag_type() != sense_entity->dag_type().parent() ) return CUBIT_FAILURE ; // Check that the sense entity is not already in some other // grouping entity if ( sense_entity->get_grouping_entity_ptr() ) return CUBIT_FAILURE; // prev and next ptrs should be NULL if sense entity is not // in a grouping entity assert (!sense_entity->next() && !sense_entity->previous()); if (after_this) { if (after_this->get_grouping_entity_ptr() != this ) return CUBIT_FAILURE; if (!sense_entity->gpe_insert_after(after_this)) return CUBIT_FAILURE; if (after_this == lastSenseEntity) lastSenseEntity = sense_entity; } else if (lastSenseEntity) { if (!sense_entity->gpe_insert_after(lastSenseEntity)) return CUBIT_FAILURE; lastSenseEntity = sense_entity; } else { firstSenseEntity = lastSenseEntity = sense_entity; } sense_entity->set_grouping_entity_ptr(this); return CUBIT_SUCCESS; }
CubitStatus GroupingEntity::disconnect_all_children | ( | DLIList< TopologyEntity * > * | children = 0 | ) | [protected, virtual] |
Implements TopologyEntity.
Definition at line 401 of file GroupingEntity.cpp.
{ while (firstSenseEntity) { if (list) list->append(firstSenseEntity); if (!remove_sense_entity(firstSenseEntity)) return CUBIT_FAILURE; } return CUBIT_SUCCESS; }
CubitStatus GroupingEntity::disconnect_all_parents | ( | DLIList< TopologyEntity * > * | parents = 0 | ) | [protected, virtual] |
Implements TopologyEntity.
Definition at line 383 of file GroupingEntity.cpp.
{ if (!myParent) return CUBIT_SUCCESS; if (list) list->append(myParent); return myParent->remove_grouping_entity(this); }
BasicTopologyEntity * GroupingEntity::get_basic_topology_entity_ptr | ( | ) | [inline] |
Definition at line 186 of file GroupingEntity.hpp.
{ return myParent; }
int GroupingEntity::get_children | ( | DLIList< TopologyEntity * > * | list = 0 | ) | const [virtual] |
Implements TopologyEntity.
Definition at line 335 of file GroupingEntity.cpp.
{ if (!firstSenseEntity) return 0; int count = 0; for (SenseEntity* ptr = firstSenseEntity; ptr; ptr = ptr->next() ) { assert(ptr->get_grouping_entity_ptr() == this); if(list) list->append(ptr); count++; } return count; }
SenseEntity * GroupingEntity::get_first_sense_entity_ptr | ( | ) | [inline] |
Definition at line 174 of file GroupingEntity.hpp.
{ return firstSenseEntity; }
SenseEntity * GroupingEntity::get_last_sense_entity_ptr | ( | ) | [inline] |
Definition at line 177 of file GroupingEntity.hpp.
{ return lastSenseEntity; }
int GroupingEntity::get_parents | ( | DLIList< TopologyEntity * > * | list = 0 | ) | const [virtual] |
Implements TopologyEntity.
Definition at line 315 of file GroupingEntity.cpp.
CubitStatus GroupingEntity::get_sense_entity_list | ( | DLIList< SenseEntity * > & | list | ) |
Definition at line 63 of file GroupingEntity.cpp.
{ if (!firstSenseEntity) return CUBIT_SUCCESS; for (SenseEntity* ptr = firstSenseEntity; ptr; ptr = ptr->next()) { assert(ptr->get_grouping_entity_ptr() == this); list.append(ptr); } return CUBIT_SUCCESS; }
CubitStatus GroupingEntity::insert_after | ( | GroupingEntity * | next | ) | [inline, private] |
Definition at line 199 of file GroupingEntity.hpp.
{ prevInParent = next_ptr; nextInParent = next_ptr->nextInParent; if (nextInParent) nextInParent->prevInParent = this; next_ptr->nextInParent = this; return CUBIT_SUCCESS; }
CubitStatus GroupingEntity::insert_before | ( | GroupingEntity * | prev | ) | [inline, private] |
Definition at line 209 of file GroupingEntity.hpp.
{ nextInParent = prev_ptr; prevInParent = prev_ptr->prevInParent; if (prevInParent) prevInParent->nextInParent = this; prev_ptr->prevInParent = this; return CUBIT_SUCCESS; }
GroupingEntity * GroupingEntity::next | ( | ) | [inline] |
Definition at line 180 of file GroupingEntity.hpp.
{ return nextInParent; }
void GroupingEntity::operator= | ( | const GroupingEntity & | ) | [private] |
GroupingEntity * GroupingEntity::previous | ( | ) | [inline] |
Definition at line 183 of file GroupingEntity.hpp.
{ return prevInParent; }
CubitBoolean GroupingEntity::query_append_children | ( | DLIList< TopologyEntity * > & | list | ) | [protected, virtual] |
Implements TopologyEntity.
Definition at line 432 of file GroupingEntity.cpp.
{ ModelQueryEngine *const mqe = ModelQueryEngine::instance(); CubitBoolean found_some = CUBIT_FALSE; if (!firstSenseEntity) return CUBIT_FALSE; for (SenseEntity* ptr = firstSenseEntity; ptr; ptr = ptr->next()) { if (!mqe->encountered(ptr)) { list.append(ptr); found_some = CUBIT_TRUE; } } return found_some; }
CubitBoolean GroupingEntity::query_append_parents | ( | DLIList< TopologyEntity * > & | list | ) | [protected, virtual] |
Implements TopologyEntity.
Definition at line 422 of file GroupingEntity.cpp.
{ if (myParent && !ModelQueryEngine::instance()->encountered(myParent)) { list.append(myParent); return CUBIT_TRUE; } return CUBIT_FALSE; }
CubitStatus GroupingEntity::remove_child_link | ( | TopologyEntity * | child_ptr | ) | [protected, virtual] |
Implements TopologyEntity.
Definition at line 365 of file GroupingEntity.cpp.
{ SenseEntity* se = dynamic_cast<SenseEntity*>(child_ptr); if (!se) return CUBIT_FAILURE; return remove_sense_entity(se); }
CubitStatus GroupingEntity::remove_from_list | ( | ) | [inline, private] |
Definition at line 189 of file GroupingEntity.hpp.
{ if (nextInParent) nextInParent->prevInParent = prevInParent; if (prevInParent) prevInParent->nextInParent = nextInParent; prevInParent = nextInParent = 0; return CUBIT_SUCCESS; }
CubitStatus GroupingEntity::remove_sense_entity | ( | SenseEntity * | sense_entity_ptr | ) |
Definition at line 145 of file GroupingEntity.cpp.
{ if (sense_entity_ptr->get_grouping_entity_ptr() != this) return CUBIT_FAILURE; if (firstSenseEntity == sense_entity_ptr) firstSenseEntity = sense_entity_ptr->next(); if (lastSenseEntity == sense_entity_ptr) lastSenseEntity = sense_entity_ptr->previous(); sense_entity_ptr->gpe_remove(); sense_entity_ptr->set_grouping_entity_ptr(NULL); return CUBIT_SUCCESS; }
void GroupingEntity::reverse_direction | ( | ) |
Definition at line 283 of file GroupingEntity.cpp.
{ SenseEntity* ptr; if (!firstSenseEntity) return; // For each child sense entity for (ptr = firstSenseEntity; ptr; ptr = ptr->previous()) { // change linked list pointers ptr->swap_gpe_list_ptrs(); // change sense ptr->reverse_sense(); } // Change first pointer the old last entity // (Preserves order as returnd by old DLIList rep and // makes this work to reverse a chain.) ptr = firstSenseEntity; firstSenseEntity = lastSenseEntity; lastSenseEntity = ptr; }
void GroupingEntity::set_basic_topology_entity_ptr | ( | BasicTopologyEntity * | bte_ptr | ) | [inline, private] |
Definition at line 219 of file GroupingEntity.hpp.
CubitStatus GroupingEntity::set_sense_entity_list | ( | DLIList< SenseEntity * > & | list, |
DLIList< SenseEntity * > & | removed | ||
) |
Definition at line 169 of file GroupingEntity.cpp.
{ int i; // Remove all? if (list.size() == 0) { get_sense_entity_list( removed ); return disconnect_all_children(); } // Check for error conditions before modifying anything list.reset(); for (i = list.size(); i--; ) { SenseEntity* sense_entity = list.get_and_step(); // Check to make sure that we are getting the correct type of // SenseEntity. if ( dag_type() != sense_entity->dag_type().parent() ) return CUBIT_FAILURE ; // Check that the sense entity is not already in some other // grouping entity if ( sense_entity->get_grouping_entity_ptr() && sense_entity->get_grouping_entity_ptr() != this ) return CUBIT_FAILURE; } // Special case for first entity in list. list.reset(); SenseEntity* new_first = list.get_and_step(); // No sense entities currently attached... if (!firstSenseEntity) { firstSenseEntity = lastSenseEntity = new_first; new_first->set_grouping_entity_ptr(this); } // Already attached, but not first in list... else if( firstSenseEntity != new_first ) { if (!new_first->get_grouping_entity_ptr()) new_first->set_grouping_entity_ptr(this); else { if (lastSenseEntity == new_first) lastSenseEntity = new_first->previous(); new_first->gpe_remove(); } new_first->gpe_insert_before(firstSenseEntity); firstSenseEntity = new_first; } // Now loop through remaining sense entities. SenseEntity* prev = new_first; for (i = list.size() - 1; i--; ) { SenseEntity* curr = list.get_and_step(); // If next sense entity in input list is not // next sense entity in this GroupingEntity... if (prev->next() != curr) { if (!curr->get_grouping_entity_ptr()) curr->set_grouping_entity_ptr(this); else { if (lastSenseEntity == curr) lastSenseEntity = curr->previous(); curr->gpe_remove(); } curr->gpe_insert_after(prev); } // update lastSenseEntity if necessary... if (lastSenseEntity == prev) lastSenseEntity = curr; // iterate prev = curr; } // Disconnect any sense entities in this GroupingEntity // that were not in in the input list (they should now // be at the end of the list of sense entities in this) // and pass them back in the 'removed' list. CubitStatus result = CUBIT_SUCCESS; while (prev != lastSenseEntity) { removed.append(prev->next()); if (!remove_sense_entity(prev->next())) { assert(0); result = CUBIT_FAILURE; prev = prev->next(); } } return result; }
friend class BasicTopologyEntity [friend] |
Definition at line 145 of file GroupingEntity.hpp.
SenseEntity* GroupingEntity::firstSenseEntity [private] |
Definition at line 154 of file GroupingEntity.hpp.
SenseEntity* GroupingEntity::lastSenseEntity [private] |
Definition at line 155 of file GroupingEntity.hpp.
BasicTopologyEntity* GroupingEntity::myParent [private] |
Definition at line 151 of file GroupingEntity.hpp.
GroupingEntity* GroupingEntity::nextInParent [private] |
Definition at line 152 of file GroupingEntity.hpp.
GroupingEntity* GroupingEntity::prevInParent [private] |
Definition at line 153 of file GroupingEntity.hpp.