00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #pragma once
00018
00019 #include <map>
00020 #include <set>
00021 #include "RoboTrader.h"
00022
00023 namespace RT
00024 {
00025
00026 typedef RoboTrader* (*RobotCreateFn)();
00027 extern void register_robotrader_in_factory(RobotCreateFn, const char*);
00028
00029
00035 template <class ManufacturedType>
00036 class RegisterRoboTraderInFactory
00037 {
00038 public:
00040 static RoboTrader* CreateInstance() {
00041 ManufacturedType*m = new ManufacturedType;
00042 return m;
00043 }
00044 RegisterRoboTraderInFactory(const char *robot_impl_name)
00045 {
00046 RobotCreateFn create_funct;
00047 create_funct = &RegisterRoboTraderInFactory<ManufacturedType>::CreateInstance;
00048 register_robotrader_in_factory( create_funct,robot_impl_name);
00049 }
00050 };
00051
00052 }
00053
00055 #define RegisterImpl(x, z) RT::RegisterRoboTraderInFactory <x> registerMe(#z);