libqi-api  2.8.7.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
metamethod.hpp
Go to the documentation of this file.
1 #pragma once
2 /*
3 ** Copyright (C) 2013 Aldebaran Robotics
4 ** See COPYING for the license
5 */
6 
7 #ifndef _QI_TYPE_METAMETHOD_HPP_
8 #define _QI_TYPE_METAMETHOD_HPP_
9 
10 # include <string>
11 # include <map>
12 
13 # include <qi/api.hpp>
14 # include <qi/type/typeinterface.hpp>
15 
16 # ifdef _MSC_VER
17 # pragma warning( push )
18 # pragma warning( disable: 4251 )
19 # endif
20 
21 namespace qi {
22  class MetaMethodParameterPrivate;
23  class AnyFunction;
25  public:
28  MetaMethodParameter(const std::string& name, const std::string& doc);
30 
31  MetaMethodParameter& operator= (const MetaMethodParameter& other);
32 
33  std::string name() const;
34  std::string description() const;
35 
36  MetaMethodParameterPrivate* _p;
37  };
38  using MetaMethodParameterVector = std::vector<MetaMethodParameter>;
39 
40  class MetaMethodPrivate;
43  public:
44  MetaMethod();
45  MetaMethod(unsigned int newUid, const MetaMethod& other);
46 
47  unsigned int uid() const;
48  const std::string& name() const;
49  std::string toString() const; //< name::(args)
50  const Signature& parametersSignature() const;
51  const Signature& returnSignature() const;
52  std::string description() const;
53  MetaMethodParameterVector parameters() const;
54  std::string returnDescription() const;
55 
58  bool isPrivate() const;
59 
60  boost::shared_ptr<MetaMethodPrivate> _p;
61 
62  MetaMethod(unsigned int uid, const qi::Signature& returnSignature,
63  const std::string& name, const qi::Signature& parametersSignature,
64  const std::string& description, const MetaMethodParameterVector& parameters,
65  const std::string& returnDescription);
66  };
67 
68  class MetaMethodBuilderPrivate;
70  public:
72  MetaMethodBuilder(const Signature &sigreturn, const std::string& name, const Signature &signature, const std::string& doc = "");
75 
76  MetaMethodBuilder& operator= (const MetaMethodBuilder& other);
77 
78  std::string name() const;
79 
80  void setUid(unsigned int uid);
81  void setSignature(const AnyFunction& f);
82  void setReturnSignature(const Signature &sig);
83  void setName(const std::string& name);
84  void setParametersSignature(const qi::Signature& sig);
85  void setReturnDescription(const std::string& doc);
86  void appendParameter(const std::string& name, const std::string& documentation);
87  void setDescription(const std::string& documentation);
88 
89  qi::MetaMethod metaMethod();
90 
91  MetaMethodBuilderPrivate* _p;
92  };
93 } // namespace qi
94 
95 # ifdef _MSC_VER
96 # pragma warning( pop )
97 # endif
98 
99 #endif // _QITYPE_METAMETHOD_HPP_
#define QI_API
Definition: api.hpp:33
Representation of a method in an GenericObject.
Definition: metamethod.hpp:42
dll import/export and compiler message
MetaMethodParameterPrivate * _p
Definition: metamethod.hpp:36
MetaMethodBuilderPrivate * _p
Definition: metamethod.hpp:91
boost::shared_ptr< MetaMethodPrivate > _p
Definition: metamethod.hpp:60
std::vector< MetaMethodParameter > MetaMethodParameterVector
Definition: metamethod.hpp:38