#include <frostbite2D/base/RefObject.h>

namespace frostbite2D {

RefObject::RefObject() : ref_count_(0) {}

RefObject::~RefObject() {}

void RefObject::Retain() {
  ++ref_count_;
}

void RefObject::Release() {
  --ref_count_;
  if (ref_count_ == 0) {
    delete this;
  }
}

uint32_t RefObject::GetRefCount() const {
  return ref_count_.load();
}

}
