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

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

namespace MFAPI {

TradeState::TradeState()
{
}

TradeState::~TradeState()
{
}

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

    groupName = in->read_string();
    boughtBase = in->read_string();
    soldBase = in->read_string();
    boughtCounter = in->read_string();
    soldCounter = in->read_string();
    pendingBoughtBase = in->read_string();
    pendingSoldBase = in->read_string();
    feedID = in->read_int32();
    marketID = in->read_int32();
    ccyType = CcyType::Type(in->read_uint8());
    settlTime = in->read_int64();
    syncTime = in->read_int64();

}

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

    out->write_string(groupName);
    out->write_string(boughtBase);
    out->write_string(soldBase);
    out->write_string(boughtCounter);
    out->write_string(soldCounter);
    out->write_string(pendingBoughtBase);
    out->write_string(pendingSoldBase);
    out->write_int32(feedID);
    out->write_int32(marketID);
    out->write_uint8(ccyType); /* enum CcyType */
    out->write_int64(settlTime);
    out->write_int64(syncTime);

}

bool TradeState::operator!=(const TradeState& o) const
{
    if(this == &o)
    {
        return false;
    }
    if(groupName != o.groupName) return true;
    if(boughtBase != o.boughtBase) return true;
    if(soldBase != o.soldBase) return true;
    if(boughtCounter != o.boughtCounter) return true;
    if(soldCounter != o.soldCounter) return true;
    if(pendingBoughtBase != o.pendingBoughtBase) return true;
    if(pendingSoldBase != o.pendingSoldBase) return true;
    if(feedID != o.feedID) return true;
    if(marketID != o.marketID) return true;
    if(ccyType != o.ccyType) return true;
    if(settlTime != o.settlTime) return true;
    if(syncTime != o.syncTime) return true;

    return false;
}

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

bool TradeState::operator<(const TradeState& o) const
{
    if(this == &o)
    {
        return false;
    }
    if(groupName < o.groupName) return true;
    else if(o.groupName < groupName) return false;
    if(boughtBase < o.boughtBase) return true;
    else if(o.boughtBase < boughtBase) return false;
    if(soldBase < o.soldBase) return true;
    else if(o.soldBase < soldBase) return false;
    if(boughtCounter < o.boughtCounter) return true;
    else if(o.boughtCounter < boughtCounter) return false;
    if(soldCounter < o.soldCounter) return true;
    else if(o.soldCounter < soldCounter) return false;
    if(pendingBoughtBase < o.pendingBoughtBase) return true;
    else if(o.pendingBoughtBase < pendingBoughtBase) return false;
    if(pendingSoldBase < o.pendingSoldBase) return true;
    else if(o.pendingSoldBase < pendingSoldBase) return false;
    if(feedID < o.feedID) return true;
    else if(o.feedID < feedID) return false;
    if(marketID < o.marketID) return true;
    else if(o.marketID < marketID) return false;
    if(ccyType < o.ccyType) return true;
    else if(o.ccyType < ccyType) return false;
    if(settlTime < o.settlTime) return true;
    else if(o.settlTime < settlTime) return false;
    if(syncTime < o.syncTime) return true;
    else if(o.syncTime < syncTime) return false;

    return false;
}

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

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

void TradeState::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("groupName=");
    out->write_string(this->groupName);
    wr->newfield();
    out->write_data("boughtBase=");
    out->write_string(this->boughtBase);
    wr->newfield();
    out->write_data("soldBase=");
    out->write_string(this->soldBase);
    wr->newfield();
    out->write_data("boughtCounter=");
    out->write_string(this->boughtCounter);
    wr->newfield();
    out->write_data("soldCounter=");
    out->write_string(this->soldCounter);
    wr->newfield();
    out->write_data("pendingBoughtBase=");
    out->write_string(this->pendingBoughtBase);
    wr->newfield();
    out->write_data("pendingSoldBase=");
    out->write_string(this->pendingSoldBase);
    wr->newfield();
    out->write_data("feedID=");
    out->write_int32(this->feedID);
    wr->newfield();
    out->write_data("marketID=");
    out->write_int32(this->marketID);
    wr->newfield();
    out->write_data("ccyType=");
    out->write_rawfield(CcyType::toString(this->ccyType)); /* enum CcyType */
    wr->newfield();
    out->write_data("settlTime=");
    out->write_int64(this->settlTime);
    wr->newfield();
    out->write_data("syncTime=");
    out->write_int64(this->syncTime);

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