--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _MIR_OPDEFS_H_
+#define _MIR_OPDEFS_H_
+
+#include "mir/ops/BatchNormOp.h"
+#include "mir/ops/BiasAddOp.h"
+#include "mir/ops/CappedReluOp.h"
+#include "mir/ops/CommonProps.h"
+#include "mir/ops/ConcatOp.h"
+#include "mir/ops/ConstantOp.h"
+#include "mir/ops/Conv2DOp.h"
+#include "mir/ops/Deconv2DOp.h"
+#include "mir/ops/DepthwiseConv2DOp.h"
+#include "mir/ops/DropoutOp.h"
+#include "mir/ops/ElementwiseOp.h"
+#include "mir/ops/EluOp.h"
+#include "mir/ops/FullyConnectedOp.h"
+#include "mir/ops/GatherOp.h"
+#include "mir/ops/GemmOp.h"
+#include "mir/ops/InputOp.h"
+#include "mir/ops/LeakyReluOp.h"
+#include "mir/ops/OutputOp.h"
+#include "mir/ops/PadOp.h"
+#include "mir/ops/PoolOp.h"
+#include "mir/ops/ReduceOp.h"
+#include "mir/ops/ReluOp.h"
+#include "mir/ops/ReshapeOp.h"
+#include "mir/ops/ResizeOp.h"
+#include "mir/ops/ScaleOp.h"
+#include "mir/ops/SigmoidOp.h"
+#include "mir/ops/SliceOp.h"
+#include "mir/ops/SoftmaxOp.h"
+#include "mir/ops/SqrtOp.h"
+#include "mir/ops/SqueezeOp.h"
+#include "mir/ops/TanhOp.h"
+#include "mir/ops/TransposeOp.h"
+
+#endif // _MIR_OPDEFS_H_
#undef HANDLE_OP
} // namespace ops
+class Operation;
+
/**
- * @brief Visitor Interface declaration
+ * @brief Base visitor with empty falback function
*/
class IVisitor
{
public:
-#define HANDLE_OP(OpType, OpClass) virtual void visit(ops::OpClass &) = 0;
+#define HANDLE_OP(OpType, OpClass) virtual void visit(ops::OpClass &);
#include "mir/ops/operations.lst.h"
#undef HANDLE_OP
virtual ~IVisitor() = default;
-};
-
-/**
- * @brief Non Pure Virtual implementation of IVisitor
- * It is used to facilitate adding new operations,
- * so that we don't have to add more declarations and
- * only need to define an implementation of `visit` for a subset of operations in the graph,
- * while not doing anything for all others.
- */
-class Visitor : public IVisitor
-{
-public:
-#define HANDLE_OP(OpType, OpClass) virtual void visit(ops::OpClass &) override;
-#include "mir/ops/operations.lst.h"
-#undef HANDLE_OP
- ~Visitor() override = default;
+protected:
+ virtual void visit_fallback(Operation &) {}
};
+// TODO Remove this using when all uses of Visitor are eliminated.
+using Visitor = IVisitor;
+
} // namespace mir
#endif //_MIR_VISITOR_H_