Sha256: 7950cdcb9f941aa08a4a1d69ce72373ab737b596d24f3dd440a9214ffa4e589f

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

#ifndef Rice__detail__Wrapper__hpp_
#define Rice__detail__Wrapper__hpp_

#include "ruby.hpp"

namespace Rice
{
namespace detail
{

class Wrapper
{
public:
  virtual ~Wrapper() = default;
  virtual void* get() = 0;

  void ruby_mark();
  void addKeepAlive(VALUE value);

private:
  // We use a vector for speed and memory locality versus a set which does
  // not scale well when getting to tens of thousands of objects (not expecting
  // that to happen...but just in case)
  std::vector<VALUE> keepAlive_;
};

template <typename T, typename Wrapper_T = void>
VALUE wrap(VALUE klass, rb_data_type_t* rb_type, T& data, bool isOwner);

template <typename T, typename Wrapper_T = void>
VALUE wrap(VALUE klass, rb_data_type_t* rb_type, T* data, bool isOwner);

template <typename T>
T* unwrap(VALUE value, rb_data_type_t* rb_type);

Wrapper* getWrapper(VALUE value, rb_data_type_t* rb_type);

void* unwrap(VALUE value);

template <typename T>
void replace(VALUE value, rb_data_type_t* rb_type, T* data, bool isOwner);

Wrapper* getWrapper(VALUE value);

} // namespace detail
} // namespace Rice

#include "Wrapper.ipp"

#endif // Rice__detail__Wrapper__hpp_

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rice-4.0.4 rice/detail/Wrapper.hpp
rice-4.0.3 rice/detail/Wrapper.hpp
rice-4.0.2 rice/detail/Wrapper.hpp
rice-4.0.1 rice/detail/Wrapper.hpp
rice-4.0.0 rice/detail/Wrapper.hpp