NEST  2.6.0,not_revisioned_source_dir@0
namedatum.h
Go to the documentation of this file.
1 /*
2  * namedatum.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 NAMEDATUM_H
24 #define NAMEDATUM_H
25 /*
26  Defines Datum classes which are derived from Names:
27  class NameDatum;
28  class LiteralDatum;
29  class BoolDatum;
30 */
31 
32 // Include all headers, needed to use token and datum objects
33 #include <typeinfo>
34 
35 // <string> MUST be included before any STL header, since there are
36 // some conflicts between this and the g++-2.7.2 STL version
37 
38 #include <string>
39 #include "name.h"
40 #include "aggregatedatum.h"
41 #include "interpret.h"
42 #include "config.h"
43 
44 /* These are declarations to specialize the static memory pool BEFORE
45  we instantiate the AggregateDatum. Note, that this is only a declaration,
46  because we do not provide an initializer (see ISO14882 Sec. 14.7.3.15.)
47  The definition is given in the *.CC file with the appropriate
48  initializer.
49 
50  Note that SUN's Forte 6.2 and 7 does not handle this correctly,
51  so we have to use a compiler-switch. 11/2002 Gewaltig
52 
53  The Alpha cxx V6.3-002 says that storage class extern is not allowed here,
54  so I removed it. 15.2.2002 Diesmann
55 */
56 #ifndef HAVE_STATIC_TEMPLATE_DECLARATION_FAILS
57 template<>
59 
60 template<>
62 #endif
63 
64 
65 
66 class NameDatum: public AggregateDatum<Name,&SLIInterpreter::Nametype>
67 {
68  Datum * clone(void) const
69  {
70  return new NameDatum(*this);
71  }
72 
74  {
76  return this;
77  }
78 
79 public:
80  NameDatum(const Name &n):
81  AggregateDatum<Name,&SLIInterpreter::Nametype>(n)
82  {set_executable();}
84  AggregateDatum<Name,&SLIInterpreter::Nametype>(n) {}
86  {set_executable();}
87 
88 };
89 
90 class LiteralDatum: public AggregateDatum<Name,&SLIInterpreter::Literaltype>
91 {
92  Datum * clone(void) const
93  {
94  return new LiteralDatum(*this);
95  }
96 
98  {
100  return this;
101  }
102 public:
103  LiteralDatum(const Name &n):
104  AggregateDatum<Name,&SLIInterpreter::Literaltype>(n)
105  {set_executable();}
107  AggregateDatum<Name,&SLIInterpreter::Literaltype>(n)
108  {set_executable();}
110  {}
111  void pprint(std::ostream &) const;
112 
113 };
114 
115 #endif
void set_executable()
Definition: datum.h:113
Definition: namedatum.h:66
Represent strings by ints to facilitate fast comparison.
Definition: name.h:53
LiteralDatum(const Name &n)
Definition: namedatum.h:103
void addReference() const
Definition: datum.h:91
Definition: aggregatedatum.h:53
NameDatum(const NameDatum &n)
Definition: namedatum.h:83
Datum * get_ptr()
Returns a reference counted pointer to the datum, or a new pointer, if the type does not support refe...
Definition: namedatum.h:97
void pprint(std::ostream &) const
Definition: literaldatum.cc:25
Datum * clone(void) const
Virtual copy constructor.
Definition: namedatum.h:92
Definition: interpret.h:69
~NameDatum()
Definition: namedatum.h:85
NameDatum(const Name &n)
Definition: namedatum.h:80
~LiteralDatum()
Definition: namedatum.h:109
Definition: namedatum.h:90
const Name n("n")
Number of synaptic release sites (int >=0) (Tsodyks2_connection)
Definition: nest_names.h:202
Datum * get_ptr()
Returns a reference counted pointer to the datum, or a new pointer, if the type does not support refe...
Definition: namedatum.h:73
pool is a specialized allocator class for many identical small objects.
Definition: allocator.h:50
Definition: datum.h:33
LiteralDatum(const LiteralDatum &n)
Definition: namedatum.h:106
Datum * clone(void) const
Virtual copy constructor.
Definition: namedatum.h:68