LIBINT  2.1.0-stable
contractable.h
1 /*
2  * This file is a part of Libint.
3  * Copyright (C) 2004-2014 Edward F. Valeev
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see http://www.gnu.org/licenses/.
17  *
18  */
19 
20 #ifndef _libint2_src_bin_libint_contract_h_
21 #define _libint2_src_bin_libint_contract_h_
22 
23 namespace libint2 {
24 
26  template <typename Derived> class Contractable {
27  public:
28  Contractable() : value_(default_value_) {}
29  Contractable(const Contractable& source) : value_(source.value_) {}
30  Contractable& operator=(const Contractable& source) {
31  value_ = source.value_;
32  return *this;
33  }
34  bool contracted() const { return value_; }
35  void uncontract() { value_ = false; }
36  void contract() { value_ = true; }
37  static void set_contracted_default_value(bool dv) { default_value_ = dv; }
38  private:
39  bool value_;
40  static bool default_value_;
41  };
42  template <typename Derived>
44 
45 };
46 
47 #endif
use this as a base to add to Derived a "contracted()" attribute
Definition: contractable.h:26
Defaults definitions for various parameters assumed by Libint.
Definition: algebra.cc:23