lleventpoll.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /**
  2. * @file lleventpoll.h
  3. * @brief LLEvDescription of the LLEventPoll class.
  4. *
  5. * $LicenseInfo:firstyear=2006&license=viewergpl$
  6. *
  7. * Copyright (c) 2006-2018, Linden Research, Inc.
  8. * Copyright (c) 2019-2023, Henri Beauchamp.
  9. *
  10. * Second Life Viewer Source Code
  11. * The source code in this file ("Source Code") is provided by Linden Lab
  12. * to you under the terms of the GNU General Public License, version 2.0
  13. * ("GPL"), unless you have obtained a separate licensing agreement
  14. * ("Other License"), formally executed by you and Linden Lab. Terms of
  15. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  16. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  17. *
  18. * There are special exceptions to the terms and conditions of the GPL as
  19. * it is applied to this Source Code. View the full text of the exception
  20. * in the file doc/FLOSS-exception.txt in this software distribution, or
  21. * online at
  22. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  23. *
  24. * By copying, modifying or distributing this software, you acknowledge
  25. * that you have read and understood your obligations described above,
  26. * and agree to abide by those obligations.
  27. *
  28. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  29. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  30. * COMPLETENESS OR PERFORMANCE.
  31. * $/LicenseInfo$
  32. */
  33. #ifndef LL_LLEVENTPOLL_H
  34. #define LL_LLEVENTPOLL_H
  35. #include <string>
  36. #include "llpointer.h"
  37. class LLEventPollImpl;
  38. class LLHost;
  39. struct LLEventPollReplies;
  40. // Implements the viewer side of server-to-viewer pushed events.
  41. class LLEventPoll
  42. {
  43. public:
  44. // Starts polling the URL.
  45. LLEventPoll(U64 handle, const LLHost& sender, const std::string& poll_url);
  46. // Stops polling, cancelling any poll in progress.
  47. ~LLEventPoll();
  48. void setRegionName(const std::string& region_name);
  49. // Returns true when a poll request is waiting for server events and its
  50. // age is within the "safe" window (i.e. when it is believed to be old
  51. // enough for the server to have received it and not too close from the
  52. // timeout). HB
  53. bool isPollInFlight() const;
  54. // Returns the age of the active poll request. HB
  55. F32 getPollAge() const;
  56. // Margin in seconds. HB
  57. static F32 getMargin();
  58. // Must be called at least once per frame, when it is safe to process
  59. // messages (outside the rendering routines, in particular). HB
  60. static void dispatchMessages();
  61. private:
  62. LLPointer<LLEventPollImpl> mImpl;
  63. };
  64. #endif // LL_LLEVENTPOLL_H