nndeploy C++ API  0.2.0
nndeploy C++ API
parallel.h
Go to the documentation of this file.
1 #ifndef _NNDEPLOY_THREAD_POOL_PARALLEL_H_
2 #define _NNDEPLOY_THREAD_POOL_PARALLEL_H_
3 
4 #include "nndeploy/base/common.h"
6 #include "nndeploy/base/log.h"
7 #include "nndeploy/base/macro.h"
8 #include "nndeploy/base/object.h"
9 #include "nndeploy/base/status.h"
10 #include "nndeploy/base/type.h"
11 
12 namespace nndeploy {
13 namespace thread_pool {
14 
15 enum ParallelForApiType : int {
17 };
18 
21 
26  public:
27  virtual ~ParallelLoopBody() {}
28  virtual void operator()(const base::Range &range) const = 0;
29 };
30 
32 
33 extern NNDEPLOY_CC_API void setThreadNum(int num);
34 
36 
40 extern NNDEPLOY_CC_API void parallelFor(const base::Range &range,
41  const ParallelLoopBody &body,
42  double nstripes = -1.0);
43 
44 } // namespace thread_pool
45 } // namespace nndeploy
46 
47 #endif /* _NNDEPLOY_THREAD_POOL_PARALLEL_H_ */
Template class specifying a continuous subsequence (slice) of a sequence. The class is used to specif...
Definition: type.h:403
Base class for parallel data processors.
Definition: parallel.h:25
virtual void operator()(const base::Range &range) const =0
#define NNDEPLOY_CC_API
api
Definition: macro.h:29
ParallelForApiType stringToParallelForApiType(const std::string &src)
void parallelFor(const base::Range &range, const ParallelLoopBody &body, double nstripes=-1.0)
Parallel data processor.
std::string parallelForApiTypeToString(ParallelForApiType type)
void setThreadNum(int num)