RxDock 0.1.0
A fast, versatile, and open-source program for docking ligands to proteins and nucleic acids
Loading...
Searching...
No Matches
Cell.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// Cell Class. Cell represents a function or input variable of the CGP
14
15#ifndef _RBT_CELL_H_
16#define _RBT_CELL_H_
17
18#include "rxdock/geneticprogram/GPTypes.h"
19
20#include <loguru.hpp>
21
22namespace rxdock {
23
24class Cell {
25public:
27 // Constructors
29 Cell() {
30 evaluated = false;
31 name = "";
32 constant = false;
33 }
34 Cell(const Cell &c)
35 : evaluated(c.evaluated), constant(c.constant), name(c.name),
36 result(c.result) {}
37
39 // Destructor
41 virtual ~Cell() {}
42
43 Cell &operator=(const Cell &c) {
44 evaluated = c.evaluated;
45 constant = c.constant;
46 name = c.name;
47 result = c.result;
48 return *this;
49 }
50
51 bool Evaluated() const { return evaluated; }
52 bool Named() const { return (name != ""); }
53 bool Constant() const { return constant; }
54 void Clear() {
55 if (!constant) {
56 evaluated = false;
57 name = "";
58 }
59 }
60 ReturnType GetResult() const { return result; }
61 std::string GetName() const { return name; }
62 void SetName(std::string s) { name = s; }
63 void SetResult(ReturnType r) {
64 result = r;
65 evaluated = true;
66 }
67 void SetConstant(ReturnType r) {
68 result = r;
69 evaluated = true;
70 constant = true;
71 name = std::to_string(r);
72 }
73 void ResetConstant() {
74 evaluated = false;
75 name = "";
76 if (constant)
77 constant = false;
78 else
79 LOG_F(WARNING, "Cell::ResetConstant: no constant");
80 }
81
82private:
83 bool evaluated, constant;
84 std::string name;
85 ReturnType result;
86 // friend std::ostream& operator<<(std::ostream& s, const Cell &p);
87};
88
89// Useful typedefs
90typedef SmartPtr<Cell> CellPtr; // Smart pointer
91typedef std::vector<CellPtr> CellList; // Vector of smart pointers
92typedef CellList::iterator CellListIter;
93typedef CellList::const_iterator CellListConstIter;
94
95} // namespace rxdock
96
97#endif //_Cell_H_
Definition Cell.h:24
Definition SmartPointer.h:48