/***************************************************************************
 Copyright (c) 2009 S Roderick <xxxstephen AT theptrgroupxxx DOT comxxx>
                               (remove the x's above)
 ***************************************************************************/
#include "BoostCorbaToolkit.hpp"
#include <rtt/Types.hpp>
#include <rtt/Toolkit.hpp>
#include <rtt/Plugin.hpp>
#include <rtt/corba/CorbaTemplateProtocol.hpp>
#include "BoostCorbaConversion.hpp"

using namespace RTT;
using namespace RTT::detail;
using namespace RTT::Corba;

namespace Examples {
namespace Corba {

bool CorbaBoostPlugin::registerTransport(std::string name, TypeInfo* ti)
{
	assert( name == ti->getTypeName() );
	// name must match that in plugin::loadTypes() and
	// typeInfo::composeTypeInfo(), etc
	if ( name == "boost_ptime" )
		return ti->addProtocol(ORO_CORBA_PROTOCOL_ID, new CorbaTemplateProtocol< boost::posix_time::ptime >() );
	if ( name == "boost_timeduration" )
		return ti->addProtocol(ORO_CORBA_PROTOCOL_ID, new CorbaTemplateProtocol< boost::posix_time::time_duration >() );
	return false;
}

std::string CorbaBoostPlugin::getTransportName() const {
	return "CORBA";
}

std::string CorbaBoostPlugin::getName() const {
	return "CorbaBoost";
}

CorbaBoostPlugin corbaBoostPlugin;

// namespace
}
}

ORO_TOOLKIT_PLUGIN(Examples::Corba::corbaBoostPlugin);

