
#include <WFX/io/OutputStream.h>

using namespace WFX;
using namespace WFX::io;
using namespace std;

OutputStream::OutputStream(std::ostream* s) {
    setStream(s);
}

OutputStream::OutputStream() {
    OStream = NULL;
}

OutputStream::~OutputStream() {
}

void OutputStream::setStream(std::ostream* s) {
    OStream = s;
}

void OutputStream::operator <<(Int i) {
    assert(OStream);
    OStream->write((Char*)&i, sizeof(Int));
}

void OutputStream::operator <<(UInt i) {
    assert(OStream);
    OStream->write((Char*)&i, sizeof(UInt));
}

void OutputStream::operator <<(Long i) {
    assert(OStream);
    OStream->write((Char*)&i, sizeof(Long));
}

void OutputStream::operator <<(ULong i) {
    assert(OStream);
    OStream->write((Char*)&i, sizeof(ULong));
}

void OutputStream::operator <<(Short i) {
    assert(OStream);
    OStream->write((Char*)&i, sizeof(Short));
}

void OutputStream::operator <<(UShort i) {
    assert(OStream);
    OStream->write((Char*)&i, sizeof(UShort));
}

void OutputStream::operator <<(Char i) {
    assert(OStream);
    OStream->write((Char*)&i, sizeof(Char));
}

void OutputStream::operator <<(UChar i) {
    assert(OStream);
    OStream->write((Char*)&i, sizeof(UChar));
}

void OutputStream::operator <<(Real r) {
    assert(OStream);
    OStream->write((Char*)&r, sizeof(Real));
}

void OutputStream::operator <<(const std::string& str) {
    assert(OStream);
    *OStream << str;
    *this << '\0';
}

