go-hep.org/x/hep@v0.38.1/groot/rtree/rfunc/rfunc_u32_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 // FuncToU32 implements rfunc.Formula 14 type FuncToU32 struct { 15 fct func() uint32 16 } 17 18 // NewFuncToU32 return a new formula, from the provided function. 19 func NewFuncToU32(rvars []string, fct func() uint32) *FuncToU32 { 20 return &FuncToU32{ 21 fct: fct, 22 } 23 } 24 25 // RVars implements rfunc.Formula 26 func (f *FuncToU32) RVars() []string { return nil } 27 28 // Bind implements rfunc.Formula 29 func (f *FuncToU32) 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 *FuncToU32) Func() any { 41 return func() uint32 { 42 return f.fct() 43 } 44 } 45 46 var ( 47 _ Formula = (*FuncToU32)(nil) 48 ) 49 50 // FuncU32ToU32 implements rfunc.Formula 51 type FuncU32ToU32 struct { 52 rvars []string 53 arg0 *uint32 54 fct func(arg00 uint32) uint32 55 } 56 57 // NewFuncU32ToU32 return a new formula, from the provided function. 58 func NewFuncU32ToU32(rvars []string, fct func(arg00 uint32) uint32) *FuncU32ToU32 { 59 return &FuncU32ToU32{ 60 rvars: rvars, 61 fct: fct, 62 } 63 } 64 65 // RVars implements rfunc.Formula 66 func (f *FuncU32ToU32) RVars() []string { return f.rvars } 67 68 // Bind implements rfunc.Formula 69 func (f *FuncU32ToU32) 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].(*uint32) 78 if !ok { 79 return fmt.Errorf( 80 "rfunc: argument type 0 (name=%s) mismatch: got=%T, want=*uint32", 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 *FuncU32ToU32) Func() any { 91 return func() uint32 { 92 return f.fct( 93 *f.arg0, 94 ) 95 } 96 } 97 98 var ( 99 _ Formula = (*FuncU32ToU32)(nil) 100 ) 101 102 // FuncU32U32ToU32 implements rfunc.Formula 103 type FuncU32U32ToU32 struct { 104 rvars []string 105 arg0 *uint32 106 arg1 *uint32 107 fct func(arg00 uint32, arg01 uint32) uint32 108 } 109 110 // NewFuncU32U32ToU32 return a new formula, from the provided function. 111 func NewFuncU32U32ToU32(rvars []string, fct func(arg00 uint32, arg01 uint32) uint32) *FuncU32U32ToU32 { 112 return &FuncU32U32ToU32{ 113 rvars: rvars, 114 fct: fct, 115 } 116 } 117 118 // RVars implements rfunc.Formula 119 func (f *FuncU32U32ToU32) RVars() []string { return f.rvars } 120 121 // Bind implements rfunc.Formula 122 func (f *FuncU32U32ToU32) 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].(*uint32) 131 if !ok { 132 return fmt.Errorf( 133 "rfunc: argument type 0 (name=%s) mismatch: got=%T, want=*uint32", 134 f.rvars[0], args[0], 135 ) 136 } 137 f.arg0 = ptr 138 } 139 { 140 ptr, ok := args[1].(*uint32) 141 if !ok { 142 return fmt.Errorf( 143 "rfunc: argument type 1 (name=%s) mismatch: got=%T, want=*uint32", 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 *FuncU32U32ToU32) Func() any { 154 return func() uint32 { 155 return f.fct( 156 *f.arg0, 157 *f.arg1, 158 ) 159 } 160 } 161 162 var ( 163 _ Formula = (*FuncU32U32ToU32)(nil) 164 ) 165 166 // FuncU32U32U32ToU32 implements rfunc.Formula 167 type FuncU32U32U32ToU32 struct { 168 rvars []string 169 arg0 *uint32 170 arg1 *uint32 171 arg2 *uint32 172 fct func(arg00 uint32, arg01 uint32, arg02 uint32) uint32 173 } 174 175 // NewFuncU32U32U32ToU32 return a new formula, from the provided function. 176 func NewFuncU32U32U32ToU32(rvars []string, fct func(arg00 uint32, arg01 uint32, arg02 uint32) uint32) *FuncU32U32U32ToU32 { 177 return &FuncU32U32U32ToU32{ 178 rvars: rvars, 179 fct: fct, 180 } 181 } 182 183 // RVars implements rfunc.Formula 184 func (f *FuncU32U32U32ToU32) RVars() []string { return f.rvars } 185 186 // Bind implements rfunc.Formula 187 func (f *FuncU32U32U32ToU32) 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].(*uint32) 196 if !ok { 197 return fmt.Errorf( 198 "rfunc: argument type 0 (name=%s) mismatch: got=%T, want=*uint32", 199 f.rvars[0], args[0], 200 ) 201 } 202 f.arg0 = ptr 203 } 204 { 205 ptr, ok := args[1].(*uint32) 206 if !ok { 207 return fmt.Errorf( 208 "rfunc: argument type 1 (name=%s) mismatch: got=%T, want=*uint32", 209 f.rvars[1], args[1], 210 ) 211 } 212 f.arg1 = ptr 213 } 214 { 215 ptr, ok := args[2].(*uint32) 216 if !ok { 217 return fmt.Errorf( 218 "rfunc: argument type 2 (name=%s) mismatch: got=%T, want=*uint32", 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 *FuncU32U32U32ToU32) Func() any { 229 return func() uint32 { 230 return f.fct( 231 *f.arg0, 232 *f.arg1, 233 *f.arg2, 234 ) 235 } 236 } 237 238 var ( 239 _ Formula = (*FuncU32U32U32ToU32)(nil) 240 )