diff options
| author | Tyge Løvset <[email protected]> | 2022-12-30 18:45:56 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-12-30 18:45:56 +0100 |
| commit | e124d8c7377de1dfce45790a196312596f6b9be5 (patch) | |
| tree | 528ebcc735cdb5d958b987c886d369bc02a11320 /docs | |
| parent | 4f0f45422fb58e9b134445ad6a4ea96d806214e8 (diff) | |
| download | STC-modified-e124d8c7377de1dfce45790a196312596f6b9be5.tar.gz STC-modified-e124d8c7377de1dfce45790a196312596f6b9be5.zip | |
Fixed carc and cbox docs. Added cbox_X_assign() : transfer ownership between cboxes.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/carc_api.md | 10 | ||||
| -rw-r--r-- | docs/cbox_api.md | 14 |
2 files changed, 12 insertions, 12 deletions
diff --git a/docs/carc_api.md b/docs/carc_api.md index 657d7257..f91975a7 100644 --- a/docs/carc_api.md +++ b/docs/carc_api.md @@ -36,14 +36,14 @@ See similar c++ class [std::shared_ptr](https://en.cppreference.com/w/cpp/memory ## Methods ```c carc_X carc_X_init(); // empty shared pointer -carc_X carc_X_new(i_valraw raw); // create an carc from raw type (available if i_valraw defined by user). -carc_X carc_X_from(i_val val); // create an carc from constructed val object. Faster than from_ptr(). +carc_X carc_X_from(i_valraw raw); // create an carc from raw type (available if i_valraw defined by user). carc_X carc_X_from_ptr(i_val* p); // create an carc from raw pointer. Takes ownership of p. +carc_X carc_X_make(i_val val); // create an carc from constructed val object. Faster than from_ptr(). carc_X carc_X_clone(carc_X other); // return other with increased use count -carc_X carc_X_move(carc_X* self); // transfer ownership to another carc. -void carc_X_take(carc_X* self, carc_X other); // take ownership of other. -void carc_X_copy(carc_X* self, carc_X other); // shared assign (increase use count) +carc_X carc_X_move(carc_X* self); // transfer ownership to receiver; self becomes NULL +void carc_X_take(carc_X* self, carc_X unowned); // take ownership of unowned. +void carc_X_assign(carc_X* self, carc_X other); // shared assign (increases use count) void carc_X_drop(carc_X* self); // destruct (decrease use count, free at 0) long carc_X_use_count(const carc_X* self); diff --git a/docs/cbox_api.md b/docs/cbox_api.md index 5f936b1c..8906f154 100644 --- a/docs/cbox_api.md +++ b/docs/cbox_api.md @@ -35,15 +35,15 @@ compare the pointer addresses when used. Additionally, `c_no_clone` or `i_is_fwd ## Methods ```c cbox_X cbox_X_init(); // return an empty cbox -cbox_X cbox_X_new(i_valraw raw); // create a cbox from raw type. Avail if i_valraw user defined. -cbox_X cbox_X_from(i_val val); // create a cbox from constructed val object. -cbox_X cbox_X_from_ptr(i_val* p); // create a cbox from a pointer. Takes ownership of p. +cbox_X cbox_X_from(i_valraw raw); // create a cbox from raw type. Avail if i_valraw user defined. +cbox_X cbox_X_from_ptr(i_val* ptr); // create a cbox from a pointer. Takes ownership of ptr. +cbox_X cbox_X_make(i_val val); // create a cbox from unowned val object. cbox_X cbox_X_clone(cbox_X other); // return deep copied clone -cbox_X cbox_X_move(cbox_X* self); // transfer ownership to another cbox. -void cbox_X_take(cbox_X* self, cbox_X other); // take ownership of other. -void cbox_X_copy(cbox_X* self, cbox_X other); // deep copy to self -void cbox_X_drop(cbox_X* self); // destruct the contained object and free's it. +cbox_X cbox_X_move(cbox_X* self); // transfer ownership to receiving cbox returned. self becomes NULL. +void cbox_X_take(cbox_X* self, cbox_X unowned); // take ownership of unowned box object. +void cbox_X_assign(cbox_X* self, cbox_X* dying); // transfer ownership from dying to self; dying becomes NULL. +void cbox_X_drop(cbox_X* self); // destruct the contained object and free its heap memory. void cbox_X_reset(cbox_X* self); void cbox_X_reset_to(cbox_X* self, i_val* p); // assign new cbox from ptr. Takes ownership of p. |
