Logo Search packages:      
Sourcecode: nagcon version File versions  Download package

br.h

/*
 * Copyright (C) 2006 Folkert van Heusden <folkert@vanheusden.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

/* code taken from linux kernel */
#if __GNUC__ == 2 && __GNUC_MINOR__ < 96
#define __builtin_expect(x, expected_value) (x)
#endif
#ifndef __builtin_expect
#define __builtin_expect(x, expected_value) (x)
#endif
#define likely(x)       __builtin_expect((x),1)
#define unlikely(x)     __builtin_expect((x),0)

class buffered_reader
{
private:
        int fd, block_size;
        char *buffer;
        long long int buffer_length, buffer_pointer;
      char *mmap_addr, *cur_offset;
      off64_t size_of_file;

        int number_of_bytes_in_buffer(void);
        int read_into_buffer(void);

public:
        buffered_reader(int fd, int block_size=4096);
        ~buffered_reader();

        int garbage_collect(char shrink_buffer=0);

        char * read_line(void);

      off64_t file_offset(void);
};

Generated by  Doxygen 1.6.0   Back to index