Orocos Real-Time Toolkit  2.6.0
MQLib.cpp
00001 /***************************************************************************
00002   tag: Peter Soetens  Thu Oct 22 11:59:07 CEST 2009  MQLib.cpp
00003 
00004                         MQLib.cpp -  description
00005                            -------------------
00006     begin                : Thu October 22 2009
00007     copyright            : (C) 2009 Peter Soetens
00008     email                : peter@thesourcworks.com
00009 
00010  ***************************************************************************
00011  *   This library is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU General Public                   *
00013  *   License as published by the Free Software Foundation;                 *
00014  *   version 2 of the License.                                             *
00015  *                                                                         *
00016  *   As a special exception, you may use this file as part of a free       *
00017  *   software library without restriction.  Specifically, if other files   *
00018  *   instantiate templates or use macros or inline functions from this     *
00019  *   file, or you compile this file and link it with other files to        *
00020  *   produce an executable, this file does not by itself cause the         *
00021  *   resulting executable to be covered by the GNU General Public          *
00022  *   License.  This exception does not however invalidate any other        *
00023  *   reasons why the executable file might be covered by the GNU General   *
00024  *   Public License.                                                       *
00025  *                                                                         *
00026  *   This library is distributed in the hope that it will be useful,       *
00027  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00028  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00029  *   Lesser General Public License for more details.                       *
00030  *                                                                         *
00031  *   You should have received a copy of the GNU General Public             *
00032  *   License along with this library; if not, write to the Free Software   *
00033  *   Foundation, Inc., 59 Temple Place,                                    *
00034  *   Suite 330, Boston, MA  02111-1307  USA                                *
00035  *                                                                         *
00036  ***************************************************************************/
00037 
00038 
00039 
00040 #include "MQLib.hpp"
00041 #include "MQTemplateProtocol.hpp"
00042 #include "MQSerializationProtocol.hpp"
00043 #include "../../types/TransportPlugin.hpp"
00044 #include "../../types/TypekitPlugin.hpp"
00045 #include <boost/serialization/vector.hpp>
00046 
00047 using namespace std;
00048 using namespace RTT::detail;
00049 
00050 namespace RTT {
00051     namespace mqueue {
00052         bool MQLibPlugin::registerTransport(std::string name, TypeInfo* ti)
00053         {
00054             if ( name == "int" )
00055                 return ti->addProtocol(ORO_MQUEUE_PROTOCOL_ID, new MQTemplateProtocol<int>() );
00056             if ( name == "double" )
00057                 return ti->addProtocol(ORO_MQUEUE_PROTOCOL_ID, new MQTemplateProtocol<double>() );
00058             //if ( name == "string" )
00059             //    return ti->addProtocol(ORO_MQUEUE_PROTOCOL_ID, new MQTemplateProtocol<std::string>() );
00060             if ( name == "float" )
00061                 return ti->addProtocol(ORO_MQUEUE_PROTOCOL_ID, new MQTemplateProtocol<float>() );
00062             if ( name == "uint" )
00063                 return ti->addProtocol(ORO_MQUEUE_PROTOCOL_ID, new MQTemplateProtocol<unsigned int>() );
00064             if ( name == "char" )
00065                 return ti->addProtocol(ORO_MQUEUE_PROTOCOL_ID, new MQTemplateProtocol<char>() );
00066             //if ( name == "long" )
00067             //    return ti->addProtocol(ORO_MQUEUE_PROTOCOL_ID, new MQTemplateProtocol<long>() );
00068             //if ( name == "PropertyBag" )
00069             //    return ti->addProtocol(ORO_MQUEUE_PROTOCOL_ID, new MQTemplateProtocol<PropertyBag>() );
00070             if ( name == "bool" )
00071                 return ti->addProtocol(ORO_MQUEUE_PROTOCOL_ID, new MQTemplateProtocol<bool>() );
00072             if ( name == "array" )
00073                 return ti->addProtocol(ORO_MQUEUE_PROTOCOL_ID, new MQSerializationProtocol< std::vector<double> >() );
00074             //if ( name == "void" )
00075             //    return ti->addProtocol(ORO_MQUEUE_PROTOCOL_ID, new MQFallBackProtocol(false)); // warn=false
00076             return false;
00077         }
00078 
00079         std::string MQLibPlugin::getTransportName() const {
00080             return "mqueue";
00081         }
00082 
00083         std::string MQLibPlugin::getTypekitName() const {
00084             return "rtt-types";
00085         }
00086         std::string MQLibPlugin::getName() const {
00087             return "rtt-mqueue-transport";
00088         }
00089     }
00090 }
00091 
00092 ORO_TYPEKIT_PLUGIN( RTT::mqueue::MQLibPlugin )