Skylark (Sketching Library)  0.1
/var/lib/jenkins/jobs/Skylark/workspace/utility/elem_extender.hpp
Go to the documentation of this file.
00001 #ifndef SKYLARK_ELEM_EXTENDER_HPP
00002 #define SKYLARK_ELEM_EXTENDER_HPP
00003 
00004 #if SKYLARK_HAVE_ELEMENTAL
00005 
00006 #include <elemental.hpp>
00007 
00008 #include "typer.hpp"
00009 namespace skylark { namespace utility {
00010 
00015 template<typename ET>
00016 struct elem_extender_t : public ET {
00017 
00018     // Once we have c'tor inheritance (e.g. gcc-4.8) we can simply
00019     // use the following line:
00020     // using ET::ET;
00021     // For now, I am just implementing the most basic c'tors. More
00022     // will be added as neccessary.
00023     elem_extender_t(int m, int n, const elem::Grid& grid=elem::DefaultGrid(),
00024         int root=0) : ET(m, n, grid, root) { }
00025 
00026 private:
00027     typedef typename utility::typer_t<ET>::value_type value_type;
00028 
00029 public:
00031     value_type &operator[](int i) {
00032         return *(ET::Buffer() + i);
00033     }
00034 
00036     const value_type &operator[](int i) const {
00037         return *(ET::Buffer() + i);
00038     }
00039 };
00040 
00041 #endif
00042 
00043 } }
00044 #endif