libpniio
get_filename.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 // Created on: aug 21, 2014
20 // Author: Eugen Wintersberger <eugen.wintersberger@desy.de>
21 //
22 #pragma once
23 
24 #include "../nximp_code.hpp"
25 #include "../nxobject.hpp"
26 
27 namespace pni{
28 namespace io{
29 namespace nx{
30 
55  template<
56  template<nximp_code> class OTYPE,
57  nximp_code IMPID
58  >
59  pni::core::string get_filename(const OTYPE<IMPID> &o)
60  {
61  return o.filename();
62  }
63 
64 
65  //------------------------------------------------------------------------
78  template<
79  typename GTYPE,
80  typename FTYPE,
81  typename ATYPE,
82  typename LTYPE
83  >
84  class get_filename_visitor : public boost::static_visitor<pni::core::string>
85  {
86  public:
88  using result_type = pni::core::string;
90  using group_type = GTYPE;
92  using field_type = FTYPE;
94  using attribute_type = ATYPE;
96  using link_type = LTYPE;
97 
98  //-----------------------------------------------------------------
114  {
115  return get_filename(g);
116  }
117 
118  //-----------------------------------------------------------------
134  {
135  return get_filename(f);
136  }
137 
138  //-----------------------------------------------------------------
155  {
156  return get_filename(a);
157  }
158 
160  {
161  return get_filename(l);
162  }
163  };
164 
185  template<
186  typename GTYPE,
187  typename FTYPE,
188  typename ATYPE,
189  typename LTYPE
190  >
192  {
194  return boost::apply_visitor(visitor_type(),o);
195  }
196 
197 //end of namespace
198 }
199 }
200 }
pni::core::string get_filename(const OTYPE< IMPID > &o)
get filename
Definition: get_filename.hpp:59
LTYPE link_type
Nexus link type.
Definition: get_filename.hpp:96
result_type operator()(const link_type &l) const
Definition: get_filename.hpp:159
GTYPE group_type
Nexus group type.
Definition: get_filename.hpp:90
get filename visitor
Definition: get_filename.hpp:84
Definition: cbf_reader.hpp:41
result_type operator()(const field_type &f) const
process field instances
Definition: get_filename.hpp:133
nximp_code
implementation codes
Definition: nximp_code.hpp:40
result_type operator()(const attribute_type &a) const
process attribute instances
Definition: get_filename.hpp:154
pni::core::string result_type
result type
Definition: get_filename.hpp:88
result_type operator()(const group_type &g) const
process group instances
Definition: get_filename.hpp:113
ATYPE attribute_type
Nexus attribute type.
Definition: get_filename.hpp:94
boost::variant< GTYPE, FTYPE, ATYPE, LTYPE > nxobject
Definition: nxobject.hpp:44
FTYPE field_type
Nexus field type.
Definition: get_filename.hpp:92