libpniio
string_utils.hpp
Go to the documentation of this file.
1 //
2 // (c) Copyright 2014 DESY, Eugen Wintersberger <eugen.wintersberger@desy.de>
3 //
4 // This file is part of libpniio.
5 //
6 // libpniio is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // libpniio is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with libpniio. If not, see <http://www.gnu.org/licenses/>.
18 // ===========================================================================
19 //
20 // Created on: Jul 21, 2014
21 // Author: Eugen Wintersberger <eugen.wintersberger@desy.de>
22 //
23 #pragma once
24 
25 #include <pni/core/types.hpp>
26 #include <vector>
28 #include "string_formatter.hpp"
29 
30 namespace pni{
31 namespace io{
32 namespace nx{
33 namespace h5{
34 
42  typedef std::vector<char> char_vector_type;
43 
44  //------------------------------------------------------------------------
52  typedef std::vector<char*> char_ptr_vector_type;
53 
54  //------------------------------------------------------------------------
62  typedef std::vector<const char*> char_const_ptr_vector_type;
63 
64  //------------------------------------------------------------------------
79  bool is_vl_string(const h5datatype &type);
80 
81  //------------------------------------------------------------------------
96  bool is_static_string(const h5datatype &type);
97 
98  //-------------------------------------------------------------------------
112  size_t static_string_size(const h5datatype &type);
113 
114  //-------------------------------------------------------------------------
128  bool is_ascii_string(const h5datatype &type);
129 
130 
131  //------------------------------------------------------------------------
147  void copy_from_vector(const char_vector_type &vector,size_t nstrs,
148  size_t strsize,pni::core::string *strings,
149  const formatter_ptr &formatter);
150 
151  //-----------------------------------------------------------------------
165  void copy_from_vector(const char_ptr_vector_type &vector,size_t nstrs,
166  pni::core::string *strings,
167  const formatter_ptr &formatter);
168 
169  bool is_nullterm_str(const h5datatype &type);
170  bool is_nullpad_str(const h5datatype &type);
171  bool is_spacepad_str(const h5datatype &type);
172 
173  bool is_string_type(const h5datatype &type);
174 
175 
176 
177 }
178 }
179 }
180 }
bool is_nullpad_str(const h5datatype &type)
Definition: string_utils.cpp:143
void copy_from_vector(const char_vector_type &vector, size_t nstrs, size_t strsize, string *strings, const formatter_ptr &formatter)
Definition: string_utils.cpp:102
bool is_string_type(const h5datatype &type)
Definition: string_utils.cpp:35
size_t static_string_size(const h5datatype &type)
get static string size
Definition: string_utils.cpp:86
scalar formatter
Definition: formatter.hpp:55
bool is_vl_string(const h5datatype &type)
check variable length string
Definition: string_utils.cpp:44
HDF5 type wrapper.
Definition: h5datatype.hpp:43
Definition: cbf_reader.hpp:41
std::vector< char > char_vector_type
vector type for individual characters
Definition: string_utils.hpp:42
std::vector< char * > char_ptr_vector_type
vector tyep for char pointers
Definition: string_utils.hpp:52
bool is_spacepad_str(const h5datatype &type)
Definition: string_utils.cpp:149
std::vector< const char * > char_const_ptr_vector_type
vector type for const char pointers
Definition: string_utils.hpp:62
bool is_nullterm_str(const h5datatype &type)
Definition: string_utils.cpp:137
std::unique_ptr< string_formatter > formatter_ptr
Definition: string_formatter.hpp:45
bool is_ascii_string(const h5datatype &type)
check if string type is ASCII
Definition: string_utils.cpp:71
bool is_static_string(const h5datatype &type)
check if static length string
Definition: string_utils.cpp:63