00001 /*************************************************************************** 00002 00003 socketmarshaller.hpp - description 00004 ------------------- 00005 begin : Mon August 7 2006 00006 copyright : (C) 2006 Bas Kemper 00007 email : kst@baskemper.be 00008 00009 *************************************************************************** 00010 * This library is free software; you can redistribute it and/or * 00011 * modify it under the terms of the GNU Lesser General Public * 00012 * License as published by the Free Software Foundation; either * 00013 * version 2.1 of the License, or (at your option) any later version. * 00014 * * 00015 * This library is distributed in the hope that it will be useful, * 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00018 * Lesser General Public License for more details. * 00019 * * 00020 * You should have received a copy of the GNU Lesser General Public * 00021 * License along with this library; if not, write to the Free Software * 00022 * Foundation, Inc., 59 Temple Place, * 00023 * Suite 330, Boston, MA 02111-1307 USA * 00024 * * 00025 ***************************************************************************/ 00026 00027 #ifndef ORO_COMP_SOCKET_MARSHALLER 00028 #define ORO_COMP_SOCKET_MARSHALLER 00029 00030 #include <rtt/Property.hpp> 00031 #include <rtt/marsh/MarshallInterface.hpp> 00032 #include <rtt/os/Mutex.hpp> 00033 #include <list> 00034 00035 namespace OCL 00036 { 00037 class TcpReporting; 00038 namespace TCP 00039 { 00040 class Datasender; 00041 class Socket; 00042 } 00043 } 00044 00045 namespace RTT 00046 { 00050 class SocketMarshaller 00051 : public marsh::MarshallInterface 00052 { 00053 private: 00054 RTT::os::MutexRecursive lock; 00055 std::list<OCL::TCP::Datasender*> _connections; 00056 OCL::TcpReporting* _reporter; 00057 00058 public: 00059 SocketMarshaller(OCL::TcpReporting* reporter); 00060 ~SocketMarshaller(); 00061 virtual void flush(); 00062 virtual void serialize(RTT::base::PropertyBase*); 00063 virtual void serialize(const PropertyBag &v); 00064 void addConnection(OCL::TCP::Socket* os); 00065 void removeConnection(OCL::TCP::Datasender* sender); 00066 void closeAllConnections(); 00067 void shutdown(); 00068 OCL::TcpReporting* getReporter() const; 00069 }; 00070 } 00071 #endif