// Copyright (C) 2010-2016  MarketFactory, Inc. All Rights Reserved.
//================================================================================
//   This file is auto-generated; DO NOT EDIT!
//================================================================================

#include <API/Clients/CPP/Proto/MarketView.h>
#include <API/Clients/CPP/MFAPIClient/APIPrivate.h>

namespace MFAPI {

MarketView::MarketView()
{
}

MarketView::~MarketView()
{
}

void MarketView::read(void* v)
{
    FastCodec* in = static_cast<FastCodec*>(v);
    (void)in;

    fmID.read(v);
    timeExchange = in->read_int64();
    timeArrival = in->read_int64();
    timeHandler = in->read_int64();
    timeEnhanced = in->read_int64();
    timeApiServer = in->read_int64();
    timeApiClient = in->read_int64();
    isSnapshot = in->read_bool();
    {
        const uint16_t len = in->read_length();
        mdEntryList.resize(len);
        std::vector<MDEntry>::iterator it = mdEntryList.begin();
        for ( ; it != mdEntryList.end(); ++it ) {
            it->read(v);
        }
    }

}

void MarketView::write(void* v) const
{
    FastCodec* out = static_cast<FastCodec*>(v);
    (void)out;

    fmID.write(v);
    out->write_int64(timeExchange);
    out->write_int64(timeArrival);
    out->write_int64(timeHandler);
    out->write_int64(timeEnhanced);
    out->write_int64(timeApiServer);
    out->write_int64(timeApiClient);
    out->write_bool(isSnapshot);
    {
        out->write_length(mdEntryList.size());
        std::vector<MDEntry>::const_iterator it = mdEntryList.begin();
        for ( ; it != mdEntryList.end(); ++it ) {
            it->write(v);
        }
    }

}

bool MarketView::operator!=(const MarketView& o) const
{
    if(this == &o)
    {
        return false;
    }
    if(fmID != o.fmID) return true;
    if(timeExchange != o.timeExchange) return true;
    if(timeArrival != o.timeArrival) return true;
    if(timeHandler != o.timeHandler) return true;
    if(timeEnhanced != o.timeEnhanced) return true;
    if(timeApiServer != o.timeApiServer) return true;
    if(timeApiClient != o.timeApiClient) return true;
    if(isSnapshot != o.isSnapshot) return true;
    if(mdEntryList != o.mdEntryList) return true;

    return false;
}

bool MarketView::operator==(const MarketView& o) const
{
    return !operator!=(o);
}

bool MarketView::operator<(const MarketView& o) const
{
    if(this == &o)
    {
        return false;
    }
    if(fmID < o.fmID) return true;
    else if(o.fmID < fmID) return false;
    if(timeExchange < o.timeExchange) return true;
    else if(o.timeExchange < timeExchange) return false;
    if(timeArrival < o.timeArrival) return true;
    else if(o.timeArrival < timeArrival) return false;
    if(timeHandler < o.timeHandler) return true;
    else if(o.timeHandler < timeHandler) return false;
    if(timeEnhanced < o.timeEnhanced) return true;
    else if(o.timeEnhanced < timeEnhanced) return false;
    if(timeApiServer < o.timeApiServer) return true;
    else if(o.timeApiServer < timeApiServer) return false;
    if(timeApiClient < o.timeApiClient) return true;
    else if(o.timeApiClient < timeApiClient) return false;
    if(isSnapshot < o.isSnapshot) return true;
    else if(o.isSnapshot < isSnapshot) return false;
    if(mdEntryList < o.mdEntryList) return true;
    else if(o.mdEntryList < mdEntryList) return false;

    return false;
}

std::ostream& operator<<(std::ostream& os, const MarketView& o)
{
    o.dump(os, false);
    return os;
}

void MarketView::dump(std::ostream& os, bool pretty) const
{
    TextStream sos;
    TextCodec codec(sos);
    TextWriter wr(codec, true);
    sos << "<MarketView ";
    dump(&wr);
    sos << ">";
    os.write(sos.ends(), sos.size());
}

void MarketView::dump(void* v) const
{
    TextWriter* wr = static_cast<TextWriter*>(v);
    TextCodec* out = &wr->out();
    (void)wr;

    TextWriter::State __state = wr->push("(", false);
    wr->newfield();
    out->write_data("fmID=");
    this->fmID.dump(v);
    wr->newfield();
    out->write_data("timeExchange=");
    out->write_int64(this->timeExchange);
    wr->newfield();
    out->write_data("timeArrival=");
    out->write_int64(this->timeArrival);
    wr->newfield();
    out->write_data("timeHandler=");
    out->write_int64(this->timeHandler);
    wr->newfield();
    out->write_data("timeEnhanced=");
    out->write_int64(this->timeEnhanced);
    wr->newfield();
    out->write_data("timeApiServer=");
    out->write_int64(this->timeApiServer);
    wr->newfield();
    out->write_data("timeApiClient=");
    out->write_int64(this->timeApiClient);
    wr->newfield();
    out->write_data("isSnapshot=");
    out->write_bool(this->isSnapshot);
    wr->newfield();
    out->write_data("mdEntryList=");

    {
        TextWriter::State __state = wr->push("[", false);
        std::vector<MDEntry>::const_iterator it = this->mdEntryList.begin();
        std::vector<MDEntry>::const_iterator end__mdEntryList = this->mdEntryList.end();
        for ( ; it != end__mdEntryList; ++it ) {
            wr->newfield();
            it->dump(v);
        }
        wr->pop("]", __state);
    }

    wr->pop(")", __state);
}

} // MFAPI

/*
Brought to you by
/opt/atlassian/bamboo-agent/xml-data/build-dir/GAT-GWY-B3/Messaging/main.py --root /opt/atlassian/bamboo-agent/xml-data/build-dir/GAT-GWY-B3 --commit-date 2016-12-06T18:11:31.205-05:00 --revision 19c07f7ab2ea0612a19fbcabdd4a54e242830e7d --branch master --generated_directory /opt/atlassian/bamboo-agent/xml-data/build-dir/GAT-GWY-B3/build/rh7_3.13.0/release/intel64/generated/Python -o /opt/atlassian/bamboo-agent/xml-data/build-dir/GAT-GWY-B3/build/rh7_3.13.0/release/intel64/generated/API/Clients/CPP/Proto -i /opt/atlassian/bamboo-agent/xml-data/build-dir/GAT-GWY-B3/Messaging/MFProtocol --namespace=MFAPI cppapi /opt/atlassian/bamboo-agent/xml-data/build-dir/GAT-GWY-B3/Messaging/MFProtocol.proto.3130 /opt/atlassian/bamboo-agent/xml-data/build-dir/GAT-GWY-B3/Messaging/MFObsolete.proto.3130 
*/
