ONE - On-device Neural Engine
|
Data Structures | |
class | JsonExport |
struct | Part |
struct | PConfig |
struct | Section |
Typedefs | |
using | Parts = std::vector< Part > |
using | Source = Part |
using | KeyValues = std::unordered_map< std::string, std::string > |
using | Sections = std::vector< Section > |
Functions | |
bool | read_ini (const std::string &path, PConfig &config) |
Read config as ini file, return false if failed. | |
bool | write_ini (std::ostream &os, const PConfig &config) |
Write config as ini file, return false if failed. | |
bool | write_json (std::ostream &os, const PConfig &config) |
Write config as json file, return false if failed. | |
Sections | read_ini (const char *data, size_t length) |
Reads Config INI from null terminated string and return Sections. | |
Sections | read_ini (const std::string &path) |
Reads Config INI from file and return Sections. | |
void | write_ini (std::ostream &os, const Sections §ions) |
Write Config INI with Sections to ostream. | |
void | write_ini (const std::string &path, const Sections §ions) |
Write Config INI with Sections to file, throw if failed. | |
Section | find (const Sections §ions, const std::string &name) |
Find a section with name, empty section if not found. | |
std::string | find (const Section §ion, const std::string &key) |
Find a key-value pair from key and return value, empty string if not found. | |
void | dump (std::ostream &os, const Sections §ions) |
Dump content of sections. | |
using crew::KeyValues = typedef std::unordered_map<std::string, std::string> |
Definition at line 28 of file PConfigIni.h.
using crew::Parts = typedef std::vector<Part> |
using crew::Sections = typedef std::vector<Section> |
Definition at line 36 of file PConfigIni.h.
using crew::Source = typedef Part |
void crew::dump | ( | std::ostream & | os, |
const Sections & | sections | ||
) |
Dump content of sections.
Definition at line 25 of file PConfigIniDump.cpp.
Referenced by operator<<().
std::string crew::find | ( | const Section & | section, |
const std::string & | key | ||
) |
Find a key-value pair from key and return value, empty string if not found.
Definition at line 215 of file PConfigIni.cpp.
References crew::Section::items.
Find a section with name, empty section if not found.
Definition at line 204 of file PConfigIni.cpp.
Referenced by read_ini().
Sections crew::read_ini | ( | const char * | data, |
size_t | length | ||
) |
Reads Config INI from null terminated string and return Sections.
Definition at line 59 of file PConfigIni.cpp.
References crew::Section::items, and crew::Section::name.
Sections crew::read_ini | ( | const std::string & | path | ) |
Reads Config INI from file and return Sections.
Definition at line 128 of file PConfigIni.cpp.
References foder::FileLoader::load(), and read_ini().
bool crew::read_ini | ( | const std::string & | path, |
PConfig & | config | ||
) |
Read config as ini file, return false if failed.
Definition at line 121 of file PConfig.cpp.
References find(), crew::PConfig::parts, read_ini(), and crew::PConfig::source.
Referenced by prunner::PModelsRunner::load_config(), partee::read(), read_ini(), and read_ini().
void crew::write_ini | ( | const std::string & | path, |
const Sections & | sections | ||
) |
Write Config INI with Sections to file, throw if failed.
Definition at line 190 of file PConfigIni.cpp.
References write_ini().
bool crew::write_ini | ( | std::ostream & | os, |
const PConfig & | config | ||
) |
Write config as ini file, return false if failed.
Definition at line 164 of file PConfig.cpp.
References crew::Section::items, crew::Part::model_file, crew::Section::name, crew::PConfig::parts, crew::PConfig::source, and write_ini().
Referenced by write_ini(), and write_ini().
void crew::write_ini | ( | std::ostream & | os, |
const Sections & | sections | ||
) |
Write Config INI with Sections to ostream.
Definition at line 177 of file PConfigIni.cpp.
bool crew::write_json | ( | std::ostream & | os, |
const PConfig & | config | ||
) |
Write config as json file, return false if failed.
Definition at line 202 of file PConfig.cpp.
References crew::JsonExport::close_brace(), crew::JsonExport::close_bracket(), crew::JsonExport::open_brace(), crew::JsonExport::open_bracket(), crew::PConfig::parts, and crew::PConfig::source.