libbio
Loading...
Searching...
No Matches
CellularForwarder.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 "bio/cellular/Cell.h"
25
26namespace bio {
27
34template < class CALLER, class CLOBBER >
36 public cellular::Class< CellularForwarder< CALLER, CLOBBER > >,
37 public CLOBBER
38{
39public:
40
45 cellular::Class< CellularForwarder< CALLER, CLOBBER > >(
46 this,
47 filter::Cellular()
48 ),
49 mForwardedCrest(NULL),
50 mCaller(NULL)
51 {
52 }
53
57 explicit CellularForwarder(const Name& name) :
58 cellular::Class< CellularForwarder< CALLER, CLOBBER > >(
59 this,
60 name,
61 filter::Cellular()
62 ),
63 mForwardedCrest(NULL),
64 mCaller(NULL)
65 {
66 }
67
71 explicit CellularForwarder(const Id& id) :
72 cellular::Class< CellularForwarder< CALLER, CLOBBER > >(
73 this,
74 id,
75 filter::Cellular()
76 ),
77 mForwardedCrest(NULL),
78 mCaller(NULL)
79 {
80 }
81
86 {
87 BIO_ASSERT(mForwardedCrest);
88 Delete(mForwardedCrest);
89 }
90
96 bio::Code (CALLER::*forwardTo)(),
97 Pointer< CALLER > caller)
98 {
99 mForwardedCrest = new BIO_EXCITATION_CLASS(CALLER, Code)(forwardTo);
100 mCaller = caller;
101 }
102
106 virtual Code Crest() BIO_FINAL
107 {
108 Code ret = (*mForwardedCrest)(mCaller);
109
110 //Then also do this.
112
113 return ret;
114 }
115
120
149 virtual bool RegisterProperties(const ::bio::Properties& properties) BIO_FINAL
150 {
152 }
153 virtual ::bio::Properties GetProperties() const BIO_FINAL
154 {
156 }
157 template < typename AS >
158 operator AS()
159 {
161 }
166 virtual void Log(
168 const char* format,
170 ) const BIO_FINAL
171 {
173 level,
174 format,
175 args
176 );
177 }
222 template < typename ENVIRONMENT >
227 template < typename ENVIRONMENT >
232 template < typename ENVIRONMENT >
237 virtual ::bio::Code Apoptose() BIO_FINAL
238 {
240 }
241 virtual bool CheckIn() BIO_FINAL
242 {
244 }
245
246private:
247 Pointer< BIO_EXCITATION_CLASS(CALLER, Code) > mForwardedCrest;
248 Pointer< CALLER > mCaller;
249};
250
251} //bio namespace
#define BIO_ASSERT(condition)
Definition AssertMacros.h:31
#define BIO_EXCITATION_CLASS(wave, ret,...)
Definition ExcitationMacros.h:51
#define BIO_FINAL
Definition KeywordMacros.h:45
Definition CellularForwarder.h:38
Pointer< const ::bio::physical::Wave > AsWave() const
Definition CellularForwarder.h:141
virtual ::bio::Code Attenuate(Pointer< const ::bio::physical::Wave > other) BIO_FINAL
Definition CellularForwarder.h:214
Pointer< ENVIRONMENT > GetEnvironment()
Definition CellularForwarder.h:228
Pointer< const ::bio::chemical::Atom > AsAtom() const
Definition CellularForwarder.h:133
virtual bool RegisterProperties(const ::bio::Properties &properties) BIO_FINAL
Definition CellularForwarder.h:149
virtual ::bio::Code SetInterval(::bio::Milliseconds interval) BIO_FINAL
Definition CellularForwarder.h:178
Pointer< ::bio::physical::Wave > AsWave()
Definition CellularForwarder.h:129
virtual bool CheckIn() BIO_FINAL
Definition CellularForwarder.h:241
virtual ::bio::Properties GetProperties() const BIO_FINAL
Definition CellularForwarder.h:153
virtual Pointer< ::bio::physical::Wave > Clone() const
Definition CellularForwarder.h:125
virtual void Log(::bio::LogLevel level, const char *format, va_list args) const BIO_FINAL
Definition CellularForwarder.h:166
virtual Code CreateDefaultProteins() BIO_FINAL
Definition CellularForwarder.h:121
virtual ::bio::Code Apoptose() BIO_FINAL
Definition CellularForwarder.h:237
virtual Pointer< ::bio::physical::Wave > Modulate(Pointer< ::bio::physical::Wave > signal) BIO_FINAL
Definition CellularForwarder.h:182
void SetCrestFunction(bio::Code(CALLER::*forwardTo)(), Pointer< CALLER > caller)
Definition CellularForwarder.h:95
virtual ::bio::Code Disattenuate(Pointer< const ::bio::physical::Wave > other) BIO_FINAL
Definition CellularForwarder.h:218
virtual Pointer< const ::bio::log::Writer > AsLogWriter() const BIO_FINAL
Definition CellularForwarder.h:162
virtual bool Superpose(Pointer< const ::bio::physical::Wave > displacement, Pointer< ::bio::physical::Interference > pattern) BIO_FINAL
Definition CellularForwarder.h:204
virtual Code Crest() BIO_FINAL
Definition CellularForwarder.h:106
CellularForwarder(const Name &name)
Definition CellularForwarder.h:57
CellularForwarder()
Definition CellularForwarder.h:44
const Pointer< ENVIRONMENT > GetEnvironment() const
Definition CellularForwarder.h:233
void SetEnvironment(Pointer< ENVIRONMENT > environment)
Definition CellularForwarder.h:223
virtual Code CacheProteins() BIO_FINAL
Definition CellularForwarder.h:116
CellularForwarder(const Id &id)
Definition CellularForwarder.h:71
virtual Pointer< const ::bio::physical::Wave > Demodulate() const BIO_FINAL
Definition CellularForwarder.h:190
virtual Pointer< ::bio::physical::Wave > Demodulate() BIO_FINAL
Definition CellularForwarder.h:186
virtual Pointer< ::bio::physical::Wave > Superpose(const ::bio::physical::ConstWaves &displacement, Pointer< ::bio::physical::Interference > pattern) BIO_FINAL
Definition CellularForwarder.h:194
virtual ~CellularForwarder()
Definition CellularForwarder.h:85
Pointer< ::bio::chemical::Atom > AsAtom()
Definition CellularForwarder.h:137
Definition Pointer.h:115
Definition String.h:55
Definition cellular/common/Class.h:50
virtual Code CreateDefaultProteins()
Definition cellular/common/Class.h:135
virtual Code SetInterval(Milliseconds period)
Definition cellular/common/Class.h:212
virtual Code Apoptose()
Definition cellular/common/Class.h:155
virtual Code CacheProteins()
Definition cellular/common/Class.h:145
virtual bool CheckIn()
Definition cellular/common/Class.h:199
Class(Pointer< CellularForwarder< CALLER, CLOBBER > > object, Filter filter=filter::Default(), Milliseconds interval=GetDefaultInterval())
Definition cellular/common/Class.h:60
virtual Code Disattenuate(Pointer< const physical::Wave > other)
Definition Atom.cpp:329
virtual Code Attenuate(Pointer< const physical::Wave > other)
Definition Atom.cpp:277
virtual Pointer< ::bio::physical::Wave > Demodulate()
Definition chemical/common/Class.h:177
virtual Properties GetProperties() const
Definition chemical/common/Class.h:314
virtual Pointer< ::bio::physical::Wave > Superpose(const ::bio::physical::ConstWaves &displacement, Pointer< ::bio::physical::Interference > pattern)
Definition chemical/common/Class.h:185
Pointer< ::bio::physical::Wave > AsWave()
Definition chemical/common/Class.h:161
virtual Pointer< ::bio::physical::Wave > Modulate(Pointer< ::bio::physical::Wave > signal)
Definition chemical/common/Class.h:173
virtual bool RegisterProperties(const Properties &properties)
Definition chemical/common/Class.h:304
virtual Pointer< ::bio::physical::Wave > Clone() const
Definition chemical/common/Class.h:143
virtual Pointer< Atom > AsAtom()
Definition chemical/common/Class.h:338
void Log(const LogLevel &level=log_level::Info(), const Filter &filter=FilterPerspective::InvalidId())
Definition UnorderedStructureInterface.h:385
virtual Pointer< const Writer > AsLogWriter() const
Definition Writer.cpp:55
Definition FinalCell.h:29
void Delete(Pointer< T > wrapped)
Definition Pointer.h:412