Hi,
I have a template wrapper class around RTT::Event:
template
class MyEvent : public RTT::Event
{
....
bool connect(const std::string& Component, const std::string&
Event, boost::function
}
template
bool VDWEvent
std::string& Event, boost::function
{
VDWTaskContext* p_comp = VDWTaskContext::nameserver()->
getObject(Component);
if(p_comp)
{
VDWEvent
getEvent
event.connect(SyncFun);
}
else
{
RTT::Logger::In in("VDWEvent::connect");
RTT::log(RTT::Error) << "Could not connect to event " <<
Event << ", " << "component " << Component << " not
found." << RTT::endlog();
return false;
}
return true;
}
When compiling I get an error on line:
VDWEvent
event(p_comp->events()->getEvent
'error: expected primary-expression before '>' token'
I don't have a clue...
In EventService.hpp getEvent is declared as follows:
template
boost::shared_ptr
{
if ( mevents.count(ename) )
return mevents[ename];
return boost::shared_ptr
}
When removing the template
Sander.
Wierd template problem.
On Wednesday 07 May 2008 13:24:55 Vandenbroucke Sander wrote:
> Hi,
>
> I have a template wrapper class around RTT::Event:
[...]
>(Event));
>
> When compiling I get an error on line:
> VDWEvent
> event(p_comp->events()->getEvent
>
> 'error: expected primary-expression before '>' token'
>
> I don't have a clue...
A classical case of 'typename' omission. You need to write:
event(p_comp->events()->getEvent(Event));
The compiler does not 'know' if SignatureT is a type or a value, because it is
passed as a template type. For some really wrong reason 'value' is assumed to
be default, os each time you use SignatureT in a class which depends on that
template parameter, you need to prefix it with 'typename'.
Peter
Wierd template problem.
On Wednesday 07 May 2008 13:40:55 Peter Soetens wrote:(Event));(Event));
> On Wednesday 07 May 2008 13:24:55 Vandenbroucke Sander wrote:
> > Hi,
> >
> > I have a template wrapper class around RTT::Event:
>
> [...]
>
> > When compiling I get an error on line:
> > VDWEvent
> > event(p_comp->events()->getEvent
> >
> > 'error: expected primary-expression before '>' token'
> >
> > I don't have a clue...
>
> A classical case of 'typename' omission. You need to write:
>
> event(p_comp->events()->getEvent
And for the type decl as well of course:
VDWEvent(Event));
event(p_comp->events()->getEvent
Peter
RE: Wierd template problem.
> >(Event));(Event));
> > A classical case of 'typename' omission. You need to write:
> >
> > event(p_comp->events()->getEvent
>
> And for the type decl as well of course:
>
> VDWEvent
> event(p_comp->events()->getEvent
>
Nope, even more obscure errors.
At least this is compiling: event(p_es->getEvent(Event));
if(p_comp)
{
RTT::EventService* p_es = p_comp->events();
VDWEvent
event.connect(SyncFun);
}
gcc issue maybe?
Sander.