Make PtrXXX() family of functions public

PiperOrigin-RevId: 413616359
Change-Id: I553c17f0668708b00fdb12a21109ed45aeba6c66
This commit is contained in:
Christian Blichmann 2021-12-02 01:41:26 -08:00 committed by Copybara-Service
parent a096056263
commit 4a6e005155
6 changed files with 5 additions and 25 deletions

View File

@ -64,6 +64,8 @@ class Var : public Pointable {
Var(const Var&) = delete; Var(const Var&) = delete;
Var& operator=(const Var&) = delete; Var& operator=(const Var&) = delete;
virtual ~Var();
// Returns the address of the storage (remote side). // Returns the address of the storage (remote side).
virtual void* GetRemote() const { return remote_; } virtual void* GetRemote() const { return remote_; }
@ -85,17 +87,15 @@ class Var : public Pointable {
// Returns a string representation of the variable value. // Returns a string representation of the variable value.
virtual std::string ToString() const = 0; virtual std::string ToString() const = 0;
virtual ~Var();
protected:
Var() = default;
// Functions to get pointers with certain type of synchronization schemes. // Functions to get pointers with certain type of synchronization schemes.
Ptr* PtrNone(); Ptr* PtrNone();
Ptr* PtrBoth(); Ptr* PtrBoth();
Ptr* PtrBefore(); Ptr* PtrBefore();
Ptr* PtrAfter(); Ptr* PtrAfter();
protected:
Var() = default;
// Set pointer to local storage class. // Set pointer to local storage class.
void SetLocal(void* local) { local_ = local; } void SetLocal(void* local) { local_ = local; }

View File

@ -35,10 +35,6 @@ namespace sapi::v {
template <class T> template <class T>
class Array : public Var { class Array : public Var {
public: public:
using Var::PtrAfter;
using Var::PtrBefore;
using Var::PtrBoth;
// The array is not owned by this object. // The array is not owned by this object.
Array(T* arr, size_t nelem) Array(T* arr, size_t nelem)
: arr_(arr), : arr_(arr),

View File

@ -28,10 +28,6 @@ namespace sapi::v {
template <class T> template <class T>
class IntBase : public Reg<T> { class IntBase : public Reg<T> {
public: public:
using Var::PtrAfter;
using Var::PtrBefore;
using Var::PtrBoth;
explicit IntBase(T value = {}) { this->SetValue(value); } explicit IntBase(T value = {}) { this->SetValue(value); }
}; };

View File

@ -37,10 +37,6 @@ class Proto;
// use protobufs as they are easier to handle. // use protobufs as they are easier to handle.
class LenVal : public Var { class LenVal : public Var {
public: public:
using Var::PtrAfter;
using Var::PtrBefore;
using Var::PtrBoth;
explicit LenVal(const char* data, uint64_t size) explicit LenVal(const char* data, uint64_t size)
: array_(const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(data)), : array_(const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(data)),
size), size),

View File

@ -38,10 +38,6 @@ class Proto : public Var {
static_assert(std::is_base_of<google::protobuf::Message, T>::value, static_assert(std::is_base_of<google::protobuf::Message, T>::value,
"Template argument must be a proto message"); "Template argument must be a proto message");
using Var::PtrAfter;
using Var::PtrBefore;
using Var::PtrBoth;
ABSL_DEPRECATED("Use Proto<>::FromMessage() instead") ABSL_DEPRECATED("Use Proto<>::FromMessage() instead")
explicit Proto(const T& proto) explicit Proto(const T& proto)
: wrapped_var_(SerializeProto(proto).value()) {} : wrapped_var_(SerializeProto(proto).value()) {}

View File

@ -27,10 +27,6 @@ namespace sapi::v {
template <class T> template <class T>
class Struct : public Var { class Struct : public Var {
public: public:
using Var::PtrAfter;
using Var::PtrBefore;
using Var::PtrBoth;
// Forwarding constructor to initalize the struct_ field. // Forwarding constructor to initalize the struct_ field.
template <typename... Args> template <typename... Args>
explicit Struct(Args&&... args) : struct_(std::forward<Args>(args)...) { explicit Struct(Args&&... args) : struct_(std::forward<Args>(args)...) {