Generated on Tue Dec 16 13:34:02 2008 for ell-3.0.0 by doxygen 1.5.1

src/ell/SC_Maximum.cc

Go to the documentation of this file.
00001 #include "ell/StateCollector.hh"
00002 
00003 namespace ell
00004 {
00005 
00006     SC_Maximum::SC_Maximum()
00007       : SC_Counting(), maxEState(NULL)
00008     {
00009     }
00010     
00011     SC_Maximum::~SC_Maximum()
00012     {
00013         if (maxEState != NULL)
00014             delete maxEState;
00015     }
00016 
00017       // This function is used to track all added intermediate States.
00018       // @param s the added State
00019     void 
00020     SC_Maximum::add(const State& s) {
00021         
00022           // check if current maximal energy state is smaller than s
00023         if (maxEState == NULL || maxEState->operator<(s)) {
00024             maxEState = s.clone(maxEState);
00025         }
00026         
00027           // forward to super class
00028         SC_Counting::add(s);
00029     }
00030     
00031     
00032 
00033       // Returns the maximal State seen so far
00034       // @return the State 
00035     const State* const
00036     SC_Maximum::getMaximumState() const {
00037         return maxEState;
00038     }
00039     
00040 
00041 }