cgma
DAG.hpp
Go to the documentation of this file.
00001 //-------------------------------------------------------------------------
00002 // Copyright Notice
00003 //
00004 // Copyright (c) 1996 
00005 // by Malcolm J. Panthaki, DBA, and the University of New Mexico.
00006 //-------------------------------------------------------------------------
00007 
00008 //-------------------------------------------------------------------------
00009 // Filename      : DAG.hpp
00010 //
00011 // Purpose       : The DAG class performs general operations related
00012 //                 to DAGs and TopologyEntitys. Its current functionalities:
00013 //                   1)Maintain a list of deactivated TopologyEntitys
00014 //       Note: The "nodes" of the DAG are type TopologyEntity.
00015 //
00016 // Special Notes : The class is a singleton.
00017 //
00018 // Creator       : Raikanta Sahu
00019 //
00020 // Creation Date : 12/02/96
00021 //
00022 // Owner         : Raikanta Sahu
00023 //-------------------------------------------------------------------------
00024 
00025 #ifndef DAG_HPP
00026 #define DAG_HPP
00027 
00028 // ********** BEGIN STANDARD INCLUDES         **********
00029 // ********** END STANDARD INCLUDES           **********
00030 
00031 // ********** BEGIN MOTIF INCLUDES            **********
00032 // ********** END MOTIF INCLUDES              **********
00033 
00034 // ********** BEGIN OPEN INVENTOR INCLUDES    **********
00035 // ********** END OPEN INVENTOR INCLUDES      **********
00036 
00037 // ********** BEGIN CUBIT INCLUDES            **********
00038 
00039 #include "CubitDefines.h"
00040 #include "CGMGeomConfigure.h"
00041 
00042 #include "DLIList.hpp"
00043 
00044 // ********** END CUBIT INCLUDES              **********
00045 
00046 // ********** BEGIN FORWARD DECLARATIONS      **********
00047 class TopologyEntity;
00048 // ********** END FORWARD DECLARATIONS        **********
00049 
00050 // ********** BEGIN MACRO DEFINITIONS         **********
00051 // ********** END MACRO DEFINITIONS           **********
00052 
00053 // ********** BEGIN ENUM DEFINITIONS          **********
00054 // ********** END ENUM DEFINITIONS            **********
00055 
00056 class CUBIT_GEOM_EXPORT DAG
00057 {
00058 
00059 // ********** BEGIN FRIEND CLASS DECLARATIONS **********
00060 // ********** END FRIEND CLASS DECLARATIONS   **********
00061 
00062 public:
00063 
00064   static DAG* instance(); 
00065     //- Controlled access and creation of the sole instance of this class.
00066     //- Singleton pattern
00067 
00068   ~DAG() ;
00069     //- Destructor
00070     
00071   static void delete_instance()
00072   {
00073     if(instance_)
00074       delete instance_;
00075     instance_ = NULL;
00076   };
00077 
00078   void add_deactivated_DAG_node(TopologyEntity* deactivatedDAGNodePtr) ;
00079     //R void
00080     //I deactivatedDAGNodePtr
00081     //I- A pointer to a deactivated DAG node (TopologyEntity)
00082     //- This function takes a pointer to a deactivated DAG node and
00083     //- adds it to the list of deactivated DAG nodes.
00084 
00085   void remove_deactivated_DAG_node(TopologyEntity* deactivatedDAGNodePtr) ;
00086     //R void
00087     //I deactivatedDAGNodePtr
00088     //I- A pointer to a deactivated DAG node
00089     //- This function takes a pointer to a deactivated DAG node and
00090     //- removes it from the list of deactivated DAG nodes.
00091 
00092   void cleanout_deactivated_DAG_nodes() ;
00093     //R void
00094     //- This function deletes all the deactivated DAG nodes and cleans
00095     //- the list of deactivated DAG nodes. 
00096     //- N.B. deletion of objects connected to the DAGNodes are not
00097     //-      done at base class. The classes derived from DAGNode
00098     //-      must do that.
00099       
00100   void remove(TopologyEntity* DAGNodePtr);
00101     //R void
00102     //I DAGNodePtr
00103     //I- The input DAG Node pointer to the DAG Node that initiated
00104     //I- the event
00105     //I event
00106     //I- The type of event that occurred -- enum in CubitDefines
00107     //- This function is used to notify the DAG class that an
00108     //- event has occurred.  The input object that initiated the
00109     //- the event is a DAG Node.
00110 
00111 // Methods added by Jason Kraftcheck on September 16, 1996.
00112 
00113   CubitStatus get_children_at_level( TopologyEntity* parent, int level,
00114                                      DLIList<TopologyEntity*>& result_set );
00115     //R CubitStatus
00116     //R- CUBIT_SUCCESS/CUBIT_FAILURE
00117     //I parent
00118     //I- A pointer to the DAG node to get the children of.
00119     //I level
00120     //I- Levels down to traverse DAG.
00121     //O result_set
00122     //O- The list of DAGNodes found.
00123     //- These methods return the children of a DAG node at the
00124     //- specified level down from the passed node.
00125     //-
00126     //- Note: These methods are implemented here rather than in
00127     //-       DAGNode because a breadth-first search will be
00128     //- much more efficient than a depth-first search in
00129     //- DAGNode.
00130 
00131   CubitStatus get_parents_at_level( TopologyEntity* child, int level,
00132                                     DLIList<TopologyEntity*>& result_set );
00133     //R CubitStatus
00134     //R- CUBIT_SUCCESS/CUBIT_FAILURE
00135     //I child
00136     //I- A pointer to the DAG node to get the parents of.
00137     //I level
00138     //I- Levels up to traverse DAG.
00139     //O result_set
00140     //O- The list of DAGNodes found.
00141     //- These methods return the parents of a DAG node at the
00142     //- specified level up from the passed node.
00143     //-
00144     //- Note: These methods are implemented here rather than in
00145     //-       DAGNode because a breadth-first search will be
00146     //- much more efficient than a depth-first search in
00147     //- DAGNode.
00148       
00149   CubitStatus get_children_at_level( DLIList<TopologyEntity*>& parents, int level,
00150                                      DLIList<TopologyEntity*>& result_set );
00151     //R CubitStatus
00152     //R- CUBIT_SUCCESS/CUBIT_FAILURE
00153     //I parents
00154     //I- A list of DAG nodes to get the children of.
00155     //I level
00156     //I- Levels down to traverse DAG.
00157     //O result_set
00158     //O- The list of DAGNodes found.
00159     //- These methods return the children of a DAG node at the
00160     //- specified level down from the passed node.
00161     //-
00162     //- Note: It is assumed that the parents passed are all at the
00163     //- same level in the DAG.  The behavior of this method
00164     //- is undefined if this it not the case.
00165 
00166   CubitStatus get_parents_at_level( DLIList<TopologyEntity*>& children, int level,
00167                                     DLIList<TopologyEntity*>& result_set );
00168     //R CubitStatus
00169     //R- CUBIT_SUCCESS/CUBIT_FAILURE
00170     //I child
00171     //I- A list of DAG nodes to get the parents of.
00172     //I level
00173     //I- Levels up to traverse DAG.
00174     //O result_set
00175     //O- The list of DAGNodes found.
00176     //- These methods return the parents of a DAG node at the
00177     //- specified level up from the passed node.
00178     //-
00179     //- Note: It is assumed that the children passed are all at the
00180     //- same level in the DAG.  The behavior of this method
00181     //- is undefined if this it not the case.
00182       
00183 // End methods added by Jason Kraftcheck on September 16, 1996.
00184 
00185 protected: 
00186 
00187   DAG() ;
00188     //- The default constructor
00189 
00190 private:
00191 
00192   static DAG* instance_ ;
00193     //- Pointer to the only instance of the class
00194 
00195   DLIList<TopologyEntity*> deactivatedDAGNodeList_ ;
00196     //- List of deactivated snodes
00197 } ;
00198 
00199 
00200 // ********** BEGIN INLINE FUNCTIONS          **********
00201 // ********** END INLINE FUNCTIONS            **********
00202 
00203 // ********** BEGIN FRIEND FUNCTIONS          **********
00204 // ********** END FRIEND FUNCTIONS            **********
00205 
00206 // ********** BEGIN EXTERN FUNCTIONS          **********
00207 // ********** END EXTERN FUNCTIONS            **********
00208 
00209 // ********** BEGIN HELPER CLASS DECLARATIONS **********
00210 // ********** END HELPER CLASS DECLARATIONS   **********
00211 
00212 #endif
00213 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines