Listing 5: The objAvl class

#ifndef OBJAVL_H
#define OBJAVL_H

#include "POBObj.h"

#include <deque>

class objAvl : public POBObj {
    friend ostream& operator<<(ostream&, objAvl&);

public:
    typedef pair<size_t, streampos> SIZE_POS;

    objAvl();
    ~objAvl();
    objAvl& operator=(const objAvl&);

    static POBObj* create() { return (POBObj*)(new objAvl); }
    operator const string& ();
    void operator=(const string&);

    bool   isEmpty();
    bool   getAvl(size_t, streampos&);
    void   addAvl(size_t, streampos);
    void   removepad();
    bool   isEmptySlot(streampos, size_t&);
    size_t spaceRecollection();
    size_t deqsize();
    
private:
    void getpos(int, int size, streampos&);
    bool deque_best_bsearch(size_t, size_t&);
    void swap(int, int);
    void sort_by_pos(int, int);
    void sort_by_size(int, int);

private:
    const size_t _max;
    size_t _acc_size;
    int       _pad_size;
    deque<SIZE_POS> _avl;
};

#endif