NEST  2.6.0,not_revisioned_source_dir@0
recordables_map.h
Go to the documentation of this file.
1 /*
2  * recordables_map.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 RECORDABLES_MAP_H
24 #define RECORDABLES_MAP_H
25 
26 #include <map>
27 #include <utility>
28 #include <cassert>
29 #include <string>
30 #include "name.h"
31 #include "nest.h"
32 #include "arraydatum.h"
33 
34 namespace nest
35 {
57  template <typename HostNode>
59  : public std::map<Name, double_t (HostNode::*)() const>
60  {
61  typedef std::map<Name, double_t (HostNode::*)() const> Base_;
62 
63  public:
64  virtual ~RecordablesMap() {}
65 
67  typedef double_t (HostNode::*DataAccessFct)() const;
68 
75  void create();
76 
84  ArrayDatum get_list() const {
86  for ( typename Base_::const_iterator it = this->begin() ;
87  it != this->end() ; ++it )
88  recordables.push_back(new LiteralDatum(it->first));
89  return recordables;
90 
91  // the entire function should just be
92  // return recordables_;
93  }
94 
95  private:
96 
98  void insert_(const Name& n, const DataAccessFct f)
99  {
100  Base_::insert(std::make_pair(n, f));
101 
102  // Line below leads to seg-fault if nest is quit right after start,
103  // see comment on get_list()
104  // recordables_.push_back(LiteralDatum(n));
105  }
106 
113  // ArrayDatum recordables_;
114  };
115 
116 
117  template <typename HostNode>
119  { assert(false); }
120 
121 
122 }
123 
124 #endif
125 
const Name recordables("recordables")
List of recordable state data (Device parameters)
Definition: nest_names.h:244
void push_back(const Token &t)
Definition: tokenarray.h:236
Represent strings by ints to facilitate fast comparison.
Definition: name.h:53
double_t(HostNode::* DataAccessFct)() const
Datatype for access functions.
Definition: recordables_map.h:67
assert(pNet!=0)
Map names of recordables to data access functions.
Definition: recordables_map.h:58
virtual ~RecordablesMap()
Definition: recordables_map.h:64
double double_t
Double precision floating point numbers.
Definition: nest.h:93
Definition: namedatum.h:90
const Name n("n")
Number of synaptic release sites (int >=0) (Tsodyks2_connection)
Definition: nest_names.h:202
std::map< Name, double_t(HostNode::*)() const > Base_
Definition: recordables_map.h:61
Default types used by the NEST kernel.
void insert_(const Name &n, const DataAccessFct f)
Insertion functions to be used in create(), adds entry to map and list.
Definition: recordables_map.h:98
ArrayDatum get_list() const
Obtain SLI list of all recordables, for use by get_status().
Definition: recordables_map.h:84
void create()
Create the map.
Definition: recordables_map.h:118