00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 #ifndef VCSN_DESIGN_PATTERN_SLOTS_HXX
00018 # define VCSN_DESIGN_PATTERN_SLOTS_HXX
00019 
00020 # include <vaucanson/design_pattern/slots.hh>
00021 # include <cstdlib>
00022 # include <vaucanson/misc/unique.hh>
00023 # include <vaucanson/misc/contract.hh>
00024 
00025 namespace vcsn {
00026 
00027   
00028 
00029 
00030 
00031   template<typename S, bool dynamic >
00032   SetSlotAttribute<S, dynamic>::SetSlotAttribute()
00033   {}
00034 
00035   template<typename S, bool dynamic >
00036   SetSlotAttribute<S, dynamic>::SetSlotAttribute(const SetSlotAttribute&)
00037   {}
00038 
00039   template<typename S, bool dynamic >
00040   SetSlotAttribute<S, dynamic>::SetSlotAttribute(const S&)
00041   {}
00042 
00043   template<typename S, bool dynamic >
00044   const S& SetSlotAttribute<S, dynamic>::_structure_get() const
00045   {
00046     return *static_cast<const S*>(NULL);
00047   }
00048 
00049   template<typename S, bool dynamic >
00050   void SetSlotAttribute<S, dynamic>::_structure_assign(const SetSlotAttribute&)
00051   {}
00052 
00053   template<typename S, bool dynamic >
00054   void SetSlotAttribute<S, dynamic>::_structure_attach(const S& )
00055   {}
00056 
00057   template<typename S, bool dynamic >
00058   bool SetSlotAttribute<S, dynamic>::_structure_bound() const
00059   {
00060     return true;
00061   }
00062 
00063   
00064 
00065 
00066 
00067   template <class S>
00068   SetSlotAttribute<S, true>::SetSlotAttribute()
00069     : s_(NULL)
00070   {}
00071 
00072   template <class S>
00073   SetSlotAttribute<S, true>::SetSlotAttribute(const SetSlotAttribute& other)
00074     : s_(other.s_)
00075   {}
00076 
00077   template <class S>
00078   SetSlotAttribute<S, true>::SetSlotAttribute(const S& other)
00079     : s_(& other ? & misc::unique::get(other) : NULL)
00080   {}
00081 
00082   template <class S>
00083   const S& SetSlotAttribute<S, true>::_structure_get() const
00084   {
00085     return *s_;
00086   }
00087 
00088   template <class S>
00089   void SetSlotAttribute<S, true>::_structure_assign(const SetSlotAttribute& other)
00090   {
00091     s_ = other.s_;
00092   }
00093 
00094   template <class S>
00095   void SetSlotAttribute<S, true>::_structure_attach(const S& s)
00096   {
00097     precondition(&s != NULL);
00098     s_ = & misc::unique::get(s);
00099   }
00100 
00101   template <class S>
00102   bool SetSlotAttribute<S, true>::_structure_bound() const
00103   {
00104     return s_;
00105   }
00106 
00107   
00108 
00109 
00110 
00111 
00112   template <class S, class Tag>
00113   SetSlot<S,Tag>::SetSlot()
00114     : SetSlotAttribute<S, dynamic_traits<S>::ret>()
00115   {}
00116 
00117   template <class S, class Tag>
00118   SetSlot<S,Tag>::SetSlot(const SetSlot& other)
00119     : SetSlotAttribute<S, dynamic_traits<S>::ret>(other)
00120   {}
00121 
00122   template <class S, class Tag>
00123   SetSlot<S,Tag>::SetSlot(const S& other)
00124     : SetSlotAttribute<S, dynamic_traits<S>::ret>(other)
00125   {}
00126 
00127 
00128 } 
00129 
00130 #endif // ! VCSN_DESIGN_PATTERN_SLOTS_HXX