00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef VUFACTORY_H
00011 #define VUFACTORY_H
00012
00013 #include <boost/shared_ptr.hpp>
00014 #include "Activities.h"
00015 #include "Speeds.h"
00016 #include "Technical.h"
00017 #include "Faults.h"
00018 #include "Overview.h"
00019
00020
00021 boost::shared_ptr<vublock> vuFactory(iter start){
00022 typedef boost::shared_ptr<vublock> p;
00023 if(start[0] != 0x76) throw std::runtime_error("Not a block");
00024 switch (start[1]){
00025 case Overview::TREP: return p(new Overview(start));
00026 case Activities::TREP: return p(new Activities(start));
00027 case Faults::TREP: return p(new Faults(start));
00028 case Speeds::TREP: return p(new Speeds(start));
00029 case Technical::TREP: return p(new Technical(start));
00030 default:
00031 std::cerr << "Oops! " << start[1] << std::endl;
00032 throw std::runtime_error("Unknown block");
00033 }
00034 return p();
00035 }
00036
00037
00038
00039
00040
00041
00042 #endif