I need to use this from C#, so I've written a C++/CLI wrapper DLL around the class. I'm a little stuck on the method above, as I'm not sure how I can pass a byte buffer from C# and convert it to a vector<char>.
My understanding of C# isn't really up to scratch, but I believe a [font=courier new,courier,monospace]byte[][/font] type is similar to [font=courier new,courier,monospace]std::vector<char>[/font]?
Why? Are you allowed to change the interface? If so, I'd recommend using an iterator version of the code. Otherwise you'll have to copy the byte array into a std::vector.
I'm not very familiar with .NET, so I've just tried to match the interface as closely as possible when writing the CLI wrapper. I've been hunting around for a [font=courier new,courier,monospace]vector<char>[/font] equivalent, but if there's a more sensible alternative I'm all ears!
A few months ago I ported all the Kinect C# code to C++/CLI and it took months. I can't remember exactly, but know that a byte[] is equivalent to unsigned char(Unsigned 8-bit integer). I used regular buffer arrays for my work, I think they were pointers, so I can't help you with that vector signature.
You should be able to get away with a regular [ ] array. Perhaps a ^ handle pointer. Thing is I was porting from C# to C++ and you are doing the opposite, can't help you more than that =/.
I'm not 100%, but from memory, you might have to use a uchar * and point to the first block of memory and pin it in managed code to convert it.
Aha, thanks. I'm note sure that there's actually any way to construct a std::vector<> using pre-allocated memory - so I'm going down the wrong path here. I'll change the interface to accept a pointer and size, and try your suggestion.