[CXX-533] Expose underlying C handles from C++ driver Created: 17/Feb/15  Updated: 24/Apr/15  Resolved: 19/Feb/15

Status: Closed
Project: C++ Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 0.1.0

Type: New Feature Priority: Major - P3
Reporter: Jonathan Reams Assignee: Tyler Brock
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: PM-123

 Description   

In the new (C++11) driver, there are features implemented in the C driver that aren't in the C++ driver. It would be useful for each C++ object that has an underlying mongoc driver object to expose that object so you can fall back to using the C driver functions without constructing a new client. An example would be gridfs, where the C driver has gridfs functions that require a mongoc_client_t.



 Comments   
Comment by Githook User [ 19/Feb/15 ]

Author:

{u'username': u'TylerBrock', u'name': u'Tyler Brock', u'email': u'tyler.brock@gmail.com'}

Message: CXX-533 safely expose implementation to users
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/bf1624b675877c6fde682912773e415352cc268b

Comment by Andrew Morrow (Inactive) [ 18/Feb/15 ]

Maybe, but I'm not sure how much we would gain. I also think it should be possible for the implementation to decline to provide the underlying handle, in case it isn't built above the C driver.

So, something like:

stdx::optional<void*> Collection::implementation_handle() const;

Comment by Adam Midvidy [ 17/Feb/15 ]

could we provide an alias type like std::thread::native_handle ?

Comment by Andrew Morrow (Inactive) [ 17/Feb/15 ]

We should probably return these as raw void*'s and require the user to cast them, so that we don't leak any C driver interfaces. That said, I agree this is a useful feature, and fairly easy to implement.

Generated at Wed Feb 07 21:59:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.