Layout.hh

Go to the documentation of this file.
00001 
00020 #ifndef avro_Layout_hh__
00021 #define avro_Layout_hh__
00022 
00023 #include <boost/noncopyable.hpp>
00024 #include "Boost.hh"
00025 
00028 
00029 namespace avro {
00030     
00031 class Layout : private boost::noncopyable {
00032 
00033   protected:
00034 
00035     Layout(size_t offset = 0) :
00036         offset_(offset)
00037     {}
00038 
00039   public:
00040 
00041     size_t offset() const {
00042         return offset_;
00043     }
00044 
00045     virtual ~Layout() {}
00046 
00047   private:
00048 
00049     const size_t offset_;
00050 };
00051 
00052 class PrimitiveLayout : public Layout {
00053 
00054   public:
00055 
00056     PrimitiveLayout(size_t offset = 0) :
00057         Layout(offset)
00058     {}
00059 };
00060 
00061 class CompoundLayout : public Layout {
00062 
00063   public:
00064 
00065     CompoundLayout(size_t offset = 0) :
00066         Layout(offset)
00067     {}
00068 
00069     void add(Layout *layout) {
00070         layouts_.push_back(layout);
00071     }
00072 
00073     const Layout &at (size_t idx) const {
00074         return layouts_.at(idx);
00075     }
00076 
00077   private:
00078 
00079     boost::ptr_vector<Layout> layouts_;
00080 };
00081 
00082 } // namespace avro
00083 
00084 #endif

Generated on Fri Mar 12 13:20:46 2010 for Avro C++ by  doxygen 1.6.1