Column-oriented GPU-accelerated Database Management System
CoGaDB
|
00001 00002 #pragma once 00003 00004 #include <core/column_base_typed.hpp> 00005 00006 namespace CoGaDB{ 00007 00018 template<class T> 00019 class CompressedColumn : public ColumnBaseTyped<T>{ 00020 public: 00021 /***************** constructors and destructor *****************/ 00022 CompressedColumn(const std::string& name, AttributeType db_type); 00023 virtual ~CompressedColumn(); 00024 00025 virtual bool insert(const boost::any& new_Value) = 0; 00026 virtual bool insert(const T& new_value) = 0; 00027 00028 virtual bool update(TID tid, const boost::any& new_value) = 0; 00029 virtual bool update(PositionListPtr tid, const boost::any& new_value) = 0; 00030 00031 virtual bool remove(TID tid)=0; 00032 //assumes tid list is sorted ascending 00033 virtual bool remove(PositionListPtr tid)=0; 00034 virtual bool clearContent()=0; 00035 00036 virtual const boost::any get(TID tid) = 0; 00037 //virtual const boost::any* const getRawData()=0; 00038 virtual void print() const throw() = 0; 00039 virtual size_t size() const throw() = 0; 00040 virtual unsigned int getSizeinBytes() const throw() = 0; 00041 00042 virtual const ColumnPtr copy() const = 0; 00043 00044 virtual bool store(const std::string& path) = 0; 00045 virtual bool load(const std::string& path) = 0; 00046 virtual bool isMaterialized() const throw(); 00047 00048 virtual bool isCompressed() const throw(); 00049 00050 00051 virtual T& operator[](const int index) = 0; 00052 00053 }; 00054 00055 typedef CompressedColumn<int> CompressedIntegerColumn; 00056 typedef CompressedColumn<float> CompressedFloatColumn; 00057 typedef CompressedColumn<double> CompressedDoubleColumn; 00058 typedef CompressedColumn<std::string> CompressedStringColumn; 00059 00060 00061 /***************** Start of Implementation Section ******************/ 00062 00063 00064 template<class T> 00065 CompressedColumn<T>::CompressedColumn(const std::string& name, AttributeType db_type) : ColumnBaseTyped<T>(name,db_type){ 00066 00067 } 00068 00069 template<class T> 00070 CompressedColumn<T>::~CompressedColumn(){ 00071 00072 } 00073 00074 template<class T> 00075 bool CompressedColumn<T>::isMaterialized() const throw(){ 00076 return false; 00077 } 00078 00079 template<class T> 00080 bool CompressedColumn<T>::isCompressed() const throw(){ 00081 return true; 00082 } 00083 00084 00085 /* 00086 template<class T> 00087 bool CompressedColumn<T>::insert(const boost::any& new_Value){ 00088 00089 return false; 00090 } 00091 00092 template<class T> 00093 const boost::any CompressedColumn<T>::get(TID tid){ 00094 00095 return boost::any(); 00096 } 00097 00098 template<class T> 00099 void CompressedColumn<T>::print() const throw(){ 00100 00101 } 00102 template<class T> 00103 size_t CompressedColumn<T>::size() const throw(){ 00104 00105 return 0; 00106 } 00107 template<class T> 00108 const ColumnPtr CompressedColumn<T>::copy() const{ 00109 00110 return ColumnPtr(NULL); 00111 } 00112 00113 template<class T> 00114 bool CompressedColumn<T>::store(const std::string& path){ 00115 00116 return std::vector<TID>(); 00117 } 00118 template<class T> 00119 bool CompressedColumn<T>::load(const std::string& path){ 00120 00121 return false; 00122 } 00123 template<class T> 00124 bool CompressedColumn<T>::isMaterialized() const throw(){ 00125 00126 return false; 00127 } 00128 00129 template<class T> 00130 bool CompressedColumn<T>::isCompressed() const throw(){ 00131 return true; 00132 } 00133 00134 template<class T> 00135 T& CompressedColumn<T>::operator[](const int index){ 00136 static T t; 00137 return t; 00138 } 00139 00140 template<class T> 00141 unsigned int CompressedColumn<T>::getSizeinBytes() const throw(){ 00142 return values_.capacity()*sizeof(T); 00143 } 00144 */ 00145 00146 /***************** End of Implementation Section ******************/ 00147 00148 00149 00150 }; //end namespace CogaDB 00151