NEST  2.6.0,not_revisioned_source_dir@0
sibling_container.h
Go to the documentation of this file.
1 /*
2  * sibling_container.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 SIBLING_CONTAINER_H
24 #define SIBLING_CONTAINER_H
25 
26 #include <vector>
27 #include <string>
28 #include "node.h"
29 #include "dictdatum.h"
30 
31 namespace nest{
32 
33  using std::vector;
34 
35  class Node;
36  class Network;
37  class Scheduler;
38 
46  class SiblingContainer: public Node
47  {
48  friend class Network;
49  friend class Scheduler;
50  friend class Subnet;
51 
52  public:
53 
55 
57 
58  virtual ~SiblingContainer(){}
59 
60  void set_status(const DictionaryDatum&) { assert(false); }
61  void get_status(DictionaryDatum&) const { assert(false); }
62 
63  bool is_subnet() const;
64 
65  bool has_proxies() const;
66 
67  bool empty() const;
68  void reserve(size_t);
69 
70  void push_back(Node*);
71 
75  vector<Node*>::iterator begin();
76 
80  vector<Node*>::iterator end();
81 
85  vector<Node*>::const_iterator begin() const;
86 
90  vector<Node*>::const_iterator end() const;
91 
92  protected:
93  size_t num_thread_siblings_() const;
96  void init_node_(const Node&) {}
97  void init_state_(const Node&) {}
98  void init_buffers_() {}
99 
100  void calibrate() {}
101  void update(Time const &, const long_t, const long_t) {}
102 
110  vector<Node *> nodes_;
111  };
112 
113 
114  inline
116  {
117  nodes_.push_back(n);
118  }
119 
120  inline
122  {
123  return nodes_.at(i); //with range check
124  }
125 
126  inline
128  {
129  return nodes_[i]; //without range check
130  }
131 
132  inline
133  vector<Node*>::iterator SiblingContainer::begin()
134  {
135  return nodes_.begin();
136  }
137 
138  inline
139  vector<Node*>::iterator SiblingContainer::end()
140  {
141  return nodes_.end();
142  }
143 
144  inline
145  vector<Node*>::const_iterator SiblingContainer::begin() const
146  {
147  return nodes_.begin();
148  }
149 
150  inline
151  vector<Node*>::const_iterator SiblingContainer::end() const
152  {
153  return nodes_.end();
154  }
155 
156  inline
158  {
159  return nodes_.empty();
160  }
161 
162  inline
164  {
165  return nodes_.size();
166  }
167 
168  inline
170  {
171  nodes_.reserve(n);
172  }
173 
174  inline
176  {
177  return false;
178  }
179 
180  inline
182  {
183  return empty() ? false : nodes_[0]->is_subnet();
184  }
185 
186 } // namespace
187 
188 #endif
size_t num_thread_siblings_() const
Return the number of thread siblings in SiblingContainer.
Definition: sibling_container.h:163
size_t index
Unsigned long type for enumerations.
Definition: nest.h:109
virtual ~SiblingContainer()
Definition: sibling_container.h:58
void init_node_(const Node &)
Definition: sibling_container.h:96
SiblingContainer class.
Definition: sibling_container.h:46
Node * get_thread_sibling_(index) const
Return the specified member of a SiblingContainer.
Definition: sibling_container.h:127
Base class for all subnet nodes.
Definition: subnet.h:67
bool is_subnet() const
Definition: sibling_container.h:181
Declarations for base class Node.
SiblingContainer()
Definition: sibling_container.cpp:35
void get_status(DictionaryDatum &) const
Definition: sibling_container.h:61
bool empty() const
Definition: sibling_container.h:157
bool has_proxies() const
Returns true if the node has proxies on remote threads.
Definition: sibling_container.h:175
assert(pNet!=0)
Definition: nest_time.h:130
vector< Node * >::iterator begin()
Return iterator to the first child node.
Definition: sibling_container.h:133
void init_state_(const Node &)
Private function to initialize the state of a node to model defaults.
Definition: sibling_container.h:97
void set_status(const DictionaryDatum &)
Definition: sibling_container.h:60
Main administrative interface to the network.
Definition: network.h:135
void calibrate()
Re-calculate dependent parameters of the node.
Definition: sibling_container.h:100
void push_back(Node *)
Definition: sibling_container.h:115
void update(Time const &, const long_t, const long_t)
Bring the node from state $t$ to $t+n*dt$.
Definition: sibling_container.h:101
const Name n("n")
Number of synaptic release sites (int >=0) (Tsodyks2_connection)
Definition: nest_names.h:202
vector< Node * >::iterator end()
Return iterator to the end of the child-list.
Definition: sibling_container.h:139
Node * get_thread_sibling_safe_(index) const
Return specified member of a SiblingContainer, with access control.
Definition: sibling_container.h:121
Base class for all NEST network objects.
Definition: node.h:96
void init_buffers_()
Private function to initialize the buffers of a node.
Definition: sibling_container.h:98
Schedule update of Nodes and Events during simulation.
Definition: scheduler.h:66
vector< Node * > nodes_
Pointer to child nodes.
Definition: sibling_container.h:110
long long_t
Integer number with at least 32 bit.
Definition: nest.h:96
void reserve(size_t)
Definition: sibling_container.h:169