1 : // Copyright 2012 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 : //
15 : // Declares a partial BlockGraphOrdererInterface that provides an implementation
16 : // for the 'name' member function.
17 :
18 : #ifndef SYZYGY_BLOCK_GRAPH_ORDERERS_NAMED_ORDERER_H_
19 : #define SYZYGY_BLOCK_GRAPH_ORDERERS_NAMED_ORDERER_H_
20 :
21 : #include "syzygy/block_graph/orderer.h"
22 :
23 : namespace block_graph {
24 : namespace orderers {
25 :
26 : // Implements the 'name' member function of BlockGraphOrdererInterface.
27 : // The user must define the static variable:
28 : //
29 : // const char DerivedType::kOrdererName[];
30 : //
31 : // @tparam DerivedType the type of the derived class.
32 : template<class DerivedType>
33 : class NamedOrdererImpl : public BlockGraphOrdererInterface {
34 : public:
35 : // Gets the name of this orderer.
36 : //
37 : // @returns the name of this orderer.
38 E : virtual const char* name() const override {
39 E : return DerivedType::kOrdererName;
40 E : }
41 : };
42 :
43 : } // namespace orderers
44 : } // namespace block_graph
45 :
46 : #endif // SYZYGY_BLOCK_GRAPH_ORDERERS_NAMED_ORDERER_H_
|