Develop Biology
The language of life
Reactant.cpp
Go to the documentation of this file.
1/*
2 * This file is a part of the Biology project by eons LLC.
3 * Biology (aka Develop Biology) is a framework for approaching software
4 * development from a natural sciences perspective.
5 *
6 * Copyright (C) 2021 Séon O'Shannon & eons LLC
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as
10 * published by the Free Software Foundation, either version 3 of the
11 * License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
23#include "bio/common/String.h"
24
25namespace bio {
26namespace chemical {
27
28void Reactant::CtorCommon(Name typeName)
29{
31 typeName,
33 );
34}
35
37 :
38 Class< Reactant >(this),
39 Substance()
40{
41 CtorCommon(typeName);
42}
43
44Reactant::Reactant(
45 Name typeName,
46 const typename UnorderedMotif< Property >::Contents* properties,
47 const typename UnorderedMotif< State >::Contents* states
48)
49 :
50 Class< Reactant >(this),
52 properties,
53 states
54 )
55{
56 CtorCommon(typeName);
57}
58
60 Name typeName,
61 const Substance* substance
62)
63 :
64 Class< Reactant >(this),
65 Substance(*substance)
66{
67 CtorCommon(typeName);
68}
69
70
72{
73 delete[] m_typeName;
74}
75
76bool Reactant::operator==(const Substance& other) const
77{
78 return Substance::operator==(other) && other.GetBondPosition(m_typeName) != 0;
79}
80
81} //chemical namespace
82} //bio namespace
Valence GetBondPosition(AtomicNumber bondedId) const
Definition: Atom.cpp:168
virtual bool operator==(const Substance &other) const
Definition: Reactant.cpp:76
Reactant(Name typeName, const Substance *substance)
Definition: Reactant.cpp:59
void CloneInto(const char *source, const char *&target)
Definition: String.cpp:236
Definition: Cell.h:31
const char * Name
Definition: Types.h:46