datasender.hpp
Go to the documentation of this file.
00001 /***************************************************************************
00002 
00003                      datasender.hpp -  description
00004                            -------------------
00005     begin                : Wed August 9 2006
00006     copyright            : (C) 2006 Bas Kemper
00007                            (C) 2007 Ruben Smits //Changed subscription structure
00008     email                : kst@baskemper.be
00009                            first dot last at mech dot kuleuven dot be
00010 
00011  ***************************************************************************
00012  *   This library is free software; you can redistribute it and/or         *
00013  *   modify it under the terms of the GNU Lesser General Public            *
00014  *   License as published by the Free Software Foundation; either          *
00015  *   version 2.1 of the License, or (at your option) any later version.    *
00016  *                                                                         *
00017  *   This library is distributed in the hope that it will be useful,       *
00018  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00019  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00020  *   Lesser General Public License for more details.                       *
00021  *                                                                         *
00022  *   You should have received a copy of the GNU Lesser General Public      *
00023  *   License along with this library; if not, write to the Free Software   *
00024  *   Foundation, Inc., 59 Temple Place,                                    *
00025  *   Suite 330, Boston, MA  02111-1307  USA                                *
00026  *                                                                         *
00027  ***************************************************************************/
00028 
00029 #ifndef ORO_COMP_TCP_DATASENDER
00030 #define ORO_COMP_TCP_DATASENDER
00031 
00032 #include <rtt/Activity.hpp>
00033 #include <rtt/os/Mutex.hpp>
00034 #include <rtt/Property.hpp>
00035 
00036 using RTT::os::Mutex;
00037 using RTT::base::PropertyBase;
00038 using RTT::Property;
00039 using RTT::PropertyBag;
00040 
00041 namespace RTT
00042 {
00043     class SocketMarshaller;
00044 }
00045 namespace OCL{
00046 
00047     namespace TCP{
00048         using namespace RTT;
00049         class TcpReportingInterpreter;
00050         class Socket;
00051 
00059         class Datasender
00060             : public RTT::Activity
00061         {
00062         private:
00063             os::Mutex lock;
00064             TcpReportingInterpreter* interpreter;
00065             void checkbag(const PropertyBag &v);
00066             void writeOut(base::PropertyBase* v);
00067             void writeOut(const PropertyBag &v);
00068             Socket* os;
00069             OCL::TcpReporting* reporter;
00070             unsigned long long limit;
00071             unsigned long long curframe;
00072             bool silenced;
00073             RTT::SocketMarshaller* marshaller;
00074             std::vector<std::string> subscriptions;
00075 
00076         public:
00077             Datasender(RTT::SocketMarshaller* marshaller, Socket* os);
00078             virtual ~Datasender();
00079 
00084             bool isValid() const;
00085 
00089             void setLimit(unsigned long long newlimit);
00090 
00094             void serialize(const PropertyBag &v);
00095 
00099             RTT::SocketMarshaller* getMarshaller() const;
00100 
00101             bool addSubscription(const std::string name );
00102             bool removeSubscription( const std::string& name );
00103 
00107             void listSubscriptions();
00108 
00112             Socket& getSocket() const;
00113 
00117             virtual void loop();
00118 
00122             virtual bool breakloop();
00123 
00127             void silence(bool newstate);
00128 
00132             void remove();
00133     };
00134 }
00135 }
00136 #endif


ocl
Author(s): OCL Development Team
autogenerated on Mon Oct 6 2014 03:16:36