00001
00002
00010 #ifndef CXXUTILS_ARRAYREP_H
00011 #define CXXUTILS_ARRAYREP_H
00012
00013
00014 #include <string>
00015 #include <vector>
00016
00017
00018
00019 namespace CaloRec {
00020
00021
00023 typedef float Arrayelt;
00024
00025
00058 struct Arrayrep
00059 {
00065 Arrayrep () {}
00066
00075 explicit Arrayrep (const std::string& str,
00076 const std::string& context = "");
00077
00085 explicit Arrayrep (const std::vector<unsigned int>& shape);
00086
00096 explicit Arrayrep (const unsigned int shape[], unsigned int n);
00097
00099 std::vector<Arrayelt> m_data;
00100
00103 std::vector<unsigned int> m_shape;
00104
00107 std::vector<unsigned int> m_sizes;
00108
00119 void init_sizes (bool resize_data = false);
00120
00129 void write_array(std::ostream& stream) const;
00130
00140 void write_subarray(std::ostream& stream, std::vector<Arrayelt>::size_type& idx, unsigned dimIndex) const;
00141
00142 };
00143
00144
00145 }
00146
00147
00148 namespace CxxUtils {
00149 using CaloRec::Arrayrep;
00150 using CaloRec::Arrayelt;
00151 }
00152
00153
00154 #endif // not CXXUTILS_ARRAYREP_H