summaryrefslogtreecommitdiff
path: root/indra/llcommon/llevents.h
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2016-04-04 15:53:09 -0400
committerOz Linden <oz@lindenlab.com>2016-04-04 15:53:09 -0400
commit9be58e915a6c69de280ccabd3019e9ac40beed26 (patch)
treead6f8f1f754a865afb761d0f17744cc7e1ef8b74 /indra/llcommon/llevents.h
parentab46c9226bd9048fa218f54bc8668594401529e7 (diff)
parent18928ea6c6f2830a0d45ec412c915eceff1b76b0 (diff)
merge with 4.0.3-release
Diffstat (limited to 'indra/llcommon/llevents.h')
-rw-r--r--indra/llcommon/llevents.h61
1 files changed, 56 insertions, 5 deletions
diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h
index 0cbd1da32d..6175329a9d 100644
--- a/indra/llcommon/llevents.h
+++ b/indra/llcommon/llevents.h
@@ -217,6 +217,18 @@ public:
* an instance without conferring @em ownership.
*/
LLEventPump& obtain(const std::string& name);
+
+ /**
+ * Find the named LLEventPump instance. If it exists post the message to it.
+ * If the pump does not exist, do nothing.
+ *
+ * returns the result of the LLEventPump::post. If no pump exists returns false.
+ *
+ * This is syntactically similar to LLEventPumps::instance().post(name, message),
+ * however if the pump does not already exist it will not be created.
+ */
+ bool post(const std::string&, const LLSD&);
+
/**
* Flush all known LLEventPump instances
*/
@@ -496,7 +508,7 @@ public:
// at the boost::bind object itself before that happens.
return LLEventDetail::visit_and_connect(name,
listener,
- boost::bind(&LLEventPump::listen_impl,
+ boost::bind(&LLEventPump::listen_invoke,
this,
name,
_1,
@@ -541,13 +553,23 @@ private:
virtual void reset();
+
+
private:
- virtual LLBoundListener listen_impl(const std::string& name, const LLEventListener&,
- const NameList& after,
- const NameList& before);
+ LLBoundListener listen_invoke(const std::string& name, const LLEventListener& listener,
+ const NameList& after,
+ const NameList& before)
+ {
+ return this->listen_impl(name, listener, after, before);
+ }
+
std::string mName;
protected:
+ virtual LLBoundListener listen_impl(const std::string& name, const LLEventListener&,
+ const NameList& after,
+ const NameList& before);
+
/// implement the dispatching
boost::shared_ptr<LLStandardSignal> mSignal;
@@ -586,10 +608,39 @@ public:
};
/*****************************************************************************
+ * LLEventMailDrop
+ *****************************************************************************/
+/**
+ * LLEventMailDrop is a specialization of LLEventStream. Events are posted normally,
+ * however if no listeners return that they have handled the event it is placed in
+ * a queue. Subsequent attaching listeners will receive stored events from the queue
+ * until a listener indicates that the event has been handled. In order to receive
+ * multiple events from a mail drop the listener must disconnect and reconnect.
+ */
+class LL_COMMON_API LLEventMailDrop : public LLEventStream
+{
+public:
+ LLEventMailDrop(const std::string& name, bool tweak = false) : LLEventStream(name, tweak) {}
+ virtual ~LLEventMailDrop() {}
+
+ /// Post an event to all listeners
+ virtual bool post(const LLSD& event);
+
+protected:
+ virtual LLBoundListener listen_impl(const std::string& name, const LLEventListener&,
+ const NameList& after,
+ const NameList& before);
+
+private:
+ typedef std::list<LLSD> EventList;
+ EventList mEventHistory;
+};
+
+/*****************************************************************************
* LLEventQueue
*****************************************************************************/
/**
- * LLEventQueue isa LLEventPump whose post() method defers calling registered
+ * LLEventQueue is a LLEventPump whose post() method defers calling registered
* listeners until flush() is called.
*/
class LL_COMMON_API LLEventQueue: public LLEventPump