//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

package cfg;


import "demo/luban"

type TestTbItem2 struct {
    _dataMap map[int32]interface{}
    _dataList []interface{}
}

func NewTestTbItem2(_buf *luban.ByteBuf) (*TestTbItem2, error) {
	if size, err := _buf.ReadSize() ; err != nil {
		return nil, err
	} else {
		_dataList := make([]interface{}, 0, size)
		dataMap := make(map[int32]interface{})

		for i := 0 ; i < size ; i++ {
			if _v, err2 := NewTestItemBase(_buf); err2 != nil {
				return nil, err2
			} else {
				_dataList = append(_dataList, _v)
                if __v, __is := _v.(*TestItem) ; __is {
                    dataMap[__v.Id] = _v
                    continue
                }
                if __v, __is := _v.(*TestEquipment) ; __is {
                    dataMap[__v.Id] = _v
                    continue
                }
                if __v, __is := _v.(*TestDecorator) ; __is {
                    dataMap[__v.Id] = _v
                    continue
                }
			}
		}
		return &TestTbItem2{_dataList:_dataList, _dataMap:dataMap}, nil
	}
}

func (table *TestTbItem2) GetDataMap() map[int32]interface{} {
    return table._dataMap
}

func (table *TestTbItem2) GetDataList() []interface{} {
    return table._dataList
}

func (table *TestTbItem2) Get(key int32) interface{} {
    return table._dataMap[key]
}