21 #include "repository.h"
28 Repository::GetTypeId (
void)
30 static TypeId tid = TypeId (
"ns3::Repository")
32 .AddConstructor<Repository> ()
39 Repository::Repository() {
43 for (
int i=0; i<MAX_NODES; i++) {
44 int channel=GetRandomChannel();
45 m_repositoryTable[i].rxChannel= channel;
48 for (
int i=0; i<5; i++) {
49 sprintf(mystring,
"node %i got channel %i",i, m_repositoryTable[i].rxChannel);
54 for (
int node=0; node<MAX_NODES; node++)
55 for (
int channel=0; channel< MAX_CHANNELS; channel++)
56 m_repositoryTableSender[node][channel].active=
false;
67 Repository::GetRxChannel(
int node) {
69 return m_repositoryTable[node].rxChannel;
78 Repository::SetRxChannel(
int node,
int channel) {
80 m_repositoryTable[node].rxChannel=channel;
87 Repository::UpdateTxChannel(
int node,
int channel,
double time) {
89 if (node < MAX_NODES) {
91 m_repositoryTableSender[node][channel].active=
true;
92 m_repositoryTableSender[node][channel].time=time;
100 Repository::GetRandomChannel() {
101 Ptr<UniformRandomVariable> uv = CreateObject<UniformRandomVariable>();
102 uv->SetAttribute (
"Min", DoubleValue (1));
103 uv->SetAttribute (
"Max", DoubleValue (MAX_CHANNELS));
104 int channel=uv->GetInteger();
105 if (channel >= MAX_CHANNELS)
106 channel = MAX_CHANNELS-1;
#define NS_LOG_FUNCTION(parameters)
#define NS_LOG_COMPONENT_DEFINE(name)
#define NS_LOG_DEBUG(msg)