Removed uLib::Vector

This commit is contained in:
Paolo Andreetto
2019-07-31 09:16:53 +00:00
parent 52d574e317
commit 38c61a4e9b
20 changed files with 79 additions and 81 deletions

View File

@@ -2,7 +2,6 @@
set(HEADERS set(HEADERS
Archives.h Archives.h
Array.h Array.h
Collection.h
Debug.h Debug.h
Export.h Export.h
Function.h Function.h
@@ -19,8 +18,6 @@ set(HEADERS
StringReader.h StringReader.h
Types.h Types.h
Uuid.h Uuid.h
Vector.h
CommaInitializer.h
Timer.h Timer.h
) )

View File

@@ -29,12 +29,11 @@
#define U_CORE_DEBUG_H #define U_CORE_DEBUG_H
#include <vector>
//#include "ltk/ltkdebug.h"
#include "Macros.h" #include "Macros.h"
#include "Types.h" #include "Types.h"
#include "Mpl.h" #include "Mpl.h"
#include "Vector.h" #include "SmartPointer.h"
#include <boost/any.hpp> #include <boost/any.hpp>
#include <TObject.h> #include <TObject.h>
@@ -128,8 +127,8 @@ public:
} }
private: private:
Vector<DItem> m_v; std::vector<DItem> m_v;
Vector<Adapter> m_a; std::vector<Adapter> m_a;
}; };

View File

@@ -31,7 +31,6 @@
#include <istream> #include <istream>
#include <algorithm> #include <algorithm>
#include "Core/Vector.h"
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>

View File

@@ -29,6 +29,7 @@
#define U_CORE_UUID_H #define U_CORE_UUID_H
#include <iostream> #include <iostream>
#include <vector>
#include <boost/uuid/uuid.hpp> #include <boost/uuid/uuid.hpp>
#include <boost/uuid/name_generator.hpp> #include <boost/uuid/name_generator.hpp>
@@ -36,7 +37,6 @@
#include <boost/uuid/uuid_io.hpp> #include <boost/uuid/uuid_io.hpp>
#include "Core/Mpl.h" #include "Core/Mpl.h"
#include "Core/Vector.h"
#include "Core/Object.h" #include "Core/Object.h"
@@ -127,7 +127,7 @@ public:
private: private:
IDGen_t gen; IDGen_t gen;
Vector<RegisterEntry> m_registry; std::vector<RegisterEntry> m_registry;
}; };

View File

@@ -28,7 +28,8 @@
#ifndef U_DATABINNING_H #ifndef U_DATABINNING_H
#define U_DATABINNING_H #define U_DATABINNING_H
#include "Core/Vector.h" #include <vector>
#include "Dense.h" #include "Dense.h"
@@ -69,7 +70,7 @@ public:
void AddPass() { m_Means.push_back( Tmean(0,0) ); } void AddPass() { m_Means.push_back( Tmean(0,0) ); }
private: private:
Vector< Tmean > m_Means; std::vector< Tmean > m_Means;
}; };

View File

@@ -28,8 +28,9 @@
#ifndef TRIANGLEMESH_H #ifndef TRIANGLEMESH_H
#define TRIANGLEMESH_H #define TRIANGLEMESH_H
#include <vector>
#include "Core/Object.h" #include "Core/Object.h"
#include "Core/Vector.h"
#include "Math/Dense.h" #include "Math/Dense.h"
namespace uLib { namespace uLib {
@@ -44,12 +45,12 @@ public:
void AddTriangle(const Id_t *id); void AddTriangle(const Id_t *id);
void AddTriangle(const Vector3i &id); void AddTriangle(const Vector3i &id);
uLibRefMacro(Points,Vector<Vector3f>) inline std::vector<Vector3f> & Points() { return this->m_Points; }
uLibRefMacro(Triangles,Vector<Vector3i>) inline std::vector<Vector3i> & Triangles() { return this->m_Triangles; }
private: private:
Vector<Vector3f> m_Points; std::vector<Vector3f> m_Points;
Vector<Vector3i> m_Triangles; std::vector<Vector3i> m_Triangles;
}; };

View File

