/
ui.go
61 lines (52 loc) · 1.17 KB
/
ui.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
// Copyright ©2017 The go-hep Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package job
import (
"io"
"go-hep.org/x/hep/fwk"
)
// UI wraps a fwk.Scripter and panics when an error occurs
type UI struct {
ui fwk.Scripter
}
// Configure configures the underlying fwk.App.
// Configure panics if an error occurs.
func (ui UI) Configure() {
err := ui.ui.Configure()
if err != nil {
panic(err)
}
}
// Start starts the underlying fwk.App.
// Start panics if an error occurs.
func (ui UI) Start() {
err := ui.ui.Start()
if err != nil {
panic(err)
}
}
// Run runs the event-loop of the underlying fwk.App.
// Run panics if an error different than io.EOF occurs.
func (ui UI) Run(evtmax int64) {
err := ui.ui.Run(evtmax)
if err != nil && err != io.EOF {
panic(err)
}
}
// Stop stops the underlying fwk.App.
// Stopt panics if an error occurs.
func (ui UI) Stop() {
err := ui.ui.Stop()
if err != nil {
panic(err)
}
}
// Shutdown shuts the underlying fwk.App down.
// Shutdown panics if an error occurs.
func (ui UI) Shutdown() {
err := ui.ui.Shutdown()
if err != nil {
panic(err)
}
}