SC_REF(3)

πŸ“¦
version 2.3.1 Β· 5 versions
, in ubuntu jammy

πŸ’– sc::Ref< T >(3) β€” MPQC manual page, bestie ✨

okay so this is the full sc::Ref< T > manual-page moment from MPQC. This template class is lowkey iconic, it's giving template-class main character energy, and we're gonna cover every single detail. Slay. 🫢

🌸 NAME 🌸

sc::Ref< T > β€” A template class that maintains references counts.

✨ SYNOPSIS ✨

#include <ref.h>
  • Inherits sc::RefBase.

πŸ‘‘ Public Member Functions πŸ‘‘

  • Ref () β€” Create a reference to a null object.
  • Ref (T *a) β€” Create a reference to the object a.
  • Ref (const Ref< T > &a) β€” Create a reference to the object referred to by a.
  • template<class A > Ref (const Ref< A > &a) β€” Create a reference to the object referred to by a.
  • ~Ref () β€” Delete this reference to the object.
  • T * operator-> () const β€” Returns the reference counted object.
  • T * pointer () const β€” Returns a pointer to the reference counted object.
  • RefCount * parentpointer () const β€” Implements the parentpointer pure virtual in the base class.
  • operator T* () const β€” no separate description in the source; it's just vibing there, bestie. πŸ’…
  • T & operator* () const β€” Returns a C++ reference to the reference counted object.
  • int null () const β€” Return 1 if this is a reference to a null object.
  • int nonnull () const β€” Return !null().
  • template<class A > int operator== (const Ref< A > &a) const β€” A variety of ordering and equivalence operators are provided using the Identity class.
  • template<class A > int operator>= (const Ref< A > &a) const β€” part of that same ordering/equivalence set from the source; no separate blurb listed.
  • template<class A > int operator<= (const Ref< A > &a) const β€” same energy, no separate blurb listed.
  • template<class A > int operator> (const Ref< A > &a) const β€” same energy, no separate blurb listed.
  • template<class A > int operator< (const Ref< A > &a) const β€” same energy, no separate blurb listed.
  • template<class A > int operator!= (const Ref< A > &a) const β€” same energy, no separate blurb listed.
  • int compare (const Ref< T > &a) const β€” Compare two objects returning -1, 0, or 1.
  • void clear () β€” Refer to the null object.
  • Ref< T > & operator= (const Ref< T > &c) β€” Assignment to c.
  • template<class A > Ref< T > & operator= (const Ref< A > &c) β€” Assignment to c.
  • Ref< T > & operator<< (const RefBase &a) β€” Assignment to the object that a references using dynamic_cast.
  • Ref< T > & operator<< (RefCount *a) β€” Assigns to the given base class pointer using dynamic_cast.
  • Ref< T > & operator= (T *cr) β€” Assignment to cr.
  • void assign_pointer (T *cr) β€” Assignment to cr.
  • void check_pointer () const β€” Check the validity of the pointer.
  • void ref_info (std::ostream &os) const β€” Print information about the reference to os.
  • void warn (const char *s) const β€” Print a warning concerning the reference.

πŸ¦‹ Additional Inherited Members πŸ¦‹

The source page literally just has this heading and then moves on β€” no extra member details listed here, bestie. So we're not inventing any. Periodt. πŸ’…

πŸ’œ Detailed Description πŸ’œ

template<class T>
class sc::Ref< T >" A template class that maintains references counts.

Several of these operations can cause a reference to an object to be replaced by a reference to a different object. If a reference to a nonnull object is eliminated, the object's reference count is decremented and the object is deleted if the reference count becomes zero. That's the lifecycle vibe. ✨

The source also has this line, and I'm quoting it because the wording is a little wild: "There also may be a to convert to T*, where T is the type of the object which Ref references." Some compilers have bugs that prevent the use of operator T*(). The pointer() member should be used instead β€” fr fr, ngl, use pointer().

πŸŽ€ Constructor & Destructor Documentation πŸŽ€

🧚 template<class T > sc::Ref< T >::~Ref () [inline]

Delete this reference to the object. Decrement the object's reference count and delete the object if the count is zero. πŸ’–

🌈 Member Function Documentation 🌈

⭐ template<class T > int sc::Ref< T >::compare (const Ref< T > & a) const [inline]

Compare two objects returning -1, 0, or 1. Similar to the C library routine strcmp. πŸ’…

⭐ template<class T > int sc::Ref< T >::null () const [inline]

Return 1 if this is a reference to a null object. Otherwise return 0.

⭐ template<class T > T& sc::Ref< T >::operator* () const [inline]

Returns a C++ reference to the reference counted object. The behaviour is undefined if the object is null.

⚠️ Undefined behaviour if the object is null β€” do not test that, bestie. 😭

⭐ template<class T > T* sc::Ref< T >::operator-> () const [inline]

Returns the reference counted object. The behaviour is undefined if the object is null.

⚠️ Again: undefined behaviour if the object is null. Do not play with that. 😭

⭐ template<class T > Ref<T>& sc::Ref< T >::operator<< (RefCount * a) [inline]

Assigns to the given base class pointer using dynamic_cast. If the dynamic_cast fails and the argument is nonnull and has a reference count of zero, then it is deleted. πŸ”₯

🌸 Author 🌸

Generated automatically by Doxygen for MPQC from the source code.


okay bestie, that's the whole page. Version 2.3.1, dated Sun Oct 4 2020, and we're out. πŸ’‹βœ¨

πŸ“¦ where this page comes from