RxDock 0.1.0
A fast, versatile, and open-source program for docking ligands to proteins and nucleic acids
Loading...
Searching...
No Matches
Commands.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// Defines the interface for a token to be used by the parser
14
15#ifndef _RBT_COMMANDS_H_
16#define _RBT_COMMANDS_H_
17
18namespace rxdock {
19
20class Commands {
21public:
22 enum CommName {
23 ADD = 0,
24 SUB = 1,
25 MUL = 2,
26 DIV = 3,
27 IF = 4,
28 LOG = 5,
29 EXP = 6,
30 RCTE = 7,
31 AND = 8,
32 NULLC = -1
33 };
34
36 // Constructors
38 Commands(const Commands &c) : name(c.name), nargs(c.nargs) {}
39 inline Commands(int ncomm) {
40 name = CommName(ncomm);
41 switch (name) {
42 case ADD:
43 case SUB:
44 case MUL:
45 case DIV:
46 case AND:
47 nargs = 2;
48 break;
49 case IF:
50 nargs = 3;
51 break;
52 case LOG:
53 case EXP:
54 nargs = 1;
55 break;
56 case RCTE:
57 nargs = 0;
58 break;
59 case NULLC:
60 nargs = 0;
61 break;
62 }
63 }
64
65 inline CommName GetName() const { return name; }
66
67 inline int GetNArgs() const { return nargs; }
68
69 inline bool IsAdd() const { return (name == ADD); }
70 inline bool IsSub() const { return (name == SUB); }
71 inline bool IsMul() const { return (name == MUL); }
72 inline bool IsDiv() const { return (name == DIV); }
73 inline bool IsIf() const { return (name == IF); }
74 inline bool IsLog() const { return (name == LOG); }
75 inline bool IsExp() const { return (name == EXP); }
76 inline bool IsRCte() const { return (name == RCTE); }
77 inline bool IsAnd() const { return (name == AND); }
78
80 // Destructor
82 virtual ~Commands() {}
83
84 virtual void copy(const Commands &c) {
85 name = c.name;
86 nargs = c.nargs;
87 }
88
90 // Private methods
92
93private:
94 Commands(); // Default constructor disabled
95 CommName name;
96 int nargs;
97};
98
99// Useful typedefs
100// typedef SmartPtr<Commands> CommandsPtr; //Smart pointer
101// typedef std::vector<CommandsPtr> CommandsList;//Vector of smart
102// pointers typedef CommandsList::iterator CommandsListIter; typedef
103// CommandsList::const_iterator CommandsListConstIter;
104
105// Compare class to compare different genomes inside a population
106// This is used to sort the genomes in a population depending
107// of the value of their scoring function.
108
109} // namespace rxdock
110
111#endif //_Commands_H_
Definition Commands.h:20