source: trunk/IPs/systemC/processor/Morpheo/Common/include/FromString.h @ 83

Last change on this file since 83 was 81, checked in by rosiere, 16 years ago
  • Finish Environment (and test)
  • Continue predictor_unit
  • Add external tools
  • svn keyword "Id" set
  • Property svn:keywords set to Id
File size: 681 bytes
Line 
1#ifndef morpheo_fromstring
2#define morpheo_fromstring
3
4/*
5 * $Id: FromString.h 81 2008-04-15 18:40:01Z rosiere $
6 *
7 * [ Description ]
8 *
9 */
10
11// #include <iosfwd>
12// #include <sstream>
13// #include <iomanip>
14#include <string>
15// #include <limits>
16
17namespace morpheo {
18 
19  template<typename T> inline T        fromString             (const std::string& x)
20  {
21    return static_cast<T>(x.c_str());
22  }
23 
24  template<>           inline uint32_t fromString<uint32_t>   (const std::string& x)
25  {
26    return static_cast<uint32_t>(atoi(x.c_str()));
27  }
28
29  template<>           inline bool     fromString<bool>       (const std::string& x)
30  {
31    return atoi(x.c_str())!=0;
32  }
33 
34}; // end namespace morpheo             
35
36#endif
Note: See TracBrowser for help on using the repository browser.