KatanaNativeInterface  $VERSION$
kmlFactories.h
Go to the documentation of this file.
1 
2 #ifndef KMLFACTORIES_H
3 #define KMLFACTORIES_H
4 
5 #include "common/exception.h"
6 
7 #include "KNI/kmlBase.h"
8 #include "KNI/kmlMotBase.h"
9 #include "KNI/kmlSctBase.h"
10 
11 #include <string>
12 #include <fstream>
13 
18 
23 public:
25  Exception("ConfigFile is not open or other failure", -41) {}
26 };
27 
32 public:
33  ConfigFileSectionNotFoundException(const std::string & attribute) throw ():
34  Exception("Could not find section '" + attribute + "' in configfile", -42) {}
35 };
36 
41 public:
42  ConfigFileSubsectionNotFoundException(const std::string & attribute) throw ():
43  Exception("Could not find subsection '" + attribute + "' in configfile", -43) {}
44 };
45 
50 public:
51  ConfigFileEntryNotFoundException(const std::string & attribute) throw ():
52  Exception("Could not find entry '" + attribute + "' in configfile", -44) {}
53 };
54 
59 public:
60  ConfigFileSyntaxErrorException(const std::string & line) throw ():
61  Exception("Syntax error in this line: '" + line + "'", -45) {}
62 };
63 
67 
68 
69 namespace KNI {
70 
76  private:
77  std::ifstream _configfile;
78  void _readEntry(char* dest, int destsz, const char* section, const char* subsection, const char* entry);
79  public:
80 
81  kmlFactory();
82 
83  bool openFile(const char* filepath) {
84  _configfile.open(filepath);
85  return _configfile.fail() ? false : true;
86  }
87 #ifdef _UNICODE
88  bool openFile(const wchar_t* filepath) {
89  _configfile.open(filepath);
90  return _configfile.fail() ? false : true;
91  }
92 #endif
93 
94  TKatGNL getGNL();
95  TKatMOT getMOT();
96  TKatSCT getSCT();
97  TKatEFF getEFF();
98  TMotDesc* getMotDesc(short count);
99  TSctDesc* getSctDesc(short count);
100 
101  TMotCLB getMotCLB(short number);
102  TMotSCP getMotSCP(short number);
103  TMotDYL getMotDYL(short number);
106  int getType();
107 
108  TMotInit getMotInit(short number);
109 
110  void getGripperParameters(bool& isPresent, int& openEncoders, int& closeEncoders);
111  };
112 
113 
114 
115 }
116 
117 #endif
The requested section could not be found.
Definition: kmlFactories.h:31
bool openFile(const char *filepath)
Definition: kmlFactories.h:83
[SCT] every sens ctrl&#39;s attributes
Definition: kmlSctBase.h:41
#define DLLDIR
Definition: dllexport.h:30
Initial motor parameters.
Definition: kmlMotBase.h:198
Exception(const std::string &message, const int error_number)
Definition: exception.h:85
std::ifstream _configfile
Definition: kmlFactories.h:77
The state of the configuration file wasn&#39;t "good".
Definition: kmlFactories.h:22
The requested entry could not be found.
Definition: kmlFactories.h:49
ConfigFileEntryNotFoundException(const std::string &attribute)
Definition: kmlFactories.h:51
[DYL] dynamic limits
Definition: kmlMotBase.h:137
Calibration structure for single motors.
Definition: kmlMotBase.h:181
Inverse Kinematics structure of the endeffektor.
Definition: kmlBase.h:113
[MOT] every motor&#39;s attributes
Definition: kmlMotBase.h:40
ConfigFileSubsectionNotFoundException(const std::string &attribute)
Definition: kmlFactories.h:42
sensor controller description (partly)
Definition: kmlSctBase.h:33
[SCP] static controller parameters
Definition: kmlMotBase.h:109
ConfigFileSectionNotFoundException(const std::string &attribute)
Definition: kmlFactories.h:33
[GNL] general robot attributes
Definition: kmlBase.h:67
motor description (partly)
Definition: kmlMotBase.h:34
There was a syntax error in the configuration file.
Definition: kmlFactories.h:58
This class is for internal use only It may change at any time It shields the configuration file parsi...
Definition: kmlFactories.h:75
The requested subsection could not be found.
Definition: kmlFactories.h:40
ConfigFileSyntaxErrorException(const std::string &line)
Definition: kmlFactories.h:60
Definition: Timer.h:30