summaryrefslogtreecommitdiff
path: root/indra/llcommon/lleventdispatcher.h
diff options
context:
space:
mode:
authorDmitry Zaporozhan <dzaporozhan@productengine.com>2009-11-12 19:29:05 +0200
committerDmitry Zaporozhan <dzaporozhan@productengine.com>2009-11-12 19:29:05 +0200
commitd149b28173c2b255bd1bf1db902368dfbdf3064a (patch)
treed433c57f07aad0959519f8b88ccd1ed8447af7bf /indra/llcommon/lleventdispatcher.h
parent38115eb90b1760025ee299a167f6a9a2311f59ab (diff)
parent3b7ed8a4e9fdff83f89b49760d281ee5c13c8155 (diff)
Merge
--HG-- branch : product-engine
Diffstat (limited to 'indra/llcommon/lleventdispatcher.h')
-rw-r--r--indra/llcommon/lleventdispatcher.h35
1 files changed, 27 insertions, 8 deletions
diff --git a/indra/llcommon/lleventdispatcher.h b/indra/llcommon/lleventdispatcher.h
index 5a86b90bff..eba7b607f1 100644
--- a/indra/llcommon/lleventdispatcher.h
+++ b/indra/llcommon/lleventdispatcher.h
@@ -44,7 +44,10 @@ public:
* is used to validate the structure of each incoming event (see
* llsd_matches()).
*/
- void add(const std::string& name, const Callable& callable, const LLSD& required=LLSD());
+ void add(const std::string& name,
+ const std::string& desc,
+ const Callable& callable,
+ const LLSD& required=LLSD());
/**
* Special case: a subclass of this class can pass an unbound member
@@ -52,18 +55,22 @@ public:
* <tt>boost::bind()</tt> expression.
*/
template <class CLASS>
- void add(const std::string& name, void (CLASS::*method)(const LLSD&),
+ void add(const std::string& name,
+ const std::string& desc,
+ void (CLASS::*method)(const LLSD&),
const LLSD& required=LLSD())
{
- addMethod<CLASS>(name, method, required);
+ addMethod<CLASS>(name, desc, method, required);
}
/// Overload for both const and non-const methods
template <class CLASS>
- void add(const std::string& name, void (CLASS::*method)(const LLSD&) const,
+ void add(const std::string& name,
+ const std::string& desc,
+ void (CLASS::*method)(const LLSD&) const,
const LLSD& required=LLSD())
{
- addMethod<CLASS>(name, method, required);
+ addMethod<CLASS>(name, desc, method, required);
}
/// Unregister a callable
@@ -86,7 +93,8 @@ public:
private:
template <class CLASS, typename METHOD>
- void addMethod(const std::string& name, const METHOD& method, const LLSD& required)
+ void addMethod(const std::string& name, const std::string& desc,
+ const METHOD& method, const LLSD& required)
{
CLASS* downcast = dynamic_cast<CLASS*>(this);
if (! downcast)
@@ -95,7 +103,7 @@ private:
}
else
{
- add(name, boost::bind(method, downcast, _1), required);
+ add(name, desc, boost::bind(method, downcast, _1), required);
}
}
void addFail(const std::string& name, const std::string& classname) const;
@@ -103,7 +111,18 @@ private:
bool attemptCall(const std::string& name, const LLSD& event) const;
std::string mDesc, mKey;
- typedef std::map<std::string, std::pair<Callable, LLSD> > DispatchMap;
+ struct DispatchEntry
+ {
+ DispatchEntry(const Callable& func, const std::string& desc, const LLSD& required):
+ mFunc(func),
+ mDesc(desc),
+ mRequired(required)
+ {}
+ Callable mFunc;
+ std::string mDesc;
+ LLSD mRequired;
+ };
+ typedef std::map<std::string, DispatchEntry> DispatchMap;
DispatchMap mDispatch;
};