@@ -284,7 +284,7 @@ namespace nil {
284284 reserved_tables_indices.left .insert (std::make_pair (name, reserved_tables.size ()));
285285 }
286286
287- void reservation_done (){
287+ void reservation_done () const {
288288 if (reserved_all) return ;
289289
290290 reserved_all = true ;
@@ -293,34 +293,35 @@ namespace nil {
293293 std::string table_name = name.substr (0 , slash_pos);
294294 BOOST_ASSERT (tables.find (table_name) != tables.end ());
295295 std::string subtable_name = name.substr (slash_pos + 1 , name.size ());
296- BOOST_ASSERT (tables[table_name]->subtables .find (subtable_name) !=
297- tables[table_name]->subtables .end ());
296+ auto const &table = tables.at (table_name);
297+ BOOST_ASSERT (table->subtables .find (subtable_name) !=
298+ table->subtables .end ());
298299
299300 if ( reserved_tables_map.find (table_name) == reserved_tables_map.end () ){
300301 filled_lookup_table_definition *filled_definition =
301- new filled_lookup_table_definition (*(tables[table_name] ));
302+ new filled_lookup_table_definition (*(table ));
302303 reserved_tables_map[table_name] = std::shared_ptr<lookup_table_definition>(filled_definition);
303304 }
304305 reserved_tables_map[table_name]->subtables [subtable_name] =
305- tables[table_name] ->subtables [subtable_name];
306+ table ->subtables [subtable_name];
306307 }
307308 }
308309
309310 const bimap_type &get_reserved_indices () const {
310311 return reserved_tables_indices;
311312 }
312313
313- const std::map<std::string, std::shared_ptr<lookup_table_definition>> &get_reserved_tables () {
314+ const std::map<std::string, std::shared_ptr<lookup_table_definition>> &get_reserved_tables () const {
314315 reservation_done ();
315316 return reserved_tables_map;
316317 }
317318 protected:
318- bool reserved_all;
319+ mutable bool reserved_all;
319320
320321 std::map<std::string, std::shared_ptr<lookup_table_definition>> tables;
321322 std::set<std::string> reserved_tables;
322323 bimap_type reserved_tables_indices;
323- std::map<std::string, std::shared_ptr<lookup_table_definition>> reserved_tables_map;
324+ mutable std::map<std::string, std::shared_ptr<lookup_table_definition>> reserved_tables_map;
324325 };
325326 } // namespace blueprint
326327} // namespace nil
0 commit comments