Skip to content
Snippets Groups Projects
Commit 1f5e70b2 authored by Francois Bleibel's avatar Francois Bleibel
Browse files

Cast: Unit testing

Added unit test of the signal casting facility. Not exporting the SignalCastRegister class anymore (inlined in the .h).
parent 32359b9e
No related branches found
No related tags found
No related merge requests found
......@@ -65,12 +65,17 @@ private:
extern SignalCaster g_caster;
/*
* The SignalCast registerer class. Can be used to automatically register a cast when instanced.
* The SignalCast registerer class. Can be used to automatically register a cast when
* instanced somewhere in a cpp file. Pass the typeid() of the type you want to
* register a cast to as the first argument.
* The code is provided here so the class does not need to be exported.
*/
class SignalCastRegisterer {
public:
SignalCastRegisterer(const std::type_info& type, SignalCaster::displayer_type displayer,
SignalCaster::caster_type caster, SignalCaster::tracer_type tracer);
SignalCaster::caster_type caster, SignalCaster::tracer_type tracer) {
g_caster.registerCast(type, displayer, caster, tracer);
}
};
/*!
......
......@@ -73,12 +73,6 @@ any SignalCaster::cast(const type_info& type, istringstream& iss) {
/// The global instance of the caster class.
DYNAMICGRAPH_EXPORT SignalCaster g_caster;
SignalCastRegisterer::SignalCastRegisterer(const std::type_info& type, SignalCaster::displayer_type displayer,
SignalCaster::caster_type caster, SignalCaster::tracer_type tracer)
{
g_caster.registerCast(type, displayer, caster, tracer);
}
/// Default casts, such as casts already supported by std::iostream
template<typename T> class DefaultCastRegisterer : public SignalCastRegisterer {
public:
......
......@@ -7,7 +7,8 @@ SET(tests
test_shell
test_pool
test_depend
test_factory)
test_factory
test_signalcast)
FOREACH(test_name ${tests})
SET(EXECUTABLE_NAME ${test_name})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment