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
27
namespace
bio
{
28
namespace
physical {
29
36
template
<
typename
T >
37
class
Class
:
38
public
Wave
39
{
40
public
:
46
Class
(
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
123
protected
:
124
T*
m_object
;
125
};
126
127
}
//physical namespace
128
}
//bio namespace
Wave.h
bio::physical::Class
Definition:
Class.h:39
bio::physical::Class::AsWave
virtual Wave * AsWave()
Definition:
Class.h:99
bio::physical::Class::m_object
T * m_object
Definition:
Class.h:124
bio::physical::Class::~Class
virtual ~Class()
Definition:
Class.h:60
bio::physical::Class::Class
Class(T *object, Symmetry *symmetry=NULL)
Definition:
Class.h:46
bio::physical::Class::Clone
virtual Wave * Clone() const
Definition:
Class.h:89
bio::physical::Class::AsWave
virtual const Wave * AsWave() const
Definition:
Class.h:108
bio::physical::Class::Convert
T * Convert(Wave *wave)
Definition:
Class.h:79
bio::physical::Symmetry
Definition:
Symmetry.h:34
bio::physical::Wave
Definition:
Wave.h:65
bio
Definition:
Cell.h:31
Codes.h
inc
bio
physical
common
Class.h
Generated by
1.9.4