00001 #ifndef __ARC_XML_CONTAINER_H__ 00002 #define __ARC_XML_CONTAINER_H__ 00003 00004 #include <string> 00005 #include <vector> 00006 #include <db_cxx.h> 00007 #include <arc/XMLNode.h> 00008 #include <arc/Logger.h> 00009 00010 namespace Arc 00011 { 00012 00013 class XmlContainer 00014 { 00015 private: 00016 DbEnv *env_; 00017 Db *db_; 00018 DbTxn *update_tid_; 00019 Arc::Logger logger_; 00020 00021 public: 00022 XmlContainer(const std::string &db_path, const std::string &db_name); 00023 ~XmlContainer(); 00024 bool put(const std::string &name, const std::string &content); 00025 std::string get(const std::string &name); 00026 void del(const std::string &name); 00027 std::vector<std::string> get_doc_names(); 00028 void start_update(); 00029 void end_update(); 00030 void checkpoint(); 00031 operator bool(void) {return db_ != NULL;} 00032 bool operator!(void) {return db_ == NULL;} 00033 }; 00034 00035 } 00036 #endif