service_client_options.h
Go to the documentation of this file.
1 #include "sick_scan/sick_scan_base.h" /* Base definitions included in all header files, added by add_sick_scan_base_header.py. Do not edit this line. */
2 /*
3  * Copyright (C) 2009, Willow Garage, Inc.
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 notice,
8  * 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 names of Stanford University or Willow Garage, Inc. nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef ROSCPP_SERVICE_CLIENT_OPTIONS_H
30 #define ROSCPP_SERVICE_CLIENT_OPTIONS_H
31 
32 #include "ros/forwards.h"
33 #include "common.h"
34 #include "ros/service_traits.h"
35 
36 namespace roswrap
37 {
38 
43 {
45  : persistent(false)
46  {
47  }
48 
49  /*
50  * \brief Constructor
51  * \param _service Name of the service to connect to
52  * \param _md5sum md5sum of the service
53  * \param _persistent Whether or not to keep the connection open to the service for future calls
54  * \param _header Any extra values to be passed along in the connection header
55  */
56  ServiceClientOptions(const std::string& _service, const std::string& _md5sum, bool _persistent, const M_string& _header)
57  : service(_service)
58  , md5sum(_md5sum)
59  , persistent(_persistent)
60  , header(_header)
61  {
62  }
63 
64  /*
65  * \brief Templated helper method, preventing you from needing to manually get the service md5sum
66  * \param MReq [template] Request message type
67  * \param MRes [template] Response message type
68  * \param _service Name of the service to connect to
69  * \param _persistent Whether or not to keep the connection open to the service for future calls
70  * \param _header Any extra values to be passed along in the connection header
71  */
72  template <class MReq, class MRes>
73  void init(const std::string& _service, bool _persistent, const M_string& _header)
74  {
75  namespace st = service_traits;
76 
77  service = _service;
78  md5sum = st::md5sum<MReq>();
79  persistent = _persistent;
80  header = _header;
81  }
82 
83  /*
84  * \brief Templated helper method, preventing you from needing to manually get the service md5sum
85  * \param Service [template] Service type
86  * \param _service Name of the service to connect to
87  * \param _persistent Whether or not to keep the connection open to the service for future calls
88  * \param _header Any extra values to be passed along in the connection header
89  */
90  template <class Service>
91  void init(const std::string& _service, bool _persistent, const M_string& _header)
92  {
93  namespace st = service_traits;
94 
95  service = _service;
96  md5sum = st::md5sum<Service>();
97  persistent = _persistent;
98  header = _header;
99  }
100 
101  std::string service;
102  std::string md5sum;
103  bool persistent;
105 };
106 
107 
108 }
109 
110 #endif
roswrap::message_traits::md5sum
const char * md5sum()
returns MD5Sum<M>::value();
Definition: message_traits.h:227
roswrap::ServiceClientOptions
Encapsulates all options available for creating a ServiceClient.
Definition: service_client_options.h:42
roswrap::ServiceClientOptions::ServiceClientOptions
ServiceClientOptions()
Definition: service_client_options.h:44
roswrap::M_string
std::map< std::string, std::string > M_string
Definition: datatypes.h:46
roswrap::ServiceClientOptions::service
std::string service
Service to connect to.
Definition: service_client_options.h:101
roswrap::ServiceClientOptions::md5sum
std::string md5sum
Service md5sum.
Definition: service_client_options.h:102
roswrap
Definition: param_modi.cpp:41
roswrap::ServiceClientOptions::ServiceClientOptions
ServiceClientOptions(const std::string &_service, const std::string &_md5sum, bool _persistent, const M_string &_header)
Definition: service_client_options.h:56
roswrap::ServiceClientOptions::persistent
bool persistent
Whether or not the connection should persist.
Definition: service_client_options.h:103
common.h
roswrap::ServiceClientOptions::init
void init(const std::string &_service, bool _persistent, const M_string &_header)
Definition: service_client_options.h:73
roswrap::ServiceClientOptions::header
M_string header
Extra key/value pairs to add to the connection header.
Definition: service_client_options.h:104
sick_scan_base.h
roswrap::message_traits::header
std_msgs::Header * header(M &m)
returns Header<M>::pointer(m);
Definition: message_traits.h:281
ROSCPP_DECL
#define ROSCPP_DECL
Definition: roswrap/src/cfgsimu/sick_scan/ros/common.h:63
roswrap::ServiceClientOptions::init
void init(const std::string &_service, bool _persistent, const M_string &_header)
Definition: service_client_options.h:91


sick_scan_xd
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Fri Oct 25 2024 02:47:10