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 
74  inline float GetTotal() const { return mTotal; }
75 
77  inline float GetThreshold() const { return mThreshold; }
78 
79 /*****************************************************************************************************************************
80 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
81 *****************************************************************************************************************************/
82 #ifndef DOXYGEN_SHOULD_SKIP_THIS
83  FbxProgress();
84  ~FbxProgress();
85 
86 private:
87  void Acquire();
88  void Release();
89  float GetPercent() const;
90  bool ExecuteCallback() const;
91 
92 #if !defined(FBXSDK_ENV_WINSTORE) && !defined(FBXSDK_ENV_EMSCRIPTEN)
93  FbxSpinLock* mLock;
94 #endif
95  float mCurrent;
96  float mPrevious;
97  float mTotal;
98  float mThreshold;
99  FbxString mStatus;
100  FbxProgressCallback mCallback;
101  void* mCallbackArgs;
102  bool mCanceled;
103 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
104 };
105 
106 #include <fbxsdk/fbxsdk_nsend.h>
107 
108 #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.
float GetThreshold() const
Retrieve the current threshold of this progress.
Definition: fbxprogress.h:77
#define NULL
Definition: fbxarch.h:213
Utility class to manipulate strings.
Definition: fbxstring.h:66
bool IsCanceled() const
Query whether user canceled this progress.
Definition: fbxprogress.h:71
float GetTotal() const
Retrieve the current total of this progress.
Definition: fbxprogress.h:74
Class for progress reporting.
Definition: fbxprogress.h:31
#define FBXSDK_DLL
Definition: fbxarch.h:176
bool(* FbxProgressCallback)(void *pArgs, float pPercentage, const char *pStatus)
Definition: fbxprogress.h:22