sigslot-help Mailing List for C++ Signal/Slot Library (sigslot)
Brought to you by:
saraht01
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: Jaco du P. <Ja...@so...> - 2004-06-22 14:52:35
|
Hi //Problem I have a factory class that is implemented as a singleton using ACE_Singleton (ACE Library). When I try to connect a signal to a method in this class, I get the error mention below. I have successfully implemented other signals in the same project, but it seem to only be a problem with ACE_Singletons. Is there something I doing incorrect? Or is there a work around that I could implement. Regards, Jaco //Code Sample below in the factory singleton itself. p_hlaObject->messageReceived.connect(HlaManagerFactorySingleton::instance(), //Line 300 &HlaManagerFactory::receiveMessage)); //Line 301 //Note This line of code below compiles without any errors or warnings. I believe that it is not the singleton instance, but the function pointer that could be causing the problem. p_hlaObject->messageReceived.disconnect(HlaManagerFactorySingleton::instance ()); //Class definition class HlaManagerFactory : public sigslot::has_slots<> { friend class ACE_Singleton<HlaManagerFactory, ACE_Null_Mutex>; private: HlaManagerFactory(void); virtual ~HlaManagerFactory(void); sigslot::signal2<ObjInterActEnum, RTI::ObjectHandle> messageReceived; private: void receiveMessage(ObjInterActEnum p_classType, RTI::ObjectHandle p_handle); }; typedef ACE_Singleton<HlaManagerFactory, ACE_Null_Mutex> HlaManagerFactorySingleton; void HlaManagerFactory::receiveMessage(ObjInterActEnum p_classType, RTI::ObjectHandle p_handle) { this->messageReceived.emit(p_classType, p_handle); } /* ERROR MESSAGE IN MS VC++ 6 */ --------------------Configuration: HlaGateway - Win32 Debug-------------------- Compiling... HlaManagerFactory.cpp c:\projects\hlagateway\source\hlamanagerfactory.cpp(301) : error C2662: 'void __thiscall sigslot::signal2<enum ObjInterActEnum,unsigned long,class sigslot::multi_threaded_local>::connect(class HlaManagerFactory *,void (__thiscall HlaManagerFactory:: *)(ObjInterActEnum,unsigned long))' : cannot convert 'this' pointer from 'const class sigslot::signal2<enum ObjInterActEnum,unsigned long,class sigslot::multi_threaded_local>' to 'class sigslot::signal2<enum ObjInterActEnum,unsigned long,class sigsl ot::multi_threaded_local> &' Conversion loses qualifiers Error executing xicl6.exe. HlaGateway.exe - 1 error(s), 0 warning(s) /* ERROR MESSAGE IN Intel 8.0 */ --------------------Configuration: HlaGateway - Win32 Debug-------------------- Compiling... HlaManagerFactory.cpp C:\Projects\HlaGateway\Source\HlaManagerFactory.cpp(300): error: no instance of function template "sigslot::signal2<arg1_type, arg2_type, mt_policy>::connect [with arg1_type=ObjInterActEnum={ObjInterActEnum}, arg2_type=RTI::ObjectHandle={RTI::Handle ={RTI::ULong={unsigned long}}}, mt_policy=sigslot::multi_threaded_local]" matches the argument list and object (the object has cv-qualifiers that prevent a match) argument types are: (HlaManagerFactory *, void (HlaManagerFactory::*)(ObjInterActEnum, RTI::ObjectHandle)) object type is: const sigslot::signal2<ObjInterActEnum, RTI::ObjectHandle, sigslot::multi_threaded_local> p_hlaObject->messageReceived.connect(HlaManagerFactorySingleton::instance(), ^ compilation aborted for C:\Projects\HlaGateway\Source\HlaManagerFactory.cpp (code 2) Error executing xicl6.exe. Creating browse info file... HlaGateway.exe - 1 error(s), 0 warning(s) ########################################### This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange. For more information, connect to http://www.F-Secure.com/ |