- Main Page
- Classes
- Files

- File List

# OptFrame/Util/NSSeqVectorOrOpt.hpp

    00001 #ifndef OPTFRAME_NSSEQVECTOROROPT_HPP_
    00002 #define OPTFRAME_NSSEQVECTOROROPT_HPP_
    00003
    00004 // Framework includes
    00005 #include "../Move.hpp"
    00006 #include "../NSSeq.hpp"
    00007
    00008 #include "NSSeqVectorOrOptk.hpp"
    00009 #include "NSSeqUnionAdapter.hpp"
    00010
    00011 using namespace std;
    00012
    00013 // definition: OrOpt is OrOpt{1..3}
    00014
    00015 template<class T, class M = OPTFRAME_DEFAULT_MEMORY>
    00016 class NSSeqVectorOrOpt: public NSSeq<vector<T> , M>
    00017 {
    00018         typedef vector<T> Route;
    00019         NSSeq<Route, M>* ns;
    00020
    00021         NSSeqVectorOrOptk<T, M>* OrOpt1;
    00022         NSSeqVectorOrOptk<T, M>* OrOpt2;
    00023         NSSeqVectorOrOptk<T, M>* OrOpt3;
    00024
    00025         NSSeqUnionAdapter<vector<T>, M>* OrOpt2_3;
    00026         NSSeqUnionAdapter<vector<T>, M>* OrOpt1_2_3;
    00027 public:
    00028
    00029         NSSeqVectorOrOpt()
    00030         {
    00031                 OrOpt1 = new NSSeqVectorOrOptk<T, M> (1);
    00032                 OrOpt2 = new NSSeqVectorOrOptk<T, M> (2);
    00033                 OrOpt3 = new NSSeqVectorOrOptk<T, M> (3);
    00034
    00035                 OrOpt2_3 = new NSSeqUnionAdapter<vector<T>, M> (*OrOpt2, *OrOpt3);
    00036                 OrOpt1_2_3 = new NSSeqUnionAdapter<vector<T>, M> (*OrOpt1, *OrOpt2_3);
    00037         }
    00038
    00039         virtual ~NSSeqVectorOrOpt()
    00040         {
    00041                 delete OrOpt1;
    00042                 delete OrOpt2;
    00043                 delete OrOpt3;
    00044
    00045                 delete OrOpt2_3;
    00046                 delete OrOpt1_2_3;
    00047         }
    00048
    00049         Move<Route, M>& move(const Route& rep)
    00050         {
    00051                 return OrOpt1_2_3->move(rep);
    00052         }
    00053
    00054         virtual NSIterator<Route, M>& getIterator(const Route& rep)
    00055         {
    00056                 return OrOpt1_2_3->getIterator(rep);
    00057         }
    00058
    00059         virtual void print()
    00060         {
    00061                 cout << "NSSeqVectorOrOpt{1..3}" << endl;
    00062         }
    00063 };
    00064
    00065 #endif /*OPTFRAME_NSSEQVECTOROROPT_HPP_*/

All Classes Functions