// This returns a *Processor ready to use. If a Processors struct isn't created
// using the New func, the ByteOrder field will not be set.
428199
func New() *Processors {
	return &Processors{Timestamp: time.Now().UTC().UnixNano(), ByteOrder: Endianness()}
}
1260336
func (d CPUDetails) Cores() cpuset.CPUSet {
	b := cpuset.NewBuilder()
	for _, info := range d {
		b.Add(info.CoreID)
	}
	return b.Result()
}
631152
func WithProcessCacheData(c context.Context, data *ProcessCacheData) context.Context {
	if data.caches == nil {
		panic("use NewProcessCacheData to allocate ProcessCacheData")
	}
	return context.WithValue(c, &processCacheKey, data)
}
327740
func (prv *ProcessorProvider) Get(params imageserver.Params) (image.Image, error) {
	nim, err := prv.Provider.Get(params)
	if err != nil {
		return nil, err
	}
	nim, err = prv.Processor.Process(nim, params)
	if err != nil {
		return nil, err
	}
	return nim, nil
}
194677
func (f ProcessorFunc) Process(g *gif.GIF, params imageserver.Params) (*gif.GIF, error) {
	return f(g, params)
}
204922
func Serialize(proc *procs.Processors) (p []byte, err error) {
	stdMu.Lock()
	defer stdMu.Unlock()
	if std == nil {
		std, err = NewProfiler()
		if err != nil {
			return nil, err
		}
	}
	return std.Serialize(proc)
}
663144
func (p *Processor) Marshal(msg interface{}) ([][]byte, error) {
	msgType := reflect.TypeOf(msg)
	if msgType == nil || msgType.Kind() != reflect.Ptr {
		return nil, errors.New("json message pointer required")
	}
	msgID := msgType.Elem().Name()
	if _, ok := p.msgInfo[msgID]; !ok {
		return nil, fmt.Errorf("message %v not registered", msgID)
	}

	// data
	m := map[string]interface{}{msgID: msg}
	data, err := json.Marshal(m)
	return [][]byte{data}, err
}
705446
func First(i interface{}) (interface{}, error) {
	t := reflect.TypeOf(i)
	v := reflect.ValueOf(i)

	switch t.Kind() {
	case reflect.Array, reflect.Slice:
	default:
		return nil, fmt.Errorf("value is nither Slice nor Array")
	}

	if v.Len() == 0 {
		return nil, fmt.Errorf("empty array")
	}

	return v.Index(0).Interface(), nil
}
1149093
func (language *GoLanguageModel) Prepare(model *surface.Model) {

	for _, t := range model.Types {
		// determine the type used for Go language implementation of the type
		t.TypeName = strings.Title(filteredTypeName(t.Name))

		for _, f := range t.Fields {
			f.FieldName = goFieldName(f.Name)
			f.ParameterName = goParameterName(f.Name)
			switch f.Type {
			case "boolean":
				f.NativeType = "bool"
			case "number":
				f.NativeType = "int"
			case "integer":
				switch f.Format {
				case "int32":
					f.NativeType = "int32"
				case "int64":
					f.NativeType = "int64"
				default:
					f.NativeType = "int64"
				}
			case "object":
				f.NativeType = "interface{}"
			case "string":
				f.NativeType = "string"
			default:
				f.NativeType = strings.Title(filteredTypeName(f.Type))
			}
		}
	}

	for _, m := range model.Methods {
		m.HandlerName = "Handle" + m.Name
		m.ProcessorName = m.Name
		m.ClientName = m.Name
	}
}
1357278
func NewProcessor(gamma float64, highQuality bool) *Processor {
	prc := new(Processor)
	gammaInv := 1 / gamma
	for i := range prc.vals {
		prc.vals[i] = uint16(math.Pow(float64(i)/65535, gammaInv)*65535 + 0.5)
	}
	if highQuality {
		prc.newDrawable = func(p image.Image) draw.Image {
			return image.NewNRGBA64(p.Bounds())
		}
	} else {
		prc.newDrawable = imageserver_image_internal.NewDrawable
	}
	return prc
}
1270886
func NewTrimPrefixProcessor(prefix string) ProcessorFunc {
	prefixTrimmer := func(in string) (string, bool) {
		out := strings.TrimPrefix(in, prefix)
		return out, out != in
	}
	return NewLoopProcessor(ProcessorFunc(prefixTrimmer))
}
478465
func (res *Resource) AddProcessor(processor *Processor) {
	for idx, p := range res.Processors {
		if p.Name == processor.Name {
			res.Processors[idx] = processor
			return
		}
	}
	res.Processors = append(res.Processors, processor)
}
1174316
func (c *Client) PostProcessor() (packer.PostProcessor, error) {
	client, err := c.packrpcClient()
	if err != nil {
		return nil, err
	}

	return &cmdPostProcessor{client.PostProcessor(), c}, nil
}
591010
func NewMockProcessor(ctrl *gomock.Controller) *MockProcessor {
	mock := &MockProcessor{ctrl: ctrl}
	mock.recorder = &MockProcessorMockRecorder{mock}
	return mock
}
1278731
func (c *Config) ProcessorNames() []string {
	var name []string
	for _, processor := range c.Processors {
		name = append(name, processor.Name)
	}
	return name
}
383514
func addressableSlice(slice interface{}) reflect.Value {
	v := reflect.ValueOf(slice)
	p := reflect.New(v.Type())
	p.Elem().Set(v)
	return p.Elem()
}
733013
func (b *coreBuild) Prepare() (warn []string, err error) {
	b.l.Lock()
	defer b.l.Unlock()

	if b.prepareCalled {
		panic("prepare already called")
	}

	b.prepareCalled = true

	packerConfig := map[string]interface{}{
		BuildNameConfigKey:     b.name,
		BuilderTypeConfigKey:   b.builderType,
		DebugConfigKey:         b.debug,
		ForceConfigKey:         b.force,
		OnErrorConfigKey:       b.onError,
		TemplatePathKey:        b.templatePath,
		UserVariablesConfigKey: b.variables,
	}

	// Prepare the builder
	warn, err = b.builder.Prepare(b.builderConfig, packerConfig)
	if err != nil {
		log.Printf("Build '%s' prepare failure: %s\n", b.name, err)
		return
	}

	// Prepare the provisioners
	for _, coreProv := range b.provisioners {
		configs := make([]interface{}, len(coreProv.config), len(coreProv.config)+1)
		copy(configs, coreProv.config)
		configs = append(configs, packerConfig)

		if err = coreProv.provisioner.Prepare(configs...); err != nil {
			return
		}
	}

	// Prepare the post-processors
	for _, ppSeq := range b.postProcessors {
		for _, corePP := range ppSeq {
			err = corePP.processor.Configure(corePP.config, packerConfig)
			if err != nil {
				return
			}
		}
	}

	return
}