MCPcopy Create free account
hub / github.com/BoevaLab/FREEC / template_2d_array

Class template_2d_array

src/ap.h:411–602  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

409********************************************************************/
410template<class T, bool Aligned = false>
411class template_2d_array
412{
413public:
414 template_2d_array()
415 {
416 m_Vec=0;
417 m_iVecSize=0;
418 m_iLow1 = 0;
419 m_iHigh1 = -1;
420 m_iLow2 = 0;
421 m_iHigh2 = -1;
422 };
423
424 ~template_2d_array()
425 {
426 if(m_Vec)
427 {
428 if( Aligned )
429 ap::afree(m_Vec);
430 else
431 delete[] m_Vec;
432 }
433 };
434
435 template_2d_array(const template_2d_array &rhs)
436 {
437 m_Vec=0;
438 m_iVecSize=0;
439 m_iLow1 = 0;
440 m_iHigh1 = -1;
441 m_iLow2 = 0;
442 m_iHigh2 = -1;
443 if( rhs.m_iVecSize!=0 )
444 {
445 setbounds(rhs.m_iLow1, rhs.m_iHigh1, rhs.m_iLow2, rhs.m_iHigh2);
446 for(int i=m_iLow1; i<=m_iHigh1; i++)
447 for(int j=m_iLow2; j<=m_iHigh2; j++)
448 operator()(i,j) = rhs(i,j);
449 //vmove(&(operator()(i,m_iLow2)), &(rhs(i,m_iLow2)), m_iHigh2-m_iLow2+1);
450 }
451 };
452 const template_2d_array& operator=(const template_2d_array &rhs)
453 {
454 if( this==&rhs )
455 return *this;
456
457 if( rhs.m_iVecSize!=0 )
458 {
459 setbounds(rhs.m_iLow1, rhs.m_iHigh1, rhs.m_iLow2, rhs.m_iHigh2);
460 for(int i=m_iLow1; i<=m_iHigh1; i++)
461 for(int j=m_iLow2; j<=m_iHigh2; j++)
462 operator()(i,j) = rhs(i,j);
463 //vmove(&(operator()(i,m_iLow2)), &(rhs(i,m_iLow2)), m_iHigh2-m_iLow2+1);
464 }
465 else
466 {
467 if(m_Vec)
468 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected