gwnavgeneration/generator/iparallelforinterface.h Source File

iparallelforinterface.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 #pragma once
8 
11 
12 namespace Kaim
13 {
14 
21 class IParallelElementFunctor : public NewOverrideBase<MemStat_NavDataGen>
22 {
23 public:
24  virtual ~IParallelElementFunctor() {}
25 
27  virtual void Do(void* element) = 0;
28 };
29 
36 class IParallelForInterface : public RefCountBaseV<IParallelForInterface, MemStat_NavDataGen>
37 {
38 public:
39  // For internal use only
40  class InitObject
41  {
42  public:
43  InitObject(IParallelForInterface* parallelFor) : m_parallelFor(parallelFor) { if (m_parallelFor) m_parallelFor->Init(); }
44  ~InitObject() { if (m_parallelFor) m_parallelFor->Terminate(); }
45  IParallelForInterface* m_parallelFor;
46  };
47 
48 public:
49  virtual ~IParallelForInterface() {}
50 
53  virtual KyResult Init() = 0;
54 
57  virtual KyResult Terminate() = 0;
58 
66  virtual KyResult ParallelFor(void** elements, KyUInt32 elementsCount, Kaim::IParallelElementFunctor* functor) = 0;
67 };
68 
69 
70 }
71 
72 
Provides an abstract base interface for an object that can treat computational jobs in parallel...
Definition: iparallelforinterface.h:36
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
virtual KyResult Init()=0
This method is expected to perform whatever steps are needed to initialize the parallelization mechan...
Provides an abstract base interface for an object that treats an element of data that can be passed t...
Definition: iparallelforinterface.h:21
virtual KyResult ParallelFor(void **elements, KyUInt32 elementsCount, Kaim::IParallelElementFunctor *functor)=0
This is the main method of the IParallelForInterface: it is called by Autodesk Navigation to manage t...
virtual void Do(void *element)=0
This method is carries out whatever processing needs to be done for the specified data element...
Navigation return code class.
Definition: types.h:108
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
virtual KyResult Terminate()=0
This method is expected to perform whatever steps are needed to shut down the parallelization mechani...