Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::GC::Anchored Class Reference

A base class for anchored objects. More...

#include <gc-anchored.h>

Inheritance diagram for Inkscape::GC::Anchored:
Inkscape::XML::Node Inkscape::XML::Document Inkscape::XML::SimpleNode SPCSSAttr Inkscape::XML::SimpleDocument Inkscape::XML::CommentNode Inkscape::XML::ElementNode Inkscape::XML::PINode Inkscape::XML::SimpleDocument Inkscape::XML::TextNode

Classes

struct  Anchor
 

Public Member Functions

void anchor () const
 
void release () const
 
unsigned _anchored_refcount () const
 
 Anchored (Anchored const &)=delete
 
void operator= (Anchored const &)=delete
 

Protected Member Functions

 Anchored ()
 
virtual ~Anchored ()=default
 

Private Member Functions

Anchor_new_anchor () const
 
void _free_anchor (Anchor *anchor) const
 

Private Attributes

Anchor_anchor
 

Detailed Description

A base class for anchored objects.


Objects are managed by our mark-and-sweep collector, but are anchored against garbage collection so long as their reference count is nonzero.

Object and member destructors will not be called on destruction unless a subclass also inherits from Inkscape::GC::Finalized.

New instances of anchored objects should be created using the C++ new operator. Under normal circumstances they should not be created on the stack.

A newly created anchored object begins with a refcount of one, and will not be collected unless the refcount is zero.

NOTE: If you create an object yourself, it is already anchored for you. You do not need to anchor it a second time.

Note that a cycle involving an anchored object (with nonzero refcount) cannot be collected. To avoid this, don't increment refcounts for pointers between two GC-managed objects.

See also
Inkscape::GC::Managed
Inkscape::GC::Finalized
Inkscape::GC::anchor
Inkscape::GC::release

Definition at line 46 of file gc-anchored.h.

Constructor & Destructor Documentation

◆ Anchored() [1/2]

Inkscape::GC::Anchored::Anchored ( Anchored const &  )
delete

◆ Anchored() [2/2]

Inkscape::GC::Anchored::Anchored ( )
inlineprotected

Definition at line 60 of file gc-anchored.h.

References anchor().

◆ ~Anchored()

virtual Inkscape::GC::Anchored::~Anchored ( )
protectedvirtualdefault

Member Function Documentation

◆ _anchored_refcount()

unsigned Inkscape::GC::Anchored::_anchored_refcount ( ) const
inline

Definition at line 52 of file gc-anchored.h.

References _anchor, and Inkscape::GC::Anchored::Anchor::refcount.

Referenced by SPObject::releaseReferences().

◆ _free_anchor()

void Inkscape::GC::Anchored::_free_anchor ( Anchored::Anchor anchor) const
private

Definition at line 61 of file gc-anchored.cpp.

References anchor().

Referenced by release().

◆ _new_anchor()

Anchored::Anchor * Inkscape::GC::Anchored::_new_anchor ( ) const
private

Definition at line 57 of file gc-anchored.cpp.

Referenced by anchor().

◆ anchor()

void Inkscape::GC::Anchored::anchor ( ) const

◆ operator=()

void Inkscape::GC::Anchored::operator= ( Anchored const &  )
delete

◆ release()

Member Data Documentation

◆ _anchor

Anchor* Inkscape::GC::Anchored::_anchor
mutableprivate

Definition at line 73 of file gc-anchored.h.

Referenced by _anchored_refcount(), anchor(), and release().


The documentation for this class was generated from the following files: