Merge branch 'master' into cxx17
This commit is contained in:
commit
cfccb5f863
1 changed files with 14 additions and 6 deletions
|
@ -97,6 +97,7 @@ namespace EC
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// section for "temporary" structures {{{
|
// section for "temporary" structures {{{
|
||||||
|
/// Temporary struct used internally by ThreadPool
|
||||||
struct TPFnDataStructZero {
|
struct TPFnDataStructZero {
|
||||||
std::array<std::size_t, 2> range;
|
std::array<std::size_t, 2> range;
|
||||||
Manager *manager;
|
Manager *manager;
|
||||||
|
@ -104,6 +105,7 @@ namespace EC
|
||||||
const BitsetType *signature;
|
const BitsetType *signature;
|
||||||
void *userData;
|
void *userData;
|
||||||
};
|
};
|
||||||
|
/// Temporary struct used internally by ThreadPool
|
||||||
template <typename Function>
|
template <typename Function>
|
||||||
struct TPFnDataStructOne {
|
struct TPFnDataStructOne {
|
||||||
std::array<std::size_t, 2> range;
|
std::array<std::size_t, 2> range;
|
||||||
|
@ -113,6 +115,7 @@ namespace EC
|
||||||
void *userData;
|
void *userData;
|
||||||
Function *fn;
|
Function *fn;
|
||||||
};
|
};
|
||||||
|
/// Temporary struct used internally by ThreadPool
|
||||||
struct TPFnDataStructTwo {
|
struct TPFnDataStructTwo {
|
||||||
std::array<std::size_t, 2> range;
|
std::array<std::size_t, 2> range;
|
||||||
Manager *manager;
|
Manager *manager;
|
||||||
|
@ -120,6 +123,7 @@ namespace EC
|
||||||
void *userData;
|
void *userData;
|
||||||
const std::vector<std::size_t> *matching;
|
const std::vector<std::size_t> *matching;
|
||||||
};
|
};
|
||||||
|
/// Temporary struct used internally by ThreadPool
|
||||||
struct TPFnDataStructThree {
|
struct TPFnDataStructThree {
|
||||||
std::array<std::size_t, 2> range;
|
std::array<std::size_t, 2> range;
|
||||||
Manager *manager;
|
Manager *manager;
|
||||||
|
@ -128,6 +132,7 @@ namespace EC
|
||||||
EntitiesType *entities;
|
EntitiesType *entities;
|
||||||
std::mutex *mutex;
|
std::mutex *mutex;
|
||||||
};
|
};
|
||||||
|
/// Temporary struct used internally by ThreadPool
|
||||||
struct TPFnDataStructFour {
|
struct TPFnDataStructFour {
|
||||||
std::array<std::size_t, 2> range;
|
std::array<std::size_t, 2> range;
|
||||||
Manager *manager;
|
Manager *manager;
|
||||||
|
@ -136,6 +141,7 @@ namespace EC
|
||||||
BitsetType *signatures;
|
BitsetType *signatures;
|
||||||
std::mutex *mutex;
|
std::mutex *mutex;
|
||||||
};
|
};
|
||||||
|
/// Temporary struct used internally by ThreadPool
|
||||||
struct TPFnDataStructFive {
|
struct TPFnDataStructFive {
|
||||||
std::array<std::size_t, 2> range;
|
std::array<std::size_t, 2> range;
|
||||||
std::size_t index;
|
std::size_t index;
|
||||||
|
@ -144,6 +150,7 @@ namespace EC
|
||||||
std::vector<std::vector<std::size_t> >*
|
std::vector<std::vector<std::size_t> >*
|
||||||
multiMatchingEntities;
|
multiMatchingEntities;
|
||||||
};
|
};
|
||||||
|
/// Temporary struct used internally by ThreadPool
|
||||||
struct TPFnDataStructSix {
|
struct TPFnDataStructSix {
|
||||||
std::array<std::size_t, 2> range;
|
std::array<std::size_t, 2> range;
|
||||||
Manager *manager;
|
Manager *manager;
|
||||||
|
@ -152,6 +159,7 @@ namespace EC
|
||||||
BitsetType *bitsets;
|
BitsetType *bitsets;
|
||||||
std::mutex *mutex;
|
std::mutex *mutex;
|
||||||
};
|
};
|
||||||
|
/// Temporary struct used internally by ThreadPool
|
||||||
template <typename Iterable>
|
template <typename Iterable>
|
||||||
struct TPFnDataStructSeven {
|
struct TPFnDataStructSeven {
|
||||||
std::array<std::size_t, 2> range;
|
std::array<std::size_t, 2> range;
|
||||||
|
@ -686,7 +694,7 @@ namespace EC
|
||||||
// Lambda function contents here
|
// Lambda function contents here
|
||||||
},
|
},
|
||||||
&c, // "Context" object passed to the function
|
&c, // "Context" object passed to the function
|
||||||
4 // four threads
|
true // enable use of internal ThreadPool
|
||||||
);
|
);
|
||||||
\endcode
|
\endcode
|
||||||
Note, the ID given to the function is not permanent. An entity's ID
|
Note, the ID given to the function is not permanent. An entity's ID
|
||||||
|
@ -808,7 +816,7 @@ namespace EC
|
||||||
manager.forMatchingSignaturePtr<TypeList<C0, C1, T0>>(
|
manager.forMatchingSignaturePtr<TypeList<C0, C1, T0>>(
|
||||||
&function, // ptr
|
&function, // ptr
|
||||||
&c, // "Context" object passed to the function
|
&c, // "Context" object passed to the function
|
||||||
4 // four threads
|
true // enable use of ThreadPool
|
||||||
);
|
);
|
||||||
\endcode
|
\endcode
|
||||||
Note, the ID given to the function is not permanent. An entity's ID
|
Note, the ID given to the function is not permanent. An entity's ID
|
||||||
|
@ -1147,8 +1155,8 @@ namespace EC
|
||||||
// call all stored functions
|
// call all stored functions
|
||||||
manager.callForMatchingFunctions();
|
manager.callForMatchingFunctions();
|
||||||
|
|
||||||
// call all stored functions with 4 threads
|
// call all stored functions with ThreadPool enabled
|
||||||
manager.callForMatchingFunctions(4);
|
manager.callForMatchingFunctions(true);
|
||||||
|
|
||||||
// remove all stored functions
|
// remove all stored functions
|
||||||
manager.clearForMatchingFunctions();
|
manager.clearForMatchingFunctions();
|
||||||
|
@ -1200,8 +1208,8 @@ namespace EC
|
||||||
// call the previously added function
|
// call the previously added function
|
||||||
manager.callForMatchingFunction(id);
|
manager.callForMatchingFunction(id);
|
||||||
|
|
||||||
// call the previously added function with 4 threads
|
// call the previously added function with ThreadPool enabled
|
||||||
manager.callForMatchingFunction(id, 4);
|
manager.callForMatchingFunction(id, true);
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
\return False if a function with the given id does not exist.
|
\return False if a function with the given id does not exist.
|
||||||
|
|
Loading…
Reference in a new issue