Ejemplo n.º 1
0
// --- 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
}
Ejemplo n.º 2
0
// --- 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
}
Ejemplo n.º 3
0
// --- 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
}
Ejemplo n.º 4
0
// --- 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
}
Ejemplo n.º 5
0
// --- 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
}