NEST  2.6.0,not_revisioned_source_dir@0
topologymodule.h
Go to the documentation of this file.
1 /*
2  * topologymodule.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 TOPOLOGYMODULE_H
24 #define TOPOLOGYMODULE_H
25 
26 #include "slimodule.h"
27 #include "network.h"
28 #include "position.h"
29 #include "ntree.h"
30 #include "exceptions.h"
31 #include "generic_factory.h"
32 
33 namespace nest
34 {
35  class Parameter;
36  class AbstractMask;
37  class AbstractLayer;
38 
39  template<int D>
40  class Layer;
41 
42  class TopologyModule: public SLIModule
43  {
44  public:
45 
48 
53  void init(SLIInterpreter*);
54 
55  const std::string name(void) const;
56  const std::string commandstring(void) const;
57 
58  static SLIType MaskType;
60 
61  /*
62  * SLI functions: See source file for documentation
63  */
64 
66  {
67  public:
68  void execute(SLIInterpreter *) const;
70 
72  {
73  public:
74  void execute(SLIInterpreter *) const;
76 
78  {
79  public:
80  void execute(SLIInterpreter *) const;
82 
84  {
85  public:
86  void execute(SLIInterpreter *) const;
88 
90  {
91  public:
92  void execute(SLIInterpreter *) const;
94 
96  {
97  public:
98  void execute(SLIInterpreter *) const;
100 
102  {
103  public:
104  void execute(SLIInterpreter *) const;
106 
108  {
109  public:
110  void execute(SLIInterpreter *) const;
112 
114  {
115  public:
116  void execute(SLIInterpreter *) const;
117  } and_M_Mfunction;
118 
120  {
121  public:
122  void execute(SLIInterpreter *) const;
123  } or_M_Mfunction;
124 
126  {
127  public:
128  void execute(SLIInterpreter *) const;
129  } sub_M_Mfunction;
130 
132  {
133  public:
134  void execute(SLIInterpreter *) const;
135  } mul_P_Pfunction;
136 
138  {
139  public:
140  void execute(SLIInterpreter *) const;
141  } div_P_Pfunction;
142 
144  {
145  public:
146  void execute(SLIInterpreter *) const;
147  } add_P_Pfunction;
148 
150  {
151  public:
152  void execute(SLIInterpreter *) const;
153  } sub_P_Pfunction;
154 
156  {
157  public:
158  void execute(SLIInterpreter *) const;
160 
162  {
163  public:
164  void execute(SLIInterpreter *) const;
166 
168  {
169  public:
170  void execute(SLIInterpreter *) const;
172 
174  {
175  public:
176  void execute(SLIInterpreter *) const;
178 
180  {
181  public:
182  void execute(SLIInterpreter *) const;
184 
186  {
187  public:
188  void execute(SLIInterpreter *) const;
190 
194  static Network &get_network();
195 
198 
205  template<class T>
206  static bool register_mask();
207 
215  template<class T>
216  static bool register_mask(const Name & name);
217 
229  static bool register_mask(const Name& name, MaskCreatorFunction creator);
230 
240 
247  static AbstractMask *create_mask(const Name& name, const DictionaryDatum &d);
248 
251 
259  template<class T>
260  static bool register_parameter(const Name & name);
261 
273  static bool register_parameter(const Name& name, ParameterCreatorFunction creator);
274 
286 
294  static Parameter *create_parameter(const Name& name, const DictionaryDatum &d);
295 
296  private:
297 
298 
302  static MaskFactory &mask_factory_();
303 
308 
313  static Network* net_;
314  };
315 
322  {
323  public:
325  : KernelException("LayerExpected") {}
326  ~LayerExpected() throw () {}
327 
328  std::string message();
329  };
330 
331  inline
333  {
334  assert(net_ != 0);
335  return *net_;
336  }
337 
338  template<class T>
339  inline
341  {
342  return mask_factory_().register_subtype<T>(T::get_name());
343  }
344 
345  template<class T>
346  inline
348  {
349  return mask_factory_().register_subtype<T>(name);
350  }
351 
352  inline
354  {
355  return mask_factory_().register_subtype(name, creator);
356  }
357 
358  inline
360  {
361  return mask_factory_().create(name,d);
362  }
363 
364  template<class T>
365  inline
367  {
369  }
370 
371  inline
373  {
374  return parameter_factory_().register_subtype(name, creator);
375  }
376 
377 
378 } // namespace nest
379 
380 #endif
void execute(SLIInterpreter *) const
Definition: topologymodule.cpp:694
GenericFactory< AbstractMask >::CreatorFunction MaskCreatorFunction
Definition: topologymodule.h:197
BaseT * create(const Name &name, const DictionaryDatum &d) const
Factory function.
Definition: generic_factory.h:86
nest::TopologyModule::GetGlobalChildren_i_M_aFunction getglobalchildren_i_M_afunction
Definition: topologymodule.h:155
Definition: topologymodule.h:107
void execute(SLIInterpreter *) const
Definition: topologymodule.cpp:627
Exception to be thrown if the wrong argument type is given to a function.
Definition: topologymodule.h:321
const Name d("d")
Specific to Izhikevich 2003.
Definition: nest_names.h:83
void execute(SLIInterpreter *) const
Definition: topologymodule.cpp:987
nest::TopologyModule::CreateMask_DFunction createmask_Dfunction
void execute(SLIInterpreter *) const
Definition: topologymodule.cpp:1139
Definition: topologymodule.h:101
void execute(SLIInterpreter *) const
Definition: topologymodule.cpp:391
GenericFactory< AbstractMask > MaskFactory
Definition: topologymodule.h:196
Definition: topologymodule.h:77
nest::TopologyModule::Distance_a_iFunction distance_a_ifunction
bool register_subtype(const Name &name)
Register a new subtype.
Definition: generic_factory.h:98
nest::TopologyModule::Div_P_PFunction div_P_Pfunction
void execute(SLIInterpreter *) const
Definition: topologymodule.cpp:680
static lockPTRDatum< AbstractMask,&TopologyModule::MaskType > create_mask(const Token &t)
Return a Mask object.
Definition: topologymodule.cpp:88
Definition: slifunction.h:35
nest::TopologyModule::DumpLayerConnections_os_i_lFunction dumplayerconnections_os_i_lfunction
void execute(SLIInterpreter *) const
Definition: topologymodule.cpp:764
~TopologyModule()
Definition: topologymodule.cpp:63
Represent strings by ints to facilitate fast comparison.
Definition: name.h:53
Definition: topologymodule.h:131
TopologyModule(Network &)
Definition: topologymodule.cpp:54
nest::TopologyModule::Sub_M_MFunction sub_M_Mfunction
void execute(SLIInterpreter *) const
Definition: topologymodule.cpp:1250
void execute(SLIInterpreter *) const
Definition: topologymodule.cpp:1195
assert(pNet!=0)
Abstract base class for parameters.
Definition: parameter.h:44
void init(SLIInterpreter *)
Initialize module by registering models with the network.
Definition: topologymodule.cpp:273
nest::TopologyModule::GetElement_i_iaFunction getelement_i_iafunction
Definition: topologymodule.h:65
nest::TopologyModule::ConnectLayers_i_i_DFunction connectlayers_i_i_Dfunction
static lockPTRDatum< Parameter,&TopologyModule::ParameterType > create_parameter(const Token &)
Return a Parameter object.
Definition: topologymodule.cpp:191
static Network & get_network()
Return a reference to the network managed by the topology module.
Definition: topologymodule.h:332
nest::TopologyModule::CreateLayer_DFunction createlayer_Dfunction
static Network * net_
Definition: topologymodule.h:313
void execute(SLIInterpreter *) const
Definition: topologymodule.cpp:582
const std::string name(void) const
Return name of the module.
Definition: topologymodule.cpp:66
Definition: topologymodule.h:149
Base class for all Kernel exceptions.
Definition: exceptions.h:54
void execute(SLIInterpreter *) const
Definition: topologymodule.cpp:779
nest::TopologyModule::And_M_MFunction and_M_Mfunction
static ParameterFactory & parameter_factory_()
Return a reference to the parameter factory class.
Definition: topologymodule.cpp:82
GenericFactory< Parameter > ParameterFactory
Definition: topologymodule.h:249
static SLIType ParameterType
SLI type for parameters.
Definition: topologymodule.h:59
void execute(SLIInterpreter *) const
Definition: topologymodule.cpp:666
Declarations for class Network.
static SLIType MaskType
SLI type for masks.
Definition: topologymodule.h:58
static MaskFactory & mask_factory_()
Return a reference to the mask factory class.
Definition: topologymodule.cpp:76
static bool register_mask()
Register an AbstractMask subclass as a new mask type.
Definition: topologymodule.h:340
Definition: interpret.h:69
void execute(SLIInterpreter *) const
Definition: topologymodule.cpp:722
Main administrative interface to the network.
Definition: network.h:135
void execute(SLIInterpreter *) const
Definition: topologymodule.cpp:513
Definition: slitype.h:49
const std::string commandstring(void) const
Return sli command sequence to be executed for initialisation.
Definition: topologymodule.cpp:71
Definition: topologymodule.h:137
Definition: topologymodule.h:113
nest::TopologyModule::DumpLayerNodes_os_iFunction dumplayernodes_os_ifunction
nest::TopologyModule::Mul_P_PFunction mul_P_Pfunction
void execute(SLIInterpreter *) const
Definition: topologymodule.cpp:736
Definition: topologymodule.h:143
~LayerExpected()
Definition: topologymodule.h:326
nest::TopologyModule::Inside_a_MFunction inside_a_Mfunction
Generic Factory class for objects deriving from a base class BaseT.
Definition: generic_factory.h:43
Definition: topologymodule.h:161
void execute(SLIInterpreter *) const
Definition: topologymodule.cpp:708
void execute(SLIInterpreter *) const
Definition: topologymodule.cpp:1083
Definition: topologymodule.h:185
Definition: topologymodule.h:42
nest::TopologyModule::Sub_P_PFunction sub_P_Pfunction
void execute(SLIInterpreter *) const
Definition: topologymodule.cpp:1303
void execute(SLIInterpreter *) const
Definition: topologymodule.cpp:446
nest::TopologyModule::Displacement_a_iFunction displacement_a_ifunction
GenericFactory< Parameter >::CreatorFunction ParameterCreatorFunction
Definition: topologymodule.h:250
Base class for all SLI Interpreter modules.
Definition: slimodule.h:34
std::string message()
Returns a diagnostic message or empty string.
Definition: topologymodule.cpp:1315
nest::TopologyModule::Add_P_PFunction add_P_Pfunction
Definition: topologymodule.h:125
static bool register_parameter(const Name &name)
Register an Parameter subclass as a new parameter type with the given name.
Definition: topologymodule.h:366
nest::TopologyModule::GetValue_a_PFunction getvalue_a_Pfunction
Abstract base class for masks with unspecified dimension.
Definition: mask.h:41
Definition: topologymodule.h:83
nest::TopologyModule::CreateParameter_DFunction createparameter_Dfunction
nest::TopologyModule::Or_M_MFunction or_M_Mfunction
Definition: topologymodule.h:179
A type-independent container for C++-types.
Definition: token.h:68
Definition: topologymodule.h:119
nest::TopologyModule::Cvdict_MFunction cvdict_Mfunction
void execute(SLIInterpreter *) const
Definition: topologymodule.cpp:750
Definition: topologymodule.h:71
LayerExpected()
Definition: topologymodule.h:324
void execute(SLIInterpreter *) const
Definition: topologymodule.cpp:1042
nest::TopologyModule::GetPosition_iFunction getposition_ifunction