nndeploy C++ API  0.2.0
nndeploy C++ API
parallel_for_api.h
Go to the documentation of this file.
1 #ifndef _NNDEPLOY_THREAD_POOL_PARALLEL_FOR_API_H_
2 #define _NNDEPLOY_THREAD_POOL_PARALLEL_FOR_API_H_
3 
5 
6 namespace nndeploy {
7 namespace thread_pool {
8 
10  public:
11  ParallelForApi() = default;
12 
13  virtual ~ParallelForApi() = default;
14 
15  virtual void setThreadNum(int num) = 0;
16 
17  virtual int getThreadNum() = 0;
18 
19  virtual int parallelFor(const base::Range &range,
20  const ParallelLoopBody &body,
21  double nstripes = -1.0) = 0;
22 };
23 
24 std::shared_ptr<ParallelForApi> &getParallelForApi(
26 
27 } // namespace thread_pool
28 } // namespace nndeploy
29 
30 #endif /* _NNDEPLOY_THREAD_POOL_PARALLEL_FOR_API_H_ */
Template class specifying a continuous subsequence (slice) of a sequence. The class is used to specif...
Definition: type.h:403
virtual int parallelFor(const base::Range &range, const ParallelLoopBody &body, double nstripes=-1.0)=0
virtual void setThreadNum(int num)=0
Base class for parallel data processors.
Definition: parallel.h:25
std::shared_ptr< ParallelForApi > & getParallelForApi(ParallelForApiType type=kParallelForApiTypeDefault)