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
24#include "Codes.h"
25#include "bio/physical/Wave.h"
26
27namespace bio {
28namespace physical {
29
36template < typename T >
37class Class :
38 public Wave
39{
40public:
47 T* object,
48 Symmetry* symmetry = NULL
49 )
50 :
51 Wave(symmetry),
52 m_object(object)
53 {
54
55 }
56
60 virtual ~Class()
61 {
62
63 }
64
69 virtual operator T*()
70 {
71 return m_object;
72 }
73
79 T* Convert(Wave* wave)
80 {
81 return Cast< T* >(wave);
82 }
83
84
89 virtual Wave* Clone() const
90 {
91 T* ret = new T(*m_object);
92 return Cast< Class< T >* >(ret); //2-step cast: 1st explicitly cast to *this; 2nd implicitly cast to Wave.
93 }
94
99 virtual Wave* AsWave()
100 {
101 return this;
102 }
103
108 virtual const Wave* AsWave() const
109 {
110 return this;
111 }
112
118 virtual operator Wave*()
119 {
120 return this;
121 }
122
123protected:
125};
126
127} //physical namespace
128} //bio namespace
virtual Wave * AsWave()
Definition: Class.h:99
virtual ~Class()
Definition: Class.h:60
Class(T *object, Symmetry *symmetry=NULL)
Definition: Class.h:46
virtual Wave * Clone() const
Definition: Class.h:89
virtual const Wave * AsWave() const
Definition: Class.h:108
T * Convert(Wave *wave)
Definition: Class.h:79
Definition: Cell.h:31