• Main Page
  • Related Pages
  • Classes
  • Files
  • File List

src/Slider.hh

00001 /*
00002  * Copyright Staffan Gimåker 2007-2010.
00003  * Copyright Anders Boberg 2007.
00004  *
00005  * ---
00006  *
00007  * This file is part of peekabot.
00008  *
00009  * peekabot is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 3 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * peekabot is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00021  */
00022 
00023 
00024 #ifndef PEEKABOT_SLIDER_HH_INCLUDED
00025 #define PEEKABOT_SLIDER_HH_INCLUDED
00026 
00027 
00028 #include <boost/any.hpp>
00029 #include <boost/function.hpp>
00030 #include <boost/lexical_cast.hpp>
00031 #include <Eigen/Core>
00032 #include <Eigen/Geometry>
00033 
00034 #include "Joint.hh"
00035 #include "HandlerInformer.hh"
00036 #include "ScopedHandler.hh"
00037 
00038 
00039 namespace peekabot
00040 {
00041 
00051     class Slider : public Joint
00052     {
00053     public:
00054         Slider();
00055 
00056         Slider(ScopedHandler *handler);
00057 
00058         virtual ~Slider() throw();
00059 
00070         Slider(const Eigen::Vector3f &axis);
00071 
00081         void set_axis(
00082             const Eigen::Vector3f &axis,
00083             CoordinateSystem coord_sys = PARENT_COORDINATES) throw();
00084 
00088         const Eigen::Vector3f &get_axis() const throw();
00089 
00090         virtual void accept(ObjectVisitor *visitor) throw();
00091 
00092         virtual ObjectType get_object_type() const;
00093 
00094         virtual Eigen::Transform3f calculate_dof_transform(float value)
00095             const throw();
00096 
00099 
00100         typedef boost::signals2::signal<void ()> AxisSetSignal;
00101 
00102         inline AxisSetSignal &axis_set_signal()
00103         {
00104             return m_axis_set_signal;
00105         }
00106 
00108 
00109     protected:
00110         virtual PropMap &get_prop_adapters();
00111 
00112     private:
00113         static void create_prop_adapters(PropMap &adapters);
00114 
00117 
00118         static void start_handler(
00119             const std::string & name,
00120             XMLHandler::AttributeMap &attributes,
00121             ScopedHandler *handler) throw();
00122 
00123         void axis_start_handler(
00124             const std::string & name,
00125             XMLHandler::AttributeMap &attributes,
00126             ScopedHandler *handler)
00127             throw();
00128 
00129         void axis_cdata_handler(
00130             CoordinateSystem coord_sys,
00131             const std::string &cdata,
00132             ScopedHandler *handler)
00133             throw(std::domain_error, std::runtime_error, boost::bad_any_cast);
00134 
00138         void min_start_handler(
00139             const std::string & name,
00140             XMLHandler::AttributeMap &attributes,
00141             ScopedHandler *handler)
00142             throw();
00143 
00147         void max_start_handler(
00148             const std::string & name,
00149             XMLHandler::AttributeMap &attributes,
00150             ScopedHandler *handler)
00151             throw();
00152 
00156         void initial_start_handler(
00157             const std::string & name,
00158             XMLHandler::AttributeMap &attributes,
00159             ScopedHandler *handler)
00160             throw();
00161 
00165         void offset_start_handler(
00166             const std::string & name,
00167             XMLHandler::AttributeMap &attributes,
00168             ScopedHandler *handler)
00169             throw();
00170 
00175         template<class T>
00176         static void generic_cdata_handler(
00177             const std::string &cdata,
00178             ScopedHandler *handler,
00179             boost::function<void (T)> f)
00180         {
00181             f( boost::lexical_cast<T>(cdata) );
00182         }
00183 
00192         static void invoke_on_end_element(
00193             ScopedHandler::TagScope &dof_scope,
00194             boost::function<void (float)> f, float val);
00195 
00197 
00198 
00199     private:
00208         Eigen::Vector3f m_axis;
00209 
00210         AxisSetSignal m_axis_set_signal;
00211 
00212         static HandlerInformer ms_handler_informer;
00213     };
00214 }
00215 
00216 #endif // PEEKABOT_SLIDER_HH_INCLUDED

Generated on Sun Jan 30 2011 for peekabot by  doxygen 1.7.1