Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.4 KiB

  1. //===== Copyright c 1996-2009, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //===========================================================================//
  7. #ifndef IMATCHASYNC_H
  8. #define IMATCHASYNC_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. //
  13. // Describes possible states of an async operation
  14. //
  15. enum AsyncOperationState_t
  16. {
  17. AOS_RUNNING,
  18. AOS_ABORTING,
  19. AOS_ABORTED,
  20. AOS_FAILED,
  21. AOS_SUCCEEDED,
  22. };
  23. //
  24. // Interface of an async operation
  25. //
  26. abstract_class IMatchAsyncOperation
  27. {
  28. public:
  29. // Poll if operation has completed
  30. virtual bool IsFinished() = 0;
  31. // Operation state
  32. virtual AsyncOperationState_t GetState() = 0;
  33. // Retrieve a generic completion result for simple operations
  34. // that return simple results upon success,
  35. // results are operation-specific, may result in undefined behavior
  36. // if operation is still in progress.
  37. virtual uint64 GetResult() = 0;
  38. virtual uint64 GetResultExtraInfo() { return 0; }
  39. // Request operation to be aborted
  40. virtual void Abort() = 0;
  41. // Release the operation interface and all resources
  42. // associated with the operation. Operation callbacks
  43. // will not be called after Release. Operation object
  44. // cannot be accessed after Release.
  45. virtual void Release() = 0;
  46. };
  47. abstract_class IMatchAsyncOperationCallback
  48. {
  49. public:
  50. // Signals when operation has finished
  51. virtual void OnOperationFinished( IMatchAsyncOperation *pOperation ) = 0;
  52. };
  53. #endif // IMATCHASYNC_H