Changeset 42354 in vbox for trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h
- Timestamp:
- Jul 24, 2012 12:13:00 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h
r42272 r42354 19 19 #define ____H_GUESTIMPLPRIVATE 20 20 21 #include <iprt/asm.h> 21 22 #include <iprt/semaphore.h> 22 23 … … 67 68 68 69 /** 69 * Generic class for a all guest control callbacks. 70 */ 71 class GuestCtrlCallback 72 { 73 public: 74 70 * Generic class for a all guest control callbacks/events. 71 */ 72 class GuestCtrlEvent 73 { 74 public: 75 76 GuestCtrlEvent(void); 77 78 virtual ~GuestCtrlEvent(void); 79 80 /** @todo Copy/comparison operator? */ 81 82 public: 83 84 int Cancel(void); 85 86 bool Canceled(void); 87 88 virtual void Destroy(void); 89 90 int Init(void); 91 92 virtual int Signal(int rc = VINF_SUCCESS); 93 94 int GetResultCode(void) { return mRC; } 95 96 int Wait(ULONG uTimeoutMS); 97 98 protected: 99 100 /** Was the callback canceled? */ 101 bool fCanceled; 102 /** Did the callback complete? */ 103 bool fCompleted; 104 /** The event semaphore for triggering 105 * the actual event. */ 106 RTSEMEVENT hEventSem; 107 /** The waiting mutex. */ 108 RTSEMMUTEX hEventMutex; 109 /** Overall result code. */ 110 int mRC; 111 }; 112 113 /* 114 * Class representing a guest control callback. 115 */ 116 class GuestCtrlCallback : public GuestCtrlEvent 117 { 118 public: 75 119 GuestCtrlCallback(void); 76 120 … … 79 123 virtual ~GuestCtrlCallback(void); 80 124 81 /** @todo Copy/comparison operator? */ 82 83 public: 84 85 int Cancel(void); 86 87 bool Canceled(void); 125 public: 126 127 void Destroy(void); 88 128 89 129 int Init(eVBoxGuestCtrlCallbackType enmType); 90 130 91 void Destroy(void); 92 93 int Signal(int rc = VINF_SUCCESS, const Utf8Str &strMsg = ""); 94 95 Utf8Str GetMessage(void) { return mMessage; } 96 97 int GetResultCode(void) { return mRC; } 98 99 eVBoxGuestCtrlCallbackType GetType(void) { return mType; } 100 101 int Wait(ULONG uTimeoutMS); 102 103 protected: 104 131 eVBoxGuestCtrlCallbackType GetCallbackType(void) { return mType; } 132 133 protected: 134 135 /** Pointer to user-supplied data. */ 136 void *pvData; 137 /** Size of user-supplied data. */ 138 size_t cbData; 105 139 /** The callback type. */ 106 140 eVBoxGuestCtrlCallbackType mType; 107 141 /** Callback flags. */ 108 142 uint32_t uFlags; 109 /** Was the callback canceled? */ 110 bool fCanceled; 111 /** Did the callback complete? */ 112 bool fCompleted; 113 /** Pointer to user-supplied data. */ 114 void *pvData; 115 /** Size of user-supplied data. */ 116 size_t cbData; 117 /** The event semaphore triggering the*/ 118 RTSEMEVENT hEventSem; 119 /** Overall result code. */ 143 }; 144 typedef std::map < uint32_t, GuestCtrlCallback* > GuestCtrlCallbacks; 145 146 struct GuestProcessWaitResult 147 { 148 /** The wait result when returning from the wait call. */ 149 ProcessWaitResult_T mResult; 120 150 int mRC; 121 /** Error / information message to the 122 * result code. */ 123 Utf8Str mMessage; 124 }; 125 typedef std::map < uint32_t, GuestCtrlCallback* > GuestCtrlCallbacks; 151 }; 152 153 /* 154 * Class representing a guest control process event. 155 */ 156 class GuestProcessEvent : public GuestCtrlEvent 157 { 158 public: 159 GuestProcessEvent(void); 160 161 GuestProcessEvent(uint32_t uWaitFlags); 162 163 virtual ~GuestProcessEvent(void); 164 165 public: 166 167 void Destroy(void); 168 169 int Init(uint32_t uWaitFlags); 170 171 uint32_t GetWaitFlags(void) { return ASMAtomicReadU32(&mWaitFlags); } 172 173 GuestProcessWaitResult GetResult(void) { return mWaitResult; } 174 175 int Signal(ProcessWaitResult enmResult, int rc = VINF_SUCCESS); 176 177 protected: 178 179 /** The waiting flag(s). The specifies what to 180 * wait for. */ 181 uint32_t mWaitFlags; 182 /** Structure containing the overall result. */ 183 GuestProcessWaitResult mWaitResult; 184 }; 126 185 127 186 /**
Note:
See TracChangeset
for help on using the changeset viewer.