Преглед изворни кода

Merge branch 'master' of http://192.168.1.10:3000/sfreundel/repos

# Conflicts:
#	CppCallbacksSignalsSlots/.vs/CppCallbacksSignalsSlots/v17/.suo
#	CppCallbacksSignalsSlots/.vs/CppCallbacksSignalsSlots/v17/Browse.VC.db
#	CppCallbacksSignalsSlots/.vs/CppCallbacksSignalsSlots/v17/DocumentLayout.backup.json
#	CppCallbacksSignalsSlots/.vs/CppCallbacksSignalsSlots/v17/DocumentLayout.json
#	CppCallbacksSignalsSlots/CppCallbacksSignalsSlots.sln
#	CppCallbacksSignalsSlots/CppCallbacksSignalsSlots/CppCallbacksSignalsSlots.vcxproj
#	CppCallbacksSignalsSlots/CppCallbacksSignalsSlots/CppCallbacksSignalsSlots.vcxproj.filters
#	CppCallbacksSignalsSlots/CppCallbacksSignalsSlots/x64/Debug/CppCallbacksSignalsSlots.exe.recipe
#	CppCallbacksSignalsSlots/CppCallbacksSignalsSlots/x64/Debug/CppCallbacksSignalsSlots.ilk
#	CppCallbacksSignalsSlots/CppCallbacksSignalsSlots/x64/Debug/CppCallbacksSignalsSlots.log
#	CppCallbacksSignalsSlots/CppCallbacksSignalsSlots/x64/Debug/vc143.idb
#	CppCallbacksSignalsSlots/CppCallbacksSignalsSlots/x64/Debug/vc143.pdb
#	CppCallbacksSignalsSlots/x64/Debug/CppCallbacksSignalsSlots.exe
#	CppCallbacksSignalsSlots/x64/Debug/CppCallbacksSignalsSlots.pdb
sfxsfl пре 8 месеци
родитељ
комит
e77789c907
100 измењених фајлова са 6869 додато и 0 уклоњено
  1. BIN
      C++ Delegates/.vs/C++ Delegates/CopilotIndices/17.13.444.19527/CodeChunks.db
  2. BIN
      C++ Delegates/.vs/C++ Delegates/CopilotIndices/17.13.444.19527/SemanticSymbols.db
  3. BIN
      C++ Delegates/.vs/C++ Delegates/FileContentIndex/399ef409-ffca-4c12-988f-2fdcdaa79d2d.vsidx
  4. BIN
      C++ Delegates/.vs/C++ Delegates/FileContentIndex/41d0a9b3-cfc7-4230-8770-6a327e36cf3f.vsidx
  5. BIN
      C++ Delegates/.vs/C++ Delegates/FileContentIndex/9bf9b4e7-1072-42aa-8d45-c0e86b76686f.vsidx
  6. BIN
      C++ Delegates/.vs/C++ Delegates/FileContentIndex/f0fa8187-db91-4c1b-89c1-03d9628bb73b.vsidx
  7. BIN
      C++ Delegates/.vs/C++ Delegates/v17/.suo
  8. BIN
      C++ Delegates/.vs/C++ Delegates/v17/Browse.VC.db
  9. 85 0
      C++ Delegates/.vs/C++ Delegates/v17/DocumentLayout.backup.json
  10. 85 0
      C++ Delegates/.vs/C++ Delegates/v17/DocumentLayout.json
  11. BIN
      C++ Delegates/.vs/C++ Delegates/v17/Solution.VC.db
  12. BIN
      C++ Delegates/.vs/C++ Delegates/v17/ipch/AutoPCH/b6f016fb77fb621d/C++ DELEGATES.ipch
  13. BIN
      C++ Delegates/.vs/C++ Delegates/v17/ipch/AutoPCH/e064f645ab091e75/MAIN.ipch
  14. 31 0
      C++ Delegates/C++ Delegates.sln
  15. 20 0
      C++ Delegates/C++ Delegates/C++ Delegates.cpp
  16. 139 0
      C++ Delegates/C++ Delegates/C++ Delegates.vcxproj
  17. 30 0
      C++ Delegates/C++ Delegates/C++ Delegates.vcxproj.filters
  18. 4 0
      C++ Delegates/C++ Delegates/C++ Delegates.vcxproj.user
  19. 2323 0
      C++ Delegates/C++ Delegates/FastDelegate.h
  20. 241 0
      C++ Delegates/C++ Delegates/FastDelegateBind.h
  21. BIN
      C++ Delegates/C++ Delegates/fastdelegate_hopter.zip
  22. BIN
      C++ Delegates/C++ Delegates/fastdelegate_src.zip
  23. 186 0
      C++ Delegates/C++ Delegates/main.cpp
  24. 11 0
      C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.exe.recipe
  25. BIN
      C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.ilk
  26. 2 0
      C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.log
  27. BIN
      C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.obj
  28. 2 0
      C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.tlog/C++ Delegates.lastbuildstate
  29. BIN
      C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.tlog/CL.command.1.tlog
  30. BIN
      C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.tlog/CL.read.1.tlog
  31. BIN
      C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.tlog/CL.write.1.tlog
  32. 1 0
      C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.tlog/Cl.items.tlog
  33. BIN
      C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.tlog/link.command.1.tlog
  34. BIN
      C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.tlog/link.read.1.tlog
  35. 2 0
      C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.tlog/link.secondary.1.tlog
  36. BIN
      C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.tlog/link.write.1.tlog
  37. BIN
      C++ Delegates/C++ Delegates/x64/Debug/main.obj
  38. BIN
      C++ Delegates/C++ Delegates/x64/Debug/vc143.idb
  39. BIN
      C++ Delegates/C++ Delegates/x64/Debug/vc143.pdb
  40. BIN
      C++ Delegates/x64/Debug/C++ Delegates.exe
  41. BIN
      C++ Delegates/x64/Debug/C++ Delegates.pdb
  42. BIN
      CPP-Signal-Bus/.vs/CPP-Signal-Bus/FileContentIndex/c7e0473a-c3da-4659-9d2a-def3aa0d8bd1.vsidx
  43. BIN
      CPP-Signal-Bus/.vs/CPP-Signal-Bus/FileContentIndex/c9b88735-7e49-4762-8d0c-620311cca80f.vsidx
  44. BIN
      CPP-Signal-Bus/.vs/CPP-Signal-Bus/FileContentIndex/edbaba08-cb9d-4978-92f6-71e9134bb372.vsidx
  45. BIN
      CPP-Signal-Bus/.vs/CPP-Signal-Bus/FileContentIndex/fae28d0f-60a2-43bc-952d-ca6ba1575d7e.vsidx
  46. BIN
      CPP-Signal-Bus/.vs/CPP-Signal-Bus/v17/.suo
  47. BIN
      CPP-Signal-Bus/.vs/CPP-Signal-Bus/v17/Browse.VC.db
  48. 173 0
      CPP-Signal-Bus/.vs/CPP-Signal-Bus/v17/DocumentLayout.backup.json
  49. 173 0
      CPP-Signal-Bus/.vs/CPP-Signal-Bus/v17/DocumentLayout.json
  50. BIN
      CPP-Signal-Bus/.vs/CPP-Signal-Bus/v17/ipch/AutoPCH/3cfdd7f574f50aea/MYHELPER.ipch
  51. BIN
      CPP-Signal-Bus/.vs/CPP-Signal-Bus/v17/ipch/AutoPCH/886d547eae9944c3/CPP-SIGNAL-BUS.ipch
  52. 31 0
      CPP-Signal-Bus/CPP-Signal-Bus.sln
  53. 229 0
      CPP-Signal-Bus/CPP-Signal-Bus/ActionManager.cpp
  54. 86 0
      CPP-Signal-Bus/CPP-Signal-Bus/ActionManager.h
  55. 229 0
      CPP-Signal-Bus/CPP-Signal-Bus/ActionManager/ActionManager.cpp
  56. 86 0
      CPP-Signal-Bus/CPP-Signal-Bus/ActionManager/ActionManager.h
  57. 189 0
      CPP-Signal-Bus/CPP-Signal-Bus/ActionManager/ActionRequest.cpp
  58. 130 0
      CPP-Signal-Bus/CPP-Signal-Bus/ActionManager/ActionRequest.h
  59. 76 0
      CPP-Signal-Bus/CPP-Signal-Bus/ActionManager/ActionResult.cpp
  60. 67 0
      CPP-Signal-Bus/CPP-Signal-Bus/ActionManager/ActionResult.h
  61. 189 0
      CPP-Signal-Bus/CPP-Signal-Bus/ActionRequest.cpp
  62. 130 0
      CPP-Signal-Bus/CPP-Signal-Bus/ActionRequest.h
  63. 76 0
      CPP-Signal-Bus/CPP-Signal-Bus/ActionResult.cpp
  64. 67 0
      CPP-Signal-Bus/CPP-Signal-Bus/ActionResult.h
  65. 154 0
      CPP-Signal-Bus/CPP-Signal-Bus/CPP-Signal-Bus.vcxproj
  66. 75 0
      CPP-Signal-Bus/CPP-Signal-Bus/CPP-Signal-Bus.vcxproj.filters
  67. 4 0
      CPP-Signal-Bus/CPP-Signal-Bus/CPP-Signal-Bus.vcxproj.user
  68. 41 0
      CPP-Signal-Bus/CPP-Signal-Bus/ObjectSignalBus.cpp
  69. 40 0
      CPP-Signal-Bus/CPP-Signal-Bus/ObjectSignalBus.h
  70. 31 0
      CPP-Signal-Bus/CPP-Signal-Bus/ObjectSignalEvent.cpp
  71. 38 0
      CPP-Signal-Bus/CPP-Signal-Bus/ObjectSignalEvent.h
  72. 62 0
      CPP-Signal-Bus/CPP-Signal-Bus/SignalBus.cpp
  73. 45 0
      CPP-Signal-Bus/CPP-Signal-Bus/SignalBus.h
  74. 39 0
      CPP-Signal-Bus/CPP-Signal-Bus/SignalEvent.cpp
  75. 52 0
      CPP-Signal-Bus/CPP-Signal-Bus/SignalEvent.h
  76. 41 0
      CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler.cpp
  77. 54 0
      CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler.h
  78. 41 0
      CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/ObjectSignalBus.cpp
  79. 40 0
      CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/ObjectSignalBus.h
  80. 31 0
      CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/ObjectSignalEvent.cpp
  81. 38 0
      CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/ObjectSignalEvent.h
  82. 62 0
      CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/SignalBus.cpp
  83. 45 0
      CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/SignalBus.h
  84. 39 0
      CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/SignalEvent.cpp
  85. 52 0
      CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/SignalEvent.h
  86. 41 0
      CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/SignalHandler.cpp
  87. 54 0
      CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/SignalHandler.h
  88. 128 0
      CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/main.cpp
  89. 416 0
      CPP-Signal-Bus/CPP-Signal-Bus/main.cpp
  90. 99 0
      CPP-Signal-Bus/CPP-Signal-Bus/myHelper.cpp
  91. BIN
      CPP-Signal-Bus/CPP-Signal-Bus/x64/Debug/ActionManager.obj
  92. BIN
      CPP-Signal-Bus/CPP-Signal-Bus/x64/Debug/ActionRequest.obj
  93. BIN
      CPP-Signal-Bus/CPP-Signal-Bus/x64/Debug/ActionResult.obj
  94. 11 0
      CPP-Signal-Bus/CPP-Signal-Bus/x64/Debug/CPP-Signal-Bus.exe.recipe
  95. BIN
      CPP-Signal-Bus/CPP-Signal-Bus/x64/Debug/CPP-Signal-Bus.ilk
  96. 3 0
      CPP-Signal-Bus/CPP-Signal-Bus/x64/Debug/CPP-Signal-Bus.log
  97. BIN
      CPP-Signal-Bus/CPP-Signal-Bus/x64/Debug/CPP-Signal-Bus.obj
  98. BIN
      CPP-Signal-Bus/CPP-Signal-Bus/x64/Debug/CPP-Signal-Bus.tlog/CL.command.1.tlog
  99. BIN
      CPP-Signal-Bus/CPP-Signal-Bus/x64/Debug/CPP-Signal-Bus.tlog/CL.read.1.tlog
  100. BIN
      CPP-Signal-Bus/CPP-Signal-Bus/x64/Debug/CPP-Signal-Bus.tlog/CL.write.1.tlog

BIN
C++ Delegates/.vs/C++ Delegates/CopilotIndices/17.13.444.19527/CodeChunks.db


BIN
C++ Delegates/.vs/C++ Delegates/CopilotIndices/17.13.444.19527/SemanticSymbols.db


BIN
C++ Delegates/.vs/C++ Delegates/FileContentIndex/399ef409-ffca-4c12-988f-2fdcdaa79d2d.vsidx


BIN
C++ Delegates/.vs/C++ Delegates/FileContentIndex/41d0a9b3-cfc7-4230-8770-6a327e36cf3f.vsidx


BIN
C++ Delegates/.vs/C++ Delegates/FileContentIndex/9bf9b4e7-1072-42aa-8d45-c0e86b76686f.vsidx


BIN
C++ Delegates/.vs/C++ Delegates/FileContentIndex/f0fa8187-db91-4c1b-89c1-03d9628bb73b.vsidx


BIN
C++ Delegates/.vs/C++ Delegates/v17/.suo


BIN
C++ Delegates/.vs/C++ Delegates/v17/Browse.VC.db


+ 85 - 0
C++ Delegates/.vs/C++ Delegates/v17/DocumentLayout.backup.json

