// // // Copyright 2017 gRPC authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // #ifndef GRPC_SRC_CORE_LIB_GPRPP_REF_COUNTED_PTR_H #define GRPC_SRC_CORE_LIB_GPRPP_REF_COUNTED_PTR_H #include <grpc/support/port_platform.h> #include <iosfwd> #include <type_traits> #include <utility> #include "src/core/lib/gprpp/debug_location.h" namespace grpc_core { // A smart pointer class for objects that provide IncrementRefCount() and // Unref() methods, such as those provided by the RefCounted base class. template <typename T> class RefCountedPtr { … }; // A smart pointer class for objects that provide IncrementWeakRefCount() and // WeakUnref() methods, such as those provided by the DualRefCounted base class. template <typename T> class WeakRefCountedPtr { … }; template <typename T, typename... Args> inline RefCountedPtr<T> MakeRefCounted(Args&&... args) { … } template <typename T> bool operator<(const RefCountedPtr<T>& p1, const RefCountedPtr<T>& p2) { … } template <typename T> bool operator<(const WeakRefCountedPtr<T>& p1, const WeakRefCountedPtr<T>& p2) { … } } // namespace grpc_core #endif // GRPC_SRC_CORE_LIB_GPRPP_REF_COUNTED_PTR_H