I want to quickly pass an object containing a vector of pointers to another process. This is what I'm trying to send:
typedef std::vector<Shelve*> ShelveVec;
This is what I've tried:
managed_shared_memory segment{create_only, "HwDescriptionObjects", 1056};
BeBoardInterface *sBeBoardInterface = segment.construct<BeBoardInterface>("BeBoardInterface")(fBeBoardFWMap);
CbcInterface *sCbcInterface = segment.construct<CbcInterface>("CbcInterface")(fBeBoardFWMap);
ShelveVec *sShelveVector = segment.construct<ShelveVec>("ShelveVector")(fShelveVector, alloc_inst);
qDebug() << "Size " << sShelveVector->size();
The first two shared memory objects work but I've tried the vector which I understand from reading the BOOST documentation is a little trickier to implement due to things like the begin
pointer allocation. When accessed from the process, it ends up being empty.
Is this possible to do or not?
EDIT, As much info as I can give:
I do a series of loops to initialise these classes:
uint32_t cNShelve = 0
for(auto &kv : mapSettings.keys())
{
cShelveId=kv;
fShelveVector.push_back(new Shelve(cShelveId));
for(auto &kv_ : mapSettings.value(kv).keys()):
{
cBeId = kv_;
BeBoard* cBeBoard = new BeBoard(cShelveId, cBeId);
fShelveVector.at(cNShelve)->addBoard(cBeBoard);
}
cNShelve++;
}
Edit2: A cheap solution:
managed_shared_memory segment{create_only, "HwDescriptionObjects", 1056};
uint32_t cNShelve = 0
for(auto &kv : mapSettings.keys())
{
cShelveId=kv;
Shelve *sShelve = segment.construct<Shelve>("Shelve")(cShelveId)
fShelveVector->push_back(sShelve);
for(auto &kv_ : mapSettings.value(kv).keys()):
{
cBeId = kv_;
BeBoard* cBeBoard = segment.construct<BeBoard>("BeBoard")(cShelveId, cBeId);
fShelveVector.at(cNShelve)->addBoard(cBeBoard);
}
cNShelve++;
}