NLLIGO::CZoneBank Class Reference

#include <zone_bank.h>


Public Member Functions

void addAndSwitch (const std::string &CategoryType, const std::string &CategoryValue)
bool addElement (const std::string &elementName, std::string &error)
 Load an element in the current directory.

void addOrSwitch (const std::string &CategoryType, const std::string &CategoryValue)
void debugInit (const std::string &sPath)
void debugSaveInit (CZoneBankElement &zbeTmp, const std::string &fileName)
void getCategoriesType (std::vector< std::string > &CategoriesType)
void getCategoryValues (const std::string &CategoryType, std::vector< std::string > &CategoryValues)
CZoneBankElementgetElementByZoneName (const std::string &ZoneName)
void getSelection (std::vector< CZoneBankElement * > &SelectedElements)
bool initFromPath (const std::string &pathName, std::string &error)
 Initialize the zone bank with all files present in the path given (note pathName must not end with '').

void reset ()
void resetSelection ()

Private Attributes

std::map< std::string, CZoneBankElement_ElementsMap
std::vector< CZoneBankElement * > _Selection


Member Function Documentation

void NLLIGO::CZoneBank::addAndSwitch const std::string &  CategoryType,
const std::string &  CategoryValue
 

Definition at line 658 of file zone_bank.cpp.

References NLLIGO::CZoneBankElement::_CategoriesMap, and uint32.

00659 {
00660         uint32 i, j;
00661         // And the selection with some constraints
00662         // All elements of the selection must have a catType and catValue equal to those given in parameters
00663         for (i = 0; i < _Selection.size(); ++i)
00664         {
00665                 CZoneBankElement *pZBE = _Selection[i];
00666                 bool bFound = false;
00667 
00668                 map<string,string>::iterator it = pZBE->_CategoriesMap.find (CategoryType);
00669                 if (it != pZBE->_CategoriesMap.end())
00670                 {
00671                         if (it->second == CategoryValue)
00672                                 bFound = true;
00673                 }
00674                 if (!bFound)
00675                 {
00676                         _Selection[i] = NULL; // Mark this item to be removed
00677                 }
00678         }
00679         // Remove all unused items      
00680         for (i = 0, j = 0; i < _Selection.size(); ++i)
00681         {
00682                 if (_Selection[i] != NULL)
00683                 {
00684                         _Selection[j] = _Selection[i];
00685                         ++j;
00686                 }
00687         }
00688         _Selection.resize (j);
00689 }

bool NLLIGO::CZoneBank::addElement const std::string &  elementName,
std::string &  error
 

Load an element in the current directory.

Definition at line 527 of file zone_bank.cpp.

References _ElementsMap, NLLIGO::CZoneBankElement::getName(), NLMISC::CIFile::open(), and NLLIGO::CZoneBankElement::serial().

Referenced by initFromPath().

00528 {
00529         try
00530         {
00531                 CZoneBankElement zbeTmp;
00532                 CIFile fileIn;
00533                 if (fileIn.open (elementName))
00534                 {
00535                         CIXml input;
00536                         input.init (fileIn);
00537                         zbeTmp.serial (input);
00538                         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(),zbeTmp));
00539                         return true;
00540                 }
00541                 else
00542                 {
00543                         error = "Can't open file " + elementName;
00544                 }
00545         }
00546         catch (Exception& e)
00547         {
00548                 error = "Error while loading ligozone "+elementName+" : "+e.what();
00549         }
00550         return false;
00551 }

void NLLIGO::CZoneBank::addOrSwitch const std::string &  CategoryType,
const std::string &  CategoryValue
 

Definition at line 627 of file zone_bank.cpp.

References NLLIGO::CZoneBankElement::_CategoriesMap, _ElementsMap, and uint32.