@@ -28,13 +28,13 @@
#ifndef U_MATH_VOXIMAGE_H #ifndef U_MATH_VOXIMAGE_H
#define U_MATH_VOXIMAGE_H #define U_MATH_VOXIMAGE_H
#include "Core/Vector.h"
#include "Core/StaticInterface.h" #include "Core/StaticInterface.h"
#include "Math/Dense.h" #include "Math/Dense.h"
#include "Math/StructuredGrid.h" #include "Math/StructuredGrid.h"
#include <iostream> #include <iostream>
#include <stdlib.h> #include <stdlib.h>
#include <vector>
namespace uLib { namespace uLib {
@@ -104,8 +104,8 @@ public:
this->m_Data = copy.m_Data; this->m_Data = copy.m_Data;
} }
uLibRefMacro(Data,Vector<T>) inline std::vector<T> & Data() { return this->m_Data; }
inline const Vector<T>& ConstData() const { return m_Data; } inline const std::vector<T>& ConstData() const { return m_Data; }
inline const T& At(int i) const { return m_Data.at(i); } inline const T& At(int i) const { return m_Data.at(i); }
inline const T& At(const Vector3i &id) const { return m_Data.at(Map(id)); } inline const T& At(const Vector3i &id) const { return m_Data.at(Map(id)); }
@@ -213,7 +213,7 @@ public:
} }
private: private:
Vector<T> m_Data; std::vector<T> m_Data;
}; };

View File

@@ -72,7 +72,7 @@ public:
void Run(); void Run();
void SetKernelNumericXZY(const Vector<float> &numeric); void SetKernelNumericXZY(const std::vector<float> &numeric);
void SetKernelSpherical(float (*shape)(float)); void SetKernelSpherical(float (*shape)(float));
@@ -84,9 +84,9 @@ public:
template < class ShapeT > template < class ShapeT >
void SetKernelWeightFunction( ShapeT shape ); void SetKernelWeightFunction( ShapeT shape );
uLibGetMacro(KernelData,Kernel<VoxelT>) inline Kernel<VoxelT> GetKernelData() const { return this->m_KernelData; }
uLibGetMacro(Image,VoxImage<VoxelT> *) inline VoxImage<VoxelT>* GetImage() const { return this->m_Image; }
void SetImage(Abstract::VoxImage *image); void SetImage(Abstract::VoxImage *image);

View File

