diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-11-02 13:53:20 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-11-02 13:53:20 +0200 |
commit | 46ed6c184190729abff308e4c0d9257bf7c89a45 (patch) | |
tree | b8f025f50fa8c445be6292337f45c90389dbf63b | |
parent | 4ff8f46ff2484c0882a1b0873b08e65e2349c849 (diff) |
Add database::reload() overloads for pointers
-rw-r--r-- | odb/database.hxx | 16 | ||||
-rw-r--r-- | odb/database.ixx | 30 |
2 files changed, 46 insertions, 0 deletions
diff --git a/odb/database.hxx b/odb/database.hxx index 8ccc642..c7816f6 100644 --- a/odb/database.hxx +++ b/odb/database.hxx @@ -70,6 +70,22 @@ namespace odb void reload (T& object); + template <typename T> + void + reload (T* obj_ptr); + + template <typename T, template <typename> class P> + void + reload (const P<T>& obj_ptr); + + template <typename T, template <typename> class P> + void + reload (P<T>& obj_ptr); + + template <typename T> + void + reload (const typename object_traits<T>::pointer_type& obj_ptr); + // Return NULL/false if not found. // template <typename T> diff --git a/odb/database.ixx b/odb/database.ixx index 7bc6520..11b59ca 100644 --- a/odb/database.ixx +++ b/odb/database.ixx @@ -65,6 +65,36 @@ namespace odb template <typename T> inline void database:: + reload (T* p) + { + reload<T> (*p); + } + + template <typename T, template <typename> class P> + inline void database:: + reload (const P<T>& p) + { + reload (odb::pointer_traits< P<T> >::get_ref (p)); + } + + template <typename T, template <typename> class P> + inline void database:: + reload (P<T>& p) + { + reload (odb::pointer_traits< P<T> >::get_ref (p)); + } + + template <typename T> + inline void database:: + reload (const typename object_traits<T>::pointer_type& pobj) + { + typedef typename object_traits<T>::pointer_type pointer_type; + + reload (odb::pointer_traits<pointer_type>::get_ref (pobj)); + } + + template <typename T> + inline void database:: update (T* p) { typedef typename object_traits<T>::pointer_type object_pointer; |