dump

package
v0.0.0-...-a20b597 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2015 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

 Binary output format.
 Header contains all 64-bit words. Strings are 8 bytes long.
	Magic number "#dump002"
	Components int
	MeshSize   [3]int
	MeshStep   [3]float64
	MeshUnit   string
	Time       float64
	TimeUnit   string
	DataLabel  string
	DataUnit   string
	Precission uint64
 	DATA
 	crc64 of DATA and header using ISO polynomial 0xD800000000000000.

Index

Constants

View Source
const (
	CRC_ENABLED  = true
	CRC_DISABLED = false
)
View Source
const (
	FLOAT32 = 4
)

Precision identifier

View Source
const MAGIC = "#dump002"

Magic number

Variables

This section is empty.

Functions

This section is empty.

Types

type Frame

type Frame struct {
	Header
	Data  []float32
	CRC   uint64
	Bytes int64 // Total number of bytes read.
	Err   error // Stores the latest I/O error, if any.
}

Header+data frame.

type Header struct {
	Magic      string
	Components int
	MeshSize   [3]int
	MeshStep   [3]float64
	MeshUnit   string
	Time       float64
	TimeUnit   string
	DataLabel  string
	DataUnit   string
	Precission uint64
}

Header for dump data frame

func (*Header) Size

func (h *Header) Size() []int

func (*Header) String

func (h *Header) String() string

type Reader

type Reader struct {
	Frame // Frame read by the last Read().
	// contains filtered or unexported fields
}

Reads successive data frames in dump format.

func NewReader

func NewReader(in io.Reader, enableCRC bool) *Reader

func (*Reader) Read

func (r *Reader) Read() error

Reads one frame and stores it in r.Frame.

type Writer

type Writer struct {
	Header       // Written by WriteHeader().
	Bytes  int64 // Total number of bytes written.
	Err    error // Stores the latest I/O error, if any.
	// contains filtered or unexported fields
}

Writes data frames in dump format. Usage:

w := NewWriter(out, CRC_ENABLED)
// set desired w.Header fields
w.WriteHeader()
w.WriteData(array) // may be repeated
w.WriteHash()      // closes this frame.
// may be repeated.

func NewWriter

func NewWriter(out io.Writer, enableCRC bool) *Writer

func (*Writer) WriteData

func (w *Writer) WriteData(list []float32)

Writes the data.

func (*Writer) WriteHash

func (w *Writer) WriteHash()

Writes the accumulated hash of this frame, closing the frame.

func (*Writer) WriteHeader

func (w *Writer) WriteHeader()

Writes the current header.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL