acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
aaa_raw_array_impl.h
1#pragma once
2
3//
4// see collection_raw_array_decl.h for declaration
5//
6// raw_array is an array that does not call constructors or destructor in elements
7// array is an array that call only copy constructor and destructor in elements
8// array is an array that call default constructors, copy constructs and destructors in elements
9
10//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
11//inline ::collection::count raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::get_size() const
12//{
13// return m_nSize;
14//}
15//
16//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
17//inline ::collection::count raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::get_size_in_bytes() const
18//{
19// return m_nSize * sizeof(TYPE);
20//}
21//
22//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
23//inline ::collection::count raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::get_count() const
24//{
25// return this->get_size();
26//}
27//
28//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
29//inline ::collection::count raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::get_byte_count() const
30//{
31// return this->get_size_in_bytes();
32//}
33//
34//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
35//inline ::collection::count raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::size() const
36//{
37// return this->get_size();
38//}
39//
40//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
41//inline ::collection::count raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::collection::count() const
42//{
43// return this->get_count();
44//}
45//
46//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
47//inline bool raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::is_empty(::collection::count countMinimum) const
48//{
49// return m_nSize < countMinimum;
50//}
51//
52//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
53//inline bool raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::empty(::collection::count countMinimum) const
54//{
55// return m_nSize < countMinimum;
56//}
57//
58//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
59//inline bool raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::has_elements(::collection::count countMinimum) const
60//{
61// return m_nSize >= countMinimum;
62//}
63//
64//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
65//inline ::collection::index raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::get_upper_bound(::collection::index i) const
66//{
67// return m_nSize + ::collection::index;
68//}
69//
70//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
71//inline ::collection::count raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::erase_all()
72//{
73// return this->allocate(0, -1);
74//}
75//
76//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
77//void raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::
78//clear()
79//{
80// erase_all();
81//}
82//
83//
84//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
85//inline void raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::erase_last()
86//{
87//
88// this->erase_at(this->get_upper_bound());
89//
90//}
91//
92//
93//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
94//inline TYPE& raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::get_at(::collection::index nIndex)
95//{
96//
97// return get_data()[nIndex];
98//}
99//
100//
101//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
102//inline const TYPE& raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::get_at(::collection::index nIndex) const
103//{
104//
105// return get_data()[nIndex];
106//
107//}
108//
109//
110//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
111//inline void raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::set_at(::collection::index nIndex, ARG_TYPE newElement)
112//{
113//
114// get_data()[nIndex] = newElement;
115//
116//}
117//
118//
119//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
120//inline const TYPE* raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::get_data() const
121//{
122//
123// return (const TYPE*)this->m_pData;
124//
125//}
126//
127//
128//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
129//inline TYPE* raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::get_data()
130//{
131//
132// return (TYPE*)this->m_pData;
133//
134//}
135//
136//
137//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
138//inline ::collection::index raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::add_item(ARG_TYPE newElement)
139//{
140//
141// ::collection::index nIndex = this->m_nSize;
142//
143// this->set_at_grow(nIndex, newElement);
144//
145// return nIndex;
146//
147//}
148//
149//
150//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
151//inline ::collection::index raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::add(const raw_array & src)
152//{
153//
154// return this->append(src);
155//
156//}
157//
158//
159//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
160//inline ::collection::index raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::add_new(::collection::count count)
161//{
162//
163// this->allocate(this->size() + count);
164//
165// return this->get_upper_bound();
166//
167//}
168//
169//
170//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
171//inline TYPE & raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::add_new()
172//{
173//
174// this->allocate(this->size() + 1);
175//
176// return this->last();
177//
178//}
179//
180//
181//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
182//inline TYPE raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::pop(::collection::index n)
183//{
184//
185// ::collection::index i = this->get_upper_bound(n);
186//
187// TYPE t = this->element_at(i);
188//
189// this->erase_at(i);
190//
191// return t;
192//
193//}
194//
195//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
196//inline void raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::pop_back(::collection::index n)
197//{
198//
199// this->erase_at(this->get_upper_bound(n));
200//
201//}
202//
203//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
204//inline ::collection::index raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::push(ARG_TYPE newElement, ::collection::index n)
205//{
206// return insert_at(this->get_upper_bound(n), newElement);
207//}
208//
209//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
210//inline void raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::push_back(ARG_TYPE newElement, ::collection::index n)
211//{
212// insert_at(this->get_upper_bound(n), newElement);
213//}
214//
215//
232//
233//
234//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
235//inline void raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::__swap(::collection::index index1, ::collection::index index2)
236//{
237// TYPE t = get_data()[index1];
238// get_data()[index1] = get_data()[index2];
239// get_data()[index2] = t;
240//}
241//
242//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
243//inline raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > & raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::operator = (const raw_array & src)
244//{
245// if(&src != this)
246// {
247// this->copy(src);
248// }
249// return *this;
250//}
251//
252//
253//
255//
256//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
257//raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::raw_array(::particle * pparticle)
258// //:
259// //::matter(pparticle)
260//{
261//
262//}
263//
264//
265//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
266//inline raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::raw_array(::std::initializer_list < TYPE > l)
267//{
268// forallref(l)
269// {
270// add((ARG_TYPE) item);
271// }
272//}
273//
274//
275//
276//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
277//raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::raw_array(const raw_array <TYPE, ARG_TYPE, ALLOCATOR> & array):
278// ARRAY_BASE(array)
279//{
280//
281//}
282//
283//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
284//raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::raw_array(raw_array <TYPE,ARG_TYPE,ALLOCATOR> && a) noexcept :
285// ARRAY_BASE(::transfer(a))
286//{
287//
288//}
289//
290//
291//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
292//raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >:: raw_array(::collection::count n)
293//{
294// this->allocate(n);
295//}
296//
297//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
298//raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::raw_array(ARG_TYPE t, ::collection::count n)
299//{
300// insert_at(0, t, n);
301//}
302//
303//
304//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
305//raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::raw_array(TYPE * ptypea, ::collection::count n)
306//{
307//
308// this->allocate(n);
309//
310// for(::i32 i = 0; i < n; i++)
311// {
312//
313// this->element_at(i) = ptypea[i];
314//
315// }
316//
317//}
318//
319//
320//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
321//raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::~raw_array()
322//{
323//
324// this->destroy();
325//
326//}
327//
342//
343//
370//
484//
512//
526//
527//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
528//inline TYPE raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::get_at_grow(::collection::index nIndex)
529//{
530//
531// return this->element_at_grow(nIndex);
532//
533//}
534//
535//
543//
544//
545//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
546//::collection::index raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::insert_at(::collection::index nIndex, ARG_TYPE newElement, ::collection::count nCount /*=1*/)
547//{
548//
549// return base_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::insert_at(nIndex, newElement,nCount);
550//
551//}
552//
553//
575//
576//
597//
598//
624//
625//
639//
663//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
664//::collection::index raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::raw_find_first(TYPE *p, ::collection::index find, ::collection::index last) const
665//{
666//
667// if(find < 0)
668// find += this->get_count();
669//
670// if(last < 0)
671// last += this->get_count();
672//
673// for(; find <= last; find++)
674// {
675//
676// if (&this->element_at(find) == p)
677// {
678//
679// return find;
680//
681// }
682//
683// }
684//
685// return -1;
686//
687//}
688//
689//
690//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
691//::collection::index raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::find_first(ARG_TYPE t, ::collection::index ( * pfnCompare )(ARG_TYPE, ARG_TYPE), ::collection::index find, ::collection::index last) const
692//
693//{
694// if(find < 0)
695// find += this->get_count();
696// if(last < 0)
697// last += this->get_count();
698// for(; find <= last; find++)
699// {
700// if(pfnCompare((ARG_TYPE)this->element_at(find), (ARG_TYPE)t) == 0)
701//
702// return find;
703// }
704// return -1;
705//}
706//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
707//raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > & raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::operator += (const raw_array & a)
708//{
709//
710// if(&a == this)
711// {
712// raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > aCopy(a);
713// add(aCopy);
714// }
715// else
716// {
717// add(a);
718// }
719// return *this;
720//
721//}
722//
723//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
724//raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::operator + (const raw_array & a) const
725//{
726// raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > aNew(*this);
727// aNew += a;
728// return a;
729//}
730//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
731//inline raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > & raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::operator =(raw_array && a)
732//{
733//
734// return transfer(::transfer(a));
735//
736//}
737//
738//template < typename TYPE, typename ARG_TYPE, typename ALLOCATOR, ::enum_type t_etypeContainer >
739//inline raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer > & raw_array < TYPE, ARG_TYPE, TYPED, MEMORY, t_etypeContainer >::transfer(raw_array && a)
740//{
741//
742// if (&a != this)
743// {
744// this->destroy();
745//
746// this->m_nGrowBy = a.m_nGrowBy;
747// this->m_pData = a.m_pData;
748// this->m_nSize = a.m_nSize;
749// this->m_nMaxSize = a.m_nMaxSize;
750//
751// a.m_pData = nullptr;
752// a.m_nSize = 0;
753// a.m_nMaxSize = 0;
754//
755// }
756//
757// return *this;
758//
759//}
760//