signal_multiplexer.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  * 
00005  *  Class to multiplex signal and slot connections. Qt 3 code from:
00006  *  http://doc.trolltech.com/qq/qq08-action-multiplexer.html.
00007  *  Converted to Qt 4 by a.somers@rathenau.nl.
00008  *  Modified for use in cloud_composer by jpapon@gmail.com  
00009  * 
00010  *  Point Cloud Library (PCL) - www.pointclouds.org
00011  *
00012  *  All rights reserved.
00013  *
00014  *  Redistribution and use in source and binary forms, with or without
00015  *  modification, are permitted provided that the following conditions
00016  *  are met:
00017  *
00018  *   * Redistributions of source code must retain the above copyright
00019  *     notice, this list of conditions and the following disclaimer.
00020  *   * Redistributions in binary form must reproduce the above
00021  *     copyright notice, this list of conditions and the following
00022  *     disclaimer in the documentation and/or other materials provided
00023  *     with the distribution.
00024  *   * Neither the name of Willow Garage, Inc. nor the names of its
00025  *     contributors may be used to endorse or promote products derived
00026  *     from this software without specific prior written permission.
00027  *
00028  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00029  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00030  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00031  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00032  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00033  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00034  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00035  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00036  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00037  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00038  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00039  *  POSSIBILITY OF SUCH DAMAGE.
00040  *
00041  */
00042 
00043 #ifndef SIGNAL_MULTIPLEXER_H_
00044 #define SIGNAL_MULTIPLEXER_H_
00045 
00046 #include <pcl/apps/cloud_composer/qt.h>
00047 
00048 namespace pcl
00049 {
00050   namespace cloud_composer
00051   {
00052     class SignalMultiplexer : public QObject
00053     {
00054       Q_OBJECT
00055 
00056       public:
00057         SignalMultiplexer(QObject *parent = 0);
00058 
00071         void 
00072         connect (QObject *sender, const char *signal, const char *slot);
00073 
00079         bool 
00080         disconnect (QObject *sender, const char *signal, const char *slot);
00081 
00094         void 
00095         connect (const char *signal, QObject *receiver, const char *slot);
00096 
00102         bool 
00103         disconnect (const char *signal, QObject *receiver, const char *slot);
00104 
00108         QObject 
00109         *currentObject () const { return object; }
00110 
00111       public slots:
00121         void 
00122         setCurrentObject (QObject *newObject);
00123 
00124       signals:
00129         void 
00130         currentObjectChanged (QObject* newObject);
00131 
00132       private:
00133         struct Connection
00134         {
00135                 QPointer<QObject> sender;
00136                 QPointer<QObject> receiver;
00137                 const char *signal;
00138                 const char *slot;
00139         };
00140 
00141         void 
00142         connect (const Connection &conn);
00143         void 
00144         disconnect (const Connection &conn);
00145 
00146         QPointer<QObject> object;
00147         QList<Connection> connections;
00148     };
00149   }
00150 }
00151 
00152 
00153 
00154 
00155 
00156 
00157 
00158 
00159 
00160 
00161 
00162 
00163 
00164 
00165 
00166 
00167 
00168 #endif // SIGNAL_MULTIPLEXER_H_


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:33:37