Column-oriented GPU-accelerated Database Management System
CoGaDB
/home/sebastian/gpudbms/trunk/cogadb/include/gpu/gpu_base_column.hpp
Go to the documentation of this file.
00001 #pragma once
00002 
00003 #include <core/global_definitions.hpp> 
00004 #include <core/base_column.hpp>
00005 
00006 
00007 namespace CoGaDB{
00008         namespace gpu{          
00009         
00010 
00011                 class GPU_Positionlist{
00012                         public:
00013                         virtual void clear() = 0;
00014                         virtual const shared_pointer_namespace::shared_ptr<GPU_Positionlist> aggregate(shared_pointer_namespace::shared_ptr<GPU_Positionlist> dev_tids) const = 0;
00015                         virtual bool insert(std::vector<TID>* pos_list) = 0;
00016                         virtual size_t size() const throw()=0;
00017                         virtual const std::type_info& type() const throw() = 0;
00018                         virtual const boost::any get(TID tid)=0; 
00019                         virtual const PositionListPtr toHostPositionlist() const = 0;
00020                         virtual void print() const throw() = 0;
00021                         virtual ~GPU_Positionlist();
00022                 };
00023 
00024 //              class GPU_2DPositionlist{
00025 //                      public:
00026 //                      virtual size_t size() const throw()=0;
00027 //                      virtual const std::type_info& type() const throw() = 0;
00028 //                      virtual const boost::any get(TID tid)=0; 
00029 //                      virtual const std::pair<std::vector<TID>*,std::vector<TID>*> toHost_2DPositionlist() const = 0;
00030 //              };
00031 
00032                 typedef shared_pointer_namespace::shared_ptr<GPU_Positionlist> GPU_PositionlistPtr;
00033 
00034                 class GPU_Base_Column{
00035                         public:
00036                         //typedef shared_pointer_namespace::shared_ptr<GPU_Base_Column> GPU_Base_ColumnPtr;
00037 
00038                         GPU_Base_Column(const std::string& name, AttributeType db_type);
00039 
00040                         virtual ~GPU_Base_Column();
00041                 
00042                         virtual bool insert(const boost::any& new_Value)=0;
00043                         virtual bool update(TID tid, const boost::any& new_Value)=0;
00044                         virtual bool remove(TID tid)=0;
00045 
00046                         virtual const boost::any get(TID tid)=0; //not const, because operator [] does not provide const return type and the child classes rely on []
00047 
00048                         /***************** column algebra operations *****************/ 
00051                         virtual bool add(const boost::any& new_Value) = 0;
00054                         virtual bool add(shared_pointer_namespace::shared_ptr<GPU_Base_Column> column) = 0;
00057                         virtual bool minus(const boost::any& new_Value) = 0;
00060                         virtual bool minus(shared_pointer_namespace::shared_ptr<GPU_Base_Column> column) = 0;   
00063                         virtual bool multiply(const boost::any& new_Value) = 0;
00066                         virtual bool multiply(shared_pointer_namespace::shared_ptr<GPU_Base_Column> column) = 0;
00069                         virtual bool division(const boost::any& new_Value) = 0; 
00072                         virtual bool division(shared_pointer_namespace::shared_ptr<GPU_Base_Column> column) = 0;        
00073 
00074                         virtual void print() const throw()=0;
00075                         virtual size_t size() const throw()=0;
00076                         virtual const std::type_info& type() const throw() = 0;
00077                         
00078                         virtual const shared_pointer_namespace::shared_ptr<GPU_Base_Column> copy() const = 0;
00079                         virtual const shared_pointer_namespace::shared_ptr<GPU_Base_Column> materialize(shared_pointer_namespace::shared_ptr<GPU_Positionlist> pos_list) const = 0;                     
00080                         
00082                         AttributeType getType() const throw();
00083                         const std::string getName() const throw();
00084 
00085                         protected:
00086                         std::string name_;
00087                         AttributeType db_type_;
00088                 };              
00089 
00090                 //typedef GPU_Base_Column::GPU_Base_ColumnPtr GPU_Base_ColumnPtr;
00091 
00092                 typedef shared_pointer_namespace::shared_ptr<GPU_Base_Column> GPU_Base_ColumnPtr;
00093                 
00094 //              typedef shared_pointer_namespace::shared_ptr<GPU_Positionlist> GPU_PositionlistPtr;
00095 
00096 //              //factory function
00097 //              const GPU_Base_Column* createGPUColumn(AttributeType type, const std::string& name);
00098 //              //copy columns from host to device
00099 //              bool copy_column_host_to_device(const std::vector<int>& host_column, GPU_Base_Column* device_column);
00100 //              bool copy_column_host_to_device(const std::vector<float>& host_column, GPU_Base_Column* device_column); 
00101 //              //
00102 //              //GPU_PositionList* copy_positionlist_host_to_device(std::vector<TID>*);
00103 //                      
00104 //              //copy columns from device to host      
00105 //              bool copy_column_device_to_host(GPU_Base_Column* device_column, std::vector<int>& host_column); //host columns are not const, because data is inserted in real columns directly 
00106 //              bool copy_column_device_to_host(GPU_Base_Column* device_column, std::vector<float>& host_column);               
00107 
00108                 const GPU_Base_ColumnPtr createGPUColumn(AttributeType type, const std::string& name);
00109 
00110                 const ColumnPtr copy_column_device_to_host(GPU_Base_ColumnPtr device_column);
00111                 const GPU_Base_ColumnPtr copy_column_host_to_device(ColumnPtr host_column);
00112 
00113                 const PositionListPtr copy_PositionList_device_to_host(GPU_PositionlistPtr device_pos_list);
00114                 const GPU_PositionlistPtr copy_PositionList_host_to_device(PositionListPtr pos_list);
00115 
00116                 const GPU_Base_ColumnPtr materializeColumn(GPU_Base_ColumnPtr device_column,GPU_PositionlistPtr device_pos_list);
00117 
00118         }; //end namespace gpu
00119 }; //end namespace CogaDB
00120                 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines