#include "km3net-dataformat/offline/Vec.hh"
#include "km3net-dataformat/offline/Exception.hh"
#include "TObject.h"
#include <string>
#include <sstream>
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
 
Go to the source code of this file.
 | 
| struct   | Head | 
|   | The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred to as "tags") and values.  More...
  | 
|   | 
| struct   | Head::tags | 
|   | 
 | 
| static void  | trimstring (std::string &s) | 
|   | Trim a string in place.  
  | 
|   | 
| std::vector< std::string >  | splitstring (const std::string &str, char delim=' ') | 
|   | Split string at delimiter.  
  | 
|   | 
| std::ostream &  | operator<< (std::ostream &out, const Head &h) | 
|   | Print header.  
  | 
|   | 
◆ trimstring()
  
  
      
        
          | static void trimstring  | 
          ( | 
          std::string & |           s | ) | 
           | 
         
       
   | 
  
inlinestatic   | 
  
 
Trim a string in place. 
- Parameters
 - 
  
  
 
Definition at line 22 of file Head.hh.
   23{
   24  
   25  s.erase( s.begin(), std::find_if(s.begin(), s.end(), [](int ch) {
   26    return !std::isspace(ch);
   27  }));
   28 
   29  
   30  s.erase(std::find_if(s.rbegin(), s.rend(), [](int ch) {
   31    return !std::isspace(ch);
   32  }).base(), s.end());
   33}
 
 
 
◆ splitstring()
  
  
      
        
          | std::vector< std::string > splitstring  | 
          ( | 
          const std::string & |           str,  | 
         
        
           | 
           | 
          char |           delim = ' ' ) | 
         
       
   | 
  
inline   | 
  
 
Split string at delimiter. 
Trailing and leading whitespace is removed from each token. Empty tokens are not put in the output list.
- Parameters
 - 
  
    | str | input string  | 
    | delim | token delimiter  | 
  
   
- Returns
 - list of tokens 
 
Definition at line 43 of file Head.hh.
   44{
   46 
   48 
   49  stringstream ss(str);
   50  string token;
   51  while (
getline(ss, token, delim))
 
   52  {
   54    if (token != "") r.push_back(token);
   55  }
   56 
   57  return r;
   58}
static void trimstring(std::string &s)
Trim a string in place.
 
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
 
 
 
 
◆ operator<<()
  
  
      
        
          | std::ostream & operator<<  | 
          ( | 
          std::ostream & |           out,  | 
         
        
           | 
           | 
          const Head & |           h ) | 
         
       
   | 
  
inline   | 
  
 
Print header. 
- Parameters
 - 
  
  
 
- Returns
 - output stream 
 
Definition at line 441 of file Head.hh.
  442{
  444  return out;
  445}
void print(std::ostream &out=std::cout) const
Print header.