//..............................................................................
//
// HID report decode info DB
//

import "io_hid.jncx"
import "io_HidRd.jnc"
import "std_HashTable.jnc"

//..............................................................................

class HidReportDecodeInfoDb {
protected:
	std.HashTable m_map;

public:
	std.Buffer const* getReportDecodeInfo(io.HidReport const* report);
}

// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

std.Buffer const* HidReportDecodeInfoDb.getReportDecodeInfo(io.HidReport const* report) {
	std.MapEntry* it = m_map.visit(report);
	std.Buffer* decodeInfo = it.m_value;
	if (!decodeInfo) {
		decodeInfo = new std.Buffer;
		report.saveDecodeInfo(decodeInfo);
		it.m_value = decodeInfo;
	}
	
	return decodeInfo;
}

//..............................................................................
