template class axl::rc::Buf

#include <axl_rc_Buf.h>

template <
    typename T,
    typename SizeOf = sl::SizeOf<T>,
    typename Ref = BufRef<T, SizeOf>
    >
class Buf: public Ref
{
public:
    // classes

    class Hdr;

    // construction

    Buf();
    Buf(const Buf& src);
    Buf(const Ref& src);

    Buf(
        const T* src,
        size_t size = -1
        );

    Buf(
        BufKind kind,
        void* p,
        size_t size
        );

    // methods

    operator const T *() const;
    operator T *();

    const T*
    operator->() const;

    T*
    operator->();

    Buf&
    operator=(const Buf& src);

    Buf&
    operator=(const Ref& src);

    Buf&
    operator=(const T* p);

    T*
    p();

    void
    clear();

    size_t
    copy(const Ref& src);

    size_t
    copy(
        const T* p,
        size_t size = -1
        );

    bool
    isExclusive();

    bool
    ensureExclusive();

    T*
    getBuffer(size_t* size = NULL);

    T*
    createBuffer(
        size_t size = sizeof(T),
        bool saveContents = false
        );

    size_t
    setBuffer(
        BufKind kind,
        void* p,
        size_t size
        );
};