substitution_rule.hpp
Go to the documentation of this file.
1 /*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright 2016-2017 Davide Faconti
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
17 * * Neither the name of Willow Garage, Inc. nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 * *******************************************************************/
34 
35 
36 #ifndef ROS_INTROSPECTION_SUBSTITUTION_RULE_H
37 #define ROS_INTROSPECTION_SUBSTITUTION_RULE_H
38 
41 
42 
43 namespace RosIntrospection{
44 
46 public:
47 
114  SubstitutionRule(const char* pattern, const char* alias, const char* substitution);
115 
116  SubstitutionRule(const SubstitutionRule& other) { *this = other; }
117 
119 
120  const std::vector<absl::string_view>& pattern() const { return _pattern; }
121  const std::vector<absl::string_view>& alias() const { return _alias; }
122  const std::vector<absl::string_view>& substitution() const { return _substitution; }
123 
124  bool operator == (const SubstitutionRule& other) const
125  {
126  return _hash == other._hash;
127  }
128  size_t hash() const { return _hash; }
129 
130 private:
131  std::string _full_pattern;
132  std::string _full_alias;
133  std::string _full_substitution;
134  std::vector<absl::string_view> _pattern;
135  std::vector<absl::string_view> _alias;
136  std::vector<absl::string_view> _substitution;
137  size_t _hash;
138 } ;
139 
140 //------------------------
141 
142 typedef std::map<ROSType, std::vector<SubstitutionRule>> SubstitutionRuleMap;
143 
144 } // end namespace
145 
146 
147 namespace std {
149  {
150 
152  typedef std::size_t result_type;
153 
154  result_type operator()(RosIntrospection::SubstitutionRule const& sr) const
155  {
156  return sr.hash();
157  }
158  };
159 }
160 
161 #endif
std::vector< absl::string_view > _pattern
RosIntrospection::SubstitutionRule argument_type
const std::vector< absl::string_view > & alias() const
std::map< ROSType, std::vector< SubstitutionRule > > SubstitutionRuleMap
const std::vector< absl::string_view > & substitution() const
const std::vector< absl::string_view > & pattern() const
std::vector< absl::string_view > _alias
bool operator==(const SubstitutionRule &other) const
std::vector< absl::string_view > _substitution
SubstitutionRule & operator=(const SubstitutionRule &other)
SubstitutionRule(const SubstitutionRule &other)
SubstitutionRule(const char *pattern, const char *alias, const char *substitution)
Pass the three arguments (pattern, alias, substitution) as point separated strings.
result_type operator()(RosIntrospection::SubstitutionRule const &sr) const


ros_type_introspection
Author(s): Davide Faconti
autogenerated on Thu May 16 2019 02:39:09