00628 {
00629         map<string,CZoneBankElement>::iterator itElt = _ElementsMap.begin();
00630 
00631         while (itElt != _ElementsMap.end())
00632         {
00633                 CZoneBankElement &rZBE = itElt->second;
00634 
00635                 map<string,string>::iterator it = rZBE._CategoriesMap.find (CategoryType);
00636 
00637                 if (it != rZBE._CategoriesMap.end())
00638                 {
00639                         if (it->second == CategoryValue)
00640                         {
00641                                 // Check if the element is not already present in the selection
00642                                 bool bFound = false;
00643                                 for (uint32 k = 0; k < _Selection.size(); ++k )
00644                                         if (&rZBE == _Selection[k])
00645                                         {
00646                                                 bFound = true;
00647                                                 break;
00648                                         }
00649                                 if (!bFound)
00650                                         _Selection.push_back (&rZBE);
00651                         }
00652                 }
00653                 ++itElt;
00654         }
00655 }

void NLLIGO::CZoneBank::debugInit const std::string &  sPath  ) 
 

Definition at line 158 of file zone_bank.cpp.

References NLLIGO::CZoneBankElement::_CategoriesMap, _ElementsMap, NLLIGO::CZoneBankElement::_Mask, NLLIGO::CZoneBankElement::addCategory(), debugSaveInit(), and NLLIGO::CZoneBankElement::getName().

