src/ell/SC_Listing.cc
Go to the documentation of this file.00001 #include "ell/SC_Listing.hh" 00002 00003 namespace ell { 00004 00005 SC_Listing::SC_Listing() 00006 : SC_Counting(), stateList() 00007 {} 00008 00009 SC_Listing::~SC_Listing() 00010 { 00011 // delete all collected State objects 00012 for ( List::iterator it = stateList.begin(); 00013 it != stateList.end(); it++ ) 00014 { 00015 delete *it; 00016 } 00017 // clear NULL pointer list 00018 stateList.clear(); 00019 } 00020 00021 // This function is used to track all added intermediate States. 00022 // @param s the added State 00023 void 00024 SC_Listing::add(const State& s) { 00025 // store a copy of s 00026 stateList.push_back(s.clone()); 00027 } 00028 00029 // Returns number of added States. 00030 // @return the number of added states 00031 size_t 00032 SC_Listing::size() const { 00033 return stateList.size(); 00034 } 00035 00036 // Returns last added State. 00037 // @return the last added State 00038 const State* const 00039 SC_Listing::getLastAdded() const { 00040 return *(stateList.rbegin()); 00041 } 00042 00044 00045 // Returns a list of all added States. 00046 // @return the State list 00047 const SC_Listing::List& 00048 SC_Listing::getList() const { 00049 return stateList; 00050 } 00051 00052 00053 } // namespace ell