Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CompositeRange.h

Go to the documentation of this file.
00001 
00017 #ifndef COMPOSITERANGE_H
00018 #define COMPOSITERANGE_H
00019 
00020 #include <Midad/Util/Undoable.h>
00021 #include <Midad/Util/Range.h>
00022 #include <Midad/Util/Signals.h>
00023 #include <vector>
00024 #include <iostream>
00025 
00026 template<class TYPE>
00027 class CompositeRange : public Undoable, public SigC::Object, 
00028                        public std::vector<SigC::Ptr<Range<TYPE> > >
00029 {
00030 
00031 public:
00032 
00033     CompositeRange() { }
00034     ~CompositeRange() { }
00035 
00036     // Undoable implementation
00037     UndoMemento GetMemento() {
00038         using namespace SigC;
00039         using namespace std;
00040 
00041         vector<UndoMemento> vum;
00042         for (unsigned int ind = 0; ind < this->size(); ++ind) {
00043             Ptr<Range<double> > r = (*this)[ind];
00044             vum.push_back(bind(slot(*r, &Range<double>::SetState),r->GetState()));
00045         }
00046         return bind(slot(*this,&CompositeRange::ProcVector),vum);
00047     }
00048 
00049     void ProcVector(std::vector<UndoMemento> vum) {
00050         for (unsigned int ind = 0; ind < vum.size(); ++ind) {
00051 //            std::cerr << "Undoing : " << ind << endl;
00052             vum[ind]();
00053         }
00054     }
00055 
00056 };                              // end of class RangeControl
00057 
00058 
00059 #endif  // COMPOSITERANGE_H

Generated on Mon Feb 15 11:06:32 2010 for loon by  doxygen 1.3.9.1