VisionCpp  0.0.1
make_place_holder_expr.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 make_place_holder_expr.hpp
21 /// \brief PlaceHolder expression helper is used to create an expression in
22 /// which the leafNodes of visionMemories has been replaced by leafNodes of
23 /// PlaceHolders.
24 
25 #ifndef VISIONCPP_INCLUDE_FRAMEWORK_EXPR_CONVERTOR_MAKE_PLACE_HOLDER_EXPR_HPP_
26 #define VISIONCPP_INCLUDE_FRAMEWORK_EXPR_CONVERTOR_MAKE_PLACE_HOLDER_EXPR_HPP_
27 
28 namespace visioncpp {
29 namespace internal {
30 /// \brief specialisation of MakePlaceHolderExprHelper where the node is
31 /// leaf node.
32 template <typename RHS, size_t LVL, size_t N>
34  LeafNode<RHS, LVL>, N> {
35  using Type =
37  LVL>;
38 };
39 /// \brief specialisation of MakePlaceHolderExprHelper where the operation of
40 /// the node is unary (the node has one child).
41 template <typename Expr, size_t N>
42 struct MakePlaceHolderExprHelper<internal::expr_category::Unary, Expr, N> {
44  typename MakePlaceHolderExprHelper<Expr::RHSExpr::ND_Category,
45  typename Expr::RHSExpr, N>::Type;
46  using Type = typename Expr::template ExprExchange<RHSPlaceHolderType>;
47 };
48 /// \brief specialisation of MakePlaceHolderExprHelper where the operation of
49 /// the node is binary (the node has two children).
50 template <typename Expr, size_t N>
52  static constexpr size_t RHSLeafCount =
54 
56  typename MakePlaceHolderExprHelper<Expr::LHSExpr::ND_Category,
57  typename Expr::LHSExpr,
58  N - RHSLeafCount>::Type;
60  typename MakePlaceHolderExprHelper<Expr::RHSExpr::ND_Category,
61  typename Expr::RHSExpr, N>::Type;
62 
63  using Type = typename Expr::template ExprExchange<LHSPlaceHolderType,
65 };
66 } // internal
67 } // visioncpp
68 #endif // VISIONCPP_INCLUDE_FRAMEWORK_EXPR_CONVERTOR_MAKE_PLACE_HOLDER_EXPR_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
typename MakePlaceHolderExprHelper< Expr::RHSExpr::ND_Category, typename Expr::RHSExpr, N >::Type RHSPlaceHolderType
typename MakePlaceHolderExprHelper< Expr::LHSExpr::ND_Category, typename Expr::LHSExpr, N - RHSLeafCount >::Type LHSPlaceHolderType
typename Expr::template ExprExchange< LHSPlaceHolderType, RHSPlaceHolderType > Type
typename MakePlaceHolderExprHelper< Expr::RHSExpr::ND_Category, typename Expr::RHSExpr, N >::Type RHSPlaceHolderType
it is used to create the PlaceHolder expression.