StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
AliHLTArrayIO.h
1 /**************************************************************************
2  * This file is property of and copyright by the ALICE HLT Project *
3  * All rights reserved. *
4  * *
5  * Primary Authors: *
6  * Copyright 2009 Matthias Kretz <kretz@kde.org> *
7  * *
8  * Permission to use, copy, modify and distribute this software and its *
9  * documentation strictly for non-commercial purposes is hereby granted *
10  * without fee, provided that the above copyright notice appears in all *
11  * copies and that both the copyright notice and this permission notice *
12  * appear in the supporting documentation. The authors make no claims *
13  * about the suitability of this software for any purpose. It is *
14  * provided "as is" without express or implied warranty. *
15  **************************************************************************/
16 
17 #ifndef ALIHLTARRAYIO_H
18 #define ALIHLTARRAYIO_H
19 
20 #include <iostream>
21 #include "AliHLTArray.h"
22 
23 namespace
24 {
25  namespace AnsiColor
26  {
27  static const char *const green = "\033[1;40;32m";
28  static const char *const yellow = "\033[1;40;33m";
29  static const char *const blue = "\033[1;40;34m";
30  static const char *const normal = "\033[0m";
31  } // namespace AnsiColor
32 } // anonymous namespace
33 
34 template<typename T>
35 inline std::ostream &operator<<( std::ostream &out, const AliHLTArray<T> &a )
36 {
37  out << AnsiColor::blue << "{" << AnsiColor::normal;
38  for ( int i = 0; i < a.Size(); ++i ) {
39  if (i > 0) {
40  out << AnsiColor::blue << ", " << AnsiColor::normal;
41  }
42  out << a[i];
43  }
44  out << AnsiColor::blue << "}" << AnsiColor::normal;
45  return out;
46 }
47 #endif // ALIHLTARRAYIO_H