- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

# slots.hh

Go to the documentation of this file.

    00001 // slots.hh: this file is part of the Vaucanson project.
    00002 //
    00003 // Vaucanson, a generic library for finite state machines.
    00004 //
    00005 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 The Vaucanson Group.
    00006 //
    00007 // This program is free software; you can redistribute it and/or
    00008 // modify it under the terms of the GNU General Public License
    00009 // as published by the Free Software Foundation; either version 2
    00010 // of the License, or (at your option) any later version.
    00011 //
    00012 // The complete GNU General Public Licence Notice can be found as the
    00013 // `COPYING' file in the root directory.
    00014 //
    00015 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
    00016 //
    00017 #ifndef VCSN_DESIGN_PATTERN_SLOTS_HH
    00018 # define VCSN_DESIGN_PATTERN_SLOTS_HH
    00019
    00028 # include <vaucanson/design_pattern/predecls.hh>
    00029
    00030 namespace vcsn {
    00031
    00034   /*------------------------------.
    00035   | Basic class for SetSlot below |
    00036   `------------------------------*/
    00037
    00059   template<typename S, bool dynamic /* default: false */>
    00060   struct SetSlotAttribute
    00061   {
    00063
    00064     SetSlotAttribute();
    00065     SetSlotAttribute(const SetSlotAttribute& other);
    00066     SetSlotAttribute(const S& other);
    00068
    00078     const S&    _structure_get() const;
    00079
    00088
    00090     void        _structure_assign(const SetSlotAttribute& other);
    00091
    00093     void        _structure_attach(const S& other);
    00095
    00101     bool        _structure_bound() const;
    00102   };
    00103
    00114   template<typename S>
    00115   struct SetSlotAttribute<S, true>
    00116   {
    00118     SetSlotAttribute();
    00119
    00126     SetSlotAttribute(const SetSlotAttribute& other);
    00127
    00141     SetSlotAttribute(const S& other);
    00142
    00144     const S&    _structure_get() const;
    00145
    00147
    00153     void        _structure_assign(const SetSlotAttribute& other);
    00154     void        _structure_attach(const S& s);
    00156
    00160     bool        _structure_bound() const;
    00161
    00162   protected:
    00163     const S*    s_;
    00164   };
    00165
    00166
    00167   /*------------------------------------.
    00168   | Set attribute for the Element class |
    00169   `------------------------------------*/
    00170
    00191   template<typename S, typename Tag>
    00192   struct SetSlot : SetSlotAttribute<S, dynamic_traits<S>::ret>
    00193   {
    00194     typedef Tag tag_type;
    00195
    00197
    00201     SetSlot();
    00202     SetSlot(const SetSlot& other);
    00203     SetSlot(const S& other);
    00205   };
    00206
    00209 }
    00210
    00211 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
    00212 #  include <vaucanson/design_pattern/slots.hxx>
    00213 # endif // VCSN_USE_INTERFACE_ONLY
    00214
    00215 #endif // ! VCSN_DESIGN_PATTERN_SLOTS_HH