




#include "xpathlink.h"

XPathLink::XPathLink()
    : XAsset() {
}

void XPathLink::ParseData(QDataStream *aStream) {
    if (GetPtr() == -1) {
        aStream->read((char*)&mDist, sizeof(float));
        aStream->read((char*)&mNodeNum, sizeof(unsigned short));
        aStream->read((char*)&mDisconnectCount, sizeof(unsigned char));
        aStream->read((char*)&mNegotiationLink, sizeof(unsigned char));
        aStream->read((char*)mBadPlaceCount, 4 * sizeof(unsigned char));
    }
}

float XPathLink::GetDist() const {
    return mDist;
}

void XPathLink::SetDist(float dist) {
    mDist = dist;
}

unsigned short XPathLink::GetNodeNum() const {
    return mNodeNum;
}

void XPathLink::SetNodeNum(unsigned short num) {
    mNodeNum = num;
}

unsigned char XPathLink::GetDisconnectCount() const {
    return mDisconnectCount;
}

void XPathLink::SetDisconnectCount(unsigned char count) {
    mDisconnectCount = count;
}

unsigned char XPathLink::GetNegotiationLink() const {
    return mNegotiationLink;
}

void XPathLink::SetNegotiationLink(unsigned char link) {
    mNegotiationLink = link;
}

const unsigned char* XPathLink::GetBadPlaceCount() const {
    return mBadPlaceCount;
}

void XPathLink::SetBadPlaceCount(const unsigned char* counts, size_t size) {
    if (size <= 4) {
        memcpy(mBadPlaceCount, counts, size * sizeof(unsigned char));
    }
}




