From: Chris J. <ch...@bu...> - 2008-01-15 21:12:34
|
On 15 Jan 2008 14:23:33 +0100, Tommy Persson <tp...@id...> wrote: > > I tried to use Minion in another program but noticed that the code > does not seem to be written with that in mind. For example a lot of > the header files are missin guards for including it more than > once. That I could work around but I then got some problems with > internal states. It works the first call but in the second call > internal variables and locks are not cleared. I tested with the 0.4.1 > version > > What I wanted to have was a CORBA server that recieved requests to > solve a problem and i wanted to use Minion internally. Is this > possible with a reasonable amount of work or shoud I give up? Hi Tommy, Using the new svn version, this is somewhat easier. The way I would advising doing this consists of two tasks: 1) Build a CSPInstance that represents your CSP. You can either do this by looking at how the parser does it, or by building a text representation of your CSP and feeding it into the existing parser. This would actually be quite easy, as ConcreteFileReader can be templated by an std::ostringstream, so you could turn your CSP into a string, then feed it in, without having to write to a file. 2) The new 'stateObj' framework allows multiple CSPs to be constructed. Note that you can still only use each 'stateObj' for one CSP, after you've used it you'll have to delete it and then make a new one for a new CSP. Make sure you compile with the 'REENTER' flag turned on if you want to use stateObj. Without this flag some hacks are performed to ensure only one stateObj can be used. This speeds things up but means you can only solve one problem in any once instance. While what you are talking about is certainly possible, as you've found Minion has not really been designed to be a well-behaved library. It can certainly be used as a library, and I have in a couple of applications, but it requires some work and there is a reasonable good chance you will find a bug or two along the way. Of course, we'll try to fix any bugs you find, but it's likely to be a bit of work. Sorry if this sounds worrying.. Chris |