00159 {
00160         CZoneBankElement zbeTmp;
00161         zbeTmp.addCategory ("zone", "Zone001");
00162         zbeTmp.addCategory ("size", "1x1");
00163         zbeTmp.addCategory ("material", "titFleur");
00164         zbeTmp._Mask.push_back (true);
00165         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00166         debugSaveInit (zbeTmp, sPath + "Zone001.ligozone");
00167         zbeTmp._CategoriesMap.clear ();
00168         zbeTmp._Mask.clear ();
00169         
00170 
00171         zbeTmp.addCategory ("zone", "Zone002");
00172         zbeTmp.addCategory ("size", "1x1");
00173         zbeTmp.addCategory ("material", "titFleur");
00174         zbeTmp._Mask.push_back (true);
00175         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00176         debugSaveInit (zbeTmp, sPath + "Zone002.ligozone");
00177         zbeTmp._CategoriesMap.clear ();
00178         zbeTmp._Mask.clear ();
00179 
00180         zbeTmp.addCategory ("zone", "Zone003");
00181         zbeTmp.addCategory ("size", "2x2");
00182         zbeTmp.addCategory ("material", "titFleur");
00183         zbeTmp._Mask.push_back (true);
00184         zbeTmp._Mask.push_back (true);
00185         zbeTmp._Mask.push_back (false);
00186         zbeTmp._Mask.push_back (true);
00187         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00188         debugSaveInit (zbeTmp, sPath + "Zone003.ligozone");
00189         zbeTmp._CategoriesMap.clear ();
00190         zbeTmp._Mask.clear ();
00191 
00192         zbeTmp.addCategory ("zone", "Zone004");
00193         zbeTmp.addCategory ("size", "2x2");
00194         zbeTmp.addCategory ("material", "grozFleur");
00195         zbeTmp._Mask.push_back (false);
00196         zbeTmp._Mask.push_back (true);
00197         zbeTmp._Mask.push_back (true);
00198         zbeTmp._Mask.push_back (true);
00199         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00200         debugSaveInit (zbeTmp, sPath + "Zone004.ligozone");
00201         zbeTmp._CategoriesMap.clear ();
00202         zbeTmp._Mask.clear ();
00203 
00204         zbeTmp.addCategory ("zone", "Zone005");
00205         zbeTmp.addCategory ("size", "1x1");
00206         zbeTmp.addCategory ("material", "grozFleur");
00207         zbeTmp._Mask.push_back (true);
00208         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00209         debugSaveInit (zbeTmp, sPath + "Zone005.ligozone");
00210         zbeTmp._CategoriesMap.clear ();
00211         zbeTmp._Mask.clear ();
00212 
00213         zbeTmp.addCategory ("zone", "Zone006");
00214         zbeTmp.addCategory ("size", "4x2");
00215         zbeTmp.addCategory ("material", "grozFleur");
00216         zbeTmp._Mask.push_back (true);
00217         zbeTmp._Mask.push_back (true);
00218         zbeTmp._Mask.push_back (false);
00219         zbeTmp._Mask.push_back (false);
00220         zbeTmp._Mask.push_back (false);
00221         zbeTmp._Mask.push_back (true);
00222         zbeTmp._Mask.push_back (true);
00223         zbeTmp._Mask.push_back (false);
00224         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00225         debugSaveInit (zbeTmp, sPath + "Zone006.ligozone");
00226         zbeTmp._CategoriesMap.clear ();
00227         zbeTmp._Mask.clear ();
00228         _ElementsMap.clear ();
00229 
00230         zbeTmp.addCategory ("zone", "Zone007");
00231         zbeTmp.addCategory ("size", "1x1");
00232         zbeTmp.addCategory ("material", "grozFleur");
00233         zbeTmp._Mask.push_back (true);
00234         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00235         debugSaveInit (zbeTmp, sPath + "Zone007.ligozone");
00236         zbeTmp._CategoriesMap.clear ();
00237         zbeTmp._Mask.clear ();
00238         _ElementsMap.clear ();
00239 
00240         zbeTmp.addCategory ("zone", "Zone008");
00241         zbeTmp.addCategory ("size", "2x2");
00242         zbeTmp.addCategory ("material", "prairie");
00243         zbeTmp._Mask.push_back (true);
00244         zbeTmp._Mask.push_back (true);
00245         zbeTmp._Mask.push_back (true);
00246         zbeTmp._Mask.push_back (true);
00247         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00248         debugSaveInit (zbeTmp, sPath + "Zone008.ligozone");
00249         zbeTmp._CategoriesMap.clear ();
00250         zbeTmp._Mask.clear ();
00251         _ElementsMap.clear ();
00252 
00253         zbeTmp.addCategory ("zone", "Zone009");
00254         zbeTmp.addCategory ("size", "2x2");
00255         zbeTmp.addCategory ("material", "prairie");
00256         zbeTmp._Mask.push_back (true);
00257         zbeTmp._Mask.push_back (true);
00258         zbeTmp._Mask.push_back (true);
00259         zbeTmp._Mask.push_back (true);
00260         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00261         debugSaveInit (zbeTmp, sPath + "Zone009.ligozone");
00262         zbeTmp._CategoriesMap.clear ();
00263         zbeTmp._Mask.clear ();
00264         _ElementsMap.clear ();
00265 
00266         zbeTmp.addCategory ("zone", "Zone010");
00267         zbeTmp.addCategory ("size", "1x1");
00268         zbeTmp.addCategory ("material", "prairie");
00269         zbeTmp._Mask.push_back (true);
00270         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00271         debugSaveInit (zbeTmp, sPath + "Zone010.ligozone");
00272         zbeTmp._CategoriesMap.clear ();
00273         zbeTmp._Mask.clear ();
00274         _ElementsMap.clear ();
00275 
00276         zbeTmp.addCategory ("zone", "WT0");
00277         zbeTmp.addCategory ("size", "1x1");
00278         zbeTmp.addCategory ("transname", "grozFleur-prairie");
00279         zbeTmp.addCategory ("transtype", "Flat");
00280         zbeTmp.addCategory ("transnum", "0");
00281         zbeTmp._Mask.push_back (true);
00282         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00283         debugSaveInit (zbeTmp, sPath + "WT0.ligozone");
00284         zbeTmp._CategoriesMap.clear ();
00285         zbeTmp._Mask.clear ();
00286         _ElementsMap.clear ();
00287 
00288         zbeTmp.addCategory ("zone", "WT1");
00289         zbeTmp.addCategory ("size", "1x1");
00290         zbeTmp.addCategory ("transname", "grozFleur-prairie");
00291         zbeTmp.addCategory ("transtype", "Flat");
00292         zbeTmp.addCategory ("transnum", "1");
00293         zbeTmp._Mask.push_back (true);
00294         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00295         debugSaveInit (zbeTmp, sPath + "WT1.ligozone");
00296         zbeTmp._CategoriesMap.clear ();
00297         zbeTmp._Mask.clear ();
00298         _ElementsMap.clear ();
00299 
00300         zbeTmp.addCategory ("zone", "WT2");
00301         zbeTmp.addCategory ("size", "1x1");
00302         zbeTmp.addCategory ("transname", "grozFleur-prairie");
00303         zbeTmp.addCategory ("transtype", "Flat");
00304         zbeTmp.addCategory ("transnum", "2");
00305         zbeTmp._Mask.push_back (true);
00306         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00307         debugSaveInit (zbeTmp, sPath + "WT2.ligozone");
00308         zbeTmp._CategoriesMap.clear ();
00309         zbeTmp._Mask.clear ();
00310         _ElementsMap.clear ();
00311 
00312         zbeTmp.addCategory ("zone", "WT3");
00313         zbeTmp.addCategory ("size", "1x1");
00314         zbeTmp.addCategory ("transname", "grozFleur-prairie");
00315         zbeTmp.addCategory ("transtype", "CornerA");
00316         zbeTmp.addCategory ("transnum", "3");
00317         zbeTmp._Mask.push_back (true);
00318         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00319         debugSaveInit (zbeTmp, sPath + "WT3.ligozone");
00320         zbeTmp._CategoriesMap.clear ();
00321         zbeTmp._Mask.clear ();
00322         _ElementsMap.clear ();
00323 
00324         zbeTmp.addCategory ("zone", "WT4");
00325         zbeTmp.addCategory ("size", "1x1");
00326         zbeTmp.addCategory ("transname", "grozFleur-prairie");
00327         zbeTmp.addCategory ("transtype", "CornerA");
00328         zbeTmp.addCategory ("transnum", "4");
00329         zbeTmp._Mask.push_back (true);
00330         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00331         debugSaveInit (zbeTmp, sPath + "WT4.ligozone");
00332         zbeTmp._CategoriesMap.clear ();
00333         zbeTmp._Mask.clear ();
00334         _ElementsMap.clear ();
00335 
00336         zbeTmp.addCategory ("zone", "WT5");
00337         zbeTmp.addCategory ("size", "1x1");
00338         zbeTmp.addCategory ("transname", "grozFleur-prairie");
00339         zbeTmp.addCategory ("transtype", "CornerA");
00340         zbeTmp.addCategory ("transnum", "5");
00341         zbeTmp._Mask.push_back (true);
00342         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00343         debugSaveInit (zbeTmp, sPath + "WT5.ligozone");
00344         zbeTmp._CategoriesMap.clear ();
00345         zbeTmp._Mask.clear ();
00346         _ElementsMap.clear ();
00347 
00348         zbeTmp.addCategory ("zone", "WT6");
00349         zbeTmp.addCategory ("size", "1x1");
00350         zbeTmp.addCategory ("transname", "grozFleur-prairie");
00351         zbeTmp.addCategory ("transtype", "CornerB");
00352         zbeTmp.addCategory ("transnum", "6");
00353         zbeTmp._Mask.push_back (true);
00354         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00355         debugSaveInit (zbeTmp, sPath + "WT6.ligozone");
00356         zbeTmp._CategoriesMap.clear ();
00357         zbeTmp._Mask.clear ();
00358         _ElementsMap.clear ();
00359 
00360         zbeTmp.addCategory ("zone", "WT7");
00361         zbeTmp.addCategory ("size", "1x1");
00362         zbeTmp.addCategory ("transname", "grozFleur-prairie");
00363         zbeTmp.addCategory ("transtype", "CornerB");
00364         zbeTmp.addCategory ("transnum", "7");
00365         zbeTmp._Mask.push_back (true);
00366         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00367         debugSaveInit (zbeTmp, sPath + "WT7.ligozone");
00368         zbeTmp._CategoriesMap.clear ();
00369         zbeTmp._Mask.clear ();
00370         _ElementsMap.clear ();
00371 
00372         zbeTmp.addCategory ("zone", "WT8");
00373         zbeTmp.addCategory ("size", "1x1");
00374         zbeTmp.addCategory ("transname", "grozFleur-prairie");
00375         zbeTmp.addCategory ("transtype", "CornerB");
00376         zbeTmp.addCategory ("transnum", "8");
00377         zbeTmp._Mask.push_back (true);
00378         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00379         debugSaveInit (zbeTmp, sPath + "WT8.ligozone");
00380         zbeTmp._CategoriesMap.clear ();
00381         zbeTmp._Mask.clear ();
00382         _ElementsMap.clear ();
00383 
00384         zbeTmp.addCategory ("zone", "ZT0");
00385         zbeTmp.addCategory ("size", "1x1");
00386         zbeTmp.addCategory ("transname", "titFleur-grozFleur");
00387         zbeTmp.addCategory ("transtype", "Flat");
00388         zbeTmp.addCategory ("transnum", "0");
00389         zbeTmp._Mask.push_back (true);
00390         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00391         debugSaveInit (zbeTmp, sPath + "ZT0.ligozone");
00392         zbeTmp._CategoriesMap.clear ();
00393         zbeTmp._Mask.clear ();
00394         _ElementsMap.clear ();
00395 
00396         zbeTmp.addCategory ("zone", "ZT1");
00397         zbeTmp.addCategory ("size", "1x1");
00398         zbeTmp.addCategory ("transname", "titFleur-grozFleur");
00399         zbeTmp.addCategory ("transtype", "Flat");
00400         zbeTmp.addCategory ("transnum", "1");
00401         zbeTmp._Mask.push_back (true);
00402         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00403         debugSaveInit (zbeTmp, sPath + "ZT1.ligozone");
00404         zbeTmp._CategoriesMap.clear ();
00405         zbeTmp._Mask.clear ();
00406         _ElementsMap.clear ();
00407 
00408         zbeTmp.addCategory ("zone", "ZT2");
00409         zbeTmp.addCategory ("size", "1x1");
00410         zbeTmp.addCategory ("transname", "titFleur-grozFleur");
00411         zbeTmp.addCategory ("transtype", "Flat");
00412         zbeTmp.addCategory ("transnum", "2");
00413         zbeTmp._Mask.push_back (true);
00414         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00415         debugSaveInit (zbeTmp, sPath + "ZT2.ligozone");
00416         zbeTmp._CategoriesMap.clear ();
00417         zbeTmp._Mask.clear ();
00418         _ElementsMap.clear ();
00419 
00420         zbeTmp.addCategory ("zone", "ZT3");
00421         zbeTmp.addCategory ("size", "1x1");
00422         zbeTmp.addCategory ("transname", "titFleur-grozFleur");
00423         zbeTmp.addCategory ("transtype", "CornerA");
00424         zbeTmp.addCategory ("transnum", "3");
00425         zbeTmp._Mask.push_back (true);
00426         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00427         debugSaveInit (zbeTmp, sPath + "ZT3.ligozone");
00428         zbeTmp._CategoriesMap.clear ();
00429         zbeTmp._Mask.clear ();
00430         _ElementsMap.clear ();
00431 
00432         zbeTmp.addCategory ("zone", "ZT4");
00433         zbeTmp.addCategory ("size", "1x1");
00434         zbeTmp.addCategory ("transname", "titFleur-grozFleur");
00435         zbeTmp.addCategory ("transtype", "CornerA");
00436         zbeTmp.addCategory ("transnum", "4");
00437         zbeTmp._Mask.push_back (true);
00438         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00439         debugSaveInit (zbeTmp, sPath + "ZT4.ligozone");
00440         zbeTmp._CategoriesMap.clear ();
00441         zbeTmp._Mask.clear ();
00442         _ElementsMap.clear ();
00443 
00444         zbeTmp.addCategory ("zone", "ZT5");
00445         zbeTmp.addCategory ("size", "1x1");
00446         zbeTmp.addCategory ("transname", "titFleur-grozFleur");
00447         zbeTmp.addCategory ("transtype", "CornerA");
00448         zbeTmp.addCategory ("transnum", "5");
00449         zbeTmp._Mask.push_back (true);
00450         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00451         debugSaveInit (zbeTmp, sPath + "ZT5.ligozone");
00452         zbeTmp._CategoriesMap.clear ();
00453         zbeTmp._Mask.clear ();
00454         _ElementsMap.clear ();
00455 
00456         zbeTmp.addCategory ("zone", "ZT6");
00457         zbeTmp.addCategory ("size", "1x1");
00458         zbeTmp.addCategory ("transname", "titFleur-grozFleur");
00459         zbeTmp.addCategory ("transtype", "CornerB");
00460         zbeTmp.addCategory ("transnum", "6");
00461         zbeTmp._Mask.push_back (true);
00462         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00463         debugSaveInit (zbeTmp, sPath + "ZT6.ligozone");
00464         zbeTmp._CategoriesMap.clear ();
00465         zbeTmp._Mask.clear ();
00466         _ElementsMap.clear ();
00467 
00468         zbeTmp.addCategory ("zone", "ZT7");
00469         zbeTmp.addCategory ("size", "1x1");
00470         zbeTmp.addCategory ("transname", "titFleur-grozFleur");
00471         zbeTmp.addCategory ("transtype", "CornerB");
00472         zbeTmp.addCategory ("transnum", "7");
00473         zbeTmp._Mask.push_back (true);
00474         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00475         debugSaveInit (zbeTmp, sPath + "ZT7.ligozone");
00476         zbeTmp._CategoriesMap.clear ();
00477         zbeTmp._Mask.clear ();
00478         _ElementsMap.clear ();
00479 
00480         zbeTmp.addCategory ("zone", "ZT8");
00481         zbeTmp.addCategory ("size", "1x1");
00482         zbeTmp.addCategory ("transname", "titFleur-grozFleur");
00483         zbeTmp.addCategory ("transtype", "CornerB");
00484         zbeTmp.addCategory ("transnum", "8");
00485         zbeTmp._Mask.push_back (true);
00486         _ElementsMap.insert (pair<string,CZoneBankElement>(zbeTmp.getName(), zbeTmp));
00487         debugSaveInit (zbeTmp, sPath + "ZT8.ligozone");
00488         zbeTmp._CategoriesMap.clear ();
00489         zbeTmp._Mask.clear ();
00490         _ElementsMap.clear ();
00491 
00492 }

