Boring changes - core.
This and several following commits contain the "boring" changes required to support the new Ptr. These are changes like: * new T -> makePtr<T> or .reset(new T) or Ptr<T>(new T) (depending on the situation) * p.empty() -> !p * delete_obj -> DefaultDeleter::operator() and similar changes that are numerous, but primitive.
This commit is contained in:
@@ -358,8 +358,6 @@ Core_DynStructBaseTest::Core_DynStructBaseTest()
|
||||
iterations = max_struct_size*2;
|
||||
gen = struct_idx = iter = -1;
|
||||
test_progress = -1;
|
||||
|
||||
storage = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -999,7 +997,7 @@ void Core_SeqBaseTest::run( int )
|
||||
{
|
||||
t = cvtest::randReal(rng)*(max_log_storage_block_size - min_log_storage_block_size)
|
||||
+ min_log_storage_block_size;
|
||||
storage = cvCreateMemStorage( cvRound( exp(t * CV_LOG2) ) );
|
||||
storage.reset(cvCreateMemStorage( cvRound( exp(t * CV_LOG2) ) ));
|
||||
}
|
||||
|
||||
iter = struct_idx = -1;
|
||||
@@ -1083,11 +1081,11 @@ void Core_SeqSortInvTest::run( int )
|
||||
{
|
||||
struct_idx = iter = -1;
|
||||
|
||||
if( storage.empty() )
|
||||
if( !storage )
|
||||
{
|
||||
t = cvtest::randReal(rng)*(max_log_storage_block_size - min_log_storage_block_size)
|
||||
+ min_log_storage_block_size;
|
||||
storage = cvCreateMemStorage( cvRound( exp(t * CV_LOG2) ) );
|
||||
storage.reset(cvCreateMemStorage( cvRound( exp(t * CV_LOG2) ) ));
|
||||
}
|
||||
|
||||
for( iter = 0; iter < iterations/10; iter++ )
|
||||
@@ -1384,7 +1382,7 @@ void Core_SetTest::run( int )
|
||||
{
|
||||
struct_idx = iter = -1;
|
||||
t = cvtest::randReal(rng)*(max_log_storage_block_size - min_log_storage_block_size) + min_log_storage_block_size;
|
||||
storage = cvCreateMemStorage( cvRound( exp(t * CV_LOG2) ) );
|
||||
storage.reset(cvCreateMemStorage( cvRound( exp(t * CV_LOG2) ) ));
|
||||
|
||||
for( int i = 0; i < struct_count; i++ )
|
||||
{
|
||||
@@ -1398,7 +1396,7 @@ void Core_SetTest::run( int )
|
||||
|
||||
cvTsReleaseSimpleSet( (CvTsSimpleSet**)&simple_struct[i] );
|
||||
simple_struct[i] = cvTsCreateSimpleSet( max_struct_size, pure_elem_size );
|
||||
cxcore_struct[i] = cvCreateSet( 0, sizeof(CvSet), elem_size, storage );
|
||||
cxcore_struct[i] = cvCreateSet( 0, sizeof(CvSet), elem_size, storage );
|
||||
}
|
||||
|
||||
if( test_set_ops( iterations*100 ) < 0 )
|
||||
@@ -1811,7 +1809,7 @@ void Core_GraphTest::run( int )
|
||||
int block_size = cvRound( exp(t * CV_LOG2) );
|
||||
block_size = MAX(block_size, (int)(sizeof(CvGraph) + sizeof(CvMemBlock) + sizeof(CvSeqBlock)));
|
||||
|
||||
storage = cvCreateMemStorage(block_size);
|
||||
storage.reset(cvCreateMemStorage(block_size));
|
||||
|
||||
for( i = 0; i < struct_count; i++ )
|
||||
{
|
||||
@@ -1929,7 +1927,7 @@ void Core_GraphScanTest::run( int )
|
||||
storage_blocksize = MAX(storage_blocksize, (int)(sizeof(CvGraph) + sizeof(CvMemBlock) + sizeof(CvSeqBlock)));
|
||||
storage_blocksize = MAX(storage_blocksize, (int)(sizeof(CvGraphEdge) + sizeof(CvMemBlock) + sizeof(CvSeqBlock)));
|
||||
storage_blocksize = MAX(storage_blocksize, (int)(sizeof(CvGraphVtx) + sizeof(CvMemBlock) + sizeof(CvSeqBlock)));
|
||||
storage = cvCreateMemStorage(storage_blocksize);
|
||||
storage.reset(cvCreateMemStorage(storage_blocksize));
|
||||
|
||||
if( gen == 0 )
|
||||
{
|
||||
|
@@ -270,16 +270,16 @@ protected:
|
||||
|
||||
cvRelease((void**)&m_nd);
|
||||
|
||||
Ptr<CvSparseMat> m_s = (CvSparseMat*)fs["test_sparse_mat"].readObj();
|
||||
Ptr<CvSparseMat> _test_sparse_ = cvCreateSparseMat(test_sparse_mat);
|
||||
Ptr<CvSparseMat> _test_sparse = (CvSparseMat*)cvClone(_test_sparse_);
|
||||
Ptr<CvSparseMat> m_s((CvSparseMat*)fs["test_sparse_mat"].readObj());
|
||||
Ptr<CvSparseMat> _test_sparse_(cvCreateSparseMat(test_sparse_mat));
|
||||
Ptr<CvSparseMat> _test_sparse((CvSparseMat*)cvClone(_test_sparse_));
|
||||
SparseMat m_s2;
|
||||
fs["test_sparse_mat"] >> m_s2;
|
||||
Ptr<CvSparseMat> _m_s2 = cvCreateSparseMat(m_s2);
|
||||
Ptr<CvSparseMat> _m_s2(cvCreateSparseMat(m_s2));
|
||||
|
||||
if( !m_s || !CV_IS_SPARSE_MAT(m_s) ||
|
||||
!cvTsCheckSparse(m_s, _test_sparse,0) ||
|
||||
!cvTsCheckSparse(_m_s2, _test_sparse,0))
|
||||
!cvTsCheckSparse(m_s, _test_sparse, 0) ||
|
||||
!cvTsCheckSparse(_m_s2, _test_sparse, 0))
|
||||
{
|
||||
ts->printf( cvtest::TS::LOG, "the read sparse matrix is not correct\n" );
|
||||
ts->set_failed_test_info( cvtest::TS::FAIL_INVALID_OUTPUT );
|
||||
|
@@ -669,7 +669,7 @@ void Core_ArrayOpTest::run( int /* start_from */)
|
||||
cvSetReal3D(&matA, idx1[0], idx1[1], idx1[2], -val0);
|
||||
cvSetND(&matB, idx0, val1);
|
||||
cvSet3D(&matB, idx1[0], idx1[1], idx1[2], -val1);
|
||||
Ptr<CvMatND> matC = cvCloneMatND(&matB);
|
||||
Ptr<CvMatND> matC(cvCloneMatND(&matB));
|
||||
|
||||
if( A.at<float>(idx0[0], idx0[1], idx0[2]) != val0 ||
|
||||
A.at<float>(idx1[0], idx1[1], idx1[2]) != -val0 ||
|
||||
@@ -762,7 +762,7 @@ void Core_ArrayOpTest::run( int /* start_from */)
|
||||
}
|
||||
}
|
||||
|
||||
Ptr<CvSparseMat> M2 = cvCreateSparseMat(M);
|
||||
Ptr<CvSparseMat> M2(cvCreateSparseMat(M));
|
||||
MatND Md;
|
||||
M.copyTo(Md);
|
||||
SparseMat M3; SparseMat(Md).convertTo(M3, Md.type(), 2);
|
||||
|
Reference in New Issue
Block a user