Difficulty getting import session progress

amuravievQ565R
Contributor

Difficulty getting import session progress

amuravievQ565R
Contributor
Contributor

Hello,

 

Callback functions can be passed into the init() method to receive progress information:

 static Foundation::RCSharedPtr<RCProjectImportSession> init(const Foundation::RCString& projectFilePath, Foundation::RCFileMode fileMode,
Foundation::RCCode& errorCode,
RCImportProgressCallbackPtr projectProgressCallback = nullptr,
RCImportCompletionCallbackPtr projectCompletionCallback = nullptr);

 

    typedef void (*RCImportProgressCallbackPtr)(const RCIOStatus& status);
    typedef void (*RCImportCompletionCallbackPtr)(Foundation::RCCode errorCode, const Foundation::RCBuffer<RCScanImportStatus>& importStatus);
    typedef void (*RCScanImportCompletionCallbackPtr)(const RCScanImportStatus& importStatus);

 

The problem is that these cannot be pointers to class members., which significantly limits and complicates their use.

 

I have to make them global functions that will change global variables (protected by a global mutex), and my class will read these global variables. Moreover, to read I have to create a separate thread, which needs to be terminated correctly in case of an error... This will inevitably lead to errors.

 

Is it possible to change them to std::function?

 

Or maybe I just didn't figure out how to use them correctly? 

 

Best regards,

Aleksei

 

0 Likes
Reply
116 Views
0 Replies
Replies (0)