마지막으로 부스트 : 프로세스 라이브러리에 대한 이해를 가지고 있다고 생각합니다. 그리고 몇 가지 멤버 변수를 포함하는 상대적으로 간단한 클래스를 다룰 때 성공적으로 사용했습니다. 모든 표준 데이터 유형입니다.Boost :: Interprocess with complex, nested classes
그러나 이제는 다소 복잡한 클래스를 프로세스 공유 메모리로 푸시하는 문제에 직면하고 있으며 운이 전혀 없습니다. 나는 여기 누군가가 도울 수 있기를 바라고있다.
// 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;
}
은 내가해야 할 것은 여러 프로세스가 데이터를 액세스 할 수 있도록 프로세스 간 메모리 공간에서 SharedClass 객체의 벡터를 만드는 것입니다 : 나는 기초가 희망 무엇을 아래로 스트리핑, 나는이 라인을 따라 뭔가를 . 내가 무엇을 시도하든 해결책을 찾지 못하는 것 같습니다. 프로세스 간 버전 (interprocess :: vector, interprocess :: string, offset_ptr 등)을 따라 모든 단일 멤버 변수를 만드는 것보다 쉬운 방법이있는 것 같지만 그렇지 않을 수도 있습니다. 그리고 나서도, 나는 모든 할당 자들과 어떻게 대처할 지 잘 모르겠다. GSL 라이브러리 구조는 말할 것도 없다.
도움말!