// Package diagram provide diagram data structure and operation package diagram import ( "fmt" "modelRT/util" ) // anchorValueOverview define struct of storage all anchor value keyed by component uuid var anchorValueOverview util.TypedMap[string, string] // GetAnchorValue define func of get circuit diagram data by componentID func GetAnchorValue(componentUUID string) (string, error) { anchorValue, ok := anchorValueOverview.Load(componentUUID) if !ok { return "", fmt.Errorf("can not find anchor value by componentUUID:%s", componentUUID) } return anchorValue, nil } // UpdateAnchorValue define func of update anchor value by componentUUID and anchor name func UpdateAnchorValue(componentUUID string, anchorValue string) bool { _, result := anchorValueOverview.Swap(componentUUID, anchorValue) return result } // StoreAnchorValue define func of store anchor value with componentUUID and anchor name func StoreAnchorValue(componentUUID string, anchorValue string) { anchorValueOverview.Store(componentUUID, anchorValue) } // DeleteAnchorValue define func of delete anchor value with componentUUID func DeleteAnchorValue(componentUUID string) { anchorValueOverview.Delete(componentUUID) }