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

Class template_1d_array

src/ap.h:257–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

255********************************************************************/
256template<class T, bool Aligned = false>
257class template_1d_array
258{
259public:
260 template_1d_array()
261 {
262 m_Vec=0;
263 m_iVecSize = 0;
264 m_iLow = 0;
265 m_iHigh = -1;
266 };
267
268 ~template_1d_array()
269 {
270 if(m_Vec)
271 {
272 if( Aligned )
273 ap::afree(m_Vec);
274 else
275 delete[] m_Vec;
276 }
277 };
278
279 template_1d_array(const template_1d_array &rhs)
280 {
281 m_Vec=0;
282 m_iVecSize = 0;
283 m_iLow = 0;
284 m_iHigh = -1;
285 if( rhs.m_iVecSize!=0 )
286 setcontent(rhs.m_iLow, rhs.m_iHigh, rhs.getcontent());
287 };
288
289
290 const template_1d_array& operator=(const template_1d_array &rhs)
291 {
292 if( this==&rhs )
293 return *this;
294
295 if( rhs.m_iVecSize!=0 )
296 setcontent(rhs.m_iLow, rhs.m_iHigh, rhs.getcontent());
297 else
298 {
299 m_Vec=0;
300 m_iVecSize = 0;
301 m_iLow = 0;
302 m_iHigh = -1;
303 }
304 return *this;
305 };
306
307
308 const T& operator()(int i) const
309 {
310 #ifndef NO_AP_ASSERT
311 ap_error::make_assertion(i>=m_iLow && i<=m_iHigh);
312 #endif
313 return m_Vec[ i-m_iLow ];
314 };

Callers

nothing calls this directly

Calls 1

getcontentMethod · 0.80

Tested by

no test coverage detected