sapling/eden/fs/inodes/InodePtr-defs.h
Adam Simpkins aa5e6c7295 update license headers in C++ files
Summary:
Update the copyright & license headers in C++ files to reflect the
relicensing to GPLv2

Reviewed By: wez

Differential Revision: D15487078

fbshipit-source-id: 19f24c933a64ecad0d3a692d0f8d2a38b4194b1d
2019-06-19 17:02:45 -07:00

71 lines
1.6 KiB
C++

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
#pragma once
/*
* This file contains definitions of a few simple and commonly called
* InodePtrImpl methods. It is useful for callers to see the definition of
* these methods so they can be inlined.
*
* This file is included automatically by InodeBase.h
*/
#include "InodePtr.h"
#include "InodeBase.h"
namespace facebook {
namespace eden {
template <typename InodeType>
InodePtrImpl<InodeType>::InodePtrImpl(
InodeType* value,
NormalIncrementEnum) noexcept
: value_(value) {
if (value_) {
value_->incrementPtrRef();
}
}
template <typename InodeType>
InodePtrImpl<InodeType>::InodePtrImpl(
InodeType* value,
LockedIncrementEnum) noexcept
: value_(value) {
// We don't check for value_ == nullptr here.
// The caller should always ensure the argument is non-null for this call.
value_->newInodeRefConstructed();
}
template <typename InodeType>
void InodePtrImpl<InodeType>::incref() {
if (value_) {
value_->incrementPtrRef();
}
}
template <typename InodeType>
void InodePtrImpl<InodeType>::decref() {
if (value_) {
value_->decrementPtrRef();
}
}
template <typename InodeType>
void InodePtrImpl<InodeType>::manualDecRef() {
CHECK_NOTNULL(value_);
value_->decrementPtrRef();
}
template <typename InodeType>
void InodePtrImpl<InodeType>::resetNoDecRef() {
CHECK_NOTNULL(value_);
value_ = nullptr;
}
} // namespace eden
} // namespace facebook