@@ -0,0 +1,85 @@
+{
+  "Version": 1,
+  "WorkspaceRootPath": "C:\\Users\\sfreunde\\source\\repos\\C\u002B\u002B Delegates\\",
+  "Documents": [
+    {
+      "AbsoluteMoniker": "D:0:0:{F5BC104A-7115-4833-9722-2AA569F3BB8F}|C\u002B\u002B Delegates\\C\u002B\u002B Delegates.vcxproj|C:\\Users\\sfreunde\\source\\repos\\C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{F5BC104A-7115-4833-9722-2AA569F3BB8F}|C\u002B\u002B Delegates\\C\u002B\u002B Delegates.vcxproj|solutionrelative:C\u002B\u002B Delegates\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\sfreunde\\source\\repos\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\FastDelegateBind.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\sfreunde\\source\\repos\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\FastDelegate.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\sfreunde\\source\\repos\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    }
+  ],
+  "DocumentGroupContainers": [
+    {
+      "Orientation": 0,
+      "VerticalTabListWidth": 256,
+      "DocumentGroups": [
+        {
+          "DockedWidth": 205,
+          "SelectedChildIndex": 0,
+          "Children": [
+            {
+              "$type": "Document",
+              "DocumentIndex": 0,
+              "Title": "main.cpp",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\main.cpp",
+              "RelativeDocumentMoniker": "C\u002B\u002B Delegates\\main.cpp",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\main.cpp",
+              "RelativeToolTip": "C\u002B\u002B Delegates\\main.cpp",
+              "ViewState": "AgIAAGkAAAAAAAAAAAAAAH8AAAAAAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
+              "WhenOpened": "2025-05-05T16:36:40.713Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 1,
+              "Title": "FastDelegateBind.h",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\FastDelegateBind.h",
+              "RelativeDocumentMoniker": "..\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\FastDelegateBind.h",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\FastDelegateBind.h",
+              "RelativeToolTip": "..\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\FastDelegateBind.h",
+              "ViewState": "AgIAACQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
+              "WhenOpened": "2025-05-05T16:34:35.978Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 2,
+              "Title": "FastDelegate.h",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\FastDelegate.h",
+              "RelativeDocumentMoniker": "..\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\FastDelegate.h",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\FastDelegate.h",
+              "RelativeToolTip": "..\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\FastDelegate.h",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
+              "WhenOpened": "2025-05-05T16:33:42.17Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 3,
+              "Title": "main.cpp",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\main.cpp",
+              "RelativeDocumentMoniker": "..\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\main.cpp",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\main.cpp",
+              "RelativeToolTip": "..\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\main.cpp",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
+              "WhenOpened": "2025-05-05T16:33:42.014Z",
+              "EditorCaption": ""
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}

+ 85 - 0
C++ Delegates/.vs/C++ Delegates/v17/DocumentLayout.json

@@ -0,0 +1,85 @@
+{
+  "Version": 1,
+  "WorkspaceRootPath": "C:\\Users\\sfreunde\\source\\repos\\C\u002B\u002B Delegates\\",
+  "Documents": [
+    {
+      "AbsoluteMoniker": "D:0:0:{F5BC104A-7115-4833-9722-2AA569F3BB8F}|C\u002B\u002B Delegates\\C\u002B\u002B Delegates.vcxproj|C:\\Users\\sfreunde\\source\\repos\\C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{F5BC104A-7115-4833-9722-2AA569F3BB8F}|C\u002B\u002B Delegates\\C\u002B\u002B Delegates.vcxproj|solutionrelative:C\u002B\u002B Delegates\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\sfreunde\\source\\repos\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\FastDelegateBind.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\sfreunde\\source\\repos\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\FastDelegate.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\sfreunde\\source\\repos\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    }
+  ],
+  "DocumentGroupContainers": [
+    {
+      "Orientation": 0,
+      "VerticalTabListWidth": 256,
+      "DocumentGroups": [
+        {
+          "DockedWidth": 205,
+          "SelectedChildIndex": 0,
+          "Children": [
+            {
+              "$type": "Document",
+              "DocumentIndex": 0,
+              "Title": "main.cpp",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\main.cpp",
+              "RelativeDocumentMoniker": "C\u002B\u002B Delegates\\main.cpp",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\main.cpp",
+              "RelativeToolTip": "C\u002B\u002B Delegates\\main.cpp",
+              "ViewState": "AgIAAAEAAAAAAAAAAAAewBcAAAAXAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
+              "WhenOpened": "2025-05-05T16:36:40.713Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 1,
+              "Title": "FastDelegateBind.h",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\FastDelegateBind.h",
+              "RelativeDocumentMoniker": "..\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\FastDelegateBind.h",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\FastDelegateBind.h",
+              "RelativeToolTip": "..\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\FastDelegateBind.h",
+              "ViewState": "AgIAACQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
+              "WhenOpened": "2025-05-05T16:34:35.978Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 2,
+              "Title": "FastDelegate.h",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\FastDelegate.h",
+              "RelativeDocumentMoniker": "..\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\FastDelegate.h",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\FastDelegate.h",
+              "RelativeToolTip": "..\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\FastDelegate.h",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
+              "WhenOpened": "2025-05-05T16:33:42.17Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 3,
+              "Title": "main.cpp",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\main.cpp",
+              "RelativeDocumentMoniker": "..\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\main.cpp",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\main.cpp",
+              "RelativeToolTip": "..\\Old C\u002B\u002B Delegates\\C\u002B\u002B Delegates\\main.cpp",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
+              "WhenOpened": "2025-05-05T16:33:42.014Z",
+              "EditorCaption": ""
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}

BIN
C++ Delegates/.vs/C++ Delegates/v17/Solution.VC.db


BIN
C++ Delegates/.vs/C++ Delegates/v17/ipch/AutoPCH/b6f016fb77fb621d/C++ DELEGATES.ipch


BIN
C++ Delegates/.vs/C++ Delegates/v17/ipch/AutoPCH/e064f645ab091e75/MAIN.ipch


+ 31 - 0
C++ Delegates/C++ Delegates.sln

@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.13.35931.197 d17.13
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "C++ Delegates", "C++ Delegates\C++ Delegates.vcxproj", "{F5BC104A-7115-4833-9722-2AA569F3BB8F}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x64 = Debug|x64
+		Debug|x86 = Debug|x86
+		Release|x64 = Release|x64
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{F5BC104A-7115-4833-9722-2AA569F3BB8F}.Debug|x64.ActiveCfg = Debug|x64
+		{F5BC104A-7115-4833-9722-2AA569F3BB8F}.Debug|x64.Build.0 = Debug|x64
+		{F5BC104A-7115-4833-9722-2AA569F3BB8F}.Debug|x86.ActiveCfg = Debug|Win32
+		{F5BC104A-7115-4833-9722-2AA569F3BB8F}.Debug|x86.Build.0 = Debug|Win32
+		{F5BC104A-7115-4833-9722-2AA569F3BB8F}.Release|x64.ActiveCfg = Release|x64
+		{F5BC104A-7115-4833-9722-2AA569F3BB8F}.Release|x64.Build.0 = Release|x64
+		{F5BC104A-7115-4833-9722-2AA569F3BB8F}.Release|x86.ActiveCfg = Release|Win32
+		{F5BC104A-7115-4833-9722-2AA569F3BB8F}.Release|x86.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {EB6FB6B4-1D4F-4700-8888-21B529596A48}
+	EndGlobalSection
+EndGlobal

+ 20 - 0
C++ Delegates/C++ Delegates/C++ Delegates.cpp

@@ -0,0 +1,20 @@
+// C++ Delegates.cpp : This file contains the 'main' function. Program execution begins and ends there.
+//
+
+#include <iostream>
+
+int main()
+{
+    std::cout << "Hello World!\n";
+}
+
+// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
+// Debug program: F5 or Debug > Start Debugging menu
+
+// Tips for Getting Started: 
+//   1. Use the Solution Explorer window to add/manage files
+//   2. Use the Team Explorer window to connect to source control
+//   3. Use the Output window to see build output and other messages
+//   4. Use the Error List window to view errors
+//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
+//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file

+ 139 - 0
C++ Delegates/C++ Delegates/C++ Delegates.vcxproj

@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <VCProjectVersion>17.0</VCProjectVersion>
+    <Keyword>Win32Proj</Keyword>
+    <ProjectGuid>{f5bc104a-7115-4833-9722-2aa569f3bb8f}</ProjectGuid>
+    <RootNamespace>CDelegates</RootNamespace>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="main.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="FastDelegate.h" />
+    <ClInclude Include="FastDelegateBind.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 30 - 0
C++ Delegates/C++ Delegates/C++ Delegates.vcxproj.filters

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
+    </Filter>
+    <Filter Include="Resource Files">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="main.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="FastDelegateBind.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="FastDelegate.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>

+ 4 - 0
C++ Delegates/C++ Delegates/C++ Delegates.vcxproj.user

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup />
+</Project>

+ 2323 - 0
C++ Delegates/C++ Delegates/FastDelegate.h

@@ -0,0 +1,2323 @@
+#pragma once
+//						FastDelegate.h 
+//	Efficient delegates in C++ that generate only two lines of asm code!
+//  Documentation is found at http://www.codeproject.com/cpp/FastDelegate.asp
+//
+//						- Don Clugston, Mar 2004.
+//		Major contributions were made by Jody Hagins.
+// History:
+// 24-Apr-04 1.0  * Submitted to CodeProject. 
+// 28-Apr-04 1.1  * Prevent most unsafe uses of evil static function hack.
+//				  * Improved syntax for horrible_cast (thanks Paul Bludov).
+//				  * Tested on Metrowerks MWCC and Intel ICL (IA32)
+//				  * Compiled, but not run, on Comeau C++ and Intel Itanium ICL.
+//	27-Jun-04 1.2 * Now works on Borland C++ Builder 5.5
+//				  * Now works on /clr "managed C++" code on VC7, VC7.1
+//				  * Comeau C++ now compiles without warnings.
+//				  * Prevent the virtual inheritance case from being used on 
+//					  VC6 and earlier, which generate incorrect code.
+//				  * Improved warning and error messages. Non-standard hacks
+//					 now have compile-time checks to make them safer.
+//				  * implicit_cast used instead of static_cast in many cases.
+//				  * If calling a const member function, a const class pointer can be used.
+//				  * MakeDelegate() global helper function added to simplify pass-by-value.
+//				  * Added fastdelegate.clear()
+// 16-Jul-04 1.2.1* Workaround for gcc bug (const member function pointers in templates)
+// 30-Oct-04 1.3  * Support for (non-void) return values.
+//				  * No more workarounds in client code!
+//					 MSVC and Intel now use a clever hack invented by John Dlugosz:
+//				     - The FASTDELEGATEDECLARE workaround is no longer necessary.
+//					 - No more warning messages for VC6
+//				  * Less use of macros. Error messages should be more comprehensible.
+//				  * Added include guards
+//				  * Added FastDelegate::empty() to test if invocation is safe (Thanks Neville Franks).
+//				  * Now tested on VS 2005 Express Beta, PGI C++
+// 24-Dec-04 1.4  * Added DelegateMemento, to allow collections of disparate delegates.
+//                * <,>,<=,>= comparison operators to allow storage in ordered containers.
+//				  * Substantial reduction of code size, especially the 'Closure' class.
+//				  * Standardised all the compiler-specific workarounds.
+//                * MFP conversion now works for CodePlay (but not yet supported in the full code).
+//                * Now compiles without warnings on _any_ supported compiler, including BCC 5.5.1
+//				  * New syntax: FastDelegate< int (char *, double) >. 
+// 14-Feb-05 1.4.1* Now treats =0 as equivalent to .clear(), ==0 as equivalent to .empty(). (Thanks elfric).
+//				  * Now tested on Intel ICL for AMD64, VS2005 Beta for AMD64 and Itanium.
+// 30-Mar-05 1.5  * Safebool idiom: "if (dg)" is now equivalent to "if (!dg.empty())"
+//				  * Fully supported by CodePlay VectorC
+//                * Bugfix for Metrowerks: empty() was buggy because a valid MFP can be 0 on MWCC!
+//                * More optimal assignment,== and != operators for static function pointers.
+
+#ifndef FASTDELEGATE_H
+#define FASTDELEGATE_H
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include <memory.h> // to allow <,> comparisons
+
+////////////////////////////////////////////////////////////////////////////////
+//						Configuration options
+//
+////////////////////////////////////////////////////////////////////////////////
+
+// Uncomment the following #define for optimally-sized delegates.
+// In this case, the generated asm code is almost identical to the code you'd get
+// if the compiler had native support for delegates.
+// It will not work on systems where sizeof(dataptr) < sizeof(codeptr). 
+// Thus, it will not work for DOS compilers using the medium model.
+// It will also probably fail on some DSP systems.
+#define FASTDELEGATE_USESTATICFUNCTIONHACK
+
+// Uncomment the next line to allow function declarator syntax.
+// It is automatically enabled for those compilers where it is known to work.
+//#define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
+
+////////////////////////////////////////////////////////////////////////////////
+//						Compiler identification for workarounds
+//
+////////////////////////////////////////////////////////////////////////////////
+
+// Compiler identification. It's not easy to identify Visual C++ because
+// many vendors fraudulently define Microsoft's identifiers.
+#if defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__VECTOR_C) && !defined(__ICL) && !defined(__BORLANDC__)
+#define FASTDLGT_ISMSVC
+
+#if (_MSC_VER <1300) // Many workarounds are required for VC6.
+#define FASTDLGT_VC6
+#pragma warning(disable:4786) // disable this ridiculous warning
+#endif
+
+#endif
+
+// Does the compiler uses Microsoft's member function pointer structure?
+// If so, it needs special treatment.
+// Metrowerks CodeWarrior, Intel, and CodePlay fraudulently define Microsoft's 
+// identifier, _MSC_VER. We need to filter Metrowerks out.
+#if defined(_MSC_VER) && !defined(__MWERKS__)
+#define FASTDLGT_MICROSOFT_MFP
+
+#if !defined(__VECTOR_C)
+// CodePlay doesn't have the __single/multi/virtual_inheritance keywords
+#define FASTDLGT_HASINHERITANCE_KEYWORDS
+#endif
+#endif
+
+// Does it allow function declarator syntax? The following compilers are known to work:
+#if defined(FASTDLGT_ISMSVC) && (_MSC_VER >=1310) // VC 7.1
+#define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
+#endif
+
+// Gcc(2.95+), and versions of Digital Mars, Intel and Comeau in common use.
+#if defined (__DMC__) || defined(__GNUC__) || defined(__ICL) || defined(__COMO__)
+#define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
+#endif
+
+// It works on Metrowerks MWCC 3.2.2. From boost.Config it should work on earlier ones too.
+#if defined (__MWERKS__)
+#define FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
+#endif
+
+#ifdef __GNUC__ // Workaround GCC bug #8271 
+	// At present, GCC doesn't recognize constness of MFPs in templates
+#define FASTDELEGATE_GCC_BUG_8271
+#endif
+
+
+
+////////////////////////////////////////////////////////////////////////////////
+//						General tricks used in this code
+//
+// (a) Error messages are generated by typdefing an array of negative size to
+//     generate compile-time errors.
+// (b) Warning messages on MSVC are generated by declaring unused variables, and
+//	    enabling the "variable XXX is never used" warning.
+// (c) Unions are used in a few compiler-specific cases to perform illegal casts.
+// (d) For Microsoft and Intel, when adjusting the 'this' pointer, it's cast to
+//     (char *) first to ensure that the correct number of *bytes* are added.
+//
+////////////////////////////////////////////////////////////////////////////////
+//						Helper templates
+//
+////////////////////////////////////////////////////////////////////////////////
+
+
+namespace fastdelegate {
+	namespace detail {	// we'll hide the implementation details in a nested namespace.
+
+		//		implicit_cast< >
+		// I believe this was originally going to be in the C++ standard but 
+		// was left out by accident. It's even milder than static_cast.
+		// I use it instead of static_cast<> to emphasize that I'm not doing
+		// anything nasty. 
+		// Usage is identical to static_cast<>
+		template <class OutputClass, class InputClass>
+		inline OutputClass implicit_cast(InputClass input) {
+			return input;
+		}
+
+		//		horrible_cast< >
+		// This is truly evil. It completely subverts C++'s type system, allowing you 
+		// to cast from any class to any other class. Technically, using a union 
+		// to perform the cast is undefined behaviour (even in C). But we can see if
+		// it is OK by checking that the union is the same size as each of its members.
+		// horrible_cast<> should only be used for compiler-specific workarounds. 
+		// Usage is identical to reinterpret_cast<>.
+
+		// This union is declared outside the horrible_cast because BCC 5.5.1
+		// can't inline a function with a nested class, and gives a warning.
+		template <class OutputClass, class InputClass>
+		union horrible_union {
+			OutputClass out;
+			InputClass in;
+		};
+
+		template <class OutputClass, class InputClass>
+		inline OutputClass horrible_cast(const InputClass input) {
+			horrible_union<OutputClass, InputClass> u;
+			// Cause a compile-time error if in, out and u are not the same size.
+			// If the compile fails here, it means the compiler has peculiar
+			// unions which would prevent the cast from working.
+			typedef int ERROR_CantUseHorrible_cast[sizeof(InputClass) == sizeof(u)
+				&& sizeof(InputClass) == sizeof(OutputClass) ? 1 : -1];
+			u.in = input;
+			return u.out;
+		}
+
+		////////////////////////////////////////////////////////////////////////////////
+		//						Workarounds
+		//
+		////////////////////////////////////////////////////////////////////////////////
+
+		// Backwards compatibility: This macro used to be necessary in the virtual inheritance
+		// case for Intel and Microsoft. Now it just forward-declares the class.
+#define FASTDELEGATEDECLARE(CLASSNAME)	class CLASSNAME;
+
+// Prevent use of the static function hack with the DOS medium model.
+#ifdef __MEDIUM__
+#undef FASTDELEGATE_USESTATICFUNCTIONHACK
+#endif
+
+//			DefaultVoid - a workaround for 'void' templates in VC6.
+//
+//  (1) VC6 and earlier do not allow 'void' as a default template argument.
+//  (2) They also doesn't allow you to return 'void' from a function.
+//
+// Workaround for (1): Declare a dummy type 'DefaultVoid' which we use
+//   when we'd like to use 'void'. We convert it into 'void' and back
+//   using the templates DefaultVoidToVoid<> and VoidToDefaultVoid<>.
+// Workaround for (2): On VC6, the code for calling a void function is
+//   identical to the code for calling a non-void function in which the
+//   return value is never used, provided the return value is returned
+//   in the EAX register, rather than on the stack. 
+//   This is true for most fundamental types such as int, enum, void *.
+//   Const void * is the safest option since it doesn't participate 
+//   in any automatic conversions. But on a 16-bit compiler it might
+//   cause extra code to be generated, so we disable it for all compilers
+//   except for VC6 (and VC5).
+#ifdef FASTDLGT_VC6
+// VC6 workaround
+		typedef const void* DefaultVoid;
+#else
+// On any other compiler, just use a normal void.
+		typedef void DefaultVoid;
+#endif
+
+		// Translate from 'DefaultVoid' to 'void'.
+		// Everything else is unchanged
+		template <class T>
+		struct DefaultVoidToVoid { typedef T type; };
+
+		template <>
+		struct DefaultVoidToVoid<DefaultVoid> { typedef void type; };
+
+		// Translate from 'void' into 'DefaultVoid'
+		// Everything else is unchanged
+		template <class T>
+		struct VoidToDefaultVoid { typedef T type; };
+
+		template <>
+		struct VoidToDefaultVoid<void> { typedef DefaultVoid type; };
+
+
+
+		////////////////////////////////////////////////////////////////////////////////
+		//						Fast Delegates, part 1:
+		//
+		//		Conversion of member function pointer to a standard form
+		//
+		////////////////////////////////////////////////////////////////////////////////
+
+		// GenericClass is a fake class, ONLY used to provide a type.
+		// It is vitally important that it is never defined, so that the compiler doesn't
+		// think it can optimize the invocation. For example, Borland generates simpler
+		// code if it knows the class only uses single inheritance.
+
+		// Compilers using Microsoft's structure need to be treated as a special case.
+#ifdef  FASTDLGT_MICROSOFT_MFP
+
+#ifdef FASTDLGT_HASINHERITANCE_KEYWORDS
+	// For Microsoft and Intel, we want to ensure that it's the most efficient type of MFP 
+	// (4 bytes), even when the /vmg option is used. Declaring an empty class 
+	// would give 16 byte pointers in this case....
+		class __single_inheritance GenericClass;
+#endif
+		// ...but for Codeplay, an empty class *always* gives 4 byte pointers.
+		// If compiled with the /clr option ("managed C++"), the JIT compiler thinks
+		// it needs to load GenericClass before it can call any of its functions,
+		// (compiles OK but crashes at runtime!), so we need to declare an 
+		// empty class to make it happy.
+		// Codeplay and VC4 can't cope with the unknown_inheritance case either.
+		class GenericClass {};
+#else
+		class GenericClass;
+#endif
+
+		// The size of a single inheritance member function pointer.
+		const int SINGLE_MEMFUNCPTR_SIZE = sizeof(void (GenericClass::*)());
+
+		//						SimplifyMemFunc< >::Convert()
+		//
+		//	A template function that converts an arbitrary member function pointer into the 
+		//	simplest possible form of member function pointer, using a supplied 'this' pointer.
+		//  According to the standard, this can be done legally with reinterpret_cast<>.
+		//	For (non-standard) compilers which use member function pointers which vary in size 
+		//  depending on the class, we need to use	knowledge of the internal structure of a 
+		//  member function pointer, as used by the compiler. Template specialization is used
+		//  to distinguish between the sizes. Because some compilers don't support partial 
+		//	template specialisation, I use full specialisation of a wrapper struct.
+
+		// general case -- don't know how to convert it. Force a compile failure
+		template <int N>
+		struct SimplifyMemFunc {
+			template <class X, class XFuncType, class GenericMemFuncType>
+			inline static GenericClass* Convert(X* pthis, XFuncType function_to_bind,
+				GenericMemFuncType& bound_func) {
+				// Unsupported member function type -- force a compile failure.
+				// (it's illegal to have a array with negative size).
+				typedef char ERROR_Unsupported_member_function_pointer_on_this_compiler[N - 100];
+				return 0;
+			}
+		};
+
+		// For compilers where all member func ptrs are the same size, everything goes here.
+		// For non-standard compilers, only single_inheritance classes go here.
+		template <>
+		struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE> {
+			template <class X, class XFuncType, class GenericMemFuncType>
+			inline static GenericClass* Convert(X* pthis, XFuncType function_to_bind,
+				GenericMemFuncType& bound_func) {
+#if defined __DMC__  
+				// Digital Mars doesn't allow you to cast between abitrary PMF's, 
+				// even though the standard says you can. The 32-bit compiler lets you
+				// static_cast through an int, but the DOS compiler doesn't.
+				bound_func = horrible_cast<GenericMemFuncType>(function_to_bind);
+#else 
+				bound_func = reinterpret_cast<GenericMemFuncType>(function_to_bind);
+#endif
+				return reinterpret_cast<GenericClass*>(pthis);
+			}
+		};
+
+		////////////////////////////////////////////////////////////////////////////////
+		//						Fast Delegates, part 1b:
+		//
+		//					Workarounds for Microsoft and Intel
+		//
+		////////////////////////////////////////////////////////////////////////////////
+
+
+		// Compilers with member function pointers which violate the standard (MSVC, Intel, Codeplay),
+		// need to be treated as a special case.
+#ifdef FASTDLGT_MICROSOFT_MFP
+
+// We use unions to perform horrible_casts. I would like to use #pragma pack(push, 1)
+// at the start of each function for extra safety, but VC6 seems to ICE
+// intermittently if you do this inside a template.
+
+// __multiple_inheritance classes go here
+// Nasty hack for Microsoft and Intel (IA32 and Itanium)
+		template<>
+		struct SimplifyMemFunc< SINGLE_MEMFUNCPTR_SIZE + sizeof(int) > {
+			template <class X, class XFuncType, class GenericMemFuncType>
+			inline static GenericClass* Convert(X* pthis, XFuncType function_to_bind,
+				GenericMemFuncType& bound_func) {
+				// We need to use a horrible_cast to do this conversion.
+				// In MSVC, a multiple inheritance member pointer is internally defined as:
+				union {
+					XFuncType func;
+					struct {
+						GenericMemFuncType funcaddress; // points to the actual member function
+						int delta;	     // #BYTES to be added to the 'this' pointer
+					}s;
+				} u;
+				// Check that the horrible_cast will work
+				typedef int ERROR_CantUsehorrible_cast[sizeof(function_to_bind) == sizeof(u.s) ? 1 : -1];
+				u.func = function_to_bind;
+				bound_func = u.s.funcaddress;
+				return reinterpret_cast<GenericClass*>(reinterpret_cast<char*>(pthis) + u.s.delta);
+			}
+		};
+
+		// virtual inheritance is a real nuisance. It's inefficient and complicated.
+		// On MSVC and Intel, there isn't enough information in the pointer itself to
+		// enable conversion to a closure pointer. Earlier versions of this code didn't
+		// work for all cases, and generated a compile-time error instead.
+		// But a very clever hack invented by John M. Dlugosz solves this problem.
+		// My code is somewhat different to his: I have no asm code, and I make no 
+		// assumptions about the calling convention that is used.
+
+		// In VC++ and ICL, a virtual_inheritance member pointer 
+		// is internally defined as:
+		struct MicrosoftVirtualMFP {
+			void (GenericClass::* codeptr)(); // points to the actual member function
+			int delta;		// #bytes to be added to the 'this' pointer
+			int vtable_index; // or 0 if no virtual inheritance
+		};
+		// The CRUCIAL feature of Microsoft/Intel MFPs which we exploit is that the
+		// m_codeptr member is *always* called, regardless of the values of the other
+		// members. (This is *not* true for other compilers, eg GCC, which obtain the
+		// function address from the vtable if a virtual function is being called).
+		// Dlugosz's trick is to make the codeptr point to a probe function which
+		// returns the 'this' pointer that was used.
+
+		// Define a generic class that uses virtual inheritance.
+		// It has a trival member function that returns the value of the 'this' pointer.
+		struct GenericVirtualClass : virtual public GenericClass
+		{
+			typedef GenericVirtualClass* (GenericVirtualClass::* ProbePtrType)();
+			GenericVirtualClass* GetThis() { return this; }
+		};
+
+		// __virtual_inheritance classes go here
+		template <>
+		struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 2 * sizeof(int) >
+		{
+
+			template <class X, class XFuncType, class GenericMemFuncType>
+			inline static GenericClass* Convert(X* pthis, XFuncType function_to_bind,
+				GenericMemFuncType& bound_func) {
+				union {
+					XFuncType func;
+					GenericClass* (X::* ProbeFunc)();
+					MicrosoftVirtualMFP s;
+				} u;
+				u.func = function_to_bind;
+				bound_func = reinterpret_cast<GenericMemFuncType>(u.s.codeptr);
+				union {
+					GenericVirtualClass::ProbePtrType virtfunc;
+					MicrosoftVirtualMFP s;
+				} u2;
+				// Check that the horrible_cast<>s will work
+				typedef int ERROR_CantUsehorrible_cast[sizeof(function_to_bind) == sizeof(u.s)
+					&& sizeof(function_to_bind) == sizeof(u.ProbeFunc)
+					&& sizeof(u2.virtfunc) == sizeof(u2.s) ? 1 : -1];
+				// Unfortunately, taking the address of a MF prevents it from being inlined, so 
+				// this next line can't be completely optimised away by the compiler.
+				u2.virtfunc = &GenericVirtualClass::GetThis;
+				u.s.codeptr = u2.s.codeptr;
+				return (pthis->*u.ProbeFunc)();
+			}
+		};
+
+#if (_MSC_VER <1300)
+
+		// Nasty hack for Microsoft Visual C++ 6.0
+		// unknown_inheritance classes go here
+		// There is a compiler bug in MSVC6 which generates incorrect code in this case!!
+		template <>
+		struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 3 * sizeof(int) >
+		{
+			template <class X, class XFuncType, class GenericMemFuncType>
+			inline static GenericClass* Convert(X* pthis, XFuncType function_to_bind,
+				GenericMemFuncType& bound_func) {
+				// There is an apalling but obscure compiler bug in MSVC6 and earlier:
+				// vtable_index and 'vtordisp' are always set to 0 in the 
+				// unknown_inheritance case!
+				// This means that an incorrect function could be called!!!
+				// Compiling with the /vmg option leads to potentially incorrect code.
+				// This is probably the reason that the IDE has a user interface for specifying
+				// the /vmg option, but it is disabled -  you can only specify /vmg on 
+				// the command line. In VC1.5 and earlier, the compiler would ICE if it ever
+				// encountered this situation.
+				// It is OK to use the /vmg option if /vmm or /vms is specified.
+
+				// Fortunately, the wrong function is only called in very obscure cases.
+				// It only occurs when a derived class overrides a virtual function declared 
+				// in a virtual base class, and the member function 
+				// points to the *Derived* version of that function. The problem can be
+				// completely averted in 100% of cases by using the *Base class* for the 
+				// member fpointer. Ie, if you use the base class as an interface, you'll
+				// stay out of trouble.
+				// Occasionally, you might want to point directly to a derived class function
+				// that isn't an override of a base class. In this case, both vtable_index 
+				// and 'vtordisp' are zero, but a virtual_inheritance pointer will be generated.
+				// We can generate correct code in this case. To prevent an incorrect call from
+				// ever being made, on MSVC6 we generate a warning, and call a function to 
+				// make the program crash instantly. 
+				typedef char ERROR_VC6CompilerBug[-100];
+				return 0;
+			}
+		};
+
+
+#else 
+
+		// Nasty hack for Microsoft and Intel (IA32 and Itanium)
+		// unknown_inheritance classes go here 
+		// This is probably the ugliest bit of code I've ever written. Look at the casts!
+		// There is a compiler bug in MSVC6 which prevents it from using this code.
+		template <>
+		struct SimplifyMemFunc<SINGLE_MEMFUNCPTR_SIZE + 3 * sizeof(int) >
+		{
+			template <class X, class XFuncType, class GenericMemFuncType>
+			inline static GenericClass* Convert(X* pthis, XFuncType function_to_bind,
+				GenericMemFuncType& bound_func) {
+				// The member function pointer is 16 bytes long. We can't use a normal cast, but
+				// we can use a union to do the conversion.
+				union {
+					XFuncType func;
+					// In VC++ and ICL, an unknown_inheritance member pointer 
+					// is internally defined as:
+					struct {
+						GenericMemFuncType m_funcaddress; // points to the actual member function
+						int delta;		// #bytes to be added to the 'this' pointer
+						int vtordisp;		// #bytes to add to 'this' to find the vtable
+						int vtable_index; // or 0 if no virtual inheritance
+					} s;
+				} u;
+				// Check that the horrible_cast will work
+				typedef int ERROR_CantUsehorrible_cast[sizeof(XFuncType) == sizeof(u.s) ? 1 : -1];
+				u.func = function_to_bind;
+				bound_func = u.s.funcaddress;
+				int virtual_delta = 0;
+				if (u.s.vtable_index) { // Virtual inheritance is used
+					// First, get to the vtable. 
+					// It is 'vtordisp' bytes from the start of the class.
+					const int* vtable = *reinterpret_cast<const int* const*>(
+						reinterpret_cast<const char*>(pthis) + u.s.vtordisp);
+
+					// 'vtable_index' tells us where in the table we should be looking.
+					virtual_delta = u.s.vtordisp + *reinterpret_cast<const int*>(
+						reinterpret_cast<const char*>(vtable) + u.s.vtable_index);
+				}
+				// The int at 'virtual_delta' gives us the amount to add to 'this'.
+				// Finally we can add the three components together. Phew!
+				return reinterpret_cast<GenericClass*>(
+					reinterpret_cast<char*>(pthis) + u.s.delta + virtual_delta);
+			};
+		};
+#endif // MSVC 7 and greater
+
+#endif // MS/Intel hacks
+
+	}  // namespace detail
+
+	////////////////////////////////////////////////////////////////////////////////
+	//						Fast Delegates, part 2:
+	//
+	//	Define the delegate storage, and cope with static functions
+	//
+	////////////////////////////////////////////////////////////////////////////////
+
+	// DelegateMemento -- an opaque structure which can hold an arbitary delegate.
+	// It knows nothing about the calling convention or number of arguments used by
+	// the function pointed to.
+	// It supplies comparison operators so that it can be stored in STL collections.
+	// It cannot be set to anything other than null, nor invoked directly: 
+	//   it must be converted to a specific delegate.
+
+	// Implementation:
+	// There are two possible implementations: the Safe method and the Evil method.
+	//				DelegateMemento - Safe version
+	//
+	// This implementation is standard-compliant, but a bit tricky.
+	// A static function pointer is stored inside the class. 
+	// Here are the valid values:
+	// +-- Static pointer --+--pThis --+-- pMemFunc-+-- Meaning------+
+	// |   0				|  0       |   0        | Empty          |
+	// |   !=0              |(dontcare)|  Invoker   | Static function|
+	// |   0                |  !=0     |  !=0*      | Method call    |
+	// +--------------------+----------+------------+----------------+
+	//  * For Metrowerks, this can be 0. (first virtual function in a 
+	//       single_inheritance class).
+	// When stored stored inside a specific delegate, the 'dontcare' entries are replaced
+	// with a reference to the delegate itself. This complicates the = and == operators
+	// for the delegate class.
+
+	//				DelegateMemento - Evil version
+	//
+	// For compilers where data pointers are at least as big as code pointers, it is 
+	// possible to store the function pointer in the this pointer, using another 
+	// horrible_cast. In this case the DelegateMemento implementation is simple:
+	// +--pThis --+-- pMemFunc-+-- Meaning---------------------+
+	// |    0     |  0         | Empty                         |
+	// |  !=0     |  !=0*      | Static function or method call|
+	// +----------+------------+-------------------------------+
+	//  * For Metrowerks, this can be 0. (first virtual function in a 
+	//       single_inheritance class).
+	// Note that the Sun C++ and MSVC documentation explicitly state that they 
+	// support static_cast between void * and function pointers.
+
+	class DelegateMemento {
+	protected:
+		// the data is protected, not private, because many
+		// compilers have problems with template friends.
+		typedef void (detail::GenericClass::* GenericMemFuncType)(); // arbitrary MFP.
+		detail::GenericClass* m_pthis;
+		GenericMemFuncType m_pFunction;
+
+#if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
+		typedef void (*GenericFuncPtr)(); // arbitrary code pointer
+		GenericFuncPtr m_pStaticFunction;
+#endif
+
+	public:
+#if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
+		DelegateMemento() : m_pthis(0), m_pFunction(0), m_pStaticFunction(0) {};
+		void clear() {
+			m_pthis = 0; m_pFunction = 0; m_pStaticFunction = 0;
+		}
+#else
+		DelegateMemento() : m_pthis(0), m_pFunction(0) {};
+		void clear() { m_pthis = 0; m_pFunction = 0; }
+#endif
+	public:
+#if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
+		inline bool IsEqual(const DelegateMemento& x) const {
+			// We have to cope with the static function pointers as a special case
+			if (m_pFunction != x.m_pFunction) return false;
+			// the static function ptrs must either both be equal, or both be 0.
+			if (m_pStaticFunction != x.m_pStaticFunction) return false;
+			if (m_pStaticFunction != 0) return m_pthis == x.m_pthis;
+			else return true;
+		}
+#else // Evil Method
+		inline bool IsEqual(const DelegateMemento& x) const {
+			return m_pthis == x.m_pthis && m_pFunction == x.m_pFunction;
+		}
+#endif
+		// Provide a strict weak ordering for DelegateMementos.
+		inline bool IsLess(const DelegateMemento& right) const {
+			// deal with static function pointers first
+#if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
+			if (m_pStaticFunction != 0 || right.m_pStaticFunction != 0)
+				return m_pStaticFunction < right.m_pStaticFunction;
+#endif
+			if (m_pthis != right.m_pthis) return m_pthis < right.m_pthis;
+			// There are no ordering operators for member function pointers, 
+			// but we can fake one by comparing each byte. The resulting ordering is
+			// arbitrary (and compiler-dependent), but it permits storage in ordered STL containers.
+			return memcmp(&m_pFunction, &right.m_pFunction, sizeof(m_pFunction)) < 0;
+
+		}
+		// BUGFIX (Mar 2005):
+		// We can't just compare m_pFunction because on Metrowerks,
+		// m_pFunction can be zero even if the delegate is not empty!
+		inline bool operator ! () const		// Is it bound to anything?
+		{
+			return m_pthis == 0 && m_pFunction == 0;
+		}
+		inline bool empty() const		// Is it bound to anything?
+		{
+			return m_pthis == 0 && m_pFunction == 0;
+		}
+	public:
+		DelegateMemento& operator = (const DelegateMemento& right) {
+			SetMementoFrom(right);
+			return *this;
+		}
+		inline bool operator <(const DelegateMemento& right) {
+			return IsLess(right);
+		}
+		inline bool operator >(const DelegateMemento& right) {
+			return right.IsLess(*this);
+		}
+		DelegateMemento(const DelegateMemento& right) :
+			m_pFunction(right.m_pFunction), m_pthis(right.m_pthis)
+#if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
+			, m_pStaticFunction(right.m_pStaticFunction)
+#endif
+		{
+		}
+	protected:
+		void SetMementoFrom(const DelegateMemento& right) {
+			m_pFunction = right.m_pFunction;
+			m_pthis = right.m_pthis;
+#if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
+			m_pStaticFunction = right.m_pStaticFunction;
+#endif
+		}
+	};
+
+
+	//						ClosurePtr<>
+	//
+	// A private wrapper class that adds function signatures to DelegateMemento.
+	// It's the class that does most of the actual work.
+	// The signatures are specified by:
+	// GenericMemFunc: must be a type of GenericClass member function pointer. 
+	// StaticFuncPtr:  must be a type of function pointer with the same signature 
+	//                 as GenericMemFunc.
+	// UnvoidStaticFuncPtr: is the same as StaticFuncPtr, except on VC6
+	//                 where it never returns void (returns DefaultVoid instead).
+
+	// An outer class, FastDelegateN<>, handles the invoking and creates the
+	// necessary typedefs.
+	// This class does everything else.
+
+	namespace detail {
+
+		template < class GenericMemFunc, class StaticFuncPtr, class UnvoidStaticFuncPtr>
+		class ClosurePtr : public DelegateMemento {
+		public:
+			// These functions are for setting the delegate to a member function.
+
+			// Here's the clever bit: we convert an arbitrary member function into a 
+			// standard form. XMemFunc should be a member function of class X, but I can't 
+			// enforce that here. It needs to be enforced by the wrapper class.
+			template < class X, class XMemFunc >
+			inline void bindmemfunc(X* pthis, XMemFunc function_to_bind) {
+				m_pthis = SimplifyMemFunc< sizeof(function_to_bind) >
+					::Convert(pthis, function_to_bind, m_pFunction);
+#if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
+				m_pStaticFunction = 0;
+#endif
+			}
+			// For const member functions, we only need a const class pointer.
+			// Since we know that the member function is const, it's safe to 
+			// remove the const qualifier from the 'this' pointer with a const_cast.
+			// VC6 has problems if we just overload 'bindmemfunc', so we give it a different name.
+			template < class X, class XMemFunc>
+			inline void bindconstmemfunc(const X* pthis, XMemFunc function_to_bind) {
+				m_pthis = SimplifyMemFunc< sizeof(function_to_bind) >
+					::Convert(const_cast<X*>(pthis), function_to_bind, m_pFunction);
+#if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
+				m_pStaticFunction = 0;
+#endif
+			}
+#ifdef FASTDELEGATE_GCC_BUG_8271	// At present, GCC doesn't recognize constness of MFPs in templates
+			template < class X, class XMemFunc>
+			inline void bindmemfunc(const X* pthis, XMemFunc function_to_bind) {
+				bindconstmemfunc(pthis, function_to_bind);
+#if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
+				m_pStaticFunction = 0;
+#endif
+			}
+#endif
+			// These functions are required for invoking the stored function
+			inline GenericClass* GetClosureThis() const { return m_pthis; }
+			inline GenericMemFunc GetClosureMemPtr() const { return reinterpret_cast<GenericMemFunc>(m_pFunction); }
+
+			// There are a few ways of dealing with static function pointers.
+			// There's a standard-compliant, but tricky method.
+			// There's also a straightforward hack, that won't work on DOS compilers using the
+			// medium memory model. It's so evil that I can't recommend it, but I've
+			// implemented it anyway because it produces very nice asm code.
+
+#if !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
+
+//				ClosurePtr<> - Safe version
+//
+// This implementation is standard-compliant, but a bit tricky.
+// I store the function pointer inside the class, and the delegate then
+// points to itself. Whenever the delegate is copied, these self-references
+// must be transformed, and this complicates the = and == operators.
+		public:
+			// The next two functions are for operator ==, =, and the copy constructor.
+			// We may need to convert the m_pthis pointers, so that
+			// they remain as self-references.
+			template< class DerivedClass >
+			inline void CopyFrom(DerivedClass* pParent, const DelegateMemento& x) {
+				SetMementoFrom(x);
+				if (m_pStaticFunction != 0) {
+					// transform self references...
+					m_pthis = reinterpret_cast<GenericClass*>(pParent);
+				}
+			}
+			// For static functions, the 'static_function_invoker' class in the parent 
+			// will be called. The parent then needs to call GetStaticFunction() to find out 
+			// the actual function to invoke.
+			template < class DerivedClass, class ParentInvokerSig >
+			inline void bindstaticfunc(DerivedClass* pParent, ParentInvokerSig static_function_invoker,
+				StaticFuncPtr function_to_bind) {
+				if (function_to_bind == 0) { // cope with assignment to 0
+					m_pFunction = 0;
+				}
+				else {
+					bindmemfunc(pParent, static_function_invoker);
+				}
+				m_pStaticFunction = reinterpret_cast<GenericFuncPtr>(function_to_bind);
+			}
+			inline UnvoidStaticFuncPtr GetStaticFunction() const {
+				return reinterpret_cast<UnvoidStaticFuncPtr>(m_pStaticFunction);
+			}
+#else
+
+//				ClosurePtr<> - Evil version
+//
+// For compilers where data pointers are at least as big as code pointers, it is 
+// possible to store the function pointer in the this pointer, using another 
+// horrible_cast. Invocation isn't any faster, but it saves 4 bytes, and
+// speeds up comparison and assignment. If C++ provided direct language support
+// for delegates, they would produce asm code that was almost identical to this.
+// Note that the Sun C++ and MSVC documentation explicitly state that they 
+// support static_cast between void * and function pointers.
+
+			template< class DerivedClass >
+			inline void CopyFrom(DerivedClass* pParent, const DelegateMemento& right) {
+				SetMementoFrom(right);
+			}
+			// For static functions, the 'static_function_invoker' class in the parent 
+			// will be called. The parent then needs to call GetStaticFunction() to find out 
+			// the actual function to invoke.
+			// ******** EVIL, EVIL CODE! *******
+			template < 	class DerivedClass, class ParentInvokerSig>
+			inline void bindstaticfunc(DerivedClass* pParent, ParentInvokerSig static_function_invoker,
+				StaticFuncPtr function_to_bind) {
+				if (function_to_bind == 0) { // cope with assignment to 0
+					m_pFunction = 0;
+				}
+				else {
+					// We'll be ignoring the 'this' pointer, but we need to make sure we pass
+					// a valid value to bindmemfunc().
+					bindmemfunc(pParent, static_function_invoker);
+				}
+
+				// WARNING! Evil hack. We store the function in the 'this' pointer!
+				// Ensure that there's a compilation failure if function pointers 
+				// and data pointers have different sizes.
+				// If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK.
+				typedef int ERROR_CantUseEvilMethod[sizeof(GenericClass*) == sizeof(function_to_bind) ? 1 : -1];
+				m_pthis = horrible_cast<GenericClass*>(function_to_bind);
+				// MSVC, SunC++ and DMC accept the following (non-standard) code:
+		//		m_pthis = static_cast<GenericClass *>(static_cast<void *>(function_to_bind));
+				// BCC32, Comeau and DMC accept this method. MSVC7.1 needs __int64 instead of long
+		//		m_pthis = reinterpret_cast<GenericClass *>(reinterpret_cast<long>(function_to_bind));
+			}
+			// ******** EVIL, EVIL CODE! *******
+			// This function will be called with an invalid 'this' pointer!!
+			// We're just returning the 'this' pointer, converted into
+			// a function pointer!
+			inline UnvoidStaticFuncPtr GetStaticFunction() const {
+				// Ensure that there's a compilation failure if function pointers 
+				// and data pointers have different sizes.
+				// If you get this error, you need to #undef FASTDELEGATE_USESTATICFUNCTIONHACK.
+				typedef int ERROR_CantUseEvilMethod[sizeof(UnvoidStaticFuncPtr) == sizeof(this) ? 1 : -1];
+				return horrible_cast<UnvoidStaticFuncPtr>(this);
+			}
+#endif // !defined(FASTDELEGATE_USESTATICFUNCTIONHACK)
+
+			// Does the closure contain this static function?
+			inline bool IsEqualToStaticFuncPtr(StaticFuncPtr funcptr) {
+				if (funcptr == 0) return empty();
+				// For the Evil method, if it doesn't actually contain a static function, this will return an arbitrary
+				// value that is not equal to any valid function pointer.
+				else return funcptr == reinterpret_cast<StaticFuncPtr>(GetStaticFunction());
+			}
+		};
+
+
+	} // namespace detail
+
+	////////////////////////////////////////////////////////////////////////////////
+	//						Fast Delegates, part 3:
+	//
+	//				Wrapper classes to ensure type safety
+	//
+	////////////////////////////////////////////////////////////////////////////////
+
+
+	// Once we have the member function conversion templates, it's easy to make the
+	// wrapper classes. So that they will work with as many compilers as possible, 
+	// the classes are of the form
+	//   FastDelegate3<int, char *, double>
+	// They can cope with any combination of parameters. The max number of parameters
+	// allowed is 8, but it is trivial to increase this limit.
+	// Note that we need to treat const member functions seperately.
+	// All this class does is to enforce type safety, and invoke the delegate with
+	// the correct list of parameters.
+
+	// Because of the weird rule about the class of derived member function pointers,
+	// you sometimes need to apply a downcast to the 'this' pointer.
+	// This is the reason for the use of "implicit_cast<X*>(pthis)" in the code below. 
+	// If CDerivedClass is derived from CBaseClass, but doesn't override SimpleVirtualFunction,
+	// without this trick you'd need to write:
+	//		MyDelegate(static_cast<CBaseClass *>(&d), &CDerivedClass::SimpleVirtualFunction);
+	// but with the trick you can write
+	//		MyDelegate(&d, &CDerivedClass::SimpleVirtualFunction);
+
+	// RetType is the type the compiler uses in compiling the template. For VC6,
+	// it cannot be void. DesiredRetType is the real type which is returned from
+	// all of the functions. It can be void.
+
+	// Implicit conversion to "bool" is achieved using the safe_bool idiom,
+	// using member data pointers (MDP). This allows "if (dg)..." syntax
+	// Because some compilers (eg codeplay) don't have a unique value for a zero
+	// MDP, an extra padding member is added to the SafeBool struct.
+	// Some compilers (eg VC6) won't implicitly convert from 0 to an MDP, so
+	// in that case the static function constructor is not made explicit; this
+	// allows "if (dg==0) ..." to compile.
+
+	//N=0
+	template<class RetType = detail::DefaultVoid>
+	class FastDelegate0 {
+	private:
+		typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
+		typedef DesiredRetType(*StaticFunctionPtr)();
+		typedef RetType(*UnvoidStaticFunctionPtr)();
+		typedef RetType(detail::GenericClass::* GenericMemFn)();
+		typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
+		ClosureType m_Closure;
+	public:
+		// Typedefs to aid generic programming
+		typedef FastDelegate0 type;
+
+		// Construction and comparison functions
+		FastDelegate0() { clear(); }
+		FastDelegate0(const FastDelegate0& x) {
+			m_Closure.CopyFrom(this, x.m_Closure);
+		}
+		void operator = (const FastDelegate0& x) {
+			m_Closure.CopyFrom(this, x.m_Closure);
+		}
+		bool operator ==(const FastDelegate0& x) const {
+			return m_Closure.IsEqual(x.m_Closure);
+		}
+		bool operator !=(const FastDelegate0& x) const {
+			return !m_Closure.IsEqual(x.m_Closure);
+		}
+		bool operator <(const FastDelegate0& x) const {
+			return m_Closure.IsLess(x.m_Closure);
+		}
+		bool operator >(const FastDelegate0& x) const {
+			return x.m_Closure.IsLess(m_Closure);
+		}
+		// Binding to non-const member functions
+		template < class X, class Y >
+		FastDelegate0(Y* pthis, DesiredRetType(X::* function_to_bind)()) {
+			m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
+		}
+		template < class X, class Y >
+		inline void bind(Y* pthis, DesiredRetType(X::* function_to_bind)()) {
+			m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
+		}
+		// Binding to const member functions.
+		template < class X, class Y >
+		FastDelegate0(const Y* pthis, DesiredRetType(X::* function_to_bind)() const) {
+			m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
+		}
+		template < class X, class Y >
+		inline void bind(const Y* pthis, DesiredRetType(X::* function_to_bind)() const) {
+			m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
+		}
+		// Static functions. We convert them into a member function call.
+		// This constructor also provides implicit conversion
+		FastDelegate0(DesiredRetType(*function_to_bind)()) {
+			bind(function_to_bind);
+		}
+		// for efficiency, prevent creation of a temporary
+		void operator = (DesiredRetType(*function_to_bind)()) {
+			bind(function_to_bind);
+		}
+		inline void bind(DesiredRetType(*function_to_bind)()) {
+			m_Closure.bindstaticfunc(this, &FastDelegate0::InvokeStaticFunction,
+				function_to_bind);
+		}
+		// Invoke the delegate
+		RetType operator() () const {
+			return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))();
+		}
+		// Implicit conversion to "bool" using the safe_bool idiom
+	private:
+		typedef struct SafeBoolStruct {
+			int a_data_pointer_to_this_is_0_on_buggy_compilers;
+			StaticFunctionPtr m_nonzero;
+		} UselessTypedef;
+		typedef StaticFunctionPtr SafeBoolStruct::* unspecified_bool_type;
+	public:
+		operator unspecified_bool_type() const {
+			return empty() ? 0 : &SafeBoolStruct::m_nonzero;
+		}
+		// necessary to allow ==0 to work despite the safe_bool idiom
+		inline bool operator==(StaticFunctionPtr funcptr) {
+			return m_Closure.IsEqualToStaticFuncPtr(funcptr);
+		}
+		inline bool operator!=(StaticFunctionPtr funcptr) {
+			return !m_Closure.IsEqualToStaticFuncPtr(funcptr);
+		}
+		inline bool operator ! () const {	// Is it bound to anything?
+			return !m_Closure;
+		}
+		inline bool empty() const {
+			return !m_Closure;
+		}
+		void clear() { m_Closure.clear(); }
+		// Conversion to and from the DelegateMemento storage class
+		const DelegateMemento& GetMemento() { return m_Closure; }
+		void SetMemento(const DelegateMemento& any) { m_Closure.CopyFrom(this, any); }
+
+	private:	// Invoker for static functions
+		RetType InvokeStaticFunction() const {
+			return (*(m_Closure.GetStaticFunction()))();
+		}
+	};
+
+	//N=1
+	template<class Param1, class RetType = detail::DefaultVoid>
+	class FastDelegate1 {
+	private:
+		typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
+		typedef DesiredRetType(*StaticFunctionPtr)(Param1 p1);
+		typedef RetType(*UnvoidStaticFunctionPtr)(Param1 p1);
+		typedef RetType(detail::GenericClass::* GenericMemFn)(Param1 p1);
+		typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
+		ClosureType m_Closure;
+	public:
+		// Typedefs to aid generic programming
+		typedef FastDelegate1 type;
+
+		// Construction and comparison functions
+		FastDelegate1() { clear(); }
+		FastDelegate1(const FastDelegate1& x) {
+			m_Closure.CopyFrom(this, x.m_Closure);
+		}
+		void operator = (const FastDelegate1& x) {
+			m_Closure.CopyFrom(this, x.m_Closure);
+		}
+		bool operator ==(const FastDelegate1& x) const {
+			return m_Closure.IsEqual(x.m_Closure);
+		}
+		bool operator !=(const FastDelegate1& x) const {
+			return !m_Closure.IsEqual(x.m_Closure);
+		}
+		bool operator <(const FastDelegate1& x) const {
+			return m_Closure.IsLess(x.m_Closure);
+		}
+		bool operator >(const FastDelegate1& x) const {
+			return x.m_Closure.IsLess(m_Closure);
+		}
+		// Binding to non-const member functions
+		template < class X, class Y >
+		FastDelegate1(Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1)) {
+			m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
+		}
+		template < class X, class Y >
+		inline void bind(Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1)) {
+			m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
+		}
+		// Binding to const member functions.
+		template < class X, class Y >
+		FastDelegate1(const Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1) const) {
+			m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
+		}
+		template < class X, class Y >
+		inline void bind(const Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1) const) {
+			m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
+		}
+		// Static functions. We convert them into a member function call.
+		// This constructor also provides implicit conversion
+		FastDelegate1(DesiredRetType(*function_to_bind)(Param1 p1)) {
+			bind(function_to_bind);
+		}
+		// for efficiency, prevent creation of a temporary
+		void operator = (DesiredRetType(*function_to_bind)(Param1 p1)) {
+			bind(function_to_bind);
+		}
+		inline void bind(DesiredRetType(*function_to_bind)(Param1 p1)) {
+			m_Closure.bindstaticfunc(this, &FastDelegate1::InvokeStaticFunction,
+				function_to_bind);
+		}
+		// Invoke the delegate
+		RetType operator() (Param1 p1) const {
+			return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1);
+		}
+		// Implicit conversion to "bool" using the safe_bool idiom
+	private:
+		typedef struct SafeBoolStruct {
+			int a_data_pointer_to_this_is_0_on_buggy_compilers;
+			StaticFunctionPtr m_nonzero;
+		} UselessTypedef;
+		typedef StaticFunctionPtr SafeBoolStruct::* unspecified_bool_type;
+	public:
+		operator unspecified_bool_type() const {
+			return empty() ? 0 : &SafeBoolStruct::m_nonzero;
+		}
+		// necessary to allow ==0 to work despite the safe_bool idiom
+		inline bool operator==(StaticFunctionPtr funcptr) {
+			return m_Closure.IsEqualToStaticFuncPtr(funcptr);
+		}
+		inline bool operator!=(StaticFunctionPtr funcptr) {
+			return !m_Closure.IsEqualToStaticFuncPtr(funcptr);
+		}
+		inline bool operator ! () const {	// Is it bound to anything?
+			return !m_Closure;
+		}
+		inline bool empty() const {
+			return !m_Closure;
+		}
+		void clear() { m_Closure.clear(); }
+		// Conversion to and from the DelegateMemento storage class
+		const DelegateMemento& GetMemento() { return m_Closure; }
+		void SetMemento(const DelegateMemento& any) { m_Closure.CopyFrom(this, any); }
+
+	private:	// Invoker for static functions
+		RetType InvokeStaticFunction(Param1 p1) const {
+			return (*(m_Closure.GetStaticFunction()))(p1);
+		}
+	};
+
+	//N=2
+	template<class Param1, class Param2, class RetType = detail::DefaultVoid>
+	class FastDelegate2 {
+	private:
+		typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
+		typedef DesiredRetType(*StaticFunctionPtr)(Param1 p1, Param2 p2);
+		typedef RetType(*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2);
+		typedef RetType(detail::GenericClass::* GenericMemFn)(Param1 p1, Param2 p2);
+		typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
+		ClosureType m_Closure;
+	public:
+		// Typedefs to aid generic programming
+		typedef FastDelegate2 type;
+
+		// Construction and comparison functions
+		FastDelegate2() { clear(); }
+		FastDelegate2(const FastDelegate2& x) {
+			m_Closure.CopyFrom(this, x.m_Closure);
+		}
+		void operator = (const FastDelegate2& x) {
+			m_Closure.CopyFrom(this, x.m_Closure);
+		}
+		bool operator ==(const FastDelegate2& x) const {
+			return m_Closure.IsEqual(x.m_Closure);
+		}
+		bool operator !=(const FastDelegate2& x) const {
+			return !m_Closure.IsEqual(x.m_Closure);
+		}
+		bool operator <(const FastDelegate2& x) const {
+			return m_Closure.IsLess(x.m_Closure);
+		}
+		bool operator >(const FastDelegate2& x) const {
+			return x.m_Closure.IsLess(m_Closure);
+		}
+		// Binding to non-const member functions
+		template < class X, class Y >
+		FastDelegate2(Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2)) {
+			m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
+		}
+		template < class X, class Y >
+		inline void bind(Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2)) {
+			m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
+		}
+		// Binding to const member functions.
+		template < class X, class Y >
+		FastDelegate2(const Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2) const) {
+			m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
+		}
+		template < class X, class Y >
+		inline void bind(const Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2) const) {
+			m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
+		}
+		// Static functions. We convert them into a member function call.
+		// This constructor also provides implicit conversion
+		FastDelegate2(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2)) {
+			bind(function_to_bind);
+		}
+		// for efficiency, prevent creation of a temporary
+		void operator = (DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2)) {
+			bind(function_to_bind);
+		}
+		inline void bind(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2)) {
+			m_Closure.bindstaticfunc(this, &FastDelegate2::InvokeStaticFunction,
+				function_to_bind);
+		}
+		// Invoke the delegate
+		RetType operator() (Param1 p1, Param2 p2) const {
+			return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2);
+		}
+		// Implicit conversion to "bool" using the safe_bool idiom
+	private:
+		typedef struct SafeBoolStruct {
+			int a_data_pointer_to_this_is_0_on_buggy_compilers;
+			StaticFunctionPtr m_nonzero;
+		} UselessTypedef;
+		typedef StaticFunctionPtr SafeBoolStruct::* unspecified_bool_type;
+	public:
+		operator unspecified_bool_type() const {
+			return empty() ? 0 : &SafeBoolStruct::m_nonzero;
+		}
+		// necessary to allow ==0 to work despite the safe_bool idiom
+		inline bool operator==(StaticFunctionPtr funcptr) {
+			return m_Closure.IsEqualToStaticFuncPtr(funcptr);
+		}
+		inline bool operator!=(StaticFunctionPtr funcptr) {
+			return !m_Closure.IsEqualToStaticFuncPtr(funcptr);
+		}
+		inline bool operator ! () const {	// Is it bound to anything?
+			return !m_Closure;
+		}
+		inline bool empty() const {
+			return !m_Closure;
+		}
+		void clear() { m_Closure.clear(); }
+		// Conversion to and from the DelegateMemento storage class
+		const DelegateMemento& GetMemento() { return m_Closure; }
+		void SetMemento(const DelegateMemento& any) { m_Closure.CopyFrom(this, any); }
+
+	private:	// Invoker for static functions
+		RetType InvokeStaticFunction(Param1 p1, Param2 p2) const {
+			return (*(m_Closure.GetStaticFunction()))(p1, p2);
+		}
+	};
+
+	//N=3
+	template<class Param1, class Param2, class Param3, class RetType = detail::DefaultVoid>
+	class FastDelegate3 {
+	private:
+		typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
+		typedef DesiredRetType(*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3);
+		typedef RetType(*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3);
+		typedef RetType(detail::GenericClass::* GenericMemFn)(Param1 p1, Param2 p2, Param3 p3);
+		typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
+		ClosureType m_Closure;
+	public:
+		// Typedefs to aid generic programming
+		typedef FastDelegate3 type;
+
+		// Construction and comparison functions
+		FastDelegate3() { clear(); }
+		FastDelegate3(const FastDelegate3& x) {
+			m_Closure.CopyFrom(this, x.m_Closure);
+		}
+		void operator = (const FastDelegate3& x) {
+			m_Closure.CopyFrom(this, x.m_Closure);
+		}
+		bool operator ==(const FastDelegate3& x) const {
+			return m_Closure.IsEqual(x.m_Closure);
+		}
+		bool operator !=(const FastDelegate3& x) const {
+			return !m_Closure.IsEqual(x.m_Closure);
+		}
+		bool operator <(const FastDelegate3& x) const {
+			return m_Closure.IsLess(x.m_Closure);
+		}
+		bool operator >(const FastDelegate3& x) const {
+			return x.m_Closure.IsLess(m_Closure);
+		}
+		// Binding to non-const member functions
+		template < class X, class Y >
+		FastDelegate3(Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3)) {
+			m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
+		}
+		template < class X, class Y >
+		inline void bind(Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3)) {
+			m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
+		}
+		// Binding to const member functions.
+		template < class X, class Y >
+		FastDelegate3(const Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3) const) {
+			m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
+		}
+		template < class X, class Y >
+		inline void bind(const Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3) const) {
+			m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
+		}
+		// Static functions. We convert them into a member function call.
+		// This constructor also provides implicit conversion
+		FastDelegate3(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3)) {
+			bind(function_to_bind);
+		}
+		// for efficiency, prevent creation of a temporary
+		void operator = (DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3)) {
+			bind(function_to_bind);
+		}
+		inline void bind(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3)) {
+			m_Closure.bindstaticfunc(this, &FastDelegate3::InvokeStaticFunction,
+				function_to_bind);
+		}
+		// Invoke the delegate
+		RetType operator() (Param1 p1, Param2 p2, Param3 p3) const {
+			return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3);
+		}
+		// Implicit conversion to "bool" using the safe_bool idiom
+	private:
+		typedef struct SafeBoolStruct {
+			int a_data_pointer_to_this_is_0_on_buggy_compilers;
+			StaticFunctionPtr m_nonzero;
+		} UselessTypedef;
+		typedef StaticFunctionPtr SafeBoolStruct::* unspecified_bool_type;
+	public:
+		operator unspecified_bool_type() const {
+			return empty() ? 0 : &SafeBoolStruct::m_nonzero;
+		}
+		// necessary to allow ==0 to work despite the safe_bool idiom
+		inline bool operator==(StaticFunctionPtr funcptr) {
+			return m_Closure.IsEqualToStaticFuncPtr(funcptr);
+		}
+		inline bool operator!=(StaticFunctionPtr funcptr) {
+			return !m_Closure.IsEqualToStaticFuncPtr(funcptr);
+		}
+		inline bool operator ! () const {	// Is it bound to anything?
+			return !m_Closure;
+		}
+		inline bool empty() const {
+			return !m_Closure;
+		}
+		void clear() { m_Closure.clear(); }
+		// Conversion to and from the DelegateMemento storage class
+		const DelegateMemento& GetMemento() { return m_Closure; }
+		void SetMemento(const DelegateMemento& any) { m_Closure.CopyFrom(this, any); }
+
+	private:	// Invoker for static functions
+		RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3) const {
+			return (*(m_Closure.GetStaticFunction()))(p1, p2, p3);
+		}
+	};
+
+	//N=4
+	template<class Param1, class Param2, class Param3, class Param4, class RetType = detail::DefaultVoid>
+	class FastDelegate4 {
+	private:
+		typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
+		typedef DesiredRetType(*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
+		typedef RetType(*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
+		typedef RetType(detail::GenericClass::* GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4);
+		typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
+		ClosureType m_Closure;
+	public:
+		// Typedefs to aid generic programming
+		typedef FastDelegate4 type;
+
+		// Construction and comparison functions
+		FastDelegate4() { clear(); }
+		FastDelegate4(const FastDelegate4& x) {
+			m_Closure.CopyFrom(this, x.m_Closure);
+		}
+		void operator = (const FastDelegate4& x) {
+			m_Closure.CopyFrom(this, x.m_Closure);
+		}
+		bool operator ==(const FastDelegate4& x) const {
+			return m_Closure.IsEqual(x.m_Closure);
+		}
+		bool operator !=(const FastDelegate4& x) const {
+			return !m_Closure.IsEqual(x.m_Closure);
+		}
+		bool operator <(const FastDelegate4& x) const {
+			return m_Closure.IsLess(x.m_Closure);
+		}
+		bool operator >(const FastDelegate4& x) const {
+			return x.m_Closure.IsLess(m_Closure);
+		}
+		// Binding to non-const member functions
+		template < class X, class Y >
+		FastDelegate4(Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) {
+			m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
+		}
+		template < class X, class Y >
+		inline void bind(Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) {
+			m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
+		}
+		// Binding to const member functions.
+		template < class X, class Y >
+		FastDelegate4(const Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const) {
+			m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
+		}
+		template < class X, class Y >
+		inline void bind(const Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const) {
+			m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
+		}
+		// Static functions. We convert them into a member function call.
+		// This constructor also provides implicit conversion
+		FastDelegate4(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) {
+			bind(function_to_bind);
+		}
+		// for efficiency, prevent creation of a temporary
+		void operator = (DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) {
+			bind(function_to_bind);
+		}
+		inline void bind(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) {
+			m_Closure.bindstaticfunc(this, &FastDelegate4::InvokeStaticFunction,
+				function_to_bind);
+		}
+		// Invoke the delegate
+		RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4) const {
+			return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4);
+		}
+		// Implicit conversion to "bool" using the safe_bool idiom
+	private:
+		typedef struct SafeBoolStruct {
+			int a_data_pointer_to_this_is_0_on_buggy_compilers;
+			StaticFunctionPtr m_nonzero;
+		} UselessTypedef;
+		typedef StaticFunctionPtr SafeBoolStruct::* unspecified_bool_type;
+	public:
+		operator unspecified_bool_type() const {
+			return empty() ? 0 : &SafeBoolStruct::m_nonzero;
+		}
+		// necessary to allow ==0 to work despite the safe_bool idiom
+		inline bool operator==(StaticFunctionPtr funcptr) {
+			return m_Closure.IsEqualToStaticFuncPtr(funcptr);
+		}
+		inline bool operator!=(StaticFunctionPtr funcptr) {
+			return !m_Closure.IsEqualToStaticFuncPtr(funcptr);
+		}
+		inline bool operator ! () const {	// Is it bound to anything?
+			return !m_Closure;
+		}
+		inline bool empty() const {
+			return !m_Closure;
+		}
+		void clear() { m_Closure.clear(); }
+		// Conversion to and from the DelegateMemento storage class
+		const DelegateMemento& GetMemento() { return m_Closure; }
+		void SetMemento(const DelegateMemento& any) { m_Closure.CopyFrom(this, any); }
+
+	private:	// Invoker for static functions
+		RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const {
+			return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4);
+		}
+	};
+
+	//N=5
+	template<class Param1, class Param2, class Param3, class Param4, class Param5, class RetType = detail::DefaultVoid>
+	class FastDelegate5 {
+	private:
+		typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
+		typedef DesiredRetType(*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
+		typedef RetType(*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
+		typedef RetType(detail::GenericClass::* GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5);
+		typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
+		ClosureType m_Closure;
+	public:
+		// Typedefs to aid generic programming
+		typedef FastDelegate5 type;
+
+		// Construction and comparison functions
+		FastDelegate5() { clear(); }
+		FastDelegate5(const FastDelegate5& x) {
+			m_Closure.CopyFrom(this, x.m_Closure);
+		}
+		void operator = (const FastDelegate5& x) {
+			m_Closure.CopyFrom(this, x.m_Closure);
+		}
+		bool operator ==(const FastDelegate5& x) const {
+			return m_Closure.IsEqual(x.m_Closure);
+		}
+		bool operator !=(const FastDelegate5& x) const {
+			return !m_Closure.IsEqual(x.m_Closure);
+		}
+		bool operator <(const FastDelegate5& x) const {
+			return m_Closure.IsLess(x.m_Closure);
+		}
+		bool operator >(const FastDelegate5& x) const {
+			return x.m_Closure.IsLess(m_Closure);
+		}
+		// Binding to non-const member functions
+		template < class X, class Y >
+		FastDelegate5(Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
+			m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
+		}
+		template < class X, class Y >
+		inline void bind(Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
+			m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
+		}
+		// Binding to const member functions.
+		template < class X, class Y >
+		FastDelegate5(const Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const) {
+			m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
+		}
+		template < class X, class Y >
+		inline void bind(const Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const) {
+			m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
+		}
+		// Static functions. We convert them into a member function call.
+		// This constructor also provides implicit conversion
+		FastDelegate5(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
+			bind(function_to_bind);
+		}
+		// for efficiency, prevent creation of a temporary
+		void operator = (DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
+			bind(function_to_bind);
+		}
+		inline void bind(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
+			m_Closure.bindstaticfunc(this, &FastDelegate5::InvokeStaticFunction,
+				function_to_bind);
+		}
+		// Invoke the delegate
+		RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const {
+			return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5);
+		}
+		// Implicit conversion to "bool" using the safe_bool idiom
+	private:
+		typedef struct SafeBoolStruct {
+			int a_data_pointer_to_this_is_0_on_buggy_compilers;
+			StaticFunctionPtr m_nonzero;
+		} UselessTypedef;
+		typedef StaticFunctionPtr SafeBoolStruct::* unspecified_bool_type;
+	public:
+		operator unspecified_bool_type() const {
+			return empty() ? 0 : &SafeBoolStruct::m_nonzero;
+		}
+		// necessary to allow ==0 to work despite the safe_bool idiom
+		inline bool operator==(StaticFunctionPtr funcptr) {
+			return m_Closure.IsEqualToStaticFuncPtr(funcptr);
+		}
+		inline bool operator!=(StaticFunctionPtr funcptr) {
+			return !m_Closure.IsEqualToStaticFuncPtr(funcptr);
+		}
+		inline bool operator ! () const {	// Is it bound to anything?
+			return !m_Closure;
+		}
+		inline bool empty() const {
+			return !m_Closure;
+		}
+		void clear() { m_Closure.clear(); }
+		// Conversion to and from the DelegateMemento storage class
+		const DelegateMemento& GetMemento() { return m_Closure; }
+		void SetMemento(const DelegateMemento& any) { m_Closure.CopyFrom(this, any); }
+
+	private:	// Invoker for static functions
+		RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const {
+			return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5);
+		}
+	};
+
+	//N=6
+	template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class RetType = detail::DefaultVoid>
+	class FastDelegate6 {
+	private:
+		typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
+		typedef DesiredRetType(*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
+		typedef RetType(*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
+		typedef RetType(detail::GenericClass::* GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6);
+		typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
+		ClosureType m_Closure;
+	public:
+		// Typedefs to aid generic programming
+		typedef FastDelegate6 type;
+
+		// Construction and comparison functions
+		FastDelegate6() { clear(); }
+		FastDelegate6(const FastDelegate6& x) {
+			m_Closure.CopyFrom(this, x.m_Closure);
+		}
+		void operator = (const FastDelegate6& x) {
+			m_Closure.CopyFrom(this, x.m_Closure);
+		}
+		bool operator ==(const FastDelegate6& x) const {
+			return m_Closure.IsEqual(x.m_Closure);
+		}
+		bool operator !=(const FastDelegate6& x) const {
+			return !m_Closure.IsEqual(x.m_Closure);
+		}
+		bool operator <(const FastDelegate6& x) const {
+			return m_Closure.IsLess(x.m_Closure);
+		}
+		bool operator >(const FastDelegate6& x) const {
+			return x.m_Closure.IsLess(m_Closure);
+		}
+		// Binding to non-const member functions
+		template < class X, class Y >
+		FastDelegate6(Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) {
+			m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
+		}
+		template < class X, class Y >
+		inline void bind(Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) {
+			m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
+		}
+		// Binding to const member functions.
+		template < class X, class Y >
+		FastDelegate6(const Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const) {
+			m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
+		}
+		template < class X, class Y >
+		inline void bind(const Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const) {
+			m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
+		}
+		// Static functions. We convert them into a member function call.
+		// This constructor also provides implicit conversion
+		FastDelegate6(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) {
+			bind(function_to_bind);
+		}
+		// for efficiency, prevent creation of a temporary
+		void operator = (DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) {
+			bind(function_to_bind);
+		}
+		inline void bind(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) {
+			m_Closure.bindstaticfunc(this, &FastDelegate6::InvokeStaticFunction,
+				function_to_bind);
+		}
+		// Invoke the delegate
+		RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const {
+			return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6);
+		}
+		// Implicit conversion to "bool" using the safe_bool idiom
+	private:
+		typedef struct SafeBoolStruct {
+			int a_data_pointer_to_this_is_0_on_buggy_compilers;
+			StaticFunctionPtr m_nonzero;
+		} UselessTypedef;
+		typedef StaticFunctionPtr SafeBoolStruct::* unspecified_bool_type;
+	public:
+		operator unspecified_bool_type() const {
+			return empty() ? 0 : &SafeBoolStruct::m_nonzero;
+		}
+		// necessary to allow ==0 to work despite the safe_bool idiom
+		inline bool operator==(StaticFunctionPtr funcptr) {
+			return m_Closure.IsEqualToStaticFuncPtr(funcptr);
+		}
+		inline bool operator!=(StaticFunctionPtr funcptr) {
+			return !m_Closure.IsEqualToStaticFuncPtr(funcptr);
+		}
+		inline bool operator ! () const {	// Is it bound to anything?
+			return !m_Closure;
+		}
+		inline bool empty() const {
+			return !m_Closure;
+		}
+		void clear() { m_Closure.clear(); }
+		// Conversion to and from the DelegateMemento storage class
+		const DelegateMemento& GetMemento() { return m_Closure; }
+		void SetMemento(const DelegateMemento& any) { m_Closure.CopyFrom(this, any); }
+
+	private:	// Invoker for static functions
+		RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const {
+			return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6);
+		}
+	};
+
+	//N=7
+	template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class RetType = detail::DefaultVoid>
+	class FastDelegate7 {
+	private:
+		typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
+		typedef DesiredRetType(*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
+		typedef RetType(*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
+		typedef RetType(detail::GenericClass::* GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7);
+		typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
+		ClosureType m_Closure;
+	public:
+		// Typedefs to aid generic programming
+		typedef FastDelegate7 type;
+
+		// Construction and comparison functions
+		FastDelegate7() { clear(); }
+		FastDelegate7(const FastDelegate7& x) {
+			m_Closure.CopyFrom(this, x.m_Closure);
+		}
+		void operator = (const FastDelegate7& x) {
+			m_Closure.CopyFrom(this, x.m_Closure);
+		}
+		bool operator ==(const FastDelegate7& x) const {
+			return m_Closure.IsEqual(x.m_Closure);
+		}
+		bool operator !=(const FastDelegate7& x) const {
+			return !m_Closure.IsEqual(x.m_Closure);
+		}
+		bool operator <(const FastDelegate7& x) const {
+			return m_Closure.IsLess(x.m_Closure);
+		}
+		bool operator >(const FastDelegate7& x) const {
+			return x.m_Closure.IsLess(m_Closure);
+		}
+		// Binding to non-const member functions
+		template < class X, class Y >
+		FastDelegate7(Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) {
+			m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
+		}
+		template < class X, class Y >
+		inline void bind(Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) {
+			m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
+		}
+		// Binding to const member functions.
+		template < class X, class Y >
+		FastDelegate7(const Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const) {
+			m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
+		}
+		template < class X, class Y >
+		inline void bind(const Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const) {
+			m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
+		}
+		// Static functions. We convert them into a member function call.
+		// This constructor also provides implicit conversion
+		FastDelegate7(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) {
+			bind(function_to_bind);
+		}
+		// for efficiency, prevent creation of a temporary
+		void operator = (DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) {
+			bind(function_to_bind);
+		}
+		inline void bind(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) {
+			m_Closure.bindstaticfunc(this, &FastDelegate7::InvokeStaticFunction,
+				function_to_bind);
+		}
+		// Invoke the delegate
+		RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const {
+			return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7);
+		}
+		// Implicit conversion to "bool" using the safe_bool idiom
+	private:
+		typedef struct SafeBoolStruct {
+			int a_data_pointer_to_this_is_0_on_buggy_compilers;
+			StaticFunctionPtr m_nonzero;
+		} UselessTypedef;
+		typedef StaticFunctionPtr SafeBoolStruct::* unspecified_bool_type;
+	public:
+		operator unspecified_bool_type() const {
+			return empty() ? 0 : &SafeBoolStruct::m_nonzero;
+		}
+		// necessary to allow ==0 to work despite the safe_bool idiom
+		inline bool operator==(StaticFunctionPtr funcptr) {
+			return m_Closure.IsEqualToStaticFuncPtr(funcptr);
+		}
+		inline bool operator!=(StaticFunctionPtr funcptr) {
+			return !m_Closure.IsEqualToStaticFuncPtr(funcptr);
+		}
+		inline bool operator ! () const {	// Is it bound to anything?
+			return !m_Closure;
+		}
+		inline bool empty() const {
+			return !m_Closure;
+		}
+		void clear() { m_Closure.clear(); }
+		// Conversion to and from the DelegateMemento storage class
+		const DelegateMemento& GetMemento() { return m_Closure; }
+		void SetMemento(const DelegateMemento& any) { m_Closure.CopyFrom(this, any); }
+
+	private:	// Invoker for static functions
+		RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const {
+			return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7);
+		}
+	};
+
+	//N=8
+	template<class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class RetType = detail::DefaultVoid>
+	class FastDelegate8 {
+	private:
+		typedef typename detail::DefaultVoidToVoid<RetType>::type DesiredRetType;
+		typedef DesiredRetType(*StaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
+		typedef RetType(*UnvoidStaticFunctionPtr)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
+		typedef RetType(detail::GenericClass::* GenericMemFn)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8);
+		typedef detail::ClosurePtr<GenericMemFn, StaticFunctionPtr, UnvoidStaticFunctionPtr> ClosureType;
+		ClosureType m_Closure;
+	public:
+		// Typedefs to aid generic programming
+		typedef FastDelegate8 type;
+
+		// Construction and comparison functions
+		FastDelegate8() { clear(); }
+		FastDelegate8(const FastDelegate8& x) {
+			m_Closure.CopyFrom(this, x.m_Closure);
+		}
+		void operator = (const FastDelegate8& x) {
+			m_Closure.CopyFrom(this, x.m_Closure);
+		}
+		bool operator ==(const FastDelegate8& x) const {
+			return m_Closure.IsEqual(x.m_Closure);
+		}
+		bool operator !=(const FastDelegate8& x) const {
+			return !m_Closure.IsEqual(x.m_Closure);
+		}
+		bool operator <(const FastDelegate8& x) const {
+			return m_Closure.IsLess(x.m_Closure);
+		}
+		bool operator >(const FastDelegate8& x) const {
+			return x.m_Closure.IsLess(m_Closure);
+		}
+		// Binding to non-const member functions
+		template < class X, class Y >
+		FastDelegate8(Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) {
+			m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
+		}
+		template < class X, class Y >
+		inline void bind(Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) {
+			m_Closure.bindmemfunc(detail::implicit_cast<X*>(pthis), function_to_bind);
+		}
+		// Binding to const member functions.
+		template < class X, class Y >
+		FastDelegate8(const Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const) {
+			m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
+		}
+		template < class X, class Y >
+		inline void bind(const Y* pthis, DesiredRetType(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const) {
+			m_Closure.bindconstmemfunc(detail::implicit_cast<const X*>(pthis), function_to_bind);
+		}
+		// Static functions. We convert them into a member function call.
+		// This constructor also provides implicit conversion
+		FastDelegate8(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) {
+			bind(function_to_bind);
+		}
+		// for efficiency, prevent creation of a temporary
+		void operator = (DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) {
+			bind(function_to_bind);
+		}
+		inline void bind(DesiredRetType(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) {
+			m_Closure.bindstaticfunc(this, &FastDelegate8::InvokeStaticFunction,
+				function_to_bind);
+		}
+		// Invoke the delegate
+		RetType operator() (Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const {
+			return (m_Closure.GetClosureThis()->*(m_Closure.GetClosureMemPtr()))(p1, p2, p3, p4, p5, p6, p7, p8);
+		}
+		// Implicit conversion to "bool" using the safe_bool idiom
+	private:
+		typedef struct SafeBoolStruct {
+			int a_data_pointer_to_this_is_0_on_buggy_compilers;
+			StaticFunctionPtr m_nonzero;
+		} UselessTypedef;
+		typedef StaticFunctionPtr SafeBoolStruct::* unspecified_bool_type;
+	public:
+		operator unspecified_bool_type() const {
+			return empty() ? 0 : &SafeBoolStruct::m_nonzero;
+		}
+		// necessary to allow ==0 to work despite the safe_bool idiom
+		inline bool operator==(StaticFunctionPtr funcptr) {
+			return m_Closure.IsEqualToStaticFuncPtr(funcptr);
+		}
+		inline bool operator!=(StaticFunctionPtr funcptr) {
+			return !m_Closure.IsEqualToStaticFuncPtr(funcptr);
+		}
+		inline bool operator ! () const {	// Is it bound to anything?
+			return !m_Closure;
+		}
+		inline bool empty() const {
+			return !m_Closure;
+		}
+		void clear() { m_Closure.clear(); }
+		// Conversion to and from the DelegateMemento storage class
+		const DelegateMemento& GetMemento() { return m_Closure; }
+		void SetMemento(const DelegateMemento& any) { m_Closure.CopyFrom(this, any); }
+
+	private:	// Invoker for static functions
+		RetType InvokeStaticFunction(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const {
+			return (*(m_Closure.GetStaticFunction()))(p1, p2, p3, p4, p5, p6, p7, p8);
+		}
+	};
+
+
+	////////////////////////////////////////////////////////////////////////////////
+	//						Fast Delegates, part 4:
+	// 
+	//				FastDelegate<> class (Original author: Jody Hagins)
+	//	Allows boost::function style syntax like:
+	//			FastDelegate< double (int, long) >
+	// instead of:
+	//			FastDelegate2< int, long, double >
+	//
+	////////////////////////////////////////////////////////////////////////////////
+
+#ifdef FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
+
+// Declare FastDelegate as a class template.  It will be specialized
+// later for all number of arguments.
+	template <typename Signature>
+	class FastDelegate;
+
+	//N=0
+	// Specialization to allow use of
+	// FastDelegate< R (  ) >
+	// instead of 
+	// FastDelegate0 < R >
+	template<typename R>
+	class FastDelegate< R() >
+		// Inherit from FastDelegate0 so that it can be treated just like a FastDelegate0
+		: public FastDelegate0 < R >
+	{
+	public:
+		// Make using the base type a bit easier via typedef.
+		typedef FastDelegate0 < R > BaseType;
+
+		// Allow users access to the specific type of this delegate.
+		typedef FastDelegate SelfType;
+
+		// Mimic the base class constructors.
+		FastDelegate() : BaseType() {}
+
+		template < class X, class Y >
+		FastDelegate(Y* pthis,
+			R(X::* function_to_bind)())
+			: BaseType(pthis, function_to_bind) {
+		}
+
+		template < class X, class Y >
+		FastDelegate(const Y* pthis,
+			R(X::* function_to_bind)() const)
+			: BaseType(pthis, function_to_bind)
+		{
+		}
+
+		FastDelegate(R(*function_to_bind)())
+			: BaseType(function_to_bind) {
+		}
+		void operator = (const BaseType& x) {
+			*static_cast<BaseType*>(this) = x;
+		}
+	};
+
+	//N=1
+	// Specialization to allow use of
+	// FastDelegate< R ( Param1 ) >
+	// instead of 
+	// FastDelegate1 < Param1, R >
+	template<typename R, class Param1>
+	class FastDelegate< R(Param1) >
+		// Inherit from FastDelegate1 so that it can be treated just like a FastDelegate1
+		: public FastDelegate1 < Param1, R >
+	{
+	public:
+		// Make using the base type a bit easier via typedef.
+		typedef FastDelegate1 < Param1, R > BaseType;
+
+		// Allow users access to the specific type of this delegate.
+		typedef FastDelegate SelfType;
+
+		// Mimic the base class constructors.
+		FastDelegate() : BaseType() {}
+
+		template < class X, class Y >
+		FastDelegate(Y* pthis,
+			R(X::* function_to_bind)(Param1 p1))
+			: BaseType(pthis, function_to_bind) {
+		}
+
+		template < class X, class Y >
+		FastDelegate(const Y* pthis,
+			R(X::* function_to_bind)(Param1 p1) const)
+			: BaseType(pthis, function_to_bind)
+		{
+		}
+
+		FastDelegate(R(*function_to_bind)(Param1 p1))
+			: BaseType(function_to_bind) {
+		}
+		void operator = (const BaseType& x) {
+			*static_cast<BaseType*>(this) = x;
+		}
+	};
+
+	//N=2
+	// Specialization to allow use of
+	// FastDelegate< R ( Param1, Param2 ) >
+	// instead of 
+	// FastDelegate2 < Param1, Param2, R >
+	template<typename R, class Param1, class Param2>
+	class FastDelegate< R(Param1, Param2) >
+		// Inherit from FastDelegate2 so that it can be treated just like a FastDelegate2
+		: public FastDelegate2 < Param1, Param2, R >
+	{
+	public:
+		// Make using the base type a bit easier via typedef.
+		typedef FastDelegate2 < Param1, Param2, R > BaseType;
+
+		// Allow users access to the specific type of this delegate.
+		typedef FastDelegate SelfType;
+
+		// Mimic the base class constructors.
+		FastDelegate() : BaseType() {}
+
+		template < class X, class Y >
+		FastDelegate(Y* pthis,
+			R(X::* function_to_bind)(Param1 p1, Param2 p2))
+			: BaseType(pthis, function_to_bind) {
+		}
+
+		template < class X, class Y >
+		FastDelegate(const Y* pthis,
+			R(X::* function_to_bind)(Param1 p1, Param2 p2) const)
+			: BaseType(pthis, function_to_bind)
+		{
+		}
+
+		FastDelegate(R(*function_to_bind)(Param1 p1, Param2 p2))
+			: BaseType(function_to_bind) {
+		}
+		void operator = (const BaseType& x) {
+			*static_cast<BaseType*>(this) = x;
+		}
+	};
+
+	//N=3
+	// Specialization to allow use of
+	// FastDelegate< R ( Param1, Param2, Param3 ) >
+	// instead of 
+	// FastDelegate3 < Param1, Param2, Param3, R >
+	template<typename R, class Param1, class Param2, class Param3>
+	class FastDelegate< R(Param1, Param2, Param3) >
+		// Inherit from FastDelegate3 so that it can be treated just like a FastDelegate3
+		: public FastDelegate3 < Param1, Param2, Param3, R >
+	{
+	public:
+		// Make using the base type a bit easier via typedef.
+		typedef FastDelegate3 < Param1, Param2, Param3, R > BaseType;
+
+		// Allow users access to the specific type of this delegate.
+		typedef FastDelegate SelfType;
+
+		// Mimic the base class constructors.
+		FastDelegate() : BaseType() {}
+
+		template < class X, class Y >
+		FastDelegate(Y* pthis,
+			R(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3))
+			: BaseType(pthis, function_to_bind) {
+		}
+
+		template < class X, class Y >
+		FastDelegate(const Y* pthis,
+			R(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3) const)
+			: BaseType(pthis, function_to_bind)
+		{
+		}
+
+		FastDelegate(R(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3))
+			: BaseType(function_to_bind) {
+		}
+		void operator = (const BaseType& x) {
+			*static_cast<BaseType*>(this) = x;
+		}
+	};
+
+	//N=4
+	// Specialization to allow use of
+	// FastDelegate< R ( Param1, Param2, Param3, Param4 ) >
+	// instead of 
+	// FastDelegate4 < Param1, Param2, Param3, Param4, R >
+	template<typename R, class Param1, class Param2, class Param3, class Param4>
+	class FastDelegate< R(Param1, Param2, Param3, Param4) >
+		// Inherit from FastDelegate4 so that it can be treated just like a FastDelegate4
+		: public FastDelegate4 < Param1, Param2, Param3, Param4, R >
+	{
+	public:
+		// Make using the base type a bit easier via typedef.
+		typedef FastDelegate4 < Param1, Param2, Param3, Param4, R > BaseType;
+
+		// Allow users access to the specific type of this delegate.
+		typedef FastDelegate SelfType;
+
+		// Mimic the base class constructors.
+		FastDelegate() : BaseType() {}
+
+		template < class X, class Y >
+		FastDelegate(Y* pthis,
+			R(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4))
+			: BaseType(pthis, function_to_bind) {
+		}
+
+		template < class X, class Y >
+		FastDelegate(const Y* pthis,
+			R(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const)
+			: BaseType(pthis, function_to_bind)
+		{
+		}
+
+		FastDelegate(R(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4))
+			: BaseType(function_to_bind) {
+		}
+		void operator = (const BaseType& x) {
+			*static_cast<BaseType*>(this) = x;
+		}
+	};
+
+	//N=5
+	// Specialization to allow use of
+	// FastDelegate< R ( Param1, Param2, Param3, Param4, Param5 ) >
+	// instead of 
+	// FastDelegate5 < Param1, Param2, Param3, Param4, Param5, R >
+	template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5>
+	class FastDelegate< R(Param1, Param2, Param3, Param4, Param5) >
+		// Inherit from FastDelegate5 so that it can be treated just like a FastDelegate5
+		: public FastDelegate5 < Param1, Param2, Param3, Param4, Param5, R >
+	{
+	public:
+		// Make using the base type a bit easier via typedef.
+		typedef FastDelegate5 < Param1, Param2, Param3, Param4, Param5, R > BaseType;
+
+		// Allow users access to the specific type of this delegate.
+		typedef FastDelegate SelfType;
+
+		// Mimic the base class constructors.
+		FastDelegate() : BaseType() {}
+
+		template < class X, class Y >
+		FastDelegate(Y* pthis,
+			R(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5))
+			: BaseType(pthis, function_to_bind) {
+		}
+
+		template < class X, class Y >
+		FastDelegate(const Y* pthis,
+			R(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const)
+			: BaseType(pthis, function_to_bind)
+		{
+		}
+
+		FastDelegate(R(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5))
+			: BaseType(function_to_bind) {
+		}
+		void operator = (const BaseType& x) {
+			*static_cast<BaseType*>(this) = x;
+		}
+	};
+
+	//N=6
+	// Specialization to allow use of
+	// FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6 ) >
+	// instead of 
+	// FastDelegate6 < Param1, Param2, Param3, Param4, Param5, Param6, R >
+	template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6>
+	class FastDelegate< R(Param1, Param2, Param3, Param4, Param5, Param6) >
+		// Inherit from FastDelegate6 so that it can be treated just like a FastDelegate6
+		: public FastDelegate6 < Param1, Param2, Param3, Param4, Param5, Param6, R >
+	{
+	public:
+		// Make using the base type a bit easier via typedef.
+		typedef FastDelegate6 < Param1, Param2, Param3, Param4, Param5, Param6, R > BaseType;
+
+		// Allow users access to the specific type of this delegate.
+		typedef FastDelegate SelfType;
+
+		// Mimic the base class constructors.
+		FastDelegate() : BaseType() {}
+
+		template < class X, class Y >
+		FastDelegate(Y* pthis,
+			R(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6))
+			: BaseType(pthis, function_to_bind) {
+		}
+
+		template < class X, class Y >
+		FastDelegate(const Y* pthis,
+			R(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const)
+			: BaseType(pthis, function_to_bind)
+		{
+		}
+
+		FastDelegate(R(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6))
+			: BaseType(function_to_bind) {
+		}
+		void operator = (const BaseType& x) {
+			*static_cast<BaseType*>(this) = x;
+		}
+	};
+
+	//N=7
+	// Specialization to allow use of
+	// FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7 ) >
+	// instead of 
+	// FastDelegate7 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, R >
+	template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7>
+	class FastDelegate< R(Param1, Param2, Param3, Param4, Param5, Param6, Param7) >
+		// Inherit from FastDelegate7 so that it can be treated just like a FastDelegate7
+		: public FastDelegate7 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, R >
+	{
+	public:
+		// Make using the base type a bit easier via typedef.
+		typedef FastDelegate7 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, R > BaseType;
+
+		// Allow users access to the specific type of this delegate.
+		typedef FastDelegate SelfType;
+
+		// Mimic the base class constructors.
+		FastDelegate() : BaseType() {}
+
+		template < class X, class Y >
+		FastDelegate(Y* pthis,
+			R(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7))
+			: BaseType(pthis, function_to_bind) {
+		}
+
+		template < class X, class Y >
+		FastDelegate(const Y* pthis,
+			R(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const)
+			: BaseType(pthis, function_to_bind)
+		{
+		}
+
+		FastDelegate(R(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7))
+			: BaseType(function_to_bind) {
+		}
+		void operator = (const BaseType& x) {
+			*static_cast<BaseType*>(this) = x;
+		}
+	};
+
+	//N=8
+	// Specialization to allow use of
+	// FastDelegate< R ( Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8 ) >
+	// instead of 
+	// FastDelegate8 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, R >
+	template<typename R, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8>
+	class FastDelegate< R(Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8) >
+		// Inherit from FastDelegate8 so that it can be treated just like a FastDelegate8
+		: public FastDelegate8 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, R >
+	{
+	public:
+		// Make using the base type a bit easier via typedef.
+		typedef FastDelegate8 < Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, R > BaseType;
+
+		// Allow users access to the specific type of this delegate.
+		typedef FastDelegate SelfType;
+
+		// Mimic the base class constructors.
+		FastDelegate() : BaseType() {}
+
+		template < class X, class Y >
+		FastDelegate(Y* pthis,
+			R(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8))
+			: BaseType(pthis, function_to_bind) {
+		}
+
+		template < class X, class Y >
+		FastDelegate(const Y* pthis,
+			R(X::* function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const)
+			: BaseType(pthis, function_to_bind)
+		{
+		}
+
+		FastDelegate(R(*function_to_bind)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8))
+			: BaseType(function_to_bind) {
+		}
+		void operator = (const BaseType& x) {
+			*static_cast<BaseType*>(this) = x;
+		}
+	};
+
+
+#endif //FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
+
+	////////////////////////////////////////////////////////////////////////////////
+	//						Fast Delegates, part 5:
+	//
+	//				MakeDelegate() helper function
+	//
+	//			MakeDelegate(&x, &X::func) returns a fastdelegate of the type
+	//			necessary for calling x.func() with the correct number of arguments.
+	//			This makes it possible to eliminate many typedefs from user code.
+	//
+	////////////////////////////////////////////////////////////////////////////////
+
+	// Also declare overloads of a MakeDelegate() global function to 
+	// reduce the need for typedefs.
+	// We need seperate overloads for const and non-const member functions.
+	// Also, because of the weird rule about the class of derived member function pointers,
+	// implicit downcasts may need to be applied later to the 'this' pointer.
+	// That's why two classes (X and Y) appear in the definitions. Y must be implicitly
+	// castable to X.
+
+	// Workaround for VC6. VC6 needs void return types converted into DefaultVoid.
+	// GCC 3.2 and later won't compile this unless it's preceded by 'typename',
+	// but VC6 doesn't allow 'typename' in this context.
+	// So, I have to use a macro.
+
+#ifdef FASTDLGT_VC6
+#define FASTDLGT_RETTYPE detail::VoidToDefaultVoid<RetType>::type
+#else 
+#define FASTDLGT_RETTYPE RetType
+#endif
+
+//N=0
+	template <class X, class Y, class RetType>
+	FastDelegate0<FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType(X::* func)()) {
+		return FastDelegate0<FASTDLGT_RETTYPE>(x, func);
+	}
+
+	template <class X, class Y, class RetType>
+	FastDelegate0<FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType(X::* func)() const) {
+		return FastDelegate0<FASTDLGT_RETTYPE>(x, func);
+	}
+
+	//N=1
+	template <class X, class Y, class Param1, class RetType>
+	FastDelegate1<Param1, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType(X::* func)(Param1 p1)) {
+		return FastDelegate1<Param1, FASTDLGT_RETTYPE>(x, func);
+	}
+
+	template <class X, class Y, class Param1, class RetType>
+	FastDelegate1<Param1, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType(X::* func)(Param1 p1) const) {
+		return FastDelegate1<Param1, FASTDLGT_RETTYPE>(x, func);
+	}
+
+	//N=2
+	template <class X, class Y, class Param1, class Param2, class RetType>
+	FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType(X::* func)(Param1 p1, Param2 p2)) {
+		return FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE>(x, func);
+	}
+
+	template <class X, class Y, class Param1, class Param2, class RetType>
+	FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType(X::* func)(Param1 p1, Param2 p2) const) {
+		return FastDelegate2<Param1, Param2, FASTDLGT_RETTYPE>(x, func);
+	}
+
+	//N=3
+	template <class X, class Y, class Param1, class Param2, class Param3, class RetType>
+	FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3)) {
+		return FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE>(x, func);
+	}
+
+	template <class X, class Y, class Param1, class Param2, class Param3, class RetType>
+	FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3) const) {
+		return FastDelegate3<Param1, Param2, Param3, FASTDLGT_RETTYPE>(x, func);
+	}
+
+	//N=4
+	template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class RetType>
+	FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4)) {
+		return FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE>(x, func);
+	}
+
+	template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class RetType>
+	FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const) {
+		return FastDelegate4<Param1, Param2, Param3, Param4, FASTDLGT_RETTYPE>(x, func);
+	}
+
+	//N=5
+	template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class RetType>
+	FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5)) {
+		return FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE>(x, func);
+	}
+
+	template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class RetType>
+	FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const) {
+		return FastDelegate5<Param1, Param2, Param3, Param4, Param5, FASTDLGT_RETTYPE>(x, func);
+	}
+
+	//N=6
+	template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class RetType>
+	FastDelegate6<Param1, Param2, Param3, Param4, Param5, Param6, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6)) {
+		return FastDelegate6<Param1, Param2, Param3, Param4, Param5, Param6, FASTDLGT_RETTYPE>(x, func);
+	}
+
+	template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class RetType>
+	FastDelegate6<Param1, Param2, Param3, Param4, Param5, Param6, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const) {
+		return FastDelegate6<Param1, Param2, Param3, Param4, Param5, Param6, FASTDLGT_RETTYPE>(x, func);
+	}
+
+	//N=7
+	template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class RetType>
+	FastDelegate7<Param1, Param2, Param3, Param4, Param5, Param6, Param7, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7)) {
+		return FastDelegate7<Param1, Param2, Param3, Param4, Param5, Param6, Param7, FASTDLGT_RETTYPE>(x, func);
+	}
+
+	template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class RetType>
+	FastDelegate7<Param1, Param2, Param3, Param4, Param5, Param6, Param7, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const) {
+		return FastDelegate7<Param1, Param2, Param3, Param4, Param5, Param6, Param7, FASTDLGT_RETTYPE>(x, func);
+	}
+
+	//N=8
+	template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class RetType>
+	FastDelegate8<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8)) {
+		return FastDelegate8<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, FASTDLGT_RETTYPE>(x, func);
+	}
+
+	template <class X, class Y, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8, class RetType>
+	FastDelegate8<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, FASTDLGT_RETTYPE> MakeDelegate(Y* x, RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const) {
+		return FastDelegate8<Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, FASTDLGT_RETTYPE>(x, func);
+	}
+
+
+	// clean up after ourselves...
+#undef FASTDLGT_RETTYPE
+
+} // namespace fastdelegate
+
+#endif // !defined(FASTDELEGATE_H)
+

