1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
9 #ifndef dbos_workdir_storage_Directory_hpp
10 #define dbos_workdir_storage_Directory_hpp
12 #include <anna/dbos/Object.hpp>
13 #include <anna/dbos/ObjectFacade.hpp>
14 #include <anna/dbos/Loader.hpp>
28 namespace filesystem {
36 class Directory : public dbos::Object, public dbos::ObjectFacade <Directory> {
38 const filesystem::Directory* getFilesystemDirectory() const throw() { return a_filesystemDirectory; }
39 int getINode() const throw() { return a_inode; }
41 std::string asString() const throw();
43 static void setup(dbos::Repository&, const int maxSize) throw(RuntimeException);
44 static Directory* instantiate(const filesystem::Directory*) throw(RuntimeException);
46 static const char* getStorageAreaName() throw() { return "storage::Directory"; }
47 static const dbos::Size getMaxSize() throw() { return st_maxSize; }
50 class Loader : public dbos::Loader {
52 Loader() : dbos::Loader() {;}
54 Loader& setKey(const filesystem::Directory* directory) throw() {
55 a_filesystemDirectory = directory;
59 const filesystem::Directory* getDirectory() const throw() { return a_filesystemDirectory; }
60 int getINode() const throw() { return a_inode; }
62 dbos::Index getIndex() const throw();
63 std::string asString() const throw();
66 const filesystem::Directory* a_filesystemDirectory;
69 // dbms::Statement is not required
70 dbms::Statement* initialize(dbms::Database&) throw(RuntimeException) { return NULL; }
71 bool load(dbms::Connection*, const dbos::StorageArea*) throw(RuntimeException);
74 const filesystem::Directory* a_filesystemDirectory;
77 static Loader* st_loader;
78 static ExclusiveHash <std::string> st_hash;
79 static int st_maxSize;
82 Directory(const Directory&);
84 void initialize(dbos::Loader& loader) throw(RuntimeException, dbms::DatabaseException);
85 void destroy() throw();
87 dbos_declare_object(Directory);