author | Peter D. Barnes, Jr. <barnes26@llnl.gov> |
Wed, 11 Dec 2013 15:18:55 -0800 | |
changeset 10503 | f6b5cea9cd85 |
parent 10221 | 6f82f37b5c76 |
permissions | -rwxr-xr-x |
7497
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
1 |
#! /usr/bin/env python |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
2 |
import sys |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
3 |
from optparse import OptionParser |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
4 |
import os |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
5 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
6 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
7 |
WSCRIPT_TEMPLATE = '''# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
8 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
9 |
# def options(opt): |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
10 |
# pass |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
11 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
12 |
# def configure(conf): |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
13 |
# conf.check_nonfatal(header_name='stdint.h', define_name='HAVE_STDINT_H') |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
14 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
15 |
def build(bld): |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
16 |
module = bld.create_ns3_module(%(MODULE)r, ['core']) |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
17 |
module.source = [ |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
18 |
'model/%(MODULE)s.cc', |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
19 |
'helper/%(MODULE)s-helper.cc', |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
20 |
] |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
21 |
|
7646
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
22 |
module_test = bld.create_ns3_module_test_library('%(MODULE)s') |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
23 |
module_test.source = [ |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
24 |
'test/%(MODULE)s-test-suite.cc', |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
25 |
] |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
26 |
|
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9272
diff
changeset
|
27 |
headers = bld(features='ns3header') |
7497
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
28 |
headers.module = %(MODULE)r |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
29 |
headers.source = [ |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
30 |
'model/%(MODULE)s.h', |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
31 |
'helper/%(MODULE)s-helper.h', |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
32 |
] |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
33 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
34 |
if bld.env.ENABLE_EXAMPLES: |
9277
0f87d1cb030c
Upgrade waf to 1.7.10 and fix included wscripts
Vedran Miletić <rivanvx@gmail.com>
parents:
9272
diff
changeset
|
35 |
bld.recurse('examples') |
7497
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
36 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
37 |
# bld.ns3_python_bindings() |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
38 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
39 |
''' |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
40 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
41 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
42 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
43 |
MODEL_CC_TEMPLATE = '''/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
44 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
45 |
#include "%(MODULE)s.h" |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
46 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
47 |
namespace ns3 { |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
48 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
49 |
/* ... */ |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
50 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
51 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
52 |
} |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
53 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
54 |
''' |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
55 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
56 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
57 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
58 |
MODEL_H_TEMPLATE = '''/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
59 |
#ifndef %(INCLUDE_GUARD)s |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
60 |
#define %(INCLUDE_GUARD)s |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
61 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
62 |
namespace ns3 { |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
63 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
64 |
/* ... */ |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
65 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
66 |
} |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
67 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
68 |
#endif /* %(INCLUDE_GUARD)s */ |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
69 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
70 |
''' |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
71 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
72 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
73 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
74 |
HELPER_CC_TEMPLATE = '''/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
75 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
76 |
#include "%(MODULE)s-helper.h" |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
77 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
78 |
namespace ns3 { |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
79 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
80 |
/* ... */ |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
81 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
82 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
83 |
} |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
84 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
85 |
''' |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
86 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
87 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
88 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
89 |
HELPER_H_TEMPLATE = '''/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
90 |
#ifndef %(INCLUDE_GUARD)s |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
91 |
#define %(INCLUDE_GUARD)s |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
92 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
93 |
#include "ns3/%(MODULE)s.h" |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
94 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
95 |
namespace ns3 { |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
96 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
97 |
/* ... */ |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
98 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
99 |
} |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
100 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
101 |
#endif /* %(INCLUDE_GUARD)s */ |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
102 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
103 |
''' |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
104 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
105 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
106 |
EXAMPLES_WSCRIPT_TEMPLATE = '''# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
107 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
108 |
def build(bld): |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
109 |
obj = bld.create_ns3_program('%(MODULE)s-example', [%(MODULE)r]) |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
110 |
obj.source = '%(MODULE)s-example.cc' |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
111 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
112 |
''' |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
113 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
114 |
EXAMPLE_CC_TEMPLATE = '''/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
115 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
116 |
#include "ns3/core-module.h" |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
117 |
#include "ns3/%(MODULE)s-helper.h" |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
118 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
119 |
using namespace ns3; |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
120 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
121 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
122 |
int |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
123 |
main (int argc, char *argv[]) |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
124 |
{ |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
125 |
bool verbose = true; |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
126 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
127 |
CommandLine cmd; |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
128 |
cmd.AddValue ("verbose", "Tell application to log if true", verbose); |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
129 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
130 |
cmd.Parse (argc,argv); |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
131 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
132 |
/* ... */ |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
133 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
134 |
Simulator::Run (); |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
135 |
Simulator::Destroy (); |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
136 |
return 0; |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
137 |
} |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
138 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
139 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
140 |
''' |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
141 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
142 |
|
7646
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
143 |
TEST_CC_TEMPLATE = '''/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
144 |
|
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
145 |
// Include a header file from your module to test. |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
146 |
#include "ns3/%(MODULE)s.h" |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
147 |
|
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
148 |
// An essential include is test.h |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
149 |
#include "ns3/test.h" |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
150 |
|
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
151 |
// Do not put your test classes in namespace ns3. You may find it useful |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
152 |
// to use the using directive to access the ns3 namespace directly |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
153 |
using namespace ns3; |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
154 |
|
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
155 |
// This is an example TestCase. |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
156 |
class %(CAPITALIZED)sTestCase1 : public TestCase |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
157 |
{ |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
158 |
public: |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
159 |
%(CAPITALIZED)sTestCase1 (); |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
160 |
virtual ~%(CAPITALIZED)sTestCase1 (); |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
161 |
|
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
162 |
private: |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
163 |
virtual void DoRun (void); |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
164 |
}; |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
165 |
|
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
166 |
// Add some help text to this case to describe what it is intended to test |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
167 |
%(CAPITALIZED)sTestCase1::%(CAPITALIZED)sTestCase1 () |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
168 |
: TestCase ("%(CAPITALIZED)s test case (does nothing)") |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
169 |
{ |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
170 |
} |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
171 |
|
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
172 |
// This destructor does nothing but we include it as a reminder that |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
173 |
// the test case should clean up after itself |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
174 |
%(CAPITALIZED)sTestCase1::~%(CAPITALIZED)sTestCase1 () |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
175 |
{ |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
176 |
} |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
177 |
|
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
178 |
// |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
179 |
// This method is the pure virtual method from class TestCase that every |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
180 |
// TestCase must implement |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
181 |
// |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
182 |
void |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
183 |
%(CAPITALIZED)sTestCase1::DoRun (void) |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
184 |
{ |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
185 |
// A wide variety of test macros are available in src/core/test.h |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
186 |
NS_TEST_ASSERT_MSG_EQ (true, true, "true doesn't equal true for some reason"); |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
187 |
// Use this one for floating point comparisons |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
188 |
NS_TEST_ASSERT_MSG_EQ_TOL (0.01, 0.01, 0.001, "Numbers are not equal within tolerance"); |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
189 |
} |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
190 |
|
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
191 |
// The TestSuite class names the TestSuite, identifies what type of TestSuite, |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
192 |
// and enables the TestCases to be run. Typically, only the constructor for |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
193 |
// this class must be defined |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
194 |
// |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
195 |
class %(CAPITALIZED)sTestSuite : public TestSuite |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
196 |
{ |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
197 |
public: |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
198 |
%(CAPITALIZED)sTestSuite (); |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
199 |
}; |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
200 |
|
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
201 |
%(CAPITALIZED)sTestSuite::%(CAPITALIZED)sTestSuite () |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
202 |
: TestSuite ("%(MODULE)s", UNIT) |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
203 |
{ |
9285
9583e3c6bf5e
Introduce compound name for static TestSuite declaration and be stricter about allowed module name
Vedran Miletić <rivanvx@gmail.com>
parents:
9283
diff
changeset
|
204 |
// TestDuration for TestCase can be QUICK, EXTENSIVE or TAKES_FOREVER |
9583e3c6bf5e
Introduce compound name for static TestSuite declaration and be stricter about allowed module name
Vedran Miletić <rivanvx@gmail.com>
parents:
9283
diff
changeset
|
205 |
AddTestCase (new %(CAPITALIZED)sTestCase1, TestCase::QUICK); |
7646
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
206 |
} |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
207 |
|
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
208 |
// Do not forget to allocate an instance of this TestSuite |
9285
9583e3c6bf5e
Introduce compound name for static TestSuite declaration and be stricter about allowed module name
Vedran Miletić <rivanvx@gmail.com>
parents:
9283
diff
changeset
|
209 |
static %(CAPITALIZED)sTestSuite %(COMPOUND)sTestSuite; |
7646
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
210 |
|
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
211 |
''' |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
212 |
|
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
213 |
|
7882
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
214 |
DOC_RST_TEMPLATE = '''Example Module Documentation |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
215 |
---------------------------- |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
216 |
|
9262
ed3daba53a83
refer to replace.txt in the documentation template
Tom Henderson <tomh@tomh.org>
parents:
8836
diff
changeset
|
217 |
.. include:: replace.txt |
10503
f6b5cea9cd85
Manual chapter on documentation.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10221
diff
changeset
|
218 |
.. highlight:: cpp |
9262
ed3daba53a83
refer to replace.txt in the documentation template
Tom Henderson <tomh@tomh.org>
parents:
8836
diff
changeset
|
219 |
|
7882
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
220 |
.. heading hierarchy: |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
221 |
------------- Chapter |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
222 |
************* Section (#.#) |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
223 |
============= Subsection (#.#.#) |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
224 |
############# Paragraph (no number) |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
225 |
|
9262
ed3daba53a83
refer to replace.txt in the documentation template
Tom Henderson <tomh@tomh.org>
parents:
8836
diff
changeset
|
226 |
This is a suggested outline for adding new module documentation to |ns3|. |
7882
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
227 |
See ``src/click/doc/click.rst`` for an example. |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
228 |
|
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
229 |
The introductory paragraph is for describing what this code is trying to |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
230 |
model. |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
231 |
|
9262
ed3daba53a83
refer to replace.txt in the documentation template
Tom Henderson <tomh@tomh.org>
parents:
8836
diff
changeset
|
232 |
For consistency (italicized formatting), please use |ns3| to refer to |
ed3daba53a83
refer to replace.txt in the documentation template
Tom Henderson <tomh@tomh.org>
parents:
8836
diff
changeset
|
233 |
ns-3 in the documentation (and likewise, |ns2| for ns-2). These macros |
ed3daba53a83
refer to replace.txt in the documentation template
Tom Henderson <tomh@tomh.org>
parents:
8836
diff
changeset
|
234 |
are defined in the file ``replace.txt``. |
ed3daba53a83
refer to replace.txt in the documentation template
Tom Henderson <tomh@tomh.org>
parents:
8836
diff
changeset
|
235 |
|
7882
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
236 |
Model Description |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
237 |
***************** |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
238 |
|
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
239 |
The source code for the new module lives in the directory ``src/%(MODULE)s``. |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
240 |
|
8836
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
241 |
Add here a basic description of what is being modeled. |
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
242 |
|
7882
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
243 |
Design |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
244 |
====== |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
245 |
|
8836
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
246 |
Briefly describe the software design of the model and how it fits into |
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
247 |
the existing ns-3 architecture. |
7882
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
248 |
|
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
249 |
Scope and Limitations |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
250 |
===================== |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
251 |
|
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
252 |
What can the model do? What can it not do? Please use this section to |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
253 |
describe the scope and limitations of the model. |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
254 |
|
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
255 |
References |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
256 |
========== |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
257 |
|
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
258 |
Add academic citations here, such as if you published a paper on this |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
259 |
model, or if readers should read a particular specification or other work. |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
260 |
|
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
261 |
Usage |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
262 |
***** |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
263 |
|
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
264 |
This section is principally concerned with the usage of your model, using |
8836
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
265 |
the public API. Focus first on most common usage patterns, then go |
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
266 |
into more advanced topics. |
7882
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
267 |
|
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
268 |
Building New Module |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
269 |
=================== |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
270 |
|
8836
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
271 |
Include this subsection only if there are special build instructions or |
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
272 |
platform limitations. |
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
273 |
|
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
274 |
Helpers |
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
275 |
======= |
7882
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
276 |
|
8836
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
277 |
What helper API will users typically use? Describe it here. |
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
278 |
|
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
279 |
Attributes |
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
280 |
========== |
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
281 |
|
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
282 |
What classes hold attributes, and what are the key ones worth mentioning? |
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
283 |
|
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
284 |
Output |
7882
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
285 |
====== |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
286 |
|
8836
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
287 |
What kind of data does the model generate? What are the key trace |
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
288 |
sources? What kind of logging output can be enabled? |
7882
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
289 |
|
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
290 |
Advanced Usage |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
291 |
============== |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
292 |
|
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
293 |
Go into further details (such as using the API outside of the helpers) |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
294 |
in additional sections, as needed. |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
295 |
|
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
296 |
Examples |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
297 |
======== |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
298 |
|
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
299 |
What examples using this new code are available? Describe them here. |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
300 |
|
8836
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
301 |
Troubleshooting |
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
302 |
=============== |
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
303 |
|
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
304 |
Add any tips for avoiding pitfalls, etc. |
a2fa1888133d
extend the sample documentation outline
Tom Henderson <tomh@tomh.org>
parents:
7882
diff
changeset
|
305 |
|
7882
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
306 |
Validation |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
307 |
********** |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
308 |
|
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
309 |
Describe how the model has been tested/validated. What tests run in the |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
310 |
test suite? How much API and code is covered by the tests? Again, |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
311 |
references to outside published work may help here. |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
312 |
''' |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
313 |
|
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
314 |
|
7497
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
315 |
def main(argv): |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
316 |
parser = OptionParser(usage=("Usage: %prog [options] modulename\n" |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
317 |
"Utility script to create a basic template for a new ns-3 module")) |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
318 |
(options, args) = parser.parse_args() |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
319 |
if len(args) != 1: |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
320 |
parser.print_help() |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
321 |
return 1 |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
322 |
|
9285
9583e3c6bf5e
Introduce compound name for static TestSuite declaration and be stricter about allowed module name
Vedran Miletić <rivanvx@gmail.com>
parents:
9283
diff
changeset
|
323 |
modname = args[0].lower() |
9583e3c6bf5e
Introduce compound name for static TestSuite declaration and be stricter about allowed module name
Vedran Miletić <rivanvx@gmail.com>
parents:
9283
diff
changeset
|
324 |
if False in [word.isalnum() for word in modname.split("-")]: |
9583e3c6bf5e
Introduce compound name for static TestSuite declaration and be stricter about allowed module name
Vedran Miletić <rivanvx@gmail.com>
parents:
9283
diff
changeset
|
325 |
print >> sys.stderr, "Module name should only contain alphanumeric characters and dashes" |
9583e3c6bf5e
Introduce compound name for static TestSuite declaration and be stricter about allowed module name
Vedran Miletić <rivanvx@gmail.com>
parents:
9283
diff
changeset
|
326 |
return 2 |
7497
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
327 |
assert os.path.sep not in modname |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
328 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
329 |
moduledir = os.path.join(os.path.dirname(__file__), modname) |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
330 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
331 |
if os.path.exists(moduledir): |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
332 |
print >> sys.stderr, "Module %r already exists" % (modname,) |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
333 |
return 2 |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
334 |
|
10221 | 335 |
print("Creating module %r, " |
336 |
"run './waf configure' to include it in the build" % (modname,)) |
|
9285
9583e3c6bf5e
Introduce compound name for static TestSuite declaration and be stricter about allowed module name
Vedran Miletić <rivanvx@gmail.com>
parents:
9283
diff
changeset
|
337 |
|
7497
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
338 |
os.mkdir(moduledir) |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
339 |
wscript = file(os.path.join(moduledir, "wscript"), "wt") |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
340 |
wscript.write(WSCRIPT_TEMPLATE % dict(MODULE=modname)) |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
341 |
wscript.close() |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
342 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
343 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
344 |
# |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
345 |
# model |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
346 |
# |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
347 |
modeldir = os.path.join(moduledir, "model") |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
348 |
os.mkdir(modeldir) |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
349 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
350 |
model_cc = file(os.path.join(moduledir, "model", "%s.cc" % modname), "wt") |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
351 |
model_cc.write(MODEL_CC_TEMPLATE % dict(MODULE=modname)) |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
352 |
model_cc.close() |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
353 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
354 |
model_h = file(os.path.join(moduledir, "model", "%s.h" % modname), "wt") |
9272
32d40ab86df5
Fix INCLUDE_GUARD in create-module.py
Vedran Miletić <rivanvx@gmail.com>
parents:
9262
diff
changeset
|
355 |
model_h.write(MODEL_H_TEMPLATE % dict(MODULE=modname, INCLUDE_GUARD="%s_H" % (modname.replace("-", "_").upper()),)) |
7497
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
356 |
model_h.close() |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
357 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
358 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
359 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
360 |
# |
7646
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
361 |
# test |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
362 |
# |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
363 |
testdir = os.path.join(moduledir, "test") |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
364 |
os.mkdir(testdir) |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
365 |
test_cc = file(os.path.join(moduledir, "test", "%s-test-suite.cc" % modname), "wt") |
9285
9583e3c6bf5e
Introduce compound name for static TestSuite declaration and be stricter about allowed module name
Vedran Miletić <rivanvx@gmail.com>
parents:
9283
diff
changeset
|
366 |
test_cc.write(TEST_CC_TEMPLATE % dict(MODULE=modname, |
9583e3c6bf5e
Introduce compound name for static TestSuite declaration and be stricter about allowed module name
Vedran Miletić <rivanvx@gmail.com>
parents:
9283
diff
changeset
|
367 |
CAPITALIZED=''.join([word.capitalize() for word in modname.split('-')]), |
9583e3c6bf5e
Introduce compound name for static TestSuite declaration and be stricter about allowed module name
Vedran Miletić <rivanvx@gmail.com>
parents:
9283
diff
changeset
|
368 |
COMPOUND=''.join([modname.split('-')[0]] + [word.capitalize() for word in modname.split('-')[1:]]), |
9583e3c6bf5e
Introduce compound name for static TestSuite declaration and be stricter about allowed module name
Vedran Miletić <rivanvx@gmail.com>
parents:
9283
diff
changeset
|
369 |
)) |
7646
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
370 |
test_cc.close() |
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
371 |
|
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
372 |
|
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
373 |
|
0c1ed7ef4ee7
make create-module.py generate a test skeleton
Mitch Watrous <watrous@u.washington.edu>
parents:
7497
diff
changeset
|
374 |
# |
7497
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
375 |
# helper |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
376 |
# |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
377 |
helperdir = os.path.join(moduledir, "helper") |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
378 |
os.mkdir(helperdir) |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
379 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
380 |
helper_cc = file(os.path.join(moduledir, "helper", "%s-helper.cc" % modname), "wt") |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
381 |
helper_cc.write(HELPER_CC_TEMPLATE % dict(MODULE=modname)) |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
382 |
helper_cc.close() |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
383 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
384 |
helper_h = file(os.path.join(moduledir, "helper", "%s-helper.h" % modname), "wt") |
9283
67ccf7a7abec
Fix INCLUDE_GUARD for helper in create-module.py
Vedran Miletić <rivanvx@gmail.com>
parents:
9282
diff
changeset
|
385 |
helper_h.write(HELPER_H_TEMPLATE % dict(MODULE=modname, INCLUDE_GUARD="%s_HELPER_H" % (modname.replace("-", "_").upper()),)) |
7497
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
386 |
helper_h.close() |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
387 |
|
7882
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
388 |
# |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
389 |
# examples |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
390 |
# |
7497
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
391 |
examplesdir = os.path.join(moduledir, "examples") |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
392 |
os.mkdir(examplesdir) |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
393 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
394 |
examples_wscript = file(os.path.join(examplesdir, "wscript"), "wt") |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
395 |
examples_wscript.write(EXAMPLES_WSCRIPT_TEMPLATE % dict(MODULE=modname)) |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
396 |
examples_wscript.close() |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
397 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
398 |
example_cc = file(os.path.join(moduledir, "examples", "%s-example.cc" % modname), "wt") |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
399 |
example_cc.write(EXAMPLE_CC_TEMPLATE % dict(MODULE=modname)) |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
400 |
example_cc.close() |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
401 |
|
7882
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
402 |
# |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
403 |
# doc |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
404 |
# |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
405 |
docdir = os.path.join(moduledir, "doc") |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
406 |
os.mkdir(docdir) |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
407 |
|
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
408 |
doc_rst = file(os.path.join(moduledir, "doc", "%s.rst" % modname), "wt") |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
409 |
doc_rst.write(DOC_RST_TEMPLATE % dict(MODULE=modname)) |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
410 |
doc_rst.close() |
158f38cfe101
Bug 1423 - extend create-module.py to generate documentation outline
Mitch Watrous <watrous@u.washington.edu>
parents:
7646
diff
changeset
|
411 |
|
7497
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
412 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
413 |
return 0 |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
414 |
|
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
415 |
if __name__ == '__main__': |
b9c82024dddd
Add a script to help create new ns-3 modules
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
diff
changeset
|
416 |
sys.exit(main(sys.argv)) |