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_SCALED_MODEL_H_
00038 #define _DATABASE_SCALED_MODEL_H_
00039
00040 #include <database_interface/db_class.h>
00041
00042 namespace household_objects_database {
00043
00044 class DatabaseScaledModel : public database_interface::DBClass
00045 {
00046 private:
00047
00048 public:
00049
00050 database_interface::DBField<int> id_;
00051
00052 database_interface::DBField<double> scale_;
00053 database_interface::DBField<int> original_model_id_;
00054
00055
00056
00057 database_interface::DBField<std::string> model_;
00058 database_interface::DBField<std::string> maker_;
00059 database_interface::DBField< std::vector<std::string> > tags_;
00060 database_interface::DBField<std::string> source_;
00061 database_interface::DBField<std::string> acquisition_method_;
00062
00063 DatabaseScaledModel() :
00064 id_(database_interface::DBFieldBase::TEXT, this, "scaled_model_id", "scaled_model", true),
00065 scale_(database_interface::DBFieldBase::TEXT, this, "scaled_model_scale", "scaled_model", true),
00066 original_model_id_(database_interface::DBFieldBase::TEXT, this, "original_model_id", "scaled_model", true),
00067
00068 model_(database_interface::DBFieldBase::TEXT, this, "original_model_model" ,"original_model", false),
00069 maker_(database_interface::DBFieldBase::TEXT, this, "original_model_maker", "original_model", false),
00070 tags_(database_interface::DBFieldBase::TEXT, this, "original_model_tags", "original_model", false),
00071 source_(database_interface::DBFieldBase::TEXT, this, "original_model_source", "original_model", false),
00072 acquisition_method_(database_interface::DBFieldBase::TEXT, this, "acquisition_method_name", "original_model", false)
00073 {
00074 primary_key_field_ = &id_;
00075 fields_.push_back(&scale_);
00076 fields_.push_back(&original_model_id_);
00077
00078 fields_.push_back(&model_);
00079 fields_.push_back(&maker_);
00080 fields_.push_back(&tags_);
00081 fields_.push_back(&source_);
00082 fields_.push_back(&acquisition_method_);
00083
00084 setAllFieldsReadFromDatabase(true);
00085 setAllFieldsWriteToDatabase(false);
00086 scale_.setWriteToDatabase(true);
00087 original_model_id_.setWriteToDatabase(true);
00088
00089 id_.setSequenceName("model_model_id_seq");
00090 id_.setWriteToDatabase(false);
00091
00092 foreign_keys_.insert( std::pair<std::string, database_interface::DBFieldBase*>("original_model", &original_model_id_) );
00093 }
00094 };
00095
00096 }
00097
00098 #endif