Fawkes API
Fawkes Development Version
|
24 #include <blackboard/exceptions.h>
25 #include <blackboard/internal/instance_factory.h>
26 #include <interface/interface.h>
27 #include <utils/system/dynamic_module/module.h>
28 #include <utils/system/dynamic_module/module_manager.h>
46 mm_ =
new ModuleManager(IFACEDIR);
68 if (strlen(identifier) == 0) {
69 throw Exception(
"Interface ID may not be empty");
71 if (strlen(type) == 0) {
74 if (strlen(type) > INTERFACE_TYPE_SIZE_) {
75 throw Exception(
"Interface type '%s' too long, maximum length is %zu",
77 INTERFACE_TYPE_SIZE_);
79 if (strlen(identifier) > INTERFACE_ID_SIZE_) {
80 throw Exception(
"Interface ID '%s' too long, maximum length is %zu", type, INTERFACE_ID_SIZE_);
87 }
catch (Exception &e) {
88 throw BlackBoardInterfaceNotFoundException(type,
" Module file not found.");
91 if (!mod->has_symbol(
"interface_factory")) {
92 throw BlackBoardInterfaceNotFoundException(type,
" Generator function not found.");
97 Interface *iface = iff();
98 iface->set_type_id(type, identifier);
113 std::string filename =
115 Module *mod = mm_->
get_module(filename.c_str());
121 if (!mod->has_symbol(
"interface_destroy")) {
virtual Module * open_module(const char *filename)
Open a module.
Thrown if no definition of interface or interface generator found.
void delete_interface_instance(Interface *interface)
Destroy an interface instance.
void(* InterfaceDestroyFunc)(Interface *interface)
Interface destructor function for the shared library.
virtual Module * get_module(const char *filename)
Get a module if opened.
BlackBoardInstanceFactory()
Constructor.
Interface * new_interface_instance(const char *type, const char *identifier)
Creates a new interface instance.
virtual void close_module(Module *module)
Close a module by Module instance.
virtual const char * get_module_file_extension()
Get the file extension for the current module type.
~BlackBoardInstanceFactory()
Destructor.
Interface *(* InterfaceFactoryFunc)(void)
Interface generator function for the shared library Do not use directly.