Subversion Repositories HomeAutomation

Rev

Rev 1322 | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1. /*
  2.  * convert.h
  3.  *
  4.  *  Created on: Aug 04, 2009
  5.  *      Author: Mattias Runge
  6.  */
  7.  
  8. #ifndef CONVERT_H_
  9. #define CONVERT_H_
  10.  
  11. #include <string>
  12. #include <boost/algorithm/string/case_conv.hpp>
  13. #include "types.h"
  14. #include <fstream>
  15. #include <sstream>
  16. #include <cmath>
  17.  
  18. namespace atom {
  19. namespace convert {
  20.  
  21. using namespace std;
  22. using namespace boost::algorithm;
  23.  
  24. string bool2string(const bool b);
  25. bool string2bool(const string s);
  26. int string2int(const string s);
  27. string int2string(int i);
  28. string uint2string(unsigned int i);
  29. unsigned int string2uint(const string s);
  30. float string2float(const string s);
  31. string float2string(float f);
  32.  
  33. string bytes2string(byte_list bytes);
  34.  
  35. unsigned int hex2uint(string hex);
  36. string hex2bin(string hex);
  37. string bin2hex(string bin);
  38. float bin2float(string bin);
  39. string float2bin(float num, unsigned int length);
  40. unsigned int bin2uint(string bin);
  41. string uint2bin(unsigned int num, unsigned int length);
  42. string uint2hex(unsigned int num, unsigned int length);
  43.  
  44. string bin_invert(string bin);
  45.  
  46. unsigned int stateCount2bitCount(unsigned int stateCount);
  47.  
  48. }
  49. }
  50.  
  51. #endif // CONVERT_H_
  52.