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

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

namespace MFAPI {

TradeCapture::TradeCapture()
{
}

TradeCapture::~TradeCapture()
{
}

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

    sequenceID = in->read_int32();
    orderID = in->read_int64();
    clOrdID = in->read_string();
    exOrdID = in->read_string();
    exPendingID = in->read_string();
    exTradeID = in->read_string();
    modelID = in->read_string();
    timeExchange = in->read_int64();
    timeHandler = in->read_int64();
    timeApiServer = in->read_int64();
    timeApiClient = in->read_int64();
    feedID = in->read_int32();
    origFeedID = in->read_int32();
    marketID = in->read_int32();
    side = Side::Type(in->read_uint8());
    amount = MFFloat(in->read_mffloat());
    price = MFFloat(in->read_mffloat());
    isTaker = in->read_bool();
    matchStatus = MatchStatus::Type(in->read_uint8());
    counterPartyID = in->read_string();
    tradeDate = in->read_int64();
    settlDate = in->read_int64();

}

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

    out->write_int32(sequenceID);
    out->write_int64(orderID);
    out->write_string(clOrdID);
    out->write_string(exOrdID);
    out->write_string(exPendingID);
    out->write_string(exTradeID);
    out->write_string(modelID);
    out->write_int64(timeExchange);
    out->write_int64(timeHandler);
    out->write_int64(timeApiServer);
    out->write_int64(timeApiClient);
    out->write_int32(feedID);
    out->write_int32(origFeedID);
    out->write_int32(marketID);
    out->write_uint8(side); /* enum Side */
    out->write_mffloat(amount.toInt());
    out->write_mffloat(price.toInt());
    out->write_bool(isTaker);
    out->write_uint8(matchStatus); /* enum MatchStatus */
    out->write_string(counterPartyID);
    out->write_int64(tradeDate);
    out->write_int64(settlDate);

}

bool TradeCapture::operator!=(const TradeCapture& o) const
{
    if(this == &o)
    {
        return false;
    }
    if(sequenceID != o.sequenceID) return true;
    if(orderID != o.orderID) return true;
    if(clOrdID != o.clOrdID) return true;
    if(exOrdID != o.exOrdID) return true;
    if(exPendingID != o.exPendingID) return true;
    if(exTradeID != o.exTradeID) return true;
    if(modelID != o.modelID) return true;
    if(timeExchange != o.timeExchange) return true;
    if(timeHandler != o.timeHandler) return true;
    if(timeApiServer != o.timeApiServer) return true;
    if(timeApiClient != o.timeApiClient) return true;
    if(feedID != o.feedID) return true;
    if(origFeedID != o.origFeedID) return true;
    if(marketID != o.marketID) return true;
    if(side != o.side) return true;
    if(amount != o.amount) return true;
    if(price != o.price) return true;
    if(isTaker != o.isTaker) return true;
    if(matchStatus != o.matchStatus) return true;
    if(counterPartyID != o.counterPartyID) return true;
    if(tradeDate != o.tradeDate) return true;
    if(settlDate != o.settlDate) return true;

    return false;
}

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

bool TradeCapture::operator<(const TradeCapture& o) const
{
    if(this == &o)
    {
        return false;
    }
    if(sequenceID < o.sequenceID) return true;
    else if(o.sequenceID < sequenceID) return false;
    if(orderID < o.orderID) return true;
    else if(o.orderID < orderID) return false;
    if(clOrdID < o.clOrdID) return true;
    else if(o.clOrdID < clOrdID) return false;
    if(exOrdID < o.exOrdID) return true;
    else if(o.exOrdID < exOrdID) return false;
    if(exPendingID < o.exPendingID) return true;
    else if(o.exPendingID < exPendingID) return false;
    if(exTradeID < o.exTradeID) return true;
    else if(o.exTradeID < exTradeID) return false;
    if(modelID < o.modelID) return true;
    else if(o.modelID < modelID) return false;
    if(timeExchange < o.timeExchange) return true;
    else if(o.timeExchange < timeExchange) return false;
    if(timeHandler < o.timeHandler) return true;
    else if(o.timeHandler < timeHandler) 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(feedID < o.feedID) return true;
    else if(o.feedID < feedID) return false;
    if(origFeedID < o.origFeedID) return true;
    else if(o.origFeedID < origFeedID) return false;
    if(marketID < o.marketID) return true;
    else if(o.marketID < marketID) return false;
    if(side < o.side) return true;
    else if(o.side < side) return false;
    if(amount < o.amount) return true;
    else if(o.amount < amount) return false;
    if(price < o.price) return true;
    else if(o.price < price) return false;
    if(isTaker < o.isTaker) return true;
    else if(o.isTaker < isTaker) return false;
    if(matchStatus < o.matchStatus) return true;
    else if(o.matchStatus < matchStatus) return false;
    if(counterPartyID < o.counterPartyID) return true;
    else if(o.counterPartyID < counterPartyID) return false;
    if(tradeDate < o.tradeDate) return true;
    else if(o.tradeDate < tradeDate) return false;
    if(settlDate < o.settlDate) return true;
    else if(o.settlDate < settlDate) return false;

    return false;
}

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

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

void TradeCapture::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("sequenceID=");
    out->write_int32(this->sequenceID);
    wr->newfield();
    out->write_data("orderID=");
    out->write_int64(this->orderID);
    wr->newfield();
    out->write_data("clOrdID=");
    out->write_string(this->clOrdID);
    wr->newfield();
    out->write_data("exOrdID=");
    out->write_string(this->exOrdID);
    wr->newfield();
    out->write_data("exPendingID=");
    out->write_string(this->exPendingID);
    wr->newfield();
    out->write_data("exTradeID=");
    out->write_string(this->exTradeID);
    wr->newfield();
    out->write_data("modelID=");
    out->write_string(this->modelID);
    wr->newfield();
    out->write_data("timeExchange=");
    out->write_int64(this->timeExchange);
    wr->newfield();
    out->write_data("timeHandler=");
    out->write_int64(this->timeHandler);
    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("feedID=");
    out->write_int32(this->feedID);
    wr->newfield();
    out->write_data("origFeedID=");
    out->write_int32(this->origFeedID);
    wr->newfield();
    out->write_data("marketID=");
    out->write_int32(this->marketID);
    wr->newfield();
    out->write_data("side=");
    out->write_rawfield(Side::toString(this->side)); /* enum Side */
    wr->newfield();
    out->write_data("amount=");
    out->write_int64(this->amount.toInt());
    wr->newfield();
    out->write_data("price=");
    out->write_int64(this->price.toInt());
    wr->newfield();
    out->write_data("isTaker=");
    out->write_bool(this->isTaker);
    wr->newfield();
    out->write_data("matchStatus=");
    out->write_rawfield(MatchStatus::toString(this->matchStatus)); /* enum MatchStatus */
    wr->newfield();
    out->write_data("counterPartyID=");
    out->write_string(this->counterPartyID);
    wr->newfield();
    out->write_data("tradeDate=");
    out->write_int64(this->tradeDate);
    wr->newfield();
    out->write_data("settlDate=");
    out->write_int64(this->settlDate);

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