$search
00001 /* -*- mode: C++ -*- 00002 * 00003 * Copyright (C) 2007, Tarun Nimmagadda 00004 * 00005 * License: Modified BSD Software License Agreement 00006 * 00007 * $Id: Mission.h 435 2010-08-20 15:24:22Z jack.oquin $ 00008 */ 00009 00010 //The University of Texas at Austin 00011 //This file defines the Mission Data Structure 00012 00013 //Speeds are stored in the Graph object, so this Class will 00014 //only store the Checkpoints that need to be hit. 00015 00016 #ifndef __MISSION_h__ 00017 #define __MISSION_h__ 00018 00019 #include <cstdlib> 00020 #include <deque> 00021 #include <fstream> 00022 #include <art_map/RNDF.h> 00023 #include <art_map/Graph.h> 00024 00025 class Mission{ 00026 public: 00027 Mission(const MDF& mdf); 00028 Mission(const Mission& that); 00029 ~Mission() 00030 { 00031 clear(); 00032 }; 00033 00034 bool compare(const Mission &that); 00035 00036 00037 void print(); 00038 //Removes the Current Checkpoint from the list 00039 bool nextPoint(); 00040 int current_checkpoint_id(); 00041 int next_checkpoint_id(); 00042 ElementID current_checkpoint_elementid(); 00043 ElementID next_checkpoint_elementid(); 00044 int remaining_points(){return checkpoint_ids.size();} 00045 //Returns whether the MDF was valid match to the graph 00046 bool populate_elementid(const Graph& graph); 00047 00048 // Hooks to save, reload Mission state 00049 void save(const char* fName); 00050 bool load(const char* fName, const Graph& graph); 00051 void clear(); 00052 00053 //NOTE: Checkpoints are stored in reverse order 00054 std::deque<int> checkpoint_ids; 00055 //Element ID is stored here. 00056 std::deque<ElementID> checkpoint_elementid; 00057 }; 00058 00059 /*int parse_integer(std::string line, std::string token, bool& valid);*/ 00060 ElementID parse_elementid(std::string line, bool& valid); 00061 #endif