59 typedef typename UniqueArray<DataType>::ConstReferenceType ConstReferenceType;
76 : m_buffer(do_clone ? rhs.m_buffer.clone() : rhs.m_buffer),
77 m_indexes(do_clone ? rhs.m_indexes.clone() : rhs.m_indexes),
78 m_sizes(do_clone ? rhs.m_sizes.clone() : rhs.m_sizes)
82 : m_buffer(aview.m_buffer), m_indexes(aview.m_indexes), m_sizes(aview.m_sizes)
86 ArrayView<DataType> operator[](Integer i)
88 return ArrayView<DataType>(m_sizes[i],m_buffer.data() + (m_indexes[i]));
90 ConstArrayView<DataType> operator[](Integer i)
const
92 return ConstArrayView<DataType>(m_sizes[i],m_buffer.data()+ (m_indexes[i]));
108 new_array.m_buffer = m_buffer.
clone();
109 new_array.m_indexes = m_indexes.
clone();
110 new_array.m_sizes = m_sizes.
clone();
118 DataType& at(Integer i,Integer j)
120 return m_buffer[m_indexes[i]+j];
122 void setAt(Integer i,Integer j,ConstReferenceType v)
124 return m_buffer.setAt(m_indexes[i]+j,v);
128 Integer
dim1Size()
const {
return m_indexes.size(); }
160 return m_buffer.view();
166 return m_buffer.constView();
172 if (new_sizes.
size()==0){
184 void _resize(IntegerConstArrayView ar)
186 Integer size1 = ar.size();
188 Integer total_size = 0;
189 for( Integer i=0; i<size1; ++i )
194 if (total_size==totalNbElement() && size1==m_indexes.size()){
196 for( Integer i=0; i<size1; ++i )
197 if (m_sizes[i]!=ar[i]){
208 Integer old_size1 = m_indexes.size();
210 SharedArray<DataType> new_buffer(total_size);
216 for( Integer i=0; i<old_size1; ++i ){
218 Integer old_size2 = m_sizes[i];
221 ConstArrayView<DataType> cav(_value(i));
222 for( Integer j=0; j<old_size2; ++j )
223 new_buffer[index+j] = cav[j];
226 m_buffer = new_buffer;
228 m_indexes.resize(size1);
229 m_sizes.resize(size1);
230 for( Integer i2=0, index2=0; i2<size1; ++i2 ){
232 m_indexes[i2] = index2;
240 void _copy(
const MultiArray2<DataType>& rhs,
bool do_clone)
242 m_buffer = do_clone ? rhs.m_buffer.clone() : rhs.m_buffer;
243 m_indexes = do_clone ? rhs.m_indexes.clone() : rhs.m_indexes;
244 m_sizes = do_clone ? rhs.m_sizes.clone() : rhs.m_sizes;
246 void _copy(ConstMultiArray2View<DataType> aview)
248 m_buffer = aview.m_buffer;
249 m_indexes = aview.m_indexes;
250 m_sizes = aview.m_sizes;
255 SharedArray<DataType> m_buffer;
257 SharedArray<Integer> m_indexes;
259 SharedArray<Integer> m_sizes;