00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "mapper_factory.h"
00024 #include "position_mapper.h"
00025 #include "motor_mapper.h"
00026 #include "laser_mapper.h"
00027
00028 #include <interfaces/ObjectPositionInterface.h>
00029 #include <interfaces/MotorInterface.h>
00030 #include <interfaces/Laser360Interface.h>
00031 #include <libplayerc++/playerc++.h>
00032
00033 using namespace PlayerCc;
00034 using namespace fawkes;
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 PlayerProxyFawkesInterfaceMapper *
00053 PlayerMapperFactory::create_mapper(std::string varname,
00054 fawkes::Interface *interface,
00055 PlayerCc::ClientProxy *proxy)
00056 {
00057 PlayerProxyFawkesInterfaceMapper *rv = NULL;
00058
00059 if ( (rv = try_create<ObjectPositionInterface, Position2dProxy, PlayerPositionMapper>(varname, interface, proxy)) != NULL ) {
00060 return rv;
00061 } else if ( (rv = try_create<MotorInterface, Position2dProxy, PlayerMotorPositionMapper>(varname, interface, proxy)) != NULL ) {
00062 return rv;
00063 } else if ( (rv = try_create<Laser360Interface, LaserProxy, PlayerLaserMapper>(varname, interface, proxy)) != NULL ) {
00064 return rv;
00065 } else {
00066 throw Exception("Unknown mapping, don't know how to map Fawkes interface %s "
00067 "to Player proxy %s",
00068 interface->type(), proxy->GetInterfaceStr().c_str());
00069 }
00070 }