Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

BerkeleyDB_Example.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           mdfsdb.h  -  description
00003                              -------------------
00004     begin                : Fri Jan 2 2004
00005     copyright            : (C) 2004 by Mickael Faivre-Macon
00006     email                : mickael@easyplay.com.tw
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef MDFSDBH
00019 #define MDFSDBH
00020 
00021 #include "mdfsdbbase.h"
00022 #include "db.h"
00023 
00024 namespace mdfs {
00025                            
00026 //---------------------------------------------------------------------------
00033 class MDFSDB : public MDFSDBBase {
00034 
00035 public:
00036 
00037    MDFSDB();
00038    ~MDFSDB();
00039 
00040    virtual bool UpdateFile(const MFile& f, int options); 
00041    virtual bool GetFile(MFile& f); 
00042    virtual void GetList(MQuery& q, MFileList& list); 
00043    void GetDirContent(MQuery& q, MFileList& list); 
00044 
00045 private:
00046    boost::mutex Mutex;
00047    struct MEntry {
00048       MEntry() : Updated(false) {}
00049       MFile File;
00050       bool Updated;
00051       };
00052    typedef std::list<MEntry*> MMemDB;      
00053    MMemDB DB;
00054 
00055    ::DB* dbp;
00056    int ret, t_ret;
00057 
00058    void Unmarshall(MFile& f, const DBT& data);
00059    bool Marshall(const MFile& f, DBT& data);
00060    void Load();
00061    void Save();
00062    bool GetEntry(const MFile& f, MEntry* e);
00063 
00064 
00065    };
00066    
00067 //---------------------------------------------------------------------------
00068 
00069 } // namespace
00070 
00071 #endif



MDFS SourceForge project page and download

SourceForge.net Logo

Generated on Sat Jan 3 03:14:20 2004 for MDFS by doxygen1.3.5