From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a03331.html | 1323 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1323 insertions(+) create mode 100644 docs/doxygen/nel/a03331.html (limited to 'docs/doxygen/nel/a03331.html') diff --git a/docs/doxygen/nel/a03331.html b/docs/doxygen/nel/a03331.html new file mode 100644 index 00000000..cba22aca --- /dev/null +++ b/docs/doxygen/nel/a03331.html @@ -0,0 +1,1323 @@ + + +NeL: NLPACS::CRetrieverBank class Reference + + + +
+

NLPACS::CRetrieverBank Class Reference

#include <retriever_bank.h> +

+

Inheritance diagram for NLPACS::CRetrieverBank: +

+ +NLPACS::URetrieverBank + +

Detailed Description

+A bank of retrievers, shared by several global retrievers.
Author:
Benjamin Legros

+Nevrax France

+
Date:
2001
+ +

+ +

+Definition at line 51 of file retriever_bank.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

uint addRetriever (const std::string &filename)
 Loads the retriever named 'filename' (using defined search paths) and adds it to the bank.

uint addRetriever (const CLocalRetriever &retriever)
 Adds the given retriever to the bank.

void clean ()
 Cleans the bank up.

 CRetrieverBank (bool allLoaded=true)
 Constructor.

const CLocalRetrievergetRetriever (uint n) const
 Gets nth retriever.

const std::vector< CLocalRetriever > & getRetrievers () const
 Returns the vector of retrievers.

void saveRetrievers (const std::string &path, const std::string &bankPrefix)
 Write separate retrievers using dynamic filename convention.

void saveShortBank (const std::string &path, const std::string &bankPrefix, bool saveLr=true)
 Write separate retrievers using dynamic filename convention.

void serial (NLMISC::IStream &f)
 Serialises this CRetrieverBank.

void setLrInFileFlag (bool status)
 Set the lr status.

uint size () const
 Returns the number of retrievers in the bank.

Dynamic retrieve loading
bool allLoaded () const
void diff (const std::set< uint > &newlr, std::set< uint > &in, std::set< uint > &out)
 Diff loaded retrievers.

const std::string & getNamePrefix () const
bool isLoaded (uint n) const
 Tells if retriever is loaded.

void loadRetriever (uint n, NLMISC::IStream &s)
 Loads nth retriever from stream.

void setNamePrefix (const char *prefix)
void setRetrieverAsLoaded (uint n)
 Insert a retriever in loaded list.

void unloadRetriever (uint n)
 Unload nth retriever.


Static Public Member Functions

URetrieverBankcreateRetrieverBank (const char *retrieverBank, bool loadAll=true)
void deleteRetrieverBank (URetrieverBank *retrieverBank)

Protected Attributes

bool _AllLoaded
 All loaded ?

std::set< uint_LoadedRetrievers
 The loaded retrievers, if the retriever bank is not in loadAll mode.

bool _LrInRBank
 Tells if retrievers should be read from rbank directly or streamed from disk.

std::string _NamePrefix
 Bank name prefix.

std::vector< CLocalRetriever_Retrievers
 The retrievers stored in the retriever bank.


Friends

class URetrieverBank
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + + +
NLPACS::CRetrieverBank::CRetrieverBank bool  allLoaded = true  )  [inline]
+
+ + + + + +
+   + + +

+Constructor. +

+ +

+Definition at line 73 of file retriever_bank.h. +

+References _AllLoaded, _LrInRBank, and allLoaded(). +

+

00073 : _AllLoaded(allLoaded), _LrInRBank(true) {}
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
uint NLPACS::CRetrieverBank::addRetriever const std::string &  filename  )  [inline]
+
+ + + + + +
+   + + +

+Loads the retriever named 'filename' (using defined search paths) and adds it to the bank. +

+ +

+Definition at line 94 of file retriever_bank.h. +

+References _Retrievers, NLMISC::CIFile::close(), nldebug, NLMISC::CIFile::open(), NLPACS::CLocalRetriever::serial(), and uint. +

+

00095         {
+00096                 NLMISC::CIFile  input;
+00097                 _Retrievers.resize(_Retrievers.size()+1);
+00098                 CLocalRetriever &localRetriever = _Retrievers.back();
+00099                 nldebug("load retriever file %s", filename.c_str());
+00100                 input.open(filename);
+00101                 localRetriever.serial(input);
+00102                 input.close();
+00103 
+00104                 return _Retrievers.size()-1;
+00105         }
+
+