+ 241 - 0
C++ Delegates/C++ Delegates/FastDelegateBind.h

@@ -0,0 +1,241 @@
+#pragma once
+//						FastDelegateBind.h 
+//  Helper file for FastDelegates. Provides bind() function, enabling
+//  FastDelegates to be rapidly compared to programs using boost::function and boost::bind.
+//
+//  Documentation is found at http://www.codeproject.com/cpp/FastDelegate.asp
+//
+//		Original author: Jody Hagins.
+//		 Minor changes by Don Clugston.
+//
+// Warning: The arguments to 'bind' are ignored! No actual binding is performed.
+// The behaviour is equivalent to boost::bind only when the basic placeholder 
+// arguments _1, _2, _3, etc are used in order.
+//
+// HISTORY:
+//	1.4 Dec 2004. Initial release as part of FastDelegate 1.4.
+
+
+#ifndef FASTDELEGATEBIND_H
+#define FASTDELEGATEBIND_H
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+////////////////////////////////////////////////////////////////////////////////
+//						FastDelegate bind()
+//
+//				bind() helper function for boost compatibility.
+//				(Original author: Jody Hagins).
+//
+// Add another helper, so FastDelegate can be a dropin replacement
+// for boost::bind (in a fair number of cases).
+// Note the elipses, because boost::bind() takes place holders
+// but FastDelegate does not care about them.  Getting the place holder
+// mechanism to work, and play well with boost is a bit tricky, so
+// we do the "easy" thing...
+// Assume we have the following code...
+//      using boost::bind;
+//      bind(&Foo:func, &foo, _1, _2);
+// we should be able to replace the "using" with...
+//      using fastdelegate::bind;
+// and everything should work fine...
+////////////////////////////////////////////////////////////////////////////////
+
+#ifdef FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
+
+namespace fastdelegate {
+
+    //N=0
+    template <class X, class Y, class RetType>
+    FastDelegate< RetType() >
+        bind(
+            RetType(X::* func)(),
+            Y* y,
+            ...)
+    {
+        return FastDelegate< RetType() >(y, func);
+    }
+
+    template <class X, class Y, class RetType>
+    FastDelegate< RetType() >
+        bind(
+            RetType(X::* func)() const,
+            Y* y,
+            ...)
+    {
+        return FastDelegate< RetType() >(y, func);
+    }
+
+    //N=1
+    template <class X, class Y, class RetType, class Param1>
+    FastDelegate< RetType(Param1 p1) >
+        bind(
+            RetType(X::* func)(Param1 p1),
+            Y* y,
+            ...)
+    {
+        return FastDelegate< RetType(Param1 p1) >(y, func);
+    }
+
+    template <class X, class Y, class RetType, class Param1>
+    FastDelegate< RetType(Param1 p1) >
+        bind(
+            RetType(X::* func)(Param1 p1) const,
+            Y* y,
+            ...)
+    {
+        return FastDelegate< RetType(Param1 p1) >(y, func);
+    }
+
+    //N=2
+    template <class X, class Y, class RetType, class Param1, class Param2>
+    FastDelegate< RetType(Param1 p1, Param2 p2) >
+        bind(
+            RetType(X::* func)(Param1 p1, Param2 p2),
+            Y* y,
+            ...)
+    {
+        return FastDelegate< RetType(Param1 p1, Param2 p2) >(y, func);
+    }
+
+    template <class X, class Y, class RetType, class Param1, class Param2>
+    FastDelegate< RetType(Param1 p1, Param2 p2) >
+        bind(
+            RetType(X::* func)(Param1 p1, Param2 p2) const,
+            Y* y,
+            ...)
+    {
+        return FastDelegate< RetType(Param1 p1, Param2 p2) >(y, func);
+    }
+
+    //N=3
+    template <class X, class Y, class RetType, class Param1, class Param2, class Param3>
+    FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3) >
+        bind(
+            RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3),
+            Y* y,
+            ...)
+    {
+        return FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3) >(y, func);
+    }
+
+    template <class X, class Y, class RetType, class Param1, class Param2, class Param3>
+    FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3) >
+        bind(
+            RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3) const,
+            Y* y,
+            ...)
+    {
+        return FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3) >(y, func);
+    }
+
+    //N=4
+    template <class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4>
+    FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3, Param4 p4) >
+        bind(
+            RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4),
+            Y* y,
+            ...)
+    {
+        return FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3, Param4 p4) >(y, func);
+    }
+
+    template <class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4>
+    FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3, Param4 p4) >
+        bind(
+            RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4) const,
+            Y* y,
+            ...)
+    {
+        return FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3, Param4 p4) >(y, func);
+    }
+
+    //N=5
+    template <class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5>
+    FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) >
+        bind(
+            RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5),
+            Y* y,
+            ...)
+    {
+        return FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) >(y, func);
+    }
+
+    template <class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5>
+    FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) >
+        bind(
+            RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) const,
+            Y* y,
+            ...)
+    {
+        return FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5) >(y, func);
+    }
+
+    //N=6
+    template <class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6>
+    FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) >
+        bind(
+            RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6),
+            Y* y,
+            ...)
+    {
+        return FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) >(y, func);
+    }
+
+    template <class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6>
+    FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) >
+        bind(
+            RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) const,
+            Y* y,
+            ...)
+    {
+        return FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6) >(y, func);
+    }
+
+    //N=7
+    template <class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7>
+    FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) >
+        bind(
+            RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7),
+            Y* y,
+            ...)
+    {
+        return FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) >(y, func);
+    }
+
+    template <class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7>
+    FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) >
+        bind(
+            RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) const,
+            Y* y,
+            ...)
+    {
+        return FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7) >(y, func);
+    }
+
+    //N=8
+    template <class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8>
+    FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) >
+        bind(
+            RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8),
+            Y* y,
+            ...)
+    {
+        return FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) >(y, func);
+    }
+
+    template <class X, class Y, class RetType, class Param1, class Param2, class Param3, class Param4, class Param5, class Param6, class Param7, class Param8>
+    FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) >
+        bind(
+            RetType(X::* func)(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) const,
+            Y* y,
+            ...)
+    {
+        return FastDelegate< RetType(Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8) >(y, func);
+    }
+} // namespace fastdelegate
+
+#endif //FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX
+#endif // !defined(FASTDELEGATEBIND_H)
+

