libpniio
is_attribute.hpp
Go to the documentation of this file.
1 //
2 // (c) Copyright 2013 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: Jun 28, 2013
21 // Author: Eugen Wintersberger <eugen.wintersberger@desy.de>
22 //
23 #pragma once
24 
25 #include "../nxobject.hpp"
26 
27 namespace pni{
28 namespace io{
29 namespace nx{
30 
43  template<
44  typename GTYPE,
45  typename FTYPE,
46  typename ATYPE,
47  typename LTYPE
48  >
49  class is_attribute_visitor : public boost::static_visitor<bool>
50  {
51  public:
53  using result_type = bool;
55  using group_type = GTYPE;
57  using field_type = FTYPE;
59  using attribute_type = ATYPE;
61  using link_type = LTYPE;
62 
63  //-----------------------------------------------------------------
70  result_type operator()(const group_type &) const noexcept
71  {
72  return false;
73  }
74 
75  //-----------------------------------------------------------------
82  result_type operator()(const field_type &) const noexcept
83  {
84  return false;
85  }
86 
87  //-----------------------------------------------------------------
94  result_type operator()(const attribute_type &) const noexcept
95  {
96  return true;
97  }
98 
99  //-----------------------------------------------------------------
103  result_type operator()(const link_type &) const noexcept
104  {
105  return false;
106  }
107 
108  };
109 
110  //------------------------------------------------------------------------
129  template<
130  typename GTYPE,
131  typename FTYPE,
132  typename ATYPE,
133  typename LTYPE
134  >
136  {
138  return boost::apply_visitor(visitor_type(),o);
139  }
140 
141 //end of namespace
142 }
143 }
144 }
result_type operator()(const group_type &) const noexcept
process group instances
Definition: is_attribute.hpp:70
FTYPE field_type
Nexus field type.
Definition: is_attribute.hpp:57
result_type operator()(const attribute_type &) const noexcept
process attribute instances
Definition: is_attribute.hpp:94
GTYPE group_type
Nexus group type.
Definition: is_attribute.hpp:55
LTYPE link_type
NeXus link type.
Definition: is_attribute.hpp:61
Definition: cbf_reader.hpp:41
ATYPE attribute_type
Nexus attribute type.
Definition: is_attribute.hpp:59
result_type operator()(const link_type &) const noexcept
process link instances
Definition: is_attribute.hpp:103
is_attribute visitor
Definition: is_attribute.hpp:49
result_type operator()(const field_type &) const noexcept
process field instances
Definition: is_attribute.hpp:82
bool result_type
result type (bool)
Definition: is_attribute.hpp:53
boost::variant< GTYPE, FTYPE, ATYPE, LTYPE > nxobject
Definition: nxobject.hpp:44
bool is_attribute(const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o) noexcept
check if attribute
Definition: is_attribute.hpp:135