00001 #ifndef __hazy_create_view_h 00002 #define __hazy_create_view_h 00003 00004 #include "postgres_util.h" 00005 #include "globals.h" 00006 #include "low_level_net.h" 00007 #include "hazy_model.h" 00008 #include "hazy_message.h" 00009 #include <string> 00010 #include "server_conn.h" 00011 #include <sys/types.h> 00012 #include <sys/socket.h> 00013 #include <netdb.h> 00014 #include <arpa/inet.h> 00015 #include <netinet/tcp.h> 00016 #include <iostream> 00017 #include <fstream> 00018 #include <stdlib.h> 00019 00020 class Hazy_Create_View { 00021 private: 00022 Hazy_Database *db_conn; 00023 std::string hazy_db_name; 00024 00025 std::string view_name; 00026 std::string view_key; 00027 std::string original_entity_table; 00028 std::string hazy_entity_table; 00029 std::string entity_table_key; 00030 std::string labels_table; 00031 std::string label_in_table; 00032 std::string example_table; 00033 std::string example_table_key; 00034 std::string example_table_label; 00035 std::string feature_function; 00036 std::string training_table_name; 00037 00038 enum storage_manager_type sm; 00039 int dense; 00040 int useepsmap; 00041 hazy_model::strategy hazy_strategy; 00042 int reservoir_size; 00043 double resort_time; 00044 double tao_val; 00045 double alpha_ratio; 00046 int buffer_size; 00047 int dim; 00048 double m_factor; 00049 00050 int write_func_create_view(message_data msg, size_t length); 00051 00052 public: 00053 Hazy_Create_View(std::string, std::string, std::string, std::string, std::string, std::string, 00054 std::string, std::string, std::string, std::string, std::string, 00055 enum storage_manager_type, int, int, hazy_model::strategy, int, double, double, 00056 double, int); 00057 void retrieve_unique_view_id(int &view_id); 00058 void insert_newview_to_catalog(int view_id); 00059 void callGetStatsFeaturesFunction(int view_id); 00060 void normalizeAndGetM(int view_id, double &m_factor); 00061 void callCreateEntityFeaturesFunction(int view_id); 00062 void callPrepareTrainFunction(int view_id); 00063 void getNumberOfFeatures(int view_id, int &num_of_features); 00064 int createUpdateInPlaceFunction(int view_id); 00065 void createView(int view_id); 00066 int createTriggers(int view_id); 00067 }; 00068 00069 #endif