00001
00002
00003
00004
00005 #ifndef BALL_KERNEL_ATOMCONTAINER_H
00006 #define BALL_KERNEL_ATOMCONTAINER_H
00007
00008 #ifndef BALL_KERNEL_ATOMITERATOR_H
00009 # include <BALL/KERNEL/atomIterator.h>
00010 #endif
00011
00012 #ifndef BALL_KERNEL_ATOMCONTAINERITERATOR_H
00013 # include <BALL/KERNEL/atomContainerIterator.h>
00014 #endif
00015
00016
00017 #define BALL_ATOMCONTAINER_DEFAULT_NAME ""
00018
00019 namespace BALL
00020 {
00021 class Molecule;
00022
00030 class BALL_EXPORT AtomContainer
00031 : public Composite,
00032 public PropertyManager
00033 {
00034 public:
00035
00036 BALL_CREATE_DEEP(AtomContainer)
00037
00038
00041
00043 enum Property
00044 {
00046 NUMBER_OF_PROPERTIES = 0
00047 };
00048
00050
00053
00056 AtomContainer();
00057
00062 AtomContainer(const AtomContainer& atom_container, bool deep = true);
00063
00067 AtomContainer(const String& name);
00068
00071 virtual ~AtomContainer();
00072
00077 virtual void clear();
00078
00083 virtual void destroy();
00084
00086
00089
00093 virtual void persistentWrite(PersistenceManager& pm, const char* name = 0) const;
00094
00098 virtual void persistentRead(PersistenceManager& pm);
00099
00101
00104
00111 void set(const AtomContainer& atom_container, bool deep = true);
00112
00119 AtomContainer& operator = (const AtomContainer& atom_container);
00120
00126 void get(AtomContainer& atom_container, bool deep = true) const;
00127
00131 void swap(AtomContainer& atom_container);
00132
00134
00137
00141 bool operator == (const AtomContainer& atom_container) const;
00142
00146 bool operator != (const AtomContainer& atom_container) const;
00147
00149
00152
00156 void setName(const String& name);
00157
00161 const String& getName() const;
00162
00167 AtomContainer* getSuperAtomContainer();
00168
00173 const AtomContainer* getSuperAtomContainer() const;
00174
00181 AtomContainer* getAtomContainer(Position position);
00182
00189 const AtomContainer* getAtomContainer(Position position) const;
00190
00197 Atom* getAtom(Position position);
00198
00205 const Atom* getAtom(Position position) const;
00206
00213 Atom* getAtom(const String& name);
00214
00221 const Atom* getAtom(const String& name) const;
00222
00226 Size countAtomContainers() const;
00227
00231 Size countAtoms() const;
00232
00236 Size countBonds() const;
00237
00241 Size countInterBonds() const;
00242
00246 Size countIntraBonds() const;
00247
00251 void prepend(Atom& atom);
00252
00256 void append(Atom& atom);
00257
00261 void insert(Atom& atom);
00262
00267 void insertBefore(Atom& atom, Composite& before);
00268
00273 void insertAfter(Atom& atom, Composite& after);
00274
00278 bool remove(Atom& atom);
00279
00280 Size removeHavingProperty(BALL::Property p);
00281 Size removeNotHavingProperty(BALL::Property p);
00282 Size removeHavingProperty(const string& name);
00283 Size removeNotHavingProperty(const string& name);
00284
00288 void prepend(AtomContainer& atom_container);
00289
00293 void append(AtomContainer& atom_container);
00294
00298 void insert(AtomContainer& atom_container);
00299
00304 void insertBefore(AtomContainer& atom_container, Composite& before);
00305
00310 void insertAfter(AtomContainer& atom_container, Composite& after);
00311
00316 void spliceBefore(AtomContainer& atom_container);
00317
00322 void spliceAfter(AtomContainer& atom_container);
00323
00329 void splice(AtomContainer& atom_container);
00330
00335 bool remove(AtomContainer& atom_container);
00336
00338
00341
00344 void destroyBonds();
00345
00347
00350
00354 bool isSubAtomContainerOf(const AtomContainer& atom_container) const;
00355
00359 bool isSuperAtomContainerOf(const AtomContainer& atom_container) const;
00360
00362
00365
00371 virtual bool isValid() const;
00372
00379 virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
00380
00382
00385
00387 bool applyIntraBond(UnaryProcessor<Bond>& processor);
00388
00390 bool applyInterBond(UnaryProcessor<Bond>& processor);
00391
00393
00394
00395
00396 BALL_KERNEL_DEFINE_ITERATOR_CREATORS(Atom)
00397 BALL_KERNEL_DEFINE_ITERATOR_CREATORS(AtomContainer)
00398
00399
00400 private:
00401
00402
00403
00404 String name_;
00405
00406 };
00407 }
00408
00409 #endif // BALL_KERNEL_ATOMCONTAINER_H