module Qpid::Proton::Util::SwigHelper

Provides helper functions for writing wrapper functions for the underlying C APIs.

Before defining any mutators the class must define the name of the prefix for methods with the constant PROTON_METOD_PREFIX.

Mutators, Setters And Getters

There are three types of wrappers that are supported:

proton_writer

Defines a set-only method for the named attribute.

proton_reader

Defines a get-only method for the named attribute.

proton_accessor

Defines both a set- and a get-method for the named

attribute.
proton_caller

A simple wrapper for calling an underlying method,

avoids repetitive boiler plate coding.

Arguments

:is_or_get => {:is, :get}

For both the getter and the mutator types

you can also declare that the method uses “is” instead of “get” in the underlying API. Such methods are then defined with “?”

@example

class Terminus

  include WrapperHelper

  PROTON_METHOD_PREFIX = "pn_terminus"

  # add methods "type" and "type=" that call "pn_terminus_{get,set}_type"
  proton_accessor :type

  # adds the method "dynamic?" that calls "pn_terminus_is_dynamic"
  proton_accessor :dynamic, :is_or_get => :is

  # adds a method named "foo" that calls "pn_terminus_foo"
  proton_caller :foo

end

@private

Public Class Methods

included(base) click to toggle source
# File lib/util/swig_helper.rb, line 66
def self.included(base)
  base.extend ClassMethods
end