package ndr

import (
	
	
	
	
)

// type MyBytes []byte
// implement RawBytes interface

const (
	sizeMethod = "Size"
)

// RawBytes interface should be implemented if reading just a number of bytes from the NDR stream
type RawBytes interface {
	Size(interface{}) int
}

func rawBytesSize( reflect.Value,  reflect.Value) (int, error) {
	 := .MethodByName(sizeMethod)
	if !.IsValid() {
		return 0, fmt.Errorf("could not find a method called %s on the implementation of RawBytes", sizeMethod)
	}
	 := []reflect.Value{}
	 := .Call()
	if [0].Kind() != reflect.Int {
		return 0, errors.New("the RawBytes size function did not return an integer")
	}
	return int([0].Int()), nil
}

func addSizeToTag( reflect.Value,  reflect.Value,  reflect.StructTag) (reflect.StructTag, error) {
	,  := rawBytesSize(, )
	if  != nil {
		return , 
	}
	 := parseTags()
	.Map["size"] = strconv.Itoa()
	return .StructTag(), nil
}

func ( *Decoder) ( reflect.Value,  reflect.StructTag) error {
	 := parseTags()
	,  := .Map["size"]
	if ! {
		return errors.New("size tag not available")
	}
	,  := strconv.Atoi()
	if  != nil {
		return fmt.Errorf("size not valid: %v", )
	}
	,  := .readBytes()
	if  != nil {
		return 
	}
	.Set(reflect.ValueOf().Convert(.Type()))
	return nil
}