コード例 #1
0
ファイル: pkg1.go プロジェクト: sbinet/go-gaudi
// --- factory function ---
func New(t, n string) kernel.IComponent {
	switch t {
	case "alg1":
		self := &alg1{}
		_ = kernel.NewAlg(&self.Algorithm, t, n)
		kernel.RegisterComp(self)
		return self
	case "alg2":
		self := &alg2{}
		_ = kernel.NewAlg(&self.Algorithm, t, n)
		kernel.RegisterComp(self)
		return self
	case "svc1":
		self := &svc1{}
		_ = kernel.NewSvc(&self.Service, t, n)
		kernel.RegisterComp(self)
		return self
	case "tool1":
		self := &tool1{}
		_ = kernel.NewTool(&self.AlgTool, t, n, nil)
		kernel.RegisterComp(self)
		return self
	default:
		err := "no such type [" + t + "]"
		panic(err)
	}
	return nil
}
コード例 #2
0
ファイル: datastore.go プロジェクト: sbinet/go-gaudi
// --- factory function ---
func New(t, n string) kernel.IComponent {
	switch t {
	case "datastoresvc":
		self := &datastoresvc{}
		//self.stores = make([]datastore, 1)
		_ = kernel.NewSvc(&self.Service, t, n)
		kernel.RegisterComp(self)
		return self
	default:
		err := "no such type [" + t + "]"
		panic(err)
	}
	return nil
}
コード例 #3
0
ファイル: evtproc.go プロジェクト: sbinet/go-gaudi
// --- factory function ---
func New(t, n string) kernel.IComponent {
	switch t {
	case "evtproc":
		self := &evtproc{}

		//self.properties.props = make(map[string]interface{})
		//self.name = name
		self.algs = []kernel.IAlgorithm{}
		_ = kernel.NewSvc(&self.Service, t, n)
		kernel.RegisterComp(self)
		self.DeclareProperty("NbrWorkers", 2)
		return self

	default:
		err := "no such type [" + t + "]"
		panic(err)
	}
	return nil
}
コード例 #4
0
ファイル: pkg2.go プロジェクト: sbinet/go-gaudi
// --- factory function ---
func New(t, n string) kernel.IComponent {
	switch t {
	case "alg1":
		self := &alg1{}
		_ = kernel.NewAlg(&self.Algorithm, t, n)
		kernel.RegisterComp(self)
		return self
	case "svc2":
		self := &svc2{}
		_ = kernel.NewSvc(&self.Service, t, n)
		kernel.RegisterComp(self)
		return self
	case "alg_adder":
		self := &alg_adder{}
		_ = kernel.NewAlg(&self.Algorithm, t, n)
		kernel.RegisterComp(self)

		self.DeclareProperty("Val", -99.)
		self.DeclareProperty("SimpleCounter", "cnt")
		return self

	case "alg_dumper":
		self := &alg_dumper{}
		_ = kernel.NewAlg(&self.Algorithm, t, n)
		kernel.RegisterComp(self)

		self.DeclareProperty("SimpleCounter", "cnt")
		self.DeclareProperty("ExpectedValue", -1)
		self.DeclareProperty("NbrJets", "njets")
		self.DeclareProperty("PtJets", "ptjets")
		return self

	default:
		err := "no such type [" + t + "]"
		panic(err)
	}
	return nil
}
コード例 #5
0
ファイル: outstream.go プロジェクト: sbinet/go-gaudi
// --- factory ---
func New(t, n string) kernel.IComponent {
	switch t {
	case "gob_outstream":
		self := &gob_outstream{}
		kernel.NewAlg(&self.Algorithm, t, n)
		kernel.RegisterComp(self)

		// properties
		self.DeclareProperty("Output", "foo.gob")
		self.DeclareProperty("Items", g_keys)
		return self

	case "json_outstream":
		self := &json_outstream{}
		kernel.NewAlg(&self.Algorithm, t, n)
		kernel.RegisterComp(self)

		// properties
		self.DeclareProperty("Output", "foo.json")
		self.DeclareProperty("Items", g_keys)
		return self

	case "json_outstream_svc":
		self := &json_outstream_svc{}
		kernel.NewSvc(&self.Service, t, n)
		kernel.RegisterComp(self)

		self.streams = make(map[string]kernel.IOutputStream)
		// properties

		return self

	default:
		err := "no such type [" + t + "]"
		panic(err)
	}
	return nil
}