summaryrefslogtreecommitdiff
path: root/src/container.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/container.h')
-rw-r--r--src/container.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/container.h b/src/container.h
new file mode 100644
index 0000000..d9eeffd
--- /dev/null
+++ b/src/container.h
@@ -0,0 +1,46 @@
1#ifndef NEURAL_CONTAINER_H
2#define NEURAL_CONTAINER_H
3
4#include "neural/node.h"
5#include <bu/list.h>
6
7namespace Neural
8{
9 template<typename sigtype>
10 class Container : public Node<sigtype>
11 {
12 public:
13 typedef Bu::List<Neural::Node<sigtype> *> NodeList;
14
15 Container()
16 {
17 }
18
19 virtual ~Container()
20 {
21 for( typename NodeList::iterator i = lNodes.begin(); i; i++ )
22 delete *i;
23 }
24
25 virtual void addNode( Node<sigtype> *pNode )
26 {
27 lNodes.append( pNode );
28 }
29
30 virtual const NodeList &getNodeList() const
31 {
32 return lNodes;
33 }
34
35 protected:
36 virtual NodeList &getNodeList()
37 {
38 return lNodes;
39 }
40
41 private:
42 NodeList lNodes;
43 };
44};
45
46#endif