Changed the layer constructor to use a more pythonic:
Layer(name, type, file) Please review and comment!
This commit is contained in:
parent
c3ff3084ca
commit
d0f0f5a564
1 changed files with 4 additions and 9 deletions
|
@ -81,18 +81,13 @@ struct layer_pickle_suite : boost::python::pickle_suite
|
|||
|
||||
namespace
|
||||
{
|
||||
//user-friendly wrapper that uses Python dictionary
|
||||
using namespace boost::python;
|
||||
Layer create_layer(const dict& d)
|
||||
Layer create_layer(const char* name, const char* type, const char* file)
|
||||
{
|
||||
parameters params;
|
||||
boost::python::list keys=d.keys();
|
||||
for (int i=0;i<len(keys);++i)
|
||||
{
|
||||
std::string key=extract<std::string>(keys[i]);
|
||||
std::string value=extract<std::string>(d[key]);
|
||||
params[key] = value;
|
||||
}
|
||||
params["name"] = name;
|
||||
params["type"] = type;
|
||||
params["file"] = file;
|
||||
return Layer(params);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue