OpenWalker Project
Documentation of the ROS Packages
|
Contains the macros for classes to load them on runtime. More...
Go to the source code of this file.
Macros | |
#define | OW_PLUGIN_CLASS_CREATE(Class) |
A macro that creates the create factory function for the Class. More... | |
#define | OW_PLUGIN_CLASS_DESTROY(Class) |
A macro that creates the destroy factory function for the Class. More... | |
#define | OW_PLUGIN_CLASS(Class) |
A macro that creates the create and destroy factory functions for the Class. More... | |
Contains the macros for classes to load them on runtime.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
This project has received funding from the European Unionās Horizon 2020 research and innovation programme under grant agreement No 732287.
This macros have to be added to the .cpp file of the class that will be loaded at runtime. Make sure that you have only one loadable class with this macros per .so file.
#define OW_PLUGIN_CLASS | ( | Class | ) |
A macro that creates the create and destroy factory functions for the Class.
NOTE: Use this macro only once per .so file!
#define OW_PLUGIN_CLASS_CREATE | ( | Class | ) |
A macro that creates the create factory function for the Class.
NOTE: the static_cast from 'Class*' to 'IGenericClass*' is essential. The void* is casted back with reinterpret_cast to 'IGenericClass*'. This fails with seg fault when not previously using static_cast.
NOTE: the upcasting from 'IGenericClass*' to 'Class*' must be again done with static_cast!
NOTE: Use this macro only once per .so file!
#define OW_PLUGIN_CLASS_DESTROY | ( | Class | ) |
A macro that creates the destroy factory function for the Class.
NOTE: The destruction should run from top to down (should be less error prone than down to top).
NOTE: Since classes should be created by the factory they should also be deleted by the factory to avoid memory corruptions when the .so file has been compiled with a different compiler (version) then the loader of the .so file.
NOTE: Use this macro only once per .so file!