PrefixMaxKeyGenerator Class Reference

#include <PrefixMaxKeyGenerator.h>

List of all members.

Public Member Functions

 PrefixMaxKeyGenerator ()
 ~PrefixMaxKeyGenerator ()
bool addKeyThing (std::string theName, std::string thePrefix, int theMax=0)
void removeKeyThing (std::string theName)
bool existsKeyThing (std::string theName)
void updateMaxTo (std::string theName, int posibleMax)
bool generateKeyOf (std::string theName, std::string &theInputString)
bool generateKeyOf (std::string theName, int posibleMax, std::string &theInputString)
bool getPrefixOf (std::string theName, std::string &theInputString)
int getCurrentMaxOf (std::string theName)
int getTotalThingsNumber ()
void clear ()

Private Attributes

int numberOfKeyThings
std::map< std::string, KeyThingkeyThings


Detailed Description

Definition at line 20 of file PrefixMaxKeyGenerator.h.


Constructor & Destructor Documentation

PrefixMaxKeyGenerator::PrefixMaxKeyGenerator (  ) 

Definition at line 19 of file PrefixMaxKeyGenerator.cxx.

References numberOfKeyThings.

00020         {
00021                 numberOfKeyThings = 0;          
00022         }

PrefixMaxKeyGenerator::~PrefixMaxKeyGenerator (  ) 

Definition at line 27 of file PrefixMaxKeyGenerator.cxx.

References clear().

00028         {
00029                 clear();
00030         }

Here is the call graph for this function:


Member Function Documentation

bool PrefixMaxKeyGenerator::addKeyThing ( std::string  theName,
std::string  thePrefix,
int  theMax = 0 
)

Definition at line 44 of file PrefixMaxKeyGenerator.cxx.

References keyThings.

Referenced by OutlineModelManager::OutlineModelManager().

00045         {
00046                 KeyThing * kThing = new KeyThing(thePrefix, theMax);
00047                 int before = keyThings.size();
00048                 keyThings.insert(std::pair < std::string, KeyThing >( theName, *kThing ));
00049                 int after = keyThings.size();                   
00050                 return after > before;
00051         }

Here is the caller graph for this function:

void PrefixMaxKeyGenerator::clear (  ) 

Definition at line 188 of file PrefixMaxKeyGenerator.cxx.

References keyThings, and numberOfKeyThings.

Referenced by OutlineModelManager::clean(), and ~PrefixMaxKeyGenerator().

00189         {               
00190                 std::map<std::string, KeyThing >::iterator iter = keyThings.begin();
00191                 while( iter != keyThings.end() )
00192                 {
00193                         keyThings.erase(iter);                  
00194                 }
00195                 keyThings.clear();              
00196                 numberOfKeyThings = 0;
00197         }

Here is the caller graph for this function:

bool PrefixMaxKeyGenerator::existsKeyThing ( std::string  theName  ) 

Definition at line 68 of file PrefixMaxKeyGenerator.cxx.

References keyThings.

00069         {
00070                 return keyThings.find(theName) != keyThings.end();              
00071         }

bool PrefixMaxKeyGenerator::generateKeyOf ( std::string  theName,
int  posibleMax,
std::string &  theInputString 
)

Definition at line 118 of file PrefixMaxKeyGenerator.cxx.

References KeyThing::getPrefix(), KeyThing::getValue(), keyThings, and KeyThing::setValue().

00119         {
00120                 theInputString = "";
00121                 std::map<std::string, KeyThing >::iterator iterP = keyThings.find(theName);
00122                 if ( iterP != keyThings.end() )
00123                 {       
00124                         KeyThing kthing = (iterP->second);
00125                         int max = kthing.getValue();
00126 
00127                         if ( max < posibleMax )
00128                         {
00129                                 kthing.setValue(posibleMax);
00130                         }
00131 
00132 
00133                         std::ostringstream genKey;
00134                         genKey<<kthing.getPrefix() << " " << kthing.getValue();
00135                         theInputString = genKey.str();
00136                         return true;
00137                 }
00138                 return false;
00139         }

