Hello all. I'm no expert on using templates, so I can't figure out what I'm doing wrong when trying to add an item to a DirectoryWatcher event.
Function to catch the event:
void DirectoryMonitorMgr::EventItemAdded(const void *pSender, DirectoryWatcher::DirectoryEvent &arg)
{
std::cout << "EventItemAdded: " << arg.event << " : " << arg.item.path() << std::endl;
}
Inside a method of my DirectoryMonitorMgr class:
newDirectoryWatcher = new DirectoryWatcher(theDirectory, DirectoryWatcher::DW_FILTER_ENABLE_ALL, 30);
newDirectoryWatcher->itemAdded += Delegate<DirectoryMonitorMgr, DirectoryWatcher::DirectoryEvent>(this, &DirectoryMonitorMgr::EventItemAdded);
The error given at the "newDirectoryWatcher->itemAdded += ..." line is:
error C2679: binary '+=' : no operator found which takes a right-hand operand of type 'Poco::Delegate<TObj,TArgs>' (or there is no acceptable conversion)
1> with
1> [
1> TObj=DirectoryMonitorMgr,
1> TArgs=Poco::DirectoryWatcher::DirectoryEvent
1> ]
1> c:\sandbox\trunk\poco\include\poco\abstractevent.h(193): could be 'void Poco::AbstractEvent<TArgs,TStrategy,TDelegate,TMutex>::operator +=(const TDelegate &)'
1> with
1> [
1> TArgs=const Poco::DirectoryWatcher::DirectoryEvent,
1> TStrategy=Poco::DefaultStrategy<const Poco::DirectoryWatcher::DirectoryEvent,Poco::AbstractDelegate<const Poco::DirectoryWatcher::DirectoryEvent>>,
1> TDelegate=Poco::AbstractDelegate<const Poco::DirectoryWatcher::DirectoryEvent>,
1> TMutex=Poco::FastMutex
1> ]
1> while trying to match the argument list '(Poco::BasicEvent<TArgs>, Poco::Delegate<TObj,TArgs>)'
1> with
1> [
1> TArgs=const Poco::DirectoryWatcher::DirectoryEvent
1> ]
1> and
1> [
1> TObj=DirectoryMonitorMgr,
1> TArgs=Poco::DirectoryWatcher::DirectoryEvent
1> ]
Can anyone decipher this and tell me how to do this correctly?
Thanks,
Dave





