Vaucanson  1.4.1
slots.hh
Go to the documentation of this file.
1 // slots.hh: 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_SLOTS_HH
18 # define VCSN_DESIGN_PATTERN_SLOTS_HH
19 
29 
30 namespace vcsn {
31 
34  /*------------------------------.
35  | Basic class for SetSlot below |
36  `------------------------------*/
37 
59  template<typename S, bool dynamic /* default: false */>
61  {
63 
65  SetSlotAttribute(const SetSlotAttribute& other);
66  SetSlotAttribute(const S& other);
68 
78  const S& _structure_get() const;
79 
88 
90  void _structure_assign(const SetSlotAttribute& other);
91 
93  void _structure_attach(const S& other);
95 
101  bool _structure_bound() const;
102  };
103 
114  template<typename S>
115  struct SetSlotAttribute<S, true>
116  {
119 
126  SetSlotAttribute(const SetSlotAttribute& other);
127 
141  SetSlotAttribute(const S& other);
142 
144  const S& _structure_get() const;
145 
147 
153  void _structure_assign(const SetSlotAttribute& other);
154  void _structure_attach(const S& s);
156 
160  bool _structure_bound() const;
161 
162  protected:
163  const S* s_;
164  };
165 
166 
167  /*------------------------------------.
168  | Set attribute for the Element class |
169  `------------------------------------*/
170 
191  template<typename S, typename Tag>
192  struct SetSlot : SetSlotAttribute<S, dynamic_traits<S>::ret>
193  {
194  typedef Tag tag_type;
195 
197 
201  SetSlot();
202  SetSlot(const SetSlot& other);
203  SetSlot(const S& other);
205  };
206 
209 }
210 
211 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
212 # include <vaucanson/design_pattern/slots.hxx>
213 # endif // VCSN_USE_INTERFACE_ONLY
214 
215 #endif // ! VCSN_DESIGN_PATTERN_SLOTS_HH