Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

AbuseCacheStack.h

Go to the documentation of this file.
00001 #ifndef ABUSECACHESTACK_H
00002 #define ABUSECACHESTACK_H
00003 
00004 #include <abuse/AbuseAddiesCache.h>
00005 #include <deque>
00006 
00007 /*
00008 This class implements a stack of AbuseAddiesCache*;
00009 Everytime the class is queried for an abuse addy, it loops over the 
00010 stack and ask every cache, stopping when it finds a valid response.
00011 
00012 Implementation Notes:
00013 ==================== 
00014 - The stack is owner of the caches' pointers -> it will free them when
00015   it's destroyed. 
00016 - As it handles some raw pointers, we should write a    
00017   copy ctor and an operator=, but - since we're not interested in deep-copying
00018   an AbuseCacheStack, we simply declare them private and not implemented.
00019 */
00020 
00021 class AbuseCacheStack: public AbuseAddiesCache
00022 {
00023 public:
00024         AbuseCacheStack(){}
00025         //AbuseAddiesCache Interface
00026         virtual ~AbuseCacheStack();
00027         virtual std::list<std::string> query(const Url& url)const throw(std::runtime_error);
00028         virtual std::list<std::string> query(const std::string& doman)const throw(std::runtime_error);
00029         virtual void add(const UrlRange& range,const std::list<std::string>& addies);
00030 
00031         //other public methods
00032         //note: I don't use the usual notation myMethod
00033         //      I use the STL one, as it sounds more familiar here
00034         void push_front(AbuseAddiesCache* cache);
00035         void push_back(AbuseAddiesCache* cache);
00036         size_t size()const;
00037         AbuseAddiesCache* pop_front();
00038         AbuseAddiesCache* pop_back();
00039 private:
00040         std::deque<AbuseAddiesCache*> m_stack;
00041         //not implemented!
00042         AbuseCacheStack(const AbuseCacheStack&);
00043         void operator=(const AbuseCacheStack&);
00044 };
00045 
00046 #endif  //ABUSECACHESTACK_H

Generated on Thu Jun 16 00:13:24 2005 for Abuse! by  doxygen 1.4.3