From 237d659b8d00cbbf54366656b3d8b34068a03b1c Mon Sep 17 00:00:00 2001 From: Sameer Agarwal Date: Wed, 30 May 2012 20:34:49 -0700 Subject: [PATCH] Added CERES_ prefix to the DISALLOW macros. Change-Id: Ib81e9112e8bbc6ed6cb52f21825df0f6e659be51 --- include/ceres/cost_function.h | 2 +- include/ceres/internal/macros.h | 16 +++++++++------- include/ceres/loss_function.h | 4 ++-- include/ceres/problem.h | 2 +- .../ceres/block_random_access_dense_matrix.h | 2 +- .../ceres/block_random_access_sparse_matrix.h | 2 +- internal/ceres/block_sparse_matrix.h | 4 ++-- internal/ceres/canonical_views_clustering.cc | 2 +- internal/ceres/cgnr_solver.h | 2 +- internal/ceres/compressed_row_sparse_matrix.h | 2 +- internal/ceres/conjugate_gradients_solver.h | 2 +- internal/ceres/dense_qr_solver.h | 2 +- internal/ceres/graph.h | 2 +- internal/ceres/problem_impl.h | 2 +- internal/ceres/schur_complement_solver.h | 6 +++--- internal/ceres/sparse_normal_cholesky_solver.h | 2 +- internal/ceres/visibility_based_preconditioner.h | 2 +- 17 files changed, 29 insertions(+), 27 deletions(-) diff --git a/include/ceres/cost_function.h b/include/ceres/cost_function.h index 84403d906..9b010f78f 100644 --- a/include/ceres/cost_function.h +++ b/include/ceres/cost_function.h @@ -119,7 +119,7 @@ class CostFunction { // number of outputs (residuals). vector parameter_block_sizes_; int num_residuals_; - DISALLOW_COPY_AND_ASSIGN(CostFunction); + CERES_DISALLOW_COPY_AND_ASSIGN(CostFunction); }; } // namespace ceres diff --git a/include/ceres/internal/macros.h b/include/ceres/internal/macros.h index 05d628795..7dd4e3eb0 100644 --- a/include/ceres/internal/macros.h +++ b/include/ceres/internal/macros.h @@ -43,11 +43,13 @@ // // For disallowing only assign or copy, write the code directly, but declare // the intend in a comment, for example: -// void operator=(const TypeName&); // DISALLOW_ASSIGN -// Note, that most uses of DISALLOW_ASSIGN and DISALLOW_COPY are broken -// semantically, one should either use disallow both or neither. Try to -// avoid these in new code. -#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ +// +// void operator=(const TypeName&); // _DISALLOW_ASSIGN + +// Note, that most uses of CERES_DISALLOW_ASSIGN and CERES_DISALLOW_COPY +// are broken semantically, one should either use disallow both or +// neither. Try to avoid these in new code. +#define CERES_DISALLOW_COPY_AND_ASSIGN(TypeName) \ TypeName(const TypeName&); \ void operator=(const TypeName&) @@ -57,9 +59,9 @@ // This should be used in the private: declarations for a class // that wants to prevent anyone from instantiating it. This is // especially useful for classes containing only static methods. -#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ +#define CERES_DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ TypeName(); \ - DISALLOW_COPY_AND_ASSIGN(TypeName) + CERES_DISALLOW_COPY_AND_ASSIGN(TypeName) // The arraysize(arr) macro returns the # of elements in an array arr. // The expression is a compile-time constant, and therefore can be diff --git a/include/ceres/loss_function.h b/include/ceres/loss_function.h index 81add02cd..c95a0a08c 100644 --- a/include/ceres/loss_function.h +++ b/include/ceres/loss_function.h @@ -249,7 +249,7 @@ class ScaledLoss : public LossFunction { internal::scoped_ptr rho_; const double a_; const Ownership ownership_; - DISALLOW_COPY_AND_ASSIGN(ScaledLoss); + CERES_DISALLOW_COPY_AND_ASSIGN(ScaledLoss); }; // Sometimes after the optimization problem has been constructed, we @@ -314,7 +314,7 @@ class LossFunctionWrapper : public LossFunction { private: internal::scoped_ptr rho_; Ownership ownership_; - DISALLOW_COPY_AND_ASSIGN(LossFunctionWrapper); + CERES_DISALLOW_COPY_AND_ASSIGN(LossFunctionWrapper); }; } // namespace ceres diff --git a/include/ceres/problem.h b/include/ceres/problem.h index 0ca61006b..9710e46cf 100644 --- a/include/ceres/problem.h +++ b/include/ceres/problem.h @@ -257,7 +257,7 @@ class Problem { private: friend class internal::SolverImpl; internal::scoped_ptr problem_impl_; - DISALLOW_COPY_AND_ASSIGN(Problem); + CERES_DISALLOW_COPY_AND_ASSIGN(Problem); }; } // namespace ceres diff --git a/internal/ceres/block_random_access_dense_matrix.h b/internal/ceres/block_random_access_dense_matrix.h index 3a0096209..9f27a4c30 100644 --- a/internal/ceres/block_random_access_dense_matrix.h +++ b/internal/ceres/block_random_access_dense_matrix.h @@ -89,7 +89,7 @@ class BlockRandomAccessDenseMatrix : public BlockRandomAccessMatrix { vector block_layout_; scoped_array values_; - DISALLOW_COPY_AND_ASSIGN(BlockRandomAccessDenseMatrix); + CERES_DISALLOW_COPY_AND_ASSIGN(BlockRandomAccessDenseMatrix); }; } // namespace internal diff --git a/internal/ceres/block_random_access_sparse_matrix.h b/internal/ceres/block_random_access_sparse_matrix.h index 12613c3da..27e30a753 100644 --- a/internal/ceres/block_random_access_sparse_matrix.h +++ b/internal/ceres/block_random_access_sparse_matrix.h @@ -100,7 +100,7 @@ class BlockRandomAccessSparseMatrix : public BlockRandomAccessMatrix { // The underlying matrix object which actually stores the cells. scoped_ptr tsm_; - DISALLOW_COPY_AND_ASSIGN(BlockRandomAccessSparseMatrix); + CERES_DISALLOW_COPY_AND_ASSIGN(BlockRandomAccessSparseMatrix); }; } // namespace internal diff --git a/internal/ceres/block_sparse_matrix.h b/internal/ceres/block_sparse_matrix.h index f71446e8f..f0be33567 100644 --- a/internal/ceres/block_sparse_matrix.h +++ b/internal/ceres/block_sparse_matrix.h @@ -74,7 +74,7 @@ class BlockSparseMatrixBase : public SparseMatrix { virtual const double* RowBlockValues(int row_block_index) const = 0; private: - DISALLOW_COPY_AND_ASSIGN(BlockSparseMatrixBase); + CERES_DISALLOW_COPY_AND_ASSIGN(BlockSparseMatrixBase); }; // This class implements the SparseMatrix interface for storing and @@ -135,7 +135,7 @@ class BlockSparseMatrix : public BlockSparseMatrixBase { int num_nonzeros_; scoped_array values_; scoped_ptr block_structure_; - DISALLOW_COPY_AND_ASSIGN(BlockSparseMatrix); + CERES_DISALLOW_COPY_AND_ASSIGN(BlockSparseMatrix); }; } // namespace internal diff --git a/internal/ceres/canonical_views_clustering.cc b/internal/ceres/canonical_views_clustering.cc index 53190ada6..5a320d75a 100644 --- a/internal/ceres/canonical_views_clustering.cc +++ b/internal/ceres/canonical_views_clustering.cc @@ -75,7 +75,7 @@ class CanonicalViewsClustering { IntMap view_to_canonical_view_; // Maps a view to its similarity to its current cluster center. HashMap view_to_canonical_view_similarity_; - DISALLOW_COPY_AND_ASSIGN(CanonicalViewsClustering); + CERES_DISALLOW_COPY_AND_ASSIGN(CanonicalViewsClustering); }; void ComputeCanonicalViewsClustering( diff --git a/internal/ceres/cgnr_solver.h b/internal/ceres/cgnr_solver.h index dd36f9900..877b4c4ce 100644 --- a/internal/ceres/cgnr_solver.h +++ b/internal/ceres/cgnr_solver.h @@ -57,7 +57,7 @@ class CgnrSolver : public LinearSolver { private: const LinearSolver::Options options_; scoped_ptr jacobi_preconditioner_; - DISALLOW_COPY_AND_ASSIGN(CgnrSolver); + CERES_DISALLOW_COPY_AND_ASSIGN(CgnrSolver); }; } // namespace internal diff --git a/internal/ceres/compressed_row_sparse_matrix.h b/internal/ceres/compressed_row_sparse_matrix.h index 9a39d28e1..c44f1db8d 100644 --- a/internal/ceres/compressed_row_sparse_matrix.h +++ b/internal/ceres/compressed_row_sparse_matrix.h @@ -120,7 +120,7 @@ class CompressedRowSparseMatrix : public SparseMatrix { int max_num_nonzeros_; - DISALLOW_COPY_AND_ASSIGN(CompressedRowSparseMatrix); + CERES_DISALLOW_COPY_AND_ASSIGN(CompressedRowSparseMatrix); }; } // namespace internal diff --git a/internal/ceres/conjugate_gradients_solver.h b/internal/ceres/conjugate_gradients_solver.h index 57f99e31d..b8dfa56b5 100644 --- a/internal/ceres/conjugate_gradients_solver.h +++ b/internal/ceres/conjugate_gradients_solver.h @@ -65,7 +65,7 @@ class ConjugateGradientsSolver : public LinearSolver { private: const LinearSolver::Options options_; - DISALLOW_COPY_AND_ASSIGN(ConjugateGradientsSolver); + CERES_DISALLOW_COPY_AND_ASSIGN(ConjugateGradientsSolver); }; } // namespace internal diff --git a/internal/ceres/dense_qr_solver.h b/internal/ceres/dense_qr_solver.h index 990c8d445..2e0b2837e 100644 --- a/internal/ceres/dense_qr_solver.h +++ b/internal/ceres/dense_qr_solver.h @@ -90,7 +90,7 @@ class DenseQRSolver: public DenseSparseMatrixSolver { double* x); const LinearSolver::Options options_; - DISALLOW_COPY_AND_ASSIGN(DenseQRSolver); + CERES_DISALLOW_COPY_AND_ASSIGN(DenseQRSolver); }; } // namespace internal diff --git a/internal/ceres/graph.h b/internal/ceres/graph.h index fd7a224f0..2c0f6d28e 100644 --- a/internal/ceres/graph.h +++ b/internal/ceres/graph.h @@ -129,7 +129,7 @@ class Graph { HashMap > edges_; HashMap, double> edge_weights_; - DISALLOW_COPY_AND_ASSIGN(Graph); + CERES_DISALLOW_COPY_AND_ASSIGN(Graph); }; } // namespace internal diff --git a/internal/ceres/problem_impl.h b/internal/ceres/problem_impl.h index 523860e65..2ca055448 100644 --- a/internal/ceres/problem_impl.h +++ b/internal/ceres/problem_impl.h @@ -118,7 +118,7 @@ class ProblemImpl { map parameter_block_map_; internal::scoped_ptr program_; - DISALLOW_COPY_AND_ASSIGN(ProblemImpl); + CERES_DISALLOW_COPY_AND_ASSIGN(ProblemImpl); }; } // namespace internal diff --git a/internal/ceres/schur_complement_solver.h b/internal/ceres/schur_complement_solver.h index b788ce091..0a25ce1fa 100644 --- a/internal/ceres/schur_complement_solver.h +++ b/internal/ceres/schur_complement_solver.h @@ -128,7 +128,7 @@ class SchurComplementSolver : public BlockSparseMatrixBaseSolver { scoped_ptr lhs_; scoped_array rhs_; - DISALLOW_COPY_AND_ASSIGN(SchurComplementSolver); + CERES_DISALLOW_COPY_AND_ASSIGN(SchurComplementSolver); }; // Dense Cholesky factorization based solver. @@ -142,7 +142,7 @@ class DenseSchurComplementSolver : public SchurComplementSolver { virtual void InitStorage(const CompressedRowBlockStructure* bs); virtual bool SolveReducedLinearSystem(double* solution); - DISALLOW_COPY_AND_ASSIGN(DenseSchurComplementSolver); + CERES_DISALLOW_COPY_AND_ASSIGN(DenseSchurComplementSolver); }; @@ -164,7 +164,7 @@ class SparseSchurComplementSolver : public SchurComplementSolver { // once and reused in subsequent calls. cholmod_factor* symbolic_factor_; #endif // CERES_NO_SUITESPARSE - DISALLOW_COPY_AND_ASSIGN(SparseSchurComplementSolver); + CERES_DISALLOW_COPY_AND_ASSIGN(SparseSchurComplementSolver); }; } // namespace internal diff --git a/internal/ceres/sparse_normal_cholesky_solver.h b/internal/ceres/sparse_normal_cholesky_solver.h index 5445559e6..e38f39b7f 100644 --- a/internal/ceres/sparse_normal_cholesky_solver.h +++ b/internal/ceres/sparse_normal_cholesky_solver.h @@ -82,7 +82,7 @@ class SparseNormalCholeskySolver : public CompressedRowSparseMatrixSolver { const LinearSolver::Options options_; - DISALLOW_COPY_AND_ASSIGN(SparseNormalCholeskySolver); + CERES_DISALLOW_COPY_AND_ASSIGN(SparseNormalCholeskySolver); }; } // namespace internal diff --git a/internal/ceres/visibility_based_preconditioner.h b/internal/ceres/visibility_based_preconditioner.h index c265a0e32..888c65eba 100644 --- a/internal/ceres/visibility_based_preconditioner.h +++ b/internal/ceres/visibility_based_preconditioner.h @@ -244,7 +244,7 @@ class VisibilityBasedPreconditioner : public LinearOperator { // Temporary vector used by RightMultiply. cholmod_dense* tmp_rhs_; - DISALLOW_COPY_AND_ASSIGN(VisibilityBasedPreconditioner); + CERES_DISALLOW_COPY_AND_ASSIGN(VisibilityBasedPreconditioner); }; #else // SuiteSparse // If SuiteSparse is not compiled in, the preconditioner is not