libbio
Loading...
Searching...
No Matches
DependentMotif.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 "LinearMotif.h"
27
28namespace bio {
29namespace chemical {
30
40template < typename CONTENT_TYPE, typename ENVIRONMENT >
42 public chemical::Class< DependentMotif< CONTENT_TYPE, ENVIRONMENT > >,
43 public LinearMotif< CONTENT_TYPE >,
44 public EnvironmentDependent< ENVIRONMENT >
45{
46private:
49
50 void BondLinearMotif()
51 {
52 const AtomicNumber bondedId = Atom::GetBondId< LinearMotif< CONTENT_TYPE > >();
53 BIO_SANITIZE(bondedId, , return)
54 if (this->GetBondPosition(bondedId))
55 {
56 return;
57 }
60 }
61
62public:
70 {
72 }
77
83 )
84 :
88 {
89 BondLinearMotif();
90
91 }
92
100 )
101 :
105 {
106 BondLinearMotif();
107
108 }
109
124
129 {
130
131 }
132
139 {
141 // lazy-NULL backing store (LinearMotif defers allocation to first write):
142 // no contents to propagate the environment into.
143 BIO_SANITIZE_AT_SAFETY_LEVEL_1(!this->mContents.IsNull(), , return)
144 for (
145 SmartIterator cnt = this->mContents.Mutable()->End();
146 !cnt.IsBeforeBeginning();
147 --cnt
148 )
149 {
151 }
152 }
153
154
169
198};
199} //chemical namespace
200} //bio namespace
#define BIO_DISAMBIGUATE_REQUIRED_CLASS_METHODS(ns, caller)
Definition ClassMethodMacros.h:73
#define BIO_DISAMBIGUATE_OPTIONAL_CLASS_METHODS(ns, caller)
Definition ClassMethodMacros.h:93
#define BIO_SANITIZE_AT_SAFETY_LEVEL_1(test, success, failure)
Definition SanitizeMacros.h:55
#define BIO_SANITIZE(test, success, failure)
Definition SanitizeMacros.h:94
Definition Pointer.h:115
Definition SmartIterator.h:40
CowPtr< Container > mContents
Definition AbstractMotif.h:236
virtual Valence FormBondImplementation(Pointer< physical::Wave > toBond, AtomicNumber id, BondType type)
Definition Atom.cpp:438
Valence GetBondPosition() const
Definition Atom.h:518
Definition chemical/common/Class.h:52
Pointer< ::bio::physical::Wave > AsWave()
Definition chemical/common/Class.h:161
Definition DependentMotif.h:45
DependentMotif(const typename LinearMotif< CONTENT_TYPE >::Contents *contents, EnvironmentPointer environment=NULL)
Definition DependentMotif.h:97
DependentMotif(const DependentMotif< CONTENT_TYPE, ENVIRONMENT > &toCopy)
Definition DependentMotif.h:115
DependentMotif(EnvironmentPointer environment=NULL)
Definition DependentMotif.h:81
virtual ~DependentMotif()
Definition DependentMotif.h:128
virtual Code InsertImplementation(ContentPointer toAdd, const Position position=BOTTOM, const Id optionalPositionArg=0, const bool transferSubContents=false)
Definition DependentMotif.h:183
virtual Code Attenuate(Pointer< const physical::Wave > other)
Definition DependentMotif.h:69
virtual void SetEnvironment(EnvironmentPointer environment)
Definition DependentMotif.h:138
virtual ContentPointer AddImplementation(ContentPointer content)
Definition DependentMotif.h:161
virtual Code Disattenuate(Pointer< const physical::Wave > other)
Definition DependentMotif.h:73
Definition EnvironmentDependent.h:43
virtual EnvironmentPointer GetEnvironment()
Definition EnvironmentDependent.h:70
virtual void SetEnvironment(EnvironmentPointer environment)
Definition EnvironmentDependent.h:88
Definition LinearMotif.h:133
virtual Code Attenuate(Pointer< const physical::Wave > other)
Definition LinearMotif.h:1043
virtual Code InsertImplementation(ContentPointer toAdd, const Position position=BOTTOM, const Id optionalPositionArg=0, const bool transferSubContents=false)
Definition LinearMotif.h:620
virtual ContentPointer AddImplementation(ContentPointer content)
Definition LinearMotif.h:408
virtual Code Disattenuate(Pointer< const physical::Wave > other)
Definition LinearMotif.h:1075
Definition Line.h:46
Definition Wave.h:82
Wave(Pointer< Symmetry > symmetry=NULL)
Definition Wave.cpp:102
#define BIO_SINGLE_ARG(...)
Definition common/macro/Macros.h:68
BondType Virtual()
Code MissingArgument1()
Definition FinalCell.h:29
Position
Definition chemical/common/Types.h:59
@ BOTTOM
Definition chemical/common/Types.h:61