RINASim  October 2016
Documentation of framework for OMNeT++
RMTModuleAllocator.h
Go to the documentation of this file.
1 // The MIT License (MIT)
2 //
3 // Copyright (c) 2014-2016 Brno University of Technology, PRISTINE project
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 // THE SOFTWARE.
22 
23 #ifndef __RINA_RMTMODULEALLOCATOR_H_
24 #define __RINA_RMTMODULEALLOCATOR_H_
25 
26 #include <omnetpp.h>
27 
28 #include "Utils.h"
29 #include "ExternConsts.h"
30 #include "RMTQueue.h"
31 #include "RMTPort.h"
32 #include "RMTQMonitorBase.h"
33 #include "IntSDUProtection.h"
34 
35 
36 class RMTQMonitorBase; /* FIXME: circular dependency */
37 
42 class RMTModuleAllocator : public cSimpleModule
43 {
44  public:
45 
52  RMTPort* addPort(Flow* flow);
53 
62  RMTQueue* addQueue(RMTQueueType type, RMTPort* port, const char* queueId = "0");
63 
69  void removePort(RMTPort* port);
70 
76  void removeQueue(RMTQueue* queue);
77 
83  void removeQueues(RMTQueues& queues);
84 
92 
99  RMTPort* getPort(const char* name);
100 
107 
108  protected:
109  virtual void initialize();
110  virtual void handleMessage(cMessage *msg) {};
111 
112  private:
115  std::map<RMTQueue*, RMTPort*> queueToPort;
116 
117  RMTQueue* lookup(RMTPort* port, RMTQueueType type, const char* queueName);
118 
119  // TODO: purge this crap and think of a smarter way of positioning modules
120  unsigned int portCount;
121  std::map<RMTPort*, unsigned int> portQueueCount;
122  unsigned int portXCoord, portYCoord;
123 };
124 
125 #endif
void removeQueues(RMTQueues &queues)
Class representing flow object with attributes from specs.
Definition: Flow.h:45
virtual void initialize()
RMTQueue * lookup(RMTPort *port, RMTQueueType type, const char *queueName)
std::map< RMTPort *, unsigned int > portQueueCount
RMTPort * getQueueToPortMapping(RMTQueue *queue)
RMTPort * addPort(Flow *flow)
RMTPort * getPort(const char *name)
RMTQueue * addQueue(RMTQueueType type, RMTPort *port, const char *queueId="0")
void removePort(RMTPort *port)
void removeQueue(RMTQueue *queue)
virtual void handleMessage(cMessage *msg)
std::map< RMTQueue *, RMTPort * > queueToPort
RMTQMonitorBase * qMonPolicy
std::vector< RMTQueue * > RMTQueues
Definition: RMTQueue.h:180