mirror of https://github.com/subgraph/fw-daemon
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
441 B
26 lines
441 B
9 years ago
|
package definitions
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"sync"
|
||
|
)
|
||
|
|
||
|
var lock sync.RWMutex
|
||
|
var definitions = make(map[string]fmt.Stringer)
|
||
|
|
||
|
// Get returns the XML description of a UI definition and whether it was found
|
||
|
func Get(uiName string) (fmt.Stringer, bool) {
|
||
|
lock.RLock()
|
||
|
defer lock.RUnlock()
|
||
|
|
||
|
def, ok := definitions[uiName]
|
||
|
return def, ok
|
||
|
}
|
||
|
|
||
|
func add(uiName string, def fmt.Stringer) {
|
||
|
lock.Lock()
|
||
|
defer lock.Unlock()
|
||
|
|
||
|
definitions[uiName] = def
|
||
|
}
|