VisionCpp  0.0.1
leaf_count.hpp
Go to the documentation of this file.
1 // This file is part of VisionCpp, a lightweight C++ template library
2 // for computer vision and image processing.
3 //
4 // Copyright (C) 2016 Codeplay Software Limited. All Rights Reserved.
5 //
6 // Contact: visioncpp@codeplay.com
7 //
8 // Licensed under the Apache License, Version 2.0 (the "License");
9 // you may not use this file except in compliance with the License.
10 // You may obtain a copy of the License at
11 //
12 // http://www.apache.org/licenses/LICENSE-2.0
13 //
14 // Unless required by applicable law or agreed to in writing, software
15 // distributed under the License is distributed on an "AS IS" BASIS,
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 // See the License for the specific language governing permissions and
18 // limitations under the License.
19 
20 /// \file leaf_count.hpp
21 /// \brief LeafCount used to counting terminal nodes. The total number of
22 /// leaf nodes is used by MakePlaceHolderExprHelper to statically find the order
23 /// of the leaf node in a expression tree.
24 
25 #ifndef VISIONCPP_INCLUDE_FRAMEWORK_EXPR_CONVERTOR_LEAF_COUNT_HPP_
26 #define VISIONCPP_INCLUDE_FRAMEWORK_EXPR_CONVERTOR_LEAF_COUNT_HPP_
27 
28 namespace visioncpp {
29 namespace internal {
30 /// \brief specialisation of LeafCount when the node is a LeafNode
31 /// template parameters:
32 /// \param RHS is the visionMemory
33 /// \param LVL shows the level of the node in the expression tree
34 template <typename RHS, size_t LVL>
35 struct LeafCount<expr_category::Unary, LeafNode<RHS, LVL>> {
36  static constexpr size_t Count = 1;
37 };
38 
39 /// \brief specialisation of LeafCount when the node has one child
40 /// template parameters:
41 /// \param RHS is the right-hand side expression of the node
42 /// \param LVL shows the level of the node in the expression tree
43 template <typename Expr>
44 struct LeafCount<expr_category::Unary, Expr> {
45  static constexpr size_t Count =
47 };
48 /// \brief specialisation of LeafCount when the node has two children
49 /// template parameters:
50 /// \param LHS is the left-hand side expression in the node
51 /// \param RHS is the right-hand side expression in the node
52 /// \param LVL shows the level of the node in the expression tree
53 template <typename Expr>
54 struct LeafCount<expr_category::Binary, Expr> {
55  static constexpr size_t Count =
58 };
59 } // internal
60 } // visioncpp
61 #endif // VISIONCPP_INCLUDE_FRAMEWORK_EXPR_CONVERTOR_LEAF_COUNT_HPP_
VisionCpp namespace.
Definition: sycl/device.hpp:24
is used to count the total number of leafNode in the expression tree.
the definition is in LeafNode.
Definition: leaf_node.hpp:38