00001
00002
00003
00004
00005
00006
00007 #ifndef BALL_KERNEL_ATOMCONTAINER_H
00008 #define BALL_KERNEL_ATOMCONTAINER_H
00009
00010 #ifndef BALL_KERNEL_ATOMITERATOR_H
00011 # include <BALL/KERNEL/atomIterator.h>
00012 #endif
00013
00014 #ifndef BALL_KERNEL_ATOMCONTAINERITERATOR_H
00015 # include <BALL/KERNEL/atomContainerIterator.h>
00016 #endif
00017
00018
00019 #define BALL_ATOMCONTAINER_DEFAULT_NAME ""
00020
00021 namespace BALL
00022 {
00023 class Molecule;
00024
00032 class BALL_EXPORT AtomContainer
00033 : public Composite,
00034 public PropertyManager
00035 {
00036 public:
00037
00038 BALL_CREATE_DEEP(AtomContainer)
00039
00040
00043
00045 enum Property
00046 {
00048 NUMBER_OF_PROPERTIES = 0
00049 };
00050
00052
00055
00058 AtomContainer();
00059
00064 AtomContainer(const AtomContainer& atom_container, bool deep = true);
00065
00069 AtomContainer(const String& name);
00070
00073 virtual ~AtomContainer();
00074
00079 virtual void clear();
00080
00085 virtual void destroy();
00086
00088
00091
00095 virtual void persistentWrite(PersistenceManager& pm, const char* name = 0) const
00096 throw(Exception::GeneralException);
00097
00101 virtual void persistentRead(PersistenceManager& pm)
00102 throw(Exception::GeneralException);
00103
00105
00108
00115 void set(const AtomContainer& atom_container, bool deep = true);
00116
00123 AtomContainer& operator = (const AtomContainer& atom_container);
00124
00130 void get(AtomContainer& atom_container, bool deep = true) const;
00131
00135 void swap(AtomContainer& atom_container);
00136
00138
00141
00145 bool operator == (const AtomContainer& atom_container) const;
00146
00150 bool operator != (const AtomContainer& atom_container) const;
00151
00153
00156
00160 void setName(const String& name);
00161
00165 const String& getName() const;
00166
00171 AtomContainer* getSuperAtomContainer();
00172
00177 const AtomContainer* getSuperAtomContainer() const;
00178
00185 AtomContainer* getAtomContainer(Position position);
00186
00193 const AtomContainer* getAtomContainer(Position position) const;
00194
00201 Atom* getAtom(Position position);
00202
00209 const Atom* getAtom(Position position) const;
00210
00217 Atom* getAtom(const String& name);
00218
00225 const Atom* getAtom(const String& name) const;
00226
00230 Size countAtomContainers() const;
00231
00235 Size countAtoms() const;
00236
00240 Size countBonds() const;
00241
00245 Size countInterBonds() const;
00246
00250 Size countIntraBonds() const;
00251
00255 void prepend(Atom& atom);
00256
00260 void append(Atom& atom);
00261
00265 void insert(Atom& atom);
00266
00271 void insertBefore(Atom& atom, Composite& before);
00272
00277 void insertAfter(Atom& atom, Composite& after);
00278
00282 bool remove(Atom& atom);
00283
00284 Size removeHavingProperty(BALL::Property p);
00285 Size removeNotHavingProperty(BALL::Property p);
00286 Size removeHavingProperty(const string& name);
00287 Size removeNotHavingProperty(const string& name);
00288
00292 void prepend(AtomContainer& atom_container);
00293
00297 void append(AtomContainer& atom_container);
00298
00302 void insert(AtomContainer& atom_container);
00303
00308 void insertBefore(AtomContainer& atom_container, Composite& before);
00309
00314 void insertAfter(AtomContainer& atom_container, Composite& after);
00315
00320 void spliceBefore(AtomContainer& atom_container);
00321
00326 void spliceAfter(AtomContainer& atom_container);
00327
00333 void splice(AtomContainer& atom_container);
00334
00339 bool remove(AtomContainer& atom_container);
00340
00342
00345
00348 void destroyBonds();
00349
00351
00354
00358 bool isSubAtomContainerOf(const AtomContainer& atom_container) const;
00359
00363 bool isSuperAtomContainerOf(const AtomContainer& atom_container) const;
00364
00366
00369
00375 virtual bool isValid() const;
00376
00383 virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
00384
00386
00389
00391 bool applyIntraBond(UnaryProcessor<Bond>& processor);
00392
00394 bool applyInterBond(UnaryProcessor<Bond>& processor);
00395
00397
00398
00399
00400 BALL_KERNEL_DEFINE_ITERATOR_CREATORS(Atom)
00401 BALL_KERNEL_DEFINE_ITERATOR_CREATORS(AtomContainer)
00402
00403
00404 private:
00405
00406
00407
00408 String name_;
00409
00410 };
00411 }
00412
00413 #endif // BALL_KERNEL_ATOMCONTAINER_H