MachineIntelligenceCore:Algorithms
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IBMFontMatrixImporter.hpp
Go to the documentation of this file.
1 
23 #ifndef SRC_importers_IBMFONTMATRIXIMPORTER_HPP_
24 #define SRC_importers_IBMFONTMATRIXIMPORTER_HPP_
25 
26 #include <importers/Importer.hpp>
27 #include <types/MatrixTypes.hpp>
28 
29 namespace mic {
30 namespace importers {
31 
37 {
40 };
41 
42 } /* namespace importers */
43 } /* namespace mic */
44 
45 namespace mic {
46 namespace configuration {
47 
48 
53 template<>
54 class LexicalTranslator<mic::importers::IBMfont_t> {
55 public:
56  static std::string toStr(const mic::importers::IBMfont_t & val) {
57  try {
58  return boost::lexical_cast<std::string>((unsigned int)val);
59  } catch(...) {
60  std::stringstream ss;
61  ss << val;
62  return ss.str();
63  }
64  return "";
65  }
66 
67  static mic::importers::IBMfont_t fromStr(const std::string & str) {
68  try {
69  return (mic::importers::IBMfont_t) boost::lexical_cast<unsigned int>(str);
70  } catch (...) {
71  std::stringstream ss(str);
72  unsigned int ret;
73  ss >> ret;
74  return (mic::importers::IBMfont_t) ret;
75  }
76  // If failed, return 8x8.
78  }
79 };
80 
81 } /* namespace configuration */
82 } /* namespace mic */
83 
84 
85 namespace mic {
86 namespace importers {
87 
88 
93 class IBMFontMatrixImporter: public mic::importers::Importer< mic::types::MatrixXf, char> {
94 public:
99  IBMFontMatrixImporter(std::string node_name_ = "ibm_font_matrix_importer");
100 
104  virtual ~IBMFontMatrixImporter() { };
105 
110  bool importData();
111 
116 
117 private:
121  mic::configuration::Property<IBMfont_t> font_type;
122 };
123 
124 } /* namespace importers */
125 } /* namespace mic */
126 
127 #endif /* SRC_importers_IBMFONTMATRIXIMPORTER_HPP_ */
static mic::importers::IBMfont_t fromStr(const std::string &str)
static std::string toStr(const mic::importers::IBMfont_t &val)
Contains definition of basic matrix datatypes derived from Eigen.
mic::configuration::Property< IBMfont_t > font_type
IBMfont_t
IBM font type.
Parent class for all data importers.
Definition: Importer.hpp:51
Contains declaration (and definition) of base template class of all data importers.
IBMFontMatrixImporter(std::string node_name_="ibm_font_matrix_importer")
Loads characters of size 16x16.
Importer responsible for importing/loading characters from IBM VGA font dataset.
Loads characters of size 8x8.