#ifndef GENERS_ARRAYIO_HH_ #define GENERS_ARRAYIO_HH_ #include "geners/CPP11_array.hh" #include "geners/GenericIO.hh" namespace gs { template struct ClassIdSpecialization > {inline static ClassId classId(const bool isPtr=false) {return ClassId(stack_container_name("std::array"), 0, isPtr);}}; template struct ClassIdSpecialization > {inline static ClassId classId(const bool isPtr=false) {return ClassId(stack_container_name("std::array"), 0, isPtr);}}; template struct ClassIdSpecialization > {inline static ClassId classId(const bool isPtr=false) {return ClassId(stack_container_name("std::array"), 0, isPtr);}}; template struct ClassIdSpecialization > {inline static ClassId classId(const bool isPtr=false) {return ClassId(stack_container_name("std::array"), 0, isPtr);}}; template struct IOIsContiguous > {enum {value = 1};}; template struct IOIsContiguous > {enum {value = 1};}; template struct IOIsContiguous > {enum {value = 1};}; template struct IOIsContiguous > {enum {value = 1};}; // Need to specialize behavior in the header because // there is no "clear" method in std::array template struct GenericReader, InContainerHeader> { typedef CPP11_array Container; inline static bool process(Container&, Stream& is, State* state, const bool processClassId) { if (processClassId) { static const ClassId current(ClassId::makeId()); ClassId id(is, 1); current.ensureSameName(id); } if (!IOTraits::IsPOD) { ClassId id(is, 1); state->push_back(id); } return true; } }; // Ignore array size I/O. The size is built into // the type definition anyway template struct GenericWriter, InContainerSize> { inline static bool process(std::size_t, Stream&, State*, bool) {return true;} }; template struct GenericReader, InContainerSize> { inline static bool process(std::size_t, Stream&, State*, bool) {return true;} }; template struct GenericWriter, InPODArray> { typedef CPP11_array Array; inline static bool process(const Array& a, Stream& os, State*, bool) { write_pod_array(os, &a[0], N); return !os.fail(); } }; template struct GenericReader, InPODArray> { typedef CPP11_array Array; inline static bool process(Array& a, Stream& is, State*, bool) { read_pod_array(is, &a[0], N); return !is.fail(); } }; template struct InsertContainerItem > { typedef CPP11_array A; static inline void insert(A& obj, const typename A::value_type& item, const std::size_t itemNumber) {obj.at(itemNumber) = item;} }; template struct InsertContainerItem > { typedef CPP11_array A; static inline void insert(A& obj, const typename A::value_type& item, const std::size_t itemNumber) {obj.at(itemNumber) = item;} }; } #endif // GENERS_ARRAYIO_HH_