#ifndef INCLUDED_BOBCAT_SHAREDSTREAM_
#define INCLUDED_BOBCAT_SHAREDSTREAM_

#include <istream>
#include <ostream>

#include <bobcat/sharedstreambuf>

namespace FBB
{

struct SharedStream: private SharedStreambuf, 
                    public std::istream, public std::ostream,
                    public virtual SharedEnum__
{
    SharedStream();

    SharedStream(                                           // 2
            size_t maxSize, SizeUnit sizeUnit,
            std::ios::openmode openMode = std::ios::in | std::ios::out,
            size_t access = 0600);

    SharedStream(                                           // 3
            int id, 
            std::ios::openmode openMode = std::ios::in | std::ios::out);

    
    using SharedStreambuf::attachSharedCondition;

    void clear();

    using SharedStreambuf::createSharedCondition;

    using SharedStreambuf::id;

    using SharedStreambuf::kill;

    void memInfo(std::ostream &out, char const *end = "\n") const;

    void open(
            size_t maxSize, SizeUnit sizeUnit,
            std::ios::openmode openMode = std::ios::in | std::ios::out,
            size_t access = 0600);

    void open(
            int id,
            std::ios::openmode openMode = std::ios::in | std::ios::out);

    using SharedStreambuf::remove;

    bool truncate(std::streamsize offset);
};

#include "clear.f"
#include "truncate.f"

} // FBB        
#endif
