ost::RefObject(3)

πŸ“¦ version 1.8.1, in ubuntu jammy

✨ ost::RefObject ✨ β€” from the Library Functions Manual bestie πŸ’…

okay so picture this: you're in ost::RefObject(3) territory, the library functions manual zone, and we're talking about a reference countable object. she's giving main character energy but make it memory management. πŸŽ€


πŸ¦‹ NAME πŸ¦‹

ost::RefObject β€” a reference countable object. that's it, that's the vibe. 🫢


🌸 SYNOPSIS 🌸

#include <object.h>

πŸ’– Public Member Functions πŸ’–

  • virtual void * getObject (void)=0 β€” the actual object being managed can be returned by this method as a void, and then you recast it to the actual type. yes bestie, it's giving type-erasure realness. ✨

πŸ”’ Protected Member Functions πŸ”’

  • RefObject () β€” the constructor simply initializes the count. no cap, that's literally all she does.
  • virtual ~RefObject () β€” the destructor is called when the reference count returns to zero. iconic exit, truly. πŸ’€

πŸŽ€ Protected Attributes πŸŽ€

  • unsigned refCount β€” the count itself. the moment. the number that decides everything. πŸ‘‘

🫢 Friends 🫢

  • class RefPointer

🌈 Detailed Description 🌈

a reference countable object.

this is used in association with smart pointers (RefPointer). they're a duo, fr fr. πŸ¦‹

Author David Sugar dyfet@gnutelephony.org

object managed by smart pointer reference count. periodt. πŸ’…


⭐ Constructor & Destructor Documentation ⭐

🌸 ost::RefObject::RefObject () [inline], [protected] 🌸

the constructor simply initializes the count. lowkey humble, highkey essential.

πŸ’œ virtual ost::RefObject::~RefObject () [protected], [virtual] πŸ’œ

the destructor is called when the reference count returns to zero. this is done through a virtual destructor. so when the last reference dips out, she cleans up after herself β€” graceful. 😭


πŸ”₯ Member Function Documentation πŸ”₯

✨ virtual void* ost::RefObject::getObject (void) [pure virtual] ✨

the actual object being managed can be returned by this method as a void and then recast to the actual type. this removes the need to dynamic cast from RefObject and the dependence on rtti this implies. not me dodging rtti entirely, we love a clean escape. πŸ™ˆ

Returns underlying object being referenced.


πŸ’– friend class RefPointer [friend] πŸ’–


πŸ“ Member Data Documentation πŸ“

πŸ‘‘ unsigned ost::RefObject::refCount [protected] πŸ‘‘


πŸ’œ Author πŸ’œ

generated automatically by Doxygen for GNU CommonC++ from the source code. so like, the robots wrote this one, but i'm here to make it cute. πŸ€–βœ¨


heads up bestie: this is a pure virtual situation up top (getObject is =0), so RefObject is not the one you instantiate directly β€” she's the blueprint, and her destructor is virtual on purpose so the count-to-zero cleanup actually reaches the right subclass. also the constructor and destructor and refCount are all protected, so the outside world is not invited, only RefPointer and friends. iykyk. πŸ”

and that's the whole page, mwah. πŸ’‹ this was rendered for GNU CommonC++, dated Sun Dec 27 2020, and yeah β€” it's ost::RefObject(3). slay, go manage your references responsibly. πŸŽ€πŸ’–πŸ¦‹

πŸ“¦ where this page comes from