summaryrefslogtreecommitdiff
path: root/file.sort.pb.go
diff options
context:
space:
mode:
Diffstat (limited to 'file.sort.pb.go')
-rw-r--r--file.sort.pb.go412
1 files changed, 412 insertions, 0 deletions
diff --git a/file.sort.pb.go b/file.sort.pb.go
new file mode 100644
index 0000000..313bd20
--- /dev/null
+++ b/file.sort.pb.go
@@ -0,0 +1,412 @@
+// Code generated by go.wit.com/apps/autogenpb DO NOT EDIT.
+// This file was autogenerated with autogenpb v0.0.42-1-gf74f364 2025.01.13_0345
+// go install go.wit.com/apps/autogenpb@latest
+//
+// define which structs (messages) you want to use in the .proto file
+// Then sort.pb.go and marshal.pb.go files are autogenerated
+//
+// autogenpb uses it and has an example .proto file with instructions
+//
+
+package main
+
+import (
+ "fmt"
+ "sync"
+)
+
+// a simple global lock
+var fileMu sync.RWMutex
+
+// START SORT
+
+// DEFINE THE Files ITERATOR.
+// itializes a new iterator.
+func newFilesIterator(things []*Files) *FilesIterator {
+ return &FilesIterator{things: things}
+}
+
+type FilesIterator struct {
+ sync.RWMutex // this isn't getting used properly yet?
+
+ things []*Files
+ index int
+}
+
+func (it *FilesIterator) Scan() bool {
+ if it.index >= len(it.things) {
+ return false
+ }
+ it.index++
+ return true
+}
+
+// Next() returns the next thing in the array
+func (it *FilesIterator) Next() *Files {
+ if it.things[it.index-1] == nil {
+ fmt.Println("Next() error in FilesIterator", it.index)
+ }
+ return it.things[it.index-1]
+}
+
+// END DEFINE THE ITERATOR
+
+// DEFINE THE File ITERATOR.
+// itializes a new iterator.
+func newFileIterator(things []*File) *FileIterator {
+ return &FileIterator{things: things}
+}
+
+type FileIterator struct {
+ sync.RWMutex // this isn't getting used properly yet?
+
+ things []*File
+ index int
+}
+
+func (it *FileIterator) Scan() bool {
+ if it.index >= len(it.things) {
+ return false
+ }
+ it.index++
+ return true
+}
+
+// Next() returns the next thing in the array
+func (it *FileIterator) Next() *File {
+ if it.things[it.index-1] == nil {
+ fmt.Println("Next() error in FileIterator", it.index)
+ }
+ return it.things[it.index-1]
+}
+
+// END DEFINE THE ITERATOR
+
+// DEFINE THE MsgVar ITERATOR.
+// itializes a new iterator.
+func newMsgVarIterator(things []*MsgVar) *MsgVarIterator {
+ return &MsgVarIterator{things: things}
+}
+
+type MsgVarIterator struct {
+ sync.RWMutex // this isn't getting used properly yet?
+
+ things []*MsgVar
+ index int
+}
+
+func (it *MsgVarIterator) Scan() bool {
+ if it.index >= len(it.things) {
+ return false
+ }
+ it.index++
+ return true
+}
+
+// Next() returns the next thing in the array
+func (it *MsgVarIterator) Next() *MsgVar {
+ if it.things[it.index-1] == nil {
+ fmt.Println("Next() error in MsgVarIterator", it.index)
+ }
+ return it.things[it.index-1]
+}
+
+// END DEFINE THE ITERATOR
+
+// DEFINE THE MsgName ITERATOR.
+// itializes a new iterator.
+func newMsgNameIterator(things []*MsgName) *MsgNameIterator {
+ return &MsgNameIterator{things: things}
+}
+
+type MsgNameIterator struct {
+ sync.RWMutex // this isn't getting used properly yet?
+
+ things []*MsgName
+ index int
+}
+
+func (it *MsgNameIterator) Scan() bool {
+ if it.index >= len(it.things) {
+ return false
+ }
+ it.index++
+ return true
+}
+
+// Next() returns the next thing in the array
+func (it *MsgNameIterator) Next() *MsgName {
+ if it.things[it.index-1] == nil {
+ fmt.Println("Next() error in MsgNameIterator", it.index)
+ }
+ return it.things[it.index-1]
+}
+
+// END DEFINE THE ITERATOR
+
+// DEFINE THE Sort ITERATOR.
+// itializes a new iterator.
+func newSortIterator(things []*Sort) *SortIterator {
+ return &SortIterator{things: things}
+}
+
+type SortIterator struct {
+ sync.RWMutex // this isn't getting used properly yet?
+
+ things []*Sort
+ index int
+}
+
+func (it *SortIterator) Scan() bool {
+ if it.index >= len(it.things) {
+ return false
+ }
+ it.index++
+ return true
+}
+
+// Next() returns the next thing in the array
+func (it *SortIterator) Next() *Sort {
+ if it.things[it.index-1] == nil {
+ fmt.Println("Next() error in SortIterator", it.index)
+ }
+ return it.things[it.index-1]
+}
+
+// END DEFINE THE ITERATOR
+
+// DEFINE THE Find ITERATOR.
+// itializes a new iterator.
+func newFindIterator(things []*Find) *FindIterator {
+ return &FindIterator{things: things}
+}
+
+type FindIterator struct {
+ sync.RWMutex // this isn't getting used properly yet?
+
+ things []*Find
+ index int
+}
+
+func (it *FindIterator) Scan() bool {
+ if it.index >= len(it.things) {
+ return false
+ }
+ it.index++
+ return true
+}
+
+// Next() returns the next thing in the array
+func (it *FindIterator) Next() *Find {
+ if it.things[it.index-1] == nil {
+ fmt.Println("Next() error in FindIterator", it.index)
+ }
+ return it.things[it.index-1]
+}
+
+// END DEFINE THE ITERATOR
+
+// DEFINE THE Identify ITERATOR.
+// itializes a new iterator.
+func newIdentifyIterator(things []*Identify) *IdentifyIterator {
+ return &IdentifyIterator{things: things}
+}
+
+type IdentifyIterator struct {
+ sync.RWMutex // this isn't getting used properly yet?
+
+ things []*Identify
+ index int
+}
+
+func (it *IdentifyIterator) Scan() bool {
+ if it.index >= len(it.things) {
+ return false
+ }
+ it.index++
+ return true
+}
+
+// Next() returns the next thing in the array
+func (it *IdentifyIterator) Next() *Identify {
+ if it.things[it.index-1] == nil {
+ fmt.Println("Next() error in IdentifyIterator", it.index)
+ }
+ return it.things[it.index-1]
+}
+
+// END DEFINE THE ITERATOR
+
+// safely returns a slice of pointers to the FRUIT protobufs
+func (x *Files) allFiles() []*File {
+ x.Lock.RLock()
+ defer x.Lock.RUnlock()
+
+ // Create a new slice to hold pointers to each FRUIT
+ var tmp []*File
+ tmp = make([]*File, len(x.Files))
+ for i, p := range x.Files {
+ tmp[i] = p // Copy pointers for safe iteration
+ }
+
+ return tmp
+}
+
+// safely returns a slice of pointers to the FRUIT protobufs
+func (x *File) allMsgNames() []*MsgName {
+ x.Lock.RLock()
+ defer x.Lock.RUnlock()
+
+ // Create a new slice to hold pointers to each FRUIT
+ var tmp []*MsgName
+ tmp = make([]*MsgName, len(x.MsgNames))
+ for i, p := range x.MsgNames {
+ tmp[i] = p // Copy pointers for safe iteration
+ }
+
+ return tmp
+}
+
+// safely returns a slice of pointers to the FRUIT protobufs
+func (x *File) allSortNames() []*MsgName {
+ x.Lock.RLock()
+ defer x.Lock.RUnlock()
+
+ // Create a new slice to hold pointers to each FRUIT
+ var tmp []*MsgName
+ tmp = make([]*MsgName, len(x.SortNames))
+ for i, p := range x.SortNames {
+ tmp[i] = p // Copy pointers for safe iteration
+ }
+
+ return tmp
+}
+
+// safely returns a slice of pointers to the FRUIT protobufs
+func (x *File) allToSort() []*Sort {
+ x.Lock.RLock()
+ defer x.Lock.RUnlock()
+
+ // Create a new slice to hold pointers to each FRUIT
+ var tmp []*Sort
+ tmp = make([]*Sort, len(x.ToSort))
+ for i, p := range x.ToSort {
+ tmp[i] = p // Copy pointers for safe iteration
+ }
+
+ return tmp
+}
+
+// safely returns a slice of pointers to the FRUIT protobufs
+func (x *MsgName) allVars() []*MsgVar {
+ x.Lock.RLock()
+ defer x.Lock.RUnlock()
+
+ // Create a new slice to hold pointers to each FRUIT
+ var tmp []*MsgVar
+ tmp = make([]*MsgVar, len(x.Vars))
+ for i, p := range x.Vars {
+ tmp[i] = p // Copy pointers for safe iteration
+ }
+
+ return tmp
+}
+
+// safely returns a slice of pointers to the File protobufs
+func (x *Files) selectAllFiles() []*File {
+ x.Lock.RLock()
+ defer x.Lock.RUnlock()
+
+ // Create a new slice to hold pointers to each File
+ var tmp []*File
+ tmp = make([]*File, len(x.Files))
+ for i, p := range x.Files {
+ tmp[i] = p // Copy pointers for safe iteration
+ }
+
+ return tmp
+}
+
+// safely returns a slice of pointers to the MsgName protobufs
+func (x *File) selectAllMsgNames() []*MsgName {
+ x.Lock.RLock()
+ defer x.Lock.RUnlock()
+
+ // Create a new slice to hold pointers to each MsgName
+ var tmp []*MsgName
+ tmp = make([]*MsgName, len(x.MsgNames))
+ for i, p := range x.MsgNames {
+ tmp[i] = p // Copy pointers for safe iteration
+ }
+
+ return tmp
+}
+
+// safely returns a slice of pointers to the MsgName protobufs
+func (x *File) selectAllSortNames() []*MsgName {
+ x.Lock.RLock()
+ defer x.Lock.RUnlock()
+
+ // Create a new slice to hold pointers to each MsgName
+ var tmp []*MsgName
+ tmp = make([]*MsgName, len(x.SortNames))
+ for i, p := range x.SortNames {
+ tmp[i] = p // Copy pointers for safe iteration
+ }
+
+ return tmp
+}
+
+// safely returns a slice of pointers to the Sort protobufs
+func (x *File) selectAllToSort() []*Sort {
+ x.Lock.RLock()
+ defer x.Lock.RUnlock()
+
+ // Create a new slice to hold pointers to each Sort
+ var tmp []*Sort
+ tmp = make([]*Sort, len(x.ToSort))
+ for i, p := range x.ToSort {
+ tmp[i] = p // Copy pointers for safe iteration
+ }
+
+ return tmp
+}
+
+// safely returns a slice of pointers to the MsgVar protobufs
+func (x *MsgName) selectAllVars() []*MsgVar {
+ x.Lock.RLock()
+ defer x.Lock.RUnlock()
+
+ // Create a new slice to hold pointers to each MsgVar
+ var tmp []*MsgVar
+ tmp = make([]*MsgVar, len(x.Vars))
+ for i, p := range x.Vars {
+ tmp[i] = p // Copy pointers for safe iteration
+ }
+
+ return tmp
+}
+
+// END SORT
+
+func (x *Files) Len() int {
+ x.Lock.RLock()
+ defer x.Lock.RUnlock()
+
+ return len(x.Files)
+}
+
+// just a simple Append() shortcut (but still uses the mutex lock)
+func (x *Files) Append(y *File) {
+ x.Lock.Lock()
+ defer x.Lock.Unlock()
+
+ x.Files = append(x.Files, y)
+}
+
+func (x *Files) All() *FileIterator {
+ FilePointers := x.selectAllFiles()
+
+ iterator := newFileIterator(FilePointers)
+ return iterator
+}