Parameter.h
Go to the documentation of this file.
00001 #ifndef FACE_CONTOUR_DETECTOR_FILTERS_PARAMETER_H_
00002 #define FACE_CONTOUR_DETECTOR_FILTERS_PARAMETER_H_
00003 
00004 #include <vector>
00005 #include <string>
00006 #include <cassert>
00007 #include <sstream>
00008 
00009 #include <iostream>
00010 
00011 namespace face_contour_detector {
00012         namespace filters {
00014                 enum ParameterType {
00015                         TBOOL, 
00016                         TINT, 
00017                         TDOUBLE, 
00018                         TSTRING 
00019                 };
00021                 class Parameter {
00022                 public:
00026                         Parameter(const std::string& name, bool* ptr) : m_name(name), m_type(TBOOL), m_valuePtrB(ptr), m_valuePtrI(0), m_valuePtrD(0), m_valuePtrS(0) {}
00030                         Parameter(const std::string& name, int* ptr) : m_name(name), m_type(TINT), m_valuePtrB(0), m_valuePtrI(ptr), m_valuePtrD(0), m_valuePtrS(0) {}
00036                         Parameter(const std::string& name, int* ptr, int rulerMinimum, int rulerMaximum) : m_name(name), m_type(TINT), m_valuePtrB(0), m_valuePtrI(ptr), m_valuePtrD(0), m_valuePtrS(0) {
00037                                 std::stringstream minS;
00038                                 minS<<rulerMinimum;
00039                                 m_rulerMinimum = minS.str();
00040                                 std::stringstream maxS;
00041                                 maxS<<rulerMaximum;
00042                                 m_rulerMaximum = maxS.str();
00043                         }
00047                         Parameter(const std::string& name, double* ptr) : m_name(name), m_type(TDOUBLE), m_valuePtrB(0), m_valuePtrI(0), m_valuePtrD(ptr), m_valuePtrS(0) {
00048                         }
00054                         Parameter(const std::string& name, double* ptr, double rulerMinimum, double rulerMaximum) : m_name(name), m_type(TDOUBLE), m_valuePtrB(0), m_valuePtrI(0), m_valuePtrD(ptr), m_valuePtrS(0) {
00055                                 std::stringstream minS;
00056                                 minS<<rulerMinimum;
00057                                 m_rulerMinimum = minS.str();
00058                                 std::stringstream maxS;
00059                                 maxS<<rulerMaximum;
00060                                 m_rulerMaximum = maxS.str();
00061                         }
00065                         Parameter(const std::string& name, std::string* ptr) : m_name(name), m_type(TSTRING), m_valuePtrB(0), m_valuePtrI(0), m_valuePtrD(0), m_valuePtrS(ptr) {}
00068                         Parameter(const Parameter& other) :  m_name(other.m_name), m_type(other.m_type), m_rulerMinimum(other.m_rulerMinimum), m_rulerMaximum(other.m_rulerMaximum), m_valuePtrB(other.m_valuePtrB), m_valuePtrI(other.m_valuePtrI), m_valuePtrD(other.m_valuePtrD), m_valuePtrS(other.m_valuePtrS) {}
00069 
00072                         const std::string& GetName() const { return m_name; }
00075                         ParameterType GetType() const { return m_type; }
00076 
00080                         bool* GetBoolValuePtr() const { assert(m_valuePtrB != 0); return m_valuePtrB; }
00084                         int* GetIntValuePtr() const { assert(m_valuePtrI != 0); return m_valuePtrI; }
00088                         double* GetDoubleValuePtr() const { assert(m_valuePtrD != 0); return m_valuePtrD; }
00092                         std::string* GetStringValuePtr() const { assert(m_valuePtrS != 0); return m_valuePtrS; }
00094                         std::string GetRulerMinimum() { return m_rulerMinimum; }
00096                         std::string GetRulerMaximum() { return m_rulerMaximum; }
00097 
00098                 private:
00099                         std::string m_name;
00100                         ParameterType m_type;
00101 
00102                         std::string m_rulerMinimum;
00103                         std::string m_rulerMaximum;
00104 
00105                         //NOTE: this could be just a single pointer that could be changed with casting, could be optimized later
00106                         bool* m_valuePtrB;
00107                         int* m_valuePtrI;
00108                         double* m_valuePtrD;
00109                         std::string* m_valuePtrS;
00110                 };
00111         }
00112 }
00113 #endif /* FACE_CONTOUR_DETECTOR_FILTERS_PARAMETER_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends


face_contour_detector
Author(s): Fabian Wenzelmann and Julian Schmid
autogenerated on Wed Dec 26 2012 16:18:17