Add example for using pool as a class member#1032
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1032 +/- ##
==========================================
- Coverage 94.25% 94.06% -0.20%
==========================================
Files 48 48
Lines 4720 4750 +30
==========================================
+ Hits 4449 4468 +19
- Misses 271 282 +11
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
igchor
left a comment
There was a problem hiding this comment.
Reviewed 2 of 4 files at r1.
Reviewable status: 2 of 4 files reviewed, 1 unresolved discussion (waiting on @karczex)
examples/pool/pool_as_class_member.cpp, line 26 at r1 (raw file):
/* pool object */ pmem::obj::pool<persistent_data> pop; /* Pointer to data. */
?
lukaszstolarczuk
left a comment
There was a problem hiding this comment.
Reviewed 3 of 4 files at r1.
Reviewable status: 3 of 4 files reviewed, 6 unresolved discussions (waiting on @karczex)
a discussion (no related file):
in the commit message:
- Please drop "I added" ;) (and re-phrase I guess)
it's data->its data
examples/pool/pool_as_class_member.cpp, line 40 at r1 (raw file):
std::cerr << "Cannot open pool: " << e.what() << std::endl << "Trying to create new one " << std::endl;
a new one
examples/pool/pool_as_class_member.cpp, line 44 at r1 (raw file):
PMEMOBJ_MIN_POOL); } /* Assign persistent poiner to root object. */
- pointer (misspell)
- to the root object
examples/pool/pool_as_class_member.cpp, line 64 at r1 (raw file):
increment() { auto root_obj = pop.root();
maybe don't duplicate code - use set(x+1)
examples/pool/pool_as_class_member.cpp, line 72 at r1 (raw file):
print() { auto root_obj = pop.root();
you don't need this line, just use it below
KFilipek
left a comment
There was a problem hiding this comment.
Reviewed 4 of 4 files at r1.
Reviewable status: all files reviewed, 9 unresolved discussions (waiting on @karczex)
examples/pool/pool_as_class_member.cpp, line 28 at r1 (raw file):
/* Pointer to data. */ static constexpr const char *layout = "pool_layout";
const char* is not enough?
examples/pool/pool_as_class_member.cpp, line 41 at r1 (raw file):
pop = pool<persistent_data>::create("poolfile", layout, PMEMOBJ_MIN_POOL);
if pop is still nullptr then try to create instead of doing work under risk in catch clause outside of try block
examples/pool/pool_as_class_member.cpp, line 46 at r1 (raw file):
/* Assign persistent poiner to root object. */ }
Foo() = delete;
|
examples/pool/pool_as_class_member.cpp, line 72 at r1 (raw file): Previously, lukaszstolarczuk (Łukasz Stolarczuk) wrote…
Done. |
|
examples/pool/pool_as_class_member.cpp, line 64 at r1 (raw file): Previously, lukaszstolarczuk (Łukasz Stolarczuk) wrote…
Done. |
|
examples/pool/pool_as_class_member.cpp, line 46 at r1 (raw file): Previously, KFilipek (Krzysztof Filipek) wrote…
Done. |
|
examples/pool/pool_as_class_member.cpp, line 41 at r1 (raw file): Previously, KFilipek (Krzysztof Filipek) wrote…
Done. |
|
examples/pool/pool_as_class_member.cpp, line 40 at r1 (raw file): Previously, lukaszstolarczuk (Łukasz Stolarczuk) wrote…
Done. |
|
examples/pool/pool_as_class_member.cpp, line 28 at r1 (raw file): Previously, KFilipek (Krzysztof Filipek) wrote…
Done. |
|
examples/pool/pool_as_class_member.cpp, line 26 at r1 (raw file): Previously, igchor (Igor Chorążewicz) wrote…
Done. |
a376a3b to
4f86e17
Compare
|
a discussion (no related file): Previously, lukaszstolarczuk (Łukasz Stolarczuk) wrote…
Done. |
lukaszstolarczuk
left a comment
There was a problem hiding this comment.
Reviewed 3 of 3 files at r2.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @igchor, @karczex, and @KFilipek)
include/libpmemobj++/pool.hpp, line 47 at r2 (raw file):
* @snippet pool/pool.cpp pool_base_example * * The exmple of using pool with RAII idom:
idiom
karczex
left a comment
There was a problem hiding this comment.
Reviewable status: 3 of 4 files reviewed, 5 unresolved discussions (waiting on @igchor, @KFilipek, and @lukaszstolarczuk)
examples/pool/pool_as_class_member.cpp, line 44 at r1 (raw file):
Previously, lukaszstolarczuk (Łukasz Stolarczuk) wrote…
- pointer (misspell)
- to the root object
Done.
include/libpmemobj++/pool.hpp, line 47 at r2 (raw file):
Previously, lukaszstolarczuk (Łukasz Stolarczuk) wrote…
idiom
Done.
lukaszstolarczuk
left a comment
There was a problem hiding this comment.
Reviewed 1 of 1 files at r3.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @igchor and @KFilipek)
KFilipek
left a comment
There was a problem hiding this comment.
Reviewed 1 of 3 files at r2, 1 of 1 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @igchor)
KFilipek
left a comment
There was a problem hiding this comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @igchor)
igchor
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! all files reviewed, all discussions resolved (waiting on @karczex)
I added example for this, as it's not obvious at the first glance how
to handle pool as class member, and how to access it's data.
This change is