void NLLIGO::CZoneBank::debugSaveInit CZoneBankElement zbeTmp,
const std::string &  fileName
 

Definition at line 141 of file zone_bank.cpp.

References NLMISC::COXml::init(), NLMISC::COFile::open(), and NLLIGO::CZoneBankElement::serial().

Referenced by debugInit().

00142 {
00143         try
00144         {
00145                 COFile fileOut;
00146                 fileOut.open (fileName);
00147                 COXml output;
00148                 output.init (&fileOut);
00149                 zbeTmp.serial (output);
00150         }
00151         catch (Exception& /*e*/)
00152         {
00153         }
00154 
00155 }

void NLLIGO::CZoneBank::getCategoriesType std::vector< std::string > &  CategoriesType  ) 
 

Definition at line 554 of file zone_bank.cpp.

References NLLIGO::CZoneBankElement::_CategoriesMap, _ElementsMap, and uint32.

00555 {
00556         map<string,CZoneBankElement>::iterator itElt = _ElementsMap.begin();
00557 
00558         while (itElt != _ElementsMap.end())
00559         {
00560                 CZoneBankElement &rZBE = itElt->second;
00561 
00562                 map<string,string>::iterator it = rZBE._CategoriesMap.begin();
00563 
00564                 while (it != rZBE._CategoriesMap.end())
00565                 {
00566                         bool bFound = false;
00567                         for (uint32 k = 0; k < CategoriesType.size(); ++k)
00568                                 if (it->first == CategoriesType[k])
00569                                 {
00570                                         bFound = true;
00571                                         break;
00572                                 }
00573                         if (!bFound)
00574                                 CategoriesType.push_back (it->first);
00575 
00576                         ++it;
00577                 }
00578                 ++itElt;
00579         }
00580 }

