libbio
Loading...
Searching...
No Matches
inc
bio
physical
cache
CachedId.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/physical/relativity/Perspective.h
"
25
#include "
bio/common/cache/Cached.h
"
26
27
namespace
bio
{
28
33
template
<
typename
ID_TYPE >
34
class
CachedId
:
35
public
Cached
< ID_TYPE, const Name&, ID_TYPE (physical::Perspective< ID_TYPE >::*)(const Name&) >
36
{
37
public
:
38
43
CachedId
(
44
const
Name
&
lookup
,
45
physical::Perspective< ID_TYPE >
&
perspective
46
)
47
:
48
Cached
<
ID_TYPE
,
const
Name
&,
ID_TYPE
(physical::Perspective<
ID_TYPE
>::*)(
const
Name
&) >(
49
lookup
,
50
0,
51
&physical::Perspective<
ID_TYPE
>::GetIdFromName
52
),
53
mPerspective
(
perspective
)
54
{
55
Flush
();
56
}
57
61
virtual
~CachedId
()
62
{
63
64
}
65
69
virtual
void
Flush
()
70
{
71
this->
mT
= ((*
SafelyAccess< physical::Perspective< ID_TYPE >
>(&this->
mPerspective
))->*(this->
mLookupFunction
))(this->
mLookup
);
72
}
73
81
friend ::std::ostream&
operator<<
(
82
std::ostream&
out
,
83
const
CachedId
&
t
84
)
85
{
86
out
<<
t
.mT;
87
return
out
;
88
}
89
90
protected
:
91
physical::Perspective< ID_TYPE >
&
mPerspective
;
92
};
93
94
}
//bio namespace
Cached.h
Perspective.h
bio::CachedId
Definition
CachedId.h:36
bio::CachedId::CachedId
CachedId(const Name &lookup, physical::Perspective< ID_TYPE > &perspective)
Definition
CachedId.h:43
bio::CachedId::~CachedId
virtual ~CachedId()
Definition
CachedId.h:61
bio::CachedId::mPerspective
physical::Perspective< ID_TYPE > & mPerspective
Definition
CachedId.h:91
bio::CachedId::operator<<
friend::std::ostream & operator<<(std::ostream &out, const CachedId &t)
Definition
CachedId.h:81
bio::CachedId::Flush
virtual void Flush()
Definition
CachedId.h:69
bio::Cached
Definition
Cached.h:38
bio::Cached< ID_TYPE, const Name &, ID_TYPE(physical::Perspective< ID_TYPE >::*)(const Name &) >::mLookupFunction
ID_TYPE(physical::Perspective< ID_TYPE >::*)(const Name &) mLookupFunction
Definition
Cached.h:95
bio::Cached< ID_TYPE, const Name &, ID_TYPE(physical::Perspective< ID_TYPE >::*)(const Name &) >::mLookup
const Name & mLookup
Definition
Cached.h:94
bio::Pointer
Definition
Pointer.h:115
bio::String
Definition
String.h:55
bio::TransparentWrapper::mT
T mT
Definition
TransparentWrapper.h:150
bio::physical::Perspective< ID_TYPE >
bio
Definition
FinalCell.h:29
Generated by
1.9.8