Line data Source code
1 : /**
2 : * Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved.
3 : * http://soramitsu.co.jp
4 : *
5 : * Licensed under the Apache License, Version 2.0 (the "License");
6 : * you may not use this file except in compliance with the License.
7 : * You may obtain a copy of the License at
8 : *
9 : * http://www.apache.org/licenses/LICENSE-2.0
10 : *
11 : * Unless required by applicable law or agreed to in writing, software
12 : * distributed under the License is distributed on an "AS IS" BASIS,
13 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 : * See the License for the specific language governing permissions and
15 : * limitations under the License.
16 : */
17 :
18 : #ifndef IROHA_ABSTRACT_TX_RESPONSE_HPP
19 : #define IROHA_ABSTRACT_TX_RESPONSE_HPP
20 :
21 : #include "interfaces/base/model_primitive.hpp"
22 : #include "utils/string_builder.hpp"
23 :
24 : namespace shared_model {
25 : namespace interface {
26 : /**
27 : * Abstract transaction response
28 : * @tparam Model - concrete model transaction response
29 : */
30 : template <typename Model>
31 : class AbstractTxResponse : public ModelPrimitive<Model> {
32 : private:
33 : /**
34 : * @return string representation of class name
35 : */
36 : virtual std::string className() const = 0;
37 :
38 : public:
39 : // ------------------------| Primitive override |-------------------------
40 :
41 : std::string toString() const override {
42 744 : return detail::PrettyStringBuilder().init(className()).finalize();
43 0 : }
44 :
45 : bool operator==(const Model &rhs) const override {
46 19992 : return true;
47 : }
48 : };
49 : } // namespace interface
50 : } // namespace shared_model
51 :
52 : #endif // IROHA_ABSTRACT_TX_RESPONSE_HPP
|