@@ -48,14 +48,14 @@ public:
inline T& operator[](const int &id) { return m_Data[id]; } inline T& operator[](const int &id) { return m_Data[id]; }
inline int GetCenterData() const; inline int GetCenterData() const;
uLibRefMacro(Data,Vector<T>) inline std::vector<T> & Data() { return this->m_Data; }
inline const Vector<T>& ConstData() const { return this->m_Data; } inline const std::vector<T>& ConstData() const { return this->m_Data; }
void PrintSelf(std::ostream &o) const; void PrintSelf(std::ostream &o) const;
private: private:
Vector<T> m_Data; std::vector<T> m_Data;
}; };
template < typename T > template < typename T >
@@ -163,7 +163,7 @@ float VoxImageFilter<_TPLT_>::Distance2(const Vector3i &v)
_TPL_ _TPL_
void VoxImageFilter<_TPLT_>::SetKernelNumericXZY(const Vector<float> &numeric) void VoxImageFilter<_TPLT_>::SetKernelNumericXZY(const std::vector<float> &numeric)
{ {
// set data order // // set data order //
StructuredData::Order order = m_KernelData.GetDataOrder(); StructuredData::Order order = m_KernelData.GetDataOrder();
@@ -268,8 +268,8 @@ void VoxImageFilter<_TPLT_>::SetImage(Abstract::VoxImage *image)
_TPL_ _TPL_
float VoxImageFilter<_TPLT_>::Convolve(const VoxImage<VoxelT> &buffer, int index) float VoxImageFilter<_TPLT_>::Convolve(const VoxImage<VoxelT> &buffer, int index)
{ {
const Vector<VoxelT> &vbuf = buffer.ConstData(); const std::vector<VoxelT> &vbuf = buffer.ConstData();
const Vector<VoxelT> &vker = m_KernelData.ConstData(); const std::vector<VoxelT> &vker = m_KernelData.ConstData();
int vox_size = vbuf.size(); int vox_size = vbuf.size();
int ker_size = vker.size(); int ker_size = vker.size();
int pos; int pos;

View File

@@ -50,8 +50,8 @@ public:
float Evaluate(const VoxImage<VoxelT> &buffer, int index) float Evaluate(const VoxImage<VoxelT> &buffer, int index)
{ {
const Vector<VoxelT> &vbuf = buffer.ConstData(); const std::vector<VoxelT> &vbuf = buffer.ConstData();
const Vector<VoxelT> &vker = this->m_KernelData.ConstData(); const std::vector<VoxelT> &vker = this->m_KernelData.ConstData();
int vox_size = vbuf.size(); int vox_size = vbuf.size();
int ker_size = vker.size(); int ker_size = vker.size();
int pos; int pos;

View File

@@ -59,13 +59,13 @@ public:
float Evaluate(const VoxImage<VoxelT> &buffer, int index) float Evaluate(const VoxImage<VoxelT> &buffer, int index)
{ {
const Vector<VoxelT> &vbuf = buffer.ConstData(); const std::vector<VoxelT> &vbuf = buffer.ConstData();
const Vector<VoxelT> &vker = this->m_KernelData.ConstData(); const std::vector<VoxelT> &vker = this->m_KernelData.ConstData();
int vox_size = vbuf.size(); int vox_size = vbuf.size();
int ker_size = vker.size(); int ker_size = vker.size();
int pos; int pos;
Vector<VoxelT> mfh(ker_size); std::vector<VoxelT> mfh(ker_size);
for (int i = 0; i < ker_size; ++i) for (int i = 0; i < ker_size; ++i)
mfh[i].Count = i; //index key for ordering function mfh[i].Count = i; //index key for ordering function
for (int ik = 0; ik < ker_size; ik++) { for (int ik = 0; ik < ker_size; ik++) {
@@ -126,13 +126,13 @@ public:
float Evaluate(const VoxImage<VoxelT> &buffer, int index) float Evaluate(const VoxImage<VoxelT> &buffer, int index)
{ {
const Vector<VoxelT> &vbuf = buffer.ConstData(); const std::vector<VoxelT> &vbuf = buffer.ConstData();
const Vector<VoxelT> &vker = this->m_KernelData.ConstData(); const std::vector<VoxelT> &vker = this->m_KernelData.ConstData();
int vox_size = vbuf.size(); int vox_size = vbuf.size();
int ker_size = vker.size(); int ker_size = vker.size();
int pos; int pos;
Vector<VoxelT> mfh(ker_size); std::vector<VoxelT> mfh(ker_size);
for (int i = 0; i < ker_size; ++i) for (int i = 0; i < ker_size; ++i)
mfh[i].Count = i; //index key for ordering function mfh[i].Count = i; //index key for ordering function
for (int ik = 0; ik < ker_size; ik++) { for (int ik = 0; ik < ker_size; ik++) {

View File

@@ -50,8 +50,8 @@ public:
float Evaluate(const VoxImage<VoxelT> &buffer, int index) float Evaluate(const VoxImage<VoxelT> &buffer, int index)
{ {
const Vector<VoxelT> &vbuf = buffer.ConstData(); const std::vector<VoxelT> &vbuf = buffer.ConstData();
const Vector<VoxelT> &vker = this->m_KernelData.ConstData(); const std::vector<VoxelT> &vker = this->m_KernelData.ConstData();
int vox_size = vbuf.size(); int vox_size = vbuf.size();
int ker_size = vker.size(); int ker_size = vker.size();
int pos; int pos;
@@ -101,15 +101,15 @@ public:
float Evaluate(const VoxImage<VoxelT> &buffer, int index) float Evaluate(const VoxImage<VoxelT> &buffer, int index)
{ {
const Vector<VoxelT> &vbuf = buffer.ConstData(); const std::vector<VoxelT> &vbuf = buffer.ConstData();
const Vector<VoxelT> &vker = this->m_KernelData.ConstData(); const std::vector<VoxelT> &vker = this->m_KernelData.ConstData();
int img_size = vbuf.size(); int img_size = vbuf.size();
int ker_size = vker.size(); int ker_size = vker.size();
int pos; int pos;
Vector<FPair> mfh(ker_size); std::vector<FPair> mfh(ker_size);
for (int i = 0; i < ker_size; ++i) for (int i = 0; i < ker_size; ++i)
mfh[i].first = vker[i].Value; // kernel value in first mfh[i].first = vker[i].Value; // kernel value in first
for (int ik = 0; ik < ker_size; ik++) { for (int ik = 0; ik < ker_size; ik++) {

View File

@@ -43,7 +43,7 @@ class VoxFilterAlgorithmCustom :
public VoxImageFilter<VoxelT, VoxFilterAlgorithmCustom<VoxelT> > { public VoxImageFilter<VoxelT, VoxFilterAlgorithmCustom<VoxelT> > {
typedef float (* FunctionPt)(const Vector<Scalarf> &); typedef float (* FunctionPt)(const std::vector<Scalarf> &);
public: public:
typedef VoxImageFilter<VoxelT, VoxFilterAlgorithmCustom<VoxelT> > BaseClass; typedef VoxImageFilter<VoxelT, VoxFilterAlgorithmCustom<VoxelT> > BaseClass;
VoxFilterAlgorithmCustom(const Vector3i &size) : VoxFilterAlgorithmCustom(const Vector3i &size) :
@@ -53,14 +53,14 @@ public:
float Evaluate(const VoxImage<VoxelT> &buffer, int index) float Evaluate(const VoxImage<VoxelT> &buffer, int index)
{ {
if(likely(m_CustomEvaluate)) { if(likely(m_CustomEvaluate)) {
const Vector<VoxelT> &vbuf = buffer.ConstData(); const std::vector<VoxelT> &vbuf = buffer.ConstData();
const Vector<VoxelT> &vker = this->m_KernelData.ConstData(); const std::vector<VoxelT> &vker = this->m_KernelData.ConstData();
int vox_size = vbuf.size(); int vox_size = vbuf.size();
int ker_size = vker.size(); int ker_size = vker.size();
int pos; int pos;
float ker_sum = 0; float ker_sum = 0;
Vector<Scalarf> mfh(ker_size); std::vector<Scalarf> mfh(ker_size);
for (int ik = 0; ik < ker_size; ik++) { for (int ik = 0; ik < ker_size; ik++) {
pos = index + vker[ik].Count - vker[this->m_KernelData.GetCenterData()].Count; pos = index + vker[ik].Count - vker[this->m_KernelData.GetCenterData()].Count;
pos = (pos + vox_size) % vox_size; pos = (pos + vox_size) % vox_size;

View File

@@ -48,8 +48,8 @@ public:
float Evaluate(const VoxImage<VoxelT> &buffer, int index) float Evaluate(const VoxImage<VoxelT> &buffer, int index)
{ {
const Vector<VoxelT> &vbuf = buffer.ConstData(); const std::vector<VoxelT> &vbuf = buffer.ConstData();
const Vector<VoxelT> &vker = this->m_KernelData.ConstData(); const std::vector<VoxelT> &vker = this->m_KernelData.ConstData();
int vox_size = vbuf.size(); int vox_size = vbuf.size();
int ker_size = vker.size(); int ker_size = vker.size();
int pos; int pos;

View File

@@ -47,13 +47,13 @@ public:
float Evaluate(const VoxImage<VoxelT> &buffer, int index) float Evaluate(const VoxImage<VoxelT> &buffer, int index)
{ {
const Vector<VoxelT> &vbuf = buffer.ConstData(); const std::vector<VoxelT> &vbuf = buffer.ConstData();
const Vector<VoxelT> &vker = this->m_KernelData.ConstData(); const std::vector<VoxelT> &vker = this->m_KernelData.ConstData();
int vox_size = vbuf.size(); int vox_size = vbuf.size();
int ker_size = vker.size(); int ker_size = vker.size();
int pos; int pos;
Vector<float> mfh(ker_size); std::vector<float> mfh(ker_size);
for (int ik = 0; ik < ker_size; ik++) { for (int ik = 0; ik < ker_size; ik++) {
pos = index + vker[ik].Count - vker[this->m_KernelData.GetCenterData()].Count; pos = index + vker[ik].Count - vker[this->m_KernelData.GetCenterData()].Count;
pos = (pos + vox_size) % vox_size; pos = (pos + vox_size) % vox_size;

View File

@@ -80,7 +80,7 @@ void VoxRaytracer::RayData::AppendRay(const VoxRaytracer::RayData &in)
void VoxRaytracer::RayData::PrintSelf(std::ostream &o) void VoxRaytracer::RayData::PrintSelf(std::ostream &o)
{ {
o << "Ray: total lenght " << m_TotalLength << "\n"; o << "Ray: total lenght " << m_TotalLength << "\n";
Vector<Element>::Iterator it; std::vector<Element>::iterator it;
for(it = m_Data.begin(); it < m_Data.end(); ++it) for(it = m_Data.begin(); it < m_Data.end(); ++it)
o << "[ " << (*it).vox_id << ", " << (*it).L << "] \n"; o << "[ " << (*it).vox_id << ", " << (*it).L << "] \n";
} }

View File

@@ -29,8 +29,8 @@
#define VOXRAYTRACER_H #define VOXRAYTRACER_H
#include <math.h> #include <math.h>
#include <vector>
#include "Core/Vector.h"
#include "Math/StructuredGrid.h" #include "Math/StructuredGrid.h"
namespace uLib { namespace uLib {
@@ -51,14 +51,14 @@ public:
void AppendRay ( const RayData &in); void AppendRay ( const RayData &in);
uLibConstRefMacro(Data,Vector<Element>) uLibConstRefMacro(Data,std::vector<Element>)
uLibConstRefMacro(TotalLength,Scalarf) uLibConstRefMacro(TotalLength,Scalarf)
void PrintSelf(std::ostream &o); void PrintSelf(std::ostream &o);
private: private:
Vector<Element> m_Data; std::vector<Element> m_Data;
Scalarf m_TotalLength; Scalarf m_TotalLength;
}; };
@@ -78,7 +78,7 @@ public:
RayData TraceLine(const HLine3f &line) const; RayData TraceLine(const HLine3f &line) const;
uLibGetMacro(Image,StructuredGrid *) inline StructuredGrid* GetImage() const { return this->m_Image; }
private: private:
StructuredGrid *m_Image; StructuredGrid *m_Image;

View File

@@ -44,14 +44,16 @@ int test_ABTrim() {
acc.SetABTrim(1,1); acc.SetABTrim(1,1);
Vector<float> v; std::vector<float> v;
v << 1,5,5,5,300; for(float tmpf : {1,5,5,5,300}) v.push_back(tmpf);
//v << 1,5,5,5,300;
for(Vector<float>::Iterator itr=v.begin(); itr<v.end(); itr++) for(std::vector<float>::iterator itr=v.begin(); itr<v.end(); itr++)
acc += *itr; acc += *itr;
std::cout << "Accumulating Trim(1,1) vector: " // TODO missing operator <<
<< v << " ... out = " << acc() << "\n"; //std::cout << "Accumulating Trim(1,1) vector: "
// << v << " ... out = " << acc() << "\n";
return( acc() == 15.0 ); return( acc() == 15.0 );
@@ -62,7 +64,7 @@ int test_Mean() {
Accumulator_Mean<float> mean; Accumulator_Mean<float> mean;
TRandom rnd; TRandom rnd;
const int c = 10000000; const int c = 10000000;
Vector<float> v; std::vector<float> v;
v.reserve(c); v.reserve(c);
for(int i=0;i<c;++i) v.push_back( rnd.Gaus(2000,5) ); for(int i=0;i<c;++i) v.push_back( rnd.Gaus(2000,5) );

View File

@@ -63,7 +63,7 @@ private:
}; };
static float MaxInVector(const Vector<float> &v) static float MaxInVector(const std::vector<float> &v)
{ {
float max = 0; float max = 0;
for(int i=0; i<v.size(); ++i) for(int i=0; i<v.size(); ++i)
@@ -93,7 +93,7 @@ int main()
VoxImage<TestVoxel> filtered = image; VoxImage<TestVoxel> filtered = image;
Vector<float> values; std::vector<float> values;
for(int i=0; i < filter.GetKernelData().GetDims().prod(); ++i) { for(int i=0; i < filter.GetKernelData().GetDims().prod(); ++i) {
values.push_back(1.); values.push_back(1.);
std::cout << values[i] << " "; std::cout << values[i] << " ";
@@ -128,7 +128,7 @@ int main()
VoxFilterAlgorithmCustom<TestVoxel> filter(Vector3i(3,3,4)); VoxFilterAlgorithmCustom<TestVoxel> filter(Vector3i(3,3,4));
Vector<float> values; std::vector<float> values;
for(int i=0; i < filter.GetKernelData().GetDims().prod(); ++i) { for(int i=0; i < filter.GetKernelData().GetDims().prod(); ++i) {
values.push_back(static_cast<float>(1)); values.push_back(static_cast<float>(1));
} }

View File

@@ -33,7 +33,6 @@
#include <ostream> #include <ostream>
#include <iomanip> #include <iomanip>
#include <Core/Vector.h>
#include <Core/Object.h> #include <Core/Object.h>