Exemplo n.º 1
0
bool ShapeConnectionPin::operator==(const ShapeConnectionPin& rhs) const
{
    COLA_ASSERT(m_router == rhs.m_router);

    if (containingObjectId() != rhs.containingObjectId())
    {
        return false;
    }

    // The shape/junction is equal, so examine the unique members.
    if (m_class_id != rhs.m_class_id)
    {
        return false;
    }
    if (m_visibility_directions != rhs.m_visibility_directions)
    {
        return false;
    }
    if (m_x_portion_offset != rhs.m_x_portion_offset)
    {
       return false;
    }
    if (m_y_portion_offset != rhs.m_y_portion_offset)
    {
       return false;
    }
    if (m_inside_offset != rhs.m_inside_offset)
    {
       return false;
    } 
    return true;  
}
Exemplo n.º 2
0
bool ShapeConnectionPin::operator<(const ShapeConnectionPin& rhs) const
{
    COLA_ASSERT(m_router == rhs.m_router);

    if (containingObjectId() != rhs.containingObjectId())
    {
        return containingObjectId() < rhs.containingObjectId();
    }
    // Note: operator< is used for set ordering within each shape or junction,
    // so the m_shape/m_junction values should match and we needn't perform the
    // above test in most cases and could just assert the following:
    // COLA_ASSERT(m_shape == rhs.m_shape);
    // COLA_ASSERT(m_junction == rhs.m_junction);

    if (m_class_id != rhs.m_class_id)
    {
        return m_class_id < rhs.m_class_id;
    }
    if (m_visibility_directions != rhs.m_visibility_directions)
    {
        return m_visibility_directions < rhs.m_visibility_directions;
    }
    if (m_x_portion_offset != rhs.m_x_portion_offset)
    {
        return m_x_portion_offset < rhs.m_x_portion_offset;
    }
    if (m_y_portion_offset != rhs.m_y_portion_offset)
    {
        return m_y_portion_offset < rhs.m_y_portion_offset;
    }
    if (m_inside_offset != rhs.m_inside_offset)
    {
        return m_inside_offset < rhs.m_inside_offset;
    }

    // Otherwise, they are considered the same.
    return false;
}