#ifndef INCLUDED_BOBCAT_OSHAREDSTREAM_
#define INCLUDED_BOBCAT_OSHAREDSTREAM_

#include <ostream>

#include <bobcat/sharedstreambuf>

namespace FBB
{

struct OSharedStream: private SharedStreambuf, 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 SharedStreambuf::attachSharedCondition;

    using std::ostream::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::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 "truncate.f"

} // FBB        
#endif





