Develop Biology
The language of life
Filterable.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
27
28namespace bio {
29namespace physical {
30
32 :
33 Class(
34 this,
35 new Symmetry(
36 "m_filter",
37 symmetry_type::DefineVariable())),
38 m_filter(filter::Default())
39{
40}
41
42Filterable::Filterable(Filter filter)
43 :
44 Class(
45 this,
46 new Symmetry(
47 "m_filter",
48 symmetry_type::DefineVariable())),
49 m_filter(filter)
50{
51
52}
53
55{
56}
57
58void Filterable::SetFilter(Filter filter)
59{
60 m_filter = filter;
61}
62
64{
65 return m_filter;
66}
67
69{
71 return Wave::Spin();
72}
73
75{
76 BIO_SANITIZE(symmetry, ,
77 return code::BadArgument1());
78 m_filter = symmetry->GetValue();
79 return code::Success();
80}
81
83{
84 BIO_SANITIZE(args.size() == 1 && args[0].Is(m_filter), ,
85 return);
86 m_filter = args[0];
87}
88
89} //physical namespace
90} //bio namespace
#define BIO_SANITIZE(test, success, failure)
void Set(T in)
Definition: ByteStream.h:147
virtual void InitializeImplementation(ByteStreams args)
Definition: Filterable.cpp:82
Filterable(Filter filter)
Definition: Filterable.cpp:31
virtual void SetFilter(Filter filter)
Definition: Filterable.cpp:58
Filter GetFilter() const
Definition: Filterable.cpp:63
virtual Symmetry * Spin() const
Definition: Filterable.cpp:68
virtual Code Reify(Symmetry *symmetry)
Definition: Filterable.cpp:74
virtual const ByteStream & GetValue() const
Definition: Symmetry.cpp:125
virtual ByteStream * AccessValue()
Definition: Symmetry.cpp:130
virtual Symmetry * Spin() const
Definition: Wave.cpp:59
Symmetry * m_symmetry
Definition: Wave.h:272
Code BadArgument1()
Code Success()
Filter Default()
SymmetryType DefineVariable()
Definition: Cell.h:31
std::vector< ByteStream > ByteStreams
Definition: Types.h:52