sigslot.h 72 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860
  1. // sigslot.h: Signal/Slot classes
  2. //
  3. // Written by Sarah Thompson (sarah@telergy.com) 2002.
  4. //
  5. // License: Public domain. You are free to use this code however you like, with the proviso that
  6. // the author takes on no responsibility or liability for any use.
  7. //
  8. // QUICK DOCUMENTATION
  9. //
  10. // (see also the full documentation at http://sigslot.sourceforge.net/)
  11. //
  12. // #define switches
  13. // SIGSLOT_PURE_ISO - Define this to force ISO C++ compliance. This also disables
  14. // all of the thread safety support on platforms where it is
  15. // available.
  16. //
  17. // SIGSLOT_USE_POSIX_THREADS - Force use of Posix threads when using a C++ compiler other than
  18. // gcc on a platform that supports Posix threads. (When using gcc,
  19. // this is the default - use SIGSLOT_PURE_ISO to disable this if
  20. // necessary)
  21. //
  22. // SIGSLOT_DEFAULT_MT_POLICY - Where thread support is enabled, this defaults to multi_threaded_global.
  23. // Otherwise, the default is single_threaded. #define this yourself to
  24. // override the default. In pure ISO mode, anything other than
  25. // single_threaded will cause a compiler error.
  26. //
  27. // PLATFORM NOTES
  28. //
  29. // Win32 - On Win32, the WIN32 symbol must be #defined. Most mainstream
  30. // compilers do this by default, but you may need to define it
  31. // yourself if your build environment is less standard. This causes
  32. // the Win32 thread support to be compiled in and used automatically.
  33. //
  34. // Unix/Linux/BSD, etc. - If you're using gcc, it is assumed that you have Posix threads
  35. // available, so they are used automatically. You can override this
  36. // (as under Windows) with the SIGSLOT_PURE_ISO switch. If you're using
  37. // something other than gcc but still want to use Posix threads, you
  38. // need to #define SIGSLOT_USE_POSIX_THREADS.
  39. //
  40. // ISO C++ - If none of the supported platforms are detected, or if
  41. // SIGSLOT_PURE_ISO is defined, all multithreading support is turned off,
  42. // along with any code that might cause a pure ISO C++ environment to
  43. // complain. Before you ask, gcc -ansi -pedantic won't compile this
  44. // library, but gcc -ansi is fine. Pedantic mode seems to throw a lot of
  45. // errors that aren't really there. If you feel like investigating this,
  46. // please contact the author.
  47. //
  48. //
  49. // THREADING MODES
  50. //
  51. // single_threaded - Your program is assumed to be single threaded from the point of view
  52. // of signal/slot usage (i.e. all objects using signals and slots are
  53. // created and destroyed from a single thread). Behaviour if objects are
  54. // destroyed concurrently is undefined (i.e. you'll get the occasional
  55. // segmentation fault/memory exception).
  56. //
  57. // multi_threaded_global - Your program is assumed to be multi threaded. Objects using signals and
  58. // slots can be safely created and destroyed from any thread, even when
  59. // connections exist. In multi_threaded_global mode, this is achieved by a
  60. // single global mutex (actually a critical section on Windows because they
  61. // are faster). This option uses less OS resources, but results in more
  62. // opportunities for contention, possibly resulting in more context switches
  63. // than are strictly necessary.
  64. //
  65. // multi_threaded_local - Behaviour in this mode is essentially the same as multi_threaded_global,
  66. // except that each signal, and each object that inherits has_slots, all
  67. // have their own mutex/critical section. In practice, this means that
  68. // mutex collisions (and hence context switches) only happen if they are
  69. // absolutely essential. However, on some platforms, creating a lot of
  70. // mutexes can slow down the whole OS, so use this option with care.
  71. //
  72. // USING THE LIBRARY
  73. //
  74. // See the full documentation at http://sigslot.sourceforge.net/
  75. //
  76. //
  77. // Libjingle specific:
  78. // This file has been modified such that has_slots and signalx do not have to be
  79. // using the same threading requirements. E.g. it is possible to connect a
  80. // has_slots<single_threaded> and signal0<multi_threaded_local> or
  81. // has_slots<multi_threaded_local> and signal0<single_threaded>.
  82. // If has_slots is single threaded the user must ensure that it is not trying
  83. // to connect or disconnect to signalx concurrently or data race may occur.
  84. // If signalx is single threaded the user must ensure that disconnect, connect
  85. // or signal is not happening concurrently or data race may occur.
  86. #ifndef TALK_BASE_SIGSLOT_H__
  87. #define TALK_BASE_SIGSLOT_H__
  88. #include <list>
  89. #include <set>
  90. #include <stdlib.h>
  91. // On our copy of sigslot.h, we set single threading as default.
  92. #define SIGSLOT_DEFAULT_MT_POLICY single_threaded
  93. // For now, this avoids windows.h in bindings (PeerConnectionImpl.h) on WIN32
  94. // TODO: wrap win32 crit section and move to another file instead (Bug 932570)
  95. #define SIGSLOT_LEAVE_OUT_MULTITHREADING 1
  96. #if defined(SIGSLOT_PURE_ISO) || (!defined(WIN32) && !defined(__GNUG__) && !defined(SIGSLOT_USE_POSIX_THREADS))
  97. # define _SIGSLOT_SINGLE_THREADED
  98. #elif defined(WIN32)
  99. # define _SIGSLOT_HAS_WIN32_THREADS
  100. # ifndef SIGSLOT_LEAVE_OUT_MULTITHREADING
  101. # if !defined(WIN32_LEAN_AND_MEAN)
  102. # define WIN32_LEAN_AND_MEAN
  103. # endif
  104. # include "windows.h"
  105. # endif
  106. #elif defined(__GNUG__) || defined(SIGSLOT_USE_POSIX_THREADS)
  107. # define _SIGSLOT_HAS_POSIX_THREADS
  108. # include <pthread.h>
  109. #else
  110. # define _SIGSLOT_SINGLE_THREADED
  111. #endif
  112. #ifndef SIGSLOT_DEFAULT_MT_POLICY
  113. # ifdef _SIGSLOT_SINGLE_THREADED
  114. # define SIGSLOT_DEFAULT_MT_POLICY single_threaded
  115. # else
  116. # define SIGSLOT_DEFAULT_MT_POLICY multi_threaded_local
  117. # endif
  118. #endif
  119. // TODO: change this namespace to talk_base?
  120. namespace sigslot {
  121. class single_threaded
  122. {
  123. public:
  124. single_threaded()
  125. {
  126. ;
  127. }
  128. virtual ~single_threaded()
  129. {
  130. ;
  131. }
  132. virtual void lock()
  133. {
  134. ;
  135. }
  136. virtual void unlock()
  137. {
  138. ;
  139. }
  140. };
  141. #ifndef SIGSLOT_LEAVE_OUT_MULTITHREADING
  142. # ifdef _SIGSLOT_HAS_WIN32_THREADS
  143. // The multi threading policies only get compiled in if they are enabled.
  144. class multi_threaded_global
  145. {
  146. public:
  147. multi_threaded_global()
  148. {
  149. static bool isinitialised = false;
  150. if(!isinitialised)
  151. {
  152. InitializeCriticalSection(get_critsec());
  153. isinitialised = true;
  154. }
  155. }
  156. multi_threaded_global(const multi_threaded_global&)
  157. {
  158. ;
  159. }
  160. virtual ~multi_threaded_global()
  161. {
  162. ;
  163. }
  164. virtual void lock()
  165. {
  166. EnterCriticalSection(get_critsec());
  167. }
  168. virtual void unlock()
  169. {
  170. LeaveCriticalSection(get_critsec());
  171. }
  172. private:
  173. CRITICAL_SECTION* get_critsec()
  174. {
  175. static CRITICAL_SECTION g_critsec;
  176. return &g_critsec;
  177. }
  178. };
  179. class multi_threaded_local
  180. {
  181. public:
  182. multi_threaded_local()
  183. {
  184. InitializeCriticalSection(&m_critsec);
  185. }
  186. multi_threaded_local(const multi_threaded_local&)
  187. {
  188. InitializeCriticalSection(&m_critsec);
  189. }
  190. virtual ~multi_threaded_local()
  191. {
  192. DeleteCriticalSection(&m_critsec);
  193. }
  194. virtual void lock()
  195. {
  196. EnterCriticalSection(&m_critsec);
  197. }
  198. virtual void unlock()
  199. {
  200. LeaveCriticalSection(&m_critsec);
  201. }
  202. private:
  203. CRITICAL_SECTION m_critsec;
  204. };
  205. # endif // _SIGSLOT_HAS_WIN32_THREADS
  206. # ifdef _SIGSLOT_HAS_POSIX_THREADS
  207. // The multi threading policies only get compiled in if they are enabled.
  208. class multi_threaded_global
  209. {
  210. public:
  211. multi_threaded_global()
  212. {
  213. pthread_mutex_init(get_mutex(), NULL);
  214. }
  215. multi_threaded_global(const multi_threaded_global&)
  216. {
  217. ;
  218. }
  219. virtual ~multi_threaded_global()
  220. {
  221. ;
  222. }
  223. virtual void lock()
  224. {
  225. pthread_mutex_lock(get_mutex());
  226. }
  227. virtual void unlock()
  228. {
  229. pthread_mutex_unlock(get_mutex());
  230. }
  231. private:
  232. pthread_mutex_t* get_mutex()
  233. {
  234. static pthread_mutex_t g_mutex;
  235. return &g_mutex;
  236. }
  237. };
  238. class multi_threaded_local
  239. {
  240. public:
  241. multi_threaded_local()
  242. {
  243. pthread_mutex_init(&m_mutex, NULL);
  244. }
  245. multi_threaded_local(const multi_threaded_local&)
  246. {
  247. pthread_mutex_init(&m_mutex, NULL);
  248. }
  249. virtual ~multi_threaded_local()
  250. {
  251. pthread_mutex_destroy(&m_mutex);
  252. }
  253. virtual void lock()
  254. {
  255. pthread_mutex_lock(&m_mutex);
  256. }
  257. virtual void unlock()
  258. {
  259. pthread_mutex_unlock(&m_mutex);
  260. }
  261. private:
  262. pthread_mutex_t m_mutex;
  263. };
  264. # endif // _SIGSLOT_HAS_POSIX_THREADS
  265. #endif // SIGSLOT_LEAVE_OUT_MULTITHREADING
  266. template<class mt_policy>
  267. class lock_block
  268. {
  269. public:
  270. mt_policy *m_mutex;
  271. explicit lock_block(mt_policy *mtx)
  272. : m_mutex(mtx)
  273. {
  274. m_mutex->lock();
  275. }
  276. ~lock_block()
  277. {
  278. m_mutex->unlock();
  279. }
  280. };
  281. class has_slots_interface;
  282. template<class mt_policy>
  283. class _connection_base0
  284. {
  285. public:
  286. virtual ~_connection_base0() {}
  287. virtual has_slots_interface* getdest() const = 0;
  288. virtual void emit() = 0;
  289. virtual _connection_base0* clone() = 0;
  290. virtual _connection_base0* duplicate(has_slots_interface* pnewdest) = 0;
  291. };
  292. template<class arg1_type, class mt_policy>
  293. class _connection_base1
  294. {
  295. public:
  296. virtual ~_connection_base1() {}
  297. virtual has_slots_interface* getdest() const = 0;
  298. virtual void emit(arg1_type) = 0;
  299. virtual _connection_base1<arg1_type, mt_policy>* clone() = 0;
  300. virtual _connection_base1<arg1_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
  301. };
  302. template<class arg1_type, class arg2_type, class mt_policy>
  303. class _connection_base2
  304. {
  305. public:
  306. virtual ~_connection_base2() {}
  307. virtual has_slots_interface* getdest() const = 0;
  308. virtual void emit(arg1_type, arg2_type) = 0;
  309. virtual _connection_base2<arg1_type, arg2_type, mt_policy>* clone() = 0;
  310. virtual _connection_base2<arg1_type, arg2_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
  311. };
  312. template<class arg1_type, class arg2_type, class arg3_type, class mt_policy>
  313. class _connection_base3
  314. {
  315. public:
  316. virtual ~_connection_base3() {}
  317. virtual has_slots_interface* getdest() const = 0;
  318. virtual void emit(arg1_type, arg2_type, arg3_type) = 0;
  319. virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>* clone() = 0;
  320. virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
  321. };
  322. template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, class mt_policy>
  323. class _connection_base4
  324. {
  325. public:
  326. virtual ~_connection_base4() {}
  327. virtual has_slots_interface* getdest() const = 0;
  328. virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type) = 0;
  329. virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* clone() = 0;
  330. virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
  331. };
  332. template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
  333. class arg5_type, class mt_policy>
  334. class _connection_base5
  335. {
  336. public:
  337. virtual ~_connection_base5() {}
  338. virtual has_slots_interface* getdest() const = 0;
  339. virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type,
  340. arg5_type) = 0;
  341. virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
  342. arg5_type, mt_policy>* clone() = 0;
  343. virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
  344. arg5_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
  345. };
  346. template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
  347. class arg5_type, class arg6_type, class mt_policy>
  348. class _connection_base6
  349. {
  350. public:
  351. virtual ~_connection_base6() {}
  352. virtual has_slots_interface* getdest() const = 0;
  353. virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
  354. arg6_type) = 0;
  355. virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
  356. arg5_type, arg6_type, mt_policy>* clone() = 0;
  357. virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
  358. arg5_type, arg6_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
  359. };
  360. template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
  361. class arg5_type, class arg6_type, class arg7_type, class mt_policy>
  362. class _connection_base7
  363. {
  364. public:
  365. virtual ~_connection_base7() {}
  366. virtual has_slots_interface* getdest() const = 0;
  367. virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
  368. arg6_type, arg7_type) = 0;
  369. virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
  370. arg5_type, arg6_type, arg7_type, mt_policy>* clone() = 0;
  371. virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
  372. arg5_type, arg6_type, arg7_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
  373. };
  374. template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
  375. class arg5_type, class arg6_type, class arg7_type, class arg8_type, class mt_policy>
  376. class _connection_base8
  377. {
  378. public:
  379. virtual ~_connection_base8() {}
  380. virtual has_slots_interface* getdest() const = 0;
  381. virtual void emit(arg1_type, arg2_type, arg3_type, arg4_type, arg5_type,
  382. arg6_type, arg7_type, arg8_type) = 0;
  383. virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
  384. arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* clone() = 0;
  385. virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
  386. arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* duplicate(has_slots_interface* pnewdest) = 0;
  387. };
  388. class _signal_base_interface
  389. {
  390. public:
  391. virtual void slot_disconnect(has_slots_interface* pslot) = 0;
  392. virtual void slot_duplicate(const has_slots_interface* poldslot, has_slots_interface* pnewslot) = 0;
  393. };
  394. template<class mt_policy>
  395. class _signal_base : public _signal_base_interface, public mt_policy
  396. {
  397. };
  398. class has_slots_interface
  399. {
  400. public:
  401. has_slots_interface()
  402. {
  403. ;
  404. }
  405. virtual void signal_connect(_signal_base_interface* sender) = 0;
  406. virtual void signal_disconnect(_signal_base_interface* sender) = 0;
  407. virtual ~has_slots_interface()
  408. {
  409. }
  410. virtual void disconnect_all() = 0;
  411. };
  412. template<class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
  413. class has_slots : public has_slots_interface, public mt_policy
  414. {
  415. private:
  416. typedef std::set<_signal_base_interface*> sender_set;
  417. typedef sender_set::const_iterator const_iterator;
  418. public:
  419. has_slots()
  420. {
  421. ;
  422. }
  423. has_slots(const has_slots& hs)
  424. {
  425. lock_block<mt_policy> lock(this);
  426. const_iterator it = hs.m_senders.begin();
  427. const_iterator itEnd = hs.m_senders.end();
  428. while(it != itEnd)
  429. {
  430. (*it)->slot_duplicate(&hs, this);
  431. m_senders.insert(*it);
  432. ++it;
  433. }
  434. }
  435. void signal_connect(_signal_base_interface* sender)
  436. {
  437. lock_block<mt_policy> lock(this);
  438. m_senders.insert(sender);
  439. }
  440. void signal_disconnect(_signal_base_interface* sender)
  441. {
  442. lock_block<mt_policy> lock(this);
  443. m_senders.erase(sender);
  444. }
  445. virtual ~has_slots()
  446. {
  447. disconnect_all();
  448. }
  449. void disconnect_all()
  450. {
  451. lock_block<mt_policy> lock(this);
  452. const_iterator it = m_senders.begin();
  453. const_iterator itEnd = m_senders.end();
  454. while(it != itEnd)
  455. {
  456. (*it)->slot_disconnect(this);
  457. ++it;
  458. }
  459. m_senders.erase(m_senders.begin(), m_senders.end());
  460. }
  461. private:
  462. sender_set m_senders;
  463. };
  464. template<class mt_policy>
  465. class _signal_base0 : public _signal_base<mt_policy>
  466. {
  467. public:
  468. typedef std::list<_connection_base0<mt_policy> *> connections_list;
  469. _signal_base0()
  470. {
  471. ;
  472. }
  473. _signal_base0(const _signal_base0& s)
  474. : _signal_base<mt_policy>(s)
  475. {
  476. lock_block<mt_policy> lock(this);
  477. typename connections_list::const_iterator it = s.m_connected_slots.begin();
  478. typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
  479. while(it != itEnd)
  480. {
  481. (*it)->getdest()->signal_connect(this);
  482. m_connected_slots.push_back((*it)->clone());
  483. ++it;
  484. }
  485. }
  486. ~_signal_base0()
  487. {
  488. disconnect_all();
  489. }
  490. bool is_empty()
  491. {
  492. lock_block<mt_policy> lock(this);
  493. typename connections_list::const_iterator it = m_connected_slots.begin();
  494. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  495. return it == itEnd;
  496. }
  497. void disconnect_all()
  498. {
  499. lock_block<mt_policy> lock(this);
  500. typename connections_list::const_iterator it = m_connected_slots.begin();
  501. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  502. while(it != itEnd)
  503. {
  504. (*it)->getdest()->signal_disconnect(this);
  505. delete *it;
  506. ++it;
  507. }
  508. m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
  509. }
  510. #ifdef _DEBUG
  511. bool connected(has_slots_interface* pclass)
  512. {
  513. lock_block<mt_policy> lock(this);
  514. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  515. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  516. while(it != itEnd)
  517. {
  518. itNext = it;
  519. ++itNext;
  520. if ((*it)->getdest() == pclass)
  521. return true;
  522. it = itNext;
  523. }
  524. return false;
  525. }
  526. #endif
  527. void disconnect(has_slots_interface* pclass)
  528. {
  529. lock_block<mt_policy> lock(this);
  530. typename connections_list::iterator it = m_connected_slots.begin();
  531. typename connections_list::iterator itEnd = m_connected_slots.end();
  532. while(it != itEnd)
  533. {
  534. if((*it)->getdest() == pclass)
  535. {
  536. delete *it;
  537. m_connected_slots.erase(it);
  538. pclass->signal_disconnect(this);
  539. return;
  540. }
  541. ++it;
  542. }
  543. }
  544. void slot_disconnect(has_slots_interface* pslot)
  545. {
  546. lock_block<mt_policy> lock(this);
  547. typename connections_list::iterator it = m_connected_slots.begin();
  548. typename connections_list::iterator itEnd = m_connected_slots.end();
  549. while(it != itEnd)
  550. {
  551. typename connections_list::iterator itNext = it;
  552. ++itNext;
  553. if((*it)->getdest() == pslot)
  554. {
  555. delete *it;
  556. m_connected_slots.erase(it);
  557. }
  558. it = itNext;
  559. }
  560. }
  561. void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
  562. {
  563. lock_block<mt_policy> lock(this);
  564. typename connections_list::iterator it = m_connected_slots.begin();
  565. typename connections_list::iterator itEnd = m_connected_slots.end();
  566. while(it != itEnd)
  567. {
  568. if((*it)->getdest() == oldtarget)
  569. {
  570. m_connected_slots.push_back((*it)->duplicate(newtarget));
  571. }
  572. ++it;
  573. }
  574. }
  575. protected:
  576. connections_list m_connected_slots;
  577. };
  578. template<class arg1_type, class mt_policy>
  579. class _signal_base1 : public _signal_base<mt_policy>
  580. {
  581. public:
  582. typedef std::list<_connection_base1<arg1_type, mt_policy> *> connections_list;
  583. _signal_base1()
  584. {
  585. ;
  586. }
  587. _signal_base1(const _signal_base1<arg1_type, mt_policy>& s)
  588. : _signal_base<mt_policy>(s)
  589. {
  590. lock_block<mt_policy> lock(this);
  591. typename connections_list::const_iterator it = s.m_connected_slots.begin();
  592. typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
  593. while(it != itEnd)
  594. {
  595. (*it)->getdest()->signal_connect(this);
  596. m_connected_slots.push_back((*it)->clone());
  597. ++it;
  598. }
  599. }
  600. void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
  601. {
  602. lock_block<mt_policy> lock(this);
  603. typename connections_list::iterator it = m_connected_slots.begin();
  604. typename connections_list::iterator itEnd = m_connected_slots.end();
  605. while(it != itEnd)
  606. {
  607. if((*it)->getdest() == oldtarget)
  608. {
  609. m_connected_slots.push_back((*it)->duplicate(newtarget));
  610. }
  611. ++it;
  612. }
  613. }
  614. ~_signal_base1()
  615. {
  616. disconnect_all();
  617. }
  618. bool is_empty()
  619. {
  620. lock_block<mt_policy> lock(this);
  621. typename connections_list::const_iterator it = m_connected_slots.begin();
  622. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  623. return it == itEnd;
  624. }
  625. void disconnect_all()
  626. {
  627. lock_block<mt_policy> lock(this);
  628. typename connections_list::const_iterator it = m_connected_slots.begin();
  629. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  630. while(it != itEnd)
  631. {
  632. (*it)->getdest()->signal_disconnect(this);
  633. delete *it;
  634. ++it;
  635. }
  636. m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
  637. }
  638. #ifdef _DEBUG
  639. bool connected(has_slots_interface* pclass)
  640. {
  641. lock_block<mt_policy> lock(this);
  642. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  643. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  644. while(it != itEnd)
  645. {
  646. itNext = it;
  647. ++itNext;
  648. if ((*it)->getdest() == pclass)
  649. return true;
  650. it = itNext;
  651. }
  652. return false;
  653. }
  654. #endif
  655. void disconnect(has_slots_interface* pclass)
  656. {
  657. lock_block<mt_policy> lock(this);
  658. typename connections_list::iterator it = m_connected_slots.begin();
  659. typename connections_list::iterator itEnd = m_connected_slots.end();
  660. while(it != itEnd)
  661. {
  662. if((*it)->getdest() == pclass)
  663. {
  664. delete *it;
  665. m_connected_slots.erase(it);
  666. pclass->signal_disconnect(this);
  667. return;
  668. }
  669. ++it;
  670. }
  671. }
  672. void slot_disconnect(has_slots_interface* pslot)
  673. {
  674. lock_block<mt_policy> lock(this);
  675. typename connections_list::iterator it = m_connected_slots.begin();
  676. typename connections_list::iterator itEnd = m_connected_slots.end();
  677. while(it != itEnd)
  678. {
  679. typename connections_list::iterator itNext = it;
  680. ++itNext;
  681. if((*it)->getdest() == pslot)
  682. {
  683. delete *it;
  684. m_connected_slots.erase(it);
  685. }
  686. it = itNext;
  687. }
  688. }
  689. protected:
  690. connections_list m_connected_slots;
  691. };
  692. template<class arg1_type, class arg2_type, class mt_policy>
  693. class _signal_base2 : public _signal_base<mt_policy>
  694. {
  695. public:
  696. typedef std::list<_connection_base2<arg1_type, arg2_type, mt_policy> *>
  697. connections_list;
  698. _signal_base2()
  699. {
  700. ;
  701. }
  702. _signal_base2(const _signal_base2<arg1_type, arg2_type, mt_policy>& s)
  703. : _signal_base<mt_policy>(s)
  704. {
  705. lock_block<mt_policy> lock(this);
  706. typename connections_list::const_iterator it = s.m_connected_slots.begin();
  707. typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
  708. while(it != itEnd)
  709. {
  710. (*it)->getdest()->signal_connect(this);
  711. m_connected_slots.push_back((*it)->clone());
  712. ++it;
  713. }
  714. }
  715. void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
  716. {
  717. lock_block<mt_policy> lock(this);
  718. typename connections_list::iterator it = m_connected_slots.begin();
  719. typename connections_list::iterator itEnd = m_connected_slots.end();
  720. while(it != itEnd)
  721. {
  722. if((*it)->getdest() == oldtarget)
  723. {
  724. m_connected_slots.push_back((*it)->duplicate(newtarget));
  725. }
  726. ++it;
  727. }
  728. }
  729. ~_signal_base2()
  730. {
  731. disconnect_all();
  732. }
  733. bool is_empty()
  734. {
  735. lock_block<mt_policy> lock(this);
  736. typename connections_list::const_iterator it = m_connected_slots.begin();
  737. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  738. return it == itEnd;
  739. }
  740. void disconnect_all()
  741. {
  742. lock_block<mt_policy> lock(this);
  743. typename connections_list::const_iterator it = m_connected_slots.begin();
  744. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  745. while(it != itEnd)
  746. {
  747. (*it)->getdest()->signal_disconnect(this);
  748. delete *it;
  749. ++it;
  750. }
  751. m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
  752. }
  753. #ifdef _DEBUG
  754. bool connected(has_slots_interface* pclass)
  755. {
  756. lock_block<mt_policy> lock(this);
  757. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  758. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  759. while(it != itEnd)
  760. {
  761. itNext = it;
  762. ++itNext;
  763. if ((*it)->getdest() == pclass)
  764. return true;
  765. it = itNext;
  766. }
  767. return false;
  768. }
  769. #endif
  770. void disconnect(has_slots_interface* pclass)
  771. {
  772. lock_block<mt_policy> lock(this);
  773. typename connections_list::iterator it = m_connected_slots.begin();
  774. typename connections_list::iterator itEnd = m_connected_slots.end();
  775. while(it != itEnd)
  776. {
  777. if((*it)->getdest() == pclass)
  778. {
  779. delete *it;
  780. m_connected_slots.erase(it);
  781. pclass->signal_disconnect(this);
  782. return;
  783. }
  784. ++it;
  785. }
  786. }
  787. void slot_disconnect(has_slots_interface* pslot)
  788. {
  789. lock_block<mt_policy> lock(this);
  790. typename connections_list::iterator it = m_connected_slots.begin();
  791. typename connections_list::iterator itEnd = m_connected_slots.end();
  792. while(it != itEnd)
  793. {
  794. typename connections_list::iterator itNext = it;
  795. ++itNext;
  796. if((*it)->getdest() == pslot)
  797. {
  798. delete *it;
  799. m_connected_slots.erase(it);
  800. }
  801. it = itNext;
  802. }
  803. }
  804. protected:
  805. connections_list m_connected_slots;
  806. };
  807. template<class arg1_type, class arg2_type, class arg3_type, class mt_policy>
  808. class _signal_base3 : public _signal_base<mt_policy>
  809. {
  810. public:
  811. typedef std::list<_connection_base3<arg1_type, arg2_type, arg3_type, mt_policy> *>
  812. connections_list;
  813. _signal_base3()
  814. {
  815. ;
  816. }
  817. _signal_base3(const _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy>& s)
  818. : _signal_base<mt_policy>(s)
  819. {
  820. lock_block<mt_policy> lock(this);
  821. typename connections_list::const_iterator it = s.m_connected_slots.begin();
  822. typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
  823. while(it != itEnd)
  824. {
  825. (*it)->getdest()->signal_connect(this);
  826. m_connected_slots.push_back((*it)->clone());
  827. ++it;
  828. }
  829. }
  830. void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
  831. {
  832. lock_block<mt_policy> lock(this);
  833. typename connections_list::iterator it = m_connected_slots.begin();
  834. typename connections_list::iterator itEnd = m_connected_slots.end();
  835. while(it != itEnd)
  836. {
  837. if((*it)->getdest() == oldtarget)
  838. {
  839. m_connected_slots.push_back((*it)->duplicate(newtarget));
  840. }
  841. ++it;
  842. }
  843. }
  844. ~_signal_base3()
  845. {
  846. disconnect_all();
  847. }
  848. bool is_empty()
  849. {
  850. lock_block<mt_policy> lock(this);
  851. typename connections_list::const_iterator it = m_connected_slots.begin();
  852. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  853. return it == itEnd;
  854. }
  855. void disconnect_all()
  856. {
  857. lock_block<mt_policy> lock(this);
  858. typename connections_list::const_iterator it = m_connected_slots.begin();
  859. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  860. while(it != itEnd)
  861. {
  862. (*it)->getdest()->signal_disconnect(this);
  863. delete *it;
  864. ++it;
  865. }
  866. m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
  867. }
  868. #ifdef _DEBUG
  869. bool connected(has_slots_interface* pclass)
  870. {
  871. lock_block<mt_policy> lock(this);
  872. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  873. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  874. while(it != itEnd)
  875. {
  876. itNext = it;
  877. ++itNext;
  878. if ((*it)->getdest() == pclass)
  879. return true;
  880. it = itNext;
  881. }
  882. return false;
  883. }
  884. #endif
  885. void disconnect(has_slots_interface* pclass)
  886. {
  887. lock_block<mt_policy> lock(this);
  888. typename connections_list::iterator it = m_connected_slots.begin();
  889. typename connections_list::iterator itEnd = m_connected_slots.end();
  890. while(it != itEnd)
  891. {
  892. if((*it)->getdest() == pclass)
  893. {
  894. delete *it;
  895. m_connected_slots.erase(it);
  896. pclass->signal_disconnect(this);
  897. return;
  898. }
  899. ++it;
  900. }
  901. }
  902. void slot_disconnect(has_slots_interface* pslot)
  903. {
  904. lock_block<mt_policy> lock(this);
  905. typename connections_list::iterator it = m_connected_slots.begin();
  906. typename connections_list::iterator itEnd = m_connected_slots.end();
  907. while(it != itEnd)
  908. {
  909. typename connections_list::iterator itNext = it;
  910. ++itNext;
  911. if((*it)->getdest() == pslot)
  912. {
  913. delete *it;
  914. m_connected_slots.erase(it);
  915. }
  916. it = itNext;
  917. }
  918. }
  919. protected:
  920. connections_list m_connected_slots;
  921. };
  922. template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, class mt_policy>
  923. class _signal_base4 : public _signal_base<mt_policy>
  924. {
  925. public:
  926. typedef std::list<_connection_base4<arg1_type, arg2_type, arg3_type,
  927. arg4_type, mt_policy> *> connections_list;
  928. _signal_base4()
  929. {
  930. ;
  931. }
  932. _signal_base4(const _signal_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>& s)
  933. : _signal_base<mt_policy>(s)
  934. {
  935. lock_block<mt_policy> lock(this);
  936. typename connections_list::const_iterator it = s.m_connected_slots.begin();
  937. typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
  938. while(it != itEnd)
  939. {
  940. (*it)->getdest()->signal_connect(this);
  941. m_connected_slots.push_back((*it)->clone());
  942. ++it;
  943. }
  944. }
  945. void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
  946. {
  947. lock_block<mt_policy> lock(this);
  948. typename connections_list::iterator it = m_connected_slots.begin();
  949. typename connections_list::iterator itEnd = m_connected_slots.end();
  950. while(it != itEnd)
  951. {
  952. if((*it)->getdest() == oldtarget)
  953. {
  954. m_connected_slots.push_back((*it)->duplicate(newtarget));
  955. }
  956. ++it;
  957. }
  958. }
  959. ~_signal_base4()
  960. {
  961. disconnect_all();
  962. }
  963. bool is_empty()
  964. {
  965. lock_block<mt_policy> lock(this);
  966. typename connections_list::const_iterator it = m_connected_slots.begin();
  967. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  968. return it == itEnd;
  969. }
  970. void disconnect_all()
  971. {
  972. lock_block<mt_policy> lock(this);
  973. typename connections_list::const_iterator it = m_connected_slots.begin();
  974. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  975. while(it != itEnd)
  976. {
  977. (*it)->getdest()->signal_disconnect(this);
  978. delete *it;
  979. ++it;
  980. }
  981. m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
  982. }
  983. #ifdef _DEBUG
  984. bool connected(has_slots_interface* pclass)
  985. {
  986. lock_block<mt_policy> lock(this);
  987. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  988. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  989. while(it != itEnd)
  990. {
  991. itNext = it;
  992. ++itNext;
  993. if ((*it)->getdest() == pclass)
  994. return true;
  995. it = itNext;
  996. }
  997. return false;
  998. }
  999. #endif
  1000. void disconnect(has_slots_interface* pclass)
  1001. {
  1002. lock_block<mt_policy> lock(this);
  1003. typename connections_list::iterator it = m_connected_slots.begin();
  1004. typename connections_list::iterator itEnd = m_connected_slots.end();
  1005. while(it != itEnd)
  1006. {
  1007. if((*it)->getdest() == pclass)
  1008. {
  1009. delete *it;
  1010. m_connected_slots.erase(it);
  1011. pclass->signal_disconnect(this);
  1012. return;
  1013. }
  1014. ++it;
  1015. }
  1016. }
  1017. void slot_disconnect(has_slots_interface* pslot)
  1018. {
  1019. lock_block<mt_policy> lock(this);
  1020. typename connections_list::iterator it = m_connected_slots.begin();
  1021. typename connections_list::iterator itEnd = m_connected_slots.end();
  1022. while(it != itEnd)
  1023. {
  1024. typename connections_list::iterator itNext = it;
  1025. ++itNext;
  1026. if((*it)->getdest() == pslot)
  1027. {
  1028. delete *it;
  1029. m_connected_slots.erase(it);
  1030. }
  1031. it = itNext;
  1032. }
  1033. }
  1034. protected:
  1035. connections_list m_connected_slots;
  1036. };
  1037. template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
  1038. class arg5_type, class mt_policy>
  1039. class _signal_base5 : public _signal_base<mt_policy>
  1040. {
  1041. public:
  1042. typedef std::list<_connection_base5<arg1_type, arg2_type, arg3_type,
  1043. arg4_type, arg5_type, mt_policy> *> connections_list;
  1044. _signal_base5()
  1045. {
  1046. ;
  1047. }
  1048. _signal_base5(const _signal_base5<arg1_type, arg2_type, arg3_type, arg4_type,
  1049. arg5_type, mt_policy>& s)
  1050. : _signal_base<mt_policy>(s)
  1051. {
  1052. lock_block<mt_policy> lock(this);
  1053. typename connections_list::const_iterator it = s.m_connected_slots.begin();
  1054. typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
  1055. while(it != itEnd)
  1056. {
  1057. (*it)->getdest()->signal_connect(this);
  1058. m_connected_slots.push_back((*it)->clone());
  1059. ++it;
  1060. }
  1061. }
  1062. void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
  1063. {
  1064. lock_block<mt_policy> lock(this);
  1065. typename connections_list::iterator it = m_connected_slots.begin();
  1066. typename connections_list::iterator itEnd = m_connected_slots.end();
  1067. while(it != itEnd)
  1068. {
  1069. if((*it)->getdest() == oldtarget)
  1070. {
  1071. m_connected_slots.push_back((*it)->duplicate(newtarget));
  1072. }
  1073. ++it;
  1074. }
  1075. }
  1076. ~_signal_base5()
  1077. {
  1078. disconnect_all();
  1079. }
  1080. bool is_empty()
  1081. {
  1082. lock_block<mt_policy> lock(this);
  1083. typename connections_list::const_iterator it = m_connected_slots.begin();
  1084. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  1085. return it == itEnd;
  1086. }
  1087. void disconnect_all()
  1088. {
  1089. lock_block<mt_policy> lock(this);
  1090. typename connections_list::const_iterator it = m_connected_slots.begin();
  1091. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  1092. while(it != itEnd)
  1093. {
  1094. (*it)->getdest()->signal_disconnect(this);
  1095. delete *it;
  1096. ++it;
  1097. }
  1098. m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
  1099. }
  1100. #ifdef _DEBUG
  1101. bool connected(has_slots_interface* pclass)
  1102. {
  1103. lock_block<mt_policy> lock(this);
  1104. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  1105. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  1106. while(it != itEnd)
  1107. {
  1108. itNext = it;
  1109. ++itNext;
  1110. if ((*it)->getdest() == pclass)
  1111. return true;
  1112. it = itNext;
  1113. }
  1114. return false;
  1115. }
  1116. #endif
  1117. void disconnect(has_slots_interface* pclass)
  1118. {
  1119. lock_block<mt_policy> lock(this);
  1120. typename connections_list::iterator it = m_connected_slots.begin();
  1121. typename connections_list::iterator itEnd = m_connected_slots.end();
  1122. while(it != itEnd)
  1123. {
  1124. if((*it)->getdest() == pclass)
  1125. {
  1126. delete *it;
  1127. m_connected_slots.erase(it);
  1128. pclass->signal_disconnect(this);
  1129. return;
  1130. }
  1131. ++it;
  1132. }
  1133. }
  1134. void slot_disconnect(has_slots_interface* pslot)
  1135. {
  1136. lock_block<mt_policy> lock(this);
  1137. typename connections_list::iterator it = m_connected_slots.begin();
  1138. typename connections_list::iterator itEnd = m_connected_slots.end();
  1139. while(it != itEnd)
  1140. {
  1141. typename connections_list::iterator itNext = it;
  1142. ++itNext;
  1143. if((*it)->getdest() == pslot)
  1144. {
  1145. delete *it;
  1146. m_connected_slots.erase(it);
  1147. }
  1148. it = itNext;
  1149. }
  1150. }
  1151. protected:
  1152. connections_list m_connected_slots;
  1153. };
  1154. template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
  1155. class arg5_type, class arg6_type, class mt_policy>
  1156. class _signal_base6 : public _signal_base<mt_policy>
  1157. {
  1158. public:
  1159. typedef std::list<_connection_base6<arg1_type, arg2_type, arg3_type,
  1160. arg4_type, arg5_type, arg6_type, mt_policy> *> connections_list;
  1161. _signal_base6()
  1162. {
  1163. ;
  1164. }
  1165. _signal_base6(const _signal_base6<arg1_type, arg2_type, arg3_type, arg4_type,
  1166. arg5_type, arg6_type, mt_policy>& s)
  1167. : _signal_base<mt_policy>(s)
  1168. {
  1169. lock_block<mt_policy> lock(this);
  1170. typename connections_list::const_iterator it = s.m_connected_slots.begin();
  1171. typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
  1172. while(it != itEnd)
  1173. {
  1174. (*it)->getdest()->signal_connect(this);
  1175. m_connected_slots.push_back((*it)->clone());
  1176. ++it;
  1177. }
  1178. }
  1179. void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
  1180. {
  1181. lock_block<mt_policy> lock(this);
  1182. typename connections_list::iterator it = m_connected_slots.begin();
  1183. typename connections_list::iterator itEnd = m_connected_slots.end();
  1184. while(it != itEnd)
  1185. {
  1186. if((*it)->getdest() == oldtarget)
  1187. {
  1188. m_connected_slots.push_back((*it)->duplicate(newtarget));
  1189. }
  1190. ++it;
  1191. }
  1192. }
  1193. ~_signal_base6()
  1194. {
  1195. disconnect_all();
  1196. }
  1197. bool is_empty()
  1198. {
  1199. lock_block<mt_policy> lock(this);
  1200. typename connections_list::const_iterator it = m_connected_slots.begin();
  1201. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  1202. return it == itEnd;
  1203. }
  1204. void disconnect_all()
  1205. {
  1206. lock_block<mt_policy> lock(this);
  1207. typename connections_list::const_iterator it = m_connected_slots.begin();
  1208. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  1209. while(it != itEnd)
  1210. {
  1211. (*it)->getdest()->signal_disconnect(this);
  1212. delete *it;
  1213. ++it;
  1214. }
  1215. m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
  1216. }
  1217. #ifdef _DEBUG
  1218. bool connected(has_slots_interface* pclass)
  1219. {
  1220. lock_block<mt_policy> lock(this);
  1221. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  1222. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  1223. while(it != itEnd)
  1224. {
  1225. itNext = it;
  1226. ++itNext;
  1227. if ((*it)->getdest() == pclass)
  1228. return true;
  1229. it = itNext;
  1230. }
  1231. return false;
  1232. }
  1233. #endif
  1234. void disconnect(has_slots_interface* pclass)
  1235. {
  1236. lock_block<mt_policy> lock(this);
  1237. typename connections_list::iterator it = m_connected_slots.begin();
  1238. typename connections_list::iterator itEnd = m_connected_slots.end();
  1239. while(it != itEnd)
  1240. {
  1241. if((*it)->getdest() == pclass)
  1242. {
  1243. delete *it;
  1244. m_connected_slots.erase(it);
  1245. pclass->signal_disconnect(this);
  1246. return;
  1247. }
  1248. ++it;
  1249. }
  1250. }
  1251. void slot_disconnect(has_slots_interface* pslot)
  1252. {
  1253. lock_block<mt_policy> lock(this);
  1254. typename connections_list::iterator it = m_connected_slots.begin();
  1255. typename connections_list::iterator itEnd = m_connected_slots.end();
  1256. while(it != itEnd)
  1257. {
  1258. typename connections_list::iterator itNext = it;
  1259. ++itNext;
  1260. if((*it)->getdest() == pslot)
  1261. {
  1262. delete *it;
  1263. m_connected_slots.erase(it);
  1264. }
  1265. it = itNext;
  1266. }
  1267. }
  1268. protected:
  1269. connections_list m_connected_slots;
  1270. };
  1271. template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
  1272. class arg5_type, class arg6_type, class arg7_type, class mt_policy>
  1273. class _signal_base7 : public _signal_base<mt_policy>
  1274. {
  1275. public:
  1276. typedef std::list<_connection_base7<arg1_type, arg2_type, arg3_type,
  1277. arg4_type, arg5_type, arg6_type, arg7_type, mt_policy> *> connections_list;
  1278. _signal_base7()
  1279. {
  1280. ;
  1281. }
  1282. _signal_base7(const _signal_base7<arg1_type, arg2_type, arg3_type, arg4_type,
  1283. arg5_type, arg6_type, arg7_type, mt_policy>& s)
  1284. : _signal_base<mt_policy>(s)
  1285. {
  1286. lock_block<mt_policy> lock(this);
  1287. typename connections_list::const_iterator it = s.m_connected_slots.begin();
  1288. typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
  1289. while(it != itEnd)
  1290. {
  1291. (*it)->getdest()->signal_connect(this);
  1292. m_connected_slots.push_back((*it)->clone());
  1293. ++it;
  1294. }
  1295. }
  1296. void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
  1297. {
  1298. lock_block<mt_policy> lock(this);
  1299. typename connections_list::iterator it = m_connected_slots.begin();
  1300. typename connections_list::iterator itEnd = m_connected_slots.end();
  1301. while(it != itEnd)
  1302. {
  1303. if((*it)->getdest() == oldtarget)
  1304. {
  1305. m_connected_slots.push_back((*it)->duplicate(newtarget));
  1306. }
  1307. ++it;
  1308. }
  1309. }
  1310. ~_signal_base7()
  1311. {
  1312. disconnect_all();
  1313. }
  1314. bool is_empty()
  1315. {
  1316. lock_block<mt_policy> lock(this);
  1317. typename connections_list::const_iterator it = m_connected_slots.begin();
  1318. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  1319. return it == itEnd;
  1320. }
  1321. void disconnect_all()
  1322. {
  1323. lock_block<mt_policy> lock(this);
  1324. typename connections_list::const_iterator it = m_connected_slots.begin();
  1325. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  1326. while(it != itEnd)
  1327. {
  1328. (*it)->getdest()->signal_disconnect(this);
  1329. delete *it;
  1330. ++it;
  1331. }
  1332. m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
  1333. }
  1334. #ifdef _DEBUG
  1335. bool connected(has_slots_interface* pclass)
  1336. {
  1337. lock_block<mt_policy> lock(this);
  1338. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  1339. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  1340. while(it != itEnd)
  1341. {
  1342. itNext = it;
  1343. ++itNext;
  1344. if ((*it)->getdest() == pclass)
  1345. return true;
  1346. it = itNext;
  1347. }
  1348. return false;
  1349. }
  1350. #endif
  1351. void disconnect(has_slots_interface* pclass)
  1352. {
  1353. lock_block<mt_policy> lock(this);
  1354. typename connections_list::iterator it = m_connected_slots.begin();
  1355. typename connections_list::iterator itEnd = m_connected_slots.end();
  1356. while(it != itEnd)
  1357. {
  1358. if((*it)->getdest() == pclass)
  1359. {
  1360. delete *it;
  1361. m_connected_slots.erase(it);
  1362. pclass->signal_disconnect(this);
  1363. return;
  1364. }
  1365. ++it;
  1366. }
  1367. }
  1368. void slot_disconnect(has_slots_interface* pslot)
  1369. {
  1370. lock_block<mt_policy> lock(this);
  1371. typename connections_list::iterator it = m_connected_slots.begin();
  1372. typename connections_list::iterator itEnd = m_connected_slots.end();
  1373. while(it != itEnd)
  1374. {
  1375. typename connections_list::iterator itNext = it;
  1376. ++itNext;
  1377. if((*it)->getdest() == pslot)
  1378. {
  1379. delete *it;
  1380. m_connected_slots.erase(it);
  1381. }
  1382. it = itNext;
  1383. }
  1384. }
  1385. protected:
  1386. connections_list m_connected_slots;
  1387. };
  1388. template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
  1389. class arg5_type, class arg6_type, class arg7_type, class arg8_type, class mt_policy>
  1390. class _signal_base8 : public _signal_base<mt_policy>
  1391. {
  1392. public:
  1393. typedef std::list<_connection_base8<arg1_type, arg2_type, arg3_type,
  1394. arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> *>
  1395. connections_list;
  1396. _signal_base8()
  1397. {
  1398. ;
  1399. }
  1400. _signal_base8(const _signal_base8<arg1_type, arg2_type, arg3_type, arg4_type,
  1401. arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>& s)
  1402. : _signal_base<mt_policy>(s)
  1403. {
  1404. lock_block<mt_policy> lock(this);
  1405. typename connections_list::const_iterator it = s.m_connected_slots.begin();
  1406. typename connections_list::const_iterator itEnd = s.m_connected_slots.end();
  1407. while(it != itEnd)
  1408. {
  1409. (*it)->getdest()->signal_connect(this);
  1410. m_connected_slots.push_back((*it)->clone());
  1411. ++it;
  1412. }
  1413. }
  1414. void slot_duplicate(const has_slots_interface* oldtarget, has_slots_interface* newtarget)
  1415. {
  1416. lock_block<mt_policy> lock(this);
  1417. typename connections_list::iterator it = m_connected_slots.begin();
  1418. typename connections_list::iterator itEnd = m_connected_slots.end();
  1419. while(it != itEnd)
  1420. {
  1421. if((*it)->getdest() == oldtarget)
  1422. {
  1423. m_connected_slots.push_back((*it)->duplicate(newtarget));
  1424. }
  1425. ++it;
  1426. }
  1427. }
  1428. ~_signal_base8()
  1429. {
  1430. disconnect_all();
  1431. }
  1432. bool is_empty()
  1433. {
  1434. lock_block<mt_policy> lock(this);
  1435. typename connections_list::const_iterator it = m_connected_slots.begin();
  1436. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  1437. return it == itEnd;
  1438. }
  1439. void disconnect_all()
  1440. {
  1441. lock_block<mt_policy> lock(this);
  1442. typename connections_list::const_iterator it = m_connected_slots.begin();
  1443. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  1444. while(it != itEnd)
  1445. {
  1446. (*it)->getdest()->signal_disconnect(this);
  1447. delete *it;
  1448. ++it;
  1449. }
  1450. m_connected_slots.erase(m_connected_slots.begin(), m_connected_slots.end());
  1451. }
  1452. #ifdef _DEBUG
  1453. bool connected(has_slots_interface* pclass)
  1454. {
  1455. lock_block<mt_policy> lock(this);
  1456. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  1457. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  1458. while(it != itEnd)
  1459. {
  1460. itNext = it;
  1461. ++itNext;
  1462. if ((*it)->getdest() == pclass)
  1463. return true;
  1464. it = itNext;
  1465. }
  1466. return false;
  1467. }
  1468. #endif
  1469. void disconnect(has_slots_interface* pclass)
  1470. {
  1471. lock_block<mt_policy> lock(this);
  1472. typename connections_list::iterator it = m_connected_slots.begin();
  1473. typename connections_list::iterator itEnd = m_connected_slots.end();
  1474. while(it != itEnd)
  1475. {
  1476. if((*it)->getdest() == pclass)
  1477. {
  1478. delete *it;
  1479. m_connected_slots.erase(it);
  1480. pclass->signal_disconnect(this);
  1481. return;
  1482. }
  1483. ++it;
  1484. }
  1485. }
  1486. void slot_disconnect(has_slots_interface* pslot)
  1487. {
  1488. lock_block<mt_policy> lock(this);
  1489. typename connections_list::iterator it = m_connected_slots.begin();
  1490. typename connections_list::iterator itEnd = m_connected_slots.end();
  1491. while(it != itEnd)
  1492. {
  1493. typename connections_list::iterator itNext = it;
  1494. ++itNext;
  1495. if((*it)->getdest() == pslot)
  1496. {
  1497. delete *it;
  1498. m_connected_slots.erase(it);
  1499. }
  1500. it = itNext;
  1501. }
  1502. }
  1503. protected:
  1504. connections_list m_connected_slots;
  1505. };
  1506. template<class dest_type, class mt_policy>
  1507. class _connection0 : public _connection_base0<mt_policy>
  1508. {
  1509. public:
  1510. _connection0()
  1511. {
  1512. m_pobject = NULL;
  1513. m_pmemfun = NULL;
  1514. }
  1515. _connection0(dest_type* pobject, void (dest_type::*pmemfun)())
  1516. {
  1517. m_pobject = pobject;
  1518. m_pmemfun = pmemfun;
  1519. }
  1520. virtual ~_connection0()
  1521. {
  1522. }
  1523. virtual _connection_base0<mt_policy>* clone()
  1524. {
  1525. return new _connection0<dest_type, mt_policy>(*this);
  1526. }
  1527. virtual _connection_base0<mt_policy>* duplicate(has_slots_interface* pnewdest)
  1528. {
  1529. return new _connection0<dest_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
  1530. }
  1531. virtual void emit()
  1532. {
  1533. (m_pobject->*m_pmemfun)();
  1534. }
  1535. virtual has_slots_interface* getdest() const
  1536. {
  1537. return m_pobject;
  1538. }
  1539. private:
  1540. dest_type* m_pobject;
  1541. void (dest_type::* m_pmemfun)();
  1542. };
  1543. template<class dest_type, class arg1_type, class mt_policy>
  1544. class _connection1 : public _connection_base1<arg1_type, mt_policy>
  1545. {
  1546. public:
  1547. _connection1()
  1548. {
  1549. m_pobject = NULL;
  1550. m_pmemfun = NULL;
  1551. }
  1552. _connection1(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type))
  1553. {
  1554. m_pobject = pobject;
  1555. m_pmemfun = pmemfun;
  1556. }
  1557. virtual ~_connection1()
  1558. {
  1559. }
  1560. virtual _connection_base1<arg1_type, mt_policy>* clone()
  1561. {
  1562. return new _connection1<dest_type, arg1_type, mt_policy>(*this);
  1563. }
  1564. virtual _connection_base1<arg1_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
  1565. {
  1566. return new _connection1<dest_type, arg1_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
  1567. }
  1568. virtual void emit(arg1_type a1)
  1569. {
  1570. (m_pobject->*m_pmemfun)(a1);
  1571. }
  1572. virtual has_slots_interface* getdest() const
  1573. {
  1574. return m_pobject;
  1575. }
  1576. private:
  1577. dest_type* m_pobject;
  1578. void (dest_type::* m_pmemfun)(arg1_type);
  1579. };
  1580. template<class dest_type, class arg1_type, class arg2_type, class mt_policy>
  1581. class _connection2 : public _connection_base2<arg1_type, arg2_type, mt_policy>
  1582. {
  1583. public:
  1584. _connection2()
  1585. {
  1586. m_pobject = NULL;
  1587. m_pmemfun = NULL;
  1588. }
  1589. _connection2(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
  1590. arg2_type))
  1591. {
  1592. m_pobject = pobject;
  1593. m_pmemfun = pmemfun;
  1594. }
  1595. virtual ~_connection2()
  1596. {
  1597. }
  1598. virtual _connection_base2<arg1_type, arg2_type, mt_policy>* clone()
  1599. {
  1600. return new _connection2<dest_type, arg1_type, arg2_type, mt_policy>(*this);
  1601. }
  1602. virtual _connection_base2<arg1_type, arg2_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
  1603. {
  1604. return new _connection2<dest_type, arg1_type, arg2_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
  1605. }
  1606. virtual void emit(arg1_type a1, arg2_type a2)
  1607. {
  1608. (m_pobject->*m_pmemfun)(a1, a2);
  1609. }
  1610. virtual has_slots_interface* getdest() const
  1611. {
  1612. return m_pobject;
  1613. }
  1614. private:
  1615. dest_type* m_pobject;
  1616. void (dest_type::* m_pmemfun)(arg1_type, arg2_type);
  1617. };
  1618. template<class dest_type, class arg1_type, class arg2_type, class arg3_type, class mt_policy>
  1619. class _connection3 : public _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>
  1620. {
  1621. public:
  1622. _connection3()
  1623. {
  1624. m_pobject = NULL;
  1625. m_pmemfun = NULL;
  1626. }
  1627. _connection3(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
  1628. arg2_type, arg3_type))
  1629. {
  1630. m_pobject = pobject;
  1631. m_pmemfun = pmemfun;
  1632. }
  1633. virtual ~_connection3()
  1634. {
  1635. }
  1636. virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>* clone()
  1637. {
  1638. return new _connection3<dest_type, arg1_type, arg2_type, arg3_type, mt_policy>(*this);
  1639. }
  1640. virtual _connection_base3<arg1_type, arg2_type, arg3_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
  1641. {
  1642. return new _connection3<dest_type, arg1_type, arg2_type, arg3_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
  1643. }
  1644. virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3)
  1645. {
  1646. (m_pobject->*m_pmemfun)(a1, a2, a3);
  1647. }
  1648. virtual has_slots_interface* getdest() const
  1649. {
  1650. return m_pobject;
  1651. }
  1652. private:
  1653. dest_type* m_pobject;
  1654. void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type);
  1655. };
  1656. template<class dest_type, class arg1_type, class arg2_type, class arg3_type,
  1657. class arg4_type, class mt_policy>
  1658. class _connection4 : public _connection_base4<arg1_type, arg2_type,
  1659. arg3_type, arg4_type, mt_policy>
  1660. {
  1661. public:
  1662. _connection4()
  1663. {
  1664. m_pobject = NULL;
  1665. m_pmemfun = NULL;
  1666. }
  1667. _connection4(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
  1668. arg2_type, arg3_type, arg4_type))
  1669. {
  1670. m_pobject = pobject;
  1671. m_pmemfun = pmemfun;
  1672. }
  1673. virtual ~_connection4()
  1674. {
  1675. }
  1676. virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* clone()
  1677. {
  1678. return new _connection4<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>(*this);
  1679. }
  1680. virtual _connection_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
  1681. {
  1682. return new _connection4<dest_type, arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
  1683. }
  1684. virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3,
  1685. arg4_type a4)
  1686. {
  1687. (m_pobject->*m_pmemfun)(a1, a2, a3, a4);
  1688. }
  1689. virtual has_slots_interface* getdest() const
  1690. {
  1691. return m_pobject;
  1692. }
  1693. private:
  1694. dest_type* m_pobject;
  1695. void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type,
  1696. arg4_type);
  1697. };
  1698. template<class dest_type, class arg1_type, class arg2_type, class arg3_type,
  1699. class arg4_type, class arg5_type, class mt_policy>
  1700. class _connection5 : public _connection_base5<arg1_type, arg2_type,
  1701. arg3_type, arg4_type, arg5_type, mt_policy>
  1702. {
  1703. public:
  1704. _connection5()
  1705. {
  1706. m_pobject = NULL;
  1707. m_pmemfun = NULL;
  1708. }
  1709. _connection5(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
  1710. arg2_type, arg3_type, arg4_type, arg5_type))
  1711. {
  1712. m_pobject = pobject;
  1713. m_pmemfun = pmemfun;
  1714. }
  1715. virtual ~_connection5()
  1716. {
  1717. }
  1718. virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
  1719. arg5_type, mt_policy>* clone()
  1720. {
  1721. return new _connection5<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
  1722. arg5_type, mt_policy>(*this);
  1723. }
  1724. virtual _connection_base5<arg1_type, arg2_type, arg3_type, arg4_type,
  1725. arg5_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
  1726. {
  1727. return new _connection5<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
  1728. arg5_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
  1729. }
  1730. virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
  1731. arg5_type a5)
  1732. {
  1733. (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5);
  1734. }
  1735. virtual has_slots_interface* getdest() const
  1736. {
  1737. return m_pobject;
  1738. }
  1739. private:
  1740. dest_type* m_pobject;
  1741. void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
  1742. arg5_type);
  1743. };
  1744. template<class dest_type, class arg1_type, class arg2_type, class arg3_type,
  1745. class arg4_type, class arg5_type, class arg6_type, class mt_policy>
  1746. class _connection6 : public _connection_base6<arg1_type, arg2_type,
  1747. arg3_type, arg4_type, arg5_type, arg6_type, mt_policy>
  1748. {
  1749. public:
  1750. _connection6()
  1751. {
  1752. m_pobject = NULL;
  1753. m_pmemfun = NULL;
  1754. }
  1755. _connection6(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
  1756. arg2_type, arg3_type, arg4_type, arg5_type, arg6_type))
  1757. {
  1758. m_pobject = pobject;
  1759. m_pmemfun = pmemfun;
  1760. }
  1761. virtual ~_connection6()
  1762. {
  1763. }
  1764. virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
  1765. arg5_type, arg6_type, mt_policy>* clone()
  1766. {
  1767. return new _connection6<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
  1768. arg5_type, arg6_type, mt_policy>(*this);
  1769. }
  1770. virtual _connection_base6<arg1_type, arg2_type, arg3_type, arg4_type,
  1771. arg5_type, arg6_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
  1772. {
  1773. return new _connection6<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
  1774. arg5_type, arg6_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
  1775. }
  1776. virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
  1777. arg5_type a5, arg6_type a6)
  1778. {
  1779. (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5, a6);
  1780. }
  1781. virtual has_slots_interface* getdest() const
  1782. {
  1783. return m_pobject;
  1784. }
  1785. private:
  1786. dest_type* m_pobject;
  1787. void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
  1788. arg5_type, arg6_type);
  1789. };
  1790. template<class dest_type, class arg1_type, class arg2_type, class arg3_type,
  1791. class arg4_type, class arg5_type, class arg6_type, class arg7_type, class mt_policy>
  1792. class _connection7 : public _connection_base7<arg1_type, arg2_type,
  1793. arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, mt_policy>
  1794. {
  1795. public:
  1796. _connection7()
  1797. {
  1798. m_pobject = NULL;
  1799. m_pmemfun = NULL;
  1800. }
  1801. _connection7(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
  1802. arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type))
  1803. {
  1804. m_pobject = pobject;
  1805. m_pmemfun = pmemfun;
  1806. }
  1807. virtual ~_connection7()
  1808. {
  1809. }
  1810. virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
  1811. arg5_type, arg6_type, arg7_type, mt_policy>* clone()
  1812. {
  1813. return new _connection7<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
  1814. arg5_type, arg6_type, arg7_type, mt_policy>(*this);
  1815. }
  1816. virtual _connection_base7<arg1_type, arg2_type, arg3_type, arg4_type,
  1817. arg5_type, arg6_type, arg7_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
  1818. {
  1819. return new _connection7<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
  1820. arg5_type, arg6_type, arg7_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
  1821. }
  1822. virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
  1823. arg5_type a5, arg6_type a6, arg7_type a7)
  1824. {
  1825. (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5, a6, a7);
  1826. }
  1827. virtual has_slots_interface* getdest() const
  1828. {
  1829. return m_pobject;
  1830. }
  1831. private:
  1832. dest_type* m_pobject;
  1833. void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
  1834. arg5_type, arg6_type, arg7_type);
  1835. };
  1836. template<class dest_type, class arg1_type, class arg2_type, class arg3_type,
  1837. class arg4_type, class arg5_type, class arg6_type, class arg7_type,
  1838. class arg8_type, class mt_policy>
  1839. class _connection8 : public _connection_base8<arg1_type, arg2_type,
  1840. arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>
  1841. {
  1842. public:
  1843. _connection8()
  1844. {
  1845. m_pobject = NULL;
  1846. m_pmemfun = NULL;
  1847. }
  1848. _connection8(dest_type* pobject, void (dest_type::*pmemfun)(arg1_type,
  1849. arg2_type, arg3_type, arg4_type, arg5_type, arg6_type,
  1850. arg7_type, arg8_type))
  1851. {
  1852. m_pobject = pobject;
  1853. m_pmemfun = pmemfun;
  1854. }
  1855. virtual ~_connection8()
  1856. {
  1857. }
  1858. virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
  1859. arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* clone()
  1860. {
  1861. return new _connection8<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
  1862. arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>(*this);
  1863. }
  1864. virtual _connection_base8<arg1_type, arg2_type, arg3_type, arg4_type,
  1865. arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* duplicate(has_slots_interface* pnewdest)
  1866. {
  1867. return new _connection8<dest_type, arg1_type, arg2_type, arg3_type, arg4_type,
  1868. arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>((dest_type *)pnewdest, m_pmemfun);
  1869. }
  1870. virtual void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
  1871. arg5_type a5, arg6_type a6, arg7_type a7, arg8_type a8)
  1872. {
  1873. (m_pobject->*m_pmemfun)(a1, a2, a3, a4, a5, a6, a7, a8);
  1874. }
  1875. virtual has_slots_interface* getdest() const
  1876. {
  1877. return m_pobject;
  1878. }
  1879. private:
  1880. dest_type* m_pobject;
  1881. void (dest_type::* m_pmemfun)(arg1_type, arg2_type, arg3_type, arg4_type,
  1882. arg5_type, arg6_type, arg7_type, arg8_type);
  1883. };
  1884. template<class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
  1885. class signal0 : public _signal_base0<mt_policy>
  1886. {
  1887. public:
  1888. typedef _signal_base0<mt_policy> base;
  1889. typedef typename base::connections_list connections_list;
  1890. using base::m_connected_slots;
  1891. signal0()
  1892. {
  1893. ;
  1894. }
  1895. signal0(const signal0<mt_policy>& s)
  1896. : _signal_base0<mt_policy>(s)
  1897. {
  1898. ;
  1899. }
  1900. template<class desttype>
  1901. void connect(desttype* pclass, void (desttype::*pmemfun)())
  1902. {
  1903. lock_block<mt_policy> lock(this);
  1904. _connection0<desttype, mt_policy>* conn =
  1905. new _connection0<desttype, mt_policy>(pclass, pmemfun);
  1906. m_connected_slots.push_back(conn);
  1907. pclass->signal_connect(this);
  1908. }
  1909. void emit()
  1910. {
  1911. lock_block<mt_policy> lock(this);
  1912. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  1913. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  1914. while(it != itEnd)
  1915. {
  1916. itNext = it;
  1917. ++itNext;
  1918. (*it)->emit();
  1919. it = itNext;
  1920. }
  1921. }
  1922. void operator()()
  1923. {
  1924. lock_block<mt_policy> lock(this);
  1925. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  1926. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  1927. while(it != itEnd)
  1928. {
  1929. itNext = it;
  1930. ++itNext;
  1931. (*it)->emit();
  1932. it = itNext;
  1933. }
  1934. }
  1935. };
  1936. template<class arg1_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
  1937. class signal1 : public _signal_base1<arg1_type, mt_policy>
  1938. {
  1939. public:
  1940. typedef _signal_base1<arg1_type, mt_policy> base;
  1941. typedef typename base::connections_list connections_list;
  1942. using base::m_connected_slots;
  1943. signal1()
  1944. {
  1945. ;
  1946. }
  1947. signal1(const signal1<arg1_type, mt_policy>& s)
  1948. : _signal_base1<arg1_type, mt_policy>(s)
  1949. {
  1950. ;
  1951. }
  1952. template<class desttype>
  1953. void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type))
  1954. {
  1955. lock_block<mt_policy> lock(this);
  1956. _connection1<desttype, arg1_type, mt_policy>* conn =
  1957. new _connection1<desttype, arg1_type, mt_policy>(pclass, pmemfun);
  1958. m_connected_slots.push_back(conn);
  1959. pclass->signal_connect(this);
  1960. }
  1961. void emit(arg1_type a1)
  1962. {
  1963. lock_block<mt_policy> lock(this);
  1964. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  1965. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  1966. while(it != itEnd)
  1967. {
  1968. itNext = it;
  1969. ++itNext;
  1970. (*it)->emit(a1);
  1971. it = itNext;
  1972. }
  1973. }
  1974. void operator()(arg1_type a1)
  1975. {
  1976. lock_block<mt_policy> lock(this);
  1977. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  1978. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  1979. while(it != itEnd)
  1980. {
  1981. itNext = it;
  1982. ++itNext;
  1983. (*it)->emit(a1);
  1984. it = itNext;
  1985. }
  1986. }
  1987. };
  1988. template<class arg1_type, class arg2_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
  1989. class signal2 : public _signal_base2<arg1_type, arg2_type, mt_policy>
  1990. {
  1991. public:
  1992. typedef _signal_base2<arg1_type, arg2_type, mt_policy> base;
  1993. typedef typename base::connections_list connections_list;
  1994. using base::m_connected_slots;
  1995. signal2()
  1996. {
  1997. ;
  1998. }
  1999. signal2(const signal2<arg1_type, arg2_type, mt_policy>& s)
  2000. : _signal_base2<arg1_type, arg2_type, mt_policy>(s)
  2001. {
  2002. ;
  2003. }
  2004. template<class desttype>
  2005. void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
  2006. arg2_type))
  2007. {
  2008. lock_block<mt_policy> lock(this);
  2009. _connection2<desttype, arg1_type, arg2_type, mt_policy>* conn = new
  2010. _connection2<desttype, arg1_type, arg2_type, mt_policy>(pclass, pmemfun);
  2011. m_connected_slots.push_back(conn);
  2012. pclass->signal_connect(this);
  2013. }
  2014. void emit(arg1_type a1, arg2_type a2)
  2015. {
  2016. lock_block<mt_policy> lock(this);
  2017. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  2018. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  2019. while(it != itEnd)
  2020. {
  2021. itNext = it;
  2022. ++itNext;
  2023. (*it)->emit(a1, a2);
  2024. it = itNext;
  2025. }
  2026. }
  2027. void operator()(arg1_type a1, arg2_type a2)
  2028. {
  2029. lock_block<mt_policy> lock(this);
  2030. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  2031. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  2032. while(it != itEnd)
  2033. {
  2034. itNext = it;
  2035. ++itNext;
  2036. (*it)->emit(a1, a2);
  2037. it = itNext;
  2038. }
  2039. }
  2040. };
  2041. template<class arg1_type, class arg2_type, class arg3_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
  2042. class signal3 : public _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy>
  2043. {
  2044. public:
  2045. typedef _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy> base;
  2046. typedef typename base::connections_list connections_list;
  2047. using base::m_connected_slots;
  2048. signal3()
  2049. {
  2050. ;
  2051. }
  2052. signal3(const signal3<arg1_type, arg2_type, arg3_type, mt_policy>& s)
  2053. : _signal_base3<arg1_type, arg2_type, arg3_type, mt_policy>(s)
  2054. {
  2055. ;
  2056. }
  2057. template<class desttype>
  2058. void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
  2059. arg2_type, arg3_type))
  2060. {
  2061. lock_block<mt_policy> lock(this);
  2062. _connection3<desttype, arg1_type, arg2_type, arg3_type, mt_policy>* conn =
  2063. new _connection3<desttype, arg1_type, arg2_type, arg3_type, mt_policy>(pclass,
  2064. pmemfun);
  2065. m_connected_slots.push_back(conn);
  2066. pclass->signal_connect(this);
  2067. }
  2068. void emit(arg1_type a1, arg2_type a2, arg3_type a3)
  2069. {
  2070. lock_block<mt_policy> lock(this);
  2071. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  2072. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  2073. while(it != itEnd)
  2074. {
  2075. itNext = it;
  2076. ++itNext;
  2077. (*it)->emit(a1, a2, a3);
  2078. it = itNext;
  2079. }
  2080. }
  2081. void operator()(arg1_type a1, arg2_type a2, arg3_type a3)
  2082. {
  2083. lock_block<mt_policy> lock(this);
  2084. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  2085. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  2086. while(it != itEnd)
  2087. {
  2088. itNext = it;
  2089. ++itNext;
  2090. (*it)->emit(a1, a2, a3);
  2091. it = itNext;
  2092. }
  2093. }
  2094. };
  2095. template<class arg1_type, class arg2_type, class arg3_type, class arg4_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
  2096. class signal4 : public _signal_base4<arg1_type, arg2_type, arg3_type,
  2097. arg4_type, mt_policy>
  2098. {
  2099. public:
  2100. typedef _signal_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy> base;
  2101. typedef typename base::connections_list connections_list;
  2102. using base::m_connected_slots;
  2103. signal4()
  2104. {
  2105. ;
  2106. }
  2107. signal4(const signal4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>& s)
  2108. : _signal_base4<arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>(s)
  2109. {
  2110. ;
  2111. }
  2112. template<class desttype>
  2113. void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
  2114. arg2_type, arg3_type, arg4_type))
  2115. {
  2116. lock_block<mt_policy> lock(this);
  2117. _connection4<desttype, arg1_type, arg2_type, arg3_type, arg4_type, mt_policy>*
  2118. conn = new _connection4<desttype, arg1_type, arg2_type, arg3_type,
  2119. arg4_type, mt_policy>(pclass, pmemfun);
  2120. m_connected_slots.push_back(conn);
  2121. pclass->signal_connect(this);
  2122. }
  2123. void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4)
  2124. {
  2125. lock_block<mt_policy> lock(this);
  2126. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  2127. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  2128. while(it != itEnd)
  2129. {
  2130. itNext = it;
  2131. ++itNext;
  2132. (*it)->emit(a1, a2, a3, a4);
  2133. it = itNext;
  2134. }
  2135. }
  2136. void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4)
  2137. {
  2138. lock_block<mt_policy> lock(this);
  2139. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  2140. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  2141. while(it != itEnd)
  2142. {
  2143. itNext = it;
  2144. ++itNext;
  2145. (*it)->emit(a1, a2, a3, a4);
  2146. it = itNext;
  2147. }
  2148. }
  2149. };
  2150. template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
  2151. class arg5_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
  2152. class signal5 : public _signal_base5<arg1_type, arg2_type, arg3_type,
  2153. arg4_type, arg5_type, mt_policy>
  2154. {
  2155. public:
  2156. typedef _signal_base5<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, mt_policy> base;
  2157. typedef typename base::connections_list connections_list;
  2158. using base::m_connected_slots;
  2159. signal5()
  2160. {
  2161. ;
  2162. }
  2163. signal5(const signal5<arg1_type, arg2_type, arg3_type, arg4_type,
  2164. arg5_type, mt_policy>& s)
  2165. : _signal_base5<arg1_type, arg2_type, arg3_type, arg4_type,
  2166. arg5_type, mt_policy>(s)
  2167. {
  2168. ;
  2169. }
  2170. template<class desttype>
  2171. void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
  2172. arg2_type, arg3_type, arg4_type, arg5_type))
  2173. {
  2174. lock_block<mt_policy> lock(this);
  2175. _connection5<desttype, arg1_type, arg2_type, arg3_type, arg4_type,
  2176. arg5_type, mt_policy>* conn = new _connection5<desttype, arg1_type, arg2_type,
  2177. arg3_type, arg4_type, arg5_type, mt_policy>(pclass, pmemfun);
  2178. m_connected_slots.push_back(conn);
  2179. pclass->signal_connect(this);
  2180. }
  2181. void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
  2182. arg5_type a5)
  2183. {
  2184. lock_block<mt_policy> lock(this);
  2185. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  2186. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  2187. while(it != itEnd)
  2188. {
  2189. itNext = it;
  2190. ++itNext;
  2191. (*it)->emit(a1, a2, a3, a4, a5);
  2192. it = itNext;
  2193. }
  2194. }
  2195. void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
  2196. arg5_type a5)
  2197. {
  2198. lock_block<mt_policy> lock(this);
  2199. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  2200. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  2201. while(it != itEnd)
  2202. {
  2203. itNext = it;
  2204. ++itNext;
  2205. (*it)->emit(a1, a2, a3, a4, a5);
  2206. it = itNext;
  2207. }
  2208. }
  2209. };
  2210. template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
  2211. class arg5_type, class arg6_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
  2212. class signal6 : public _signal_base6<arg1_type, arg2_type, arg3_type,
  2213. arg4_type, arg5_type, arg6_type, mt_policy>
  2214. {
  2215. public:
  2216. typedef _signal_base6<arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, mt_policy> base;
  2217. typedef typename base::connections_list connections_list;
  2218. using base::m_connected_slots;
  2219. signal6()
  2220. {
  2221. ;
  2222. }
  2223. signal6(const signal6<arg1_type, arg2_type, arg3_type, arg4_type,
  2224. arg5_type, arg6_type, mt_policy>& s)
  2225. : _signal_base6<arg1_type, arg2_type, arg3_type, arg4_type,
  2226. arg5_type, arg6_type, mt_policy>(s)
  2227. {
  2228. ;
  2229. }
  2230. template<class desttype>
  2231. void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
  2232. arg2_type, arg3_type, arg4_type, arg5_type, arg6_type))
  2233. {
  2234. lock_block<mt_policy> lock(this);
  2235. _connection6<desttype, arg1_type, arg2_type, arg3_type, arg4_type,
  2236. arg5_type, arg6_type, mt_policy>* conn =
  2237. new _connection6<desttype, arg1_type, arg2_type, arg3_type,
  2238. arg4_type, arg5_type, arg6_type, mt_policy>(pclass, pmemfun);
  2239. m_connected_slots.push_back(conn);
  2240. pclass->signal_connect(this);
  2241. }
  2242. void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
  2243. arg5_type a5, arg6_type a6)
  2244. {
  2245. lock_block<mt_policy> lock(this);
  2246. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  2247. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  2248. while(it != itEnd)
  2249. {
  2250. itNext = it;
  2251. ++itNext;
  2252. (*it)->emit(a1, a2, a3, a4, a5, a6);
  2253. it = itNext;
  2254. }
  2255. }
  2256. void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
  2257. arg5_type a5, arg6_type a6)
  2258. {
  2259. lock_block<mt_policy> lock(this);
  2260. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  2261. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  2262. while(it != itEnd)
  2263. {
  2264. itNext = it;
  2265. ++itNext;
  2266. (*it)->emit(a1, a2, a3, a4, a5, a6);
  2267. it = itNext;
  2268. }
  2269. }
  2270. };
  2271. template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
  2272. class arg5_type, class arg6_type, class arg7_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
  2273. class signal7 : public _signal_base7<arg1_type, arg2_type, arg3_type,
  2274. arg4_type, arg5_type, arg6_type, arg7_type, mt_policy>
  2275. {
  2276. public:
  2277. typedef _signal_base7<arg1_type, arg2_type, arg3_type, arg4_type,
  2278. arg5_type, arg6_type, arg7_type, mt_policy> base;
  2279. typedef typename base::connections_list connections_list;
  2280. using base::m_connected_slots;
  2281. signal7()
  2282. {
  2283. ;
  2284. }
  2285. signal7(const signal7<arg1_type, arg2_type, arg3_type, arg4_type,
  2286. arg5_type, arg6_type, arg7_type, mt_policy>& s)
  2287. : _signal_base7<arg1_type, arg2_type, arg3_type, arg4_type,
  2288. arg5_type, arg6_type, arg7_type, mt_policy>(s)
  2289. {
  2290. ;
  2291. }
  2292. template<class desttype>
  2293. void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
  2294. arg2_type, arg3_type, arg4_type, arg5_type, arg6_type,
  2295. arg7_type))
  2296. {
  2297. lock_block<mt_policy> lock(this);
  2298. _connection7<desttype, arg1_type, arg2_type, arg3_type, arg4_type,
  2299. arg5_type, arg6_type, arg7_type, mt_policy>* conn =
  2300. new _connection7<desttype, arg1_type, arg2_type, arg3_type,
  2301. arg4_type, arg5_type, arg6_type, arg7_type, mt_policy>(pclass, pmemfun);
  2302. m_connected_slots.push_back(conn);
  2303. pclass->signal_connect(this);
  2304. }
  2305. void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
  2306. arg5_type a5, arg6_type a6, arg7_type a7)
  2307. {
  2308. lock_block<mt_policy> lock(this);
  2309. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  2310. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  2311. while(it != itEnd)
  2312. {
  2313. itNext = it;
  2314. ++itNext;
  2315. (*it)->emit(a1, a2, a3, a4, a5, a6, a7);
  2316. it = itNext;
  2317. }
  2318. }
  2319. void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
  2320. arg5_type a5, arg6_type a6, arg7_type a7)
  2321. {
  2322. lock_block<mt_policy> lock(this);
  2323. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  2324. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  2325. while(it != itEnd)
  2326. {
  2327. itNext = it;
  2328. ++itNext;
  2329. (*it)->emit(a1, a2, a3, a4, a5, a6, a7);
  2330. it = itNext;
  2331. }
  2332. }
  2333. };
  2334. template<class arg1_type, class arg2_type, class arg3_type, class arg4_type,
  2335. class arg5_type, class arg6_type, class arg7_type, class arg8_type, class mt_policy = SIGSLOT_DEFAULT_MT_POLICY>
  2336. class signal8 : public _signal_base8<arg1_type, arg2_type, arg3_type,
  2337. arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>
  2338. {
  2339. public:
  2340. typedef _signal_base8<arg1_type, arg2_type, arg3_type, arg4_type,
  2341. arg5_type, arg6_type, arg7_type, arg8_type, mt_policy> base;
  2342. typedef typename base::connections_list connections_list;
  2343. using base::m_connected_slots;
  2344. signal8()
  2345. {
  2346. ;
  2347. }
  2348. signal8(const signal8<arg1_type, arg2_type, arg3_type, arg4_type,
  2349. arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>& s)
  2350. : _signal_base8<arg1_type, arg2_type, arg3_type, arg4_type,
  2351. arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>(s)
  2352. {
  2353. ;
  2354. }
  2355. template<class desttype>
  2356. void connect(desttype* pclass, void (desttype::*pmemfun)(arg1_type,
  2357. arg2_type, arg3_type, arg4_type, arg5_type, arg6_type,
  2358. arg7_type, arg8_type))
  2359. {
  2360. lock_block<mt_policy> lock(this);
  2361. _connection8<desttype, arg1_type, arg2_type, arg3_type, arg4_type,
  2362. arg5_type, arg6_type, arg7_type, arg8_type, mt_policy>* conn =
  2363. new _connection8<desttype, arg1_type, arg2_type, arg3_type,
  2364. arg4_type, arg5_type, arg6_type, arg7_type,
  2365. arg8_type, mt_policy>(pclass, pmemfun);
  2366. m_connected_slots.push_back(conn);
  2367. pclass->signal_connect(this);
  2368. }
  2369. void emit(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
  2370. arg5_type a5, arg6_type a6, arg7_type a7, arg8_type a8)
  2371. {
  2372. lock_block<mt_policy> lock(this);
  2373. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  2374. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  2375. while(it != itEnd)
  2376. {
  2377. itNext = it;
  2378. ++itNext;
  2379. (*it)->emit(a1, a2, a3, a4, a5, a6, a7, a8);
  2380. it = itNext;
  2381. }
  2382. }
  2383. void operator()(arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4,
  2384. arg5_type a5, arg6_type a6, arg7_type a7, arg8_type a8)
  2385. {
  2386. lock_block<mt_policy> lock(this);
  2387. typename connections_list::const_iterator itNext, it = m_connected_slots.begin();
  2388. typename connections_list::const_iterator itEnd = m_connected_slots.end();
  2389. while(it != itEnd)
  2390. {
  2391. itNext = it;
  2392. ++itNext;
  2393. (*it)->emit(a1, a2, a3, a4, a5, a6, a7, a8);
  2394. it = itNext;
  2395. }
  2396. }
  2397. };
  2398. } // namespace sigslot
  2399. #endif // TALK_BASE_SIGSLOT_H__