BIN
C++ Delegates/C++ Delegates/fastdelegate_hopter.zip


BIN
C++ Delegates/C++ Delegates/fastdelegate_src.zip


+ 186 - 0
C++ Delegates/C++ Delegates/main.cpp

@@ -0,0 +1,186 @@
+// Member Function Pointers and the Fastest Possible C++ Delegates.cpp : This file contains the 'main' function. Program execution begins and ends there.
+// https://www.codeproject.com/KB/cpp/FastDelegate.aspx
+
+/*
+	
+
+*/
+
+
+
+
+#include <iostream>
+#include <stdio.h>
+#include "FastDelegate.h"
+// Demonstrate the syntax for FastDelegates.
+//				-Don Clugston, May 2004.
+// It's a really boring example, but it shows the most important cases.
+
+// Declare some functions of varying complexity...
+void SimpleStaticFunction(int num, char* str) {
+	printf("In SimpleStaticFunction. Num=%d, str = %s\n", num, str);
+}
+
+void SimpleVoidFunction() {
+	printf("In SimpleVoidFunction with no parameters.\n");
+}
+
+class CBaseClass {
+protected:
+	char* m_name;
+public:
+	CBaseClass(char* name) : m_name(name) {};
+	void SimpleMemberFunction(int num, char* str) {
+		printf("In SimpleMemberFunction in %s. Num=%d, str = %s\n", m_name, num, str);
+	}
+	int SimpleMemberFunctionReturnsInt(int num, char* str) {
+		printf("In SimpleMemberFunction in %s. Num=%d, str = %s Return: -1\n", m_name, num, str); return -2;
+	}
+	void ConstMemberFunction(int num, char* str) const {
+		printf("In ConstMemberFunction in %s. Num=%d, str = %s\n", m_name, num, str);
+	}
+	virtual void SimpleVirtualFunction(int num, char* str) {
+		printf("In SimpleVirtualFunction in %s. Num=%d, str = %s\n", m_name, num, str);
+	}
+	static void StaticMemberFunction(int num, char* str) {
+		printf("In StaticMemberFunction. Num=%d, str =%s\n", num, str);
+	}
+};
+
+class COtherClass {
+	double rubbish = 12; // to ensure this class has non-zero size.
+public:
+	virtual void UnusedVirtualFunction(void) {}
+	virtual void TrickyVirtualFunction(int num, char* str) = 0;
+};
+
+class VeryBigClass {
+	int letsMakeThingsComplicated[400];
+};
+
+// This declaration ensures that we get a convoluted class heirarchy.
+class CDerivedClass : public VeryBigClass, virtual public COtherClass, virtual public CBaseClass
+{
+	double m_somemember[8];
+public:
+	CDerivedClass() : CBaseClass((char*)"Base of Derived") { m_somemember[0] = 1.2345; }
+	void SimpleDerivedFunction(int num, char* str) { printf("In SimpleDerived. num=%d\n", num); }
+	virtual void AnotherUnusedVirtualFunction(int num, char* str) {}
+	virtual void TrickyVirtualFunction(int num, char* str) {
+		printf("In Derived TrickyMemberFunction. Num=%d, str = %s\n", num, str);
+	}
+};
+
+using namespace fastdelegate;
+
+int main(void)
+{
+	// Delegates with up to 8 parameters are supported.
+	// Here's the case for a void function.
+	// We declare a delegate and attach it to SimpleVoidFunction()
+	printf("-- FastDelegate demo --\nA no-parameter delegate is declared using FastDelegate0\n\n");
+
+	FastDelegate0<> noparameterdelegate(&SimpleVoidFunction);
+
+	noparameterdelegate(); // invoke the delegate - this calls SimpleVoidFunction()
+
+	printf("\n-- Examples using two-parameter delegates (int, char *) --\n\n");
+
+	// By default, the return value is void.
+	typedef FastDelegate2<int, char*> MyDelegate;
+
+	// If you want to have a non-void return value, put it at the end.
+	typedef FastDelegate2<int, char*, int> IntMyDelegate;
+
+
+	MyDelegate funclist[12]; // delegates are initialized to empty
+	CBaseClass a((char*)"Base A");
+	CBaseClass b((char*)"Base B");
+	CDerivedClass d;
+	CDerivedClass c;
+
+	IntMyDelegate newdeleg;
+	newdeleg = MakeDelegate(&a, &CBaseClass::SimpleMemberFunctionReturnsInt);
+	printf("Return value: %d\n", newdeleg(0, (char*)"return value"));
+
+	// Binding a simple member function
+	funclist[0].bind(&a, &CBaseClass::SimpleMemberFunction);
+
+	// You can also bind static (free) functions
+	funclist[1].bind(&SimpleStaticFunction);
+	// and static member functions
+	funclist[2].bind(&CBaseClass::StaticMemberFunction);
+	// and const member functions (these only need a const class pointer).		 
+	funclist[11].bind((const CBaseClass*)&a, &CBaseClass::ConstMemberFunction);
+	funclist[3].bind(&a, &CBaseClass::ConstMemberFunction);
+	// and virtual member functions
+	funclist[4].bind(&b, &CBaseClass::SimpleVirtualFunction);
+
+	// You can also use the = operator. For static functions, a fastdelegate
+	// looks identical to a simple function pointer.
+	funclist[5] = &CBaseClass::StaticMemberFunction;
+
+	// The weird rule about the class of derived member function pointers is avoided.
+	// For MSVC, you can use &CDerivedClass::SimpleVirtualFunction here, but DMC will complain.
+	// Note that as well as .bind(), you can also use the MakeDelegate()
+	// global function.
+	funclist[6] = MakeDelegate(&d, &CBaseClass::SimpleVirtualFunction);
+
+	// The worst case is an abstract virtual function of a virtually-derived class
+	// with at least one non-virtual base class. This is a VERY obscure situation,
+	// which you're unlikely to encounter in the real world.
+	// FastDelegate versions prior to 1.3 had problems with this case on VC6.
+	// Now, it works without problems on all compilers.
+	funclist[7].bind(&c, &CDerivedClass::TrickyVirtualFunction);
+	// BUT... in such cases you should be using the base class as an 
+	// interface, anyway.
+	funclist[8].bind(&c, &COtherClass::TrickyVirtualFunction);
+	// Calling a function that was first declared in the derived class is straightforward
+	funclist[9] = MakeDelegate(&c, &CDerivedClass::SimpleDerivedFunction);
+
+	// You can also bind directly using the constructor
+	MyDelegate dg(&b, &CBaseClass::SimpleVirtualFunction);
+
+	char* msg = (char*)"Looking for equal delegate";
+	for (int i = 0; i < 12; i++) {
+		printf("%d :", i);
+		// The == and != operators are provided
+		// Note that they work even for inline functions.
+		if (funclist[i] == dg) { msg = (char*)"Found equal delegate"; };
+		// operator ! can be used to test for an empty delegate
+		// You can also use the .empty() member function.
+		if (!funclist[i]) {
+			printf("Delegate is empty\n");
+		}
+		else {
+			// Invocation generates optimal assembly code.
+			funclist[i](i, msg);
+		};
+	}
+	return 0;
+}
+
+/*
+	-- FastDelegate demo --
+A no-parameter delegate is declared using FastDelegate0
+
+In SimpleVoidFunction with no parameters.
+
+-- Examples using two-parameter delegates (int, char *) --
+
+In SimpleMemberFunction in Base A. Num=0, str = return value Return: -1
+Return value: -2
+0 :In SimpleMemberFunction in Base A. Num=0, str = Looking for equal delegate
+1 :In SimpleStaticFunction. Num=1, str = Looking for equal delegate
+2 :In StaticMemberFunction. Num=2, str =Looking for equal delegate
+3 :In ConstMemberFunction in Base A. Num=3, str = Looking for equal delegate
+4 :In SimpleVirtualFunction in Base B. Num=4, str = Found equal delegate
+5 :In StaticMemberFunction. Num=5, str =Found equal delegate
+6 :In SimpleVirtualFunction in Base of Derived. Num=6, str = Found equal delegate
+7 :In Derived TrickyMemberFunction. Num=7, str = Found equal delegate
+8 :In Derived TrickyMemberFunction. Num=8, str = Found equal delegate
+9 :In SimpleDerived. num=9
+10 :Delegate is empty
+11 :In ConstMemberFunction in Base A. Num=11, str = Found equal delegate
+
+*/

