NEST  2.6.0,not_revisioned_source_dir@0
booldatum.h
Go to the documentation of this file.
1 /*
2  * booldatum.h
3  *
4  * This file is part of NEST.
5  *
6  * Copyright (C) 2004 The NEST Initiative
7  *
8  * NEST is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * NEST 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 General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with NEST. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef BOOLDATUM_H
24 #define BOOLDATUM_H
25 
26 #include <string>
27 #include "genericdatum.h"
28 #include "allocator.h"
29 #include "interpret.h"
30 
31 
32 class Name;
33 class Token;
34 
35 class BoolDatum: public GenericDatum<bool,&SLIInterpreter::Booltype>
36 {
37  protected:
38  static sli::pool memory;
39 
40  private:
41  Datum *clone(void) const
42  {
43  return new BoolDatum(*this);
44  }
45 
46 public:
47  static const char* true_string;
48  static const char* false_string;
49 
50  BoolDatum(): GenericDatum<bool,&SLIInterpreter::Booltype>(){}
51  BoolDatum(const BoolDatum& val):GenericDatum<bool,&SLIInterpreter::Booltype>(val){}
52  BoolDatum(bool val):GenericDatum<bool,&SLIInterpreter::Booltype>(val){}
53  BoolDatum(const Name&);
54 
55  operator bool() const
56  { return d; }
57 
58  operator Name() const;
59 
60  operator std::string() const;
61 
62  void input_form(std::ostream &) const;
63  void print(std::ostream &) const;
64  void pprint(std::ostream &) const;
65 
66  static void * operator new(size_t size);
67 
68  static void operator delete(void *p, size_t size);
69 
70 };
71 
72 #endif
void print(std::ostream &) const
Definition: booldatum.cc:57
BoolDatum(const BoolDatum &val)
Definition: booldatum.h:51
Definition: genericdatum.h:35
BoolDatum(bool val)
Definition: booldatum.h:52
void pprint(std::ostream &) const
Definition: booldatum.cc:52
Datum * clone(void) const
Virtual copy constructor.
Definition: booldatum.h:41
BoolDatum()
Definition: booldatum.h:50
Represent strings by ints to facilitate fast comparison.
Definition: name.h:53
bool d
Definition: genericdatum.h:44
static sli::pool memory
Definition: booldatum.h:38
Definition: interpret.h:69
static const char * false_string
Definition: booldatum.h:48
Definition: booldatum.h:35
pool is a specialized allocator class for many identical small objects.
Definition: allocator.h:50
Definition: datum.h:33
A type-independent container for C++-types.
Definition: token.h:68
const Name p("p")
current release probability (Tsodyks2_connection)
Definition: nest_names.h:218
void input_form(std::ostream &) const
Definition: booldatum.cc:47
static const char * true_string
Definition: booldatum.h:47