Documentation

Overview

    Package rdict contains the definition of ROOT streamers and facilities to generate new streamers meta data from user types.

    Index

    Constants

    This section is empty.

    Variables

    View Source
    var StreamerInfos = &streamerDb{
    	db: make(map[streamerDbKey]rbytes.StreamerInfo),
    }

      StreamerInfos stores all the streamers available at runtime.

      Functions

      func GenCxxStreamerInfo

      func GenCxxStreamerInfo(w io.Writer, si rbytes.StreamerInfo, verbose bool) error

        GenCxxStreamerInfo generates the textual representation of the provided streamer info.

        func GoName2Cxx

        func GoName2Cxx(name string) string

          GoName2Cxx translates a fully-qualified Go type name to a C++ one. e.g.:

          - go-hep.org/x/hep/hbook.H1D -> go_hep_org::x::hep::hbook::H1D
          

          func NewGenGoType

          func NewGenGoType(pkg string, sictx rbytes.StreamerInfoContext, verbose bool) (*genGoType, error)

            NewGenGoType generates code for Go types from a ROOT StreamerInfo.

            func RStreamerOf

            func RStreamerOf(sinfo rbytes.StreamerInfo, i int, kind rbytes.StreamKind) (rbytes.RStreamer, error)

              RStreamerOf returns a read-streamer for the i-th element of the provided streamer info and stream kind.

              func StreamerOf

                StreamerOf generates a StreamerInfo from a reflect.Type.

                StreamerOf panics if the provided type contains non-ROOT compatible types such as chan, int, uint or func.

                func TypeFromSE

                  TypeFromSE returns a Go type corresponding to the provided StreamerElement. TypeFromSE first reaches out to the known groot types (via groot/rtypes) and then resorts to building a new type with reflect.

                  func TypeFromSI

                    TypeFromSI returns a Go type corresponding to the provided StreamerInfo. TypeFromSI first reaches out to the known groot types (via groot/rtypes) and then resorts to building a new type with reflect.

                    func Typename

                    func Typename(name, title string) (string, bool)

                      Typename returns a language dependent typename, usually encoded inside a StreamerInfo's title.

                      func Visit

                        Visit inspects a streamer info and visits all its elements, once.

                        func WStreamerOf

                        func WStreamerOf(sinfo rbytes.StreamerInfo, i int, kind rbytes.StreamKind) (rbytes.WStreamer, error)

                          WStreamerOf returns a write-streamer for the i-th element of the provided streamer info and stream kind.

                          Types

                          type Element

                          type Element struct {
                          	Name   rbase.Named
                          	Type   rmeta.Enum // element type
                          	Size   int32      // size of element
                          	ArrLen int32      // cumulative size of all array dims
                          	ArrDim int32      // number of array dimensions
                          	MaxIdx [5]int32   // maximum array index for array dimension "dim"
                          	Offset int32      // element offset in class
                          	EName  string     // data type name of data member
                          	XMin   float64    // minimum of data member if a range is specified [xmin.xmax.nbits]
                          	XMax   float64    // maximum of data member if a range is specified [xmin.xmax.nbits]
                          	Factor float64    // conversion factor if a range is specified. factor = (1<<nbits/(xmax-xmin))
                          }

                          func (Element) New

                          func (e Element) New() StreamerElement

                          type Generator

                          type Generator interface {
                          	// Generate generates code for a given type.
                          	Generate(typ string) error
                          
                          	// Format formats the Go generated code.
                          	Format() ([]byte, error)
                          }

                            Generator is the interface used to generate ROOT related code.

                            func NewGenStreamer

                            func NewGenStreamer(p string, verbose bool) (Generator, error)

                              NewGenStreamer returns a new code generator for package p, where p is the package's import path.

                              type Object

                              type Object struct {
                              	// contains filtered or unexported fields
                              }

                                Object wraps a type created from a Streamer and implements the following interfaces:

                                - root.Object
                                - rbytes.RVersioner
                                - rbytes.Marshaler
                                - rbytes.Unmarshaler
                                

                                func ObjectFrom

                                func ObjectFrom(si rbytes.StreamerInfo, sictx rbytes.StreamerInfoContext) *Object

                                func (*Object) Class

                                func (obj *Object) Class() string

                                func (*Object) MarshalROOT

                                func (obj *Object) MarshalROOT(w *rbytes.WBuffer) (int, error)

                                func (*Object) RVersion

                                func (obj *Object) RVersion() int16

                                func (*Object) SetClass

                                func (obj *Object) SetClass(name string)

                                func (*Object) String

                                func (obj *Object) String() string

                                func (*Object) UnmarshalROOT

                                func (obj *Object) UnmarshalROOT(r *rbytes.RBuffer) error

                                type StreamerArtificial

                                type StreamerArtificial struct {
                                	StreamerElement
                                }

                                func (*StreamerArtificial) Class

                                func (tss *StreamerArtificial) Class() string

                                func (*StreamerArtificial) MarshalROOT

                                func (tsa *StreamerArtificial) MarshalROOT(w *rbytes.WBuffer) (int, error)

                                func (*StreamerArtificial) RVersion

                                func (*StreamerArtificial) RVersion() int16

                                func (*StreamerArtificial) UnmarshalROOT

                                func (tsa *StreamerArtificial) UnmarshalROOT(r *rbytes.RBuffer) error

                                type StreamerBase

                                type StreamerBase struct {
                                	StreamerElement
                                	// contains filtered or unexported fields
                                }

                                func NewStreamerBase

                                func NewStreamerBase(se StreamerElement, vbase int32) *StreamerBase

                                func (*StreamerBase) Base

                                func (tsb *StreamerBase) Base() int

                                  Base returns the base class' version.

                                  func (*StreamerBase) Class

                                  func (tsb *StreamerBase) Class() string

                                  func (*StreamerBase) MarshalROOT

                                  func (tsb *StreamerBase) MarshalROOT(w *rbytes.WBuffer) (int, error)

                                  func (*StreamerBase) RVersion

                                  func (*StreamerBase) RVersion() int16

                                  func (*StreamerBase) UnmarshalROOT

                                  func (tsb *StreamerBase) UnmarshalROOT(r *rbytes.RBuffer) error

                                  type StreamerBasicPointer

                                  type StreamerBasicPointer struct {
                                  	StreamerElement
                                  	// contains filtered or unexported fields
                                  }

                                  func NewStreamerBasicPointer

                                  func NewStreamerBasicPointer(se StreamerElement, cvers int32, cname, ccls string) *StreamerBasicPointer

                                  func (*StreamerBasicPointer) Class

                                  func (tsb *StreamerBasicPointer) Class() string

                                  func (*StreamerBasicPointer) CountName

                                  func (tsb *StreamerBasicPointer) CountName() string

                                  func (*StreamerBasicPointer) MarshalROOT

                                  func (tsb *StreamerBasicPointer) MarshalROOT(w *rbytes.WBuffer) (int, error)

                                  func (*StreamerBasicPointer) RVersion

                                  func (*StreamerBasicPointer) RVersion() int16

                                  func (*StreamerBasicPointer) UnmarshalROOT

                                  func (tsb *StreamerBasicPointer) UnmarshalROOT(r *rbytes.RBuffer) error

                                  type StreamerBasicType

                                  type StreamerBasicType struct {
                                  	StreamerElement
                                  }

                                  func (*StreamerBasicType) Class

                                  func (tsb *StreamerBasicType) Class() string

                                  func (*StreamerBasicType) MarshalROOT

                                  func (tsb *StreamerBasicType) MarshalROOT(w *rbytes.WBuffer) (int, error)

                                  func (*StreamerBasicType) RVersion

                                  func (*StreamerBasicType) RVersion() int16

                                  func (*StreamerBasicType) UnmarshalROOT

                                  func (tsb *StreamerBasicType) UnmarshalROOT(r *rbytes.RBuffer) error

                                  type StreamerElement

                                  type StreamerElement struct {
                                  	// contains filtered or unexported fields
                                  }

                                  func (*StreamerElement) ArrayDim

                                  func (tse *StreamerElement) ArrayDim() int

                                  func (*StreamerElement) ArrayDims

                                  func (tse *StreamerElement) ArrayDims() []int32

                                  func (*StreamerElement) ArrayLen

                                  func (tse *StreamerElement) ArrayLen() int

                                  func (*StreamerElement) Class

                                  func (tse *StreamerElement) Class() string

                                  func (*StreamerElement) Factor

                                  func (tse *StreamerElement) Factor() float64

                                  func (*StreamerElement) MarshalROOT

                                  func (tse *StreamerElement) MarshalROOT(w *rbytes.WBuffer) (int, error)

                                  func (*StreamerElement) Name

                                  func (tse *StreamerElement) Name() string

                                  func (*StreamerElement) Offset

                                  func (tse *StreamerElement) Offset() uintptr

                                  func (*StreamerElement) RVersion

                                  func (*StreamerElement) RVersion() int16

                                  func (*StreamerElement) Size

                                  func (tse *StreamerElement) Size() uintptr

                                  func (*StreamerElement) Title

                                  func (tse *StreamerElement) Title() string

                                  func (*StreamerElement) Type

                                  func (tse *StreamerElement) Type() rmeta.Enum

                                  func (*StreamerElement) TypeName

                                  func (tse *StreamerElement) TypeName() string

                                  func (*StreamerElement) UnmarshalROOT

                                  func (tse *StreamerElement) UnmarshalROOT(r *rbytes.RBuffer) error

                                  func (*StreamerElement) XMax

                                  func (tse *StreamerElement) XMax() float64

                                  func (*StreamerElement) XMin

                                  func (tse *StreamerElement) XMin() float64

                                  type StreamerInfo

                                  type StreamerInfo struct {
                                  	// contains filtered or unexported fields
                                  }

                                  func NewCxxStreamerInfo

                                  func NewCxxStreamerInfo(name string, version int32, chksum uint32, elems []rbytes.StreamerElement) *StreamerInfo

                                    NewCxxStreamerInfo creates a new StreamerInfo from C++ provided informations.

                                    func NewStreamerInfo

                                    func NewStreamerInfo(name string, version int, elems []rbytes.StreamerElement) *StreamerInfo

                                      NewStreamerInfo creates a new StreamerInfo from Go provided informations.

                                      func (*StreamerInfo) BuildStreamers

                                      func (si *StreamerInfo) BuildStreamers() error

                                        BuildStreamers builds the r/w streamers.

                                        func (*StreamerInfo) CheckSum

                                        func (tsi *StreamerInfo) CheckSum() int

                                        func (*StreamerInfo) Class

                                        func (tsi *StreamerInfo) Class() string

                                        func (*StreamerInfo) ClassVersion

                                        func (tsi *StreamerInfo) ClassVersion() int

                                        func (*StreamerInfo) Elements

                                        func (tsi *StreamerInfo) Elements() []rbytes.StreamerElement

                                        func (*StreamerInfo) MarshalROOT

                                        func (tsi *StreamerInfo) MarshalROOT(w *rbytes.WBuffer) (int, error)

                                        func (*StreamerInfo) Name

                                        func (tsi *StreamerInfo) Name() string

                                        func (*StreamerInfo) NewDecoder

                                        func (si *StreamerInfo) NewDecoder(kind rbytes.StreamKind, r *rbytes.RBuffer) (rbytes.Decoder, error)

                                        func (*StreamerInfo) NewEncoder

                                        func (si *StreamerInfo) NewEncoder(kind rbytes.StreamKind, w *rbytes.WBuffer) (rbytes.Encoder, error)

                                        func (*StreamerInfo) NewRStreamer

                                        func (si *StreamerInfo) NewRStreamer(kind rbytes.StreamKind) (rbytes.RStreamer, error)

                                        func (*StreamerInfo) NewWStreamer

                                        func (si *StreamerInfo) NewWStreamer(kind rbytes.StreamKind) (rbytes.WStreamer, error)

                                        func (*StreamerInfo) RVersion

                                        func (*StreamerInfo) RVersion() int16

                                        func (*StreamerInfo) String

                                        func (si *StreamerInfo) String() string

                                        func (*StreamerInfo) Title

                                        func (tsi *StreamerInfo) Title() string

                                        func (*StreamerInfo) UnmarshalROOT

                                        func (tsi *StreamerInfo) UnmarshalROOT(r *rbytes.RBuffer) error

                                        type StreamerLoop

                                        type StreamerLoop struct {
                                        	StreamerElement
                                        	// contains filtered or unexported fields
                                        }

                                          StreamerLoop represents a streamer for a var-length array of a non-basic type.

                                          func NewStreamerLoop

                                          func NewStreamerLoop(se StreamerElement, cvers int32, cname, cclass string) *StreamerLoop

                                          func (*StreamerLoop) Class

                                          func (*StreamerLoop) Class() string

                                          func (*StreamerLoop) CountName

                                          func (tsl *StreamerLoop) CountName() string

                                          func (*StreamerLoop) MarshalROOT

                                          func (tsl *StreamerLoop) MarshalROOT(w *rbytes.WBuffer) (int, error)

                                          func (*StreamerLoop) RVersion

                                          func (*StreamerLoop) RVersion() int16

                                          func (*StreamerLoop) UnmarshalROOT

                                          func (tsl *StreamerLoop) UnmarshalROOT(r *rbytes.RBuffer) error

                                          type StreamerObject

                                          type StreamerObject struct {
                                          	StreamerElement
                                          }

                                          func (*StreamerObject) Class

                                          func (tso *StreamerObject) Class() string

                                          func (*StreamerObject) MarshalROOT

                                          func (tso *StreamerObject) MarshalROOT(w *rbytes.WBuffer) (int, error)

                                          func (*StreamerObject) RVersion

                                          func (*StreamerObject) RVersion() int16

                                          func (*StreamerObject) UnmarshalROOT

                                          func (tso *StreamerObject) UnmarshalROOT(r *rbytes.RBuffer) error

                                          type StreamerObjectAny

                                          type StreamerObjectAny struct {
                                          	StreamerElement
                                          }

                                          func (*StreamerObjectAny) Class

                                          func (tso *StreamerObjectAny) Class() string

                                          func (*StreamerObjectAny) MarshalROOT

                                          func (tso *StreamerObjectAny) MarshalROOT(w *rbytes.WBuffer) (int, error)

                                          func (*StreamerObjectAny) RVersion

                                          func (*StreamerObjectAny) RVersion() int16

                                          func (*StreamerObjectAny) UnmarshalROOT

                                          func (tso *StreamerObjectAny) UnmarshalROOT(r *rbytes.RBuffer) error

                                          type StreamerObjectAnyPointer

                                          type StreamerObjectAnyPointer struct {
                                          	StreamerElement
                                          }

                                          func (*StreamerObjectAnyPointer) Class

                                          func (tso *StreamerObjectAnyPointer) Class() string

                                          func (*StreamerObjectAnyPointer) MarshalROOT

                                          func (tso *StreamerObjectAnyPointer) MarshalROOT(w *rbytes.WBuffer) (int, error)

                                          func (*StreamerObjectAnyPointer) RVersion

                                          func (*StreamerObjectAnyPointer) RVersion() int16

                                          func (*StreamerObjectAnyPointer) UnmarshalROOT

                                          func (tso *StreamerObjectAnyPointer) UnmarshalROOT(r *rbytes.RBuffer) error

                                          type StreamerObjectPointer

                                          type StreamerObjectPointer struct {
                                          	StreamerElement
                                          }

                                          func (*StreamerObjectPointer) Class

                                          func (tso *StreamerObjectPointer) Class() string

                                          func (*StreamerObjectPointer) MarshalROOT

                                          func (tso *StreamerObjectPointer) MarshalROOT(w *rbytes.WBuffer) (int, error)

                                          func (*StreamerObjectPointer) RVersion

                                          func (*StreamerObjectPointer) RVersion() int16

                                          func (*StreamerObjectPointer) UnmarshalROOT

                                          func (tso *StreamerObjectPointer) UnmarshalROOT(r *rbytes.RBuffer) error

                                          type StreamerSTL

                                          type StreamerSTL struct {
                                          	StreamerElement
                                          	// contains filtered or unexported fields
                                          }

                                          func NewCxxStreamerSTL

                                          func NewCxxStreamerSTL(se StreamerElement, vtype rmeta.ESTLType, ctype rmeta.Enum) *StreamerSTL

                                            NewCxxStreamerSTL creates a new StreamerSTL from C++ informations.

                                            func NewStreamerSTL

                                            func NewStreamerSTL(name string, vtype rmeta.ESTLType, ctype rmeta.Enum) *StreamerSTL

                                            func (*StreamerSTL) Class

                                            func (tss *StreamerSTL) Class() string

                                            func (*StreamerSTL) ContainedType

                                            func (tss *StreamerSTL) ContainedType() rmeta.Enum

                                            func (*StreamerSTL) ElemTypeName

                                            func (tss *StreamerSTL) ElemTypeName() []string

                                            func (*StreamerSTL) MarshalROOT

                                            func (tss *StreamerSTL) MarshalROOT(w *rbytes.WBuffer) (int, error)

                                            func (*StreamerSTL) RVersion

                                            func (*StreamerSTL) RVersion() int16

                                            func (*StreamerSTL) STLType

                                            func (tss *StreamerSTL) STLType() rmeta.ESTLType

                                            func (*StreamerSTL) UnmarshalROOT

                                            func (tss *StreamerSTL) UnmarshalROOT(r *rbytes.RBuffer) error

                                            type StreamerSTLstring

                                            type StreamerSTLstring struct {
                                            	StreamerSTL
                                            }

                                            func (*StreamerSTLstring) Class

                                            func (tss *StreamerSTLstring) Class() string

                                            func (*StreamerSTLstring) MarshalROOT

                                            func (tss *StreamerSTLstring) MarshalROOT(w *rbytes.WBuffer) (int, error)

                                            func (*StreamerSTLstring) RVersion

                                            func (*StreamerSTLstring) RVersion() int16

                                            func (*StreamerSTLstring) UnmarshalROOT

                                            func (tss *StreamerSTLstring) UnmarshalROOT(r *rbytes.RBuffer) error

                                            type StreamerString

                                            type StreamerString struct {
                                            	StreamerElement
                                            }

                                            func (*StreamerString) Class

                                            func (tss *StreamerString) Class() string

                                            func (*StreamerString) MarshalROOT

                                            func (tss *StreamerString) MarshalROOT(w *rbytes.WBuffer) (int, error)

                                            func (*StreamerString) RVersion

                                            func (*StreamerString) RVersion() int16

                                            func (*StreamerString) UnmarshalROOT

                                            func (tss *StreamerString) UnmarshalROOT(r *rbytes.RBuffer) error