vendredi 26 janvier 2018

c++11 vector matrix data writing to mongodb

I try to find a way to write std::vector<matrix<float, 0 , 1 >> id_descriptors; values to the mongodb. I could't find a way to serialize and deserialize the id_descriptor to / from mongodb. It couldbe mostly I am a new sixpack joe to the c++ and getting older (48..:) And also i am from java/scala world (8 years). Sometimes I lost totaly in c++...

I think I can use the same way as writing the png raw binary data to mongodb as below.

bsoncxx::types::b_binary img{bsoncxx::binary_sub_type::k_binary,
                                             uint32_t(buf.size()),
                                             buf.data()};

buf is png image in memory.

In same way :

  for (auto &element : id_descriptors) {

bsoncxx::types::b_binary img{bsoncxx::binary_sub_type::k_binary,
                                                 uint32_t(element.size()),
                                                 element.data()};


}///This way its not working .  

So I can write the binary memory representation of the vector matrix to the mongo. And than I can be (may be ?) reassign the binary data to vector again .

Is this possible ?

How can I achive this ? any help example appreciated.

Aucun commentaire:

Enregistrer un commentaire