ATLAS Offline Software
Loading...
Searching...
No Matches
MultiDimArray.h File Reference
#include <iostream>
#include <sstream>
#include <limits.h>
#include <float.h>
Include dependency graph for MultiDimArray.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  MultiDimArrayTypes< T, I >
 General recursive subtyping trait. More...
class  MultiDimArrayTypes< T, 0 >
 General recursive subtyping trait. More...
class  MultiDimArrayTypes< T, 1 >
 General recursive subtyping trait. More...
class  MultiDimArray< T, N >
 Multi-dimensional array with a compile-time number of dimensions, and a run-time complete freedom over the size of the dimensions. More...

Functions

template<class T, unsigned int N>
static unsigned int totalSize (const MultiDimArray< T, N > &ht)
template<class T, unsigned int N>
static unsigned int validSize (const MultiDimArray< T, N > &ht)
template<class T>
static unsigned int totalSize (const MultiDimArray< T, 1 > &ht)
template<class T>
static unsigned int validSize (const MultiDimArray< T, 1 > &ht)
template<class T, unsigned int N>
void dump (const MultiDimArray< T, N > &idh, std::ostream &os=std::cout, const std::string &prefix="(")
template<class T>
void dump (const MultiDimArray< T, 1 > &idh, std::ostream &os=std::cout, const std::string &prefix="(")
template<class T, unsigned int N, class K>
void dumpOneEntry (const MultiDimArray< T, N > &idh, const K &indices, std::ostream &os=std::cout, const std::string &prefix="(")
template<class T, class K>
void dumpOneEntry (const MultiDimArray< T, 1 > &idh, const K &indices, std::ostream &os=std::cout, const std::string &prefix="(")
template<class T, unsigned int N>
std::ostream & operator<< (std::ostream &os, const MultiDimArray< T, N > &idh)

Variables

template<class T, unsigned int N>
MultiDimArray< T, N >::SubType MultiDimArray< T, N >::s_invalidSubType = MultiDimArray<T,N>::defaultSubType()

Function Documentation

◆ dump() [1/2]

template<class T>
void dump ( const MultiDimArray< T, 1 > & idh,
std::ostream & os = std::cout,
const std::string & prefix = "(" )

Definition at line 370 of file MultiDimArray.h.

371 {
372 int idxMin = idh.minIndex();
373 int idxMax = idh.maxIndex();
374 for ( int idx = idxMin; idx <= idxMax; ++idx ) {
375 os << prefix << idx << "): hash=" << idh[idx] << "\n";
376 }
377}
int maxIndex() const
int minIndex() const

◆ dump() [2/2]

template<class T, unsigned int N>
void dump ( const MultiDimArray< T, N > & idh,
std::ostream & os = std::cout,
const std::string & prefix = "(" )

Definition at line 358 of file MultiDimArray.h.

359 {
360 int idxMin = idh.minIndex();
361 int idxMax = idh.maxIndex();
362 for ( int idx = idxMin; idx <= idxMax; ++idx ) {
363 std::ostringstream oss;
364 oss << idx << ",";
365 dump( idh[idx], os, prefix + oss.str() );
366 }
367}
-event-from-file

◆ dumpOneEntry() [1/2]

template<class T, class K>
void dumpOneEntry ( const MultiDimArray< T, 1 > & idh,
const K & indices,
std::ostream & os = std::cout,
const std::string & prefix = "(" )

Definition at line 415 of file MultiDimArray.h.

416 {
417 int idx = indices[0];
418 os << prefix << idx << ")=" << idh[idx];
419}
std::pair< long int, long int > indices

◆ dumpOneEntry() [2/2]

template<class T, unsigned int N, class K>
void dumpOneEntry ( const MultiDimArray< T, N > & idh,
const K & indices,
std::ostream & os = std::cout,
const std::string & prefix = "(" )

Definition at line 406 of file MultiDimArray.h.

407 {
408 int idx = indices[N-1];
409 std::ostringstream oss;
410 oss << idx << ",";
411 dumpOneEntry( idh[idx], indices, os, prefix + oss.str() );
412}
void dumpOneEntry(const MultiDimArray< T, N > &idh, const K &indices, std::ostream &os=std::cout, const std::string &prefix="(")

◆ operator<<()

template<class T, unsigned int N>
std::ostream & operator<< ( std::ostream & os,
const MultiDimArray< T, N > & idh )

Definition at line 437 of file MultiDimArray.h.

437 {
438 dump( idh, os );
439 return os;
440}

◆ totalSize() [1/2]

template<class T>
unsigned int totalSize ( const MultiDimArray< T, 1 > & ht)
static

Definition at line 332 of file MultiDimArray.h.

332 {
333 return ht.size();
334}
unsigned int size() const
Size of this field.

◆ totalSize() [2/2]

template<class T, unsigned int N>
unsigned int totalSize ( const MultiDimArray< T, N > & ht)
static

Definition at line 310 of file MultiDimArray.h.

310 {
311 unsigned int nTotal = 0;
312 int idxMin = ht.minIndex();
313 int idxMax = ht.maxIndex();
314 for ( int idx = idxMin; idx <= idxMax; ++idx ) {
315 nTotal += totalSize( ht[idx] );
316 }
317 return nTotal;
318}
static unsigned int totalSize(const MultiDimArray< T, N > &ht)

◆ validSize() [1/2]

template<class T>
unsigned int validSize ( const MultiDimArray< T, 1 > & ht)
static

Definition at line 337 of file MultiDimArray.h.

337 {
338 unsigned int cnt = 0;
339 int idxMin = ht.minIndex();
340 int idxMax = ht.maxIndex();
341 for ( int idx = idxMin; idx <= idxMax; ++idx ) {
342 if ( ht[idx] != MultiDimArray<T,1>::invalidSubType() ) ++cnt;
343 }
344 return cnt;
345}
static const SubType & invalidSubType()

◆ validSize() [2/2]

template<class T, unsigned int N>
unsigned int validSize ( const MultiDimArray< T, N > & ht)
static

Definition at line 321 of file MultiDimArray.h.

321 {
322 unsigned int nTotal = 0;
323 int idxMin = ht.minIndex();
324 int idxMax = ht.maxIndex();
325 for ( int idx = idxMin; idx <= idxMax; ++idx ) {
326 nTotal += validSize( ht[idx] );
327 }
328 return nTotal;
329}
static unsigned int validSize(const MultiDimArray< T, N > &ht)

Variable Documentation

◆ MultiDimArray< T, N >::s_invalidSubType

template<class T, unsigned int N>
MultiDimArray<T,N>::SubType MultiDimArray< T, N >::s_invalidSubType = MultiDimArray<T,N>::defaultSubType()

Definition at line 446 of file MultiDimArray.h.