kmlFactories.h
Go to the documentation of this file.
00001 
00002 #ifndef KMLFACTORIES_H
00003 #define KMLFACTORIES_H
00004 
00005 #include "common/exception.h"
00006 
00007 #include "KNI/kmlBase.h"
00008 #include "KNI/kmlMotBase.h"
00009 #include "KNI/kmlSctBase.h"
00010 
00011 //<tfromm date="22.05.2009">
00012 #include <cstdlib>
00013 //</tfromm>
00014 #include <string>
00015 #include <fstream>
00016 
00021 
00025 class ConfigFileStateException : public Exception {
00026 public:
00027         ConfigFileStateException() throw ():
00028                 Exception("ConfigFile is not open or other failure", -41) {}
00029 };
00030 
00034 class ConfigFileSectionNotFoundException : public Exception {
00035 public:
00036         ConfigFileSectionNotFoundException(const std::string & attribute) throw ():
00037                 Exception("Could not find section '" + attribute + "' in configfile", -42) {}
00038 };
00039 
00043 class ConfigFileSubsectionNotFoundException : public Exception {
00044 public:
00045         ConfigFileSubsectionNotFoundException(const std::string & attribute) throw ():
00046                 Exception("Could not find subsection '" + attribute + "' in configfile", -43) {}
00047 };
00048 
00052 class ConfigFileEntryNotFoundException : public Exception {
00053 public:
00054         ConfigFileEntryNotFoundException(const std::string & attribute) throw ():
00055                 Exception("Could not find entry '" + attribute + "' in configfile", -44) {}
00056 };
00057 
00061 class ConfigFileSyntaxErrorException : public Exception {
00062 public:
00063         ConfigFileSyntaxErrorException(const std::string & line) throw ():
00064                 Exception("Syntax error in this line: '" + line + "'", -45) {}
00065 };
00066 
00070 
00071 
00072 namespace KNI {
00073 
00078         class DLLDIR kmlFactory {
00079         private:
00080                 std::ifstream _configfile;
00081                 void _readEntry(char* dest, int destsz, const char* section, const char* subsection, const char* entry);
00082         public:
00083                 
00084                 kmlFactory();
00085 
00086                 bool openFile(const char* filepath) {
00087                         _configfile.open(filepath);
00088                         return _configfile.fail() ? false : true;
00089                 }
00090 #ifdef _UNICODE
00091                 bool openFile(const wchar_t* filepath) {
00092                         _configfile.open(filepath);
00093                         return _configfile.fail() ? false : true;
00094                 }
00095 #endif
00096                 
00097                 TKatGNL   getGNL();
00098                 TKatMOT   getMOT();
00099                 TKatSCT   getSCT();
00100                 TKatEFF   getEFF();
00101                 TMotDesc* getMotDesc(short count);
00102                 TSctDesc* getSctDesc(short count);
00103 
00104                 TMotCLB getMotCLB(short number);
00105                 TMotSCP getMotSCP(short number);
00106                 TMotDYL getMotDYL(short number);
00107                 
00110                 int getType();
00113                 int getKinematics();
00114 
00115                 TMotInit getMotInit(short number);
00116                 
00117                 void getGripperParameters(bool& isPresent, int& openEncoders, int& closeEncoders);
00118         };
00119 
00120         
00121 
00122 }
00123 
00124 #endif


kni
Author(s): Martin Günther
autogenerated on Mon Aug 14 2017 02:44:12