@@ -53,10 +53,27 @@ MapConfig& MapConfig::merge(const MapConfig& other) {
5353 return *this ;
5454}
5555
56+ const std::unordered_map<std::size_t , double >& OffsetConfig::offsets () const & {
57+ return this ->offsets_ ;
58+ }
59+
60+ std::unordered_map<std::size_t , double > OffsetConfig::offsets () && {
61+ return std::move (this ->offsets_ );
62+ }
63+
64+ OffsetConfig& OffsetConfig::merge (const OffsetConfig& other) {
65+ for (const auto & p : other.offsets_ ) {
66+ this ->offsets_ [p.first ] = p.second ;
67+ }
68+
69+ return *this ;
70+ }
71+
5672UserConfig::UserConfig (const std::string& path) {
5773 auto const config = toml::parse (path);
5874
5975 this ->mapping_ .names_ = toml::get_or<std::unordered_map<std::string, std::size_t >>(config, " mapping" , {});
76+ this ->offset_ .offsets_ = toml::get_or<std::unordered_map<std::size_t , double >>(config, " offsets" , {});
6077
6178 // TODO: Seperate this into some function
6279 {
@@ -108,9 +125,13 @@ DriverConfig UserConfig::driver() && { return std::move(this->driver_); }
108125const MapConfig& UserConfig::mapping () const & { return this ->mapping_ ; }
109126MapConfig UserConfig::mapping () && { return std::move (this ->mapping_ ); }
110127
128+ const OffsetConfig& UserConfig::offset () const & { return this ->offset_ ; }
129+ OffsetConfig UserConfig::offset () && { return std::move (this ->offset_ ); }
130+
111131UserConfig& UserConfig::merge (const UserConfig& other) {
112132 this ->driver_ .merge (other.driver ());
113133 this ->mapping_ .merge (other.mapping ());
134+ this ->offset_ .merge (other.offset ());
114135
115136 return *this ;
116137}
0 commit comments