#ifndef INCLUDED_BOBCAT_OSHAREDSTREAM_
#define INCLUDED_BOBCAT_OSHAREDSTREAM_

#include <ostream>

#include <bobcat/sharedbuf>

namespace FBB
{

struct OSharedStream: private SharedBuf, public std::ostream, 
                      public virtual SharedEnum__
{
    OSharedStream();

    OSharedStream(
            size_t maxSize, SizeUnit sizeUnit,
            std::ios::openmode openMode = std::ios::out,
            size_t access = 0600);

    OSharedStream(
            size_t id, 
            std::ios::openmode openMode = std::ios::out | std::ios::in);

    using SharedBuf::attachSharedCondition;

    using std::ostream::clear;

    using SharedBuf::createSharedCondition;

    using SharedBuf::id;

    using SharedBuf::kill;

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

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

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

    using SharedBuf::remove;

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

#include "truncate.f"

} // FBB        
#endif





