blob: 3e37c31c06aacf65dd9d513bf83e4dc4749837cc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
local ParamRepo = nerv.class("nerv.ParamRepo")
function ParamRepo:__init(param_files)
local param_table = {}
if type(param_files) ~= "table" then
nerv.error("param file table is need")
end
for i = 1, #param_files do
local pf = nerv.ChunkFile(param_files[i], "r")
for cid, cspec in pairs(pf.metadata) do
if param_table[cid] ~= nil then
nerv.error("conflicting chunk id in param files")
end
param_table[cid] = pf
end
end
self.param_table = param_table
end
function ParamRepo:get_param(pid, global_conf)
local pf = self.param_table[pid]
if pf == nil then
nerv.error("param with id %s not found", pid)
end
return pf:read_chunk(pid, global_conf)
end
|