/
gong.go
4462 lines (4090 loc) · 134 KB
/
gong.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// generated code - do not edit
package models
import (
"cmp"
"errors"
"fmt"
"math"
"slices"
"time"
"golang.org/x/exp/maps"
)
func __Gong__Abs(x int) int {
if x < 0 {
return -x
}
return x
}
// errUnkownEnum is returns when a value cannot match enum values
var errUnkownEnum = errors.New("unkown enum")
// needed to avoid when fmt package is not needed by generated code
var __dummy__fmt_variable fmt.Scanner
// idem for math package when not need by generated code
var __dummy_math_variable = math.E
// swagger:ignore
type __void any
// needed for creating set of instances in the stage
var __member __void
// GongStructInterface is the interface met by GongStructs
// It allows runtime reflexion of instances (without the hassle of the "reflect" package)
type GongStructInterface interface {
GetName() (res string)
// GetID() (res int)
// GetFields() (res []string)
// GetFieldStringValue(fieldName string) (res string)
}
// StageStruct enables storage of staged instances
// swagger:ignore
type StageStruct struct {
path string
// insertion point for definition of arrays registering instances
Animates map[*Animate]any
Animates_mapString map[string]*Animate
// insertion point for slice of pointers maps
OnAfterAnimateCreateCallback OnAfterCreateInterface[Animate]
OnAfterAnimateUpdateCallback OnAfterUpdateInterface[Animate]
OnAfterAnimateDeleteCallback OnAfterDeleteInterface[Animate]
OnAfterAnimateReadCallback OnAfterReadInterface[Animate]
Circles map[*Circle]any
Circles_mapString map[string]*Circle
// insertion point for slice of pointers maps
Circle_Animations_reverseMap map[*Animate]*Circle
OnAfterCircleCreateCallback OnAfterCreateInterface[Circle]
OnAfterCircleUpdateCallback OnAfterUpdateInterface[Circle]
OnAfterCircleDeleteCallback OnAfterDeleteInterface[Circle]
OnAfterCircleReadCallback OnAfterReadInterface[Circle]
Ellipses map[*Ellipse]any
Ellipses_mapString map[string]*Ellipse
// insertion point for slice of pointers maps
Ellipse_Animates_reverseMap map[*Animate]*Ellipse
OnAfterEllipseCreateCallback OnAfterCreateInterface[Ellipse]
OnAfterEllipseUpdateCallback OnAfterUpdateInterface[Ellipse]
OnAfterEllipseDeleteCallback OnAfterDeleteInterface[Ellipse]
OnAfterEllipseReadCallback OnAfterReadInterface[Ellipse]
Layers map[*Layer]any
Layers_mapString map[string]*Layer
// insertion point for slice of pointers maps
Layer_Rects_reverseMap map[*Rect]*Layer
Layer_Texts_reverseMap map[*Text]*Layer
Layer_Circles_reverseMap map[*Circle]*Layer
Layer_Lines_reverseMap map[*Line]*Layer
Layer_Ellipses_reverseMap map[*Ellipse]*Layer
Layer_Polylines_reverseMap map[*Polyline]*Layer
Layer_Polygones_reverseMap map[*Polygone]*Layer
Layer_Paths_reverseMap map[*Path]*Layer
Layer_Links_reverseMap map[*Link]*Layer
Layer_RectLinkLinks_reverseMap map[*RectLinkLink]*Layer
OnAfterLayerCreateCallback OnAfterCreateInterface[Layer]
OnAfterLayerUpdateCallback OnAfterUpdateInterface[Layer]
OnAfterLayerDeleteCallback OnAfterDeleteInterface[Layer]
OnAfterLayerReadCallback OnAfterReadInterface[Layer]
Lines map[*Line]any
Lines_mapString map[string]*Line
// insertion point for slice of pointers maps
Line_Animates_reverseMap map[*Animate]*Line
OnAfterLineCreateCallback OnAfterCreateInterface[Line]
OnAfterLineUpdateCallback OnAfterUpdateInterface[Line]
OnAfterLineDeleteCallback OnAfterDeleteInterface[Line]
OnAfterLineReadCallback OnAfterReadInterface[Line]
Links map[*Link]any
Links_mapString map[string]*Link
// insertion point for slice of pointers maps
Link_TextAtArrowEnd_reverseMap map[*LinkAnchoredText]*Link
Link_TextAtArrowStart_reverseMap map[*LinkAnchoredText]*Link
Link_ControlPoints_reverseMap map[*Point]*Link
OnAfterLinkCreateCallback OnAfterCreateInterface[Link]
OnAfterLinkUpdateCallback OnAfterUpdateInterface[Link]
OnAfterLinkDeleteCallback OnAfterDeleteInterface[Link]
OnAfterLinkReadCallback OnAfterReadInterface[Link]
LinkAnchoredTexts map[*LinkAnchoredText]any
LinkAnchoredTexts_mapString map[string]*LinkAnchoredText
// insertion point for slice of pointers maps
LinkAnchoredText_Animates_reverseMap map[*Animate]*LinkAnchoredText
OnAfterLinkAnchoredTextCreateCallback OnAfterCreateInterface[LinkAnchoredText]
OnAfterLinkAnchoredTextUpdateCallback OnAfterUpdateInterface[LinkAnchoredText]
OnAfterLinkAnchoredTextDeleteCallback OnAfterDeleteInterface[LinkAnchoredText]
OnAfterLinkAnchoredTextReadCallback OnAfterReadInterface[LinkAnchoredText]
Paths map[*Path]any
Paths_mapString map[string]*Path
// insertion point for slice of pointers maps
Path_Animates_reverseMap map[*Animate]*Path
OnAfterPathCreateCallback OnAfterCreateInterface[Path]
OnAfterPathUpdateCallback OnAfterUpdateInterface[Path]
OnAfterPathDeleteCallback OnAfterDeleteInterface[Path]
OnAfterPathReadCallback OnAfterReadInterface[Path]
Points map[*Point]any
Points_mapString map[string]*Point
// insertion point for slice of pointers maps
OnAfterPointCreateCallback OnAfterCreateInterface[Point]
OnAfterPointUpdateCallback OnAfterUpdateInterface[Point]
OnAfterPointDeleteCallback OnAfterDeleteInterface[Point]
OnAfterPointReadCallback OnAfterReadInterface[Point]
Polygones map[*Polygone]any
Polygones_mapString map[string]*Polygone
// insertion point for slice of pointers maps
Polygone_Animates_reverseMap map[*Animate]*Polygone
OnAfterPolygoneCreateCallback OnAfterCreateInterface[Polygone]
OnAfterPolygoneUpdateCallback OnAfterUpdateInterface[Polygone]
OnAfterPolygoneDeleteCallback OnAfterDeleteInterface[Polygone]
OnAfterPolygoneReadCallback OnAfterReadInterface[Polygone]
Polylines map[*Polyline]any
Polylines_mapString map[string]*Polyline
// insertion point for slice of pointers maps
Polyline_Animates_reverseMap map[*Animate]*Polyline
OnAfterPolylineCreateCallback OnAfterCreateInterface[Polyline]
OnAfterPolylineUpdateCallback OnAfterUpdateInterface[Polyline]
OnAfterPolylineDeleteCallback OnAfterDeleteInterface[Polyline]
OnAfterPolylineReadCallback OnAfterReadInterface[Polyline]
Rects map[*Rect]any
Rects_mapString map[string]*Rect
// insertion point for slice of pointers maps
Rect_Animations_reverseMap map[*Animate]*Rect
Rect_RectAnchoredTexts_reverseMap map[*RectAnchoredText]*Rect
Rect_RectAnchoredRects_reverseMap map[*RectAnchoredRect]*Rect
Rect_RectAnchoredPaths_reverseMap map[*RectAnchoredPath]*Rect
OnAfterRectCreateCallback OnAfterCreateInterface[Rect]
OnAfterRectUpdateCallback OnAfterUpdateInterface[Rect]
OnAfterRectDeleteCallback OnAfterDeleteInterface[Rect]
OnAfterRectReadCallback OnAfterReadInterface[Rect]
RectAnchoredPaths map[*RectAnchoredPath]any
RectAnchoredPaths_mapString map[string]*RectAnchoredPath
// insertion point for slice of pointers maps
OnAfterRectAnchoredPathCreateCallback OnAfterCreateInterface[RectAnchoredPath]
OnAfterRectAnchoredPathUpdateCallback OnAfterUpdateInterface[RectAnchoredPath]
OnAfterRectAnchoredPathDeleteCallback OnAfterDeleteInterface[RectAnchoredPath]
OnAfterRectAnchoredPathReadCallback OnAfterReadInterface[RectAnchoredPath]
RectAnchoredRects map[*RectAnchoredRect]any
RectAnchoredRects_mapString map[string]*RectAnchoredRect
// insertion point for slice of pointers maps
OnAfterRectAnchoredRectCreateCallback OnAfterCreateInterface[RectAnchoredRect]
OnAfterRectAnchoredRectUpdateCallback OnAfterUpdateInterface[RectAnchoredRect]
OnAfterRectAnchoredRectDeleteCallback OnAfterDeleteInterface[RectAnchoredRect]
OnAfterRectAnchoredRectReadCallback OnAfterReadInterface[RectAnchoredRect]
RectAnchoredTexts map[*RectAnchoredText]any
RectAnchoredTexts_mapString map[string]*RectAnchoredText
// insertion point for slice of pointers maps
RectAnchoredText_Animates_reverseMap map[*Animate]*RectAnchoredText
OnAfterRectAnchoredTextCreateCallback OnAfterCreateInterface[RectAnchoredText]
OnAfterRectAnchoredTextUpdateCallback OnAfterUpdateInterface[RectAnchoredText]
OnAfterRectAnchoredTextDeleteCallback OnAfterDeleteInterface[RectAnchoredText]
OnAfterRectAnchoredTextReadCallback OnAfterReadInterface[RectAnchoredText]
RectLinkLinks map[*RectLinkLink]any
RectLinkLinks_mapString map[string]*RectLinkLink
// insertion point for slice of pointers maps
OnAfterRectLinkLinkCreateCallback OnAfterCreateInterface[RectLinkLink]
OnAfterRectLinkLinkUpdateCallback OnAfterUpdateInterface[RectLinkLink]
OnAfterRectLinkLinkDeleteCallback OnAfterDeleteInterface[RectLinkLink]
OnAfterRectLinkLinkReadCallback OnAfterReadInterface[RectLinkLink]
SVGs map[*SVG]any
SVGs_mapString map[string]*SVG
// insertion point for slice of pointers maps
SVG_Layers_reverseMap map[*Layer]*SVG
OnAfterSVGCreateCallback OnAfterCreateInterface[SVG]
OnAfterSVGUpdateCallback OnAfterUpdateInterface[SVG]
OnAfterSVGDeleteCallback OnAfterDeleteInterface[SVG]
OnAfterSVGReadCallback OnAfterReadInterface[SVG]
Texts map[*Text]any
Texts_mapString map[string]*Text
// insertion point for slice of pointers maps
Text_Animates_reverseMap map[*Animate]*Text
OnAfterTextCreateCallback OnAfterCreateInterface[Text]
OnAfterTextUpdateCallback OnAfterUpdateInterface[Text]
OnAfterTextDeleteCallback OnAfterDeleteInterface[Text]
OnAfterTextReadCallback OnAfterReadInterface[Text]
AllModelsStructCreateCallback AllModelsStructCreateInterface
AllModelsStructDeleteCallback AllModelsStructDeleteInterface
BackRepo BackRepoInterface
// if set will be called before each commit to the back repo
OnInitCommitCallback OnInitCommitInterface
OnInitCommitFromFrontCallback OnInitCommitInterface
OnInitCommitFromBackCallback OnInitCommitInterface
// store the number of instance per gongstruct
Map_GongStructName_InstancesNb map[string]int
// store meta package import
MetaPackageImportPath string
MetaPackageImportAlias string
// to be removed after fix of [issue](https://github.com/golang/go/issues/57559)
// map to enable docLink renaming when an identifier is renamed
Map_DocLink_Renaming map[string]GONG__Identifier
// the to be removed stops here
}
func (stage *StageStruct) GetType() string {
return "github.com/fullstack-lang/gongsvg/go/models"
}
type GONG__Identifier struct {
Ident string
Type GONG__ExpressionType
}
type OnInitCommitInterface interface {
BeforeCommit(stage *StageStruct)
}
// OnAfterCreateInterface callback when an instance is updated from the front
type OnAfterCreateInterface[Type Gongstruct] interface {
OnAfterCreate(stage *StageStruct,
instance *Type)
}
// OnAfterReadInterface callback when an instance is updated from the front
type OnAfterReadInterface[Type Gongstruct] interface {
OnAfterRead(stage *StageStruct,
instance *Type)
}
// OnAfterUpdateInterface callback when an instance is updated from the front
type OnAfterUpdateInterface[Type Gongstruct] interface {
OnAfterUpdate(stage *StageStruct, old, new *Type)
}
// OnAfterDeleteInterface callback when an instance is updated from the front
type OnAfterDeleteInterface[Type Gongstruct] interface {
OnAfterDelete(stage *StageStruct,
staged, front *Type)
}
type BackRepoInterface interface {
Commit(stage *StageStruct)
Checkout(stage *StageStruct)
Backup(stage *StageStruct, dirPath string)
Restore(stage *StageStruct, dirPath string)
BackupXL(stage *StageStruct, dirPath string)
RestoreXL(stage *StageStruct, dirPath string)
// insertion point for Commit and Checkout signatures
CommitAnimate(animate *Animate)
CheckoutAnimate(animate *Animate)
CommitCircle(circle *Circle)
CheckoutCircle(circle *Circle)
CommitEllipse(ellipse *Ellipse)
CheckoutEllipse(ellipse *Ellipse)
CommitLayer(layer *Layer)
CheckoutLayer(layer *Layer)
CommitLine(line *Line)
CheckoutLine(line *Line)
CommitLink(link *Link)
CheckoutLink(link *Link)
CommitLinkAnchoredText(linkanchoredtext *LinkAnchoredText)
CheckoutLinkAnchoredText(linkanchoredtext *LinkAnchoredText)
CommitPath(path *Path)
CheckoutPath(path *Path)
CommitPoint(point *Point)
CheckoutPoint(point *Point)
CommitPolygone(polygone *Polygone)
CheckoutPolygone(polygone *Polygone)
CommitPolyline(polyline *Polyline)
CheckoutPolyline(polyline *Polyline)
CommitRect(rect *Rect)
CheckoutRect(rect *Rect)
CommitRectAnchoredPath(rectanchoredpath *RectAnchoredPath)
CheckoutRectAnchoredPath(rectanchoredpath *RectAnchoredPath)
CommitRectAnchoredRect(rectanchoredrect *RectAnchoredRect)
CheckoutRectAnchoredRect(rectanchoredrect *RectAnchoredRect)
CommitRectAnchoredText(rectanchoredtext *RectAnchoredText)
CheckoutRectAnchoredText(rectanchoredtext *RectAnchoredText)
CommitRectLinkLink(rectlinklink *RectLinkLink)
CheckoutRectLinkLink(rectlinklink *RectLinkLink)
CommitSVG(svg *SVG)
CheckoutSVG(svg *SVG)
CommitText(text *Text)
CheckoutText(text *Text)
GetLastCommitFromBackNb() uint
GetLastPushFromFrontNb() uint
}
func NewStage(path string) (stage *StageStruct) {
stage = &StageStruct{ // insertion point for array initiatialisation
Animates: make(map[*Animate]any),
Animates_mapString: make(map[string]*Animate),
Circles: make(map[*Circle]any),
Circles_mapString: make(map[string]*Circle),
Ellipses: make(map[*Ellipse]any),
Ellipses_mapString: make(map[string]*Ellipse),
Layers: make(map[*Layer]any),
Layers_mapString: make(map[string]*Layer),
Lines: make(map[*Line]any),
Lines_mapString: make(map[string]*Line),
Links: make(map[*Link]any),
Links_mapString: make(map[string]*Link),
LinkAnchoredTexts: make(map[*LinkAnchoredText]any),
LinkAnchoredTexts_mapString: make(map[string]*LinkAnchoredText),
Paths: make(map[*Path]any),
Paths_mapString: make(map[string]*Path),
Points: make(map[*Point]any),
Points_mapString: make(map[string]*Point),
Polygones: make(map[*Polygone]any),
Polygones_mapString: make(map[string]*Polygone),
Polylines: make(map[*Polyline]any),
Polylines_mapString: make(map[string]*Polyline),
Rects: make(map[*Rect]any),
Rects_mapString: make(map[string]*Rect),
RectAnchoredPaths: make(map[*RectAnchoredPath]any),
RectAnchoredPaths_mapString: make(map[string]*RectAnchoredPath),
RectAnchoredRects: make(map[*RectAnchoredRect]any),
RectAnchoredRects_mapString: make(map[string]*RectAnchoredRect),
RectAnchoredTexts: make(map[*RectAnchoredText]any),
RectAnchoredTexts_mapString: make(map[string]*RectAnchoredText),
RectLinkLinks: make(map[*RectLinkLink]any),
RectLinkLinks_mapString: make(map[string]*RectLinkLink),
SVGs: make(map[*SVG]any),
SVGs_mapString: make(map[string]*SVG),
Texts: make(map[*Text]any),
Texts_mapString: make(map[string]*Text),
// end of insertion point
Map_GongStructName_InstancesNb: make(map[string]int),
path: path,
// to be removed after fix of [issue](https://github.com/golang/go/issues/57559)
Map_DocLink_Renaming: make(map[string]GONG__Identifier),
// the to be removed stops here
}
return
}
func (stage *StageStruct) GetPath() string {
return stage.path
}
func (stage *StageStruct) CommitWithSuspendedCallbacks() {
tmp := stage.OnInitCommitFromBackCallback
stage.OnInitCommitFromBackCallback = nil
stage.Commit()
stage.OnInitCommitFromBackCallback = tmp
}
func (stage *StageStruct) Commit() {
stage.ComputeReverseMaps()
if stage.BackRepo != nil {
stage.BackRepo.Commit(stage)
}
// insertion point for computing the map of number of instances per gongstruct
stage.Map_GongStructName_InstancesNb["Animate"] = len(stage.Animates)
stage.Map_GongStructName_InstancesNb["Circle"] = len(stage.Circles)
stage.Map_GongStructName_InstancesNb["Ellipse"] = len(stage.Ellipses)
stage.Map_GongStructName_InstancesNb["Layer"] = len(stage.Layers)
stage.Map_GongStructName_InstancesNb["Line"] = len(stage.Lines)
stage.Map_GongStructName_InstancesNb["Link"] = len(stage.Links)
stage.Map_GongStructName_InstancesNb["LinkAnchoredText"] = len(stage.LinkAnchoredTexts)
stage.Map_GongStructName_InstancesNb["Path"] = len(stage.Paths)
stage.Map_GongStructName_InstancesNb["Point"] = len(stage.Points)
stage.Map_GongStructName_InstancesNb["Polygone"] = len(stage.Polygones)
stage.Map_GongStructName_InstancesNb["Polyline"] = len(stage.Polylines)
stage.Map_GongStructName_InstancesNb["Rect"] = len(stage.Rects)
stage.Map_GongStructName_InstancesNb["RectAnchoredPath"] = len(stage.RectAnchoredPaths)
stage.Map_GongStructName_InstancesNb["RectAnchoredRect"] = len(stage.RectAnchoredRects)
stage.Map_GongStructName_InstancesNb["RectAnchoredText"] = len(stage.RectAnchoredTexts)
stage.Map_GongStructName_InstancesNb["RectLinkLink"] = len(stage.RectLinkLinks)
stage.Map_GongStructName_InstancesNb["SVG"] = len(stage.SVGs)
stage.Map_GongStructName_InstancesNb["Text"] = len(stage.Texts)
}
func (stage *StageStruct) Checkout() {
if stage.BackRepo != nil {
stage.BackRepo.Checkout(stage)
}
stage.ComputeReverseMaps()
// insertion point for computing the map of number of instances per gongstruct
stage.Map_GongStructName_InstancesNb["Animate"] = len(stage.Animates)
stage.Map_GongStructName_InstancesNb["Circle"] = len(stage.Circles)
stage.Map_GongStructName_InstancesNb["Ellipse"] = len(stage.Ellipses)
stage.Map_GongStructName_InstancesNb["Layer"] = len(stage.Layers)
stage.Map_GongStructName_InstancesNb["Line"] = len(stage.Lines)
stage.Map_GongStructName_InstancesNb["Link"] = len(stage.Links)
stage.Map_GongStructName_InstancesNb["LinkAnchoredText"] = len(stage.LinkAnchoredTexts)
stage.Map_GongStructName_InstancesNb["Path"] = len(stage.Paths)
stage.Map_GongStructName_InstancesNb["Point"] = len(stage.Points)
stage.Map_GongStructName_InstancesNb["Polygone"] = len(stage.Polygones)
stage.Map_GongStructName_InstancesNb["Polyline"] = len(stage.Polylines)
stage.Map_GongStructName_InstancesNb["Rect"] = len(stage.Rects)
stage.Map_GongStructName_InstancesNb["RectAnchoredPath"] = len(stage.RectAnchoredPaths)
stage.Map_GongStructName_InstancesNb["RectAnchoredRect"] = len(stage.RectAnchoredRects)
stage.Map_GongStructName_InstancesNb["RectAnchoredText"] = len(stage.RectAnchoredTexts)
stage.Map_GongStructName_InstancesNb["RectLinkLink"] = len(stage.RectLinkLinks)
stage.Map_GongStructName_InstancesNb["SVG"] = len(stage.SVGs)
stage.Map_GongStructName_InstancesNb["Text"] = len(stage.Texts)
}
// backup generates backup files in the dirPath
func (stage *StageStruct) Backup(dirPath string) {
if stage.BackRepo != nil {
stage.BackRepo.Backup(stage, dirPath)
}
}
// Restore resets Stage & BackRepo and restores their content from the restore files in dirPath
func (stage *StageStruct) Restore(dirPath string) {
if stage.BackRepo != nil {
stage.BackRepo.Restore(stage, dirPath)
}
}
// backup generates backup files in the dirPath
func (stage *StageStruct) BackupXL(dirPath string) {
if stage.BackRepo != nil {
stage.BackRepo.BackupXL(stage, dirPath)
}
}
// Restore resets Stage & BackRepo and restores their content from the restore files in dirPath
func (stage *StageStruct) RestoreXL(dirPath string) {
if stage.BackRepo != nil {
stage.BackRepo.RestoreXL(stage, dirPath)
}
}
// insertion point for cumulative sub template with model space calls
// Stage puts animate to the model stage
func (animate *Animate) Stage(stage *StageStruct) *Animate {
stage.Animates[animate] = __member
stage.Animates_mapString[animate.Name] = animate
return animate
}
// Unstage removes animate off the model stage
func (animate *Animate) Unstage(stage *StageStruct) *Animate {
delete(stage.Animates, animate)
delete(stage.Animates_mapString, animate.Name)
return animate
}
// UnstageVoid removes animate off the model stage
func (animate *Animate) UnstageVoid(stage *StageStruct) {
delete(stage.Animates, animate)
delete(stage.Animates_mapString, animate.Name)
}
// commit animate to the back repo (if it is already staged)
func (animate *Animate) Commit(stage *StageStruct) *Animate {
if _, ok := stage.Animates[animate]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CommitAnimate(animate)
}
}
return animate
}
func (animate *Animate) CommitVoid(stage *StageStruct) {
animate.Commit(stage)
}
// Checkout animate to the back repo (if it is already staged)
func (animate *Animate) Checkout(stage *StageStruct) *Animate {
if _, ok := stage.Animates[animate]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CheckoutAnimate(animate)
}
}
return animate
}
// for satisfaction of GongStruct interface
func (animate *Animate) GetName() (res string) {
return animate.Name
}
// Stage puts circle to the model stage
func (circle *Circle) Stage(stage *StageStruct) *Circle {
stage.Circles[circle] = __member
stage.Circles_mapString[circle.Name] = circle
return circle
}
// Unstage removes circle off the model stage
func (circle *Circle) Unstage(stage *StageStruct) *Circle {
delete(stage.Circles, circle)
delete(stage.Circles_mapString, circle.Name)
return circle
}
// UnstageVoid removes circle off the model stage
func (circle *Circle) UnstageVoid(stage *StageStruct) {
delete(stage.Circles, circle)
delete(stage.Circles_mapString, circle.Name)
}
// commit circle to the back repo (if it is already staged)
func (circle *Circle) Commit(stage *StageStruct) *Circle {
if _, ok := stage.Circles[circle]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CommitCircle(circle)
}
}
return circle
}
func (circle *Circle) CommitVoid(stage *StageStruct) {
circle.Commit(stage)
}
// Checkout circle to the back repo (if it is already staged)
func (circle *Circle) Checkout(stage *StageStruct) *Circle {
if _, ok := stage.Circles[circle]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CheckoutCircle(circle)
}
}
return circle
}
// for satisfaction of GongStruct interface
func (circle *Circle) GetName() (res string) {
return circle.Name
}
// Stage puts ellipse to the model stage
func (ellipse *Ellipse) Stage(stage *StageStruct) *Ellipse {
stage.Ellipses[ellipse] = __member
stage.Ellipses_mapString[ellipse.Name] = ellipse
return ellipse
}
// Unstage removes ellipse off the model stage
func (ellipse *Ellipse) Unstage(stage *StageStruct) *Ellipse {
delete(stage.Ellipses, ellipse)
delete(stage.Ellipses_mapString, ellipse.Name)
return ellipse
}
// UnstageVoid removes ellipse off the model stage
func (ellipse *Ellipse) UnstageVoid(stage *StageStruct) {
delete(stage.Ellipses, ellipse)
delete(stage.Ellipses_mapString, ellipse.Name)
}
// commit ellipse to the back repo (if it is already staged)
func (ellipse *Ellipse) Commit(stage *StageStruct) *Ellipse {
if _, ok := stage.Ellipses[ellipse]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CommitEllipse(ellipse)
}
}
return ellipse
}
func (ellipse *Ellipse) CommitVoid(stage *StageStruct) {
ellipse.Commit(stage)
}
// Checkout ellipse to the back repo (if it is already staged)
func (ellipse *Ellipse) Checkout(stage *StageStruct) *Ellipse {
if _, ok := stage.Ellipses[ellipse]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CheckoutEllipse(ellipse)
}
}
return ellipse
}
// for satisfaction of GongStruct interface
func (ellipse *Ellipse) GetName() (res string) {
return ellipse.Name
}
// Stage puts layer to the model stage
func (layer *Layer) Stage(stage *StageStruct) *Layer {
stage.Layers[layer] = __member
stage.Layers_mapString[layer.Name] = layer
return layer
}
// Unstage removes layer off the model stage
func (layer *Layer) Unstage(stage *StageStruct) *Layer {
delete(stage.Layers, layer)
delete(stage.Layers_mapString, layer.Name)
return layer
}
// UnstageVoid removes layer off the model stage
func (layer *Layer) UnstageVoid(stage *StageStruct) {
delete(stage.Layers, layer)
delete(stage.Layers_mapString, layer.Name)
}
// commit layer to the back repo (if it is already staged)
func (layer *Layer) Commit(stage *StageStruct) *Layer {
if _, ok := stage.Layers[layer]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CommitLayer(layer)
}
}
return layer
}
func (layer *Layer) CommitVoid(stage *StageStruct) {
layer.Commit(stage)
}
// Checkout layer to the back repo (if it is already staged)
func (layer *Layer) Checkout(stage *StageStruct) *Layer {
if _, ok := stage.Layers[layer]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CheckoutLayer(layer)
}
}
return layer
}
// for satisfaction of GongStruct interface
func (layer *Layer) GetName() (res string) {
return layer.Name
}
// Stage puts line to the model stage
func (line *Line) Stage(stage *StageStruct) *Line {
stage.Lines[line] = __member
stage.Lines_mapString[line.Name] = line
return line
}
// Unstage removes line off the model stage
func (line *Line) Unstage(stage *StageStruct) *Line {
delete(stage.Lines, line)
delete(stage.Lines_mapString, line.Name)
return line
}
// UnstageVoid removes line off the model stage
func (line *Line) UnstageVoid(stage *StageStruct) {
delete(stage.Lines, line)
delete(stage.Lines_mapString, line.Name)
}
// commit line to the back repo (if it is already staged)
func (line *Line) Commit(stage *StageStruct) *Line {
if _, ok := stage.Lines[line]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CommitLine(line)
}
}
return line
}
func (line *Line) CommitVoid(stage *StageStruct) {
line.Commit(stage)
}
// Checkout line to the back repo (if it is already staged)
func (line *Line) Checkout(stage *StageStruct) *Line {
if _, ok := stage.Lines[line]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CheckoutLine(line)
}
}
return line
}
// for satisfaction of GongStruct interface
func (line *Line) GetName() (res string) {
return line.Name
}
// Stage puts link to the model stage
func (link *Link) Stage(stage *StageStruct) *Link {
stage.Links[link] = __member
stage.Links_mapString[link.Name] = link
return link
}
// Unstage removes link off the model stage
func (link *Link) Unstage(stage *StageStruct) *Link {
delete(stage.Links, link)
delete(stage.Links_mapString, link.Name)
return link
}
// UnstageVoid removes link off the model stage
func (link *Link) UnstageVoid(stage *StageStruct) {
delete(stage.Links, link)
delete(stage.Links_mapString, link.Name)
}
// commit link to the back repo (if it is already staged)
func (link *Link) Commit(stage *StageStruct) *Link {
if _, ok := stage.Links[link]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CommitLink(link)
}
}
return link
}
func (link *Link) CommitVoid(stage *StageStruct) {
link.Commit(stage)
}
// Checkout link to the back repo (if it is already staged)
func (link *Link) Checkout(stage *StageStruct) *Link {
if _, ok := stage.Links[link]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CheckoutLink(link)
}
}
return link
}
// for satisfaction of GongStruct interface
func (link *Link) GetName() (res string) {
return link.Name
}
// Stage puts linkanchoredtext to the model stage
func (linkanchoredtext *LinkAnchoredText) Stage(stage *StageStruct) *LinkAnchoredText {
stage.LinkAnchoredTexts[linkanchoredtext] = __member
stage.LinkAnchoredTexts_mapString[linkanchoredtext.Name] = linkanchoredtext
return linkanchoredtext
}
// Unstage removes linkanchoredtext off the model stage
func (linkanchoredtext *LinkAnchoredText) Unstage(stage *StageStruct) *LinkAnchoredText {
delete(stage.LinkAnchoredTexts, linkanchoredtext)
delete(stage.LinkAnchoredTexts_mapString, linkanchoredtext.Name)
return linkanchoredtext
}
// UnstageVoid removes linkanchoredtext off the model stage
func (linkanchoredtext *LinkAnchoredText) UnstageVoid(stage *StageStruct) {
delete(stage.LinkAnchoredTexts, linkanchoredtext)
delete(stage.LinkAnchoredTexts_mapString, linkanchoredtext.Name)
}
// commit linkanchoredtext to the back repo (if it is already staged)
func (linkanchoredtext *LinkAnchoredText) Commit(stage *StageStruct) *LinkAnchoredText {
if _, ok := stage.LinkAnchoredTexts[linkanchoredtext]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CommitLinkAnchoredText(linkanchoredtext)
}
}
return linkanchoredtext
}
func (linkanchoredtext *LinkAnchoredText) CommitVoid(stage *StageStruct) {
linkanchoredtext.Commit(stage)
}
// Checkout linkanchoredtext to the back repo (if it is already staged)
func (linkanchoredtext *LinkAnchoredText) Checkout(stage *StageStruct) *LinkAnchoredText {
if _, ok := stage.LinkAnchoredTexts[linkanchoredtext]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CheckoutLinkAnchoredText(linkanchoredtext)
}
}
return linkanchoredtext
}
// for satisfaction of GongStruct interface
func (linkanchoredtext *LinkAnchoredText) GetName() (res string) {
return linkanchoredtext.Name
}
// Stage puts path to the model stage
func (path *Path) Stage(stage *StageStruct) *Path {
stage.Paths[path] = __member
stage.Paths_mapString[path.Name] = path
return path
}
// Unstage removes path off the model stage
func (path *Path) Unstage(stage *StageStruct) *Path {
delete(stage.Paths, path)
delete(stage.Paths_mapString, path.Name)
return path
}
// UnstageVoid removes path off the model stage
func (path *Path) UnstageVoid(stage *StageStruct) {
delete(stage.Paths, path)
delete(stage.Paths_mapString, path.Name)
}
// commit path to the back repo (if it is already staged)
func (path *Path) Commit(stage *StageStruct) *Path {
if _, ok := stage.Paths[path]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CommitPath(path)
}
}
return path
}
func (path *Path) CommitVoid(stage *StageStruct) {
path.Commit(stage)
}
// Checkout path to the back repo (if it is already staged)
func (path *Path) Checkout(stage *StageStruct) *Path {
if _, ok := stage.Paths[path]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CheckoutPath(path)
}
}
return path
}
// for satisfaction of GongStruct interface
func (path *Path) GetName() (res string) {
return path.Name
}
// Stage puts point to the model stage
func (point *Point) Stage(stage *StageStruct) *Point {
stage.Points[point] = __member
stage.Points_mapString[point.Name] = point
return point
}
// Unstage removes point off the model stage
func (point *Point) Unstage(stage *StageStruct) *Point {
delete(stage.Points, point)
delete(stage.Points_mapString, point.Name)
return point
}
// UnstageVoid removes point off the model stage
func (point *Point) UnstageVoid(stage *StageStruct) {
delete(stage.Points, point)
delete(stage.Points_mapString, point.Name)
}
// commit point to the back repo (if it is already staged)
func (point *Point) Commit(stage *StageStruct) *Point {
if _, ok := stage.Points[point]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CommitPoint(point)
}
}
return point
}
func (point *Point) CommitVoid(stage *StageStruct) {
point.Commit(stage)
}
// Checkout point to the back repo (if it is already staged)
func (point *Point) Checkout(stage *StageStruct) *Point {
if _, ok := stage.Points[point]; ok {
if stage.BackRepo != nil {
stage.BackRepo.CheckoutPoint(point)
}
}
return point
}
// for satisfaction of GongStruct interface
func (point *Point) GetName() (res string) {
return point.Name
}
// Stage puts polygone to the model stage
func (polygone *Polygone) Stage(stage *StageStruct) *Polygone {
stage.Polygones[polygone] = __member
stage.Polygones_mapString[polygone.Name] = polygone
return polygone
}
// Unstage removes polygone off the model stage
func (polygone *Polygone) Unstage(stage *StageStruct) *Polygone {
delete(stage.Polygones, polygone)
delete(stage.Polygones_mapString, polygone.Name)
return polygone
}
// UnstageVoid removes polygone off the model stage