Commit 58f09bc9 authored by Alberto Ramos's avatar Alberto Ramos

Added license and README.md

parent 9df37cbb
Pipeline #63 canceled with stages
> "THE BEER-WARE LICENSE":
> Alberto Ramos wrote this file. As long as you retain this
> notice you can do whatever you want with this stuff. If we meet some
> day, and you think this stuff is worth it, you can buy me a beer in
> return. <alberto.ramos@cern.ch>
# BDIO.jl
BDIO.jl is a package to write/read [BDIO](http://bdio.org) (**B**inary
**D**ata **I**nput/**O**utput) files.
The test1.jl file in the `tests` directory gives a simple example on
the usage of the package
```julia
julia> BDIO_set_user("alberto")
julia> BDIO_set_host("laptop")
julia> fb = BDIO_open("foo.bdio", "w", "Test file")
julia> BDIO_start_record!(fb, BDIO_BIN_INT64LE, 1, true)
julia> BDIO_write!(fb, collect(1:1000))
julia> BDIO_write_hash!(fb)
julia> BDIO_start_record!(fb, BDIO_BIN_F64LE, 2, true)
julia> vec1 = randn(1000)
julia> vec2 = similar(vec1)
julia> vec2 .= .- vec1
julia> BDIO_write!(fb, vec1)
julia> BDIO_write!(fb, vec2)
julia> BDIO_write_hash!(fb)
julia> BDIO_close!(fb)
julia> fb2 = BDIO_open("foo.bdio", "r")
julia> global isum = 0
julia> global fsum = 0.0
julia> while BDIO_seek!(fb2)
julia> if BDIO_get_uinfo(fb2) == 1
julia> idt = similar(Array{Int64, 1}, 100)
julia> for i = 1:10
julia> BDIO_read(fb2, idt)
julia> global isum += sum(idt)
julia> end
julia> elseif BDIO_get_uinfo(fb2) == 2
julia> fdt = similar(Array{Float64, 1}, 100)
julia> for i = 1:20
julia> BDIO_read(fb2, fdt)
julia> global fsum += sum(fdt)
julia> end
julia> end
julia> end
julia> rm("foo.bdio", force=true)
julia> ( (abs(fsum) < 1.0E-10) && ((2*isum - 1000*(1001)) == 0) )
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment