diff options
-rw-r--r-- | p2pvr/lib/containerCreator.h | 10 | ||||
-rw-r--r-- | p2pvr/lib/sqlContainerCreator.h | 8 |
2 files changed, 10 insertions, 8 deletions
diff --git a/p2pvr/lib/containerCreator.h b/p2pvr/lib/containerCreator.h index da4eced..9804d9b 100644 --- a/p2pvr/lib/containerCreator.h +++ b/p2pvr/lib/containerCreator.h @@ -2,8 +2,10 @@ #define CONTAINERCREATOR_H #include <boost/function.hpp> +#include <Ice/Handle.h> +#include "objectRowState.h" -template <typename T, typename V> +template <typename T, typename V, typename P = IceInternal::Handle<V>> class ContainerCreator { public: ContainerCreator(T & c) : container(c) { } @@ -14,13 +16,13 @@ class ContainerCreator { unsigned int columnCount) { while (fetch()) { - auto v = new V; + auto v = P(new V); container.push_back(v); - ObjectRowState<IceInternal::Handle<V>> rs; + ObjectRowState<P> rs; for (unsigned int c = 0; c < columnCount; c++) { rs.fields[c] = get(c); } - UnbindColumns<IceInternal::Handle<V>>(rs, v); + UnbindColumns<P>(rs, v); } } private: diff --git a/p2pvr/lib/sqlContainerCreator.h b/p2pvr/lib/sqlContainerCreator.h index 896a6de..5c8d8f8 100644 --- a/p2pvr/lib/sqlContainerCreator.h +++ b/p2pvr/lib/sqlContainerCreator.h @@ -6,15 +6,15 @@ #include <selectcommand.h> #include <sqlHandleAsVariableType.h> -template <typename T, typename V> -class SqlContainerCreator : public ContainerCreator<T, V> { +template <typename T, typename V, typename P = IceInternal::Handle<V>> +class SqlContainerCreator : public ContainerCreator<T, V, P> { public: - SqlContainerCreator(T & c) : ContainerCreator<T, V>(c) { } + SqlContainerCreator(T & c) : ContainerCreator<T, V, P>(c) { } void populate(boost::shared_ptr<DB::SelectCommand> sel) { sel->execute(); - ContainerCreator<T, V>::populate(boost::bind(&DB::SelectCommand::fetch, sel), [sel](unsigned int c) { + ContainerCreator<T, V, P>::populate(boost::bind(&DB::SelectCommand::fetch, sel), [sel](unsigned int c) { HandleAsVariableType h; const DB::Column & col = (*sel)[c]; col.apply(h); |