fake_message.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009, Willow Garage, Inc.
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  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 /* Author: Josh Faust */
31 
32 /*
33  * Subscription queue test helper classes
34  */
35 #ifndef TEST_ROSCPP_FAKE_MESSAGE_H
36 #define TEST_ROSCPP_FAKE_MESSAGE_H
37 
39 
41 {
42 public:
43  virtual const std::string __getDataType() const { return ""; }
44  virtual const std::string __getMD5Sum() const { return ""; }
45  virtual const std::string __getMessageDefinition() const { return ""; }
46  virtual uint32_t serializationLength() const { return 0; }
47  virtual uint8_t *serialize(uint8_t *write_ptr, uint32_t seq) const { (void)seq; return write_ptr; }
48  virtual uint8_t *deserialize(uint8_t *read_ptr) { return read_ptr; }
49 };
50 
52 {
53 public:
55  : calls_(0)
56  {}
57 
59  {
60  return boost::make_shared<FakeMessage>();
61  }
62 
63  virtual std::string getMD5Sum() { return ""; }
64  virtual std::string getDataType() { return ""; }
65 
67  {
68  (void)params;
69  {
70  boost::mutex::scoped_lock lock(mutex_);
71  ++calls_;
72  }
73 
74  if (cb_)
75  {
76  cb_();
77  }
78  }
79 
80  virtual const std::type_info& getTypeInfo() { return typeid(FakeMessage); }
81  virtual bool isConst() { return true; }
82  virtual bool hasHeader() { return false; }
83 
84  boost::mutex mutex_;
85  uint32_t calls_;
86 
87  boost::function<void(void)> cb_;
88 };
90 
91 #endif // TEST_ROSCPP_FAKE_MESSAGE_H
virtual uint32_t serializationLength() const
Definition: fake_message.h:46
virtual uint8_t * serialize(uint8_t *write_ptr, uint32_t seq) const
Definition: fake_message.h:47
boost::function< void(void)> cb_
Definition: fake_message.h:87
uint32_t calls_
Definition: fake_message.h:85
virtual const std::string __getMessageDefinition() const
Definition: fake_message.h:45
virtual std::string getDataType()
Definition: fake_message.h:64
virtual const std::string __getDataType() const
Definition: fake_message.h:43
virtual bool hasHeader()
Definition: fake_message.h:82
virtual ros::VoidConstPtr deserialize(const ros::SubscriptionCallbackHelperDeserializeParams &)
Definition: fake_message.h:58
boost::shared_ptr< FakeSubHelper > FakeSubHelperPtr
Definition: fake_message.h:89
boost::mutex mutex_
Definition: fake_message.h:84
virtual const std::type_info & getTypeInfo()
Definition: fake_message.h:80
virtual std::string getMD5Sum()
Definition: fake_message.h:63
virtual const std::string __getMD5Sum() const
Definition: fake_message.h:44
virtual bool isConst()
Definition: fake_message.h:81
virtual void call(ros::SubscriptionCallbackHelperCallParams &params)
Definition: fake_message.h:66
virtual uint8_t * deserialize(uint8_t *read_ptr)
Definition: fake_message.h:48


test_roscpp
Author(s): Morgan Quigley, Josh Faust, Brian Gerkey, Troy Straszheim, Dirk Thomas
autogenerated on Mon Feb 28 2022 23:34:01