Skip to content

Commit

Permalink
Remove VoxelComplex operators from namespace functions
Browse files Browse the repository at this point in the history
Follows #1390
  • Loading branch information
phcerdan committed Feb 5, 2019
1 parent 7daedc4 commit 5d9e41c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 35 deletions.
7 changes: 3 additions & 4 deletions src/DGtal/topology/VoxelComplex.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace DGtal {
// Forward definitions.
template <typename TKSpace, typename TCellContainer>
class VoxelComplex;
namespace functions {

template <typename TKSpace, typename TCellContainer>
VoxelComplex<TKSpace, TCellContainer> &
operator-=(VoxelComplex<TKSpace, TCellContainer> &,
Expand All @@ -60,7 +60,6 @@ VoxelComplex<TKSpace, TCellContainer>
operator-(const VoxelComplex<TKSpace, TCellContainer> &,
const VoxelComplex<TKSpace, TCellContainer> &);

} // namespace functions
/////////////////////////////////////////////////////////////////////////////
// template class VoxelComplex
/**
Expand Down Expand Up @@ -94,8 +93,8 @@ class VoxelComplex : public CubicalComplex<TKSpace, TCellContainer> {
/** Type of this instance of VoxelComplex. */
using Self = VoxelComplex<TKSpace, TCellContainer>;

friend Self &DGtal::functions::operator-=<>(Self &, const Self &);
friend Self DGtal::functions::operator-<>(const Self &, const Self &);
friend Self &DGtal::operator-=<>(Self &, const Self &);
friend Self DGtal::operator-<>(const Self &, const Self &);
// ----------------------- associated types ------------------------------
/** Type of the parent class CubicalComplex. */
using Parent = CubicalComplex<TKSpace, TCellContainer>;
Expand Down
60 changes: 30 additions & 30 deletions src/DGtal/topology/VoxelComplexFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,55 +365,55 @@ namespace DGtal
template <typename TObject >
std::vector< TObject >
connectedComponents(const TObject & input_obj, bool verbose);

} // namespace functions

//////////////////////////////////////////////////////////////////////////////
//Operators between VoxelComplexes//
//Operators between VoxelComplexes//

/**
* Voxel Complex difference operation. Updates the voxel complex S1 as S1 - S2.
* @tparam TKSpace the digital space in which lives the voxel complex.
* @tparam TCellContainer the associative container used to store cells within the voxel complex.
*
* @param[in,out] S1 an input voxel complex, \a S1 - \a S2 as output.
* @param[in] S2 another input voxel complex.
*
* @return a reference to the modified voxel complex S1.
*/
template <typename TKSpace, typename TCellContainer>
/**
* Voxel Complex difference operation. Updates the voxel complex S1 as S1 - S2.
* @tparam TKSpace the digital space in which lives the voxel complex.
* @tparam TCellContainer the associative container used to store cells within
* the voxel complex.
*
* @param[in,out] S1 an input voxel complex, \a S1 - \a S2 as output.
* @param[in] S2 another input voxel complex.
*
* @return a reference to the modified voxel complex S1.
*/
template <typename TKSpace, typename TCellContainer>
inline VoxelComplex< TKSpace, TCellContainer >&
operator-=( VoxelComplex< TKSpace, TCellContainer >& S1,
const VoxelComplex< TKSpace, TCellContainer >& S2 )
const VoxelComplex< TKSpace, TCellContainer >& S2 )
{
typedef VoxelComplex< TKSpace, TCellContainer > VC;
for ( Dimension i = 0; i <= VC::dimension; ++i )
setops::operator-=( S1.myCells[ i ],S2.myCells[ i ] );
functions::setops::operator-=( S1.myCells[ i ],S2.myCells[ i ] );
return S1;
}

/**
* Voxel Complex difference operation. Returns the difference of \a S1 - \a S2.
* @tparam TKSpace the digital space in which lives the voxel complex.
* @tparam TCellContainer the associative container used to store cells within the voxel complex.
*
* @param[in] S1 an input voxel complex
* @param[in] S2 another input voxel complex.
*
* @return the voxel complex \a S1 - \a S2.
*/
template <typename TKSpace, typename TCellContainer>
/**
* Voxel Complex difference operation. Returns the difference of \a S1 - \a S2.
* @tparam TKSpace the digital space in which lives the voxel complex.
* @tparam TCellContainer the associative container used to store cells within
* the voxel complex.
*
* @param[in] S1 an input voxel complex
* @param[in] S2 another input voxel complex.
*
* @return the voxel complex \a S1 - \a S2.
*/
template <typename TKSpace, typename TCellContainer>
inline VoxelComplex< TKSpace, TCellContainer >
operator-( const VoxelComplex< TKSpace, TCellContainer >& S1,
const VoxelComplex< TKSpace, TCellContainer >& S2 )
const VoxelComplex< TKSpace, TCellContainer >& S2 )
{
typedef VoxelComplex< TKSpace, TCellContainer > VC;
VC S(S1);
for ( Dimension i = 0; i <= VC::dimension; ++i )
setops::operator-=( S.myCells[ i ],S2.myCells[ i ] );
functions::setops::operator-=( S.myCells[ i ],S2.myCells[ i ] );
return S;
}

} // namespace functions
} // namespace DGtal


Expand Down
1 change: 0 additions & 1 deletion tests/topology/testVoxelComplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,6 @@ TEST_CASE_METHOD(Fixture_complex_fig4, "zeroSurface and oneSurface",
"[isSurface][function]") {
auto &vc = complex_fixture;
using namespace DGtal::functions;
using Point = FixtureComplex::Point;
vc.clear();
Point c(0, 0, 0);
{
Expand Down

0 comments on commit 5d9e41c

Please sign in to comment.