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

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