Generated on Mon Jun 23 17:17:53 2008 for ell-2.3.0 by doxygen 1.5.1

src/ell/SC_Counting.cc

Go to the documentation of this file.
00001 #include "SC_Counting.hh"
00002 
00003 namespace ell
00004 {
00005 
00006     SC_Counting::SC_Counting()
00007      :  lastAdded(NULL), stateCount(0)
00008     {
00009     }
00010     
00011     SC_Counting::~SC_Counting()
00012     {
00013         if (lastAdded != NULL) {
00014             delete lastAdded;
00015             lastAdded = NULL;
00016         }
00017     }
00018 
00019       // This function is used to track all added States.
00020       // @param s the State to add
00021     void 
00022     SC_Counting::add(const State& s) {
00023         if (lastAdded != NULL)
00024             delete lastAdded;
00025         lastAdded = s.clone();
00026         stateCount++;
00027     }
00028     
00029       // Returns number of added States.
00030       // @return the number of added states
00031     size_t 
00032     SC_Counting::size() const {
00033         return stateCount;
00034     }
00035      
00036       // Returns last added State.
00037       // @return the last added State
00038     const State* const 
00039     SC_Counting::getLastAdded() const {
00040         return lastAdded;
00041     }
00042     
00043 }