lasso
|
00001 #ifndef ASSOCPAIR_HPP 00002 #define ASSOCPAIR_HPP 00003 00004 #include "iRel_Lasso.hpp" 00005 #include "AssocPairSide.hpp" 00006 00007 #include <sstream> 00008 00009 class Lasso; 00010 00011 class AssocPair 00012 { 00013 public: 00014 friend class Lasso; 00015 00016 AssocPair(iRel_Instance instance, 00017 iBase_Instance iface0, 00018 iRel_RelationType ent_or_set0, 00019 iRel_IfaceType type0, 00020 iRel_RelationStatus status0, 00021 iBase_Instance iface1, 00022 iRel_RelationType ent_or_set1, 00023 iRel_IfaceType type1, 00024 iRel_RelationStatus status1); 00025 00026 ~AssocPair(); 00027 00028 iBase_Instance iface_instance(int iface_no) const; 00029 iRel_IfaceType iface_type(int iface_no) const; 00030 iRel_RelationType relation_type(int iface_no) const; 00031 iRel_RelationStatus relation_status(int iface_no) const; 00032 00033 int change_type(int iface_no, iRel_RelationType type); 00034 int change_status(int iface_no, iRel_RelationStatus status); 00035 00036 bool equivalent(iBase_Instance iface1, iBase_Instance iface2, 00037 bool *order_switched = NULL); 00038 bool equivalent(iRel_IfaceType type1, iRel_IfaceType type2, 00039 bool *order_switched = NULL); 00040 00041 bool contains(iBase_Instance iface); 00042 00043 int get_all_entities(int iface_no, int dimension, 00044 iBase_EntityHandle **entities, int *entities_alloc, 00045 int *entities_size); 00046 00047 int get_all_sets(int iface_no, iBase_EntitySetHandle **sets, int *sets_alloc, 00048 int *sets_size); 00049 00050 int get_entities(int iface_no, int dimension, 00051 iBase_EntitySetHandle set_handle, 00052 iBase_EntityHandle **entities, int *entities_alloc, 00053 int *entities_size); 00054 00055 int get_ents_dims(int iface_no, iBase_EntityHandle *entities, 00056 int entities_size, int **ent_types, int *ent_types_alloc, 00057 int *ent_types_size); 00058 00059 int set_relation(iBase_EntityHandle ent1, iBase_EntityHandle ent2); 00060 int set_relation(iBase_EntitySetHandle set1, iBase_EntityHandle ent2); 00061 int set_relation(iBase_EntityHandle ent1, iBase_EntitySetHandle set2); 00062 int set_relation(iBase_EntitySetHandle set1, iBase_EntitySetHandle set2); 00063 00064 int get_relation(int iface_no, iBase_EntityHandle *entities, 00065 int num_entities, iBase_EntityHandle *tag_values); 00066 int get_relation(int iface_no, iBase_EntitySetHandle *sets, 00067 int num_sets, iBase_EntityHandle *tag_values); 00068 int get_relation(int iface_no, iBase_EntityHandle *entities, 00069 int num_entities, iBase_EntitySetHandle *tag_values); 00070 int get_relation(int iface_no, iBase_EntitySetHandle *sets, 00071 int num_sets, iBase_EntitySetHandle *tag_values); 00072 int get_relation(int iface_no, iBase_EntityHandle *entities, 00073 int num_entities, iBase_EntityIterator *tag_values); 00074 int get_relation(int iface_no, iBase_EntitySetHandle *sets, 00075 int num_sets, iBase_EntityIterator *tag_values); 00076 00077 int rmv_relation(int iface_no, iBase_EntityHandle *entities, 00078 int num_entities); 00079 int rmv_relation(int iface_no, iBase_EntitySetHandle *sets, int num_sets); 00080 00081 int get_gids(int iface_no, iBase_EntityHandle *entities, int num_entities, 00082 int *tag_values); 00083 int get_gids(int iface_no, iBase_EntitySetHandle *sets, int num_sets, 00084 int *tag_values); 00085 00086 int get_dims(int iface_no, iBase_EntityHandle *entities, int num_entities, 00087 int *tag_values); 00088 int get_dims(int iface_no, iBase_EntitySetHandle *sets, int num_sets, 00089 int *tag_values); 00090 private: 00091 AssocPair(); 00092 00093 int populate_recursive(int iface_no, iBase_EntitySetHandle set, 00094 iBase_EntityHandle related_ent); 00095 int populate_recursive(int iface_no, iBase_EntitySetHandle set, 00096 iBase_EntitySetHandle related_set); 00097 00098 int unpopulate_recursive(int iface_no, iBase_EntitySetHandle set); 00099 00100 iRel_Instance instance; 00101 AssocPairSide *relSides[2]; 00102 iRel_RelationType entOrSet[2]; 00103 iRel_RelationStatus relStatus[2]; 00104 int pairId; 00105 00106 static int currId; 00107 }; 00108 00109 inline iBase_Instance AssocPair::iface_instance(int iface_no) const 00110 { 00111 return relSides[iface_no]->instance(); 00112 } 00113 00114 inline iRel_IfaceType AssocPair::iface_type(int iface_no) const 00115 { 00116 return relSides[iface_no]->type(); 00117 } 00118 00119 inline iRel_RelationType AssocPair::relation_type(int iface_no) const 00120 { 00121 return entOrSet[iface_no]; 00122 } 00123 00124 inline iRel_RelationStatus AssocPair::relation_status(int iface_no) const 00125 { 00126 return relStatus[iface_no]; 00127 } 00128 00129 static inline AssocPair *assocpair_handle(iRel_PairHandle pair) 00130 { 00131 return reinterpret_cast<AssocPair*>(pair); 00132 } 00133 #define ASSOCPAIRI assocpair_handle(pair) 00134 00135 00136 #endif