File: agent-list.h

package info (click to toggle)
ns2 2.35%2Bdfsg-2.1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 78,780 kB
  • ctags: 27,490
  • sloc: cpp: 172,923; tcl: 107,130; perl: 6,391; sh: 6,143; ansic: 5,846; makefile: 816; awk: 525; csh: 355
file content (39 lines) | stat: -rw-r--r-- 760 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Satish Kumar, kkumar@isi.edu

#ifndef agent_list_h_
#define agent_list_h_

#include <cstdlib>
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <iomanip.h>
#include <assert.h>
#include <tclcl.h>
#include <trace.h>
#include <rng.h>
#include <agent.h>

class AgentList : public TclObject {
public:
  AgentList() {
    agents_ = NULL;
    num_agents_ = 0;
  }

  virtual int command(int argc, const char * const * argv);
  static AgentList* instance() {assert(instance_); return instance_; }
  void AddAgent(nsaddr_t node_addr, void *a);
  void* GetAgent(nsaddr_t node_addr) {
    assert(num_agents_ > node_addr);
    return(agents_[node_addr]);
  }
  
private:
  void **agents_;
  int num_agents_;
  static AgentList* instance_;
};


#endif