Ginga  0.13.6
 All Classes Namespaces Functions Variables
SwitchNode.h
1 /******************************************************************************
2 Este arquivo eh parte da implementacao do ambiente declarativo do middleware
3 Ginga (Ginga-NCL).
4 
5 Direitos Autorais Reservados (c) 1989-2007 PUC-Rio/Laboratorio TeleMidia
6 
7 Este programa eh software livre; voce pode redistribui-lo e/ou modificah-lo sob
8 os termos da Licenca Publica Geral GNU versao 2 conforme publicada pela Free
9 Software Foundation.
10 
11 Este programa eh distribuido na expectativa de que seja util, porem, SEM
12 NENHUMA GARANTIA; nem mesmo a garantia implicita de COMERCIABILIDADE OU
13 ADEQUACAO A UMA FINALIDADE ESPECIFICA. Consulte a Licenca Publica Geral do
14 GNU versao 2 para mais detalhes.
15 
16 Voce deve ter recebido uma copia da Licenca Publica Geral do GNU versao 2 junto
17 com este programa; se nao, escreva para a Free Software Foundation, Inc., no
18 endereco 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
19 
20 Para maiores informacoes:
21 ncl @ telemidia.puc-rio.br
22 http://www.ncl.org.br
23 http://www.ginga.org.br
24 http://www.telemidia.puc-rio.br
25 ******************************************************************************
26 This file is part of the declarative environment of middleware Ginga (Ginga-NCL)
27 
28 Copyright: 1989-2007 PUC-RIO/LABORATORIO TELEMIDIA, All Rights Reserved.
29 
30 This program is free software; you can redistribute it and/or modify it under
31 the terms of the GNU General Public License version 2 as published by
32 the Free Software Foundation.
33 
34 This program is distributed in the hope that it will be useful, but WITHOUT ANY
35 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
36 PARTICULAR PURPOSE. See the GNU General Public License version 2 for more
37 details.
38 
39 You should have received a copy of the GNU General Public License version 2
40 along with this program; if not, write to the Free Software
41 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
42 
43 For further information contact:
44 ncl @ telemidia.puc-rio.br
45 http://www.ncl.org.br
46 http://www.ginga.org.br
47 http://www.telemidia.puc-rio.br
48 *******************************************************************************/
49 
50 #ifndef _SWITCHNODE_H_
51 #define _SWITCHNODE_H_
52 
53 #include "util/functions.h"
54 using namespace ::br::pucrio::telemidia::util;
55 
56 #include "../components/ContextNode.h"
57 #include "../components/CompositeNode.h"
58 #include "../components/NodeEntity.h"
59 #include "../components/IllegalNodeTypeException.h"
60 using namespace ::br::pucrio::telemidia::ncl::components;
61 
62 #include "../interfaces/Port.h"
63 #include "../interfaces/InterfacePoint.h"
64 #include "../interfaces/SwitchPort.h"
65 using namespace ::br::pucrio::telemidia::ncl::interfaces;
66 
67 #include "Rule.h"
68 #include "DescriptorSwitch.h"
69 #include "SwitchContent.h"
70 
71 #include <vector>
72 #include <string>
73 using namespace std;
74 
75 namespace br {
76 namespace pucrio {
77 namespace telemidia {
78 namespace ncl {
79 namespace switches {
80  class SwitchNode : public CompositeNode {
81  private:
82  Node* defaultNode;
83  vector<Rule*> ruleList;
84 
85  public:
86  SwitchNode(string id);
87  virtual ~SwitchNode();
88  bool addNode(unsigned int index, Node* node, Rule* rule);
89  bool addNode(Node* node, Rule* rule);
90 
91  //virtual from CompositeNode
92  bool addNode(Node* node);
93 
94  bool addSwitchPortMap(SwitchPort* switchPort,
95  Node* node, InterfacePoint* interfacePoint);
96 
97  //virtual from CompositeNode
98  bool addPort(Port* port);
99 
100  //virtual from CompositeNode
101  bool addPort(int index, Port* port);
102 
103  void exchangeNodesAndRules(
104  unsigned int index1, unsigned int index2);
105 
106  Node* getDefaultNode();
107 
108  //virtual from CompositeNode
109  InterfacePoint *getMapInterface(Port *port);
110 
111  //virtual from CompositeNode
112  Node* getNode(string nodeId);
113 
114  Node* getNode(unsigned int index);
115  Node* getNode(Rule* rule);
116  unsigned int getNumRules();
117  Rule* getRule(unsigned int index);
118  unsigned int indexOfRule(Rule* rule);
119 
120  //virtual from CompositeNode
121  bool recursivelyContainsNode(Node* node);
122 
123  //virtual from CompositeNode
124  bool recursivelyContainsNode(string nodeId);
125 
126  //virtual from CompositeNode
127  Node* recursivelyGetNode(string nodeId);
128 
129  //virtual from CompositeNode
130  bool removeNode(Node* node);
131 
132  bool removeNode(unsigned int index);
133  bool removeRule(Rule* rule);
134  void setDefaultNode(Node* node);
135  };
136 }
137 }
138 }
139 }
140 }
141 
142 #endif //_SWITCHNODE_H_