Exemple #1
0
void CObject::Init (void)
{
info.nType = OBJ_NONE;
cType.explInfo.attached.nNext =
cType.explInfo.attached.nPrev =
cType.explInfo.attached.nParent =
info.nAttachedObj = -1;
info.nFlags = 0;
ResetSgmLinks ();
ResetLinks ();
m_shots.nObject = -1;
m_shots.nSignature = -1;
m_xCreationTime =
m_xTimeLastHit = 0;
m_vStartVel.SetZero ();
}
// DEPRECATED, use SetLeafTaxIds
void
CBlast_def_line::SetTaxIds(const CBlast_def_line::TTaxIds& t)
{
    // Clear the 'links' field.  We may be setting new values there anyway.
    ResetLinks();

    // Next step depends on size of input set.
    if (t.empty()) {
        // If it's empty, clear the 'taxid' field too.
        ResetTaxid();
    } else if (t.size() == 1) {
        // Or if it has a single value, set 'taxid' to that value.
        SetTaxid(*t.begin());
    } else {
        // Otherwise, set the 'taxid' field to the FIRST value in the set,
        // UNLESS the following conditions are all met:
        // (1) 'taxid' has a value;
        // (2) that value is non-zero;
        // (3) it's already present in the input set.
        bool overwrite = true;
        if (IsSetTaxid()) {
            const TTaxid taxid = GetTaxid();
            if (taxid != 0) {
                TTaxIds::iterator it = t.find(taxid);
                if (it != t.end()) {
                    overwrite = false;
                }
            }
        }
        // If the above conditions were not met, overwrite the existing
        // 'taxid'.
        if (overwrite) {
            SetTaxid(*t.begin());
        }
        // Save all of the input set to the 'links' field.
        ITERATE(TTaxIds, itr, t) {
            SetLinks().push_back(*itr);
        }
    }