Develop Biology
The language of life
Class.h
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) 2022 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
22#pragma once
23
27#include "bio/log/Writer.h"
28#include "bio/chemical/Atom.h"
29#include "SymmetryTypes.h"
30
31namespace bio {
32namespace chemical {
33
34class Substance;
35
43template < typename T >
44class Class :
45 public physical::Class< T >,
46 virtual public physical::Identifiable< StandardDimension >,
47 virtual public log::Writer,
48 virtual public Atom
49{
50private:
51 void CtorCommon(Filter filter = filter::Default())
52 {
53 if (filter != filter::Default())
54 {
55 //Skip log::Writer::Initialize, since we don't have a log::Engine atm.
56 Filterable::Initialize(filter);
57 }
58 //Bond the class we're given, Virtually.
62 }
63
64public:
69 T)
70
71
78 Class(
79 T* object,
82 SymmetryType symmetryType = symmetry_type::Object())
83 :
84 physical::Class< T >(
85 object,
86 new physical::Symmetry(
87 TypeName< T >().c_str(),
88 symmetryType
89 ))
90 {
91 CtorCommon(filter);
92 }
93
94
101 Class(
102 T* object,
103 Name name,
105 Filter filter = filter::Default(),
106 SymmetryType symmetryType = symmetry_type::Object())
107 :
108 physical::Class< T >(
109 object,
110 new physical::Symmetry(
111 TypeName< T >().c_str(),
112 symmetryType
113 ))
114 {
115 CtorCommon(filter);
116
117 if (perspective)
118 {
120 name,
122 );
123 }
124 else
125 {
126 SetName(name);
127 }
128 }
129
136 Class(
137 T* object,
138 StandardDimension id,
139 physical::Perspective< StandardDimension >* perspective = NULL,
140 Filter filter = filter::Default(),
141 SymmetryType symmetryType = symmetry_type::Object())
142 :
143 physical::Class< T >(
144 object,
145 new physical::Symmetry(
146 TypeName< T >().c_str(),
147 symmetryType
148 ))
149 {
150 CtorCommon(filter);
151
152 if (perspective)
153 {
155 id,
157 );
158 }
159 else
160 {
161 SetId(id);
162 }
163 }
164
168 virtual ~Class()
169 {
170
171 }
172
178 virtual Properties GetProperties() const
179 {
180 return PeriodicTable::Instance().GetPropertiesOf< T >();
181 }
182
187 virtual Atom* AsAtom()
188 {
189 return this;
190 }
191
196 virtual const Atom* AsAtom() const
197 {
198 return this;
199 }
200
206 virtual Code Attenuate(const physical::Wave* other)
207 {
209 }
210
216 virtual Code Disattenuate(const physical::Wave* other)
217 {
219 }
220};
221
222} //chemical namespace
223} //bio namespace
void Initialize(ByteStreams args)
Definition: VirtualBase.cpp:40
virtual Code Disattenuate(const Wave *other)
Definition: Atom.cpp:83
Atom(const Atom &other)
Definition: Atom.cpp:29
virtual Code Attenuate(const Wave *other)
Definition: Atom.cpp:49
BIO_DISAMBIGUATE_ALL_CLASS_METHODS(physical, T) Class(T *object
physical::Perspective< StandardDimension > Filter filter
Definition: Class.h:81
physical::Perspective< StandardDimension > * perspective
Definition: Class.h:80
virtual ~Class()
Definition: Class.h:60
Class(T *object, Symmetry *symmetry=NULL)
Definition: Class.h:46
virtual Code Attenuate(const Wave *other)
Definition: Wave.cpp:81
virtual Code Disattenuate(const Wave *other)
Definition: Wave.cpp:86
virtual Properties GetProperties() const
Definition: Wave.cpp:142
virtual chemical::Atom * AsAtom()
Definition: Wave.h:209
BondType Virtual()
Filter Default()
SymmetryType Object()
Definition: Cell.h:31
const std::string TypeName()
const char * Name
Definition: Types.h:46
uint8_t Properties
Definition: Types.h:58