1 /* static_bitsequence_naive.h
2 * Copyright (C) 2008, Francisco Claude, all rights reserved.
4 * Naive Bitsequence - don't use, only for testing
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #ifndef _STATIC_BITSEQUENCE_NAIVE_H
24 #define _STATIC_BITSEQUENCE_NAIVE_H
26 #include <static_bitsequence.h>
28 /** Class used for testing, should not be used with long bitmaps
29 * @author Francisco Claude
31 class static_bitsequence_naive: public static_bitsequence {
33 /** Builds a naive bitsequence, receives the bitmap and the length
36 static_bitsequence_naive(uint * bitseq, uint len);
38 virtual ~static_bitsequence_naive();
40 /** Returns the number of ones until position i */
41 virtual uint rank1(uint i);
43 /** Returns the position of the i-th one
44 * @return (uint)-1 if i=0, len if i>num_ones or the position */
45 virtual uint select1(uint i);
47 /** Returns the i-th bit */
48 virtual bool access(uint i);
50 /** Returns the size of the structure in bytes */
53 /** - Not implemented - */
54 virtual int save(FILE * fp);
61 #endif /* _STATIC_BITSEQUENCE_NAIVE_H */