void Channel::Load()
{
pt_.clear();
- path p("./channels");
+ path default_json_path("./channels/default.config.json");
+ if (exists(default_json_path) && !is_directory(default_json_path)) {
+ try {
+ boost::property_tree::ptree config_pt;
+ read_json(default_json_path.string(), config_pt);
+ pt_.put_child("ch000", config_pt);
+
+ } catch (const std::exception& e) {
+ Logger::Error("%d", e.what());
+ }
+ }
+
+ path p("./channels");
if (exists(p) && is_directory(p)) {
for (auto it_dir = directory_iterator(p); it_dir != directory_iterator(); ++it_dir) {
if (is_directory(*it_dir)) {
const boost::property_tree::ptree& Channel::pt() const
{
return pt_;
+}
+
+std::string Channel::GetDefaultStage() const
+{
+ return pt_.get<std::string>("ch000.stage");
+}
+
+int Channel::GetDefaultCapacity() const
+{
+ return pt_.get<int>("ch000.capacity");
}
\ No newline at end of file
Channel();
const boost::property_tree::ptree& pt() const;
+ std::string GetDefaultStage() const;
+ int GetDefaultCapacity() const;
private:
void Load();