summaryrefslogtreecommitdiff
path: root/channels.h
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2003-04-15 00:38:48 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2003-04-15 00:38:48 +0000
commit78cbd84a0068db09b6d08ff14a316800ad9be89a (patch)
tree2be608b49b99003d7d6f49ac33abd7bbe763d7d9 /channels.h
parent0a0244dacface689335de6e0edf978b29ddb66e1 (diff)
downloadcryptopp-78cbd84a0068db09b6d08ff14a316800ad9be89a.tar.gz
fix bug in Grouper
add RIPEMD-???, Whirlpool, Shacal2, Camellia, Two-Track MAC (Kevin Springle) change ChannelSwitch to allow non-blocking input (denis bider) change Redirector to allow more options (denis bider) fix MaurerRandomnessTest optimize MD2 (Kevin Springle) git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@55 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'channels.h')
-rw-r--r--channels.h48
1 files changed, 39 insertions, 9 deletions
diff --git a/channels.h b/channels.h
index 4b12ce6..cc9aa66 100644
--- a/channels.h
+++ b/channels.h
@@ -44,16 +44,48 @@ private:
};
#endif
+class ChannelSwitchTypedefs
+{
+public:
+ typedef std::pair<BufferedTransformation *, std::string> Route;
+ typedef std::multimap<std::string, Route> RouteMap;
+
+ typedef std::pair<BufferedTransformation *, value_ptr<std::string> > DefaultRoute;
+ typedef std::list<DefaultRoute> DefaultRouteList;
+
+ typedef RouteMap::const_iterator MapIterator;
+ typedef DefaultRouteList::const_iterator ListIterator;
+};
+
+class ChannelSwitch;
+
+class ChannelRouteIterator : public ChannelSwitchTypedefs
+{
+public:
+ ChannelSwitch& m_cs;
+ std::string m_channel;
+ bool m_useDefault;
+ MapIterator m_itMapCurrent, m_itMapEnd;
+ ListIterator m_itListCurrent, m_itListEnd;
+
+ ChannelRouteIterator(ChannelSwitch &cs) : m_cs(cs) {}
+ void Reset(const std::string &channel);
+ bool End() const;
+ void Next();
+ BufferedTransformation & Destination();
+ const std::string & Channel();
+};
+
//! Route input to different and/or multiple channels based on channel ID
-class ChannelSwitch : public Multichannel<Sink>
+class ChannelSwitch : public Multichannel<Sink>, public ChannelSwitchTypedefs
{
public:
- ChannelSwitch() {}
- ChannelSwitch(BufferedTransformation &destination)
+ ChannelSwitch() : m_it(*this), m_blocked(false) {}
+ ChannelSwitch(BufferedTransformation &destination) : m_it(*this), m_blocked(false)
{
AddDefaultRoute(destination);
}
- ChannelSwitch(BufferedTransformation &destination, const std::string &outChannel)
+ ChannelSwitch(BufferedTransformation &destination, const std::string &outChannel) : m_it(*this), m_blocked(false)
{
AddDefaultRoute(destination, outChannel);
}
@@ -75,14 +107,12 @@ public:
void RemoveRoute(const std::string &inChannel, BufferedTransformation &destination, const std::string &outChannel);
private:
- typedef std::pair<BufferedTransformation *, std::string> Route;
- typedef std::multimap<std::string, Route> RouteMap;
RouteMap m_routeMap;
-
- typedef std::pair<BufferedTransformation *, value_ptr<std::string> > DefaultRoute;
- typedef std::list<DefaultRoute> DefaultRouteList;
DefaultRouteList m_defaultRoutes;
+ ChannelRouteIterator m_it;
+ bool m_blocked;
+
friend class ChannelRouteIterator;
};