cgma
ModelEntity Class Reference

#include <ModelEntity.hpp>

List of all members.

Public Member Functions

 ModelEntity ()
virtual ~ModelEntity ()
virtual int get_children (DLIList< ModelEntity * > *list=0) const =0
virtual int get_parents (DLIList< ModelEntity * > *list=0) const =0
virtual DagType dag_type () const =0
void deactivated (CubitBoolean flag)
CubitBoolean deactivated () const
CubitStatus remove_from_DAG (CubitBoolean recursive_flag=CUBIT_FALSE)
void disconnect_from_DAG ()
virtual CubitStatus remove_child_link (ModelEntity *child_ptr)=0
virtual CubitStatus disconnect_all_children (DLIList< ModelEntity * > *children=0)=0
virtual CubitStatus disconnect_all_parents (DLIList< ModelEntity * > *parents=0)=0

Protected Member Functions

virtual CubitBoolean query_append_parents (DLIList< ModelEntity * > &list)=0
virtual CubitBoolean query_append_children (DLIList< ModelEntity * > &list)=0

Protected Attributes

cBit deactivatedStatus_: 1
cBit encountered_: 1

Private Member Functions

ModelEntity const & operator= (ModelEntity const &aModEnt)
 ModelEntity (const ModelEntity &aModEnt)

Friends

class ModelQueryEngine
class GroupingEntity

Detailed Description

Definition at line 56 of file ModelEntity.hpp.


Constructor & Destructor Documentation

Definition at line 81 of file ModelEntity.cpp.

{
     // Make sure that the ModelEntity class does not have a pointer to this
     // ModelEntity in its list.  If it does, then remove the instances
     // of the pointer
   DAG::instance()->remove(this);
  
}
ModelEntity::ModelEntity ( const ModelEntity aModEnt) [private]

Member Function Documentation

virtual DagType ModelEntity::dag_type ( ) const [pure virtual]

Definition at line 209 of file ModelEntity.cpp.

{
   if (deactivatedStatus_ != flag)
   {
     deactivatedStatus_ = flag ;
     if (flag == CUBIT_TRUE)
     {
        DAG::instance()->add_deactivated_DAG_node(this) ;
     }
     else
     {
        DAG::instance()->remove_deactivated_DAG_node(this) ;
     }
   }
}

Definition at line 225 of file ModelEntity.cpp.

virtual CubitStatus ModelEntity::disconnect_all_children ( DLIList< ModelEntity * > *  children = 0) [pure virtual]
virtual CubitStatus ModelEntity::disconnect_all_parents ( DLIList< ModelEntity * > *  parents = 0) [pure virtual]

Definition at line 190 of file ModelEntity.cpp.

{
    // disconnects this entity from any others
    // to which it is connected in the DAG; does not delete the DAGNode

  disconnect_all_children();
  disconnect_all_parents();
}
virtual int ModelEntity::get_children ( DLIList< ModelEntity * > *  list = 0) const [pure virtual]
virtual int ModelEntity::get_parents ( DLIList< ModelEntity * > *  list = 0) const [pure virtual]
ModelEntity const& ModelEntity::operator= ( ModelEntity const &  aModEnt) [private]
virtual CubitBoolean ModelEntity::query_append_children ( DLIList< ModelEntity * > &  list) [protected, pure virtual]
virtual CubitBoolean ModelEntity::query_append_parents ( DLIList< ModelEntity * > &  list) [protected, pure virtual]
virtual CubitStatus ModelEntity::remove_child_link ( ModelEntity child_ptr) [pure virtual]

Definition at line 106 of file ModelEntity.cpp.

{
     // This counter will be used in the recursion to test whether
     // the call is from outside or from the function itself. When
     // the call comes from outside, the counter should always be
     // zero.

  CubitBoolean this_recurse = recurse_flag;
  if (recurse_flag == CUBIT_FALSE) recurse_flag = CUBIT_TRUE;
  
  DLIList<ModelEntity*> childModEntList;
   
     // Check to see if there are no parents of this object. 
   if ( get_parents() == 0 )
   {
      if (this_recurse == CUBIT_FALSE)
      {
         // Since we are not recursing, this is a top-level entity.
         // Notify the static observers that a top-level entity is being
         // destructed.  This must be done before children are disconnected.
       CubitObservable *top_level = CAST_TO(this, CubitObservable);
       AppUtil::instance()->send_event(top_level, TOP_LEVEL_ENTITY_DESTRUCTED);
      }

        // Go through all the children and remove their link to
        // the current object.
      
      ModelEntity* tempModEntPtr = NULL ;
      ModelEntity* childModEntPtr = NULL ;
      
      childModEntList.clean_out();
      disconnect_all_children(&childModEntList);
      
        // The following while conditional may not work...it depends on
        // what is_at_end does when you step over the end...CHECK THIS
      int i;
      for( i = 0 ; i < childModEntList.size() ; i++ )
      {
           // Get the next ModelEnti in the child list and make sure its
           // pointer to its parent is removed.
         tempModEntPtr = childModEntList.get_and_step();
          
           // Try remove() on the child ModEnt. If it comes back with
           // a success, then delete it.
         childModEntPtr = tempModEntPtr;
         
         if ( childModEntPtr->remove_from_DAG(recurse_flag) == CUBIT_SUCCESS )
         {
              // Now deactivate the child ModEnt
            childModEntPtr->deactivated(CUBIT_TRUE) ;

              // remove it from observables, just before we go to delete it
            CubitObservable *observable = CAST_TO(childModEntPtr, CubitObservable);
            if (observable) 
            {
              AppUtil::instance()->send_event(observable, MODEL_ENTITY_DESTRUCTED );
            }
         }
      }
      
      
        // If this is the top of the recursion, then clean out all the deactivated
        // entities.
      if (this_recurse == CUBIT_FALSE)
      {
         this->deactivated(CUBIT_TRUE) ;

         // remove it from observables, just before we go to delete it
         CubitObservable *observable = CAST_TO(childModEntPtr, CubitObservable);
         if (observable) 
         {
           AppUtil::instance()->send_event(observable, MODEL_ENTITY_DESTRUCTED );
         }
         GeometryQueryTool::instance()->cleanout_deactivated_geometry() ;
      }
      
      return CUBIT_SUCCESS ;
   }
   else
   {
      return CUBIT_FAILURE ;
   }
}

Friends And Related Function Documentation

friend class GroupingEntity [friend]

Definition at line 62 of file ModelEntity.hpp.

friend class ModelQueryEngine [friend]

Definition at line 61 of file ModelEntity.hpp.


Member Data Documentation

Definition at line 98 of file ModelEntity.hpp.

Definition at line 101 of file ModelEntity.hpp.


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