libalcommon  2.4.3.28-r2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
almethodinfo.h
Go to the documentation of this file.
1 
10 #pragma once
11 #ifndef _LIBALCOMMON_ALCOMMON_ALMETHODINFO_H_
12 #define _LIBALCOMMON_ALCOMMON_ALMETHODINFO_H_
13 
14 # include <alcommon/api.h>
15 # include <boost/shared_ptr.hpp>
16 
17 
18 # define BLOCKINGFUNCTION 0
19 # define ASYNCHRONOUSFUNCTION 1
21 namespace AL
22 {
23  class ALFunctorBase;
24 
34  {
35  public:
38  mask = 0;
39  }
40 
42  virtual ~ALMethodInfo() {}
43 
48  enum methodOption {
49  CPPMethod = 1,
50  AsynchronousMethod = 2,
51  localMethod = 4
52  };
53 
59  {
60  public:
61  std::string paramError;
62  std::string name;
63  std::string description;
64  std::string strType;
65  bool optional;
66  };
67 
72  template <typename T>
74  public:
79  ALParameterInfoOptional(T defaultValue) {
80  m_defaultValue = defaultValue;
81  }
83  };
84 
89  class ALExample {
90  public:
91  std::string language;
92  std::string strExample;
93  };
94 
95  std::string moduleName;
96  std::string methodName;
97  std::string methodDescription;
98  std::vector<ALParameterInfo> parameters;
99  std::string returnValue;
100  std::vector<ALExample> examples;
101  boost::shared_ptr<ALFunctorBase> ptrOnMethod;
103  short mask;
110  bool isCpp(void) {
111  return ((mask & CPPMethod) == CPPMethod);
112  }
113 
118  bool isAsynchronous(void) {
119  return (mask & AsynchronousMethod) > 0 ? true: false;
120  }
121 
126  bool isLocalMethod(void) {
127  return ((mask & localMethod) == localMethod);
128  }
129 
134  void addOption(int pOption)
135  {
136  mask = mask | (short)pOption;
137  }
138 
144  return ptrOnMethod.get();
145  }
146 
150  void clear(void) {
151  parameters.clear();
152  examples.clear();
153  }
154  };
155 
156  template <typename C, typename R>
157  void completeAndCheck(R(C::*) (), ALMethodInfo & pDesc)
158  {
159  //useless
160  }
161 
162  template <typename C, typename P1, typename R>
163  void completeAndCheck(R(C::*) (P1), ALMethodInfo & pDesc)
164  {
165  //useless
166  }
167 
168  template <typename C, typename P1, typename P2, typename R>
169  void completeAndCheck(R(C::*) (P1, P2), ALMethodInfo & pDesc)
170  {
171  //useless
172  }
173 
174  template <typename C, typename P1, typename P2, typename P3, typename R>
175  void completeAndCheck(R(C::*) (P1, P2, P3), ALMethodInfo & pDesc)
176  {
177  //useless
178  }
179 
180  template <typename C, typename P1, typename P2, typename P3, typename P4, typename R>
181  void completeAndCheck(R(C::*) (P1, P2, P3, P4), ALMethodInfo & pDesc)
182  {
183  //useless
184  }
185 
186  template <typename C, typename P1, typename P2, typename P3, typename P4, typename P5, typename R>
187  void completeAndCheck(R(C::*) (P1, P2, P3, P4, P5), ALMethodInfo & pDesc)
188  {
189  //useless
190  }
191 
192  template <typename C, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename R>
193  void completeAndCheck(R(C::*) (P1, P2, P3, P4, P5, P6), ALMethodInfo & pDesc)
194  {
195  //useless
196  }
197 
198 }
199 #endif // _LIBALCOMMON_ALCOMMON_ALMETHODINFO_H_
200 
std::string methodName
Definition: almethodinfo.h:96
ALParameterInfo returnInfo
Definition: almethodinfo.h:102
ALParameterInfoOptional(T defaultValue)
Default contructor.
Definition: almethodinfo.h:79
ALParameterInfo is the introspection container.
Definition: almethodinfo.h:58
std::vector< ALParameterInfo > parameters
Definition: almethodinfo.h:98
virtual ~ALMethodInfo()
Default destructor.
Definition: almethodinfo.h:42
void completeAndCheck(R(C::*)(P1, P2, P3, P4, P5, P6), ALMethodInfo &pDesc)
Definition: almethodinfo.h:193
bool isLocalMethod(void)
Check is the method is a local one.
Definition: almethodinfo.h:126
ALFunctorBase * getFunction()
Get a pointer to the method.
Definition: almethodinfo.h:143
ALMethodInfo is the introspection container.
Definition: almethodinfo.h:33
std::string methodDescription
Definition: almethodinfo.h:97
bool isAsynchronous(void)
Check is the method is used as asynchronous one.
Definition: almethodinfo.h:118
ALExample is container for example.
Definition: almethodinfo.h:89
void clear(void)
Clear parameters and examples.
Definition: almethodinfo.h:150
bool isCpp(void)
Check is the method is used for C++.
Definition: almethodinfo.h:110
ALParameterInfoOptional is the option container.
Definition: almethodinfo.h:73
std::string moduleName
Definition: almethodinfo.h:95
std::vector< ALExample > examples
Definition: almethodinfo.h:100
void addOption(int pOption)
Add method option.
Definition: almethodinfo.h:134
methodOption
methodOption is differents option for the method.
Definition: almethodinfo.h:48
ALFunctorBase is a generic functor class for pointer management.
Definition: alfunctor.h:35
boost::shared_ptr< ALFunctorBase > ptrOnMethod
Definition: almethodinfo.h:101
ALMethodInfo()
Default constructor.
Definition: almethodinfo.h:37
std::string returnValue
Definition: almethodinfo.h:99