Page principale | Liste des namespaces | Hiérarchie des classes | Liste alphabétique | Liste des classes | Liste des fichiers | Membres de namespace | Membres de classe

camparam.hpp

00001 #ifndef __FILE__IPSI_CAMPARAM_HPP__
00002 #define __FILE__IPSI_CAMPARAM_HPP__
00003 
00005 //  Copyright (c) 2006 for LASMEA UMR 6602 du CNRS.                  
00006 //  All rights reserved.                                             
00007 //                                                                   
00008 //  This file is part of the ipsi C++ Library.  This library is      
00009 //  free software; you can redistribute it and/or modify it under    
00010 //  the terms of the GNU Lesser General Public License as published  
00011 //  by the Free Software Foundation; either version 2.1, or (at      
00012 //  your option) any later version.                                  
00013 //                                                                   
00014 //  This library is distributed in the hope that it will be useful,  
00015 //  but WITHOUT ANY WARRANTY; without even the implied warranty of   
00016 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    
00017 //  GNU Lesser General Public License for more details.              
00018 //                                                                   
00019 //  You should have received a copy of the GNU Lesser General        
00020 //  Public License along with this library; see the file COPYING.    
00021 //  If not, send mail to the developers of ipsi                      
00022 //                                                                   
00023 //  As a special exception, you may use this file as part of a free  
00024 //  software library without restriction.  Specifically, if other    
00025 //  files instantiate templates or use macros or inline functions    
00026 //  from this file, or you compile this file and link it with other  
00027 //  files to produce an executable, this file does not by itself     
00028 //  cause the resulting executable to be covered by the GNU Lesser   
00029 //  General Public License.  This exception does not however         
00030 //  invalidate any other reasons why the executable file might be    
00031 //  covered by the GNU Lesser General Public License.                
00032 //                                                                   
00034 //  file        : camparam.hpp                                       
00035 //  created     : Tue Jul 18 15:01:32 2006                           
00036 //  by          : Christophe Tournayre                               
00037 //  description : ipsi/camparam.hpp                                  
00038 //  Modified    :                                                    
00039 //  To do       :                                                    
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 //  Beginning of ipsi namespace
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       // créer un flux à partir de la chaîne donnée
00149       std::istringstream iss( src );
00150       
00151       // Conversion vers Dest
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 //  End of ipsi namespace
00177 // /////////////////////////////////////////////////////////////////////////////
00178 
00179 
00180 
00181 
00182 #endif
00183 
00184 // /////////////////////////////////////////////////////////////////////////////
00185 // End of camparam.hpp
00186 // /////////////////////////////////////////////////////////////////////////////

Généré le Wed Aug 16 12:33:36 2006 pour IpsiC++library par  doxygen 1.4.4