Here is the call graph for this function:

bool PrefixMaxKeyGenerator::generateKeyOf ( std::string  theName,
std::string &  theInputString 
)

Definition at line 95 of file PrefixMaxKeyGenerator.cxx.

References KeyThing::getPrefix(), KeyThing::getValue(), and keyThings.

Referenced by OutlineModelManager::addAxe(), OutlineModelManager::addImageSection(), OutlineModelManager::addImageSource(), and OutlineModelManager::addOutline().

00096         {
00097                 theInputString = "";
00098                 std::map<std::string, KeyThing >::iterator iterP = keyThings.find(theName);
00099                 if ( iterP != keyThings.end() )
00100                 {                       
00101                         KeyThing kthing = (iterP->second);
00102                         int max = kthing.getValue();                    
00103                         std::ostringstream genKey;
00104                         genKey<<kthing.getPrefix() << " " << max;
00105                         theInputString = genKey.str();
00106                         return true;
00107                 }
00108                 return false;
00109         }

Here is the call graph for this function:

Here is the caller graph for this function:

int PrefixMaxKeyGenerator::getCurrentMaxOf ( std::string  theName  ) 

Definition at line 165 of file PrefixMaxKeyGenerator.cxx.

References KeyThing::getValue(), and keyThings.

00166         {
00167                 std::map<std::string, KeyThing >::iterator iterP = keyThings.find(theName);
00168                 if ( iterP != keyThings.end() )
00169                 {       
00170                         KeyThing kthing = (iterP->second);
00171                         return kthing.getValue();                       
00172                 }
00173                 return -1;
00174         }

Here is the call graph for this function:

bool PrefixMaxKeyGenerator::getPrefixOf ( std::string  theName,
std::string &  theInputString 
)

Definition at line 147 of file PrefixMaxKeyGenerator.cxx.

References KeyThing::getPrefix(), and keyThings.

00148         {
00149                 theInputString = "";
00150                 std::map<std::string, KeyThing >::iterator iterP = keyThings.find(theName);
00151                 if ( iterP != keyThings.end() )
00152                 {       
00153                         KeyThing kthing = (iterP->second);
00154                         theInputString = kthing.getPrefix();
00155                         return true;
00156                 }
00157                 return false;
00158         }

Here is the call graph for this function:

int PrefixMaxKeyGenerator::getTotalThingsNumber (  ) 

Definition at line 180 of file PrefixMaxKeyGenerator.cxx.

References keyThings.

00181         {
00182                 return keyThings.size();
00183         }

void PrefixMaxKeyGenerator::removeKeyThing ( std::string  theName  ) 

Definition at line 57 of file PrefixMaxKeyGenerator.cxx.

References keyThings.

00058         {
00059                 keyThings.erase(theName);               
00060         }

void PrefixMaxKeyGenerator::updateMaxTo ( std::string  theName,
int  posibleMax 
)

Definition at line 78 of file PrefixMaxKeyGenerator.cxx.

References keyThings.

00079         {
00080                 std::map<std::string, KeyThing >::iterator iterP = keyThings.find(theName);
00081                 if ( iterP != keyThings.end() )
00082                 {
00083                         int max = (iterP->second).getValue();
00084                         if ( max < posibleMax )
00085                                 (iterP->second).setValue(posibleMax);
00086                 }
00087         }


Member Data Documentation

std::map<std::string,KeyThing> PrefixMaxKeyGenerator::keyThings [private]

Definition at line 125 of file PrefixMaxKeyGenerator.h.

Referenced by clear(), and PrefixMaxKeyGenerator().


The documentation for this class was generated from the following files:

Generated on Wed Jun 27 23:28:34 2012 for creaContours_lib by  doxygen 1.5.7.1