00001 #ifndef CAJUN_MDF_H 00002 #define CAJUN_MDF_H 00003 00004 00005 // Copyright (C) 2006 University of Louisiana at Lafayette 00006 00010 00011 00012 #include <string> 00013 #include <vector> 00014 #include <cassert> 00015 00016 00017 namespace cajun 00018 { 00019 00020 00022 class mdf_t 00023 { 00024 private: 00025 class builder_t; 00026 00027 public: 00029 class speed_limit_t 00030 { 00031 public: 00032 speed_limit_t (unsigned id_, double min_, double max_) : 00033 m_id (id_), m_min_speed (min_), m_max_speed (max_) {} 00034 00036 unsigned id () const { return m_id; } 00038 double min_speed () const { return m_min_speed; } 00040 double max_speed () const { return m_max_speed; } 00041 00042 private: 00043 friend class builder_t; 00044 00045 unsigned m_id; 00046 double m_min_speed; 00047 double m_max_speed; 00048 }; 00049 00050 00052 static mdf_t const *load (std::string const &path_); 00053 00055 std::string const &name () const { return m_name; } 00057 std::string const &rndf_name () const { return m_rndf_name; } 00059 std::string const &format_version () const { return m_format_version; } 00061 std::string const &creation_date () const { return m_creation_date; } 00062 00064 unsigned num_checkpoints () const { return m_checkpoint.size (); } 00068 unsigned checkpoint (unsigned i_) const 00069 { 00070 assert (i_ < num_checkpoints ()); 00071 return m_checkpoint[i_]; 00072 } 00073 00075 unsigned num_speed_limits () const { return m_speed_limit.size (); } 00079 speed_limit_t const &speed_limit (unsigned id_) const 00080 { 00081 assert (id_ > 0 && id_ <= num_speed_limits ()); 00082 return m_speed_limit[id_ - 1]; 00083 } 00084 00085 private: 00086 std::string m_name; 00087 std::string m_rndf_name; 00088 00089 std::string m_format_version; 00090 std::string m_creation_date; 00091 00093 std::vector<unsigned> m_checkpoint; 00095 std::vector<speed_limit_t> m_speed_limit; 00096 }; 00097 00098 00099 }; 00100 00101 00102 #endif
1.6.1