FLImaging 7.8.25.3
FLArray.h
1#pragma once
2
10
11#include "FLBase.h"
12
13#include <vector>
14
16namespace FLImaging
17{
19 namespace Base
20 {
69 template <typename T>
70 class FL_EXPORT CFLArray : public Base::CFLBase
71 {
72 SupportToDuplicateObject(CFLArray<T>,*this);
73 public:
82
92 CFLArray(const CFLArray<T>& flArray);
93
103 CFLArray(const CFLArray<T>* pFlArray);
104
116 CFLArray(int64_t i64Count, const T& tValue);
117
129 CFLArray(const T* pArrData, int64_t i64Count);
130
131
139 virtual ~CFLArray();
140
148 virtual void Clear();
149
159 virtual bool IsEmpty() const;
160
170 virtual int64_t GetCount() const;
171
183 virtual T& GetAt(int64_t i64Index) const;
184
196 virtual void SetAt(int64_t i64Index, const T& tValue);
197
207 virtual T& Front() const;
208
218 virtual T& Back() const;
219
229 virtual T* GetBuffer() const;
230
242 virtual T* PushBack(const CFLArray<T>& flArray);
243
257 virtual T* PushBack(const T* pArrData, int64_t i64Count);
258
270 virtual T* PushBack(const T& tValue);
271
283 virtual T* PushFront(const CFLArray<T>& flArray);
284
298 virtual T* PushFront(const T* pArrData, int64_t i64Count);
299
311 virtual T* PushFront(const T& tValue);
312
320 virtual void PopBack();
321
329 virtual void PopFront();
330
342 virtual T* Append(const CFLArray<T>& flArray);
343
357 virtual T* Append(const T* pArrData, int64_t i64Count);
358
370 virtual T* Append(const T& tValue);
371
385 virtual T* InsertAt(int64_t i64Index, const CFLArray<T>& flArray);
386
402 virtual T* InsertAt(int64_t i64Index, const T* pArrData, int64_t i64Count);
403
417 virtual T* InsertAt(int64_t i64Index, const T& tValue);
418
428 virtual void RemoveAt(int64_t i64Index);
429
439 virtual void Reserve(int64_t i64Size);
440
452 virtual T* Resize(int64_t i64Size);
453
461 virtual void ShrinkToFit();
462
478 virtual void Reverse(int64_t i64BeginIndex = 0, int64_t i64EndIndex = -1);
479
497 void Sort(int64_t i64BeginIndex, int64_t i64EndIndex, bool(*pFnComparator)(const T&, const T&));
498
510 virtual const CFLArray<T>& Assign(const CFLArray<T>& flArray);
511
523 virtual const CFLArray<T>& Assign(const CFLArray<T>* pFlArray);
524
536 const CFLArray<T>& Assign(const T& tValue);
537
551 const CFLArray<T>& Assign(int64_t i64Count, const T& tValue);
552
566 const CFLArray<T>& Assign(const T* pArrData, int64_t i64Count);
567
577 void Swap(CFLArray<T>& flaArray);
578
588 void Swap(CFLArray<T>* pFlaArray);
589
601 const CFLArray<T>& operator=(const CFLArray<T>& flArray);
602
614 const CFLArray<T>& operator=(const T& tValue);
615
627 T& operator[](int32_t i32Index) const;
628
640 T& operator[](int64_t i64Index) const;
641
653 T& operator[](uint32_t u32Index) const;
654
666 T& operator[](uint64_t u64Index) const;
667
679 const CFLArray<T>& operator+=(const CFLArray<T>& flArray);
680
692 const CFLArray<T>& operator+=(const T& tValue);
693
707 friend CFLArray<T> operator+(const CFLArray<T>& flArray1, const CFLArray<T>& flArray2)
708 {
709 CFLArray<T> flArray(flArray1);
710 flArray.Append(flArray2);
711 return flArray;
712 }
713
727 friend CFLArray<T> operator+(const CFLArray<T>& flArray1, const T& tValue2)
728 {
729 CFLArray<T> flArray(flArray1);
730 flArray.Append(tValue2);
731 return flArray;
732 }
733
747 friend CFLArray<T> operator+(const T& tValue1, const CFLArray<T>& flArray2)
748 {
749 CFLArray<T> flArray(1, tValue1);
750 flArray.Append(flArray2);
751 return flArray;
752 }
753
754 DeclareGetClassType();
755
756 protected:
757
758 const T* m_pTData;
759 size_t m_stCount;
760
761 std::vector<T>& m_vctArray;
762 DeclareFLArrayContainerObject;
763 };
764
765 typedef CFLArray<int32_t> CFLArrayL;
766 typedef CFLArray<uint32_t> CFLArrayUL;
767 typedef CFLArray<int64_t> CFLArrayLL;
768 typedef CFLArray<uint64_t> CFLArrayULL;
769 typedef CFLArray<float> CFLArrayF;
770 typedef CFLArray<double> CFLArrayD;
771 }
772}
773
T & operator[](int64_t i64Index) const
Subscript Operator.
virtual void RemoveAt(int64_t i64Index)
Remove the element at that index.
CFLArray(const CFLArray< T > *pFlArray)
Copy constructor by pointer.
virtual T * Append(const T &tValue)
Add element at the end.
CFLArray(int64_t i64Count, const T &tValue)
Constructor.
virtual void ShrinkToFit()
Clean up unnecessary memory in array.
virtual T * Append(const CFLArray< T > &flArray)
Add elements at the end.
T & operator[](uint32_t u32Index) const
Subscript Operator.
virtual T * PushFront(const T &tValue)
Insert element at the front.
virtual T * PushFront(const CFLArray< T > &flArray)
Insert elements at the front.
virtual T * PushFront(const T *pArrData, int64_t i64Count)
Insert elements at the front.
virtual T * InsertAt(int64_t i64Index, const CFLArray< T > &flArray)
Insert elements at that index.
void Swap(CFLArray< T > *pFlaArray)
Swaps the contents of the array.
T & operator[](int32_t i32Index) const
Subscript Operator.
virtual T & Front() const
Get the front value.
virtual int64_t GetCount() const
Count of elements.
virtual bool IsEmpty() const
Check if element is empty.
virtual void PopBack()
Remove the back element.
void Swap(CFLArray< T > &flaArray)
Swaps the contents of the array.
virtual void Reserve(int64_t i64Size)
Array memory is pre-allocated.
const CFLArray< T > & Assign(const T &tValue)
Assigns one scalar value.
virtual T * PushBack(const CFLArray< T > &flArray)
Insert elements at the back.
virtual T * PushBack(const T &tValue)
Insert element at the back.
virtual ~CFLArray()
Destructor.
virtual T * PushBack(const T *pArrData, int64_t i64Count)
Insert elements at the back.
virtual T * InsertAt(int64_t i64Index, const T &tValue)
Insert an element at that index.
virtual T * GetBuffer() const
Get pointer to data.
virtual void Reverse(int64_t i64BeginIndex=0, int64_t i64EndIndex=-1)
Reverses the data within the range from the specified start index to the end index....
CFLArray(const CFLArray< T > &flArray)
Copy constructor by reference.
virtual const CFLArray< T > & Assign(const CFLArray< T > *pFlArray)
Allocate an object.
const CFLArray< T > & operator+=(const T &tValue)
Addition assignment operator.
friend CFLArray< T > operator+(const CFLArray< T > &flArray1, const T &tValue2)
Addition operator.
Definition FLArray.h:727
virtual T * Append(const T *pArrData, int64_t i64Count)
Add element at the end.
CFLArray()
Default constructor.
virtual T & Back() const
Get the back value.
virtual T * InsertAt(int64_t i64Index, const T *pArrData, int64_t i64Count)
Insert elements at that index.
virtual const CFLArray< T > & Assign(const CFLArray< T > &flArray)
Allocate an object.
virtual void Clear()
Clear all elements.
const CFLArray< T > & Assign(int64_t i64Count, const T &tValue)
Assigns scalar values filled with counts.
const CFLArray< T > & operator=(const CFLArray< T > &flArray)
Assignment operator.
virtual void SetAt(int64_t i64Index, const T &tValue)
Set the value at that index.
friend CFLArray< T > operator+(const CFLArray< T > &flArray1, const CFLArray< T > &flArray2)
Addition operator.
Definition FLArray.h:707
const CFLArray< T > & operator=(const T &tValue)
Assignment operator.
virtual T * Resize(int64_t i64Size)
Resizing an array.
virtual T & GetAt(int64_t i64Index) const
Get the value at that index.
friend CFLArray< T > operator+(const T &tValue1, const CFLArray< T > &flArray2)
Addition operator.
Definition FLArray.h:747
virtual void PopFront()
Remove the front element.
const CFLArray< T > & operator+=(const CFLArray< T > &flArray)
Addition assignment operator.
T & operator[](uint64_t u64Index) const
Subscript Operator.
const CFLArray< T > & Assign(const T *pArrData, int64_t i64Count)
Constructor. Allocate the number of data in memory.
CFLArray(const T *pArrData, int64_t i64Count)
Constructor. Allocate the number of data in memory.
void Sort(int64_t i64BeginIndex, int64_t i64EndIndex, bool(*pFnComparator)(const T &, const T &))
Sorts the data within the specified range from the start index to the end index. Specifying -1 refers...
Top-level base class of FLImaging.
Definition FLBase.h:36
Definition AESCryptography.h:18