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 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   inline
00023   geometry::geometry()
00024     : states_(0), transitions_(0), initials_(0), finals_(0), name_(0)
00025   {}
00026 
00027   inline
00028   geometry::geometry(const geometry& obj)
00029     : states_(0), transitions_(0), initials_(0), finals_(0), name_(0)
00030   {
00031     if (obj.states_ != 0)
00032       states_ = new states_geometry_map_t(obj.states());
00033     if (obj.transitions_ != 0)
00034       transitions_ = new transitions_geometry_map_t(obj.transitions());
00035     if (obj.initials_ != 0)
00036       initials_ = new initials_geometry_map_t(obj.initials());
00037     if (obj.finals_ != 0)
00038       finals_ = new finals_geometry_map_t(obj.finals());
00039     if (obj.name_ != 0)
00040       name_ = new std::string(obj.name());
00041   }
00042 
00043   inline
00044   geometry::~geometry()
00045   {
00046     if (states_)
00047       delete states_;
00048     if (transitions_)
00049       delete transitions_;
00050     if (initials_)
00051       delete initials_;
00052     if (finals_)
00053       delete finals_;
00054     if (name_)
00055       delete name_;
00056   }
00057 
00058 
00059   inline
00060   geometry::states_geometry_map_t& geometry::states()
00061   {
00062     if (! states_)
00063       states_ = new states_geometry_map_t();
00064     return *states_;
00065   }
00066 
00067   inline
00068   const geometry::states_geometry_map_t& geometry::states() const
00069   {
00070     if (! states_)
00071       states_ = new states_geometry_map_t();
00072     return *states_;
00073   }
00074 
00075 
00076   inline
00077   geometry::transitions_geometry_map_t& geometry::transitions()
00078   {
00079     if (! transitions_)
00080       transitions_ = new transitions_geometry_map_t();
00081     return *transitions_;
00082   }
00083 
00084   inline
00085   const geometry::transitions_geometry_map_t& geometry::transitions() const
00086   {
00087     if (! transitions_)
00088       transitions_ = new transitions_geometry_map_t();
00089     return *transitions_;
00090   }
00091 
00092 
00093   inline
00094   geometry::initials_geometry_map_t& geometry::initials()
00095   {
00096     if (! initials_)
00097       initials_ = new initials_geometry_map_t();
00098     return *initials_;
00099   }
00100 
00101   inline
00102   const geometry::initials_geometry_map_t& geometry::initials() const
00103   {
00104     if (! initials_)
00105       initials_ = new initials_geometry_map_t();
00106     return *initials_;
00107   }
00108 
00109 
00110   inline
00111   geometry::finals_geometry_map_t& geometry::finals()
00112   {
00113     if (! finals_)
00114       finals_ = new finals_geometry_map_t();
00115     return *finals_;
00116   }
00117 
00118   inline
00119   const geometry::finals_geometry_map_t& geometry::finals() const
00120   {
00121     if (! finals_)
00122       finals_ = new finals_geometry_map_t();
00123     return *finals_;
00124   }
00125 
00126 
00127   inline
00128   std::string& geometry::name()
00129   {
00130     if (! name_)
00131       name_ = new std::string();
00132     return *name_;
00133   }
00134 
00135   inline
00136   const std::string& geometry::name() const
00137   {
00138     if (! name_)
00139       name_ = new std::string();
00140     return *name_;
00141   }
00142 
00143 
00144 } // !vcsn
00145 
00146 
00147 #endif // ! VCSN_AUTOMATA_IMPLEMENTATION_GEOMETRY_HXX

Generated on Fri Jul 28 12:18:34 2006 for Vaucanson by  doxygen 1.4.6