+ + + + +
+ + + + + + + + + + +
uint NLPACS::CRetrieverBank::addRetriever const CLocalRetriever retriever  )  [inline]
+
+ + + + + +
+   + + +

+Adds the given retriever to the bank. +

+ +

+Definition at line 91 of file retriever_bank.h. +

+References _Retrievers, and uint. +

+

00091 { _Retrievers.push_back(retriever); return _Retrievers.size()-1; }
+
+

+ + + + +
+ + + + + + + + + +
bool NLPACS::CRetrieverBank::allLoaded  )  const [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 284 of file retriever_bank.h. +

+References _AllLoaded. +

+Referenced by CRetrieverBank(), NLPACS::CGlobalRetriever::refreshLrAround(), and NLPACS::CGlobalRetriever::refreshLrAroundNow(). +

+

00284 { return _AllLoaded; }
+
+

+ + + + +
+ + + + + + + + + +
void NLPACS::CRetrieverBank::clean  ) 
+
+ + + + + +
+   + + +

+Cleans the bank up. +

+ +

+Definition at line 70 of file retriever_bank.cpp. +

+References _Retrievers, and uint. +

+

00071 {
+00072         uint    i;
+00073         for (i=0; i<_Retrievers.size(); ++i)
+00074         {
+00075                 _Retrievers[i].flushFullOrderedChains();
+00076         }
+00077 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
NLPACS::URetrieverBank * NLPACS::URetrieverBank::createRetrieverBank const char *  retrieverBank,
bool  loadAll = true
[static, inherited]
+
+ + + + + +
+   + + +

+Create a retriever bank.

+

Parameters:
+ + +
retrieverBank is the global retriver bank path file name. This method use CPath to find the retriever
+
+
Returns:
the retriver bank interface or NULL if the bank was not found.
+ +

+Definition at line 39 of file retriever_bank.cpp. +

+References _AllLoaded, _NamePrefix, and file. +

+

00040 {
+00041         NL_ALLOC_CONTEXT( Pacs )
+00042 
+00043         CIFile  file;
+00044         if (file.open( CPath::lookup(retrieverBank) ))
+00045         {
+00046                 CRetrieverBank  *bank = new CRetrieverBank();
+00047 
+00048                 bank->_AllLoaded = loadAll;
+00049                 bank->_NamePrefix = CFile::getFilenameWithoutExtension(retrieverBank);
+00050 
+00051                 file.serial(*bank);
+00052 
+00053                 return static_cast<URetrieverBank *>(bank);
+00054         }
+00055         else
+00056                 return NULL;
+00057 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLPACS::URetrieverBank::deleteRetrieverBank URetrieverBank retrieverBank  )  [static, inherited]
+
+ + + + + +
+   + + +

+Delete a retriever bank. +

+Definition at line 60 of file retriever_bank.cpp. +

+References r. +

+

00061 {
+00062         // Cast
+00063 //      nlassert (dynamic_cast<NLPACS::CRetrieverBank*>(retrieverBank));
+00064         NLPACS::CRetrieverBank* r=static_cast<NLPACS::CRetrieverBank*>(retrieverBank);
+00065 
+00066         // Delete
+00067         delete r;
+00068 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NLPACS::CRetrieverBank::diff const std::set< uint > &  newlr,
std::set< uint > &  in,
std::set< uint > &  out
[inline]
+
+ + + + + +
+   + + +

+Diff loaded retrievers. +

+ +

+Definition at line 212 of file retriever_bank.h. +

+References _LoadedRetrievers, _Retrievers, in, and uint. +

+

00213         {
+00214                 std::set<uint>::iterator        it;
+00215 
+00216                 for (it=_LoadedRetrievers.begin(); it!=_LoadedRetrievers.end(); ++it)
+00217                 {
+00218                         uint    n = *it;
+00219                         if (n >= _Retrievers.size())
+00220                                 continue;
+00221                         _Retrievers[n].LoadCheckFlag = true;
+00222                 }
+00223 
+00224                 for (it=newlr.begin(); it!=newlr.end(); ++it)
+00225                 {
+00226                         uint    n = *it;
+00227                         if (n >= _Retrievers.size())
+00228                                 continue;
+00229                         if (!_Retrievers[n].LoadCheckFlag)
+00230                                 in.insert(n);
+00231                         _Retrievers[n].LoadCheckFlag = false;
+00232                 }
+00233 
+00234                 for (it=_LoadedRetrievers.begin(); it!=_LoadedRetrievers.end(); ++it)
+00235                 {
+00236                         uint    n = *it;
+00237                         if (n >= _Retrievers.size())
+00238                                 continue;
+00239                         if (_Retrievers[n].LoadCheckFlag)
+00240                                 out.insert(n);
+00241                         _Retrievers[n].LoadCheckFlag = false;
+00242                 }
+00243         }
+
+

+ + + + +
+ + + + + + + + + +
const std::string& NLPACS::CRetrieverBank::getNamePrefix  )  const [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 278 of file retriever_bank.h. +

+References _NamePrefix. +

+Referenced by NLPACS::CGlobalRetriever::findCollisionChains(), NLPACS::CGlobalRetriever::refreshLrAround(), and NLPACS::CGlobalRetriever::refreshLrAroundNow(). +

+

00278 { return _NamePrefix; }
+
+

+ + + + +
+ + + + + + + + + + +
const CLocalRetriever& NLPACS::CRetrieverBank::getRetriever uint  n  )  const [inline]
+
+ + + + + +
+   + + +

+Gets nth retriever. +

+ +

+Definition at line 82 of file retriever_bank.h. +

+References _Retrievers, nlassert, and uint. +

+Referenced by NLPACS::CGlobalRetriever::check(), NLPACS::CGlobalRetriever::findAStarPath(), NLPACS::CGlobalRetriever::findCollisionChains(), NLPACS::CGlobalRetriever::findPath(), NLPACS::CGlobalRetriever::getMeanHeight(), NLPACS::CGlobalRetriever::getRetriever(), NLPACS::CGlobalRetriever::getSurfaceById(), NLPACS::CGlobalRetriever::initAll(), NLPACS::CGlobalRetriever::retrievePosition(), NLPACS::CGlobalRetriever::testCollisionWithCollisionChains(), and NLPACS::CGlobalRetriever::testMovementWithCollisionChains(). +

+

00083         {
+00084                 nlassert(n < _Retrievers.size());
+00085                 /* if (!_Retrievers[n].isLoaded())
+00086                         nlwarning("Trying to access rbank '%s', retriever %d not loaded", _NamePrefix.c_str(), n); */
+00087                 return _Retrievers[n];
+00088         }
+
+

+ + + + +
+ + + + + + + + + +
const std::vector<CLocalRetriever>& NLPACS::CRetrieverBank::getRetrievers  )  const [inline]
+
+ + + + + +
+   + + +

