#ifndef BABELTRACE_CPP_COMMON_BT2_INTEGER_RANGE_HPP
#define BABELTRACE_CPP_COMMON_BT2_INTEGER_RANGE_HPP
-#include <type_traits>
#include <cstdint>
+#include <type_traits>
+
#include <babeltrace2/babeltrace.h>
-#include "internal/borrowed-obj.hpp"
+#include "borrowed-object.hpp"
namespace bt2 {
-
namespace internal {
template <typename ValueT>
} /* namespace internal */
template <typename LibObjT>
-class ConstIntegerRange final : public internal::BorrowedObj<LibObjT>
+class ConstIntegerRange final : public BorrowedObject<LibObjT>
{
private:
- using typename internal::BorrowedObj<LibObjT>::_ThisBorrowedObj;
- using typename internal::BorrowedObj<LibObjT>::_LibObjPtr;
- using _ThisConstIntegerRange = ConstIntegerRange<LibObjT>;
+ using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
public:
+ using typename BorrowedObject<LibObjT>::LibObjPtr;
+
using Value =
typename std::conditional<std::is_same<LibObjT, const bt_integer_range_unsigned>::value,
std::uint64_t, std::int64_t>::type;
public:
- explicit ConstIntegerRange(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObj {libObjPtr}
- {
- }
-
- ConstIntegerRange(const _ThisConstIntegerRange& range) noexcept : _ThisBorrowedObj {range}
- {
- }
-
- _ThisConstIntegerRange& operator=(const _ThisConstIntegerRange& range) noexcept
+ explicit ConstIntegerRange(const LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr}
{
- _ThisBorrowedObj::operator=(range);
- return *this;
}
- bool operator==(const _ThisConstIntegerRange& other) const noexcept
+ bool operator==(const ConstIntegerRange& other) const noexcept
{
- return internal::ConstIntegerRangeSpec<LibObjT>::isEqual(this->_libObjPtr(),
- other._libObjPtr());
+ return internal::ConstIntegerRangeSpec<LibObjT>::isEqual(this->libObjPtr(),
+ other.libObjPtr());
}
- bool operator!=(const _ThisConstIntegerRange& other) const noexcept
+ bool operator!=(const ConstIntegerRange& other) const noexcept
{
return !(*this == other);
}
Value lower() const noexcept
{
- return internal::ConstIntegerRangeSpec<LibObjT>::lower(this->_libObjPtr());
+ return internal::ConstIntegerRangeSpec<LibObjT>::lower(this->libObjPtr());
}
Value upper() const noexcept
{
- return internal::ConstIntegerRangeSpec<LibObjT>::upper(this->_libObjPtr());
+ return internal::ConstIntegerRangeSpec<LibObjT>::upper(this->libObjPtr());
}
};