package.h
Go to the documentation of this file.
1 //=================================================================================================
2 // Copyright (c) 2011, Johannes Meyer, TU Darmstadt
3 // All rights reserved.
4 
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above copyright
10 // notice, this list of conditions and the following disclaimer in the
11 // documentation and/or other materials provided with the distribution.
12 // * Neither the name of the Flight Systems and Automatic Control group,
13 // TU Darmstadt, nor the names of its contributors may be used to
14 // endorse or promote products derived from this software without
15 // specific prior written permission.
16 
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
21 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 //=================================================================================================
28 
29 #ifndef CPP_INTROSPECTION_PACKAGE_H
30 #define CPP_INTROSPECTION_PACKAGE_H
31 
32 #include <introspection/forwards.h>
33 
34 namespace cpp_introspection {
35 
36  class Package
37  {
38  protected:
40 
41  public:
42  virtual ~Package() {}
43  static PackagePtr add(const PackagePtr& package);
44 
45  virtual const char *getName() const = 0;
46  std::vector<std::string> getMessages() const;
47 
48  virtual const V_Message& fields() const { return messages_; }
49  MessagePtr message(const std::string& message) const;
50 
51  typedef V_Message::iterator iterator;
52  typedef V_Message::const_iterator const_iterator;
53  const_iterator begin() const { return messages_.begin(); }
54  const_iterator end() const { return messages_.end(); }
55  std::size_t size() const { return messages_.size(); }
56 
57  protected:
58  virtual MessagePtr add(const MessagePtr& message);
59  };
60 
61  PackagePtr package(const std::string& pkg);
62  static inline PackagePtr package(const char* pkg) { return package(std::string(pkg)); }
63  const V_Package &packages();
64 
65 } // namespace cpp_introspection
66 
67 #endif // CPP_INTROSPECTION_PACKAGE_H
std::vector< MessagePtr > V_Message
Definition: forwards.h:56
std::size_t size() const
Definition: package.h:55
const V_Package & packages()
std::vector< PackagePtr > V_Package
Definition: forwards.h:55
const_iterator begin() const
Definition: package.h:53
PackagePtr package(const std::string &pkg)
const_iterator end() const
Definition: package.h:54
virtual const V_Message & fields() const
Definition: package.h:48
static PackagePtr add(const PackagePtr &package)
V_Message::const_iterator const_iterator
Definition: package.h:52
virtual const char * getName() const =0
MessagePtr message(const std::string &message) const
V_Message::iterator iterator
Definition: package.h:51
std::vector< std::string > getMessages() const


cpp_introspection
Author(s): Johannes Meyer
autogenerated on Mon Jun 10 2019 12:56:17