+Returns the vector of retrievers. +

+ +

+Definition at line 76 of file retriever_bank.h. +

+References _Retrievers. +

+Referenced by NLPACS::CGlobalRetriever::check(), NLPACS::CGlobalRetriever::getIdentifier(), and NLPACS::CGlobalRetriever::makeLinks(). +

+

00076 { return _Retrievers; }
+
+

+ + + + +
+ + + + + + + + + + +
bool NLPACS::CRetrieverBank::isLoaded uint  n  )  const [inline]
+
+ + + + + +
+   + + +

+Tells if retriever is loaded. +

+ +

+Definition at line 287 of file retriever_bank.h. +

+References _Retrievers, and uint. +

+Referenced by NLPACS::CGlobalRetriever::selectInstances(). +

+

00288         {
+00289                 return (n < _Retrievers.size() && _Retrievers[n].isLoaded());
+00290         }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLPACS::CRetrieverBank::loadRetriever uint  n,
NLMISC::IStream s
[inline]
+
+ + + + + +
+   + + +

+Loads nth retriever from stream. +

+ +

+Definition at line 246 of file retriever_bank.h. +

+References _AllLoaded, _LoadedRetrievers, _NamePrefix, _Retrievers, nlwarning, s, and uint. +

+

00247         {
+00248                 if (_AllLoaded || n >= _Retrievers.size() || _Retrievers[n].isLoaded())
+00249                 {
+00250                         nlwarning("RetrieverBank '%s' asked to load retriever %n whereas not needed, aborted", _NamePrefix.c_str(), n);
+00251                         return;
+00252                 }
+00253 
+00254                 s.serial(_Retrievers[n]);
+00255                 _LoadedRetrievers.insert(n);
+00256         }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLPACS::CRetrieverBank::saveRetrievers const std::string &  path,
const std::string &  bankPrefix
[inline]
+
+ + + + + +
+   + + +

+Write separate retrievers using dynamic filename convention. +

+ +

