T
tech
Hi, I need to pass a block of say 320 bytes memory between some
classes
which do various processing on it. The app needs to be quick so i
can't
keep copying.
The simplest way is via pointer say:
class A
{
void Transmitdata(const short* data, size_t Insize, char* output,
size_t OutSize)
{
// do some processing on data
}
};
alternative which seems to be a lot safer is
void Transmitdata(const std::vector<short>& buf, std::vector<char>&
outBuf)
{
}
The vectors know there size so each class doesn't need to worry about
the size
of data the pointers are pointing to
Its just that the block of memory i want to pass around is in some
shared memory
area and i can't overlay a vector onto a block of memory as it makes a
copy so at present
i'm just stuck with the pointers. Anyone know a way round this?
classes
which do various processing on it. The app needs to be quick so i
can't
keep copying.
The simplest way is via pointer say:
class A
{
void Transmitdata(const short* data, size_t Insize, char* output,
size_t OutSize)
{
// do some processing on data
}
};
alternative which seems to be a lot safer is
void Transmitdata(const std::vector<short>& buf, std::vector<char>&
outBuf)
{
}
The vectors know there size so each class doesn't need to worry about
the size
of data the pointers are pointing to
Its just that the block of memory i want to pass around is in some
shared memory
area and i can't overlay a vector onto a block of memory as it makes a
copy so at present
i'm just stuck with the pointers. Anyone know a way round this?