1 /** 2 * Copyright 2021 Huawei Technologies Co., Ltd 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_CACHE_MERGE_NODE_H_ 17 #define MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_CACHE_MERGE_NODE_H_ 18 19 #include <memory> 20 #include <string> 21 #include <vector> 22 23 #include "minddata/dataset/engine/ir/datasetops/dataset_node.h" 24 25 namespace mindspore { 26 namespace dataset { 27 class CacheMergeNode : public DatasetNode { 28 public: 29 /// \brief Constructor 30 CacheMergeNode(std::shared_ptr<DatasetNode> child, std::shared_ptr<DatasetCache> cache); 31 32 /// \brief Destructor 33 ~CacheMergeNode() = default; 34 35 /// \brief Node name getter 36 /// \return Name of the current node Name()37 std::string Name() const override { return kCacheMergeNode; } 38 39 /// \brief Print the description 40 /// \param out - The output stream to write output to 41 void Print(std::ostream &out) const override; 42 43 /// \brief Copy the node to a new object 44 /// \return A shared pointer to the new copy 45 std::shared_ptr<DatasetNode> Copy() override; 46 47 /// \brief a base class override function to create the required runtime dataset op objects for this class 48 /// \param node_ops - A vector containing shared pointer to the Dataset Ops that this object will create 49 /// \return Status Status::OK() if build successfully 50 Status Build(std::vector<std::shared_ptr<DatasetOp>> *node_ops) override; 51 52 /// \brief Parameters validation 53 /// \return Status Status::OK() if all the parameters are valid 54 Status ValidateParams() override; 55 56 /// \brief Base-class override for accepting IRNodePass visitor 57 /// \param[in] p The node to visit 58 /// \param[out] modified Indicator if the node was modified 59 /// \return Status of the node visit 60 Status Accept(IRNodePass *const p, bool *const modified) override; 61 62 /// \brief Base-class override for accepting IRNodePass visitor 63 /// \param[in] p The node to visit 64 /// \param[out] modified Indicator if the node was modified 65 /// \return Status of the node visit 66 Status AcceptAfter(IRNodePass *const p, bool *const modified) override; 67 }; 68 } // namespace dataset 69 } // namespace mindspore 70 71 #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_ENGINE_IR_DATASETOPS_CACHE_MERGE_NODE_H_ 72