libpniio
is_group.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 // Created on: Jun 28, 2013
20 // Author: Eugen Wintersberger <eugen.wintersberger@desy.de>
21 //
22 #pragma once
23 
24 #include "../nxobject.hpp"
25 
26 namespace pni{
27 namespace io{
28 namespace nx{
29 
44  template<
45  typename GTYPE,
46  typename FTYPE,
47  typename ATYPE,
48  typename LTYPE
49  >
50  class is_group_visitor : public boost::static_visitor<bool>
51  {
52  public:
54  using result_type = bool;
56  using group_type = GTYPE;
58  using field_type = FTYPE;
60  using attribute_type = ATYPE;
62  using link_type = LTYPE;
63 
64  //----------------------------------------------------------------
71  result_type operator()(const group_type &) const noexcept
72  {
73  return true;
74  }
75 
76  //-----------------------------------------------------------------
83  result_type operator()(const field_type &) const noexcept
84  {
85  return false;
86  }
87 
88  //-----------------------------------------------------------------
95  result_type operator()(const attribute_type &) const noexcept
96  {
97  return false;
98  }
99 
100  //-----------------------------------------------------------------
106  result_type operator()(const link_type &) const noexcept
107  {
108  return false;
109  }
110  };
111 
130  template<
131  typename GTYPE,
132  typename FTYPE,
133  typename ATYPE,
134  typename LTYPE
135  >
137  {
138  using visitor_type = is_group_visitor<GTYPE,FTYPE,ATYPE,LTYPE>;
139  return boost::apply_visitor(visitor_type(),o);
140  }
141 
142 //end of namespace
143 }
144 }
145 }
result_type operator()(const link_type &) const noexcept
process link objects
Definition: is_group.hpp:106
FTYPE field_type
Nexus field type.
Definition: is_group.hpp:58
LTYPE link_type
NeXus link type.
Definition: is_group.hpp:62
result_type operator()(const group_type &) const noexcept
process group objects
Definition: is_group.hpp:71
Definition: cbf_reader.hpp:41
bool result_type
result type
Definition: is_group.hpp:54
result_type operator()(const attribute_type &) const noexcept
process attribute objects
Definition: is_group.hpp:95
result_type operator()(const field_type &) const noexcept
process field objects
Definition: is_group.hpp:83
is_group visitor
Definition: is_group.hpp:50
GTYPE group_type
Nexus group type.
Definition: is_group.hpp:56
boost::variant< GTYPE, FTYPE, ATYPE, LTYPE > nxobject
Definition: nxobject.hpp:44
ATYPE attribute_type
Nexus attribute type.
Definition: is_group.hpp:60
bool is_group(const nxobject< GTYPE, FTYPE, ATYPE, LTYPE > &o) noexcept
test for group
Definition: is_group.hpp:136