Skip to content

(MeshIterator): cast cell type into CellType enum instead of using std::uint8_t

What does this MR do?

When iterating through mesh cells, the iterator return the type as a CellType enum instead of a std::uint8_t. It allow to avoid a static_cast to compare the type to the enum.

Now we can simple write:

    auto cellItr          = mesh->begin< ::fwData::iterator::CellIterator >();
    const auto cellItrEnd = mesh->end< ::fwData::iterator::CellIterator >();
    
    for (; cellItr != cellItrEnd; ++cellItr)
    {
        const ::fwData::Mesh::CellType cellType = *cellItr->type;

        switch (cellType)
        {
            case ::fwData::Mesh::CellType::EDGE:
                //...
                break;
            case ::fwData::Mesh::CellType::TRIANGLE:
                //...
                break;
            //...
        }
    }

note: It is just a proposition, this change is not mandatory but can improve readability.

How to test it?

Launch unit tests, launch the applications that uses mesh (almost all).

Associated Issues/Merge Requests

Edited by Emilie WERNERT

Merge request reports