Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Structure.h

Go to the documentation of this file.
00001 #ifndef StructureH
00002 #define StructureH
00003 
00004 /*******************************************************************************
00005 Copyright 1999,2000,2001,2002 Petr Kulhanek
00006 
00007     This file is part of Core plugin.
00008 
00009     Core plugin 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     Core plugin 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 Core plugin; if not, write to the Free Software
00021     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 *******************************************************************************/
00023 /*******************************************************************************
00024 ** COPYRIGHT (C):       1998,1999,2000,2001 All Rights Reserved
00025 ** PROJECT:             Project NEMESIS
00026 ** FILE:                Structure
00027 ** FUNCTION:            information about structure without editable possibilty
00028 ** VERSION:             2.0
00029 ** LANGUAGE:            CBuilder C++
00030 ** TARGET COMPUTER:     IBM PC
00031 ** PROGRAMMER:          Petr Kulhánek
00032 ** HISTORY:
00033 VERSION DATE        NOTE
00034 1.0     1999-08-xx
00035 2.0     2002-01-01  remain only structural data, remove constraints and graphics
00036 *******************************************************************************/
00037 
00041 /* HEADER FILES ***************************************************************/
00042 
00043 #include "CoreMainHeader.h"
00044 #include "Atom.h"
00045 #include "Bond.h"
00046 #include "Constraint.h"
00047 #include "Manipulator.h"
00048 #include "IndexCounter.h"
00049 
00050 /* HEDER FILES END ************************************************************/
00051 
00052 class CXMLElement;
00053 
00054 /* CLASS DECLARATION ***********************************************************/
00055 
00057 
00062 class NEMESIS_CORE_PACKAGE CStructure {
00063     public:
00064     enum EConnectorMode{
00065             Manual=0,
00066             Auto,
00067             };
00068 
00069     public:
00070  // constructor and destructor of class
00071          __fastcall CStructure(void);
00072          __fastcall ~CStructure(void);
00073 
00074  // disk, stream operations ----------------------------------------------------
00075     bool __fastcall Load(CMolecule* p_mol);
00076     bool __fastcall Load(const CSmallString& name); // load from file
00077     bool __fastcall Save(const CSmallString& name);
00078     bool __fastcall Load(CXMLElement* p_element);           // load from XML file
00079     bool __fastcall Save(CXMLElement* p_element);           // save to XML file
00080 
00081  //
00082     void        __fastcall Clear(void);         // delete all data in structure
00083     inline bool __fastcall IsEmpty(void) const; // check structure if it is empty
00084 
00085  // connector methods ----------------------------------------------------------
00086         void __fastcall SetFirstConnector(void);
00087     void __fastcall SetNextConnector(void);
00088     bool __fastcall SetBestConnector(EBondOrder order);
00089     int  __fastcall GetNumOfUserConnectors(void);
00090     int  __fastcall GetIndexOfConnector(void);
00091     int  __fastcall GetConnector(void);
00092     int  __fastcall GetConnector(int index);
00093     void __fastcall SetConnectorField(int* p_field,int num);
00094     void __fastcall SetConnectorMode(EConnectorMode mode);
00095     EConnectorMode __fastcall GetConnectorMode(void);
00096 
00097  // master atom methods --------------------------------------------------------
00098     inline void __fastcall SetZOfMasterAtom(int z);
00099     inline int  __fastcall GetZOfMasterAtom(void) const;
00100 
00101  // accessing data -------------------------------------------------------------
00102     inline int __fastcall GetNumOfAtoms(void) const;
00103     inline int __fastcall GetNumOfBonds(void) const;
00104     inline CAtomData& __fastcall GetAtomData(int i) const;
00105     inline CBondData& __fastcall GetBondData(int i) const;
00106 
00107     int __fastcall   GetOppositeAtom(int at,int index=1);
00108     int __fastcall   GetAtomDataFromIndex(int atomindex);
00109 
00110  // Private data ---------------------------------------------------------------
00111     public:
00112     CSmallString   Name;
00113 
00114     private:
00115     CAtomData*      Atoms;          // atoms
00116     CBondData*      Bonds;          // bonds
00117     int             NA,NB;          // number of atoms and bonds
00118     int*            Connectors;     // field of connector indexes
00119     int             NumOfConnectors;// number of connectors
00120     int             Connector;      // active connector
00121     int             MasterAtomZ;    // Z of master atom
00122     EConnectorMode  Mode;           // connector mode
00123 
00124     int __fastcall          GetConnectBond(int a);
00125     };
00126 
00127 /* CLASS DECLARATION END *******************************************************/
00128 
00129 /* INLINE FUNCTIONS ***********************************************************/
00130 
00131 inline CAtomData& __fastcall CStructure::GetAtomData(int i) const
00132 {
00133  return(Atoms[i]);
00134 }
00135 
00136 //------------------------------------------------------------------------------
00137 
00138 inline CBondData& __fastcall CStructure::GetBondData(int i) const
00139 {
00140  return(Bonds[i]);
00141 }
00142 
00143 //------------------------------------------------------------------------------
00144 
00145 inline int __fastcall CStructure::GetNumOfAtoms(void) const
00146 {
00147  return(NA);
00148 }
00149 
00150 //------------------------------------------------------------------------------
00151 
00152 inline int __fastcall CStructure::GetNumOfBonds(void) const
00153 {
00154  return(NB);
00155 }
00156 
00157 //---------------------------------------------------------------------------
00158 
00159 inline void __fastcall CStructure::SetZOfMasterAtom(int z)
00160 {
00161  MasterAtomZ = z;
00162 }
00163 
00164 //---------------------------------------------------------------------------
00165 
00166 inline int __fastcall CStructure::GetZOfMasterAtom(void) const
00167 {
00168  return(MasterAtomZ);
00169 }
00170 
00171 /* INLINE FUNCTIONS END *******************************************************/
00172 
00173 #endif

Generated on Sun Feb 9 12:53:51 2003 for NemesisCore by doxygen1.3-rc2