go-hep.org/x/hep@v0.38.1/groot/root/root.go (about) 1 // Copyright ©2018 The go-hep Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Package root defines ROOT core interfaces. 6 package root // import "go-hep.org/x/hep/groot/root" 7 8 import ( 9 "go-hep.org/x/hep/groot/rvers" 10 ) 11 12 const ( 13 Version = rvers.ROOT // ROOT version the groot library implements 14 ) 15 16 // Object represents a ROOT object 17 type Object interface { 18 // Class returns the ROOT class of this object 19 Class() string 20 } 21 22 // UIDer is the interface for objects that can be referenced. 23 type UIDer interface { 24 // UID returns the unique ID of this object 25 UID() uint32 26 } 27 28 // Named represents a ROOT TNamed object 29 type Named interface { 30 Object 31 32 // Name returns the name of this ROOT object 33 Name() string 34 35 // Title returns the title of this ROOT object 36 Title() string 37 } 38 39 // Collection is a collection of ROOT Objects. 40 type Collection interface { 41 Object 42 43 // Name returns the name of the collection. 44 Name() string 45 46 // Last returns the last element index 47 Last() int 48 49 // At returns the element at index i 50 At(i int) Object 51 52 // Len returns the number of elements in the collection 53 Len() int 54 } 55 56 // SeqCollection is a sequential collection of ROOT Objects. 57 type SeqCollection interface { 58 Collection 59 } 60 61 // List is a list of ROOT Objects. 62 type List interface { 63 SeqCollection 64 } 65 66 // ObjArray is an array of ROOT Objects. 67 type ObjArray interface { 68 SeqCollection 69 LowerBound() int 70 } 71 72 // Array describes ROOT abstract array type. 73 type Array interface { 74 Len() int // number of array elements 75 Get(i int) any 76 Set(i int, v any) 77 } 78 79 // ObjString is a ROOT string that implements ROOT TObject. 80 type ObjString interface { 81 Name() string 82 String() string 83 } 84 85 // Merger is a ROOT object that can ingest data from another ROOT object. 86 type Merger interface { 87 ROOTMerge(src Object) error 88 } 89 90 // ObjectFinder is the interface that wraps the (C++ equivalent) FindObject method. 91 type ObjectFinder interface { 92 Keys() []string 93 Get(name string) (Object, error) 94 }