SDSL: Succinct Data Structure Library
A C++ template library for succinct data structures
 All Classes Namespaces Files Functions Variables Typedefs Friends
sdsl/include/sdsl/rank_support.hpp
Go to the documentation of this file.
00001 /* sdsl - succinct data structures library
00002     Copyright (C) 2008 Simon Gog
00003 
00004     This program is free software: you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation, either version 3 of the License, or
00007     (at your option) any later version.
00008 
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.
00013 
00014     You should have received a copy of the GNU General Public License
00015     along with this program.  If not, see http://www.gnu.org/licenses/ .
00016 */
00021 #ifndef INCLUDED_SDSL_RANK_SUPPORT
00022 #define INCLUDED_SDSL_RANK_SUPPORT
00023 
00028 #include "int_vector.hpp"
00029 
00031 namespace sdsl
00032 {
00033 
00035 
00037 class rank_support
00038 {
00039     protected:
00040         const int_vector<1>* m_v; 
00041     public:
00042         typedef int_vector<1>::size_type size_type;
00043 
00045 
00047         rank_support(const int_vector<1>* v = NULL);
00049         rank_support(const rank_support& rs);
00051         virtual ~rank_support() {}
00053 
00058         virtual void init(const int_vector<1>* v=NULL) = 0;
00059 
00061 
00066         virtual const size_type rank(size_type i) const = 0;
00068         virtual const size_type operator()(size_type idx) const = 0;
00070 
00072         virtual size_type serialize(std::ostream& out, structure_tree_node* v, std::string name)const = 0;
00074 
00077         virtual void load(std::istream& in, const int_vector<1>* v=NULL) = 0;
00079 
00083         virtual void set_vector(const int_vector<1>* v=NULL) = 0;
00084 };
00085 
00086 inline rank_support::rank_support(const int_vector<1>* v)
00087 {
00088     m_v = v;
00089 }
00090 
00091 inline rank_support::rank_support(const rank_support& rs)
00092 {
00093     m_v = rs.m_v;
00094 }
00095 
00096 }// end namespace sdsl
00097 
00098 #include "rank_support_v.hpp"
00099 #include "rank_support_v5.hpp"
00100 #include "rank_support_jmc.hpp"
00101 
00102 #endif // end file