Workaround for gcc debug build fail
Instead of defining temporary structs in functions, the temporary structs are defined as part of the Manager class.
This commit is contained in:
parent
be43cd03c5
commit
a851c63619
1 changed files with 86 additions and 96 deletions
|
@ -96,6 +96,72 @@ namespace EC
|
||||||
std::unique_ptr<ThreadPool<ThreadCount> > threadPool;
|
std::unique_ptr<ThreadPool<ThreadCount> > threadPool;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// section for "temporary" structures {{{
|
||||||
|
struct TPFnDataStructZero {
|
||||||
|
std::array<std::size_t, 2> range;
|
||||||
|
Manager *manager;
|
||||||
|
EntitiesType *entities;
|
||||||
|
const BitsetType *signature;
|
||||||
|
void *userData;
|
||||||
|
};
|
||||||
|
template <typename Function>
|
||||||
|
struct TPFnDataStructOne {
|
||||||
|
std::array<std::size_t, 2> range;
|
||||||
|
Manager *manager;
|
||||||
|
EntitiesType *entities;
|
||||||
|
BitsetType *signature;
|
||||||
|
void *userData;
|
||||||
|
Function *fn;
|
||||||
|
};
|
||||||
|
struct TPFnDataStructTwo {
|
||||||
|
std::array<std::size_t, 2> range;
|
||||||
|
Manager *manager;
|
||||||
|
EntitiesType *entities;
|
||||||
|
void *userData;
|
||||||
|
const std::vector<std::size_t> *matching;
|
||||||
|
};
|
||||||
|
struct TPFnDataStructThree {
|
||||||
|
std::array<std::size_t, 2> range;
|
||||||
|
Manager *manager;
|
||||||
|
std::vector<std::vector<std::size_t> > *matchingV;
|
||||||
|
const std::vector<BitsetType*> *bitsets;
|
||||||
|
EntitiesType *entities;
|
||||||
|
std::mutex *mutex;
|
||||||
|
};
|
||||||
|
struct TPFnDataStructFour {
|
||||||
|
std::array<std::size_t, 2> range;
|
||||||
|
Manager *manager;
|
||||||
|
std::vector<std::vector<std::size_t> >*
|
||||||
|
multiMatchingEntities;
|
||||||
|
BitsetType *signatures;
|
||||||
|
std::mutex *mutex;
|
||||||
|
};
|
||||||
|
struct TPFnDataStructFive {
|
||||||
|
std::array<std::size_t, 2> range;
|
||||||
|
std::size_t index;
|
||||||
|
Manager *manager;
|
||||||
|
void *userData;
|
||||||
|
std::vector<std::vector<std::size_t> >*
|
||||||
|
multiMatchingEntities;
|
||||||
|
};
|
||||||
|
struct TPFnDataStructSix {
|
||||||
|
std::array<std::size_t, 2> range;
|
||||||
|
Manager *manager;
|
||||||
|
std::vector<std::vector<std::size_t> > *
|
||||||
|
multiMatchingEntities;
|
||||||
|
BitsetType *bitsets;
|
||||||
|
std::mutex *mutex;
|
||||||
|
};
|
||||||
|
template <typename Iterable>
|
||||||
|
struct TPFnDataStructSeven {
|
||||||
|
std::array<std::size_t, 2> range;
|
||||||
|
Manager *manager;
|
||||||
|
EntitiesType *entities;
|
||||||
|
Iterable *iterable;
|
||||||
|
void *userData;
|
||||||
|
};
|
||||||
|
// end section for "temporary" structures }}}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Initializes the manager with a default capacity.
|
\brief Initializes the manager with a default capacity.
|
||||||
|
|
||||||
|
@ -656,14 +722,7 @@ namespace EC
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct TPFnDataStruct {
|
std::array<TPFnDataStructZero, ThreadCount> fnDataAr;
|
||||||
std::array<std::size_t, 2> range;
|
|
||||||
Manager *manager;
|
|
||||||
EntitiesType *entities;
|
|
||||||
BitsetType *signature;
|
|
||||||
void *userData;
|
|
||||||
};
|
|
||||||
std::array<TPFnDataStruct, ThreadCount> fnDataAr;
|
|
||||||
|
|
||||||
std::size_t s = currentSize / ThreadCount;
|
std::size_t s = currentSize / ThreadCount;
|
||||||
for(std::size_t i = 0; i < ThreadCount; ++i) {
|
for(std::size_t i = 0; i < ThreadCount; ++i) {
|
||||||
|
@ -684,7 +743,7 @@ namespace EC
|
||||||
fnDataAr[i].userData = userData;
|
fnDataAr[i].userData = userData;
|
||||||
|
|
||||||
threadPool->queueFn([&function] (void *ud) {
|
threadPool->queueFn([&function] (void *ud) {
|
||||||
auto *data = static_cast<TPFnDataStruct*>(ud);
|
auto *data = static_cast<TPFnDataStructZero*>(ud);
|
||||||
for(std::size_t i = data->range[0]; i < data->range[1];
|
for(std::size_t i = data->range[0]; i < data->range[1];
|
||||||
++i) {
|
++i) {
|
||||||
if(!data->manager->isAlive(i)) {
|
if(!data->manager->isAlive(i)) {
|
||||||
|
@ -784,15 +843,7 @@ namespace EC
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct TPFnDataStruct {
|
std::array<TPFnDataStructOne<Function>, ThreadCount> fnDataAr;
|
||||||
std::array<std::size_t, 2> range;
|
|
||||||
Manager *manager;
|
|
||||||
EntitiesType *entities;
|
|
||||||
BitsetType *signature;
|
|
||||||
void *userData;
|
|
||||||
Function *fn;
|
|
||||||
};
|
|
||||||
std::array<TPFnDataStruct, ThreadCount> fnDataAr;
|
|
||||||
|
|
||||||
std::size_t s = currentSize / ThreadCount;
|
std::size_t s = currentSize / ThreadCount;
|
||||||
for(std::size_t i = 0; i < ThreadCount; ++i) {
|
for(std::size_t i = 0; i < ThreadCount; ++i) {
|
||||||
|
@ -813,7 +864,7 @@ namespace EC
|
||||||
fnDataAr[i].userData = userData;
|
fnDataAr[i].userData = userData;
|
||||||
fnDataAr[i].fn = function;
|
fnDataAr[i].fn = function;
|
||||||
threadPool->queueFn([] (void *ud) {
|
threadPool->queueFn([] (void *ud) {
|
||||||
auto *data = static_cast<TPFnDataStruct*>(ud);
|
auto *data = static_cast<TPFnDataStructOne<Function>*>(ud);
|
||||||
for(std::size_t i = data->range[0]; i < data->range[1];
|
for(std::size_t i = data->range[0]; i < data->range[1];
|
||||||
++i) {
|
++i) {
|
||||||
if(!data->manager->isAlive(i)) {
|
if(!data->manager->isAlive(i)) {
|
||||||
|
@ -942,14 +993,7 @@ namespace EC
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct TPFnDataStruct {
|
std::array<TPFnDataStructTwo, ThreadCount> fnDataAr;
|
||||||
std::array<std::size_t, 2> range;
|
|
||||||
Manager *manager;
|
|
||||||
EntitiesType *entities;
|
|
||||||
void *userData;
|
|
||||||
const std::vector<std::size_t> *matching;
|
|
||||||
};
|
|
||||||
std::array<TPFnDataStruct, ThreadCount> fnDataAr;
|
|
||||||
|
|
||||||
std::size_t s = matching.size() / ThreadCount;
|
std::size_t s = matching.size() / ThreadCount;
|
||||||
for(std::size_t i = 0; i < ThreadCount; ++i) {
|
for(std::size_t i = 0; i < ThreadCount; ++i) {
|
||||||
|
@ -969,7 +1013,7 @@ namespace EC
|
||||||
fnDataAr[i].userData = userData;
|
fnDataAr[i].userData = userData;
|
||||||
fnDataAr[i].matching = &matching;
|
fnDataAr[i].matching = &matching;
|
||||||
threadPool->queueFn([&function, helper] (void* ud) {
|
threadPool->queueFn([&function, helper] (void* ud) {
|
||||||
auto *data = static_cast<TPFnDataStruct*>(ud);
|
auto *data = static_cast<TPFnDataStructTwo*>(ud);
|
||||||
for(std::size_t i = data->range[0];
|
for(std::size_t i = data->range[0];
|
||||||
i < data->range[1];
|
i < data->range[1];
|
||||||
++i) {
|
++i) {
|
||||||
|
@ -1022,15 +1066,7 @@ namespace EC
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct TPFnDataStruct {
|
std::array<TPFnDataStructThree, ThreadCount> fnDataAr;
|
||||||
std::array<std::size_t, 2> range;
|
|
||||||
Manager *manager;
|
|
||||||
std::vector<std::vector<std::size_t> > *matchingV;
|
|
||||||
const std::vector<BitsetType*> *bitsets;
|
|
||||||
EntitiesType *entities;
|
|
||||||
std::mutex *mutex;
|
|
||||||
};
|
|
||||||
std::array<TPFnDataStruct, ThreadCount> fnDataAr;
|
|
||||||
|
|
||||||
std::size_t s = currentSize / ThreadCount;
|
std::size_t s = currentSize / ThreadCount;
|
||||||
std::mutex mutex;
|
std::mutex mutex;
|
||||||
|
@ -1052,7 +1088,7 @@ namespace EC
|
||||||
fnDataAr[i].entities = &entities;
|
fnDataAr[i].entities = &entities;
|
||||||
fnDataAr[i].mutex = &mutex;
|
fnDataAr[i].mutex = &mutex;
|
||||||
threadPool->queueFn([] (void *ud) {
|
threadPool->queueFn([] (void *ud) {
|
||||||
auto *data = static_cast<TPFnDataStruct*>(ud);
|
auto *data = static_cast<TPFnDataStructThree*>(ud);
|
||||||
for(std::size_t i = data->range[0]; i < data->range[1];
|
for(std::size_t i = data->range[0]; i < data->range[1];
|
||||||
++i) {
|
++i) {
|
||||||
if(!data->manager->isAlive(i)) {
|
if(!data->manager->isAlive(i)) {
|
||||||
|
@ -1420,15 +1456,7 @@ namespace EC
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct TPFnDataStruct {
|
std::array<TPFnDataStructFour, ThreadCount> fnDataAr;
|
||||||
std::array<std::size_t, 2> range;
|
|
||||||
Manager *manager;
|
|
||||||
std::vector<std::vector<std::size_t> >*
|
|
||||||
multiMatchingEntities;
|
|
||||||
BitsetType *signatures;
|
|
||||||
std::mutex *mutex;
|
|
||||||
};
|
|
||||||
std::array<TPFnDataStruct, ThreadCount> fnDataAr;
|
|
||||||
|
|
||||||
std::mutex mutex;
|
std::mutex mutex;
|
||||||
std::size_t s = currentSize / ThreadCount;
|
std::size_t s = currentSize / ThreadCount;
|
||||||
|
@ -1450,7 +1478,7 @@ namespace EC
|
||||||
fnDataAr[i].mutex = &mutex;
|
fnDataAr[i].mutex = &mutex;
|
||||||
|
|
||||||
threadPool->queueFn([] (void *ud) {
|
threadPool->queueFn([] (void *ud) {
|
||||||
auto *data = static_cast<TPFnDataStruct*>(ud);
|
auto *data = static_cast<TPFnDataStructFour*>(ud);
|
||||||
for(std::size_t i = data->range[0]; i < data->range[1];
|
for(std::size_t i = data->range[0]; i < data->range[1];
|
||||||
++i) {
|
++i) {
|
||||||
if(!data->manager->isAlive(i)) {
|
if(!data->manager->isAlive(i)) {
|
||||||
|
@ -1498,15 +1526,7 @@ namespace EC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
struct TPFnDataStruct {
|
std::array<TPFnDataStructFive, ThreadCount> fnDataAr;
|
||||||
std::array<std::size_t, 2> range;
|
|
||||||
std::size_t index;
|
|
||||||
Manager *manager;
|
|
||||||
void *userData;
|
|
||||||
std::vector<std::vector<std::size_t> >*
|
|
||||||
multiMatchingEntities;
|
|
||||||
};
|
|
||||||
std::array<TPFnDataStruct, ThreadCount> fnDataAr;
|
|
||||||
std::size_t s = multiMatchingEntities[index].size()
|
std::size_t s = multiMatchingEntities[index].size()
|
||||||
/ ThreadCount;
|
/ ThreadCount;
|
||||||
for(unsigned int i = 0; i < ThreadCount; ++i) {
|
for(unsigned int i = 0; i < ThreadCount; ++i) {
|
||||||
|
@ -1527,7 +1547,7 @@ namespace EC
|
||||||
fnDataAr[i].multiMatchingEntities =
|
fnDataAr[i].multiMatchingEntities =
|
||||||
&multiMatchingEntities;
|
&multiMatchingEntities;
|
||||||
threadPool->queueFn([&func] (void *ud) {
|
threadPool->queueFn([&func] (void *ud) {
|
||||||
auto *data = static_cast<TPFnDataStruct*>(ud);
|
auto *data = static_cast<TPFnDataStructFive*>(ud);
|
||||||
for(std::size_t i = data->range[0];
|
for(std::size_t i = data->range[0];
|
||||||
i < data->range[1]; ++i) {
|
i < data->range[1]; ++i) {
|
||||||
if(data->manager->isAlive(
|
if(data->manager->isAlive(
|
||||||
|
@ -1644,15 +1664,7 @@ namespace EC
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct TPFnDataStruct {
|
std::array<TPFnDataStructSix, ThreadCount> fnDataAr;
|
||||||
std::array<std::size_t, 2> range;
|
|
||||||
Manager *manager;
|
|
||||||
std::vector<std::vector<std::size_t> > *
|
|
||||||
multiMatchingEntities;
|
|
||||||
BitsetType *bitsets;
|
|
||||||
std::mutex *mutex;
|
|
||||||
};
|
|
||||||
std::array<TPFnDataStruct, ThreadCount> fnDataAr;
|
|
||||||
|
|
||||||
std::mutex mutex;
|
std::mutex mutex;
|
||||||
std::size_t s = currentSize / ThreadCount;
|
std::size_t s = currentSize / ThreadCount;
|
||||||
|
@ -1674,7 +1686,7 @@ namespace EC
|
||||||
fnDataAr[i].mutex = &mutex;
|
fnDataAr[i].mutex = &mutex;
|
||||||
|
|
||||||
threadPool->queueFn([] (void *ud) {
|
threadPool->queueFn([] (void *ud) {
|
||||||
auto *data = static_cast<TPFnDataStruct*>(ud);
|
auto *data = static_cast<TPFnDataStructSix*>(ud);
|
||||||
for(std::size_t i = data->range[0]; i < data->range[1];
|
for(std::size_t i = data->range[0]; i < data->range[1];
|
||||||
++i) {
|
++i) {
|
||||||
if(!data->manager->isAlive(i)) {
|
if(!data->manager->isAlive(i)) {
|
||||||
|
@ -1727,15 +1739,7 @@ namespace EC
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct TPFnDataStruct {
|
std::array<TPFnDataStructFive, ThreadCount> fnDataAr;
|
||||||
std::array<std::size_t, 2> range;
|
|
||||||
std::size_t index;
|
|
||||||
Manager *manager;
|
|
||||||
void *userData;
|
|
||||||
std::vector<std::vector<std::size_t> >*
|
|
||||||
multiMatchingEntities;
|
|
||||||
};
|
|
||||||
std::array<TPFnDataStruct, ThreadCount> fnDataAr;
|
|
||||||
std::size_t s = multiMatchingEntities[index].size()
|
std::size_t s = multiMatchingEntities[index].size()
|
||||||
/ ThreadCount;
|
/ ThreadCount;
|
||||||
for(unsigned int i = 0; i < ThreadCount; ++i) {
|
for(unsigned int i = 0; i < ThreadCount; ++i) {
|
||||||
|
@ -1756,7 +1760,7 @@ namespace EC
|
||||||
fnDataAr[i].multiMatchingEntities =
|
fnDataAr[i].multiMatchingEntities =
|
||||||
&multiMatchingEntities;
|
&multiMatchingEntities;
|
||||||
threadPool->queueFn([&func] (void *ud) {
|
threadPool->queueFn([&func] (void *ud) {
|
||||||
auto *data = static_cast<TPFnDataStruct*>(ud);
|
auto *data = static_cast<TPFnDataStructFive*>(ud);
|
||||||
for(std::size_t i = data->range[0];
|
for(std::size_t i = data->range[0];
|
||||||
i < data->range[1]; ++i) {
|
i < data->range[1]; ++i) {
|
||||||
if(data->manager->isAlive(
|
if(data->manager->isAlive(
|
||||||
|
@ -1821,14 +1825,7 @@ namespace EC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
struct TPFnDataStruct {
|
std::array<TPFnDataStructZero, ThreadCount> fnDataAr;
|
||||||
std::array<std::size_t, 2> range;
|
|
||||||
Manager *manager;
|
|
||||||
EntitiesType *entities;
|
|
||||||
const BitsetType *signature;
|
|
||||||
void *userData;
|
|
||||||
};
|
|
||||||
std::array<TPFnDataStruct, ThreadCount> fnDataAr;
|
|
||||||
|
|
||||||
std::size_t s = currentSize / ThreadCount;
|
std::size_t s = currentSize / ThreadCount;
|
||||||
for(std::size_t i = 0; i < ThreadCount; ++i) {
|
for(std::size_t i = 0; i < ThreadCount; ++i) {
|
||||||
|
@ -1848,7 +1845,7 @@ namespace EC
|
||||||
fnDataAr[i].signature = &signatureBitset;
|
fnDataAr[i].signature = &signatureBitset;
|
||||||
fnDataAr[i].userData = userData;
|
fnDataAr[i].userData = userData;
|
||||||
threadPool->queueFn([&fn] (void *ud) {
|
threadPool->queueFn([&fn] (void *ud) {
|
||||||
auto *data = static_cast<TPFnDataStruct*>(ud);
|
auto *data = static_cast<TPFnDataStructZero*>(ud);
|
||||||
for(std::size_t i = data->range[0]; i < data->range[1];
|
for(std::size_t i = data->range[0]; i < data->range[1];
|
||||||
++i) {
|
++i) {
|
||||||
if(!data->manager->isAlive(i)) {
|
if(!data->manager->isAlive(i)) {
|
||||||
|
@ -1913,14 +1910,7 @@ namespace EC
|
||||||
fn(i, this, userData);
|
fn(i, this, userData);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
struct TPFnDataStruct {
|
std::array<TPFnDataStructSeven<Iterable>, ThreadCount> fnDataAr;
|
||||||
std::array<std::size_t, 2> range;
|
|
||||||
Manager *manager;
|
|
||||||
EntitiesType *entities;
|
|
||||||
Iterable *iterable;
|
|
||||||
void *userData;
|
|
||||||
};
|
|
||||||
std::array<TPFnDataStruct, ThreadCount> fnDataAr;
|
|
||||||
|
|
||||||
std::size_t s = currentSize / ThreadCount;
|
std::size_t s = currentSize / ThreadCount;
|
||||||
for(std::size_t i = 0; i < ThreadCount; ++i) {
|
for(std::size_t i = 0; i < ThreadCount; ++i) {
|
||||||
|
@ -1940,7 +1930,7 @@ namespace EC
|
||||||
fnDataAr[i].iterable = &iterable;
|
fnDataAr[i].iterable = &iterable;
|
||||||
fnDataAr[i].userData = userData;
|
fnDataAr[i].userData = userData;
|
||||||
threadPool->queueFn([&fn] (void *ud) {
|
threadPool->queueFn([&fn] (void *ud) {
|
||||||
auto *data = static_cast<TPFnDataStruct*>(ud);
|
auto *data = static_cast<TPFnDataStructSeven<Iterable>*>(ud);
|
||||||
bool isValid;
|
bool isValid;
|
||||||
for(std::size_t i = data->range[0]; i < data->range[1];
|
for(std::size_t i = data->range[0]; i < data->range[1];
|
||||||
++i) {
|
++i) {
|
||||||
|
|
Loading…
Reference in a new issue