00001 #ifndef __FILE__IPSI_CAMPARAM_HPP__
00002 #define __FILE__IPSI_CAMPARAM_HPP__
00003
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00034
00035
00036
00037
00038
00039
00041
00042
00043 #include <iostream>
00044 #include <map>
00045 #include <sstream>
00046 #include <fstream>
00047 #include <list>
00048 #include "tinyxml.hpp"
00049
00050
00051
00052
00053
00054
00055 namespace ipsi
00056 {
00057
00058 typedef struct
00059 {
00061 std::string mark ;
00062
00064 int html_heading ;
00065
00067 int jpeg_heading ;
00068
00070 int heading_end ;
00071
00073 int boundary ;
00074
00076 std::string req_mjpg,
00078 req_2,
00080 req_3 ;
00081
00083 std::string req_compress ;
00084
00086 std::string req_cmd;
00087
00089 int resp_heading_size,
00091 resp_heading;
00092
00094 std::string resp_heading_mess,
00096 resp_heading_ok;
00097
00099 std::string cmd_center ,
00100
00102 cmd_left ,
00104 cmd_right ,
00106 cmd_up ,
00108 cmd_down ,
00109
00111 cmd_zoomin ,
00113 cmd_zoomout;
00114
00115 } Caminfo;
00116
00117
00118 class CamParam
00119 {
00120 private:
00121 const std::string file;
00122 const std::string reffile;
00123 Caminfo c;
00124 std::map < std::string, std::string > m;
00125 unsigned int nbElem;
00126 std::list < std::string > tag;
00127
00128 void loadXml();
00129 void loadMap();
00130 void loadTagList();
00131 bool inTagList(const std::string s);
00132
00133 public :
00134 CamParam(const std::string filename);
00135 ~CamParam() {};
00136
00137 Caminfo getStruct() const;
00138 unsigned int getNbElem() const;
00139
00140 };
00141
00142
00143 template < class T >
00144 struct check_string
00145 {
00146 static void from_string( const std::string & src, T & dest )
00147 {
00148
00149 std::istringstream iss( src );
00150
00151
00152 iss >> dest;
00153 }
00154
00155 };
00156
00157 template < >
00158 struct check_string < std::string >
00159 {
00160 static void from_string( const std::string & src, std::string & dest )
00161 {
00162 dest = src;
00163 }
00164 };
00165
00166
00167 template < class T >
00168 void from_string( const std::string & src, T & dest )
00169 {
00170 check_string<T>::from_string( src, dest );
00171 }
00172
00173 }
00174
00175
00176
00177
00178
00179
00180
00181
00182 #endif
00183
00184
00185
00186