Last change
on this file since 84 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
|
Rev | Line | |
---|
[15] | 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 | |
---|
| 17 | namespace morpheo { |
---|
| 18 | |
---|
[78] | 19 | template<typename T> inline T fromString (const std::string& x) |
---|
[15] | 20 | { |
---|
| 21 | return static_cast<T>(x.c_str()); |
---|
| 22 | } |
---|
| 23 | |
---|
[78] | 24 | template<> inline uint32_t fromString<uint32_t> (const std::string& x) |
---|
[15] | 25 | { |
---|
[78] | 26 | return static_cast<uint32_t>(atoi(x.c_str())); |
---|
[15] | 27 | } |
---|
[78] | 28 | |
---|
| 29 | template<> inline bool fromString<bool> (const std::string& x) |
---|
| 30 | { |
---|
| 31 | return atoi(x.c_str())!=0; |
---|
| 32 | } |
---|
[15] | 33 | |
---|
| 34 | }; // end namespace morpheo |
---|
| 35 | |
---|
| 36 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.