19
19
#include < algorithm>
20
20
#include < memory>
21
21
#include < string>
22
+ #include < unordered_set>
23
+ #include < vector>
22
24
23
25
#include " pluginlib/class_loader.hpp"
24
26
@@ -160,19 +162,38 @@ class StorageFactoryImpl
160
162
161
163
virtual ~StorageFactoryImpl () = default ;
162
164
165
+ std::unordered_set<std::string> get_registered_plugin_names ()
166
+ {
167
+ std::vector<std::string> read_only_plugins = read_only_class_loader_->getDeclaredClasses ();
168
+ std::vector<std::string> read_write_plugins = read_write_class_loader_->getDeclaredClasses ();
169
+
170
+ // Merge read-only and read-write plugins
171
+ std::unordered_set<std::string> combined_plugins (
172
+ read_only_plugins.begin (), read_only_plugins.end ());
173
+ combined_plugins.insert (read_write_plugins.begin (), read_write_plugins.end ());
174
+ return combined_plugins;
175
+ }
176
+
163
177
std::shared_ptr<ReadWriteInterface> open_read_write (const StorageOptions & storage_options)
164
178
{
165
- auto instance =
166
- get_interface_instance (read_write_class_loader_, storage_options);
179
+ auto instance = get_interface_instance (read_write_class_loader_, storage_options);
167
180
168
181
if (instance == nullptr ) {
169
182
if (storage_options.storage_id .empty ()) {
170
183
ROSBAG2_STORAGE_LOG_ERROR_STREAM (
171
- " No storage id specified, and no plugin found that could open URI" );
184
+ " No storage id specified, and no plugin found that could open URI: '" <<
185
+ storage_options.uri << " '" );
172
186
} else {
173
187
ROSBAG2_STORAGE_LOG_ERROR_STREAM (
174
188
" Could not load/open plugin with storage id '" << storage_options.storage_id << " '" );
175
189
}
190
+ auto available_plugins = read_write_class_loader_->getDeclaredClasses ();
191
+ std::stringstream ss;
192
+ ss << " Available read-write storage plugins: " ;
193
+ for (const auto & storage_plugin : available_plugins) {
194
+ ss << " '" << storage_plugin << " ', " ;
195
+ }
196
+ ROSBAG2_STORAGE_LOG_INFO (" %s" , ss.str ().c_str ());
176
197
}
177
198
178
199
return instance;
@@ -193,11 +214,19 @@ class StorageFactoryImpl
193
214
if (instance == nullptr ) {
194
215
if (storage_options.storage_id .empty ()) {
195
216
ROSBAG2_STORAGE_LOG_ERROR_STREAM (
196
- " No storage id specified, and no plugin found that could open URI" );
217
+ " No storage id specified, and no plugin found that could open URI: '" <<
218
+ storage_options.uri << " '" );
197
219
} else {
198
220
ROSBAG2_STORAGE_LOG_ERROR_STREAM (
199
- " Could not load/open plugin with storage id '" << storage_options.storage_id << " '" );
221
+ " Could not load/open plugin with storage id: '" << storage_options.storage_id << " '" );
222
+ }
223
+ auto available_plugins = get_registered_plugin_names ();
224
+ std::stringstream ss;
225
+ ss << " Available storage plugins: " ;
226
+ for (const auto & storage_plugin : available_plugins) {
227
+ ss << " '" << storage_plugin << " ', " ;
200
228
}
229
+ ROSBAG2_STORAGE_LOG_INFO (" %s" , ss.str ().c_str ());
201
230
}
202
231
203
232
return instance;
0 commit comments