"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "layer2/CifBondDict.h" between
pymol-open-source-2.2.0.tar.gz and pymol-open-source-2.3.0.tar.gz

About: PyMOL is a Python-enhanced molecular graphics tool. It excels at 3D visualization of proteins, small molecules, density, surfaces, and trajectories. It also includes molecular editing, ray tracing, and movies. Open Source version.

CifBondDict.h  (pymol-open-source-2.2.0):CifBondDict.h  (pymol-open-source-2.3.0)
skipping to change at line 28 skipping to change at line 28
#include "os_std.h" #include "os_std.h"
#include "PyMOLGlobals.h" #include "PyMOLGlobals.h"
#if 1 #if 1
// (2) // (2)
// Optimized implementation, tuned on speed and memory usage. // Optimized implementation, tuned on speed and memory usage.
// Only supports resn length <= 8 and atom name length <= 4. // Only supports resn length <= 8 and atom name length <= 4.
// Working with this limitation is currently reasonable in PyMOL, // Working with this limitation is currently reasonable in PyMOL,
// since cResnLen=5 and cAtomNameLen=4 (see AtomInfo.h). // since cResnLen=5 and cAtomNameLen=4 (see AtomInfo.h).
#ifdef _PYMOL_NO_CXX11 #include <cstdint>
#define unordered_map map
#else
#include <unordered_map> #include <unordered_map>
#endif
#include <stdint.h>
#include <string.h> #include <string.h>
// mapped type of bond_dict_t // mapped type of bond_dict_t
class res_bond_dict_t : std::unordered_map<int64_t, signed char> { class res_bond_dict_t : std::unordered_map<std::int_fast64_t, signed char> {
static key_type make_key(const char * name1, const char * name2) { static key_type make_key(const char * name1, const char * name2) {
union { char s[4]; int32_t i; } u1, u2; union { char s[4]; std::int32_t i; } u1, u2;
strncpy(u1.s, name1, 4); strncpy(u1.s, name1, 4);
strncpy(u2.s, name2, 4); strncpy(u2.s, name2, 4);
if (u1.i > u2.i) if (u1.i > u2.i)
std::swap(u1.i, u2.i); std::swap(u1.i, u2.i);
// construct 8-byte key from the two 4-byte names // construct 8-byte key from the two 4-byte names
return (((key_type)u1.i) << 32) | u2.i; return (((key_type)u1.i) << 32) | u2.i;
} }
skipping to change at line 65 skipping to change at line 60
mapped_type get(const char * name1, const char * name2) const { mapped_type get(const char * name1, const char * name2) const {
auto it = find(make_key(name1, name2)); auto it = find(make_key(name1, name2));
if (it == end()) if (it == end())
return -1; return -1;
return it->second; return it->second;
} }
}; };
// type for mapping: resn -> ((name1, name2) -> bond order) // type for mapping: resn -> ((name1, name2) -> bond order)
class bond_dict_t : public std::map<int64_t, res_bond_dict_t> { class bond_dict_t : public std::map<std::int_fast64_t, res_bond_dict_t> {
static key_type make_key(const char * s_) { static key_type make_key(const char * s_) {
union { key_type i; char s[sizeof(key_type)]; }; union { key_type i; char s[sizeof(key_type)]; };
strncpy(s, s_, sizeof(s)); strncpy(s, s_, sizeof(s));
return i; return i;
} }
std::set<key_type> unknown_resn; std::set<key_type> unknown_resn;
public: public:
void set_unknown(const char * resn) { void set_unknown(const char * resn) {
 End of changes. 5 change blocks. 
9 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)