OSDN Git Service

[core] : query_conceptの変更に伴って、その要件を満たすような定義を追加した。
authorcaprice <caprice@users.sourceforge.jp>
Thu, 8 Aug 2013 16:15:23 +0000 (01:15 +0900)
committercaprice <caprice@users.sourceforge.jp>
Thu, 8 Aug 2013 16:15:23 +0000 (01:15 +0900)
core/include/model.hpp

index 28a6ee0..647d54c 100644 (file)
@@ -2,6 +2,8 @@
 #define GIKOMONA_CORE_MODEL_HPP
 
 #include <unistd.h>
+#include <memory>
+#include <tuple>
 
 #include <boost/any.hpp>
 #include <boost/lockfree/queue.hpp>
@@ -20,11 +22,8 @@ public:
     typedef std::tuple<mona_string, boost::any> inserted_query_type;
     typedef inserted_query_type *inserted_query_triv_copyable_type;
     
-    model() noexcept {
-        instance = this;
-    }
-    
-    ~model() {}
+    model() noexcept;
+    ~model();
     
     static
     model *get_instance() {
@@ -34,11 +33,20 @@ public:
     template <typename ...ValueType>
     bool insert(const mona_string& into,
                 const std::tuple<ValueType...>& values) {
-        return inserted_query_queue.push(new inserted_query_type(into, boost::any(values)));
+        /*
+        auto any_value = boost::any(values);
+        auto obj = std::make_tuple(into, any_value);
+        return inserted_query_queue.push();
+        */
     }
     
     template <typename T>
-    T select() {}
+    T select(const mona_string& column,
+             const mona_string& from) const noexcept {}
+    
+    template <typename ...ValueType>
+    std::tuple<ValueType...>
+    select_all(const mona_string& from) const noexcept {}
     
     void exec_inserted_query();
     bool load_file(const boost::filesystem::path& file_path,
@@ -48,8 +56,9 @@ public:
 
 private:
     static self_type *instance;
-    database history_db;
-    config app_config;
+    struct model_pimpl;
+    
+    std::shared_ptr<model_pimpl> pimpl;
     boost::lockfree::queue<inserted_query_triv_copyable_type> inserted_query_queue;
 };
 
@@ -57,7 +66,7 @@ template <>
 struct is_satisfied_with_query_concept<model> : public boost::mpl::true_ {};
 
 void exec_insert_query() {
-    model::get_instance()->exec_insert_query();
+    model::get_instance()->exec_inserted_query();
 }
 
 } } }