MCPcopy Create free account
hub / github.com/ImageEngine/cortex / asList

Method asList

src/IECore/BinaryFrameList.cpp:57–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57void BinaryFrameList::asList( std::vector<Frame> &frames ) const
58{
59 frames.clear();
60
61 std::vector<Frame> l;
62 m_frameList->asList( l );
63
64 if ( l.size() <= 2 )
65 {
66 return;
67 }
68#ifndef NDEBUG
69 size_t oldSize = l.size();
70#endif
71
72 frames.push_back( *l.begin() );
73 l.erase( l.begin() );
74 frames.push_back( *l.rbegin() );
75 l.pop_back();
76
77 assert( l.size() + 2 == oldSize );
78 assert( frames.size() == 2 );
79
80 std::list< std::vector< Frame > > toVisit;
81 toVisit.push_back( l );
82 while ( toVisit.size() )
83 {
84 std::vector< Frame > n = *toVisit.begin();
85 toVisit.pop_front();
86
87 if ( n.size() > 1 )
88 {
89 size_t mid = ( n.size() - 1 ) / 2;
90
91 std::vector< Frame >::iterator midIt = n.begin();
92 size_t i = 0;
93 while ( i++ != mid )
94 {
95 ++ midIt;
96 }
97
98 frames.push_back( *midIt );
99
100 std::vector< Frame > head( n.begin(), midIt );
101 std::vector< Frame > tail( midIt+1, n.end() );
102
103 toVisit.push_back( head );
104 toVisit.push_back( tail );
105
106 }
107 else if ( n.size() )
108 {
109 frames.push_back( *n.begin() );
110 }
111 }
112
113#ifndef NDEBUG
114 std::vector<Frame> origList;

Callers 2

testMethod · 0.95
testPreservationMethod · 0.95

Calls 5

clearMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
eraseMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected