forwards.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008, Willow Garage, Inc.
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions are met:
00007  *
00008  *     * Redistributions of source code must retain the above copyright
00009  *       notice, this list of conditions and the following disclaimer.
00010  *     * Redistributions in binary form must reproduce the above copyright
00011  *       notice, this list of conditions and the following disclaimer in the
00012  *       documentation and/or other materials provided with the distribution.
00013  *     * Neither the name of the Willow Garage, Inc. nor the names of its
00014  *       contributors may be used to endorse or promote products derived from
00015  *       this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00021  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00022  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00023  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00024  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00025  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00026  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00027  * POSSIBILITY OF SUCH DAMAGE.
00028  */
00029 
00030 #ifndef RVIZ_PROPERTY_FORWARDS_H
00031 #define RVIZ_PROPERTY_FORWARDS_H
00032 
00033 #include <boost/shared_ptr.hpp>
00034 #include <boost/weak_ptr.hpp>
00035 #include <boost/function.hpp>
00036 
00037 #include <vector>
00038 #include <string>
00039 
00040 #define FIXED_FRAME_STRING "<Fixed Frame>"
00041 
00042 namespace rviz
00043 {
00044 
00045 typedef boost::function<void(const std::string&)> StatusCallback;
00046 typedef std::vector<std::string> V_string;
00047 typedef boost::function<void(V_string&)> EditEnumOptionCallback;
00048 class EditEnumPGProperty;
00049 
00050 class PropertyManager;
00051 
00052 #define PROPERTY_FORWARD(name) \
00053   class name; \
00054   typedef boost::shared_ptr<name> name##Ptr; \
00055   typedef boost::weak_ptr<name> name##WPtr;
00056 
00057 PROPERTY_FORWARD(PropertyBase);
00058 PROPERTY_FORWARD(BoolProperty);
00059 PROPERTY_FORWARD(IntProperty);
00060 PROPERTY_FORWARD(FloatProperty);
00061 PROPERTY_FORWARD(DoubleProperty);
00062 PROPERTY_FORWARD(StringProperty);
00063 PROPERTY_FORWARD(ColorProperty);
00064 PROPERTY_FORWARD(EnumProperty);
00065 PROPERTY_FORWARD(EditEnumProperty);
00066 PROPERTY_FORWARD(CategoryProperty);
00067 PROPERTY_FORWARD(Vector3Property);
00068 PROPERTY_FORWARD(QuaternionProperty);
00069 PROPERTY_FORWARD(ROSTopicStringProperty);
00070 PROPERTY_FORWARD(StatusProperty);
00071 PROPERTY_FORWARD(TFFrameProperty);
00072 
00073 typedef std::vector<PropertyBasePtr> V_PropertyBasePtr;
00074 typedef std::vector<PropertyBaseWPtr> V_PropertyBaseWPtr;
00075 
00076 template<class T>
00077 void propertyChanged(boost::weak_ptr<T>& wprop)
00078 {
00079   if (boost::shared_ptr<T> prop = wprop.lock())
00080   {
00081     prop->changed();
00082   }
00083 }
00084 
00085 template<class T>
00086 void hideProperty(boost::weak_ptr<T>& wprop)
00087 {
00088   if (boost::shared_ptr<T> prop = wprop.lock())
00089   {
00090     prop->hide();
00091   }
00092 }
00093 
00094 template<class T>
00095 void showProperty(boost::weak_ptr<T>& wprop)
00096 {
00097   if (boost::shared_ptr<T> prop = wprop.lock())
00098   {
00099     prop->show();
00100   }
00101 }
00102 
00103 template<class T>
00104 void setPropertyHelpText(boost::weak_ptr<T>& wprop, const std::string& text)
00105 {
00106   if (boost::shared_ptr<T> prop = wprop.lock())
00107   {
00108     prop->setHelpText(text);
00109   }
00110 }
00111 
00112 } // namespace rviz
00113 
00114 #endif
00115 


rviz_qt
Author(s): Dave Hershberger
autogenerated on Fri Dec 6 2013 20:56:52