#include <LatticeMaker.h>
Public Types | |
| typedef Bool_t | AssociateFunc (const TObject *, const TObject *) |
| typedef Long_t | KeyFunc (const TObject *) |
Public Member Functions | |
| LatticeMaker () | |
| virtual | ~LatticeMaker () |
| Lattice * | CreateLattice (const char *nameLeft, const char *nameRight, const char *type="n:m") |
| Lattice * | CreateLattice (const TObject *objLeft, const TObject *objRight, const char *type="n:m") |
| Lattice * | CreateLattice (const TCollection *setLeft, const TCollection *setRight, AssociateFunc *asFunc, const char *type="n:m") |
| Lattice * | Create1ToNLattice (const TCollection *setLeft, const TCollection *setRight, KeyFunc *leftFunc, KeyFunc *rightFunc) |
|
|
Definition at line 36 of file LatticeMaker.h. |
|
|
Definition at line 37 of file LatticeMaker.h. |
|
|
Definition at line 40 of file LatticeMaker.h. 00040 { LEA_CTOR; };
|
|
|
Definition at line 41 of file LatticeMaker.h. 00041 { LEA_DTOR; };
|
|
||||||||||||||||||||
|
Definition at line 207 of file LatticeMaker.cxx. References LatticeBuilder::AddPrimary(), LatticeBuilder::AddSecondary(), CreateLattice(), LatticeBuilder::DockLattice(), and MSG. Referenced by LatValidate::Test_3(). 00210 {
00211
00212 // Purpose: Create a new 1:n Lattice between setLeft and setRight.
00213 // Arguments:
00214 // setLeft in Left set.
00215 // Each member is associated to 1 or more of right set
00216 // setRight in Right set.
00217 // Each member is associated to 1 of left set
00218 // LeftFunc in Key function for setLeft members.
00219 // Returns a unique key.
00220 // RightFunc in Key function for rightSet members.
00221 // Returns the unique key of the setLeft member
00222 // with which this member is associated.
00223 //
00224 // Return:
00225 // New Lattice. The caller is responsible for deleting it.
00226 // Returns 0 if either or both sets empty.
00227
00228 // Contact: N. West
00229
00230 // Check .
00231
00232 TIter itrLeft(setLeft);
00233 TIter itrRight(setRight);
00234 TObject* objLeft = itrLeft();
00235 TObject* objRight = itrRight();
00236
00237 if ( ! objLeft || ! objRight ) {
00238 MSG("Lat",Msg::kWarning)
00239 << "Cannot build lattice; one or both sets empty," << endl;
00240 return 0;
00241 }
00242
00243 // Create new 1:n Lattice.
00244 Lattice* lat = CreateLattice(objLeft->ClassName(),
00245 objRight->ClassName(),
00246 "1:n");
00247
00248
00249 // Create a LatticeBuilder and dock lattice.
00250 LatticeBuilder builder;
00251 builder.DockLattice(lat, Lattice::kLeft);
00252
00253 // Store the primary keys.
00254 itrLeft.Reset();
00255 while ( (objLeft = itrLeft() )
00256 ) builder.AddPrimary(leftFunc(objLeft), objLeft);
00257
00258 // Connect secondaries to primary.
00259 itrRight.Reset();
00260 while ( (objRight = itrRight() )
00261 ) builder.AddSecondary(rightFunc(objRight), objRight);
00262
00263 return lat;
00264
00265 }
|
|
||||||||||||||||||||
|
Definition at line 125 of file LatticeMaker.cxx. References Lattice::ConnectLR(), CreateLattice(), and MSG. 00128 {
00129
00130 // Purpose: Create a new Lattice between setLeft and setRight.
00131 // Arguments:
00132 // setLeft in Left set.
00133 // setRight in Right set.
00134 // asFunc in Association function. Returns kTRUE if entry in
00135 // first set is associated with entry in the second.
00136 // type in Lattice type. One of "1:n", "n:1" or "n:m"
00137 // the default is "n:m"
00138 //
00139 // Return:
00140 // New Lattice. The caller is responsible for deleting it.
00141 // Returns 0 if either or both sets empty.
00142
00143 // Contact: N. West
00144
00145 // Check .
00146
00147 TIter itrLeft(setLeft);
00148 TIter itrRight(setRight);
00149 TObject* objLeft = itrLeft();
00150 TObject* objRight = itrRight();
00151
00152 if ( ! objLeft || ! objRight ) {
00153 MSG("Lat",Msg::kWarning)
00154 << "Cannot build lattice; one or both sets empty," << endl;
00155 return 0;
00156 }
00157
00158 // Create new Lattice.
00159 Lattice* lat = CreateLattice(objLeft->ClassName(),
00160 objRight->ClassName(),
00161 type);
00162
00163 string latType = type;
00164 itrLeft.Reset();
00165 itrRight.Reset();
00166
00167 if ( latType == "1:n" ) {
00168 while ( (objRight = itrRight()) ){
00169 itrLeft.Reset();
00170 while ( (objLeft = itrLeft()) ) {
00171 if ( asFunc(objLeft,objRight) ) {
00172 lat->ConnectLR(objLeft,0,objRight);
00173 break;
00174 }
00175 }
00176 }
00177
00178 }
00179 else if ( latType == "n:1" ) {
00180 while ( (objLeft = itrLeft()) ){
00181 itrRight.Reset();
00182 while ( (objRight = itrRight()) ) {
00183 if ( asFunc(objLeft,objRight) ) {
00184 lat->ConnectLR(objLeft,0,objRight);
00185 break;
00186 }
00187 }
00188 }
00189 }
00190
00191 else {
00192 while ( (objLeft = itrLeft()) ){
00193 itrRight.Reset();
00194 while ( (objRight = itrRight()) ) {
00195 if ( asFunc(objLeft,objRight)
00196 ) lat->ConnectLR(objLeft,0,objRight);
00197 }
00198 }
00199 }
00200
00201
00202 return lat;
00203
00204 }
|
|
||||||||||||||||
|
Definition at line 95 of file LatticeMaker.cxx. References CreateLattice(). 00097 {
00098
00099 // Purpose: Create a new empty Lattice.
00100 // Arguments:
00101 // objLeft in Example object for left side of lattice.
00102 // objRight in Example object for right side of lattice.
00103 // type in Lattice type. One of "1:n", "n:1" or "n:m"
00104 // the default is "n:m"
00105 //
00106 // Return:
00107 // New empty Lattice. The caller is responsible for deleting it.
00108
00109
00110 // Program Notes:-
00111 // =============
00112 //
00113 // objLeft and objRight are just used to get the names for the
00114 // two sides.
00115 //
00116 // Contact: N. West
00117
00118 return CreateLattice(objLeft->ClassName(),
00119 objRight->ClassName(),
00120 type);
00121
00122 }
|
|
||||||||||||||||
|
Definition at line 47 of file LatticeMaker.cxx. Referenced by Create1ToNLattice(), CreateLattice(), and LatValidate::Test_3(). 00049 {
00050
00051 // Purpose: Create a new empty Lattice.
00052 // Arguments:
00053 // nameLeft in Class name of objects on left side of lattice.
00054 // nameRight in Class name of objects on left side of lattice.
00055 // type in Lattice type. One of "1:n", "n:1" or "n:m"
00056 // the default is "n:m"
00057 //
00058 // Return:
00059 // New empty Lattice. The caller is responsible for deleting it.
00060
00061
00062 // Program Notes:-
00063 // =============
00064 //
00065 // None.
00066 //
00067 // Contact: N. West
00068
00069 string latType = type;
00070
00071 // Create new Lattice supporting 1:n relationship
00072 if ( latType == "1:n"
00073 ) return new Lattice(nameLeft,
00074 nameRight,
00075 LatticeBase::LNodeMulti,
00076 LatticeBase::RLinkMulti);
00077
00078 // Create new Lattice supporting n:1 relationship
00079 if ( latType == "n:1"
00080 ) return new Lattice(nameLeft,
00081 nameRight,
00082 LatticeBase::RNodeMulti,
00083 LatticeBase::LLinkMulti);
00084
00085 // Create new Lattice supporting full n:m relationship
00086 return new Lattice(nameLeft,
00087 nameRight,
00088 LatticeBase::LNodeMulti,
00089 LatticeBase::RNodeMulti,
00090 LatticeBase::LLinkMulti,
00091 LatticeBase::RLinkMulti);
00092 }
|
1.3.9.1