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

- File List
- File Members

# geometry.hxx

    00001 // GEOMETRY.hxx: this file is part of the Vaucanson project.
    00002 //
    00003 // Vaucanson, a generic library for finite state machines.
    00004 //
    00005 // Copyright (C) 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_AUTOMATA_IMPLEMENTATION_GEOMETRY_HXX
    00018 # define VCSN_AUTOMATA_IMPLEMENTATION_GEOMETRY_HXX
    00019
    00020 namespace vcsn
    00021 {
    00022 # define GEOMETRY_TPARAM \
    00023   template<typename HState, typename HTransition, typename Coords>
    00024
    00025 # define GEOMETRY \
    00026   geometry<HState, HTransition, Coords>
    00027
    00028   GEOMETRY_TPARAM
    00029   inline
    00030   GEOMETRY::geometry()
    00031     : states_(0), transitions_(0), initials_(0), finals_(0), name_(0)
    00032   {}
    00033
    00034   GEOMETRY_TPARAM
    00035   inline
    00036   GEOMETRY& GEOMETRY::operator=(const GEOMETRY& obj)
    00037   {
    00038     return copy_from(obj);
    00039   }
    00040
    00041   GEOMETRY_TPARAM
    00042   inline
    00043   GEOMETRY::geometry(const GEOMETRY& obj)
    00044     : states_(0), transitions_(0), initials_(0), finals_(0), name_(0)
    00045   {
    00046     copy_from(obj);
    00047   }
    00048
    00049   GEOMETRY_TPARAM
    00050   inline
    00051   GEOMETRY& GEOMETRY::copy_from(const GEOMETRY& obj)
    00052   {
    00053     if (obj.states_ != 0)
    00054     {
    00055       delete states_;
    00056       states_ = new states_geometry_map_t(obj.states());
    00057     }
    00058     if (obj.transitions_ != 0)
    00059     {
    00060       delete transitions_;
    00061       transitions_ = new transitions_geometry_map_t(obj.transitions());
    00062     }
    00063     if (obj.initials_ != 0)
    00064     {
    00065       delete initials_;
    00066       initials_ = new initials_geometry_map_t(obj.initials());
    00067     }
    00068     if (obj.finals_ != 0)
    00069     {
    00070       delete finals_;
    00071       finals_ = new finals_geometry_map_t(obj.finals());
    00072     }
    00073     if (obj.name_ != 0)
    00074     {
    00075       delete name_;
    00076       name_ = new std::string(obj.name());
    00077     }
    00078     return *this;
    00079   }
    00080
    00081   GEOMETRY_TPARAM
    00082   inline
    00083   GEOMETRY::~geometry()
    00084   {
    00085     delete states_;
    00086     delete transitions_;
    00087     delete initials_;
    00088     delete finals_;
    00089     delete name_;
    00090   }
    00091
    00092
    00093   GEOMETRY_TPARAM
    00094   inline
    00095   typename GEOMETRY::states_geometry_map_t&
    00096   GEOMETRY::states()
    00097   {
    00098     if (! states_)
    00099       states_ = new states_geometry_map_t();
    00100     return *states_;
    00101   }
    00102
    00103   GEOMETRY_TPARAM
    00104   inline
    00105   const typename GEOMETRY::states_geometry_map_t&
    00106   GEOMETRY::states() const
    00107   {
    00108     if (! states_)
    00109       states_ = new states_geometry_map_t();
    00110     return *states_;
    00111   }
    00112
    00113
    00114   GEOMETRY_TPARAM
    00115   inline
    00116   typename GEOMETRY::transitions_geometry_map_t&
    00117   GEOMETRY::transitions()
    00118   {
    00119     if (! transitions_)
    00120       transitions_ = new transitions_geometry_map_t();
    00121     return *transitions_;
    00122   }
    00123
    00124   GEOMETRY_TPARAM
    00125   inline
    00126   const typename GEOMETRY::transitions_geometry_map_t&
    00127   GEOMETRY::transitions() const
    00128   {
    00129     if (! transitions_)
    00130       transitions_ = new transitions_geometry_map_t();
    00131     return *transitions_;
    00132   }
    00133
    00134
    00135   GEOMETRY_TPARAM
    00136   inline
    00137   typename GEOMETRY::initials_geometry_map_t&
    00138   GEOMETRY::initials()
    00139   {
    00140     if (! initials_)
    00141       initials_ = new initials_geometry_map_t();
    00142     return *initials_;
    00143   }
    00144
    00145   GEOMETRY_TPARAM
    00146   inline
    00147   const typename GEOMETRY::initials_geometry_map_t&
    00148   GEOMETRY::initials() const
    00149   {
    00150     if (! initials_)
    00151       initials_ = new initials_geometry_map_t();
    00152     return *initials_;
    00153   }
    00154
    00155
    00156   GEOMETRY_TPARAM
    00157   inline
    00158   typename GEOMETRY::finals_geometry_map_t&
    00159   GEOMETRY::finals()
    00160   {
    00161     if (! finals_)
    00162       finals_ = new finals_geometry_map_t();
    00163     return *finals_;
    00164   }
    00165
    00166   GEOMETRY_TPARAM
    00167   inline
    00168   const typename GEOMETRY::finals_geometry_map_t&
    00169   GEOMETRY::finals() const
    00170   {
    00171     if (! finals_)
    00172       finals_ = new finals_geometry_map_t();
    00173     return *finals_;
    00174   }
    00175
    00176
    00177   GEOMETRY_TPARAM
    00178   inline
    00179   std::string&
    00180   GEOMETRY::name()
    00181   {
    00182     if (! name_)
    00183       name_ = new std::string();
    00184     return *name_;
    00185   }
    00186
    00187   GEOMETRY_TPARAM
    00188   inline
    00189   const std::string&
    00190   GEOMETRY::name() const
    00191   {
    00192     if (! name_)
    00193       name_ = new std::string();
    00194     return *name_;
    00195   }
    00196
    00197
    00198 } // !vcsn
    00199
    00200
    00201 #endif // ! VCSN_AUTOMATA_IMPLEMENTATION_GEOMETRY_HXX