Revert "Remove mysql and oracle resources for anna-ericsson project"
[anna.git] / example / dbos / workdir / filesystem / Abstract.hpp
diff --git a/example/dbos/workdir/filesystem/Abstract.hpp b/example/dbos/workdir/filesystem/Abstract.hpp
new file mode 100644 (file)
index 0000000..de28336
--- /dev/null
@@ -0,0 +1,69 @@
+// ANNA - Anna is Not Nothingness Anymore                                                         //
+//                                                                                                //
+// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
+//                                                                                                //
+// See project site at http://redmine.teslayout.com/projects/anna-suite                           //
+// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
+
+
+#ifndef dbos_workdir_filesystem_Abstract_hpp
+#define dbos_workdir_filesystem_Abstract_hpp
+
+#include <vector>
+#include <string>
+
+#include <anna/core/util/ExclusiveHash.hpp>
+
+namespace workdir {
+
+namespace filesystem {
+
+using namespace anna;
+
+class Abstract {
+public:
+   struct ClassType { enum _v { Directory, File }; };
+   
+   typedef std::vector <Abstract*> child_container;
+   typedef child_container::iterator child_iterator;
+   typedef child_container::const_iterator const_child_iterator;
+   
+   virtual ~Abstract ();
+   
+   Abstract* getParent () const throw () { return a_parent; }
+   ClassType::_v getClassType () const throw () { return a_classType; }
+   const std::string& getName () const throw () { return a_name; }
+   const std::string& getPath () const throw () { return a_path; }
+
+   int child_size () const throw () { return a_children.size (); }
+   
+   child_iterator child_begin () throw () { return a_children.begin (); }
+   child_iterator child_end () throw () { return a_children.end (); }   
+   static Abstract* child (child_iterator ii) throw () { return *ii; }
+
+   const_child_iterator child_begin () const throw () { return a_children.begin (); }
+   const_child_iterator child_end () const throw () { return a_children.end (); }   
+   static const Abstract* child (const_child_iterator ii) throw () { return *ii; }
+   
+   static std::string calculePath (const Abstract* parent, const std::string& shortPath) throw ();
+   
+   virtual void print (const int level) const throw () = 0;
+
+protected:
+   Abstract (const ClassType::_v, const std::string& name);
+   Abstract (const ClassType::_v, Abstract* parent, const std::string& name);
+   
+private:
+   const ClassType::_v a_classType;
+   Abstract* a_parent;   
+   const std::string a_name;
+   std::string a_path;
+   child_container a_children;
+   
+   Abstract (const Abstract&);
+};
+
+}
+}
+
+#endif