I think I finally have a grasp on the basics of the boost:interprocess library, and I've been using it successfully when dealing with relatively simple classes that contain a few member variables that are all standard data types.
However, I am now faced with the problem of pushing a rather complex class out into interprocess shared memory and I'm having no luck at all. I'm hoping someone here can help (or can steer me towards an alternate solution). Stripping it down to what I hope are the basics, I have something along these lines:
// these first two classes are from the Gnu Scientific Library, so I can't
// (or won't) be able to mess with the definition of these structures.
typedef struct
{
size_t size1;
size_t size2;
size_t tda;
double * data;
gsl_block * block;
int owner;
} gsl_matrix;
typedef struct
{
size_t size1;
size_t size2;
size_t tda;
int * data;
gsl_block_int * block;
int owner;
} gsl_matrix_int;
class MyNumbersClass
{
gsl_matrix_int* m_pIntMatrix;
gsl_matrix* m_pDblMatrix;
unsigned int iVal1;
unsigned int iVal2;
}
class MyOtherDataClass
{
std::vector<int> m_vInputs;
std::vector<double> m_vOutputs;
std::string m_sTitle;
bool m_bCorrect;
}
class SharedClass
{
MyNumbersClass* m_pFirstNumbers;
std::vector<double> m_vDblData;
std::vector<MyOtherDataClass> m_vOtherData;
}
What I need to do is create a vector of SharedClass objects in the interprocess memory space so that multiple processes can access the data. No matter what I try, I cannot seem to find a solution. It seems like there should be an easier way than making every single member variable along the way an interprocess version (interprocess::vector, interprocess::string, offset_ptr, etc), but maybe not. And even then, I'm not sure how to deal with all the allocators and such, not to mention the GSL library structures.
Help!