summaryrefslogtreecommitdiffstats
path: root/lib/e17/ecore.rb
blob: fe4786f30a2f9da53a45f62eb9567232b787ee6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
require 'e17/ecore/ecore-ffi'
#
module E17
    module Ecore
        #
        class EcorePipe
            def initialize cb, data
                @ptr = E17::API.ecore_pipe_add cb, data
            end
            def del; E17::API.ecore_pipe_del @ptr; end
            def read_close; E17::API.ecore_pipe_read_close @ptr; end
            def write_close; E17::API.ecore_pipe_write_close @ptr; end
            def write data
                E17::API.ecore_pipe_write @ptr, FFI::MemoryPointer.from_string(data.to_s), data.to_s.length+1
            end
            #
        end
        #
    end
end
#
# EOF