void NLLIGO::CZoneBank::getCategoryValues const std::string &  CategoryType,
std::vector< std::string > &  CategoryValues
 

Definition at line 583 of file zone_bank.cpp.

References NLLIGO::CZoneBankElement::_CategoriesMap, _ElementsMap, and uint32.

00584 {
00585         map<string,CZoneBankElement>::iterator itElt = _ElementsMap.begin();
00586 
00587         while (itElt != _ElementsMap.end())
00588         {
00589                 CZoneBankElement &rZBE = itElt->second;
00590 
00591                 map<string,string>::iterator it = rZBE._CategoriesMap.find (CategoryType);
00592 
00593                 if (it != rZBE._CategoriesMap.end())
00594                 {
00595                         bool bFound = false;
00596                         for (uint32 k = 0; k < CategoryValues.size(); ++k )
00597                                 if (it->second == CategoryValues[k])
00598                                 {
00599                                         bFound = true;
00600                                         break;
00601                                 }
00602                         if (!bFound)
00603                                 CategoryValues.push_back (it->second);
00604                 }
00605                 ++itElt;
00606         }
00607 }

CZoneBankElement * NLLIGO::CZoneBank::getElementByZoneName const std::string &  ZoneName  ) 
 

Definition at line 610 of file zone_bank.cpp.