+ 11 - 0
C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.exe.recipe

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project>
+  <ProjectOutputs>
+    <ProjectOutput>
+      <FullPath>C:\Users\sfreunde\source\repos\C++ Delegates\x64\Debug\C++ Delegates.exe</FullPath>
+    </ProjectOutput>
+  </ProjectOutputs>
+  <ContentFiles />
+  <SatelliteDlls />
+  <NonRecipeFileRefs />
+</Project>

BIN
C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.ilk


+ 2 - 0
C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.log

@@ -0,0 +1,2 @@
+  main.cpp
+  C++ Delegates.vcxproj -> C:\Users\sfreunde\source\repos\C++ Delegates\x64\Debug\C++ Delegates.exe

BIN
C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.obj


+ 2 - 0
C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.tlog/C++ Delegates.lastbuildstate

@@ -0,0 +1,2 @@
+PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.43.34808:TargetPlatformVersion=10.0.22621.0:
+Debug|x64|C:\Users\sfreunde\source\repos\C++ Delegates\|

BIN
C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.tlog/CL.command.1.tlog


BIN
C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.tlog/CL.read.1.tlog


BIN
C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.tlog/CL.write.1.tlog


+ 1 - 0
C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.tlog/Cl.items.tlog

@@ -0,0 +1 @@
+C:\Users\sfreunde\source\repos\C++ Delegates\C++ Delegates\main.cpp;C:\Users\sfreunde\source\repos\C++ Delegates\C++ Delegates\x64\Debug\main.obj

BIN
C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.tlog/link.command.1.tlog


BIN
C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.tlog/link.read.1.tlog


+ 2 - 0
C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.tlog/link.secondary.1.tlog

@@ -0,0 +1,2 @@
+^C:\USERS\SFREUNDE\SOURCE\REPOS\C++ DELEGATES\C++ DELEGATES\X64\DEBUG\MAIN.OBJ
+C:\Users\sfreunde\source\repos\C++ Delegates\C++ Delegates\x64\Debug\C++ Delegates.ilk

BIN
C++ Delegates/C++ Delegates/x64/Debug/C++ Delegates.tlog/link.write.1.tlog


BIN
C++ Delegates/C++ Delegates/x64/Debug/main.obj


BIN
C++ Delegates/C++ Delegates/x64/Debug/vc143.idb


BIN
C++ Delegates/C++ Delegates/x64/Debug/vc143.pdb


BIN
C++ Delegates/x64/Debug/C++ Delegates.exe


BIN
C++ Delegates/x64/Debug/C++ Delegates.pdb


BIN
CPP-Signal-Bus/.vs/CPP-Signal-Bus/FileContentIndex/c7e0473a-c3da-4659-9d2a-def3aa0d8bd1.vsidx


BIN
CPP-Signal-Bus/.vs/CPP-Signal-Bus/FileContentIndex/c9b88735-7e49-4762-8d0c-620311cca80f.vsidx


BIN
CPP-Signal-Bus/.vs/CPP-Signal-Bus/FileContentIndex/edbaba08-cb9d-4978-92f6-71e9134bb372.vsidx


BIN
CPP-Signal-Bus/.vs/CPP-Signal-Bus/FileContentIndex/fae28d0f-60a2-43bc-952d-ca6ba1575d7e.vsidx


BIN
CPP-Signal-Bus/.vs/CPP-Signal-Bus/v17/.suo


BIN
CPP-Signal-Bus/.vs/CPP-Signal-Bus/v17/Browse.VC.db


+ 173 - 0
CPP-Signal-Bus/.vs/CPP-Signal-Bus/v17/DocumentLayout.backup.json

