suanPan
Bead.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright (C) 2017-2024 Theodore Chang
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  ******************************************************************************/
26 #ifndef BEAD_H
27 #define BEAD_H
28 
29 #include <Domain/Storage.hpp>
30 
31 class DomainBase;
32 
33 class Bead {
34  unsigned current_domain_tag = 1;
35 
36  DomainBaseStorage domain_pool;
37 
38 public:
39  Bead();
40 
41  bool insert(const shared_ptr<DomainBase>&);
42  void erase_domain(unsigned);
43  void enable_domain(unsigned);
44  void disable_domain(unsigned);
45 
46  void set_current_domain_tag(unsigned);
47  unsigned get_current_domain_tag() const;
48 
49  const shared_ptr<DomainBase>& get_domain(unsigned) const;
50  const shared_ptr<DomainBase>& get_current_domain() const;
51 
52  friend shared_ptr<DomainBase>& get_domain(const shared_ptr<Bead>&, unsigned);
53  friend shared_ptr<DomainBase>& get_current_domain(const shared_ptr<Bead>&);
54 
55  int precheck();
56 
57  int analyze();
58 };
59 
60 #endif
A Bead class is a top level container.
Definition: Bead.h:33
int analyze()
Definition: Bead.cpp:70
void erase_domain(unsigned)
Definition: Bead.cpp:26
void enable_domain(unsigned)
Definition: Bead.cpp:43
unsigned get_current_domain_tag() const
Definition: Bead.cpp:49
int precheck()
Definition: Bead.cpp:55
bool insert(const shared_ptr< DomainBase > &)
Definition: Bead.cpp:24
void disable_domain(unsigned)
Definition: Bead.cpp:45
const shared_ptr< DomainBase > & get_current_domain() const
Definition: Bead.cpp:53
Bead()
Definition: Bead.cpp:22
const shared_ptr< DomainBase > & get_domain(unsigned) const
Definition: Bead.cpp:51
void set_current_domain_tag(unsigned)
Definition: Bead.cpp:47
The DomainBase class is a template.
Definition: DomainBase.h:104