References _ElementsMap.

00611 {
00612         map<string,CZoneBankElement>::iterator it = _ElementsMap.find (ZoneName);
00613         if (it != _ElementsMap.end())
00614         {
00615                 return &(it->second);
00616         }
00617         return NULL;
00618 }

void NLLIGO::CZoneBank::getSelection std::vector< CZoneBankElement * > &  SelectedElements  ) 
 

Definition at line 692 of file zone_bank.cpp.

00693 {
00694         SelectedElements = _Selection;
00695 }

bool NLLIGO::CZoneBank::initFromPath const std::string &  pathName,
std::string &  error
 

Initialize the zone bank with all files present in the path given (note pathName must not end with '').

\

Definition at line 502 of file zone_bank.cpp.

References addElement().

00503 {
00504         char sDirBackup[512];
00505         GetCurrentDirectory (512, sDirBackup);
00506         SetCurrentDirectory (sPathName.c_str());
00507         WIN32_FIND_DATA findData;
00508         HANDLE hFind;
00509         hFind = FindFirstFile ("*.ligozone", &findData);
00510         
00511         while (hFind != INVALID_HANDLE_VALUE)
00512         {
00513                 // If the name of the file is not . or .. then its a valid entry in the DataBase
00514                 if (!((strcmp (findData.cFileName, ".") == 0) || (strcmp (findData.cFileName, "..") == 0)))
00515                 {
00516                         if (!addElement (findData.cFileName, error))
00517                                 return false;
00518                 }
00519                 if (FindNextFile (hFind, &findData) == 0)
00520                         break;
00521         }
00522         SetCurrentDirectory (sDirBackup);
00523         return true;
00524 }

void NLLIGO::CZoneBank::reset  ) 
 

Definition at line 495 of file zone_bank.cpp.

References _ElementsMap.

00496 {
00497         _ElementsMap.clear ();
00498         _Selection.clear ();
00499 }

void NLLIGO::CZoneBank::resetSelection  ) 
 

Definition at line 621 of file zone_bank.cpp.

00622 {
00623         _Selection.clear ();
00624 }


Field Documentation

std::map<std::string,CZoneBankElement> NLLIGO::CZoneBank::_ElementsMap [private]
 

Definition at line 102 of file zone_bank.h.

Referenced by addElement(), addOrSwitch(), debugInit(), getCategoriesType(), getCategoryValues(), getElementByZoneName(), and reset().

std::vector<CZoneBankElement*> NLLIGO::CZoneBank::_Selection [private]
 

Definition at line 104 of file zone_bank.h.


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 12:51:10 2004 for NeL by doxygen 1.3.6