Avogadro  1.1.0
/home/kitware/dashboards/avogadro/libavogadro/src/fragment.h
00001 /**********************************************************************
00002   Fragment - Fragment class derived from the base Primitive class
00003 
00004   Copyright (C) 2008 Marcus D. Hanwell
00005 
00006   This file is part of the Avogadro molecular editor project.
00007   For more information, see <http://avogadro.openmolecules.net/>
00008 
00009   Avogadro is free software; you can redistribute it and/or modify
00010   it under the terms of the GNU General Public License as published by
00011   the Free Software Foundation; either version 2 of the License, or
00012   (at your option) any later version.
00013 
00014   Avogadro is distributed in the hope that it will be useful,
00015   but WITHOUT ANY WARRANTY; without even the implied warranty of
00016   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017   GNU General Public License for more details.
00018 
00019   You should have received a copy of the GNU General Public License
00020   along with this program; if not, write to the Free Software
00021   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00022   02110-1301, USA.
00023  **********************************************************************/
00024 
00025 #ifndef FRAGMENT_H
00026 #define FRAGMENT_H
00027 
00028 #include <avogadro/primitive.h>
00029 
00030 #include <QList>
00031 
00032 namespace Avogadro {
00033 
00034   class Molecule;
00035 
00046   class FragmentPrivate;
00047   class A_EXPORT Fragment : public Primitive
00048   {
00049     Q_OBJECT
00050 
00051     public:
00057       Fragment(QObject *parent=0);
00058 
00062       explicit Fragment(Type type, QObject *parent=0);
00063 
00067       ~Fragment();
00068 
00073       inline QString name() const { return m_name; }
00074 
00078       inline void setName(QString name) { m_name = name; }
00079 
00083       void addAtom(unsigned long id);
00084 
00088       void removeAtom(unsigned long id);
00089 
00093       QList<unsigned long> atoms() const;
00094 
00098       void addBond(unsigned long id);
00099 
00103       void removeBond(unsigned long id);
00104 
00108       QList<unsigned long> bonds() const;
00109 
00110       friend class Molecule;
00111 
00112     protected:
00113       Molecule *m_molecule;
00114       QString m_name; 
00115       QList<unsigned long> m_atoms; 
00116       QList<unsigned long> m_bonds; 
00118     private:
00119       Q_DECLARE_PRIVATE(Fragment)
00120   };
00121 
00122 } // End namespace Avoagdro
00123 
00124 #endif