Vaucanson  1.4.1
structure.hxx
1 // structure.hxx: this file is part of the Vaucanson project.
2 //
3 // Vaucanson, a generic library for finite state machines.
4 //
5 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 The Vaucanson Group.
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
11 //
12 // The complete GNU General Public Licence Notice can be found as the
13 // `COPYING' file in the root directory.
14 //
15 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
16 //
17 #ifndef VCSN_DESIGN_PATTERN_STRUCTURE_HXX
18 # define VCSN_DESIGN_PATTERN_STRUCTURE_HXX
19 
21 
22 namespace vcsn {
23 
24  /*-----------------------------------.
25  | Delegations for Structure::contain |
26  `-----------------------------------*/
27 
28  template <typename S>
29  template <typename T>
30  bool
32  {
33  return op_contains(self(), elt.value());
34  }
35 
36  template <typename S>
37  template <typename T>
38  bool
39  Structure<S>::contains(const T& elt_value) const
40  {
41  return op_contains(self(), elt_value);
42  }
43 
44  template <typename S>
45  template <typename OtherS, typename T>
46  bool
48  {
49  return false;
50  }
51 
52  /*---------------------------------.
53  | Delegation for Structure::choose |
54  `---------------------------------*/
55 
56  template <class S>
57  template <class T>
60  {
61  return op_choose(self(), SELECT(T));
62  }
63 
64  /*-------------------------.
65  | Static inheritance stuff |
66  `-------------------------*/
67 
68  template <typename S>
69  S&
71  {
72  return static_cast<self_t&>(*this);
73  }
74 
75  template <typename S>
76  const S&
78  {
79  return static_cast<const self_t&>(*this);
80  }
81 
82 
83  /*-----------------------.
84  | Protected constructors |
85  `-----------------------*/
86 
87  template <typename S>
89  : misc::unique::unifiable()
90  {}
91 
92  template <typename S>
94  : misc::unique::unifiable(other)
95  {}
96 
97 
98  /*--------------------.
99  | Default Comparison |
100  `--------------------*/
101 
102  template<typename S>
103  bool operator != (const vcsn::Structure<S>& a,
104  const vcsn::Structure<S>& b)
105  { return not (a.self() == b.self()); }
106 
107 } // vcsn
108 
109 #endif // ! VCSN_DESIGN_PATTERN_STRUCTURE_HXX