ATLAS Offline Software
Loading...
Searching...
No Matches
Control/CxxUtils/CxxUtils/Arrayrep.h
Go to the documentation of this file.
1// This file's extension implies that it's C, but it's really -*- C++ -*-.
2
3/*
4 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
5*/
12
13#ifndef CXXUTILS_ARRAYREP_H
14#define CXXUTILS_ARRAYREP_H
15
16
17#include <string>
18#include <vector>
19
20
21// Presently has to be in CaloRec ns for backwards compatibility.
22namespace CaloRec {
23
24
26typedef float Arrayelt;
27
28
62{
69
78 explicit Arrayrep (const std::string& str,
79 const std::string& context = "");
80
88 explicit Arrayrep (const std::vector<unsigned int>& shape);
89
99 explicit Arrayrep (const unsigned int shape[], unsigned int n);
100
102 std::vector<Arrayelt> m_data;
103
106 std::vector<unsigned int> m_shape;
107
110 std::vector<unsigned int> m_sizes;
111
122 void init_sizes (bool resize_data = false);
123
131
132 void write_array(std::ostream& stream) const;
133
142
143 void write_subarray(std::ostream& stream, std::vector<Arrayelt>::size_type& idx, unsigned dimIndex) const;
144
145};
146
147
148} // namespace CaloRec
149
150
151namespace CxxUtils {
152 using CaloRec::Arrayrep;
153 using CaloRec::Arrayelt;
154}
155
156
157#endif // not CXXUTILS_ARRAYREP_H
Namespace for helper functions.
float Arrayelt
The type of an element of an Array.
Representation class for Array's.
void write_array(std::ostream &stream) const
Creates a text representation of the array content.
Definition Arrayrep.cxx:245
void write_subarray(std::ostream &stream, std::vector< Arrayelt >::size_type &idx, unsigned dimIndex) const
Helper function for write_array.
Definition Arrayrep.cxx:279
std::vector< Arrayelt > m_data
The array data, stored using the C array ordering.
void init_sizes(bool resize_data=false)
Initialize the m_sizes vector from the m_shape vector.
Definition Arrayrep.cxx:34
std::vector< unsigned int > m_sizes
Subarray sizes, for faster access.
std::vector< unsigned int > m_shape
The array shape.