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

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

namespace MFAPI {

APIMarket::APIMarket()
{
}

APIMarket::~APIMarket()
{
}

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

    marketID = in->read_int32();
    name = in->read_string();
    feedID = in->read_int32();
    bigIncrement = MFFloat(in->read_mffloat());
    minIncrement = MFFloat(in->read_mffloat());
    instrumentType = InstrumentType::Type(in->read_uint8());
    settlementDate = StandardTenor::Type(in->read_uint8());

}

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

    out->write_int32(marketID);
    out->write_string(name);
    out->write_int32(feedID);
    out->write_mffloat(bigIncrement.toInt());
    out->write_mffloat(minIncrement.toInt());
    out->write_uint8(instrumentType); /* enum InstrumentType */
    out->write_uint8(settlementDate); /* enum StandardTenor */

}

bool APIMarket::operator!=(const APIMarket& o) const
{
    if(this == &o)
    {
        return false;
    }
    if(marketID != o.marketID) return true;
    if(name != o.name) return true;
    if(feedID != o.feedID) return true;
    if(bigIncrement != o.bigIncrement) return true;
    if(minIncrement != o.minIncrement) return true;
    if(instrumentType != o.instrumentType) return true;
    if(settlementDate != o.settlementDate) return true;

    return false;
}

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

bool APIMarket::operator<(const APIMarket& o) const
{
    if(this == &o)
    {
        return false;
    }
    if(marketID < o.marketID) return true;
    else if(o.marketID < marketID) return false;
    if(name < o.name) return true;
    else if(o.name < name) return false;
    if(feedID < o.feedID) return true;
    else if(o.feedID < feedID) return false;
    if(bigIncrement < o.bigIncrement) return true;
    else if(o.bigIncrement < bigIncrement) return false;
    if(minIncrement < o.minIncrement) return true;
    else if(o.minIncrement < minIncrement) return false;
    if(instrumentType < o.instrumentType) return true;
    else if(o.instrumentType < instrumentType) return false;
    if(settlementDate < o.settlementDate) return true;
    else if(o.settlementDate < settlementDate) return false;

    return false;
}

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

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

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

    TextWriter::State __state = wr->push("(", true);
    wr->newfield();
    out->write_data("marketID=");
    out->write_int32(this->marketID);
    wr->newfield();
    out->write_data("name=");
    out->write_string(this->name);
    wr->newfield();
    out->write_data("feedID=");
    out->write_int32(this->feedID);
    wr->newfield();
    out->write_data("bigIncrement=");
    out->write_int64(this->bigIncrement.toInt());
    wr->newfield();
    out->write_data("minIncrement=");
    out->write_int64(this->minIncrement.toInt());
    wr->newfield();
    out->write_data("instrumentType=");
    out->write_rawfield(InstrumentType::toString(this->instrumentType)); /* enum InstrumentType */
    wr->newfield();
    out->write_data("settlementDate=");
    out->write_rawfield(StandardTenor::toString(this->settlementDate)); /* enum StandardTenor */

    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 
*/
