• Main Page
  • Related Pages
  • Classes
  • Files
  • File List

src/ActionSource.hh

00001 /*
00002  * Copyright Staffan Gimåker 2010.
00003  *
00004  * ---
00005  *
00006  * This file is part of peekabot.
00007  *
00008  * peekabot is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 3 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * peekabot is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00020  */
00021 
00022 #ifndef PEEKABOT_ACTION_SOURCE_HH_INCLUDED
00023 #define PEEKABOT_ACTION_SOURCE_HH_INCLUDED
00024 
00025 
00026 #include "Types.hh"
00027 
00028 #include <list>
00029 #include <boost/bimap.hpp>
00030 #include <boost/shared_ptr.hpp>
00031 #include <boost/filesystem/path.hpp>
00032 
00033 
00034 namespace peekabot
00035 {
00036     class Path;
00037     class UploadCache;
00038     class Config;
00039     class Action;
00040 
00041     class ActionSource
00042     {
00043     public:
00044         void add_pseudonym(ObjectID pseudo_id, ObjectID real_id);
00045 
00046         void remove_pseudonym(ObjectID pseudo_id);
00047 
00048         ObjectID pseudonym_to_real(ObjectID pseudo_id);
00049 
00050         ObjectID real_to_pseudonym(ObjectID real_id);
00051 
00052         boost::shared_ptr<UploadCache> get_upload_cache();
00053 
00054         void append_search_dir(const boost::filesystem::path &dir);
00055 
00056         void prepend_search_dir(const boost::filesystem::path &dir);
00057 
00058         const std::list<boost::filesystem::path> &get_search_dirs() const;
00059 
00060         Path make_data_path(const std::string &path) const;
00061 
00062         virtual void send_response(const boost::shared_ptr<Action> &action) = 0;
00063 
00064     protected:
00065         ActionSource(const Config &config);
00066 
00067     private:
00068         typedef boost::bimap<ObjectID, ObjectID> PseudonymBimap;
00069         PseudonymBimap m_pseudonyms;
00070 
00071         boost::shared_ptr<UploadCache> m_upload_cache;
00072 
00073         std::list<boost::filesystem::path> m_search_dirs;
00074     };
00075 }
00076 
00077 
00078 #endif // PEEKABOT_ACTION_SOURCE_HH_INCLUDED

Generated on Sun Jan 30 2011 for peekabot by  doxygen 1.7.1