Sha256: 158b6d4df30f6e88016d7c950a3665a677a4752fce3daea357ddab684b3a1d44

Contents?: true

Size: 786 Bytes

Versions: 1

Compression:

Stored size: 786 Bytes

Contents

#ifndef Rice__detail__NativeRegistry__hpp
#define Rice__detail__NativeRegistry__hpp

#include <unordered_map>
#include <any>
#include <tuple>

#include "ruby.hpp"

namespace Rice::detail
{
  class NativeRegistry
  {
  public:
    // Add a new native callable object keyed by Ruby class and method_id
    void add(VALUE klass, ID method_id, std::any callable);

    // Returns the Rice data for the currently active Ruby method
    template <typename Return_T>
    Return_T lookup();

    template <typename Return_T>
    Return_T lookup(VALUE klass, ID method_id);

  private:
    size_t key(VALUE klass, ID method_id);
    std::unordered_multimap<size_t, std::tuple<VALUE, ID, std::any>> natives_ = {};
  };
}
#include "NativeRegistry.ipp"

#endif // Rice__detail__NativeRegistry__hpp

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rice-4.3.2 rice/detail/NativeRegistry.hpp