@@ -0,0 +1,173 @@
+{
+  "Version": 1,
+  "WorkspaceRootPath": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\",
+  "Documents": [
+    {
+      "AbsoluteMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|solutionrelative:CPP-Signal-Bus\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionRequest.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|solutionrelative:CPP-Signal-Bus\\ActionRequest.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\SignalHandler.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|solutionrelative:CPP-Signal-Bus\\SignalHandler.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\SignalEvent.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|solutionrelative:CPP-Signal-Bus\\SignalEvent.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\SignalBus.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|solutionrelative:CPP-Signal-Bus\\SignalBus.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionResult.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|solutionrelative:CPP-Signal-Bus\\ActionResult.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionRequest.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|solutionrelative:CPP-Signal-Bus\\ActionRequest.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionManager.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|solutionrelative:CPP-Signal-Bus\\ActionManager.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|C:\\USERS\\SFREUNDE\\SOURCE\\REPOS\\CPP-SIGNAL-BUS\\CPP-SIGNAL-BUS\\MYHELPER.CPP||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|solutionrelative:CPP-SIGNAL-BUS\\MYHELPER.CPP||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    }
+  ],
+  "DocumentGroupContainers": [
+    {
+      "Orientation": 0,
+      "VerticalTabListWidth": 256,
+      "DocumentGroups": [
+        {
+          "DockedWidth": 200,
+          "SelectedChildIndex": 8,
+          "Children": [
+            {
+              "$type": "Document",
+              "DocumentIndex": 1,
+              "Title": "ActionRequest.cpp",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionRequest.cpp",
+              "RelativeDocumentMoniker": "CPP-Signal-Bus\\ActionRequest.cpp",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionRequest.cpp",
+              "RelativeToolTip": "CPP-Signal-Bus\\ActionRequest.cpp",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAAYAAAAKAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
+              "WhenOpened": "2025-04-29T15:33:00.519Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 2,
+              "Title": "SignalHandler.cpp",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\SignalHandler.cpp",
+              "RelativeDocumentMoniker": "CPP-Signal-Bus\\SignalHandler.cpp",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\SignalHandler.cpp",
+              "RelativeToolTip": "CPP-Signal-Bus\\SignalHandler.cpp",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAAQAAAAKAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
+              "WhenOpened": "2025-04-29T15:32:44.148Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 3,
+              "Title": "SignalEvent.cpp",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\SignalEvent.cpp",
+              "RelativeDocumentMoniker": "CPP-Signal-Bus\\SignalEvent.cpp",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\SignalEvent.cpp",
+              "RelativeToolTip": "CPP-Signal-Bus\\SignalEvent.cpp",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAAQAAAAKAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
+              "WhenOpened": "2025-04-29T15:32:36.118Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 4,
+              "Title": "SignalBus.cpp",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\SignalBus.cpp",
+              "RelativeDocumentMoniker": "CPP-Signal-Bus\\SignalBus.cpp",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\SignalBus.cpp",
+              "RelativeToolTip": "CPP-Signal-Bus\\SignalBus.cpp",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAAQAAAAKAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
+              "WhenOpened": "2025-04-29T15:32:09.341Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 5,
+              "Title": "ActionResult.h",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionResult.h",
+              "RelativeDocumentMoniker": "CPP-Signal-Bus\\ActionResult.h",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionResult.h",
+              "RelativeToolTip": "CPP-Signal-Bus\\ActionResult.h",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAA4AAAAJAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
+              "WhenOpened": "2025-04-29T15:31:52.594Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 6,
+              "Title": "ActionRequest.h",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionRequest.h",
+              "RelativeDocumentMoniker": "CPP-Signal-Bus\\ActionRequest.h",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionRequest.h",
+              "RelativeToolTip": "CPP-Signal-Bus\\ActionRequest.h",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAA4AAAAJAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
+              "WhenOpened": "2025-04-29T15:31:42.553Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 7,
+              "Title": "ActionManager.h",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionManager.h",
+              "RelativeDocumentMoniker": "CPP-Signal-Bus\\ActionManager.h",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionManager.h",
+              "RelativeToolTip": "CPP-Signal-Bus\\ActionManager.h",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAA8AAAAJAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
+              "WhenOpened": "2025-04-29T15:31:18.491Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 8,
+              "Title": "myHelper.cpp",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\myHelper.cpp",
+              "RelativeDocumentMoniker": "CPP-Signal-Bus\\myHelper.cpp",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\myHelper.cpp",
+              "RelativeToolTip": "CPP-Signal-Bus\\myHelper.cpp",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
+              "WhenOpened": "2025-04-29T15:24:26.555Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 0,
+              "Title": "main.cpp",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\main.cpp",
+              "RelativeDocumentMoniker": "CPP-Signal-Bus\\main.cpp",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\main.cpp*",
+              "RelativeToolTip": "CPP-Signal-Bus\\main.cpp*",
+              "ViewState": "AgIAACcAAAAAAAAAAAAAADEAAAAAAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
+              "WhenOpened": "2025-04-29T15:14:45.387Z",
+              "EditorCaption": ""
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}

+ 173 - 0
CPP-Signal-Bus/.vs/CPP-Signal-Bus/v17/DocumentLayout.json

@@ -0,0 +1,173 @@
+{
+  "Version": 1,
+  "WorkspaceRootPath": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\",
+  "Documents": [
+    {
+      "AbsoluteMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|solutionrelative:CPP-Signal-Bus\\main.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionRequest.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|solutionrelative:CPP-Signal-Bus\\ActionRequest.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\SignalHandler.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|solutionrelative:CPP-Signal-Bus\\SignalHandler.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\SignalEvent.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|solutionrelative:CPP-Signal-Bus\\SignalEvent.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\SignalBus.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|solutionrelative:CPP-Signal-Bus\\SignalBus.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionResult.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|solutionrelative:CPP-Signal-Bus\\ActionResult.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionRequest.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|solutionrelative:CPP-Signal-Bus\\ActionRequest.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionManager.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|solutionrelative:CPP-Signal-Bus\\ActionManager.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    },
+    {
+      "AbsoluteMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|C:\\USERS\\SFREUNDE\\SOURCE\\REPOS\\CPP-SIGNAL-BUS\\CPP-SIGNAL-BUS\\MYHELPER.CPP||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
+      "RelativeMoniker": "D:0:0:{2397DB77-CCB5-42EC-A094-802CCC42A37B}|CPP-Signal-Bus\\CPP-Signal-Bus.vcxproj|solutionrelative:CPP-SIGNAL-BUS\\MYHELPER.CPP||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
+    }
+  ],
+  "DocumentGroupContainers": [
+    {
+      "Orientation": 0,
+      "VerticalTabListWidth": 256,
+      "DocumentGroups": [
+        {
+          "DockedWidth": 200,
+          "SelectedChildIndex": 8,
+          "Children": [
+            {
+              "$type": "Document",
+              "DocumentIndex": 1,
+              "Title": "ActionRequest.cpp",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionRequest.cpp",
+              "RelativeDocumentMoniker": "CPP-Signal-Bus\\ActionRequest.cpp",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionRequest.cpp",
+              "RelativeToolTip": "CPP-Signal-Bus\\ActionRequest.cpp",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAAYAAAAKAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
+              "WhenOpened": "2025-04-29T15:33:00.519Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 2,
+              "Title": "SignalHandler.cpp",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\SignalHandler.cpp",
+              "RelativeDocumentMoniker": "CPP-Signal-Bus\\SignalHandler.cpp",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\SignalHandler.cpp",
+              "RelativeToolTip": "CPP-Signal-Bus\\SignalHandler.cpp",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAAQAAAAKAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
+              "WhenOpened": "2025-04-29T15:32:44.148Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 3,
+              "Title": "SignalEvent.cpp",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\SignalEvent.cpp",
+              "RelativeDocumentMoniker": "CPP-Signal-Bus\\SignalEvent.cpp",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\SignalEvent.cpp",
+              "RelativeToolTip": "CPP-Signal-Bus\\SignalEvent.cpp",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAAQAAAAKAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
+              "WhenOpened": "2025-04-29T15:32:36.118Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 4,
+              "Title": "SignalBus.cpp",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\SignalBus.cpp",
+              "RelativeDocumentMoniker": "CPP-Signal-Bus\\SignalBus.cpp",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\SignalBus.cpp",
+              "RelativeToolTip": "CPP-Signal-Bus\\SignalBus.cpp",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAAQAAAAKAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
+              "WhenOpened": "2025-04-29T15:32:09.341Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 5,
+              "Title": "ActionResult.h",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionResult.h",
+              "RelativeDocumentMoniker": "CPP-Signal-Bus\\ActionResult.h",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionResult.h",
+              "RelativeToolTip": "CPP-Signal-Bus\\ActionResult.h",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAA4AAAAJAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
+              "WhenOpened": "2025-04-29T15:31:52.594Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 6,
+              "Title": "ActionRequest.h",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionRequest.h",
+              "RelativeDocumentMoniker": "CPP-Signal-Bus\\ActionRequest.h",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionRequest.h",
+              "RelativeToolTip": "CPP-Signal-Bus\\ActionRequest.h",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAA4AAAAJAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
+              "WhenOpened": "2025-04-29T15:31:42.553Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 7,
+              "Title": "ActionManager.h",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionManager.h",
+              "RelativeDocumentMoniker": "CPP-Signal-Bus\\ActionManager.h",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\ActionManager.h",
+              "RelativeToolTip": "CPP-Signal-Bus\\ActionManager.h",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAA8AAAAJAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
+              "WhenOpened": "2025-04-29T15:31:18.491Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 8,
+              "Title": "myHelper.cpp",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\myHelper.cpp",
+              "RelativeDocumentMoniker": "CPP-Signal-Bus\\myHelper.cpp",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\myHelper.cpp",
+              "RelativeToolTip": "CPP-Signal-Bus\\myHelper.cpp",
+              "ViewState": "AgIAAAAAAAAAAAAAAAAAAA0AAAAAAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
+              "WhenOpened": "2025-04-29T15:24:26.555Z",
+              "EditorCaption": ""
+            },
+            {
+              "$type": "Document",
+              "DocumentIndex": 0,
+              "Title": "main.cpp",
+              "DocumentMoniker": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\main.cpp",
+              "RelativeDocumentMoniker": "CPP-Signal-Bus\\main.cpp",
+              "ToolTip": "C:\\Users\\sfreunde\\source\\repos\\CPP-Signal-Bus\\CPP-Signal-Bus\\main.cpp",
+              "RelativeToolTip": "CPP-Signal-Bus\\main.cpp",
+              "ViewState": "AgIAACcAAAAAAAAAAAAAAEgAAAAbAAAAAAAAAA==",
+              "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
+              "WhenOpened": "2025-04-29T15:14:45.387Z",
+              "EditorCaption": ""
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}

BIN
CPP-Signal-Bus/.vs/CPP-Signal-Bus/v17/ipch/AutoPCH/3cfdd7f574f50aea/MYHELPER.ipch


BIN
CPP-Signal-Bus/.vs/CPP-Signal-Bus/v17/ipch/AutoPCH/886d547eae9944c3/CPP-SIGNAL-BUS.ipch


+ 31 - 0
CPP-Signal-Bus/CPP-Signal-Bus.sln

@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.13.35931.197 d17.13
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CPP-Signal-Bus", "CPP-Signal-Bus\CPP-Signal-Bus.vcxproj", "{2397DB77-CCB5-42EC-A094-802CCC42A37B}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x64 = Debug|x64
+		Debug|x86 = Debug|x86
+		Release|x64 = Release|x64
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{2397DB77-CCB5-42EC-A094-802CCC42A37B}.Debug|x64.ActiveCfg = Debug|x64
+		{2397DB77-CCB5-42EC-A094-802CCC42A37B}.Debug|x64.Build.0 = Debug|x64
+		{2397DB77-CCB5-42EC-A094-802CCC42A37B}.Debug|x86.ActiveCfg = Debug|Win32
+		{2397DB77-CCB5-42EC-A094-802CCC42A37B}.Debug|x86.Build.0 = Debug|Win32
+		{2397DB77-CCB5-42EC-A094-802CCC42A37B}.Release|x64.ActiveCfg = Release|x64
+		{2397DB77-CCB5-42EC-A094-802CCC42A37B}.Release|x64.Build.0 = Release|x64
+		{2397DB77-CCB5-42EC-A094-802CCC42A37B}.Release|x86.ActiveCfg = Release|Win32
+		{2397DB77-CCB5-42EC-A094-802CCC42A37B}.Release|x86.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {A7D882E9-23E7-495F-A7CD-10C42894837E}
+	EndGlobalSection
+EndGlobal

+ 229 - 0
CPP-Signal-Bus/CPP-Signal-Bus/ActionManager.cpp

@@ -0,0 +1,229 @@
+#ifndef ACTIONMANAGER_CPP
+#define ACTIONMANAGER_CPP
+
+#include <random>
+
+#include "ActionManager.h"
+
+// #include "ActionRequest.h"
+// #include "ActionResult.h"
+
+using namespace std;
+
+static int getRandomInt(int a, int b){
+    int max, min;
+    if(a>b){
+        max = a; min = b;
+    }else{
+        max = b; min = a;
+    }
+    random_device rd;
+    mt19937 gen(rd());
+    uniform_real_distribution<double> distr(min, max);
+
+    return (int) distr(gen);
+}
+static string randomString(int len = 9) {
+    const char alphanum[] =
+        "0123456789"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+        "abcdefghijklmnopqrstuvwxyz";
+    int stringLen = sizeof(alphanum) - 1;
+
+    string str;
+    for (int i = 0; i < len; i++) {
+        int rnd = getRandomInt(0, stringLen);
+        str += alphanum[rnd % stringLen];
+    }
+    return str;
+}
+
+
+///ActionResult
+
+
+///ActionRequest
+
+
+
+///ActionManager
+ActionManager::ActionManager(){
+
+}
+ActionManager::~ActionManager(){
+	if(hasAnyRequests()){
+		while(hasAnyRequests()){
+			ActionRequest* req  = popFromQueue();
+			ActionResult* res = getResultByID(req->getID());
+
+			if(req){
+				emit(req->getID());
+				if(res){
+					req->handle(res);
+				}
+				removeRequest(req->getID());
+				removeResult(req->getID());
+			}
+		}
+	}
+}
+
+bool ActionManager::hasAnyRequests(){
+	return (!requests.empty());
+}
+
+bool ActionManager::isEmptyQueue(){
+	return actionQueue.empty();
+}
+
+
+bool ActionManager::handleCurrRequest(){
+	ActionRequest* req  = popFromQueue();
+	if(req){
+
+		ActionResult* newRes = processRequest(req);
+		ActionResult* oldRes = getResultByID(req->getID());
+
+		ARS status = req->getStatus();
+
+		if(status == ARS::FULFILLED){
+			sendEvent(req->getID(), newRes);
+			req->handle(newRes);
+		}
+		if(req->isWaiting()){
+			pushToNext(req);
+			results[req->getID()] = newRes;
+		}else{
+			removeRequest(req->getID());
+			removeResult(req->getID());
+		}
+		
+		return true;
+	}
+	return false;
+}
+
+ActionResult* ActionManager::processRequest(ActionRequest* req){
+
+	ActionResult* oldRes = getResultByID(req->getID());
+
+	ActionResult* newRes = NULL;
+	
+	if(req->isWaiting()){
+		ARS oldState = req->getStatus();
+
+		if(oldState == ARS::PROCESSING){
+			req->waitOnce();
+		}
+		ActionResult* newRes = req->process(oldRes);
+
+		ARS newState = req->getStatus();
+
+		if(newState != oldState){
+			req->onStateChange(newRes);
+		}
+
+		return newRes;
+	}else{
+		newRes = new ActionResult(*oldRes);
+	}
+
+	return newRes;
+}
+
+ActionRequest* ActionManager::getCurrentRequest(){
+	ActionRequest* req = NULL;
+	if(!actionQueue.empty()){
+		req = actionQueue.front();
+	}
+	return req;
+}
+
+void ActionManager::pushRequest(ActionRequest* req){
+	if(req==NULL) return;
+	if(results.count(req->getID())<=0){
+
+		requests[req->getID()] = req;
+		results[req->getID()] = new ActionResult(req->getID());
+
+		// req->changeStatus(ARS::PENDING);
+
+		subscribe(req->getID(), req->getActionHandler());
+
+		pushToQueue(req);
+	}
+}
+ActionRequest* ActionManager::removeRequest(string id){
+	ActionRequest* req = NULL;
+	if(requests.count(id)>0){
+		req = requests[id];
+		if(req){
+			requests.erase(id);
+		}
+	}
+	return req;
+}
+ActionResult* ActionManager::removeResult(string id){
+	ActionResult* res = NULL;
+	if(results.count(id)>0){
+		res = results[id];
+		if(res){
+			results.erase(id);
+		}
+	}
+	return res;
+}
+
+void ActionManager::pushToQueue(ActionRequest* req){
+	actionQueue.push(req);
+}
+
+void ActionManager::pushToNext(ActionRequest* req){
+	nextQueue.push(req);
+}
+
+ActionRequest* ActionManager::popFromQueue(){
+	ActionRequest* req = NULL;
+	if(!actionQueue.empty()){
+		req = actionQueue.front();
+		actionQueue.pop();
+	}
+	return req;
+}
+
+ActionRequest* ActionManager::getRequestByID(string id){
+	if(requests.count(id)>0){
+		return requests[id];
+	}
+	return NULL;
+}
+ActionResult* ActionManager::getResultByID(string id){
+	if(results.count(id)>0){
+		return results[id];
+	}
+	return NULL;
+}
+
+void ActionManager::emit(string n){
+	if(hasSignal(n)){
+		SignalEvent* event = createSignalEvent(n);
+		sendEvent(n, event);
+	}
+}
+
+SignalEvent* ActionManager::createSignalEvent(string n){
+	ActionResult* event = NULL;
+	if(results.count(n)>0){
+		event = results[n];
+	}
+
+	return event;
+}
+
+void ActionManager::placeNextQueue(){
+	actionQueue = nextQueue;
+	queue<ActionRequest*> newQueue;
+	nextQueue = newQueue;
+}
+
+#endif

+ 86 - 0
CPP-Signal-Bus/CPP-Signal-Bus/ActionManager.h

@@ -0,0 +1,86 @@
+#ifndef ACTIONMANAGER_H
+#define ACTIONMANAGER_H
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <vector>
+#include <map>
+#include <queue>
+#include <ctime>
+#include <utility>
+#include <initializer_list>
+
+#include <functional>
+
+#include "SignalBus.h"
+
+#include "ActionRequest.h"
+#include "ActionResult.h"
+
+using namespace std;
+
+/*	
+	ActionManager is a Command bus that makes use of ActionRequests as the commands and invokes them after a certain period of time
+	and returns a Result to the Signalhandlers it stores based on the id of that request, along with the result data
+*/
+
+class ActionManager:public SignalBus{
+public:
+	//creates the action manager object
+	ActionManager();
+	~ActionManager();
+	//emits a signal based on the id of the request, which will send the current result to the completion handler for the request object
+	virtual void emit(string n);
+	//processes a request and returns a result object which may be temporary for further processing or the final result for completion
+	
+	ActionResult* processRequest(ActionRequest* req);
+	//handles the current request on the top of the queue as it pops and returns it back in the queue for next step
+	bool handleCurrRequest();
+	//push request to the bottom of the queue of other requests and the request lists based on id
+	//also creates a pending result fro the request to process it
+	void pushRequest(ActionRequest* req);
+	//removes a request from the queue and the list based on the id
+	ActionRequest* removeRequest(string id);
+	//removes a result from the result list by request id
+	ActionResult* removeResult(string id);
+	//gets a request in the list by id
+	ActionRequest* getRequestByID(string id);
+	//gets a result object in the list by id
+	ActionResult* getResultByID(string id);
+	//get current request at the top of the queue
+	ActionRequest* getCurrentRequest();
+	//replaces the current queue with the queue of next requests
+	void placeNextQueue();
+	//checks if there are any requests in the queue or the next queue
+	bool hasAnyRequests();
+	//checks if the current queue is empty
+	bool isEmptyQueue();
+	//gets the number of requests in the current queue
+	int getQueueSize(){
+		return (int) actionQueue.size();
+	}
+	//gets number of requests in the next queue
+	int getNextQueueSize(){
+		return (int) nextQueue.size();
+	}
+protected:
+	// virtual void sendEvent(string n, SignalEvent* event);
+	//creates a Actionresult based on an id and returns it as an Actionresult
+	virtual SignalEvent* createSignalEvent(string n);
+	//pushes a request to the current queue
+	void pushToQueue(ActionRequest* req);
+	//pushes a request to the next queue
+	void pushToNext(ActionRequest* req);
+	//pops a request from the current queue
+	ActionRequest* popFromQueue();
+
+	map<string, ActionRequest*> requests;	//list of all requests sorted by id
+	map<string, ActionResult*> results;	//list of all results sorted by request id
+	// queue<ActionRequest*> actionQueue;
+	queue<ActionRequest*> actionQueue;	//queue for actionRequests
+	queue<ActionRequest*> nextQueue;	//next queue for actionRequests
+};
+
+
+#endif

+ 229 - 0
CPP-Signal-Bus/CPP-Signal-Bus/ActionManager/ActionManager.cpp

@@ -0,0 +1,229 @@
+#ifndef ACTIONMANAGER_CPP
+#define ACTIONMANAGER_CPP
+
+#include <random>
+
+#include "ActionManager.h"
+
+// #include "ActionRequest.h"
+// #include "ActionResult.h"
+
+using namespace std;
+
+static int getRandomInt(int a, int b){
+    int max, min;
+    if(a>b){
+        max = a; min = b;
+    }else{
+        max = b; min = a;
+    }
+    random_device rd;
+    mt19937 gen(rd());
+    uniform_real_distribution<double> distr(min, max);
+
+    return (int) distr(gen);
+}
+static string randomString(int len = 9) {
+    const char alphanum[] =
+        "0123456789"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+        "abcdefghijklmnopqrstuvwxyz";
+    int stringLen = sizeof(alphanum) - 1;
+
+    string str;
+    for (int i = 0; i < len; i++) {
+        int rnd = getRandomInt(0, stringLen);
+        str += alphanum[rnd % stringLen];
+    }
+    return str;
+}
+
+
+///ActionResult
+
+
+///ActionRequest
+
+
+
+///ActionManager
+ActionManager::ActionManager(){
+
+}
+ActionManager::~ActionManager(){
+	if(hasAnyRequests()){
+		while(hasAnyRequests()){
+			ActionRequest* req  = popFromQueue();
+			ActionResult* res = getResultByID(req->getID());
+
+			if(req){
+				emit(req->getID());
+				if(res){
+					req->handle(res);
+				}
+				removeRequest(req->getID());
+				removeResult(req->getID());
+			}
+		}
+	}
+}
+
+bool ActionManager::hasAnyRequests(){
+	return (!requests.empty());
+}
+
+bool ActionManager::isEmptyQueue(){
+	return actionQueue.empty();
+}
+
+
+bool ActionManager::handleCurrRequest(){
+	ActionRequest* req  = popFromQueue();
+	if(req){
+
+		ActionResult* newRes = processRequest(req);
+		ActionResult* oldRes = getResultByID(req->getID());
+
+		ARS status = req->getStatus();
+
+		if(status == ARS::FULFILLED){
+			sendEvent(req->getID(), newRes);
+			req->handle(newRes);
+		}
+		if(req->isWaiting()){
+			pushToNext(req);
+			results[req->getID()] = newRes;
+		}else{
+			removeRequest(req->getID());
+			removeResult(req->getID());
+		}
+		
+		return true;
+	}
+	return false;
+}
+
+ActionResult* ActionManager::processRequest(ActionRequest* req){
+
+	ActionResult* oldRes = getResultByID(req->getID());
+
+	ActionResult* newRes = NULL;
+	
+	if(req->isWaiting()){
+		ARS oldState = req->getStatus();
+
+		if(oldState == ARS::PROCESSING){
+			req->waitOnce();
+		}
+		ActionResult* newRes = req->process(oldRes);
+
+		ARS newState = req->getStatus();
+
+		if(newState != oldState){
+			req->onStateChange(newRes);
+		}
+
+		return newRes;
+	}else{
+		newRes = new ActionResult(*oldRes);
+	}
+
+	return newRes;
+}
+
+ActionRequest* ActionManager::getCurrentRequest(){
+	ActionRequest* req = NULL;
+	if(!actionQueue.empty()){
+		req = actionQueue.front();
+	}
+	return req;
+}
+
+void ActionManager::pushRequest(ActionRequest* req){
+	if(req==NULL) return;
+	if(results.count(req->getID())<=0){
+
+		requests[req->getID()] = req;
+		results[req->getID()] = new ActionResult(req->getID());
+
+		// req->changeStatus(ARS::PENDING);
+
+		subscribe(req->getID(), req->getActionHandler());
+
+		pushToQueue(req);
+	}
+}
+ActionRequest* ActionManager::removeRequest(string id){
+	ActionRequest* req = NULL;
+	if(requests.count(id)>0){
+		req = requests[id];
+		if(req){
+			requests.erase(id);
+		}
+	}
+	return req;
+}
+ActionResult* ActionManager::removeResult(string id){
+	ActionResult* res = NULL;
+	if(results.count(id)>0){
+		res = results[id];
+		if(res){
+			results.erase(id);
+		}
+	}
+	return res;
+}
+
+void ActionManager::pushToQueue(ActionRequest* req){
+	actionQueue.push(req);
+}
+
+void ActionManager::pushToNext(ActionRequest* req){
+	nextQueue.push(req);
+}
+
+ActionRequest* ActionManager::popFromQueue(){
+	ActionRequest* req = NULL;
+	if(!actionQueue.empty()){
+		req = actionQueue.front();
+		actionQueue.pop();
+	}
+	return req;
+}
+
+ActionRequest* ActionManager::getRequestByID(string id){
+	if(requests.count(id)>0){
+		return requests[id];
+	}
+	return NULL;
+}
+ActionResult* ActionManager::getResultByID(string id){
+	if(results.count(id)>0){
+		return results[id];
+	}
+	return NULL;
+}
+
+void ActionManager::emit(string n){
+	if(hasSignal(n)){
+		SignalEvent* event = createSignalEvent(n);
+		sendEvent(n, event);
+	}
+}
+
+SignalEvent* ActionManager::createSignalEvent(string n){
+	ActionResult* event = NULL;
+	if(results.count(n)>0){
+		event = results[n];
+	}
+
+	return event;
+}
+
+void ActionManager::placeNextQueue(){
+	actionQueue = nextQueue;
+	queue<ActionRequest*> newQueue;
+	nextQueue = newQueue;
+}
+
+#endif

+ 86 - 0
CPP-Signal-Bus/CPP-Signal-Bus/ActionManager/ActionManager.h

@@ -0,0 +1,86 @@
+#ifndef ACTIONMANAGER_H
+#define ACTIONMANAGER_H
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <vector>
+#include <map>
+#include <queue>
+#include <ctime>
+#include <utility>
+#include <initializer_list>
+
+#include <functional>
+
+#include "../SignalHandler/SignalBus.h"
+
+#include "ActionRequest.h"
+#include "ActionResult.h"
+
+using namespace std;
+
+/*	
+	ActionManager is a Command bus that makes use of ActionRequests as the commands and invokes them after a certain period of time
+	and returns a Result to the Signalhandlers it stores based on the id of that request, along with the result data
+*/
+
+class ActionManager:public SignalBus{
+public:
+	//creates the action manager object
+	ActionManager();
+	~ActionManager();
+	//emits a signal based on the id of the request, which will send the current result to the completion handler for the request object
+	virtual void emit(string n);
+	//processes a request and returns a result object which may be temporary for further processing or the final result for completion
+	
+	ActionResult* processRequest(ActionRequest* req);
+	//handles the current request on the top of the queue as it pops and returns it back in the queue for next step
+	bool handleCurrRequest();
+	//push request to the bottom of the queue of other requests and the request lists based on id
+	//also creates a pending result fro the request to process it
+	void pushRequest(ActionRequest* req);
+	//removes a request from the queue and the list based on the id
+	ActionRequest* removeRequest(string id);
+	//removes a result from the result list by request id
+	ActionResult* removeResult(string id);
+	//gets a request in the list by id
+	ActionRequest* getRequestByID(string id);
+	//gets a result object in the list by id
+	ActionResult* getResultByID(string id);
+	//get current request at the top of the queue
+	ActionRequest* getCurrentRequest();
+	//replaces the current queue with the queue of next requests
+	void placeNextQueue();
+	//checks if there are any requests in the queue or the next queue
+	bool hasAnyRequests();
+	//checks if the current queue is empty
+	bool isEmptyQueue();
+	//gets the number of requests in the current queue
+	int getQueueSize(){
+		return (int) actionQueue.size();
+	}
+	//gets number of requests in the next queue
+	int getNextQueueSize(){
+		return (int) nextQueue.size();
+	}
+protected:
+	// virtual void sendEvent(string n, SignalEvent* event);
+	//creates a Actionresult based on an id and returns it as an Actionresult
+	virtual SignalEvent* createSignalEvent(string n);
+	//pushes a request to the current queue
+	void pushToQueue(ActionRequest* req);
+	//pushes a request to the next queue
+	void pushToNext(ActionRequest* req);
+	//pops a request from the current queue
+	ActionRequest* popFromQueue();
+
+	map<string, ActionRequest*> requests;	//list of all requests sorted by id
+	map<string, ActionResult*> results;	//list of all results sorted by request id
+	// queue<ActionRequest*> actionQueue;
+	queue<ActionRequest*> actionQueue;	//queue for actionRequests
+	queue<ActionRequest*> nextQueue;	//next queue for actionRequests
+};
+
+
+#endif

+ 189 - 0
CPP-Signal-Bus/CPP-Signal-Bus/ActionManager/ActionRequest.cpp

@@ -0,0 +1,189 @@
+#ifndef ACTIONREQUEST_CPP
+#define ACTIONREQUEST_CPP
+
+#include <random>
+
+#include "ActionRequest.h"
+#include "../myHelper.cpp"
+
+using namespace std;
+
+static int getRandomInt(int a, int b){
+    int max, min;
+    if(a>b){
+        max = a; min = b;
+    }else{
+        max = b; min = a;
+    }
+    random_device rd;
+    mt19937 gen(rd());
+    uniform_real_distribution<double> distr(min, max);
+
+    return (int) distr(gen);
+}
+static string randomString(int len = 9) {
+    const char alphanum[] =
+        "0123456789"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+        "abcdefghijklmnopqrstuvwxyz";
+    int stringLen = sizeof(alphanum) - 1;
+
+    string str;
+    for (int i = 0; i < len; i++) {
+        int rnd = getRandomInt(0, stringLen);
+        str += alphanum[rnd % stringLen];
+    }
+    return str;
+}
+
+ActionRequest::ActionRequest(int _wait, map<string,string> _data, function<void(SignalEvent*)> func){
+	id = randomString(8);
+
+	waitCount = _wait;
+	startCount = _wait;
+	requestData = _data;
+	actionHandler = new FunctionHandler(func);
+	processHandler = new FunctionHandler([this](SignalEvent* e){
+		_process(e);
+	});
+
+	status = ARS::PENDING;
+
+	// result = new ActionResult(getID(), this);
+}
+ActionRequest::ActionRequest(int _wait, map<string,string> _data, function<void(SignalEvent*)> func, function<void(SignalEvent*)> func2){
+	id = randomString(8);
+
+	waitCount = _wait;
+	startCount = _wait;
+	requestData = _data;
+	actionHandler = new FunctionHandler(func);
+	processHandler = new FunctionHandler(func2);
+
+	status = ARS::PENDING;
+
+	// result = new ActionResult(getID(), this);
+}
+ActionRequest::ActionRequest(int _wait, function<void(SignalEvent*)> func){
+	id = randomString(8);
+
+	waitCount = _wait;
+	startCount = _wait;
+	actionHandler = new FunctionHandler(func);
+	processHandler = new FunctionHandler([this](SignalEvent* e){
+		_process(e);
+	});
+
+	status = ARS::PENDING;
+	// result = new ActionResult(getID(), this);
+}
+ActionRequest::ActionRequest(int _wait, function<void(SignalEvent*)> func, function<void(SignalEvent*)> func2){
+	id = randomString(8);
+
+	waitCount = _wait;
+	startCount = _wait;
+	actionHandler = new FunctionHandler(func);
+	processHandler = new FunctionHandler(func2);
+
+	status = ARS::PENDING;
+
+	// result = new ActionResult(getID(), this);
+}
+ActionRequest::ActionRequest(ActionRequest& other){
+	id = randomString(8);
+
+	startCount = other.waitCount;
+	waitCount = other.waitCount;
+
+	requestData = other.requestData;
+	actionHandler = new FunctionHandler(*(other.actionHandler));
+	processHandler = new FunctionHandler(*(other.processHandler));
+	status = other.status;
+	// result = new ActionResult(getID(), this);
+}
+ActionRequest::~ActionRequest(){
+	actionHandler = NULL;
+	processHandler = NULL;
+	// result = NULL;
+}
+
+ActionRequest* ActionRequest::clone(){
+	return new ActionRequest(*this);
+}
+
+void ActionRequest::changeStatus(ARS newState){
+	ARS oldState = status;
+	status = newState;
+
+	//maybe emit signal or run onStateChange
+}
+
+string* ActionRequest::getData(string key){
+	if(requestData.count(key)>0){
+		return &(requestData[key]);
+	}
+	return NULL;
+}
+string* ActionRequest::setData(string key, string val){
+	string* _val = NULL;
+	if(requestData.count(key)>0){
+		_val = &(requestData[key]);
+	}
+	requestData[key] = val;
+	return _val;
+}
+void ActionRequest::setDataMap(map<string,string> newData){
+	requestData = newData;
+}
+map<string,string> ActionRequest::getDataMap(){
+	return requestData;
+}
+
+void ActionRequest::handle(ActionResult* res){
+	
+}
+
+void ActionRequest::onStateChange(SignalEvent* e){
+
+	ActionResult* newResult = static_cast<ActionResult*>(e);
+	
+	//do smt on state change
+}
+ActionResult* ActionRequest::process(ActionResult* oldRes){
+	ActionResult* newRes = new ActionResult(*oldRes);
+	
+	if(status == ARS::PENDING){
+		changeStatus(ARS::PROCESSING);
+	}
+	if(status == ARS::PROCESSING){
+		_process(newRes);
+		SignalHandler* _handler = getProcessHandler();
+		_handler->handle(newRes);
+
+		if(waitCount==0){
+			newRes->resolve(true);
+		}else if(waitCount<0){
+			newRes->resolve(false);
+		}
+	}
+
+	if(newRes->isFinished()){
+		changeStatus(ARS::FULFILLED);
+	}
+
+	return newRes;
+}
+void ActionRequest::_process(SignalEvent* e){
+	
+	ActionResult* res  = static_cast<ActionResult*>(e);
+
+	for(auto kv: requestData){
+		if(!res->getData(kv.first)){
+			res->setData(kv.first, kv.second);
+		}
+	}
+
+}
+
+
+#endif

+ 130 - 0
CPP-Signal-Bus/CPP-Signal-Bus/ActionManager/ActionRequest.h

@@ -0,0 +1,130 @@
+#ifndef ACTIONREQUEST_H
+#define ACTIONREQUEST_H
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <vector>
+#include <map>
+#include <queue>
+#include <ctime>
+#include <utility>
+
+#include <functional>
+
+#include "../SignalHandler/SignalHandler.h"
+
+#include "ActionResult.h"
+
+using namespace std;
+
+/*	
+	ACTION REQUEST STATE
+	Enum to show state of the Request, showing whether it is waiting to process, processing or finished processing
+*/
+
+enum ARS{
+	PENDING,
+	PROCESSING,
+	FULFILLED
+};
+
+/*	
+	Request for action that has handlers to process and invoke a request based on a certain function
+	Request will create a result as it processes and update the result data based on the process function
+	and the request data as an input
+*/
+
+class ActionRequest{
+	friend class ActionManager;
+public:
+	//create a request with a number of steps to wait, input data, processing function and function to handle when it finishes
+	ActionRequest(int _wait, map<string,string> _data, function<void(SignalEvent*)> func);
+	ActionRequest(int _wait, map<string,string> _data, function<void(SignalEvent*)> func, function<void(SignalEvent*)> proc);
+	ActionRequest(int _wait, function<void(SignalEvent*)> func);
+	ActionRequest(int _wait, function<void(SignalEvent*)> func, function<void(SignalEvent*)> proc);
+	//copy constructor for action request to clone request
+	ActionRequest(ActionRequest& other);
+	~ActionRequest();
+
+	//clones request
+	ActionRequest* clone();
+	//processes a result to create a new result
+	ActionResult* process(ActionResult* oldRes);
+	//handles result when state changes
+	virtual void onStateChange(SignalEvent* res);
+	//handles result when it completes
+	virtual void handle(ActionResult* res);
+
+	//sets data for request input based on a key
+	string* setData(string key, string val);
+	//sets all data for request as a map
+	void setDataMap(map<string,string> newData);
+	//gets all data for request as a map
+	map<string,string> getDataMap();
+	//gets data for request based on a key
+	string* getData(string key);
+
+	//changes status of request
+	void changeStatus(ARS newState);
+	//get number of steps to wait for request	
+	int getWaitCount(){
+		return waitCount;
+	}
+	//get number of steps request was meant to wait entirely
+	int getStartCount(){
+		return startCount;
+	}
+	//get the handler for action on completion
+	SignalHandler* getActionHandler(){
+		return actionHandler;
+	}
+	//get the handler for processing result
+	SignalHandler* getProcessHandler(){
+		return processHandler;
+	}
+	//get id of request
+	string getID(){
+		return id;
+	}
+	//get status of request as a string
+	string getStatusAsString(){
+		return ActionRequest::statusToString(getStatus());
+	}
+	//get status of request as an ARS
+	ARS getStatus(){
+		return status;
+	}
+	//gets a string version of an ARS
+	static string statusToString(ARS status){
+		switch(status){
+			case (ARS::PENDING): return "PENDING";
+			case (ARS::PROCESSING): return "PROCESSING";
+			case (ARS::FULFILLED): return "FULFILLED";
+			default: return "UNKNOWN";
+		}
+	}
+	//checks if the request has not been fulfilled
+	bool isWaiting(){
+		return (status != ARS::FULFILLED);
+	}
+	//virtual function for a request to wait once as it processes
+	virtual void waitOnce(){
+		waitCount--;
+	}
+protected:
+	//internal processor for request for a specific result
+	virtual void _process(SignalEvent* res);
+	int waitCount;	//number of steps to wait until exeecution
+	int startCount;	//number of steps to wait from the beginning
+
+	ARS status;	//status of request
+	
+	map<string,string> requestData;	//data of request
+	FunctionHandler* actionHandler;	//signalhandler for handling completion
+	FunctionHandler* processHandler;	//signalhandler for handling processing
+private:
+	string id;	//id of request that is auto generated
+};
+
+#endif

+ 76 - 0
CPP-Signal-Bus/CPP-Signal-Bus/ActionManager/ActionResult.cpp

@@ -0,0 +1,76 @@
+#ifndef ACTIONRESULT_CPP
+#define ACTIONRESULT_CPP
+
+#include <random>
+
+#include "ActionResult.h"
+
+using namespace std;
+
+ActionResult::ActionResult(string _id){
+	id = _id;
+	success = false;
+
+}
+ActionResult::ActionResult(string _id, bool s){
+	id = _id;
+	success = s;
+}
+ActionResult::ActionResult(string _id, bool s, std::map<string, string> _data){
+	id = _id;
+	success = s;
+	resultData = _data;
+}
+ActionResult::ActionResult(ActionResult& other){
+	id = other.id;
+	success = other.success;
+	finished = other.finished;
+	resultData = other.resultData;
+}
+ActionResult::~ActionResult(){
+	
+}
+
+void ActionResult::resolve(bool s){
+	if(!finished){
+		finished = true;
+		success = s;
+	}
+}
+
+SignalEvent* ActionResult::clone(){
+	return new ActionResult(*this);
+}
+
+bool ActionResult::isFinished(){
+	return finished;
+}
+bool ActionResult::isSuccess(){
+	return success;
+}
+
+string* ActionResult::getData(string key){
+	if(resultData.count(key)>0){
+		return &(resultData[key]);
+	}
+	return NULL;
+}
+string* ActionResult::setData(string key, string val){
+	string* _val = NULL;
+	if(resultData.count(key)>0){
+		_val = &(resultData[key]);
+	}
+	resultData[key] = val;
+	return _val;
+}
+
+map<string,string> ActionResult::setDataMap(map<string,string> newData){
+	map<string,string> temp = resultData;
+	resultData = newData;
+	return temp;
+}
+map<string,string> ActionResult::getDataMap(){
+	return resultData;
+}
+
+#endif

+ 67 - 0
CPP-Signal-Bus/CPP-Signal-Bus/ActionManager/ActionResult.h

@@ -0,0 +1,67 @@
+#ifndef ACTIONRESULT_H
+#define ACTIONRESULT_H
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <vector>
+#include <map>
+#include <queue>
+#include <ctime>
+#include <utility>
+
+#include <functional>
+
+#include "../SignalHandler/SignalEvent.h"
+// #include "ActionRequest.h"
+
+using namespace std;
+
+/*	
+	Result of Request while or after it has been processed with all the data meant to be returned after a certain time
+*/
+
+class ActionResult: public SignalEvent{
+friend class ActionRequest;
+friend class ActionManager;
+public:
+	//creates the result based on the request id, success and result data
+	ActionResult(string id);
+	ActionResult(string id, bool success);
+	ActionResult(string id, bool success, map<string,string> _data);
+	ActionResult(ActionResult& other);
+	~ActionResult();
+
+	//creates a clone of the result since it is a signal event
+	SignalEvent* clone();
+	
+	//get data based on a key or returns null if nonexistent
+	string* getData(string key);
+	//set data based on a key and value
+	string* setData(string key, string val);
+	//set data using a hashmap of strings
+	map<string,string> setDataMap(map<string,string> newData);
+	//get all data as a hashmap
+	map<string,string> getDataMap();
+	//returns the id of the result, which is the id of the original request
+	string getRequestID(){
+		return id;
+	}
+	
+	//check if request was finished
+	bool isFinished();
+	//check if request was a success
+	bool isSuccess();
+
+	//resolves the result by finishing the request and setting its succession
+	void resolve(bool s);
+protected:
+
+	bool success;	//request succession
+	bool finished;	//request completion
+	map<string,string> resultData; //data of the result
+	string id;	//id of the original request
+
+};
+
+#endif

+ 189 - 0
CPP-Signal-Bus/CPP-Signal-Bus/ActionRequest.cpp

@@ -0,0 +1,189 @@
+#ifndef ACTIONREQUEST_CPP
+#define ACTIONREQUEST_CPP
+
+#include <random>
+
+#include "ActionRequest.h"
+#include "myHelper.cpp"
+
+using namespace std;
+
+static int getRandomInt(int a, int b){
+    int max, min;
+    if(a>b){
+        max = a; min = b;
+    }else{
+        max = b; min = a;
+    }
+    random_device rd;
+    mt19937 gen(rd());
+    uniform_real_distribution<double> distr(min, max);
+
+    return (int) distr(gen);
+}
+static string randomString(int len = 9) {
+    const char alphanum[] =
+        "0123456789"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+        "abcdefghijklmnopqrstuvwxyz";
+    int stringLen = sizeof(alphanum) - 1;
+
+    string str;
+    for (int i = 0; i < len; i++) {
+        int rnd = getRandomInt(0, stringLen);
+        str += alphanum[rnd % stringLen];
+    }
+    return str;
+}
+
+ActionRequest::ActionRequest(int _wait, map<string,string> _data, function<void(SignalEvent*)> func){
+	id = randomString(8);
+
+	waitCount = _wait;
+	startCount = _wait;
+	requestData = _data;
+	actionHandler = new FunctionHandler(func);
+	processHandler = new FunctionHandler([this](SignalEvent* e){
+		_process(e);
+	});
+
+	status = ARS::PENDING;
+
+	// result = new ActionResult(getID(), this);
+}
+ActionRequest::ActionRequest(int _wait, map<string,string> _data, function<void(SignalEvent*)> func, function<void(SignalEvent*)> func2){
+	id = randomString(8);
+
+	waitCount = _wait;
+	startCount = _wait;
+	requestData = _data;
+	actionHandler = new FunctionHandler(func);
+	processHandler = new FunctionHandler(func2);
+
+	status = ARS::PENDING;
+
+	// result = new ActionResult(getID(), this);
+}
+ActionRequest::ActionRequest(int _wait, function<void(SignalEvent*)> func){
+	id = randomString(8);
+
+	waitCount = _wait;
+	startCount = _wait;
+	actionHandler = new FunctionHandler(func);
+	processHandler = new FunctionHandler([this](SignalEvent* e){
+		_process(e);
+	});
+
+	status = ARS::PENDING;
+	// result = new ActionResult(getID(), this);
+}
+ActionRequest::ActionRequest(int _wait, function<void(SignalEvent*)> func, function<void(SignalEvent*)> func2){
+	id = randomString(8);
+
+	waitCount = _wait;
+	startCount = _wait;
+	actionHandler = new FunctionHandler(func);
+	processHandler = new FunctionHandler(func2);
+
+	status = ARS::PENDING;
+
+	// result = new ActionResult(getID(), this);
+}
+ActionRequest::ActionRequest(ActionRequest& other){
+	id = randomString(8);
+
+	startCount = other.waitCount;
+	waitCount = other.waitCount;
+
+	requestData = other.requestData;
+	actionHandler = new FunctionHandler(*(other.actionHandler));
+	processHandler = new FunctionHandler(*(other.processHandler));
+	status = other.status;
+	// result = new ActionResult(getID(), this);
+}
+ActionRequest::~ActionRequest(){
+	actionHandler = NULL;
+	processHandler = NULL;
+	// result = NULL;
+}
+
+ActionRequest* ActionRequest::clone(){
+	return new ActionRequest(*this);
+}
+
+void ActionRequest::changeStatus(ARS newState){
+	ARS oldState = status;
+	status = newState;
+
+	//maybe emit signal or run onStateChange
+}
+
+string* ActionRequest::getData(string key){
+	if(requestData.count(key)>0){
+		return &(requestData[key]);
+	}
+	return NULL;
+}
+string* ActionRequest::setData(string key, string val){
+	string* _val = NULL;
+	if(requestData.count(key)>0){
+		_val = &(requestData[key]);
+	}
+	requestData[key] = val;
+	return _val;
+}
+void ActionRequest::setDataMap(map<string,string> newData){
+	requestData = newData;
+}
+map<string,string> ActionRequest::getDataMap(){
+	return requestData;
+}
+
+void ActionRequest::handle(ActionResult* res){
+	
+}
+
+void ActionRequest::onStateChange(SignalEvent* e){
+
+	ActionResult* newResult = static_cast<ActionResult*>(e);
+	
+	//do smt on state change
+}
+ActionResult* ActionRequest::process(ActionResult* oldRes){
+	ActionResult* newRes = new ActionResult(*oldRes);
+	
+	if(status == ARS::PENDING){
+		changeStatus(ARS::PROCESSING);
+	}
+	if(status == ARS::PROCESSING){
+		_process(newRes);
+		SignalHandler* _handler = getProcessHandler();
+		_handler->handle(newRes);
+
+		if(waitCount==0){
+			newRes->resolve(true);
+		}else if(waitCount<0){
+			newRes->resolve(false);
+		}
+	}
+
+	if(newRes->isFinished()){
+		changeStatus(ARS::FULFILLED);
+	}
+
+	return newRes;
+}
+void ActionRequest::_process(SignalEvent* e){
+	
+	ActionResult* res  = static_cast<ActionResult*>(e);
+
+	for(auto kv: requestData){
+		if(!res->getData(kv.first)){
+			res->setData(kv.first, kv.second);
+		}
+	}
+
+}
+
+
+#endif

+ 130 - 0
CPP-Signal-Bus/CPP-Signal-Bus/ActionRequest.h

@@ -0,0 +1,130 @@
+#ifndef ACTIONREQUEST_H
+#define ACTIONREQUEST_H
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <vector>
+#include <map>
+#include <queue>
+#include <ctime>
+#include <utility>
+
+#include <functional>
+
+#include "SignalHandler.h"
+
+#include "ActionResult.h"
+
+using namespace std;
+
+/*	
+	ACTION REQUEST STATE
+	Enum to show state of the Request, showing whether it is waiting to process, processing or finished processing
+*/
+
+enum ARS{
+	PENDING,
+	PROCESSING,
+	FULFILLED
+};
+
+/*	
+	Request for action that has handlers to process and invoke a request based on a certain function
+	Request will create a result as it processes and update the result data based on the process function
+	and the request data as an input
+*/
+
+class ActionRequest{
+	friend class ActionManager;
+public:
+	//create a request with a number of steps to wait, input data, processing function and function to handle when it finishes
+	ActionRequest(int _wait, map<string,string> _data, function<void(SignalEvent*)> func);
+	ActionRequest(int _wait, map<string,string> _data, function<void(SignalEvent*)> func, function<void(SignalEvent*)> proc);
+	ActionRequest(int _wait, function<void(SignalEvent*)> func);
+	ActionRequest(int _wait, function<void(SignalEvent*)> func, function<void(SignalEvent*)> proc);
+	//copy constructor for action request to clone request
+	ActionRequest(ActionRequest& other);
+	~ActionRequest();
+
+	//clones request
+	ActionRequest* clone();
+	//processes a result to create a new result
+	ActionResult* process(ActionResult* oldRes);
+	//handles result when state changes
+	virtual void onStateChange(SignalEvent* res);
+	//handles result when it completes
+	virtual void handle(ActionResult* res);
+
+	//sets data for request input based on a key
+	string* setData(string key, string val);
+	//sets all data for request as a map
+	void setDataMap(map<string,string> newData);
+	//gets all data for request as a map
+	map<string,string> getDataMap();
+	//gets data for request based on a key
+	string* getData(string key);
+
+	//changes status of request
+	void changeStatus(ARS newState);
+	//get number of steps to wait for request	
+	int getWaitCount(){
+		return waitCount;
+	}
+	//get number of steps request was meant to wait entirely
+	int getStartCount(){
+		return startCount;
+	}
+	//get the handler for action on completion
+	SignalHandler* getActionHandler(){
+		return actionHandler;
+	}
+	//get the handler for processing result
+	SignalHandler* getProcessHandler(){
+		return processHandler;
+	}
+	//get id of request
+	string getID(){
+		return id;
+	}
+	//get status of request as a string
+	string getStatusAsString(){
+		return ActionRequest::statusToString(getStatus());
+	}
+	//get status of request as an ARS
+	ARS getStatus(){
+		return status;
+	}
+	//gets a string version of an ARS
+	static string statusToString(ARS status){
+		switch(status){
+			case (ARS::PENDING): return "PENDING";
+			case (ARS::PROCESSING): return "PROCESSING";
+			case (ARS::FULFILLED): return "FULFILLED";
+			default: return "UNKNOWN";
+		}
+	}
+	//checks if the request has not been fulfilled
+	bool isWaiting(){
+		return (status != ARS::FULFILLED);
+	}
+	//virtual function for a request to wait once as it processes
+	virtual void waitOnce(){
+		waitCount--;
+	}
+protected:
+	//internal processor for request for a specific result
+	virtual void _process(SignalEvent* res);
+	int waitCount;	//number of steps to wait until exeecution
+	int startCount;	//number of steps to wait from the beginning
+
+	ARS status;	//status of request
+	
+	map<string,string> requestData;	//data of request
+	FunctionHandler* actionHandler;	//signalhandler for handling completion
+	FunctionHandler* processHandler;	//signalhandler for handling processing
+private:
+	string id;	//id of request that is auto generated
+};
+
+#endif

+ 76 - 0
CPP-Signal-Bus/CPP-Signal-Bus/ActionResult.cpp

@@ -0,0 +1,76 @@
+#ifndef ACTIONRESULT_CPP
+#define ACTIONRESULT_CPP
+
+#include <random>
+
+#include "ActionResult.h"
+
+using namespace std;
+
+ActionResult::ActionResult(string _id){
+	id = _id;
+	success = false;
+
+}
+ActionResult::ActionResult(string _id, bool s){
+	id = _id;
+	success = s;
+}
+ActionResult::ActionResult(string _id, bool s, std::map<string, string> _data){
+	id = _id;
+	success = s;
+	resultData = _data;
+}
+ActionResult::ActionResult(ActionResult& other){
+	id = other.id;
+	success = other.success;
+	finished = other.finished;
+	resultData = other.resultData;
+}
+ActionResult::~ActionResult(){
+	
+}
+
+void ActionResult::resolve(bool s){
+	if(!finished){
+		finished = true;
+		success = s;
+	}
+}
+
+SignalEvent* ActionResult::clone(){
+	return new ActionResult(*this);
+}
+
+bool ActionResult::isFinished(){
+	return finished;
+}
+bool ActionResult::isSuccess(){
+	return success;
+}
+
+string* ActionResult::getData(string key){
+	if(resultData.count(key)>0){
+		return &(resultData[key]);
+	}
+	return NULL;
+}
+string* ActionResult::setData(string key, string val){
+	string* _val = NULL;
+	if(resultData.count(key)>0){
+		_val = &(resultData[key]);
+	}
+	resultData[key] = val;
+	return _val;
+}
+
+map<string,string> ActionResult::setDataMap(map<string,string> newData){
+	map<string,string> temp = resultData;
+	resultData = newData;
+	return temp;
+}
+map<string,string> ActionResult::getDataMap(){
+	return resultData;
+}
+
+#endif

+ 67 - 0
CPP-Signal-Bus/CPP-Signal-Bus/ActionResult.h

@@ -0,0 +1,67 @@
+#ifndef ACTIONRESULT_H
+#define ACTIONRESULT_H
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <vector>
+#include <map>
+#include <queue>
+#include <ctime>
+#include <utility>
+
+#include <functional>
+
+#include "SignalEvent.h"
+// #include "ActionRequest.h"
+
+using namespace std;
+
+/*	
+	Result of Request while or after it has been processed with all the data meant to be returned after a certain time
+*/
+
+class ActionResult: public SignalEvent{
+friend class ActionRequest;
+friend class ActionManager;
+public:
+	//creates the result based on the request id, success and result data
+	ActionResult(string id);
+	ActionResult(string id, bool success);
+	ActionResult(string id, bool success, map<string,string> _data);
+	ActionResult(ActionResult& other);
+	~ActionResult();
+
+	//creates a clone of the result since it is a signal event
+	SignalEvent* clone();
+	
+	//get data based on a key or returns null if nonexistent
+	string* getData(string key);
+	//set data based on a key and value
+	string* setData(string key, string val);
+	//set data using a hashmap of strings
+	map<string,string> setDataMap(map<string,string> newData);
+	//get all data as a hashmap
+	map<string,string> getDataMap();
+	//returns the id of the result, which is the id of the original request
+	string getRequestID(){
+		return id;
+	}
+	
+	//check if request was finished
+	bool isFinished();
+	//check if request was a success
+	bool isSuccess();
+
+	//resolves the result by finishing the request and setting its succession
+	void resolve(bool s);
+protected:
+
+	bool success;	//request succession
+	bool finished;	//request completion
+	map<string,string> resultData; //data of the result
+	string id;	//id of the original request
+
+};
+
+#endif

+ 154 - 0
CPP-Signal-Bus/CPP-Signal-Bus/CPP-Signal-Bus.vcxproj

@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <VCProjectVersion>17.0</VCProjectVersion>
+    <Keyword>Win32Proj</Keyword>
+    <ProjectGuid>{2397db77-ccb5-42ec-a094-802ccc42a37b}</ProjectGuid>
+    <RootNamespace>CPPSignalBus</RootNamespace>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v143</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="ActionManager.cpp" />
+    <ClCompile Include="ActionRequest.cpp" />
+    <ClCompile Include="ActionResult.cpp" />
+    <ClCompile Include="main.cpp" />
+    <ClCompile Include="myHelper.cpp" />
+    <ClCompile Include="ObjectSignalBus.cpp" />
+    <ClCompile Include="ObjectSignalEvent.cpp" />
+    <ClCompile Include="SignalBus.cpp" />
+    <ClCompile Include="SignalEvent.cpp" />
+    <ClCompile Include="SignalHandler.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="ActionManager.h" />
+    <ClInclude Include="ActionRequest.h" />
+    <ClInclude Include="ActionResult.h" />
+    <ClInclude Include="ObjectSignalBus.h" />
+    <ClInclude Include="ObjectSignalEvent.h" />
+    <ClInclude Include="SignalBus.h" />
+    <ClInclude Include="SignalEvent.h" />
+    <ClInclude Include="SignalHandler.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 75 - 0
CPP-Signal-Bus/CPP-Signal-Bus/CPP-Signal-Bus.vcxproj.filters

@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="Source Files">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="Header Files">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
+    </Filter>
+    <Filter Include="Resource Files">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="main.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="ActionManager.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="ActionRequest.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="ActionResult.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="myHelper.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="ObjectSignalBus.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="ObjectSignalEvent.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="SignalBus.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="SignalEvent.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="SignalHandler.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="ActionManager.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="ActionRequest.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="ActionResult.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="ObjectSignalBus.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="ObjectSignalEvent.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="SignalBus.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="SignalEvent.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+    <ClInclude Include="SignalHandler.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
+  </ItemGroup>
+</Project>

+ 4 - 0
CPP-Signal-Bus/CPP-Signal-Bus/CPP-Signal-Bus.vcxproj.user

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup />
+</Project>

+ 41 - 0
CPP-Signal-Bus/CPP-Signal-Bus/ObjectSignalBus.cpp

@@ -0,0 +1,41 @@
+#ifndef OBJECTSIGNALBUS_CPP
+#define OBJECTSIGNALBUS_CPP
+
+#include "ObjectSignalBus.h"
+
+using namespace std;
+
+template<class T>
+ObjectSignalBus<T>::ObjectSignalBus(){
+	
+}
+template<class T>
+ObjectSignalBus<T>::~ObjectSignalBus(){
+	
+}
+template<class T>
+void ObjectSignalBus<T>::emit(string n){
+	if(hasSignal(n)){
+		SignalEvent* event = createSignalEvent(n,NULL);
+
+		sendEvent(n, event);
+	}
+}
+template<class T>
+void ObjectSignalBus<T>::emit(string n, T* _data){
+	if(hasSignal(n)){
+		SignalEvent* event = createSignalEvent(n, _data);
+
+		sendEvent(n, event);
+	}
+}
+template<class T>
+SignalEvent* ObjectSignalBus<T>::createSignalEvent(string n){
+	return new ObjectSignalEvent<T>(n,NULL);
+}
+template<class T>
+SignalEvent* ObjectSignalBus<T>::createSignalEvent(string n, T* _data){
+	return new ObjectSignalEvent<T>(n,_data);
+}
+
+#endif

+ 40 - 0
CPP-Signal-Bus/CPP-Signal-Bus/ObjectSignalBus.h

@@ -0,0 +1,40 @@
+#ifndef OBJECTSIGNALBUS_H
+#define OBJECTSIGNALBUS_H
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <vector>
+#include <map>
+#include <ctime>
+
+#include <functional>
+
+#include "SignalBus.h"
+#include "ObjectSignalEvent.h"
+
+using namespace std;
+
+/*	
+	SignalBus that handles all its events using ObjectSignalEvents, therefore can emit data in the event as well
+*/
+
+template<class T>
+class ObjectSignalBus: public SignalBus{
+public:
+	//creates a signal bus
+	ObjectSignalBus();
+	~ObjectSignalBus();
+	//emit the signal with NULL data
+	virtual void emit(string n);
+	//emits the signal with data passed into it
+	virtual void emit(string n, T* _data);
+
+protected:
+	//creates a signalevent of type ObjectSignalEvent but has NULL data
+	virtual SignalEvent* createSignalEvent(string n);
+	//creates a signalevent of type ObjectSignalEvent with specific data
+	virtual SignalEvent* createSignalEvent(string n, T* _data);
+};
+
+#endif

+ 31 - 0
CPP-Signal-Bus/CPP-Signal-Bus/ObjectSignalEvent.cpp

@@ -0,0 +1,31 @@
+#ifndef OBJECTSIGNALEVENT_CPP
+#define OBJECTSIGNALEVENT_CPP
+
+#include "ObjectSignalEvent.h"
+
+using namespace std;
+
+template<class T>
+ObjectSignalEvent<T>::ObjectSignalEvent(string n, T* _data):SignalEvent(n){
+	data = _data;
+}
+template<class T>
+ObjectSignalEvent<T>::ObjectSignalEvent(ObjectSignalEvent& other){
+	this->data = other.data;
+	this->name = other.name;
+}
+template<class T>
+ObjectSignalEvent<T>::~ObjectSignalEvent(){
+	data = NULL;
+}
+template<class T>
+SignalEvent* ObjectSignalEvent<T>::clone(){
+	return new ObjectSignalEvent(*this);
+}
+template<class T>
+T* ObjectSignalEvent<T>::getData() const{
+	return data;
+}
+
+
+#endif

+ 38 - 0
CPP-Signal-Bus/CPP-Signal-Bus/ObjectSignalEvent.h

@@ -0,0 +1,38 @@
+#ifndef OBJECTSIGNALEVENT_H
+#define OBJECTSIGNALEVENT_H
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <vector>
+#include <map>
+#include <ctime>
+
+#include <functional>
+
+#include "SignalEvent.h"
+
+using namespace std;
+
+/*	
+	ObjectSignalEvent is an event that contains data of a specific type which can be passed on in a handler
+*/
+
+template<class T>
+class ObjectSignalEvent: public SignalEvent{
+public:
+	//create signalevent with the corresponding data
+	ObjectSignalEvent(string n, T* data);
+	ObjectSignalEvent(ObjectSignalEvent& other);
+	~ObjectSignalEvent();
+	//create clone of signal event
+	SignalEvent* clone();
+	//get the data passed on in the event
+	T* getData() const;
+public:
+	//data of the event as a pointer
+	T* data;
+};
+
+
+#endif

+ 62 - 0
CPP-Signal-Bus/CPP-Signal-Bus/SignalBus.cpp

@@ -0,0 +1,62 @@
+#ifndef SIGNALBUS_CPP
+#define SIGNALBUS_CPP
+
+#include "SignalBus.h"
+#include "myHelper.cpp"
+
+SignalBus::SignalBus(){
+
+}
+SignalBus::~SignalBus(){
+	
+}
+bool SignalBus::hasSignal(string n){
+	return (signals.count(n)>0);
+}
+void SignalBus::subscribe(string n, SignalHandler* listener){
+	if(!hasSignal(n)){
+		signals[n] = new vector<SignalHandler*>();
+	}
+	vector<SignalHandler*>* listeners = signals[n];
+
+	listeners->push_back(listener);
+}
+void SignalBus::unsubscribe(string n, SignalHandler* listener){
+	if(hasSignal(n)){
+		vector<SignalHandler*>* listeners = signals[n];
+
+		for(int i=0; i<listeners->size(); i++){
+			SignalHandler* handler = (*listeners)[i];
+			if(listener == handler || listener->getID() == handler->getID()){
+				listeners->erase(listeners->begin()+i);
+				i--; //just to retain index
+			}
+		}
+	}
+}
+void SignalBus::emit(string n){
+	if(hasSignal(n)){
+		SignalEvent* event = createSignalEvent(n);
+
+		sendEvent(n, event);
+	}
+}
+void SignalBus::sendEvent(string n, SignalEvent* event){
+	if(hasSignal(n)){
+		// cout<<"- sending event..."<<endl;
+		vector<SignalHandler*>* listeners = signals[n];
+		// cout<<"- NumOfListeners..."<<listeners->size()<<endl;
+		for(int i=0; i<listeners->size(); i++){
+			SignalHandler* handler = (*listeners)[i];
+			handler->handle(event);
+		}
+	}
+}
+
+SignalEvent* SignalBus::createSignalEvent(string n){
+	SignalEvent* event = new SignalDefaultEvent(n);
+
+	return event;
+}
+
+#endif

+ 45 - 0
CPP-Signal-Bus/CPP-Signal-Bus/SignalBus.h

@@ -0,0 +1,45 @@
+#ifndef SIGNALBUS_H
+#define SIGNALBUS_H
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <vector>
+#include <map>
+#include <ctime>
+
+#include <functional>
+
+#include "SignalHandler.h"
+
+using namespace std;
+
+/*	
+	SignalBus is a container that allows signalhandlers to be subscribed to it and handle them when the corresponding signal name is emitted
+	The signalhandlers in any object act as Observers to another object that holds the bus as a context, as to treat it dynamically and to not
+	explicitly observe the object state, but rather emit the signal based on a certain condition
+*/
+
+class SignalBus{
+public:
+	//creates the signal bus
+	SignalBus();
+	~SignalBus();
+	//emits the signal based on the name. Will create a signalevent and emit it to the corresponding listeners to that event name
+	virtual void emit(string n);
+	//subscribes a listener/handler to a signal name
+	void subscribe(string n, SignalHandler* listener);
+	//unsubscribes a listener/handler from a signal name
+	void unsubscribe(string n, SignalHandler* listener);
+	//check if the signal was created in the bus or if the signal has any listeners
+	bool hasSignal(string n);
+protected:
+	//a list of signals which listed as a signal name corresponding to a list of listeners
+	map<string, vector<SignalHandler*>*> signals;
+	//sends a specific signalevent to every listener to that event name
+	virtual void sendEvent(string n, SignalEvent* event);
+	//creates a signalevent based on the signal name, which by default is the SignalDefaultEvent, but this can be extended
+	virtual SignalEvent* createSignalEvent(string n);
+};
+
+#endif

+ 39 - 0
CPP-Signal-Bus/CPP-Signal-Bus/SignalEvent.cpp

@@ -0,0 +1,39 @@
+#ifndef SIGNALEVENT_CPP
+#define SIGNALEVENT_CPP
+
+#include "SignalEvent.h"
+#include "myHelper.cpp"
+
+SignalEvent::SignalEvent(){
+	name = "";
+}
+SignalEvent::SignalEvent(string n){
+	name = n;
+}
+SignalEvent::~SignalEvent(){
+
+}
+string SignalEvent::getEventName() const{
+	return name;
+}
+
+static int CALLCOUNT = 0;
+
+SignalDefaultEvent::SignalDefaultEvent(string n):SignalEvent(n){
+	// name = n;
+	callTime = time(0);
+	callCount = CALLCOUNT++;
+}
+SignalDefaultEvent::SignalDefaultEvent(SignalDefaultEvent& other){
+	name = other.name;
+	callTime = other.callTime;
+	callCount = other.callCount;
+}
+SignalDefaultEvent::~SignalDefaultEvent(){
+
+}
+SignalEvent* SignalDefaultEvent::clone(){
+	return new SignalDefaultEvent(*this);
+}
+
+#endif

+ 52 - 0
CPP-Signal-Bus/CPP-Signal-Bus/SignalEvent.h

@@ -0,0 +1,52 @@
+#ifndef SIGNALEVENT_H
+#define SIGNALEVENT_H
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <vector>
+#include <map>
+#include <ctime>
+
+#include <functional>
+
+using namespace std;
+
+/*	
+	SignalEvent carries data and the name of the emitted event from the SignalBus to be parsed and can be extended by any other class
+	This is used to share states dynamically in the observer pattern
+*/
+
+class SignalEvent{
+public:
+	//creates signal event with the event name
+	SignalEvent(string n);
+	~SignalEvent();
+	//get event name
+	string getEventName() const;
+	//creates a copy of the signal event
+	virtual SignalEvent* clone() = 0;
+protected:
+	SignalEvent();
+	string name;
+};
+
+/*	
+	Default Event that can be used to send signals that do not need to carry additional data
+*/
+
+class SignalDefaultEvent: public SignalEvent{
+public:
+	//creates the event object
+	SignalDefaultEvent(string n);
+	//copy constructor
+	SignalDefaultEvent(SignalDefaultEvent& other);
+	~SignalDefaultEvent();
+	//clone the signal event
+	SignalEvent* clone();
+
+	time_t callTime;	//records the step time it gets called
+	int callCount;		//records the amount of times the event was called
+};
+
+#endif

+ 41 - 0
CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler.cpp

@@ -0,0 +1,41 @@
+#ifndef SIGNALHANDLER_CPP
+#define SIGNALHANDLER_CPP
+
+#include "SignalHandler.h"
+#include "myHelper.cpp"
+
+/////SignalEvent
+
+/////SignalHandler
+SignalHandler::SignalHandler(){
+	id = myHelper::randomString(8);
+}
+SignalHandler::~SignalHandler(){
+	
+}
+string SignalHandler::getID() const{
+	return id;
+}
+
+FunctionHandler::FunctionHandler(function<void(SignalEvent*)> newFunc){
+	func = newFunc;
+}
+FunctionHandler::FunctionHandler(FunctionHandler& other){
+	func = other.func;
+}
+FunctionHandler::~FunctionHandler(){
+	func = NULL;
+}
+void FunctionHandler::handle(SignalEvent* event){
+	//run function
+	func(event);
+}
+/////SignalBus
+
+///ObjectSignalEvent
+
+
+///ObjectSignalBus
+
+
+#endif

+ 54 - 0
CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler.h

@@ -0,0 +1,54 @@
+#ifndef SIGNALHANDLER_H
+#define SIGNALHANDLER_H
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <vector>
+#include <map>
+#include <ctime>
+
+#include <functional>
+
+#include "SignalEvent.h"
+
+using namespace std;
+
+/*	
+	SignalHandler will run a certain function whenever the signal is emitted and received, which "handles" the signal and data passed through
+	This runs or handles the state change in the observer
+*/
+
+class SignalHandler{
+public:
+	//creates the signal handler with a unique id
+	SignalHandler();
+	~SignalHandler();
+	//gets the id of handler
+	string getID() const;
+	//function used to handler the event and its data
+	virtual void handle(SignalEvent* event) = 0;
+
+private:
+	string id;
+};
+
+/*	
+	FunctionHandler is a signal handler will take a function as a paramter for contruction and use that to handle the signal instead
+*/
+
+class FunctionHandler: public SignalHandler{
+public:
+	//creates the signal handler with a function to store. Note that this is normally a function lambda
+	FunctionHandler(function<void(SignalEvent*)> newFunc);
+	//copy constructor for the handler
+	FunctionHandler(FunctionHandler& other);
+	~FunctionHandler();
+protected:
+	//function used to run the function contained to handle the event and its data
+	virtual void handle(SignalEvent* event);
+	//variable used to store the function. Function is a void type that takes a signalEvent ptr as a parameter
+	function<void(SignalEvent*)> func;
+};
+
+#endif

+ 41 - 0
CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/ObjectSignalBus.cpp

@@ -0,0 +1,41 @@
+#ifndef OBJECTSIGNALBUS_CPP
+#define OBJECTSIGNALBUS_CPP
+
+#include "ObjectSignalBus.h"
+
+using namespace std;
+
+template<class T>
+ObjectSignalBus<T>::ObjectSignalBus(){
+	
+}
+template<class T>
+ObjectSignalBus<T>::~ObjectSignalBus(){
+	
+}
+template<class T>
+void ObjectSignalBus<T>::emit(string n){
+	if(hasSignal(n)){
+		SignalEvent* event = createSignalEvent(n,NULL);
+
+		sendEvent(n, event);
+	}
+}
+template<class T>
+void ObjectSignalBus<T>::emit(string n, T* _data){
+	if(hasSignal(n)){
+		SignalEvent* event = createSignalEvent(n, _data);
+
+		sendEvent(n, event);
+	}
+}
+template<class T>
+SignalEvent* ObjectSignalBus<T>::createSignalEvent(string n){
+	return new ObjectSignalEvent<T>(n,NULL);
+}
+template<class T>
+SignalEvent* ObjectSignalBus<T>::createSignalEvent(string n, T* _data){
+	return new ObjectSignalEvent<T>(n,_data);
+}
+
+#endif

+ 40 - 0
CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/ObjectSignalBus.h

@@ -0,0 +1,40 @@
+#ifndef OBJECTSIGNALBUS_H
+#define OBJECTSIGNALBUS_H
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <vector>
+#include <map>
+#include <ctime>
+
+#include <functional>
+
+#include "SignalBus.h"
+#include "ObjectSignalEvent.h"
+
+using namespace std;
+
+/*	
+	SignalBus that handles all its events using ObjectSignalEvents, therefore can emit data in the event as well
+*/
+
+template<class T>
+class ObjectSignalBus: public SignalBus{
+public:
+	//creates a signal bus
+	ObjectSignalBus();
+	~ObjectSignalBus();
+	//emit the signal with NULL data
+	virtual void emit(string n);
+	//emits the signal with data passed into it
+	virtual void emit(string n, T* _data);
+
+protected:
+	//creates a signalevent of type ObjectSignalEvent but has NULL data
+	virtual SignalEvent* createSignalEvent(string n);
+	//creates a signalevent of type ObjectSignalEvent with specific data
+	virtual SignalEvent* createSignalEvent(string n, T* _data);
+};
+
+#endif

+ 31 - 0
CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/ObjectSignalEvent.cpp

@@ -0,0 +1,31 @@
+#ifndef OBJECTSIGNALEVENT_CPP
+#define OBJECTSIGNALEVENT_CPP
+
+#include "ObjectSignalEvent.h"
+
+using namespace std;
+
+template<class T>
+ObjectSignalEvent<T>::ObjectSignalEvent(string n, T* _data):SignalEvent(n){
+	data = _data;
+}
+template<class T>
+ObjectSignalEvent<T>::ObjectSignalEvent(ObjectSignalEvent& other){
+	this->data = other.data;
+	this->name = other.name;
+}
+template<class T>
+ObjectSignalEvent<T>::~ObjectSignalEvent(){
+	data = NULL;
+}
+template<class T>
+SignalEvent* ObjectSignalEvent<T>::clone(){
+	return new ObjectSignalEvent(*this);
+}
+template<class T>
+T* ObjectSignalEvent<T>::getData() const{
+	return data;
+}
+
+
+#endif

+ 38 - 0
CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/ObjectSignalEvent.h

@@ -0,0 +1,38 @@
+#ifndef OBJECTSIGNALEVENT_H
+#define OBJECTSIGNALEVENT_H
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <vector>
+#include <map>
+#include <ctime>
+
+#include <functional>
+
+#include "SignalEvent.h"
+
+using namespace std;
+
+/*	
+	ObjectSignalEvent is an event that contains data of a specific type which can be passed on in a handler
+*/
+
+template<class T>
+class ObjectSignalEvent: public SignalEvent{
+public:
+	//create signalevent with the corresponding data
+	ObjectSignalEvent(string n, T* data);
+	ObjectSignalEvent(ObjectSignalEvent& other);
+	~ObjectSignalEvent();
+	//create clone of signal event
+	SignalEvent* clone();
+	//get the data passed on in the event
+	T* getData() const;
+public:
+	//data of the event as a pointer
+	T* data;
+};
+
+
+#endif

+ 62 - 0
CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/SignalBus.cpp

@@ -0,0 +1,62 @@
+#ifndef SIGNALBUS_CPP
+#define SIGNALBUS_CPP
+
+#include "SignalBus.h"
+#include "../myHelper.cpp"
+
+SignalBus::SignalBus(){
+
+}
+SignalBus::~SignalBus(){
+	
+}
+bool SignalBus::hasSignal(string n){
+	return (signals.count(n)>0);
+}
+void SignalBus::subscribe(string n, SignalHandler* listener){
+	if(!hasSignal(n)){
+		signals[n] = new vector<SignalHandler*>();
+	}
+	vector<SignalHandler*>* listeners = signals[n];
+
+	listeners->push_back(listener);
+}
+void SignalBus::unsubscribe(string n, SignalHandler* listener){
+	if(hasSignal(n)){
+		vector<SignalHandler*>* listeners = signals[n];
+
+		for(int i=0; i<listeners->size(); i++){
+			SignalHandler* handler = (*listeners)[i];
+			if(listener == handler || listener->getID() == handler->getID()){
+				listeners->erase(listeners->begin()+i);
+				i--; //just to retain index
+			}
+		}
+	}
+}
+void SignalBus::emit(string n){
+	if(hasSignal(n)){
+		SignalEvent* event = createSignalEvent(n);
+
+		sendEvent(n, event);
+	}
+}
+void SignalBus::sendEvent(string n, SignalEvent* event){
+	if(hasSignal(n)){
+		// cout<<"- sending event..."<<endl;
+		vector<SignalHandler*>* listeners = signals[n];
+		// cout<<"- NumOfListeners..."<<listeners->size()<<endl;
+		for(int i=0; i<listeners->size(); i++){
+			SignalHandler* handler = (*listeners)[i];
+			handler->handle(event);
+		}
+	}
+}
+
+SignalEvent* SignalBus::createSignalEvent(string n){
+	SignalEvent* event = new SignalDefaultEvent(n);
+
+	return event;
+}
+
+#endif

+ 45 - 0
CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/SignalBus.h

@@ -0,0 +1,45 @@
+#ifndef SIGNALBUS_H
+#define SIGNALBUS_H
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <vector>
+#include <map>
+#include <ctime>
+
+#include <functional>
+
+#include "SignalHandler.h"
+
+using namespace std;
+
+/*	
+	SignalBus is a container that allows signalhandlers to be subscribed to it and handle them when the corresponding signal name is emitted
+	The signalhandlers in any object act as Observers to another object that holds the bus as a context, as to treat it dynamically and to not
+	explicitly observe the object state, but rather emit the signal based on a certain condition
+*/
+
+class SignalBus{
+public:
+	//creates the signal bus
+	SignalBus();
+	~SignalBus();
+	//emits the signal based on the name. Will create a signalevent and emit it to the corresponding listeners to that event name
+	virtual void emit(string n);
+	//subscribes a listener/handler to a signal name
+	void subscribe(string n, SignalHandler* listener);
+	//unsubscribes a listener/handler from a signal name
+	void unsubscribe(string n, SignalHandler* listener);
+	//check if the signal was created in the bus or if the signal has any listeners
+	bool hasSignal(string n);
+protected:
+	//a list of signals which listed as a signal name corresponding to a list of listeners
+	map<string, vector<SignalHandler*>*> signals;
+	//sends a specific signalevent to every listener to that event name
+	virtual void sendEvent(string n, SignalEvent* event);
+	//creates a signalevent based on the signal name, which by default is the SignalDefaultEvent, but this can be extended
+	virtual SignalEvent* createSignalEvent(string n);
+};
+
+#endif

+ 39 - 0
CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/SignalEvent.cpp

@@ -0,0 +1,39 @@
+#ifndef SIGNALEVENT_CPP
+#define SIGNALEVENT_CPP
+
+#include "SignalEvent.h"
+#include "../myHelper.cpp"
+
+SignalEvent::SignalEvent(){
+	name = "";
+}
+SignalEvent::SignalEvent(string n){
+	name = n;
+}
+SignalEvent::~SignalEvent(){
+
+}
+string SignalEvent::getEventName() const{
+	return name;
+}
+
+static int CALLCOUNT = 0;
+
+SignalDefaultEvent::SignalDefaultEvent(string n):SignalEvent(n){
+	// name = n;
+	callTime = time(0);
+	callCount = CALLCOUNT++;
+}
+SignalDefaultEvent::SignalDefaultEvent(SignalDefaultEvent& other){
+	name = other.name;
+	callTime = other.callTime;
+	callCount = other.callCount;
+}
+SignalDefaultEvent::~SignalDefaultEvent(){
+
+}
+SignalEvent* SignalDefaultEvent::clone(){
+	return new SignalDefaultEvent(*this);
+}
+
+#endif

+ 52 - 0
CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/SignalEvent.h

@@ -0,0 +1,52 @@
+#ifndef SIGNALEVENT_H
+#define SIGNALEVENT_H
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <vector>
+#include <map>
+#include <ctime>
+
+#include <functional>
+
+using namespace std;
+
+/*	
+	SignalEvent carries data and the name of the emitted event from the SignalBus to be parsed and can be extended by any other class
+	This is used to share states dynamically in the observer pattern
+*/
+
+class SignalEvent{
+public:
+	//creates signal event with the event name
+	SignalEvent(string n);
+	~SignalEvent();
+	//get event name
+	string getEventName() const;
+	//creates a copy of the signal event
+	virtual SignalEvent* clone() = 0;
+protected:
+	SignalEvent();
+	string name;
+};
+
+/*	
+	Default Event that can be used to send signals that do not need to carry additional data
+*/
+
+class SignalDefaultEvent: public SignalEvent{
+public:
+	//creates the event object
+	SignalDefaultEvent(string n);
+	//copy constructor
+	SignalDefaultEvent(SignalDefaultEvent& other);
+	~SignalDefaultEvent();
+	//clone the signal event
+	SignalEvent* clone();
+
+	time_t callTime;	//records the step time it gets called
+	int callCount;		//records the amount of times the event was called
+};
+
+#endif

+ 41 - 0
CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/SignalHandler.cpp

@@ -0,0 +1,41 @@
+#ifndef SIGNALHANDLER_CPP
+#define SIGNALHANDLER_CPP
+
+#include "SignalHandler.h"
+#include "../myHelper.cpp"
+
+/////SignalEvent
+
+/////SignalHandler
+SignalHandler::SignalHandler(){
+	id = myHelper::randomString(8);
+}
+SignalHandler::~SignalHandler(){
+	
+}
+string SignalHandler::getID() const{
+	return id;
+}
+
+FunctionHandler::FunctionHandler(function<void(SignalEvent*)> newFunc){
+	func = newFunc;
+}
+FunctionHandler::FunctionHandler(FunctionHandler& other){
+	func = other.func;
+}
+FunctionHandler::~FunctionHandler(){
+	func = NULL;
+}
+void FunctionHandler::handle(SignalEvent* event){
+	//run function
+	func(event);
+}
+/////SignalBus
+
+///ObjectSignalEvent
+
+
+///ObjectSignalBus
+
+
+#endif

+ 54 - 0
CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/SignalHandler.h

@@ -0,0 +1,54 @@
+#ifndef SIGNALHANDLER_H
+#define SIGNALHANDLER_H
+
+#include <iostream>
+#include <iomanip>
+#include <string>
+#include <vector>
+#include <map>
+#include <ctime>
+
+#include <functional>
+
+#include "SignalEvent.h"
+
+using namespace std;
+
+/*	
+	SignalHandler will run a certain function whenever the signal is emitted and received, which "handles" the signal and data passed through
+	This runs or handles the state change in the observer
+*/
+
+class SignalHandler{
+public:
+	//creates the signal handler with a unique id
+	SignalHandler();
+	~SignalHandler();
+	//gets the id of handler
+	string getID() const;
+	//function used to handler the event and its data
+	virtual void handle(SignalEvent* event) = 0;
+
+private:
+	string id;
+};
+
+/*	
+	FunctionHandler is a signal handler will take a function as a paramter for contruction and use that to handle the signal instead
+*/
+
+class FunctionHandler: public SignalHandler{
+public:
+	//creates the signal handler with a function to store. Note that this is normally a function lambda
+	FunctionHandler(function<void(SignalEvent*)> newFunc);
+	//copy constructor for the handler
+	FunctionHandler(FunctionHandler& other);
+	~FunctionHandler();
+protected:
+	//function used to run the function contained to handle the event and its data
+	virtual void handle(SignalEvent* event);
+	//variable used to store the function. Function is a void type that takes a signalEvent ptr as a parameter
+	function<void(SignalEvent*)> func;
+};
+
+#endif

+ 128 - 0
CPP-Signal-Bus/CPP-Signal-Bus/SignalHandler/main.cpp

@@ -0,0 +1,128 @@
+#include <iostream>
+#include <cstdlib>
+#include <ctime>
+#include <random>
+#include <cmath>
+#include <math.h>
+
+#include <functional>
+
+#include "SignalBus.h"
+#include "ObjectSignalHandler.h"
+#include "../myHelper.cpp"
+
+
+using namespace std;
+
+class SillyEvent: public SignalEvent{
+public:
+    SillyEvent(string n, string msg):SignalEvent(n){
+        message = msg;
+    }
+    SillyEvent(SillyEvent& other){
+        name = other.name;
+        other.message = other.message;
+    }
+    ~SillyEvent(){}
+
+    SignalEvent* clone(){
+        return new SillyEvent(*this);
+    }
+
+    string getMessage() const{
+        return message;
+    }
+protected:
+    string message;
+};
+
+class SillyHandler: public SignalHandler{
+    friend class myContext;
+public:
+    SillyHandler(function<void(SillyEvent*)> f){
+        func = f;
+    }
+    ~SillyHandler(){
+
+    }
+protected:
+    function<void(SillyEvent*)> func;
+
+    virtual void handle(SignalEvent* event){
+        SillyEvent* e = static_cast<SillyEvent*>(event);
+
+        cout<<"Message is being set to "<<e->getMessage()<<endl;
+        func(e);
+    }
+};
+
+class SillySignalBus: public SignalBus{
+public:
+    SillySignalBus(){}
+    ~SillySignalBus(){}
+
+    virtual void emit(string n, string p){
+        if(hasSignal(n)){
+            vector<SignalHandler*> listeners = (*signals[n]);
+
+            SignalEvent* event = createSignalEvent(n, p);
+            sendEvent(n, event);
+        }
+    }
+    int getListenerCount(string n){
+        if(hasSignal(n)){
+            vector<SignalHandler*>* listeners = signals[n];
+            return listeners->size();
+        }
+        return 0;
+    }
+protected:
+    virtual SignalEvent* createSignalEvent(string n){
+        return new SillyEvent(n, myHelper::randomString(10));
+    }
+    virtual SignalEvent* createSignalEvent(string n, string p){
+        return new SillyEvent(n, p);
+    }
+};
+
+class myContext{
+public:
+    myContext(){
+        function<void(SignalEvent*)> f = [this](SignalEvent* e){
+            handle(e);
+        };
+        handler = new FunctionHandler(f);
+    }
+    ~myContext(){}
+
+    SignalHandler* handler;
+protected:
+    void handle(SignalEvent* _e){
+        SillyEvent* e = static_cast<SillyEvent*>(_e);
+
+        cout<<"Message: "<<e->getMessage()<<endl;
+    }
+};
+
+void signalTest(){
+   SillySignalBus* bus = new SillySignalBus();
+
+   myContext context;
+   bus->subscribe("set", context.handler);
+
+   for(int i=0; i<4; i++){
+        if(i%2==0){
+            bus->emit("set", "Mishka is old");
+        }else{
+            cout<<"Nothing at "<<i<<endl;
+        }
+   }
+
+   bus->unsubscribe("set", context.handler);
+}
+
+// int main(){
+//     signalTest();
+
+//     return 0;
+// }

+ 416 - 0
CPP-Signal-Bus/CPP-Signal-Bus/main.cpp

@@ -0,0 +1,416 @@
+// CPP-Signal-Bus.cpp : This file contains the 'main' function. Program execution begins and ends there.
+// https://github.com/catsums/CPP-Signal-Bus/tree/main
+
+
+#if 1
+
+#include <cstdlib>
+#include <ctime>
+#include <random>
+#include <cmath>
+#include <math.h>
+
+#include <functional>
+
+#include "ActionManager/ActionManager.h"
+#include "myHelper.cpp"
+
+using namespace std;
+
+int getRandomInt(int a, int b) {
+	return myHelper::uniformDistribution<int>(a, b);
+}
+
+string getRandomString(int size) {
+	return myHelper::randomString(size);
+}
+
+class myContext {
+public:
+	string name;
+	int reqCount = 5;
+	vector<ActionRequest*> requests;
+	myContext(string n) {
+		name = n;
+	}
+	~myContext() {
+
+	}
+
+	void checkRequests() {
+
+		for (int i = 0; i < (int)requests.size();i++) {
+			ActionRequest* req = requests[i];
+			if (req->getWaitCount() <= 0) {
+				requests.erase(requests.begin() + i);
+				i--;
+			}
+		}
+	}
+
+	ActionRequest* createRequest(map<string, string>& data, ActionManager* actionManager) {
+		ActionRequest* req = new ActionRequest(getRandomInt(2, 8), data, [this](SignalEvent* e) {
+			onHandle(e);
+			});
+
+		actionManager->pushRequest(req);
+
+		reqCount--;
+		requests.push_back(req);
+
+		return req;
+	}
+
+	void onProcess(ActionResult* res) {
+		res->setData("fish", name);
+	}
+
+	void onHandle(SignalEvent* e) {
+		try {
+			ActionResult* res = dynamic_cast<ActionResult*>(e);
+
+			if (res->isFinished()) {
+				if (res->isSuccess()) {
+					cout << "SUCCESS OK" << endl;
+
+					cout << "> Fishes ID:" << res->getData("fish") << endl;
+				}
+				else {
+					cout << "FAIL" << endl;
+				}
+			}
+			else {
+				cout << "Still Processing..." << endl;
+				onProcess(res);
+			}
+		}
+		catch (const bad_cast& err) {
+			cout << "Error trying to cast SignalEvent to ActionEvent" << endl;
+		}
+
+	}
+};
+
+class StepManager {
+public:
+	ActionManager actionManager;
+	vector<myContext*> arr;
+	int step = 0;
+	int maxStep = 10;
+	StepManager() {
+
+	}
+	~StepManager() {
+
+	}
+	void mainLoop() {
+		while (step < maxStep) {
+			cout << "----Step " << step << "----" << endl;
+			cout << "------------------------" << endl;
+
+			//run all requests
+			cout << ">>> Running requests" << endl;
+			while (!actionManager.isEmptyQueue()) {
+				actionManager.handleCurrRequest();
+			}
+			actionManager.placeNextQueue();
+
+			//try to get requests
+			cout << ">>> Pushing requests" << endl;
+			checkEnvironment();
+
+			step++;
+		}
+	}
+	void checkEnvironment() {
+		for (int i = 0; i < (int)arr.size();i++) {
+			myContext* ctx = arr[i];
+			int coin = getRandomInt(0, 1);
+			if (coin == 1) {
+				cout << ctx->name << " opened a request" << endl;
+				map<string, string> reqData;
+				reqData["fish"] = getRandomString(8);
+				ctx->createRequest(reqData, &actionManager);
+			}
+		}
+	}
+};
+
+void managerTest()
+{
+	StepManager manager;
+
+	manager.arr.push_back(new myContext("carp"));
+	manager.arr.push_back(new myContext("hake"));
+	manager.arr.push_back(new myContext("jellyfish"));
+
+	manager.mainLoop();
+}
+
+int main() {
+	managerTest();
+
+	return 0;
+}
+
+#else
+
+#include <iostream>
+#include <cstdlib>
+#include <ctime>
+#include <random>
+#include <cmath>
+#include <math.h>
+
+#include <functional>
+
+#include "SignalBus.h"
+#include "ObjectSignalHandler.h"
+#include "../myHelper.cpp"
+
+
+using namespace std;
+
+class SillyEvent : public SignalEvent {
+public:
+	SillyEvent(string n, string msg) :SignalEvent(n) {
+		message = msg;
+	}
+	SillyEvent(SillyEvent& other) {
+		name = other.name;
+		other.message = other.message;
+	}
+	~SillyEvent() {}
+
+	SignalEvent* clone() {
+		return new SillyEvent(*this);
+	}
+
+	string getMessage() const {
+		return message;
+	}
+protected:
+	string message;
+};
+
+class SillyHandler : public SignalHandler {
+	friend class myContext;
+public:
+	SillyHandler(function<void(SillyEvent*)> f) {
+		func = f;
+	}
+	~SillyHandler() {
+
+	}
+protected:
+	function<void(SillyEvent*)> func;
+
+	virtual void handle(SignalEvent* event) {
+		SillyEvent* e = static_cast<SillyEvent*>(event);
+
+		cout << "Message is being set to " << e->getMessage() << endl;
+		func(e);
+	}
+};
+
+class SillySignalBus : public SignalBus {
+public:
+	SillySignalBus() {}
+	~SillySignalBus() {}
+
+	virtual void emit(string n, string p) {
+		if (hasSignal(n)) {
+			vector<SignalHandler*> listeners = (*signals[n]);
+
+			SignalEvent* event = createSignalEvent(n, p);
+			sendEvent(n, event);
+		}
+	}
+	int getListenerCount(string n) {
+		if (hasSignal(n)) {
+			vector<SignalHandler*>* listeners = signals[n];
+			return listeners->size();
+		}
+		return 0;
+	}
+protected:
+	virtual SignalEvent* createSignalEvent(string n) {
+		return new SillyEvent(n, myHelper::randomString(10));
+	}
+	virtual SignalEvent* createSignalEvent(string n, string p) {
+		return new SillyEvent(n, p);
+	}
+};
+
+class myContext {
+public:
+	myContext() {
+		function<void(SignalEvent*)> f = [this](SignalEvent* e) {
+			handle(e);
+			};
+		handler = new FunctionHandler(f);
+	}
+	~myContext() {}
+
+	SignalHandler* handler;
+protected:
+	void handle(SignalEvent* _e) {
+		SillyEvent* e = static_cast<SillyEvent*>(_e);
+
+		cout << "Message: " << e->getMessage() << endl;
+	}
+};
+
+void signalTest() {
+	SillySignalBus* bus = new SillySignalBus();
+
+	myContext context;
+	bus->subscribe("set", context.handler);
+
+	for (int i = 0; i < 4; i++) {
+		if (i % 2 == 0) {
+			bus->emit("set", "Mishka is old");#include <iostream>
+#include <cstdlib>
+#include <ctime>
+#include <random>
+#include <cmath>
+#include <math.h>
+
+#include <functional>
+
+#include "SignalBus.h"
+#include "ObjectSignalHandler.h"
+#include "../myHelper.cpp"
+
+
+				using namespace std;
+
+			class SillyEvent : public SignalEvent {
+			public:
+				SillyEvent(string n, string msg) :SignalEvent(n) {
+					message = msg;
+				}
+				SillyEvent(SillyEvent& other) {
+					name = other.name;
+					other.message = other.message;
+				}
+				~SillyEvent() {}
+
+				SignalEvent* clone() {
+					return new SillyEvent(*this);
+				}
+
+				string getMessage() const {
+					return message;
+				}
+			protected:
+				string message;
+			};
+
+			class SillyHandler : public SignalHandler {
+				friend class myContext;
+			public:
+				SillyHandler(function<void(SillyEvent*)> f) {
+					func = f;
+				}
+				~SillyHandler() {
+
+				}
+			protected:
+				function<void(SillyEvent*)> func;
+
+				virtual void handle(SignalEvent* event) {
+					SillyEvent* e = static_cast<SillyEvent*>(event);
+
+					cout << "Message is being set to " << e->getMessage() << endl;
+					func(e);
+				}
+			};
+
+			class SillySignalBus : public SignalBus {
+			public:
+				SillySignalBus() {}
+				~SillySignalBus() {}
+
+				virtual void emit(string n, string p) {
+					if (hasSignal(n)) {
+						vector<SignalHandler*> listeners = (*signals[n]);
+
+						SignalEvent* event = createSignalEvent(n, p);
+						sendEvent(n, event);
+					}
+				}
+				int getListenerCount(string n) {
+					if (hasSignal(n)) {
+						vector<SignalHandler*>* listeners = signals[n];
+						return listeners->size();
+					}
+					return 0;
+				}
+			protected:
+				virtual SignalEvent* createSignalEvent(string n) {
+					return new SillyEvent(n, myHelper::randomString(10));
+				}
+				virtual SignalEvent* createSignalEvent(string n, string p) {
+					return new SillyEvent(n, p);
+				}
+			};
+
+			class myContext {
+			public:
+				myContext() {
+					function<void(SignalEvent*)> f = [this](SignalEvent* e) {
+						handle(e);
+						};
+					handler = new FunctionHandler(f);
+				}
+				~myContext() {}
+
+				SignalHandler* handler;
+			protected:
+				void handle(SignalEvent* _e) {
+					SillyEvent* e = static_cast<SillyEvent*>(_e);
+
+					cout << "Message: " << e->getMessage() << endl;
+				}
+			};
+
+			void signalTest() {
+				SillySignalBus* bus = new SillySignalBus();
+
+				myContext context;
+				bus->subscribe("set", context.handler);
+
+				for (int i = 0; i < 4; i++) {
+					if (i % 2 == 0) {
+						bus->emit("set", "Mishka is old");
+					}
+					else {
+						cout << "Nothing at " << i << endl;
+					}
+				}
+
+				bus->unsubscribe("set", context.handler);
+			}
+
+			// int main(){
+			//     signalTest();
+
+			//     return 0;
+			// }
+		}
+		else {
+			cout << "Nothing at " << i << endl;
+		}
+	}
+
+	bus->unsubscribe("set", context.handler);
+}
+
+// int main(){
+//     signalTest();
+
+//     return 0;
+// }
+
+#endif 

+ 99 - 0
CPP-Signal-Bus/CPP-Signal-Bus/myHelper.cpp

@@ -0,0 +1,99 @@
+#pragma once
+
+#include <cstdlib>
+#include <random>
+#include <cmath>
+#include <math.h>
+#include <iostream>
+#include <ctime>
+#include <string>
+#include <vector>
+
+#define M_PI 3.1413927
+
+using namespace std;
+
+class myHelper {
+public:
+
+	template <typename T>
+	static T uniformDistribution(T a, T b) {
+		T max, min;
+		if (a > b) {
+			max = a; min = b;
+		}
+		else {
+			max = b; min = a;
+		}
+		random_device rd;
+		mt19937 gen(rd());
+		uniform_real_distribution<double> distr(min, max);
+
+		return (T)distr(gen);
+	}
+	template <typename T>
+	static T normalDistribution(T u, T o) {
+		srand(time(0));
+		double u1 = uniformDistribution<double>(0.0, 1.0);
+		double u2 = uniformDistribution<double>(0.0, 1.0);
+
+		double z0 = sqrt(-2.0 * log(u1)) * cos(2.0 * M_PI * u2);
+		double z1 = sqrt(-2.0 * log(u1)) * sin(2.0 * M_PI * u2);
+
+		double res = z0 * o + u;
+
+		return (T)res;
+
+	}
+
+	static int randomInt(int a, int b) {
+		if (a > b) {
+			int temp = a;
+			a = b;
+			b = temp;
+		}
+		return (int)uniformDistribution<int>(a, b);
+	}
+	static int getRandomInt(int a, int b) {
+		return randomInt(a, b);
+	}
+	template <typename T>
+	static T getRandomItemFrom(vector<T> arr) {
+		int index = randomInt(0, arr.size());
+
+		return arr[index];
+	}
+	static double randomDouble(double a, double b) {
+		if (a > b) {
+			double temp = a;
+			a = b;
+			b = temp;
+		}
+		return (double)uniformDistribution<double>(a, b);
+	}
+	static string randomString(int len = 9) {
+		const char alphanum[] =
+			"0123456789"
+			"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+			"abcdefghijklmnopqrstuvwxyz";
+		int stringLen = sizeof(alphanum) - 1;
+
+		string str;
+		for (int i = 0; i < len; i++) {
+			int rnd = randomInt(0, stringLen);
+			str += alphanum[rnd % stringLen];
+		}
+		return str;
+	}
+
+	static int coinFlip() {
+		return randomInt(0, 2);
+	}
+	static int diceRoll() {
+		return randomInt(1, 7);
+	}
+	static int diceRoll(int size) {
+		return randomInt(1, size + 1);
+	}
+
+};

BIN
CPP-Signal-Bus/CPP-Signal-Bus/x64/Debug/ActionManager.obj


BIN
CPP-Signal-Bus/CPP-Signal-Bus/x64/Debug/ActionRequest.obj


BIN
CPP-Signal-Bus/CPP-Signal-Bus/x64/Debug/ActionResult.obj


+ 11 - 0
CPP-Signal-Bus/CPP-Signal-Bus/x64/Debug/CPP-Signal-Bus.exe.recipe

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project>
+  <ProjectOutputs>
+    <ProjectOutput>
+      <FullPath>C:\Users\sfreunde\source\repos\CPP-Signal-Bus\x64\Debug\CPP-Signal-Bus.exe</FullPath>
+    </ProjectOutput>
+  </ProjectOutputs>
+  <ContentFiles />
+  <SatelliteDlls />
+  <NonRecipeFileRefs />
+</Project>

BIN
CPP-Signal-Bus/CPP-Signal-Bus/x64/Debug/CPP-Signal-Bus.ilk


+ 3 - 0
CPP-Signal-Bus/CPP-Signal-Bus/x64/Debug/CPP-Signal-Bus.log

@@ -0,0 +1,3 @@
+  main.cpp
+C:\Users\sfreunde\source\repos\CPP-Signal-Bus\CPP-Signal-Bus\main.cpp(87,26): warning C4101: 'err': unreferenced local variable
+  CPP-Signal-Bus.vcxproj -> C:\Users\sfreunde\source\repos\CPP-Signal-Bus\x64\Debug\CPP-Signal-Bus.exe

BIN
CPP-Signal-Bus/CPP-Signal-Bus/x64/Debug/CPP-Signal-Bus.obj


BIN
CPP-Signal-Bus/CPP-Signal-Bus/x64/Debug/CPP-Signal-Bus.tlog/CL.command.1.tlog


BIN
CPP-Signal-Bus/CPP-Signal-Bus/x64/Debug/CPP-Signal-Bus.tlog/CL.read.1.tlog


BIN
CPP-Signal-Bus/CPP-Signal-Bus/x64/Debug/CPP-Signal-Bus.tlog/CL.write.1.tlog


Неке датотеке нису приказане због велике количине промена