go-hep.org/x/hep@v0.38.1/groot/rtree/rfunc/rfunc_u64_gen.go (about) 1 // Copyright ©2020 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 // Automatically generated. DO NOT EDIT. 6 7 package rfunc 8 9 import ( 10 "fmt" 11 ) 12 13 // FuncToU64 implements rfunc.Formula 14 type FuncToU64 struct { 15 fct func() uint64 16 } 17 18 // NewFuncToU64 return a new formula, from the provided function. 19 func NewFuncToU64(rvars []string, fct func() uint64) *FuncToU64 { 20 return &FuncToU64{ 21 fct: fct, 22 } 23 } 24 25 // RVars implements rfunc.Formula 26 func (f *FuncToU64) RVars() []string { return nil } 27 28 // Bind implements rfunc.Formula 29 func (f *FuncToU64) Bind(args []any) error { 30 if got, want := len(args), 0; got != want { 31 return fmt.Errorf( 32 "rfunc: invalid number of bind arguments (got=%d, want=%d)", 33 got, want, 34 ) 35 } 36 return nil 37 } 38 39 // Func implements rfunc.Formula 40 func (f *FuncToU64) Func() any { 41 return func() uint64 { 42 return f.fct() 43 } 44 } 45 46 var ( 47 _ Formula = (*FuncToU64)(nil) 48 ) 49 50 // FuncU64ToU64 implements rfunc.Formula 51 type FuncU64ToU64 struct { 52 rvars []string 53 arg0 *uint64 54 fct func(arg00 uint64) uint64 55 } 56 57 // NewFuncU64ToU64 return a new formula, from the provided function. 58 func NewFuncU64ToU64(rvars []string, fct func(arg00 uint64) uint64) *FuncU64ToU64 { 59 return &FuncU64ToU64{ 60 rvars: rvars, 61 fct: fct, 62 } 63 } 64 65 // RVars implements rfunc.Formula 66 func (f *FuncU64ToU64) RVars() []string { return f.rvars } 67 68 // Bind implements rfunc.Formula 69 func (f *FuncU64ToU64) Bind(args []any) error { 70 if got, want := len(args), 1; got != want { 71 return fmt.Errorf( 72 "rfunc: invalid number of bind arguments (got=%d, want=%d)", 73 got, want, 74 ) 75 } 76 { 77 ptr, ok := args[0].(*uint64) 78 if !ok { 79 return fmt.Errorf( 80 "rfunc: argument type 0 (name=%s) mismatch: got=%T, want=*uint64", 81 f.rvars[0], args[0], 82 ) 83 } 84 f.arg0 = ptr 85 } 86 return nil 87 } 88 89 // Func implements rfunc.Formula 90 func (f *FuncU64ToU64) Func() any { 91 return func() uint64 { 92 return f.fct( 93 *f.arg0, 94 ) 95 } 96 } 97 98 var ( 99 _ Formula = (*FuncU64ToU64)(nil) 100 ) 101 102 // FuncU64U64ToU64 implements rfunc.Formula 103 type FuncU64U64ToU64 struct { 104 rvars []string 105 arg0 *uint64 106 arg1 *uint64 107 fct func(arg00 uint64, arg01 uint64) uint64 108 } 109 110 // NewFuncU64U64ToU64 return a new formula, from the provided function. 111 func NewFuncU64U64ToU64(rvars []string, fct func(arg00 uint64, arg01 uint64) uint64) *FuncU64U64ToU64 { 112 return &FuncU64U64ToU64{ 113 rvars: rvars, 114 fct: fct, 115 } 116 } 117 118 // RVars implements rfunc.Formula 119 func (f *FuncU64U64ToU64) RVars() []string { return f.rvars } 120 121 // Bind implements rfunc.Formula 122 func (f *FuncU64U64ToU64) Bind(args []any) error { 123 if got, want := len(args), 2; got != want { 124 return fmt.Errorf( 125 "rfunc: invalid number of bind arguments (got=%d, want=%d)", 126 got, want, 127 ) 128 } 129 { 130 ptr, ok := args[0].(*uint64) 131 if !ok { 132 return fmt.Errorf( 133 "rfunc: argument type 0 (name=%s) mismatch: got=%T, want=*uint64", 134 f.rvars[0], args[0], 135 ) 136 } 137 f.arg0 = ptr 138 } 139 { 140 ptr, ok := args[1].(*uint64) 141 if !ok { 142 return fmt.Errorf( 143 "rfunc: argument type 1 (name=%s) mismatch: got=%T, want=*uint64", 144 f.rvars[1], args[1], 145 ) 146 } 147 f.arg1 = ptr 148 } 149 return nil 150 } 151 152 // Func implements rfunc.Formula 153 func (f *FuncU64U64ToU64) Func() any { 154 return func() uint64 { 155 return f.fct( 156 *f.arg0, 157 *f.arg1, 158 ) 159 } 160 } 161 162 var ( 163 _ Formula = (*FuncU64U64ToU64)(nil) 164 ) 165 166 // FuncU64U64U64ToU64 implements rfunc.Formula 167 type FuncU64U64U64ToU64 struct { 168 rvars []string 169 arg0 *uint64 170 arg1 *uint64 171 arg2 *uint64 172 fct func(arg00 uint64, arg01 uint64, arg02 uint64) uint64 173 } 174 175 // NewFuncU64U64U64ToU64 return a new formula, from the provided function. 176 func NewFuncU64U64U64ToU64(rvars []string, fct func(arg00 uint64, arg01 uint64, arg02 uint64) uint64) *FuncU64U64U64ToU64 { 177 return &FuncU64U64U64ToU64{ 178 rvars: rvars, 179 fct: fct, 180 } 181 } 182 183 // RVars implements rfunc.Formula 184 func (f *FuncU64U64U64ToU64) RVars() []string { return f.rvars } 185 186 // Bind implements rfunc.Formula 187 func (f *FuncU64U64U64ToU64) Bind(args []any) error { 188 if got, want := len(args), 3; got != want { 189 return fmt.Errorf( 190 "rfunc: invalid number of bind arguments (got=%d, want=%d)", 191 got, want, 192 ) 193 } 194 { 195 ptr, ok := args[0].(*uint64) 196 if !ok { 197 return fmt.Errorf( 198 "rfunc: argument type 0 (name=%s) mismatch: got=%T, want=*uint64", 199 f.rvars[0], args[0], 200 ) 201 } 202 f.arg0 = ptr 203 } 204 { 205 ptr, ok := args[1].(*uint64) 206 if !ok { 207 return fmt.Errorf( 208 "rfunc: argument type 1 (name=%s) mismatch: got=%T, want=*uint64", 209 f.rvars[1], args[1], 210 ) 211 } 212 f.arg1 = ptr 213 } 214 { 215 ptr, ok := args[2].(*uint64) 216 if !ok { 217 return fmt.Errorf( 218 "rfunc: argument type 2 (name=%s) mismatch: got=%T, want=*uint64", 219 f.rvars[2], args[2], 220 ) 221 } 222 f.arg2 = ptr 223 } 224 return nil 225 } 226 227 // Func implements rfunc.Formula 228 func (f *FuncU64U64U64ToU64) Func() any { 229 return func() uint64 { 230 return f.fct( 231 *f.arg0, 232 *f.arg1, 233 *f.arg2, 234 ) 235 } 236 } 237 238 var ( 239 _ Formula = (*FuncU64U64U64ToU64)(nil) 240 )