Closed Jinhui-Wu closed 10 years ago
There I used a C++ template technique called SFINAE (http://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error) to detect the types that have subclasses in order to construct and deserialize the correct openflow message subclass. (has_factory
In the head file openflow-inl-1.0.hh // Factory template
struct has_factory
{
// template static char test(typeof(&C::factory));
template static char test(typeof(&C::factory())); // something wrong?
template static long test(...);
public: enum { value = sizeof(test(0)) == sizeof(char) };
};
All the openflow message class inherit from v1::ofp_msg which has a member function -- factory(), so has_factory will always return TRUE. Am I correct? I find this problem when I fail to send v1::ofp_port_stats_request.