00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef _DATABASE_TASK_H_
00038 #define _DATABASE_TASK_H_
00039
00040 #include <database_interface/db_class.h>
00041
00042 namespace household_objects_database {
00043
00045
00049 class DatabaseTaskID : public database_interface::DBClass
00050 {
00051 public:
00052 database_interface::DBField<int> id_;
00053
00054 DatabaseTaskID() :
00055 id_(database_interface::DBFieldBase::TEXT, this, "get_mark_next_dbase_task", "get_mark_next_dbase_task()", false)
00056 {
00057 primary_key_field_ = &id_;
00058 id_.setWriteToDatabase(false);
00059 }
00060
00061 };
00062
00064
00068 class DatabaseTaskIDTyped : public database_interface::DBClass
00069 {
00070 public:
00071 database_interface::DBField<int> id_;
00072
00073 DatabaseTaskIDTyped() :
00074 id_(database_interface::DBFieldBase::TEXT, this, "get_mark_next_dbase_task_of_type", "foo_bar", false)
00075 {
00076 primary_key_field_ = &id_;
00077 id_.setWriteToDatabase(false);
00078 }
00079
00082 DatabaseTaskIDTyped(std::string function_field) :
00083 id_(database_interface::DBFieldBase::TEXT, this, "get_mark_next_dbase_task_of_type", function_field, false)
00084 {
00085 primary_key_field_ = &id_;
00086 id_.setWriteToDatabase(false);
00087 }
00088 };
00089
00090 class DatabaseTask : public database_interface::DBClass
00091 {
00092 private:
00093 public:
00094
00095 database_interface::DBField<int> id_;
00096
00097 database_interface::DBField<std::string> type_;
00098 database_interface::DBField<std::string> outcome_name_;
00099
00100 DatabaseTask() :
00101 id_(database_interface::DBFieldBase::TEXT, this, "dbase_task_id", "dbase_task", true),
00102 type_(database_interface::DBFieldBase::TEXT, this, "dbase_task_type", "dbase_task", true),
00103 outcome_name_(database_interface::DBFieldBase::TEXT, this, "dbase_task_outcome_name", "dbase_task", true)
00104 {
00105 primary_key_field_ = &id_;
00106 fields_.push_back(&type_);
00107 fields_.push_back(&outcome_name_);
00108
00109 setAllFieldsReadFromDatabase(true);
00110 setAllFieldsWriteToDatabase(true);
00111
00112 id_.setSequenceName("task_id_seq");
00113 id_.setWriteToDatabase(false);
00114 }
00115 };
00116
00118 class DatabasePlanningTask : public database_interface::DBClass
00119 {
00120 public:
00121
00122 database_interface::DBField<int> id_;
00123
00124 database_interface::DBField<int> scaled_model_id_;
00125 database_interface::DBField<std::string> hand_name_;
00126 database_interface::DBField<int> time_;
00127
00128 DatabasePlanningTask() :
00129 id_(database_interface::DBFieldBase::TEXT, this, "dbase_task_id", "planning_task", true),
00130 scaled_model_id_(database_interface::DBFieldBase::TEXT, this, "scaled_model_id", "planning_task", true),
00131 hand_name_(database_interface::DBFieldBase::TEXT, this, "hand_name", "planning_task", true),
00132 time_(database_interface::DBFieldBase::TEXT, this, "task_time", "planning_task", true)
00133 {
00134 primary_key_field_ = &id_;
00135 fields_.push_back(&scaled_model_id_);
00136 fields_.push_back(&hand_name_);
00137 fields_.push_back(&time_);
00138
00139 setAllFieldsReadFromDatabase(true);
00140 setAllFieldsWriteToDatabase(true);
00141 }
00142
00143 };
00144
00145 class DatabaseOptimizationTask : public database_interface::DBClass
00146 {
00147 public:
00148
00149 database_interface::DBField<int> dbase_task_id_;
00150
00151 database_interface::DBField<std::string> hand_name_;
00152 database_interface::DBField< std::vector<double> > parameters_;
00153
00154 DatabaseOptimizationTask() :
00155 dbase_task_id_(database_interface::DBFieldBase::TEXT, this, "dbase_task_id", "optimization_task", true),
00156 hand_name_(database_interface::DBFieldBase::TEXT, this, "hand_name", "optimization_task", true),
00157 parameters_(database_interface::DBFieldBase::TEXT, this, "optimization_task_parameters", "optimization_task", true)
00158 {
00159 primary_key_field_ = &dbase_task_id_;
00160 fields_.push_back(&hand_name_);
00161 fields_.push_back(¶meters_);
00162
00163 setAllFieldsReadFromDatabase(true);
00164 setAllFieldsWriteToDatabase(true);
00165 }
00166 };
00167
00168 class DatabaseOptimizationResult : public database_interface::DBClass
00169 {
00170 public:
00171 database_interface::DBField<int> id_;
00172 database_interface::DBField<int> dbase_task_id_;
00173 database_interface::DBField<std::string> hand_name_;
00174 database_interface::DBField< std::vector<double> > parameters_;
00175 database_interface::DBField< std::vector<double> > results_;
00176 database_interface::DBField< std::vector<double> > seed_;
00177
00178 DatabaseOptimizationResult() :
00179 id_(database_interface::DBFieldBase::TEXT, this,
00180 "optimization_result_id", "optimization_result", true),
00181 dbase_task_id_(database_interface::DBFieldBase::TEXT, this,
00182 "dbase_task_id", "optimization_result", true),
00183 hand_name_(database_interface::DBFieldBase::TEXT, this,
00184 "hand_name", "optimization_result", true),
00185 parameters_(database_interface::DBFieldBase::TEXT, this,
00186 "optimization_result_parameters", "optimization_result", true),
00187 results_(database_interface::DBFieldBase::TEXT, this,
00188 "optimization_result_results", "optimization_result", true),
00189 seed_(database_interface::DBFieldBase::TEXT, this,
00190 "optimization_result_seed", "optimization_result", true)
00191 {
00192 primary_key_field_ = &id_;
00193 fields_.push_back(&dbase_task_id_);
00194 fields_.push_back(&hand_name_);
00195 fields_.push_back(¶meters_);
00196 fields_.push_back(&results_);
00197 fields_.push_back(&seed_);
00198
00199 setAllFieldsReadFromDatabase(true);
00200 setAllFieldsWriteToDatabase(true);
00201
00202 id_.setSequenceName("optimization_result_id_seq");
00203 id_.setWriteToDatabase(false);
00204 }
00205 };
00206
00207 }
00208
00209 #endif