libalcommon  2.1.0.18
/home/opennao/work/master/sdk/libnaoqi/libalcommon/alcommon/almethodinfo.h
Go to the documentation of this file.
00001 
00010 #pragma once
00011 #ifndef _LIBALCOMMON_ALCOMMON_ALMETHODINFO_H_
00012 #define _LIBALCOMMON_ALCOMMON_ALMETHODINFO_H_
00013 
00014 # include <alcommon/api.h>
00015 # include <boost/shared_ptr.hpp>
00016 
00017 
00018 # define BLOCKINGFUNCTION     0 
00019 # define ASYNCHRONOUSFUNCTION 1 
00021 namespace AL
00022 {
00023   class ALFunctorBase;
00024 
00033   class ALMethodInfo
00034   {
00035   public:
00037     ALMethodInfo() {
00038       mask = 0;
00039     }
00040 
00042     virtual ~ALMethodInfo() {}
00043 
00048     enum methodOption {
00049       CPPMethod           = 1, 
00050       AsynchronousMethod  = 2, 
00051       localMethod         = 4  
00052     };
00053 
00058     class ALParameterInfo
00059     {
00060     public:
00061       std::string paramError;  
00062       std::string name;        
00063       std::string description; 
00064       std::string strType;     
00065       bool        optional;    
00066     };
00067 
00072     template <typename T>
00073     class ALParameterInfoOptional: public ALParameterInfo {
00074     public:
00079       ALParameterInfoOptional(T defaultValue) {
00080         m_defaultValue = defaultValue;
00081       }
00082       T m_defaultValue; 
00083     };
00084 
00089     class ALExample {
00090     public:
00091       std::string language;   
00092       std::string strExample; 
00093     };
00094 
00095     std::string                      moduleName;        
00096     std::string                      methodName;        
00097     std::string                      methodDescription; 
00098     std::vector<ALParameterInfo>     parameters;        
00099     std::string                      returnValue;       
00100     std::vector<ALExample>           examples;          
00101     boost::shared_ptr<ALFunctorBase> ptrOnMethod;       
00102     ALParameterInfo                  returnInfo;        
00103     short                            mask;              
00110     bool isCpp(void) {
00111       return ((mask & CPPMethod) == CPPMethod);
00112     }
00113 
00118     bool isAsynchronous(void) {
00119       return (mask & AsynchronousMethod) > 0 ? true: false;
00120     }
00121 
00126     bool isLocalMethod(void) {
00127       return ((mask & localMethod) == localMethod);
00128     }
00129 
00134     void addOption(int pOption)
00135     {
00136       mask = mask | (short)pOption;
00137     }
00138 
00143     ALFunctorBase* getFunction() {
00144       return ptrOnMethod.get();
00145     }
00146 
00150     void clear(void) {
00151       parameters.clear();
00152       examples.clear();
00153     }
00154   };
00155 
00156   template <typename C, typename R>
00157   void completeAndCheck(R(C::*) (), ALMethodInfo & pDesc)
00158   {
00159     //useless
00160   }
00161 
00162   template <typename C, typename P1, typename R>
00163   void completeAndCheck(R(C::*) (P1), ALMethodInfo & pDesc)
00164   {
00165     //useless
00166   }
00167 
00168   template <typename C, typename P1, typename P2, typename R>
00169   void completeAndCheck(R(C::*) (P1, P2), ALMethodInfo & pDesc)
00170   {
00171     //useless
00172   }
00173 
00174   template <typename C, typename P1, typename P2, typename P3, typename R>
00175   void completeAndCheck(R(C::*) (P1, P2, P3), ALMethodInfo & pDesc)
00176   {
00177     //useless
00178   }
00179 
00180   template <typename C, typename P1, typename P2, typename P3, typename P4, typename R>
00181   void completeAndCheck(R(C::*) (P1, P2, P3, P4), ALMethodInfo & pDesc)
00182   {
00183     //useless
00184   }
00185 
00186   template <typename C, typename P1, typename P2, typename P3, typename P4, typename P5, typename R>
00187   void completeAndCheck(R(C::*) (P1, P2, P3, P4, P5), ALMethodInfo & pDesc)
00188   {
00189     //useless
00190   }
00191 
00192   template <typename C, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename R>
00193   void completeAndCheck(R(C::*) (P1, P2, P3, P4, P5, P6), ALMethodInfo & pDesc)
00194   {
00195     //useless
00196   }
00197 
00198 }
00199 #endif  // _LIBALCOMMON_ALCOMMON_ALMETHODINFO_H_
00200 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines