00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00022 #pragma once
00023
00024 #include "RobotHelperInterfaces.h"
00025 #include "RTPosition.h"
00026 #include "RTOrder.h"
00027 #include "RTExchangeType.h"
00028 #include "RTInstrument.h"
00029
00030 #include <map>
00031
00032 namespace RT
00033 {
00034 enum RobotStatus
00035 {
00036 enUndefined,
00037 enRobotCreated,
00038 enRobotStarted,
00039 enRobotRunning,
00040 enRobotSuspended,
00041 enRobotStopped,
00042 enRobotClosed,
00043 enRobotInitialized,
00044 enRobotError,
00045 enMaxRobotState
00046 };
00047
00048 static char* RobotStatusStr[]=
00049 {
00050 "Undefined",
00051 "Created",
00052 "Started",
00053 "Running",
00054 "Suspended",
00055 "Stopped",
00056 "Closed",
00057 "Initialized",
00058 "Error",
00059 "Undefined"
00060 };
00061
00063 struct RobotState
00064 {
00065 RobotState():
00066 status_(enRobotCreated)
00067 ,status_str_("Created")
00068 {}
00069
00070 RobotStatus status_;
00071 std::string status_str_;
00072 };
00073
00075 struct RobotTypeParameter
00076 {
00077 std::string name_;
00078 std::string value_;
00079 std::string description_;
00080 std::string type_;
00081
00082 void init()
00083 {
00084 name_="";
00085 value_="";
00086 description_="";
00087 type_="";
00088 }
00089 void to_xml(std::ostream& stream)
00090 {
00091 stream<<"<PARAMETR>";
00092 stream<<"<PName>"<<name_.c_str() <<"</PName>";
00093 stream<<"<PValue>"<< value_.c_str()<<"</PValue>";
00094 stream<<"<PDescription>"<<description_.c_str() <<"</PDescription>";
00095 stream<<"<PType>"<<type_.c_str() <<"</PType>";
00096 stream<<"</PARAMETR>";
00097 }
00098 };
00100 typedef std::list<RobotTypeParameter> ParametersList;
00101
00103 typedef std::map<std::string,RTOrder*> OrderList;
00105 typedef std::pair<std::string,std::string> StrPair;
00107 typedef std::list<StrPair> StrPairList;
00108
00114 class RTRobotStateInfo
00115 {
00116 public:
00117 RTRobotStateInfo(){}
00118
00119
00121 const std::string& name() {return name_;}
00123 const std::string& robot_id() {return robot_id_;}
00125 const std::string& account() {return account_;}
00127 const std::string& exchange_account() {return exchange_account_;}
00128
00130 RobotState& robot_state() {return robot_state_;}
00131
00133 ParametersList& parameters() {return parameters_;}
00135 PositionList& positions() {return position_list_;}
00137 OrderList& order_list() {return order_list_;}
00138
00139
00141 void name(const std::string& name) {name_=name;}
00143 void robot_id(const std::string& robot_id) {robot_id_=robot_id;}
00145 void account(const std::string& account) {account_=account;}
00147 void exchange_account(const std::string& account) {exchange_account_=account;}
00149 void robot_state(const RobotState& state) {robot_state_=state;}
00150
00152 void parameters(ParametersList& params) {parameters_=params;}
00154 void positions(PositionList& pos_list) {position_list_=pos_list;}
00156 void order_list(OrderList& order_list) {order_list_=order_list;}
00157
00158 private:
00159 std::string name_;
00160 std::string robot_id_;
00161 std::string account_;
00162 std::string exchange_account_;
00163
00164 RobotState robot_state_;
00165
00166 ParametersList parameters_;
00167 PositionList position_list_;
00168 OrderList order_list_;
00169 };
00170 }