You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2013/09/04 20:59:46 UTC
git commit: TS-2177: Add invoke utility method to APIHooks.
Updated Branches:
refs/heads/master b71ca5521 -> 6da47d5c4
TS-2177: Add invoke utility method to APIHooks.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/6da47d5c
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/6da47d5c
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/6da47d5c
Branch: refs/heads/master
Commit: 6da47d5c43419d2d54429d9c777f5e40c774c41a
Parents: b71ca55
Author: Alan M. Carroll <am...@network-geographics.com>
Authored: Wed Sep 4 13:59:04 2013 -0500
Committer: Alan M. Carroll <am...@network-geographics.com>
Committed: Wed Sep 4 13:59:33 2013 -0500
----------------------------------------------------------------------
proxy/InkAPIInternal.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6da47d5c/proxy/InkAPIInternal.h
----------------------------------------------------------------------
diff --git a/proxy/InkAPIInternal.h b/proxy/InkAPIInternal.h
index 971e196..74614df 100644
--- a/proxy/InkAPIInternal.h
+++ b/proxy/InkAPIInternal.h
@@ -143,6 +143,7 @@ public:
APIHook *get();
void clear();
bool is_empty() const;
+ void invoke(int event, void* data);
private:
Que(APIHook, m_link) m_hooks;
@@ -154,6 +155,12 @@ APIHooks::is_empty() const
return NULL == m_hooks.head;
}
+inline void
+APIHooks::invoke(int event, void* data) {
+ for ( APIHook* hook = m_hooks.head ; NULL != hook ; hook = hook->next())
+ hook->invoke(event, data);
+}
+
/** Container for API hooks for a specific feature.
This is an array of hook lists, each identified by a numeric identifier (id). Each array element is a list of all
@@ -184,6 +191,9 @@ public:
/// @return @c true if @a id is a valid id, @c false otherwise.
static bool is_valid(ID id);
+ /// Invoke the callbacks for the hook @a id.
+ void invoke(ID id, int event, void* data);
+
/// Fast check for any hooks in this container.
///
/// @return @c true if any list has at least one hook, @c false if
@@ -246,6 +256,13 @@ FeatureAPIHooks<ID,N>::get(ID id)
}
template < typename ID, ID N >
+void
+FeatureAPIHooks<ID,N>::invoke(ID id, int event, void* data)
+{
+ m_hooks[id].invoke(event, data);
+}
+
+template < typename ID, ID N >
bool
FeatureAPIHooks<ID,N>::has_hooks() const
{