File: export_entity_property_mapper.cc

package info (click to toggle)
openstructure 2.9.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 205,228 kB
  • sloc: cpp: 188,129; python: 35,361; ansic: 34,298; fortran: 3,275; sh: 286; xml: 146; makefile: 29
file content (68 lines) | stat: -rw-r--r-- 2,428 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <boost/python.hpp>

#include <ost/mol/entity_property_mapper.hh>

using namespace ost;
using namespace ost::mol;
using namespace boost::python;

namespace {


Real (EntityPropertyMapper::*get_ah_a)(const AtomHandle&) const=&EntityPropertyMapper::Get;
Real (EntityPropertyMapper::*get_av_a)(const AtomView&) const=&EntityPropertyMapper::Get;
Real (EntityPropertyMapper::*get_rh_a)(const ResidueHandle&) const=&EntityPropertyMapper::Get;
Real (EntityPropertyMapper::*get_rv_a)(const ResidueView&) const=&EntityPropertyMapper::Get;
Real (EntityPropertyMapper::*get_ch_a)(const ChainHandle&) const=&EntityPropertyMapper::Get;
Real (EntityPropertyMapper::*get_cv_a)(const ChainView&) const=&EntityPropertyMapper::Get;


Real (EntityPropertyMapper::*get_ah_b)(const AtomHandle&, Real) const=&EntityPropertyMapper::Get;
Real (EntityPropertyMapper::*get_av_b)(const AtomView&, Real) const=&EntityPropertyMapper::Get;
Real (EntityPropertyMapper::*get_rh_b)(const ResidueHandle&, Real) const=&EntityPropertyMapper::Get;
Real (EntityPropertyMapper::*get_rv_b)(const ResidueView&, Real) const=&EntityPropertyMapper::Get;
Real (EntityPropertyMapper::*get_ch_b)(const ChainHandle&, Real) const=&EntityPropertyMapper::Get;
Real (EntityPropertyMapper::*get_cv_b)(const ChainView&, Real) const=&EntityPropertyMapper::Get;

EntityPropertyMapper create_epm(const String& prop_name, char level)
{
  switch(level) {
    case 'A':
    case 'a':
      return EntityPropertyMapper(prop_name, Prop::ATOM);
    case 'R':
    case 'r':
      return EntityPropertyMapper(prop_name, Prop::RESIDUE);
    case 'C':
    case 'c':
      return EntityPropertyMapper(prop_name, Prop::CHAIN);
    case 'U':
    case 'u':
      return EntityPropertyMapper(prop_name, Prop::UNSPECIFIED);
    default:
      throw Error(String("unknown property level '")+level+"'");
  }
}

}

void export_EntityPropertyMapper()
{
  class_<EntityPropertyMapper>("EntityPropertyMapper", 
                               init<const String&, 
                                    Prop::Level>(arg("level")=Prop::UNSPECIFIED))
    .def("__init__", &create_epm)
    .def("Get", get_ah_a)
    .def("Get", get_av_a)
    .def("Get", get_rh_a)
    .def("Get", get_rv_a)
    .def("Get", get_ch_a)
    .def("Get", get_cv_a)
    .def("Get", get_ah_b)
    .def("Get", get_av_b)
    .def("Get", get_rh_b)
    .def("Get", get_rv_b)
    .def("Get", get_ch_b)
    .def("Get", get_cv_b)
  ;  
}