libbio
Loading...
Searching...
No Matches
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
26
27namespace bio {
28
33template < typename ID_TYPE >
34class CachedId :
35 public Cached< ID_TYPE, const Name&, ID_TYPE (physical::Perspective< ID_TYPE >::*)(const Name&) >
36{
37public:
38
44 const Name& lookup,
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 ),
54 {
55 Flush();
56 }
57
61 virtual ~CachedId()
62 {
63
64 }
65
69 virtual void Flush()
70 {
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
90protected:
92};
93
94} //bio namespace
Definition CachedId.h:36
CachedId(const Name &lookup, physical::Perspective< ID_TYPE > &perspective)
Definition CachedId.h:43
virtual ~CachedId()
Definition CachedId.h:61
physical::Perspective< ID_TYPE > & mPerspective
Definition CachedId.h:91
friend::std::ostream & operator<<(std::ostream &out, const CachedId &t)
Definition CachedId.h:81
virtual void Flush()
Definition CachedId.h:69
Definition Cached.h:38
ID_TYPE(physical::Perspective< ID_TYPE >::*)(const Name &) mLookupFunction
Definition Cached.h:95
Definition Pointer.h:115
Definition String.h:55
T mT
Definition TransparentWrapper.h:150
Definition FinalCell.h:29