1 // $Id: mmdb_mask.h $ 2 // ================================================================= 3 // 4 // CCP4 Coordinate Library: support of coordinate-related 5 // functionality in protein crystallography applications. 6 // 7 // Copyright (C) Eugene Krissinel 2000-2013. 8 // 9 // This library is free software: you can redistribute it and/or 10 // modify it under the terms of the GNU Lesser General Public 11 // License version 3, modified in accordance with the provisions 12 // of the license to address the requirements of UK law. 13 // 14 // You should have received a copy of the modified GNU Lesser 15 // General Public License along with this library. If not, copies 16 // may be downloaded from http://www.ccp4.ac.uk/ccp4license.php 17 // 18 // This program is distributed in the hope that it will be useful, 19 // but WITHOUT ANY WARRANTY; without even the implied warranty of 20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 // GNU Lesser General Public License for more details. 22 // 23 // ================================================================= 24 // 25 // 12.09.13 <-- Date of Last Modification. 26 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 27 // ----------------------------------------------------------------- 28 // 29 // **** Module : MMDBF_Mask <interface> 30 // ~~~~~~~~~ 31 // **** Project : MacroMolecular Data Base (MMDB) 32 // ~~~~~~~~~ 33 // 34 // **** Classes : mmdb::Mask ( atom selection mask ) 35 // ~~~~~~~~~ 36 // 37 // (C) E. Krissinel 2000-2013 38 // 39 // ================================================================= 40 // 41 42 #ifndef __MMDB_Mask__ 43 #define __MMDB_Mask__ 44 45 #include "mmdb_io_stream.h" 46 47 namespace mmdb { 48 49 // ========================== Mask ============================= 50 51 DefineClass(Mask); 52 DefineStreamFunctions(Mask); 53 54 class Mask : public io::Stream { 55 56 public : 57 58 Mask (); 59 Mask ( io::RPStream Object ); 60 ~Mask(); 61 62 void SetMaskBit ( int BitNo ); 63 void NewMask ( PPMask Mask, int nMasks ); 64 65 void CopyMask ( PMask Mask ); // this = Mask 66 void SetMask ( PMask Mask ); // this = this | Mask 67 void RemoveMask ( PMask Mask ); // this = this & (~Mask) 68 void SelMask ( PMask Mask ); // this = this & Mask 69 void XadMask ( PMask Mask ); // this = this ^ Mask 70 void ClearMask (); // this = NULL 71 void NegMask (); // this = ~this 72 73 bool CheckMask ( PMask Mask ); // true if the bit is on 74 bool isMask (); // true if any mask bit is on 75 getLength()76 inline int getLength() { return mlen; } 77 78 pstr Print ( pstr S ); // returns binary string 79 80 void write ( io::RFile f ); 81 void read ( io::RFile f ); 82 83 protected : 84 int mlen; 85 wvector m; 86 87 void InitMask(); 88 void Expand ( int n ); 89 90 }; 91 92 } // namespace mmdb 93 94 #endif 95 96