xo-umbrella2/xo-alloc2/include/xo/alloc2/VisitReason.hpp
Roland Conybeare 6a82040d48 git subrepo clone git@github.com:Rconybea/xo-alloc2.git xo-alloc2
subrepo:
  subdir:   "xo-alloc2"
  merged:   "4039c29f"
upstream:
  origin:   "git@github.com:Rconybea/xo-alloc2.git"
  branch:   "main"
  commit:   "4039c29f"
git-subrepo:
  version:  "0.4.9"
  origin:   "???"
  commit:   "???"
2026-06-06 22:01:14 -04:00

54 lines
1.5 KiB
C++

/** @file VisitReason.hpp
*
* @author Roland Conybeare, Apr 2026
**/
#pragma once
namespace xo {
namespace mm {
/** @brief tag when navigating object graph
*
* Used with
* @ref DX1Collector::visit_child
* @ref GCObject::visit_gco_children
**/
class VisitReason {
public:
enum class code {
invalid = -1,
/** color not needed **/
unspecified,
/** Forward child pointers inplace for GC.
* See @ref GCObjectStore::forward_inplace_aux
**/
forward,
/** verify GC store consistency
* See @ref DX1Collector::_verify_aux
**/
verify,
N,
};
explicit VisitReason(code x) : code_{x} {}
static VisitReason unspecified() { return VisitReason(code::unspecified); }
static VisitReason forward() { return VisitReason(code::forward); }
static VisitReason verify() { return VisitReason(code::verify); }
code code() const noexcept { return code_; }
enum code code_;
};
inline bool operator==(VisitReason x, VisitReason y) { return x.code() == y.code(); }
inline bool operator!=(VisitReason x, VisitReason y) { return x.code() != y.code(); }
} /*namespace mm*/
} /*namespace xo*/
/* end VisitReason.hpp */