OpenViBE forum

The OpenViBE community
It is currently Sat Dec 16, 2017 8:34 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Mon Jul 04, 2016 10:32 am 
Offline

Joined: Sun Jul 03, 2016 1:07 pm
Posts: 3
I am designing a box plugin and would like some functionality to be separated out into another class.

However, I can't seem to write to the LogManager in this other class.

I find that if I pass the logmanager to the class constructor in the box plugin's initialize() function, the logmanager held by the class becomes invalid in process() -- apparently it is destroyed and recreated inbetween these two functions somehow.

Is there a proper way to access logging in another class used by a box plugin?


Top
 Profile  
Reply with quote  
PostPosted: Mon Jul 04, 2016 12:55 pm 
Offline

Joined: Tue Dec 04, 2012 3:53 pm
Posts: 601
Location: INRIA Rennes, FRANCE
Hi Baffo, indeed that is an old design choice that the pointers are invalidated between the process() calls. A working solution is to pass the LogManager to the class each time during process() and pull the logmanager from that. Since its a pointer or a ref, there's not much overhead. Unfortunately this design means that you cannot print to the logmanager from a thread or when the scheduler is not in the scope of executing the box. To get around this, you can buffer the log messages and then send them out during either process() or processClock().

Ps. I imagine the design was due to an expectation that the boxes might migrate from one memory address space to another during runtime (like from a network computer to another)... hasn't happened so far.

Hope this helps,
Jussi


Top
 Profile  
Reply with quote  
PostPosted: Sat Jul 09, 2016 3:31 pm 
Offline

Joined: Sun Jul 03, 2016 1:07 pm
Posts: 3
Thanks, this is the solution I am implementing now.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Americanized by Maƫl Soucaze.