+Definition at line 185 of file retriever_bank.h. +

+References _Retrievers, NLMISC::IStream::serial(), and uint. +

+Referenced by saveShortBank(). +

+

00186         {
+00187                 uint    i;
+00188                 for (i=0; i<_Retrievers.size(); ++i)
+00189                 {
+00190                         NLMISC::COFile  f(NLMISC::CPath::standardizePath(path) + bankPrefix + "_" + NLMISC::toString(i) + ".lr");
+00191                         f.serial(_Retrievers[i]);
+00192                 }
+00193         }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NLPACS::CRetrieverBank::saveShortBank const std::string &  path,
const std::string &  bankPrefix,
bool  saveLr = true
[inline]
+
+ + + + + +
+   + + +

+Write separate retrievers using dynamic filename convention. +

+ +

+Definition at line 196 of file retriever_bank.h. +

+References _LrInRBank, saveRetrievers(), and serial(). +

+

00197         {
+00198                 NLMISC::COFile  f(NLMISC::CPath::standardizePath(path) + bankPrefix + ".rbank");
+00199 
+00200                 _LrInRBank = false;
+00201 
+00202                 serial(f);
+00203 
+00204                 if (saveLr)
+00205                         saveRetrievers(path, bankPrefix);
+00206         }
+
+

+ + + + +
+ + + + + + + + + + +
void NLPACS::CRetrieverBank::serial NLMISC::IStream f  )  [inline]
+
+ + + + + +
+   + + +

+Serialises this CRetrieverBank. +

+ +

+Definition at line 114 of file retriever_bank.h. +

+References _AllLoaded, _LrInRBank, _NamePrefix, _Retrievers, NLMISC::IStream::isReading(), NLMISC::CPath::lookup(), nlinfo, nlwarning, num, NLMISC::IStream::serial(), NLMISC::IStream::serialCont(), NLMISC::IStream::serialVersion(), uint, and uint32. +

+Referenced by saveShortBank(). +

+

00115         {
+00116                 /*
+00117                 Version 0:
+00118                         - base version.
+00119                 Version 1:
+00120                         - saves & loads lr in rbank only if bool LrInFile true
+00121                 */
+00122                 uint    ver = f.serialVersion(1);
+00123 
+00124                 bool    lrPresent = true;
+00125                 if (ver > 0)
+00126                 {
+00127                         lrPresent = _LrInRBank;
+00128                         f.serial(lrPresent);
+00129                 }
+00130 
+00131                 if (f.isReading())
+00132                 {
+00133                         if (!_AllLoaded)
+00134                         {
+00135                                 uint32  num = 0;
+00136                                 f.serial(num);
+00137                                 nlinfo("Presetting RetrieverBank '%s', %d retriever slots allocated", _NamePrefix.c_str(), num);
+00138                                 _Retrievers.resize(num);
+00139                         }
+00140                         else if (lrPresent)
+00141                         {
+00142                                 f.serialCont(_Retrievers);
+00143                         }
+00144                         else
+00145                         {
+00146                                 uint32  num = 0;
+00147                                 f.serial(num);
+00148                                 _Retrievers.resize(num);
+00149 
+00150                                 uint    i;
+00151                                 for (i=0; i<num; ++i)
+00152                                 {
+00153                                         std::string     fname = NLMISC::CPath::lookup(_NamePrefix + "_" + NLMISC::toString(i) + ".lr", false, true);
+00154                                         if (fname == "")
+00155                                                 continue;
+00156 
+00157                                         NLMISC::CIFile  f(fname);
+00158                                         try
+00159                                         {
+00160                                                 f.serial(_Retrievers[i]);
+00161                                         }
+00162                                         catch (NLMISC::Exception &e)
+00163                                         {
+00164                                                 nlwarning("Couldn't load retriever file '%s', %s", fname.c_str(), e.what());
+00165                                                 _Retrievers[i].clear();
+00166                                         }
+00167                                 }
+00168                         }
+00169                 }
+00170                 else
+00171                 {
+00172                         if (lrPresent)
+00173                         {
+00174                                 f.serialCont(_Retrievers);
+00175                         }
+00176                         else
+00177                         {
+00178                                 uint32  num = _Retrievers.size();
+00179                                 f.serial(num);
+00180                         }
+00181                 }
+00182         }
+
+

+ + + + +
+ + + + + + + + + + +
void NLPACS::CRetrieverBank::setLrInFileFlag bool  status  )  [inline]
+
+ + + + + +
+   + + +

