A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
repository.h
1 // Switchable Interface Implementation START
2 // @author: Marco Di Felice
3 
4 #ifndef repository_H
5 #define repository_H
6 
7 
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <string.h>
11 #include "common-cognitive-header.h"
12 #include "ns3/object.h"
13 #include "ns3/core-module.h"
14 #include "ns3/tag.h"
15 #include "ns3/log.h"
16 
17 
18 namespace ns3 {
19 
20 // Channel Entry for receiver nodes
22  // receiving channel
23  int rxChannel;
24 };
25 
26 
27 
28 // Channel Entry for sender nodes
30  //Flag indicating wheter the channel is used for transmitting
31  bool active;
32  //Last time the channel was used
33  double time;
34 };
35 
36 
37 
38 // Cross-Layer Repository class
39 class Repository : public Object
40 {
41 
42 public:
43  static TypeId GetTypeId (void);
44  // Initializer
45  Repository();
46 
47  // Set/Get Function for the Receiver Channel Table
48  int GetRxChannel(int node);
49  void SetRxChannel(int node, int channel);
50 
51  // Set/Get Function for the Sender Channel Table
52  void UpdateTxChannel(int node, int channel, double time);
53 
54 
55 private:
56 
57  // Receiver Channel table: m_repositoryTable[i] contains the channels used for receiving by node i
58  RepositoryEntryRecv m_repositoryTable[MAX_NODES];
59  // Sender Channel table: repository_table_sender[i][j] contains the information (active/time) for sending node i and channel j
60  RepositoryEntrySend m_repositoryTableSender[MAX_NODES][MAX_CHANNELS];
61  // Returns a random channel between 1 and MAX_CHANNELS
62  int GetRandomChannel();
63 
64 };
65 
66 // Switchable Interface Implementation END
67 }
68 #endif
69 
Definition: repository.h:29
Definition: repository.h:21
a base class which provides memory management and object aggregation
Definition: object.h:63
a unique identifier for an interface.
Definition: type-id.h:44