diff options
author | Richard Linden <none@none> | 2012-03-29 23:48:29 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2012-03-29 23:48:29 -0700 |
commit | 2fa1c42aadbe2a29e1bcced9a487c0e5abf0602b (patch) | |
tree | 08d9ebd23121654a9cf4e0561b1256de9bc9b608 /indra/llui/llnotifications.h | |
parent | 1ea65f0285d7022ce20ef84d4e35e3c94bcb3fbd (diff) |
CHUI-51 WIP notifications routig code cleanup
phase 2, removal of extraneous signaling in favor of llnotificationchannels
made notificationchannels work better with overrides and lifetime managed
by creator
Diffstat (limited to 'indra/llui/llnotifications.h')
-rw-r--r-- | indra/llui/llnotifications.h | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index f83365a97d..344108ecbf 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -94,10 +94,11 @@ // and we need this to manage the notification callbacks #include "llevents.h" #include "llfunctorregistry.h" -#include "llpointer.h" #include "llinitparam.h" #include "llnotificationslistener.h" #include "llnotificationptr.h" +#include "llpointer.h" +#include "llrefcount.h" class LLAvatarName; typedef enum e_notification_priority @@ -707,7 +708,8 @@ typedef std::multimap<std::string, LLNotificationPtr> LLNotificationMap; // all of the built-in tests should attach to the "Visible" channel // class LLNotificationChannelBase : - public LLEventTrackable + public LLEventTrackable, + public LLRefCount { LOG_CLASS(LLNotificationChannelBase); public: @@ -787,26 +789,48 @@ protected: // destroy it, but if it becomes necessary to do so, the shared_ptr model // will ensure that we don't leak resources. class LLNotificationChannel; -typedef boost::shared_ptr<LLNotificationChannel> LLNotificationChannelPtr; +typedef boost::intrusive_ptr<LLNotificationChannel> LLNotificationChannelPtr; // manages a list of notifications // Note that if this is ever copied around, we might find ourselves with multiple copies // of a queue with notifications being added to different nonequivalent copies. So we -// make it inherit from boost::noncopyable, and then create a map of shared_ptr to manage it. +// make it inherit from boost::noncopyable, and then create a map of LLPointer to manage it. // class LLNotificationChannel : boost::noncopyable, - public LLNotificationChannelBase + public LLNotificationChannelBase, + public LLInstanceTracker<LLNotificationChannel, std::string> { LOG_CLASS(LLNotificationChannel); public: + // Notification Channels have a filter, which determines which notifications + // will be added to this channel. + // Channel filters cannot change. + struct Params : public LLInitParam::Block<Params> + { + Mandatory<std::string> name; + Optional<LLNotificationFilter> filter; + Optional<LLNotificationComparator> comparator; + Multiple<std::string> sources; + + Params() + : comparator("", LLNotificationComparators::orderByUUID()) + {} + }; + + LLNotificationChannel(const Params& p = Params()); + + LLNotificationChannel(const std::string& name, const std::string& parent, + LLNotificationFilter filter, LLNotificationComparator comparator=LLNotificationComparators::orderByUUID()); + virtual ~LLNotificationChannel() {} typedef LLNotificationSet::iterator Iterator; std::string getName() const { return mName; } - std::string getParentChannelName() { return mParent; } + void connectToChannel(const std::string& channel_name); + bool isEmpty() const; Iterator begin(); @@ -818,14 +842,6 @@ public: std::string summarize(); - // Notification Channels have a filter, which determines which notifications - // will be added to this channel. - // Channel filters cannot change. - // Channels have a protected constructor so you can't make smart pointers that don't - // come from our internal reference; call NotificationChannel::build(args) - LLNotificationChannel(const std::string& name, const std::string& parent, - LLNotificationFilter filter, LLNotificationComparator comparator=LLNotificationComparators::orderByUUID()); - private: std::string mName; std::string mParent; @@ -912,10 +928,6 @@ public: void createDefaultChannels(); - typedef std::map<std::string, LLNotificationChannelPtr> ChannelMap; - ChannelMap mChannels; - - void addChannel(LLNotificationChannelPtr pChan); LLNotificationChannelPtr getChannel(const std::string& channelName); std::string getGlobalString(const std::string& key) const; @@ -954,6 +966,7 @@ private: bool mIgnoreAllNotifications; boost::scoped_ptr<LLNotificationsListener> mListener; + std::vector<LLNotificationChannelPtr> mDefaultChannels; }; /** |