+Set the lr status. +

+ +

+Definition at line 111 of file retriever_bank.h. +

+References _LrInRBank. +

+

00111 { _LrInRBank = status; }
+
+

+ + + + +
+ + + + + + + + + + +
void NLPACS::CRetrieverBank::setNamePrefix const char *  prefix  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 281 of file retriever_bank.h. +

+References _NamePrefix. +

+

00281 { _NamePrefix = prefix; }
+
+

+ + + + +
+ + + + + + + + + + +
void NLPACS::CRetrieverBank::setRetrieverAsLoaded uint  n  )  [inline]
+
+ + + + + +
+   + + +

+Insert a retriever in loaded list. +

+ +

+Definition at line 259 of file retriever_bank.h. +

+References _LoadedRetrievers, and uint. +

+

00260         {
+00261                 _LoadedRetrievers.insert(n);
+00262         }
+
+

+ + + + +
+ + + + + + + + + +
uint NLPACS::CRetrieverBank::size  )  const [inline]
+
+ + + + + +
+   + + +

+Returns the number of retrievers in the bank. +

+ +

+Definition at line 79 of file retriever_bank.h. +

+References _Retrievers, and uint. +

+

00079 { return _Retrievers.size(); }
+
+

+ + + + +
+ + + + + + + + + + +
void NLPACS::CRetrieverBank::unloadRetriever uint  n  )  [inline]
+
+ + + + + +
+   + + +

+Unload nth retriever. +

+ +

+Definition at line 265 of file retriever_bank.h. +

+References _AllLoaded, _LoadedRetrievers, _NamePrefix, _Retrievers, nlwarning, and uint. +

+

00266         {
+00267                 if (_AllLoaded || n >= _Retrievers.size() || !_Retrievers[n].isLoaded())
+00268                 {
+00269                         nlwarning("RetrieverBank '%s' asked to unload retriever %n whereas not needed, aborted", _NamePrefix.c_str(), n);
+00270                         return;
+00271                 }
+00272 
+00273                 _Retrievers[n].clear();
+00274                 _LoadedRetrievers.erase(n);
+00275         }
+
+


Friends And Related Function Documentation

+

+ + + + +
+ + +
friend class URetrieverBank [friend] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 53 of file retriever_bank.h.

+


Field Documentation

+

+ + + + +
+ + +
bool NLPACS::CRetrieverBank::_AllLoaded [protected] +
+
+ + + + + +
+   + + +

+All loaded ? +

+ +

+Definition at line 60 of file retriever_bank.h. +

+Referenced by allLoaded(), NLPACS::URetrieverBank::createRetrieverBank(), CRetrieverBank(), loadRetriever(), serial(), and unloadRetriever().

+

+ + + + +
+ + +
std::set<uint> NLPACS::CRetrieverBank::_LoadedRetrievers [protected] +
+
+ + + + + +
+   + + +

+The loaded retrievers, if the retriever bank is not in loadAll mode. +

+ +

+Definition at line 66 of file retriever_bank.h. +

+Referenced by diff(), loadRetriever(), setRetrieverAsLoaded(), and unloadRetriever().

+

+ + + + +
+ + +
bool NLPACS::CRetrieverBank::_LrInRBank [protected] +
+
+ + + + + +
+   + + +

+Tells if retrievers should be read from rbank directly or streamed from disk. +

+ +

+Definition at line 69 of file retriever_bank.h. +

+Referenced by CRetrieverBank(), saveShortBank(), serial(), and setLrInFileFlag().

+

+ + + + +
+ + +
std::string NLPACS::CRetrieverBank::_NamePrefix [protected] +
+
+ + + + + +
+   + + +

+Bank name prefix. +

+ +

+Definition at line 63 of file retriever_bank.h. +

+Referenced by NLPACS::URetrieverBank::createRetrieverBank(), getNamePrefix(), loadRetriever(), serial(), setNamePrefix(), and unloadRetriever().

+

+ + + + +
+ + +
std::vector<CLocalRetriever> NLPACS::CRetrieverBank::_Retrievers [protected] +
+
+ + + + + +
+   + + +

+The retrievers stored in the retriever bank. +

+ +

+Definition at line 57 of file retriever_bank.h. +

+Referenced by addRetriever(), clean(), diff(), getRetriever(), getRetrievers(), isLoaded(), loadRetriever(), saveRetrievers(), serial(), size(), and unloadRetriever().

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 14:23:21 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1