FBX C++ API Reference
fbxprogress.h
Go to the documentation of this file.
1 /****************************************************************************************
2 
3  Copyright (C) 2015 Autodesk, Inc.
4  All rights reserved.
5 
6  Use of this software is subject to the terms of the Autodesk license agreement
7  provided at the time of installation or download, or which otherwise accompanies
8  this software in either electronic or hard copy form.
9 
10 ****************************************************************************************/
11 
13 #ifndef _FBXSDK_FILEIO_PROGRESS_H_
14 #define _FBXSDK_FILEIO_PROGRESS_H_
15 
16 #include <fbxsdk/fbxsdk_def.h>
17 
19 
20 #include <fbxsdk/fbxsdk_nsbegin.h>
21 
22 typedef bool (*FbxProgressCallback)(void* pArgs, float pPercentage, const char* pStatus);
23 
24 #if !defined(FBXSDK_ENV_WINSTORE) && !defined(FBXSDK_ENV_EMSCRIPTEN)
25  class FbxSpinLock;
26 #endif
27 
32 {
33 public:
37  void SetProgressCallback(FbxProgressCallback pCallback, void* pArgs=NULL);
38 
42  void SetTotal(float pTotal);
43 
47  void SetThreshold(float pThreshold);
48 
53  void Update(float pDelta, const char* pStatus=NULL);
54 
56  void Reset();
57 
61  float GetProgress(FbxString* pStatus=NULL);
62 
65  void Complete(const char* pStatus=NULL);
66 
68  void Cancel();
69 
71  inline bool IsCanceled() const { return mCanceled; }
72 
73 /*****************************************************************************************************************************
74 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
75 *****************************************************************************************************************************/
76 #ifndef DOXYGEN_SHOULD_SKIP_THIS
77  FbxProgress();
78  ~FbxProgress();
79 
80 private:
81  void Acquire();
82  void Release();
83  float GetPercent() const;
84  bool ExecuteCallback() const;
85 
86 #if !defined(FBXSDK_ENV_WINSTORE) && !defined(FBXSDK_ENV_EMSCRIPTEN)
87  FbxSpinLock* mLock;
88 #endif
89  float mCurrent;
90  float mPrevious;
91  float mTotal;
92  float mThreshold;
93  FbxString mStatus;
94  FbxProgressCallback mCallback;
95  void* mCallbackArgs;
96  bool mCanceled;
97 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
98 };
99 
100 #include <fbxsdk/fbxsdk_nsend.h>
101 
102 #endif /* _FBXSDK_FILEIO_PROGRESS_H_ */
A spinlock is the fastest and most simple thread lock mechanism available.
Definition: fbxsync.h:38
FBX SDK environment definition.
#define NULL
Definition: fbxarch.h:210
Utility class to manipulate strings.
Definition: fbxstring.h:66
Class for progress reporting.
Definition: fbxprogress.h:31
#define FBXSDK_DLL
Definition: fbxarch.h:173
bool IsCanceled() const
Query whether user canceled this progress.
Definition: fbxprogress.h:71
bool(* FbxProgressCallback)(void *pArgs, float pPercentage, const char *pStatus)
Definition: fbxprogress.h:22