Boost logo

Boost Users :

From: Daniel Clemens (phoenix_133_at_[hidden])
Date: 2008-08-18 06:57:49


Hi erveryone,

The goal:
I am currently on a coding project, that offers a common interface for all IPC-Types:
- shared memory
- message-queues
- ...

by meaning interface, I don't want the user to be bothered with the details of Inter process communication.
I just want him to say what type he wants to use and then just use an instance of my class IPC and the read() or write() method, to simply use the according interprocess type provided by boost.

this should be programmed for SLES 10 (=Suse Linux). I would like to have something like:

class IPC{
//Attributes
+ string sName
+ int iStatus
+ iMaxMsgSize
+ iMaxMessages
+ enum ipcType

//Methods
+ IPC();//constructor
+ string read();
+ void write(string);

}//end class

The explanation of the code:

Depending on the type I suggest on creation of an IPC-Instance the rest should be handled by the class - e.g. instanciating a boost::interprocess::message_queue mq( foo ); Now the question I have is, if the containers offer some sort of way of providing this functionality. Maybe I am currently just too blind to find the answer to the problem.

Approaches so far (and failures):

My current approach is, that depending on the type-setting, the read() and write() methods use the boost.Interprocess libraries to ither build a message_queue or a shared memory.

The example provided for message_queues works fine. I then tried to assign an instance of boost::interprocess:message_queue to an attribute of an instance of IPC. But it says I am assigning a temporary to a pointer. I then tried assigning not an address, but to return a boost::interprocess:message_queue instance from the read()-method and assign it to an attribute. It seems it called the copy-constructor and didn't like that approach ither.

Aproach suggestion and questions:
Now I thought that the solution to getting a re-usable message_queue working is to use the pointers provided with the boost::interprocess to assign an instance of the established message-queue to the IPC-instance-Attribute.
Is this the right way of doing this? And if so, could you give me an example?
Thank you!

-- 
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/wasistshortview.php?mc=sv_ext_mf@gmx

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net