RxDock 0.1.0
A fast, versatile, and open-source program for docking ligands to proteins and nucleic acids
Loading...
Searching...
No Matches
Vble.h
1/***********************************************************************
2 * The rDock program was developed from 1998 - 2006 by the software team
3 * at RiboTargets (subsequently Vernalis (R&D) Ltd).
4 * In 2006, the software was licensed to the University of York for
5 * maintenance and distribution.
6 * In 2012, Vernalis and the University of York agreed to release the
7 * program as Open Source software.
8 * This version is licensed under GNU-LGPL version 3.0 with support from
9 * the University of Barcelona.
10 * http://rdock.sourceforge.net/
11 ***********************************************************************/
12
13// Vble class. Stores information about the variables used by the filters.
14
15#ifndef _RBT_VBLE_H_
16#define _RBT_VBLE_H_
17
18#include "rxdock/geneticprogram/GPTypes.h"
19
20namespace rxdock {
21
22class Vble {
23public:
24 static const std::string _CT;
25 enum VbleType { CTE, LIG, SCORE, SITE };
26 Vble() : vt(CTE), value(0.0), name("") {
27 _RBTOBJECTCOUNTER_CONSTR_(_CT);
28 } // default const.
29 Vble(std::string s, ReturnType val = 0.0) : value(val), name(s) {
30 if (s.find("LIG_") == 0)
31 vt = LIG;
32 else if (s.find("SITE_") == 0)
33 vt = SITE;
34 else if (s.find(GetMetaDataPrefix() + "score") == 0)
35 vt = SCORE;
36 else
37 vt = CTE;
38 _RBTOBJECTCOUNTER_CONSTR_(_CT);
39 }
40 Vble(const Vble &v) : vt(v.vt), value(v.value), name(v.name) {
41 _RBTOBJECTCOUNTER_COPYCONSTR_(_CT);
42 }
43 void SetValue(ReturnType val) {
44 value = val;
45 if (name == "") {
46 name = std::to_string(value);
47 }
48 }
49 ReturnType GetValue() const { return value; }
50 virtual ~Vble() { _RBTOBJECTCOUNTER_DESTR_(_CT); }
51
52 Vble &operator=(const Vble &v) {
53 vt = v.vt;
54 value = v.value;
55 name = v.name;
56 return *this;
57 }
58
59 void SetName(std::string nm) { name = nm; }
60 std::string GetName() const { return name; }
61
62 bool IsLig() { return (vt == LIG); }
63 bool IsScore() { return (vt == SCORE); }
64 bool IsSite() { return (vt == SITE); }
65
66private:
67 VbleType vt;
68 ReturnType value;
69 std::string name;
70};
71
72// Useful typedefs
73typedef SmartPtr<Vble> VblePtr; // Smart pointer
74typedef std::vector<VblePtr> VbleList; // Vector of smart pointers
75typedef VbleList::iterator VbleListIter;
76typedef VbleList::const_iterator VbleListConstIter;
77
78} // namespace rxdock
79
80#endif //_Vble_H_
Definition SmartPointer.h:48
Definition Vble.h:22