fbxprogress.h

Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2013 Autodesk, Inc.
00004    All rights reserved.
00005  
00006    Use of this software is subject to the terms of the Autodesk license agreement
00007    provided at the time of installation or download, or which otherwise accompanies
00008    this software in either electronic or hard copy form.
00009  
00010 ****************************************************************************************/
00011 
00013 #ifndef _FBXSDK_FILEIO_PROGRESS_H_
00014 #define _FBXSDK_FILEIO_PROGRESS_H_
00015 
00016 #include <fbxsdk/fbxsdk_def.h>
00017 
00018 #include <fbxsdk/core/base/fbxstring.h>
00019 
00020 #include <fbxsdk/fbxsdk_nsbegin.h>
00021 
00022 typedef bool (*FbxProgressCallback)(void* pArgs, float pPercentage, const char* pStatus);
00023 
00024 #ifndef FBXSDK_ENV_WINRT
00025     class FbxSpinLock;
00026 #endif
00027 
00031 class FBXSDK_DLL FbxProgress
00032 {
00033 public:
00037     void SetProgressCallback(FbxProgressCallback pCallback, void* pArgs=NULL);
00038 
00042     void SetTotal(float pTotal);
00043 
00047     void SetThreshold(float pThreshold);
00048 
00053     void Update(float pDelta, const char* pStatus=NULL);
00054 
00056     void Reset();
00057 
00061     float GetProgress(FbxString* pStatus=NULL);
00062 
00065     void Complete(const char* pStatus=NULL);
00066 
00068     void Cancel();
00069 
00071     inline bool IsCanceled() const { return mCanceled; }
00072 
00073 /*****************************************************************************************************************************
00074 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
00075 *****************************************************************************************************************************/
00076 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00077     FbxProgress();
00078     ~FbxProgress();
00079 
00080 private:
00081     void Acquire();
00082     void Release();
00083     float GetPercent() const;
00084     bool ExecuteCallback() const;
00085 
00086 #ifndef FBXSDK_ENV_WINRT
00087     FbxSpinLock*        mLock;
00088 #endif
00089     float               mCurrent;
00090     float               mPrevious;
00091     float               mTotal;
00092     float               mThreshold;
00093     FbxString           mStatus;
00094     FbxProgressCallback mCallback;
00095     void*               mCallbackArgs;
00096     bool                mCanceled;
00097 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
00098 };
00099 
00100 #include <fbxsdk/fbxsdk_nsend.h>
00101 
00102 #endif /* _FBXSDK_FILEIO_PROGRESS_H_ */