diff --git "a/codeparrot-valid_1017.txt" "b/codeparrot-valid_1017.txt" new file mode 100644--- /dev/null +++ "b/codeparrot-valid_1017.txt" @@ -0,0 +1,10000 @@ + + return _maybe_view_as_subclass(x, array) + + +def _broadcast_to(array, shape, subok, readonly): + shape = tuple(shape) if np.iterable(shape) else (shape,) + array = np.array(array, copy=False, subok=subok) + if not shape and array.shape: + raise ValueError('cannot broadcast a non-scalar to a scalar array') + if any(size < 0 for size in shape): + raise ValueError('all elements of broadcast shape must be non-' + 'negative') + broadcast = np.nditer( + (array,), flags=['multi_index', 'refs_ok', 'zerosize_ok'], + op_flags=['readonly'], itershape=shape, order='C').itviews[0] + result = _maybe_view_as_subclass(array, broadcast) + if not readonly and array.flags.writeable: + result.flags.writeable = True + return result + + +def broadcast_to(array, shape, subok=False): + """Broadcast an array to a new shape. + + Parameters + ---------- + array : array_like + The array to broadcast. + shape : tuple + The shape of the desired array. + subok : bool, optional + If True, then sub-classes will be passed-through, otherwise + the returned array will be forced to be a base-class array (default). + + Returns + ------- + broadcast : array + A readonly view on the original array with the given shape. It is + typically not contiguous. Furthermore, more than one element of a + broadcasted array may refer to a single memory location. + + Raises + ------ + ValueError + If the array is not compatible with the new shape according to NumPy's + broadcasting rules. + + Notes + ----- + .. versionadded:: 1.10.0 + + Examples + -------- + >>> x = np.array([1, 2, 3]) + >>> np.broadcast_to(x, (3, 3)) + array([[1, 2, 3], + [1, 2, 3], + [1, 2, 3]]) + """ + return _broadcast_to(array, shape, subok=subok, readonly=True) + + +def _broadcast_shape(*args): + """Returns the shape of the ararys that would result from broadcasting the + supplied arrays against each other. + """ + if not args: + raise ValueError('must provide at least one argument') + if len(args) == 1: + # a single argument does not work with np.broadcast + return np.asarray(args[0]).shape + # use the old-iterator because np.nditer does not handle size 0 arrays + # consistently + b = np.broadcast(*args[:32]) + # unfortunately, it cannot handle 32 or more arguments directly + for pos in range(32, len(args), 31): + # ironically, np.broadcast does not properly handle np.broadcast + # objects (it treats them as scalars) + # use broadcasting to avoid allocating the full array + b = broadcast_to(0, b.shape) + b = np.broadcast(b, *args[pos:(pos + 31)]) + return b.shape + + +def broadcast_arrays(*args, **kwargs): + """ + Broadcast any number of arrays against each other. + + Parameters + ---------- + `*args` : array_likes + The arrays to broadcast. + + subok : bool, optional + If True, then sub-classes will be passed-through, otherwise + the returned arrays will be forced to be a base-class array (default). + + Returns + ------- + broadcasted : list of arrays + These arrays are views on the original arrays. They are typically + not contiguous. Furthermore, more than one element of a + broadcasted array may refer to a single memory location. If you + need to write to the arrays, make copies first. + + Examples + -------- + >>> x = np.array([[1,2,3]]) + >>> y = np.array([[1],[2],[3]]) + >>> np.broadcast_arrays(x, y) + [array([[1, 2, 3], + [1, 2, 3], + [1, 2, 3]]), array([[1, 1, 1], + [2, 2, 2], + [3, 3, 3]])] + + Here is a useful idiom for getting contiguous copies instead of + non-contiguous views. + + >>> [np.array(a) for a in np.broadcast_arrays(x, y)] + [array([[1, 2, 3], + [1, 2, 3], + [1, 2, 3]]), array([[1, 1, 1], + [2, 2, 2], + [3, 3, 3]])] + + """ + # nditer is not used here to avoid the limit of 32 arrays. + # Otherwise, something like the following one-liner would suffice: + # return np.nditer(args, flags=['multi_index', 'zerosize_ok'], + # order='C').itviews + + subok = kwargs.pop('subok', False) + if kwargs: + raise TypeError('broadcast_arrays() got an unexpected keyword ' + 'argument {}'.format(kwargs.pop())) + args = [np.array(_m, copy=False, subok=subok) for _m in args] + + shape = _broadcast_shape(*args) + + if all(array.shape == shape for array in args): + # Common case where nothing needs to be broadcasted. + return args + + # TODO: consider making the results of broadcast_arrays readonly to match + # broadcast_to. This will require a deprecation cycle. + return [_broadcast_to(array, shape, subok=subok, readonly=False) + for array in args] + +from django.core import mail +from django.test import TestCase + +from django.core.cache import cache + +from rest_framework.test import APIClient, APITestCase + +from contact.models import Description, Message +from user.models import User +from stats.models import Hit + +from user.tests import create_test_users, login + +from phiroom.tests_utils import test_status_codes + + +def create_test_messages(instance): + """Create messages for tests. + Run create_test_users first. + """ + instance.mesg = Message.objects.create( + name=instance.staffUser.username, + user=instance.staffUser, + mail=instance.staffUser.email, + website=instance.staffUser.website_link, + subject="contact", + message="Hello", + ) + + instance.mesg2 = Message.objects.create( + name="Bill", + mail="Bill@bill.com", + subject="contact", + message="Hello", + forward=False + ) + + + +class DescriptionModelTest(TestCase): + """Description model test class.""" + + fixtures = ["initial_data"] + + def setUp(self): + # create users + create_test_users(self) + + + def test_description_creation(self): + # create a description + desc = Description.objects.create( + title="Contact", + source="My beautiful source \n##titre##", + author=self.staffUser + ) + # assert description has been saved in db + desc = Description.objects.get(pk=2) + self.assertEqual(desc.title, "Contact") + self.assertEqual(desc.author, self.staffUser) + self.assertEqual(desc.source, + "My beautiful source \n##titre##") + self.assertEqual(desc.content, + "

My beautiful source

\n

titre

") + self.assertTrue(desc.date_update) + + # assert updating description always save as a new one + desc.title = "New contact" + desc.author = self.normalUser + desc.save() + + desc2 = Description.objects.get(pk=3) + self.assertEqual(desc2.title, "New contact") + self.assertEqual(desc2.author, self.normalUser) + + # assert latest always returns latest description + latest = Description.objects.latest() + self.assertEqual(desc2, latest) + + + +class MessageModelTest(TestCase): + """Message model test class.""" + + fixtures = ["initial_data"] + + def setUp(self): + # create users + create_test_users(self) + + def test_message_creation(self): + # create a new message + mesg = Message( + name="Tom", + mail="tom@tom.com", + subject="My subject", + message="My message", + forward=True + ) + mesg.save() + # assert it has been saved in db + mesg = Message.objects.get(pk=1) + self.assertEqual(mesg.name, "Tom") + self.assertEqual(mesg.mail, "tom@tom.com") + self.assertEqual(mesg.subject, "My subject") + self.assertEqual(mesg.message, "My message") + self.assertTrue(mesg.forward) + self.assertTrue(mesg.date) + + # create a test message with existing user + mesg = Message( + subject="A second subject", + message="A second message", + user=self.normalUser, + forward=False + ) + mesg.save() + # assert it has been saved in db + mesg = Message.objects.get(pk=2) + self.assertEqual(mesg.name, self.normalUser.username) + self.assertEqual(mesg.mail, self.normalUser.email) + self.assertEqual(mesg.subject, "A second subject") + self.assertEqual(mesg.message, "A second message") + self.assertEqual(mesg.forward, False) + self.assertEqual(mesg.user, self.normalUser) + self.assertTrue(mesg.date) + + +# we disable cache for tests +class DescriptionAPITest(APITestCase): + """Description API Test class.""" + + fixtures = ["initial_data"] + + def setUp(self): + # create users + create_test_users(self) + # create few descriptions + self.desc = Description.objects.create( + title="Contact", + source="My beautiful source \n##titre##", + author=self.staffUser + ) + self.desc2 = Description.objects.create( + title="Contact2", + source="My beautiful source \n##titre##", + author=self.staffUser + ) + self.desc3 = Description.objects.create( + title="Contact3", + source="My beautiful source \n##titre##", + author=self.staffUser + ) + + + self.client = APIClient() + + def test_contact_hits(self): + + # create some hits, 2 with same IP + hit = Hit.objects.create( + ip = '127.0.0.8', + type = 'CONTACT', + ) + hit = Hit.objects.create( + ip = '127.0.0.8', + type = 'CONTACT', + ) + hit = Hit.objects.create( + ip = '127.0.0.9', + type = 'CONTACT', + ) + + url = '/api/contact/hits/' + data = { 'name': 'tom' } + + # test without login + test_status_codes(self, url, [401, 401, 401, 401, 401], + postData=data, putData=data, patchData=data) + + # test with normal user + login(self, self.normalUser) + test_status_codes(self, url, [403, 403, 403, 403, 403], + postData=data, putData=data, patchData=data) + + # test with staff user + login(self, self.staffUser) + test_status_codes(self, url, [200, 405, 405, 405, 405], + postData=data, putData=data, patchData=data) + + response=self.client.get(url) + # only 2 hits should be counted + self.assertEqual(response.data, 2) + + # we reset hits count + for hit in Hit.objects.all(): + hit.delete() + + # we clear cache to be sure + cache.clear() + response=self.client.get(url) + # 0 hit should be returned + self.assertEqual(response.data, 0) + + + + def test_latest_description(self): + url = '/api/contact/description/' + data = { + 'title': 'toto', + 'source': 'tata', + } + + # test without login + test_status_codes(self, url, [200, 405, 405, 405, 405], + postData=data, putData=data, patchData=data) + # client should get last description + response=self.client.get(url) + self.assertEqual(response.data['title'], self.desc3.title) + + # test with normal user + login(self, self.normalUser) + test_status_codes(self, url, [200, 405, 405, 405, 405], + postData=data, putData=data, patchData=data) + # client should get last description + response=self.client.get(url) + self.assertEqual(response.data['title'], self.desc3.title) + + # test with staff member + login(self, self.staffUser) + test_status_codes(self, url, [200, 405, 405, 405, 405], + postData=data, putData=data, patchData=data) + + # client should get last description + response=self.client.get(url) + self.assertEqual(response.data['title'], self.desc3.title) + + + def test_descriptions_list(self): + url = '/api/contact/descriptions/' + data = { + 'title': 'toto', + 'source': 'tata', + } + + # test without login + test_status_codes(self, url, [401, 401, 401, 401, 401], + postData=data, putData=data, patchData=data) + + # test with normal user + login(self, self.normalUser) + test_status_codes(self, url, [403, 403, 403, 403, 403], + postData=data, putData=data, patchData=data) + + # test with staff member + login(self, self.staffUser) + test_status_codes(self, url, [200, 201, 405, 405, 405], + postData=data, putData=data, patchData=data) + + + # client should get list of descriptions + response=self.client.get(url) + self.assertEqual(len(response.data['results']), 5) + #self.assertEqual(len(response.data['results']), 4) + desc = Description.objects.latest() + self.assertEqual(desc.title, data['title']) + self.assertEqual(desc.source, data['source']) + self.assertTrue(desc.date_update) + self.assertTrue(desc.content) + # assert user is save as author + self.assertEqual(desc.author, self.staffUser) + + + + def test_descriptions_detail(self): + url = '/api/contact/descriptions/{}/'.format( + self.desc.pk) + data = { + 'title': 'toto', + 'source': 'tata', + } + + # test without login + test_status_codes(self, url, [401, 401, 401, 401, 401], + postData=data, putData=data, patchData=data) + + # test with normal user + login(self, self.normalUser) + test_status_codes(self, url, [403, 403, 403, 403, 403], + postData=data, putData=data, patchData=data) + + # test with staff member + login(self, self.staffUser) + test_status_codes(self, url, [200, 405, 405, 405, 405], + postData=data, putData=data, patchData=data) + # client should get list of descriptions + response=self.client.get(url) + self.assertEqual(response.data['title'], self.desc.title) + + + +class MessageAPITest(APITestCase): + """Message API Test class.""" + + fixtures = ["initial_data"] + + def setUp(self): + # create users + create_test_users(self) + # create test messages + create_test_messages(self) + + self.client = APIClient() + + + def test_messages_list(self): + url = '/api/contact/messages/' + data = { + 'name': 'toto', + 'mail': 'toto@toto.com', + 'website': 'http://toto.com', + 'subject': 'test', + 'message': 'message', + 'forward': False + } + data2 = { + 'subject': 'test', + 'message': 'message', + 'forward': True + } + # test without login + # client shouldn't get + response=self.client.get(url) + self.assertEqual(response.status_code, 401) + # client should be able to post + response=self.client.post(url, data) + self.assertEqual(response.status_code, 201) + # !!! assert mail has been sent + # one mail should have been sent (forward is false) + self.assertEqual(len(mail.outbox), 1) + self.assertTrue(mail.outbox[0].subject) + self.assertTrue(mail.outbox[0].message) + self.assertTrue(data['message'] in mail.outbox[0].body) + self.assertTrue(data['subject'] in mail.outbox[0].body) + self.assertTrue(self.staffUser.email in mail.outbox[0].to) + # client shouldn't be able to put + response=self.client.put(url, data) + self.assertEqual(response.status_code, 401) + # client shouldn't be able to patch + response=self.client.patch(url, data) + self.assertEqual(response.status_code, 401) + # client shouldn't be able to delete + response=self.client.delete(url) + self.assertEqual(response.status_code, 401) + + # test with normal user + login(self, self.normalUser) + # client shouldn't get + response=self.client.get(url) + self.assertEqual(response.status_code, 403) + # client should be able to post + response=self.client.post(url, data2) + self.assertEqual(response.status_code, 201) + + mesg = Message.objects.latest('pk') + self.assertEqual(mesg.name, self.normalUser.username) + self.assertEqual(mesg.mail, self.normalUser.email) + self.assertEqual(mesg.website, self.normalUser.website_link) + self.assertEqual(mesg.user, self.normalUser) + # !!! assert mail has been sent + # 2 mails should have been sent (forward is true) + self.assertEqual(len(mail.outbox), 3) + self.assertTrue(mail.outbox[1].subject) + self.assertTrue(mail.outbox[1].message) + self.assertTrue(data2['message'] in mail.outbox[1].body) + self.assertTrue(data2['subject'] in mail.outbox[1].body) + self.assertTrue(self.staffUser.email in mail.outbox[1].to) + # assert user email is in recipient list + self.assertTrue(self.normalUser.email in mail.outbox[2].to) + # assert message in email body + self.assertTrue(data2['message'] in mail.outbox[2].body) + # client shouldn't be able to put + response=self.client.put(url, data) + self.assertEqual(response.status_code, 403) + # client shouldn't be able to patch + response=self.client.patch(url, data) + self.assertEqual(response.status_code, 403) + # client shouldn't be able to delete + response=self.client.delete(url) + self.assertEqual(response.status_code, 403) + + + # test with staff member + login(self, self.staffUser) + # client should get list of messages + response=self.client.get(url) + self.assertEqual(response.status_code, 200) + # assert messages have been saved + self.assertEqual(len(response.data['results']), 4) + self.assertEqual(response.data['results'][2]['name'], data['name']) + self.assertEqual(response.data['results'][2]['mail'], data['mail']) + self.assertEqual(response.data['results'][2]['subject'], data['subject']) + self.assertEqual(response.data['results'][2]['message'], data['message']) + self.assertEqual(response.data['results'][2]['website'], data['website']) + self.assertEqual(response.data['results'][2]['forward'], data['forward']) + # assert IP and date have been saved + message = Message.objects.get(pk=4) + self.assertTrue(message.date) + self.assertTrue(message.ip) + # client should be able to post + response=self.client.post(url, data) + self.assertEqual(response.status_code, 201) + # !!! assert mail has been sent + # one mail should have been sent (forward is true) + self.assertEqual(len(mail.outbox), 4) + self.assertTrue(mail.outbox[3].subject) + self.assertTrue(mail.outbox[3].message) + self.assertTrue(data2['message'] in mail.outbox[3].body) + self.assertTrue(data2['subject'] in mail.outbox[3].body) + self.assertTrue(self.staffUser.email in mail.outbox[3].to) + # client shouldn't be able to put + response=self.client.put(url, data) + self.assertEqual(response.status_code, 403) + # client shouldn't be able to patch + response=self.client.patch(url, data) + self.assertEqual(response.status_code, 403) + # client shouldn't be able to delete + response=self.client.delete(url) + self.assertEqual(response.status_code, 405) + + + def test_messages_detail(self): + url = '/api/contact/messages/1/' + data = { + 'name': 'toto', + 'mail': 'toto@toto.com', + 'website': 'http://toto.com', + 'subject': 'test', + 'message': 'message', + 'forward': False + } + + # test without login + test_status_codes(self, url, [401, 401, 401, 401, 401], + postData=data, putData=data, patchData=data) + + # test with normal user + login(self, self.normalUser) + test_status_codes(self, url, [403, 403, 403, 403, 403], + postData=data, putData=data, patchData=data) + + # test with staff member + login(self, self.staffUser) + + # client should get specific message + response=self.client.get(url) + self.assertEqual(response.data['subject'], self.mesg.subject) + + # test status codes + test_status_codes(self, url, [200, 405, 405, 405, 204], + postData=data, putData=data, patchData=data) + + # assert object has been deleted + m = Message.objects.filter(pk=1).count() + self.assertEqual(m, 0) + + + + +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# Adapted by Noviat to +# - make the 'mand_id' field optional +# - support Noviat tax code scheme +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +import time +import base64 + +from openerp.osv import fields, osv +from openerp.tools.translate import _ +from openerp.report import report_sxw + + +class partner_vat_intra(osv.osv_memory): + """ + Partner Vat Intra + """ + _name = "partner.vat.intra" + _description = 'Partner VAT Intra' + + def _get_xml_data(self, cr, uid, context=None): + if context.get('file_save', False): + return base64.encodestring(context['file_save'].encode('utf8')) + return '' + + def _get_europe_country(self, cursor, user, context=None): + return self.pool.get('res.country').search(cursor, user, [('code', 'in', ['AT', 'BG', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'GB'])]) + + _columns = { + 'name': fields.char('File Name'), + 'period_code': fields.char('Period Code', size=6, required=True, help='''This is where you have to set the period code for the intracom declaration using the format: ppyyyy + PP can stand for a month: from '01' to '12'. + PP can stand for a trimester: '31','32','33','34' + The first figure means that it is a trimester, + The second figure identify the trimester. + PP can stand for a complete fiscal year: '00'. + YYYY stands for the year (4 positions). + ''' + ), + 'period_ids': fields.many2many('account.period', 'account_period_rel', 'acc_id', 'period_id', 'Period (s)', help = 'Select here the period(s) you want to include in your intracom declaration'), + 'tax_code_id': fields.many2one('account.tax.code', 'Company', domain=[('parent_id', '=', False)], help="Keep empty to use the user's company", required=True), + 'test_xml': fields.boolean('Test XML file', help="Sets the XML output as test file"), + 'mand_id' : fields.char('Reference', help="Reference given by the Representative of the sending company."), + 'msg': fields.text('File created', readonly=True), + 'no_vat': fields.text('Partner With No VAT', readonly=True, help="The Partner whose VAT number is not defined and they are not included in XML File."), + 'file_save' : fields.binary('Save File', readonly=True), + 'country_ids': fields.many2many('res.country', 'vat_country_rel', 'vat_id', 'country_id', 'European Countries'), + 'comments': fields.text('Comments'), + } + + def _get_tax_code(self, cr, uid, context=None): + obj_tax_code = self.pool.get('account.tax.code') + obj_user = self.pool.get('res.users') + company_id = obj_user.browse(cr, uid, uid, context=context).company_id.id + tax_code_ids = obj_tax_code.search(cr, uid, [('company_id', '=', company_id), ('parent_id', '=', False)], context=context) + return tax_code_ids and tax_code_ids[0] or False + + _defaults = { + 'country_ids': _get_europe_country, + 'file_save': _get_xml_data, + 'name': 'vat_intra.xml', + 'tax_code_id': _get_tax_code, + } + + def _get_datas(self, cr, uid, ids, context=None): + """Collects require data for vat intra xml + :param ids: id of wizard. + :return: dict of all data to be used to generate xml for Partner VAT Intra. + :rtype: dict + """ + if context is None: + context = {} + + obj_user = self.pool.get('res.users') + obj_sequence = self.pool.get('ir.sequence') + obj_partner = self.pool.get('res.partner') + + xmldict = {} + post_code = street = city = country = data_clientinfo = '' + seq = amount_sum = 0 + + wiz_data = self.browse(cr, uid, ids[0], context=context) + comments = wiz_data.comments + + if wiz_data.tax_code_id: + data_company = wiz_data.tax_code_id.company_id + else: + data_company = obj_user.browse(cr, uid, uid, context=context).company_id + + # Get Company vat + company_vat = data_company.partner_id.vat + if not company_vat: + raise osv.except_osv(_('Insufficient Data!'),_('No VAT number associated with your company.')) + company_vat = company_vat.replace(' ','').upper() + issued_by = company_vat[:2] + + if len(wiz_data.period_code) != 6: + raise osv.except_osv(_('Error!'), _('Period code is not valid.')) + + if not wiz_data.period_ids: + raise osv.except_osv(_('Insufficient Data!'),_('Please select at least one Period.')) + + p_id_list = obj_partner.search(cr, uid, [('vat','!=',False)], context=context) + if not p_id_list: + raise osv.except_osv(_('Insufficient Data!'),_('No partner has a VAT number associated with him.')) + + seq_declarantnum = obj_sequence.get(cr, uid, 'declarantnum') + dnum = company_vat[2:] + seq_declarantnum[-4:] + + addr = obj_partner.address_get(cr, uid, [data_company.partner_id.id], ['invoice']) + email = data_company.partner_id.email or '' + phone = data_company.partner_id.phone or '' + + if addr.get('invoice',False): + ads = obj_partner.browse(cr, uid, [addr['invoice']])[0] + city = (ads.city or '') + post_code = (ads.zip or '') + if ads.street: + street = ads.street + if ads.street2: + street += ' ' + street += ads.street2 + if ads.country_id: + country = ads.country_id.code + + if not country: + country = company_vat[:2] + if not email: + raise osv.except_osv(_('Insufficient Data!'),_('No email address associated with the company.')) + if not phone: + raise osv.except_osv(_('Insufficient Data!'),_('No phone associated with the company.')) + xmldict.update({ + 'company_name': data_company.name, + 'company_vat': company_vat, + 'vatnum': company_vat[2:], + 'mand_id': wiz_data.mand_id, + 'sender_date': str(time.strftime('%Y-%m-%d')), + 'street': street, + 'city': city, + 'post_code': post_code, + 'country': country, + 'email': email, + 'phone': phone.replace('/','').replace('.','').replace('(','').replace(')','').replace(' ',''), + 'period': wiz_data.period_code, + 'clientlist': [], + 'comments': comments, + 'issued_by': issued_by, + }) + #tax code 44: services + #tax code 46L: normal good deliveries + #tax code 46T: ABC good deliveries + #tax code 48xxx: credite note on tax code xxx + codes = ('44', '46L', '46T', '48s44', '48s46L', '48s46T') + cr.execute('''SELECT p.name As partner_name, l.partner_id AS partner_id, p.vat AS vat, + (CASE WHEN t.code = '48s44' THEN '44' + WHEN t.code = '48s46L' THEN '46L' + WHEN t.code = '48s46T' THEN '46T' + ELSE t.code END) AS intra_code, + SUM(CASE WHEN t.code in ('48s44','48s46L','48s46T') THEN -l.tax_amount ELSE l.tax_amount END) AS amount + FROM account_move_line l + LEFT JOIN account_tax_code t ON (l.tax_code_id = t.id) + LEFT JOIN res_partner p ON (l.partner_id = p.id) + WHERE t.code IN %s + AND l.period_id IN %s + AND t.company_id = %s + GROUP BY p.name, l.partner_id, p.vat, intra_code''', (codes, tuple([p.id for p in wiz_data.period_ids]), data_company.id)) + + p_count = 0 + + for row in cr.dictfetchall(): + if not row['vat']: + row['vat'] = '' + p_count += 1 + + seq += 1 + amt = row['amount'] or 0.0 + amount_sum += amt + + intra_code = row['intra_code'] == '44' and 'S' or (row['intra_code'] == '46L' and 'L' or (row['intra_code'] == '46T' and 'T' or '')) + + xmldict['clientlist'].append({ + 'partner_name': row['partner_name'], + 'seq': seq, + 'vatnum': row['vat'][2:].replace(' ','').upper(), + 'vat': row['vat'], + 'country': row['vat'][:2], + 'amount': round(amt,2), + 'intra_code': row['intra_code'], + 'code': intra_code}) + + xmldict.update({'dnum': dnum, 'clientnbr': str(seq), 'amountsum': round(amount_sum,2), 'partner_wo_vat': p_count}) + return xmldict + + def create_xml(self, cursor, user, ids, context=None): + """Creates xml that is to be exported and sent to estate for partner vat intra. + :return: Value for next action. + :rtype: dict + """ + mod_obj = self.pool.get('ir.model.data') + xml_data = self._get_datas(cursor, user, ids, context=context) + month_quarter = xml_data['period'][:2] + year = xml_data['period'][2:] + data_file = '' + + # Can't we do this by etree? + data_head = """ + + + %(vatnum)s + %(company_name)s + %(street)s + %(post_code)s + %(city)s + %(country)s + %(email)s + %(phone)s + """ % (xml_data) + if xml_data['mand_id']: + data_head += '\n\t\t%(mand_id)s' % (xml_data) + data_comp_period = '\n\t\t\n\t\t\t%(vatnum)s\n\t\t\t%(company_name)s\n\t\t\t%(street)s\n\t\t\t%(post_code)s\n\t\t\t%(city)s\n\t\t\t%(country)s\n\t\t\t%(email)s\n\t\t\t%(phone)s\n\t\t' % (xml_data) + if month_quarter.startswith('3'): + data_comp_period += '\n\t\t\n\t\t\t'+month_quarter[1]+' \n\t\t\t'+year+'\n\t\t' + elif month_quarter.startswith('0') and month_quarter.endswith('0'): + data_comp_period+= '\n\t\t\n\t\t\t'+year+'\n\t\t' + else: + data_comp_period += '\n\t\t\n\t\t\t'+month_quarter+' \n\t\t\t'+year+'\n\t\t' + + data_clientinfo = '' + for client in xml_data['clientlist']: + if not client['vatnum']: + raise osv.except_osv(_('Insufficient Data!'),_('No vat number defined for %s.') % client['partner_name']) + data_clientinfo +='\n\t\t\n\t\t\t%(vatnum)s\n\t\t\t%(code)s\n\t\t\t%(amount).2f\n\t\t' % (client) + + data_decl = '\n\t' % (xml_data) + + data_file += data_head + data_decl + data_comp_period + data_clientinfo + '\n\t\t%(comments)s\n\t\n' % (xml_data) + context = dict(context or {}) + context['file_save'] = data_file + + model_data_ids = mod_obj.search(cursor, user,[('model','=','ir.ui.view'),('name','=','view_vat_intra_save')], context=context) + resource_id = mod_obj.read(cursor, user, model_data_ids, fields=['res_id'], context=context)[0]['res_id'] + + return { + 'name': _('Save'), + 'context': context, + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': 'partner.vat.intra', + 'views': [(resource_id,'form')], + 'view_id': 'view_vat_intra_save', + 'type': 'ir.actions.act_window', + 'target': 'new', + } + + def preview(self, cr, uid, ids, context=None): + xml_data = self._get_datas(cr, uid, ids, context=context) + datas = { + 'ids': [], + 'model': 'partner.vat.intra', + 'form': xml_data + } + return self.pool['report'].get_action( + cr, uid, [], 'l10n_be.report_l10nvatintraprint', data=datas, context=context + ) + + +class vat_intra_print(report_sxw.rml_parse): + def __init__(self, cr, uid, name, context): + super(vat_intra_print, self).__init__(cr, uid, name, context=context) + self.localcontext.update({ + 'time': time, + }) + + +class wrapped_vat_intra_print(osv.AbstractModel): + _name = 'report.l10n_be.report_l10nvatintraprint' + _inherit = 'report.abstract_report' + _template = 'l10n_be.report_l10nvatintraprint' + _wrapped_report_class = vat_intra_print + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + +#!/usr/bin/python +# -*- coding: utf-8 -*- +# (c) 2016, Kenneth D. Evensen +# +# This file is part of Ansible (sort of) +# +# Ansible is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Ansible is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Ansible. If not, see . +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.pycompat24 import get_exception + +DOCUMENTATION = """ +module: pamd +author: + - "Kenneth D. Evensen (@kevensen)" +short_description: Manage PAM Modules +description: + - Edit PAM service's type, control, module path and module arguments. + In order for a PAM rule to be modified, the type, control and + module_path must match an existing rule. See man(5) pam.d for details. +version_added: "2.3" +options: + name: + required: true + description: + - The name generally refers to the PAM service file to + change, for example system-auth. + type: + required: true + description: + - The type of the PAM rule being modified. The type, control + and module_path all must match a rule to be modified. + control: + required: true + description: + - The control of the PAM rule being modified. This may be a + complicated control with brackets. If this is the case, be + sure to put "[bracketed controls]" in quotes. The type, + control and module_path all must match a rule to be modified. + module_path: + required: true + description: + - The module path of the PAM rule being modified. The type, + control and module_path all must match a rule to be modified. + new_type: + required: false + description: + - The type to assign to the new rule. + new_control: + required: false + description: + - The control to assign to the new rule. + new_module_path: + required: false + description: + - The control to assign to the new rule. + module_arguments: + required: false + description: + - When state is 'updated', the module_arguments will replace existing + module_arguments. When state is 'args_absent' args matching those + listed in module_arguments will be removed. When state is + 'args_present' any args listed in module_arguments are added if + missing from the existing rule. Furthermore, if the module argument + takes a value denoted by '=', the value will be changed to that specified + in module_arguments. + state: + required: false + default: updated + choices: + - updated + - before + - after + - args_present + - args_absent + description: + - The default of 'updated' will modify an existing rule if type, + control and module_path all match an existing rule. With 'before', + the new rule will be inserted before a rule matching type, control + and module_path. Similarly, with 'after', the new rule will be inserted + after an existing rule matching type, control and module_path. With + either 'before' or 'after' new_type, new_control, and new_module_path + must all be specified. If state is 'args_absent' or 'args_present', + new_type, new_control, and new_module_path will be ignored. + path: + required: false + default: /etc/pam.d/ + description: + - This is the path to the PAM service files +""" + +EXAMPLES = """ +- name: Update pamd rule's control in /etc/pam.d/system-auth + pamd: + name: system-auth + type: auth + control: required + module_path: pam_faillock.so + new_control: sufficient + +- name: Update pamd rule's complex control in /etc/pam.d/system-auth + pamd: + name: system-auth + type: session + control: '[success=1 default=ignore]' + module_path: pam_succeed_if.so + new_control: '[success=2 default=ignore]' + +- name: Insert a new rule before an existing rule + pamd: + name: system-auth + type: auth + control: required + module_path: pam_faillock.so + new_type: auth + new_control: sufficient + new_module_path: pam_faillock.so + state: before + +- name: Insert a new rule after an existing rule + pamd: + name: system-auth + type: auth + control: required + module_path: pam_faillock.so + new_type: auth + new_control=sufficient + new_module_path: pam_faillock.so + state: after + +- name: Remove module arguments from an existing rule + pamd: + name: system-auth + type: auth + control: required + module_path: pam_faillock.so + module_arguments: '' + state: updated + +- name: Replace all module arguments in an existing rule + pamd: + name: system-auth + type: auth + control: required + module_path: pam_faillock.so + module_arguments: 'preauth + silent + deny=3 + unlock_time=604800 + fail_interval=900' + state: updated + +- name: Remove specific arguments from a rule + pamd: + name: system-auth + type: session control='[success=1 default=ignore]' + module_path: pam_succeed_if.so + module_arguments: 'crond quiet' + state: args_absent + +- name: Ensure specific arguments are present in a rule + pamd: + name: system-auth + type: session + control: '[success=1 default=ignore]' + module_path: pam_succeed_if.so + module_arguments: 'crond quiet' + state: args_present + +- name: Update specific argument value in a rule + pamd: + name: system-auth + type: auth + control: required + module_path: pam_faillock.so + module_arguments: 'fail_interval=300' + state: args_present +""" + +RETURN = ''' +dest: + description: path to pam.d service that was changed + returned: success + type: string + sample: "/etc/pam.d/system-auth" +... +''' + + +# The PamdRule class encapsulates a rule in a pam.d service +class PamdRule(object): + + def __init__(self, rule_type, + rule_control, rule_module_path, + rule_module_args=None): + + self.rule_type = rule_type + self.rule_control = rule_control + self.rule_module_path = rule_module_path + + try: + if (rule_module_args is not None and + type(rule_module_args) is list): + self.rule_module_args = rule_module_args + elif (rule_module_args is not None and + type(rule_module_args) is str): + self.rule_module_args = rule_module_args.split() + except AttributeError: + self.rule_module_args = [] + + @classmethod + def rulefromstring(cls, stringline): + split_line = stringline.split() + + rule_type = split_line[0] + rule_control = split_line[1] + + if rule_control.startswith('['): + rule_control = stringline[stringline.index('['): + stringline.index(']')+1] + + if "]" in split_line[2]: + rule_module_path = split_line[3] + rule_module_args = split_line[4:] + else: + rule_module_path = split_line[2] + rule_module_args = split_line[3:] + + return cls(rule_type, rule_control, rule_module_path, rule_module_args) + + def get_module_args_as_string(self): + try: + if self.rule_module_args is not None: + return ' '.join(self.rule_module_args) + except AttributeError: + pass + return '' + + def __str__(self): + return "%-10s\t%s\t%s %s" % (self.rule_type, + self.rule_control, + self.rule_module_path, + self.get_module_args_as_string()) + + +# PamdService encapsulates an entire service and contains one or more rules +class PamdService(object): + + def __init__(self, path, name, ansible): + self.path = path + self.name = name + self.check = ansible.check_mode + self.ansible = ansible + self.fname = self.path + "/" + self.name + self.preamble = [] + self.rules = [] + try: + for line in open(self.fname, 'r'): + if line.startswith('#') and not line.isspace(): + self.preamble.append(line.rstrip()) + elif not line.startswith('#') and not line.isspace(): + self.rules.append(PamdRule.rulefromstring + (stringline=line.rstrip())) + except Exception: + e = get_exception() + self.ansible.fail_json(msg='Unable to open/read PAM module file ' + + '%s with error %s' % (self.fname, str(e))) + + def __str__(self): + return self.fname + + +def update_rule(service, old_rule, new_rule): + + changed = False + change_count = 0 + result = {'action': 'update_rule'} + + for rule in service.rules: + if (old_rule.rule_type == rule.rule_type and + old_rule.rule_control == rule.rule_control and + old_rule.rule_module_path == rule.rule_module_path): + + if (new_rule.rule_type is not None and + new_rule.rule_type != rule.rule_type): + rule.rule_type = new_rule.rule_type + changed = True + if (new_rule.rule_control is not None and + new_rule.rule_control != rule.rule_control): + rule.rule_control = new_rule.rule_control + changed = True + if (new_rule.rule_module_path is not None and + new_rule.rule_module_path != rule.rule_module_path): + rule.rule_module_path = new_rule.rule_module_path + changed = True + try: + if (new_rule.rule_module_args is not None and + new_rule.rule_module_args != + rule.rule_module_args): + rule.rule_module_args = new_rule.rule_module_args + changed = True + except AttributeError: + pass + if changed: + result['updated_rule_'+str(change_count)] = str(rule) + result['new_rule'] = str(new_rule) + + change_count += 1 + + result['change_count'] = change_count + return changed, result + + +def insert_before_rule(service, old_rule, new_rule): + index = 0 + change_count = 0 + result = {'action': + 'insert_before_rule'} + changed = False + for rule in service.rules: + if (old_rule.rule_type == rule.rule_type and + old_rule.rule_control == rule.rule_control and + old_rule.rule_module_path == rule.rule_module_path): + if index == 0: + service.rules.insert(0, new_rule) + changed = True + elif (new_rule.rule_type != service.rules[index-1].rule_type or + new_rule.rule_control != + service.rules[index-1].rule_control or + new_rule.rule_module_path != + service.rules[index-1].rule_module_path): + service.rules.insert(index, new_rule) + changed = True + if changed: + result['new_rule'] = str(new_rule) + result['before_rule_'+str(change_count)] = str(rule) + change_count += 1 + index += 1 + result['change_count'] = change_count + return changed, result + + +def insert_after_rule(service, old_rule, new_rule): + index = 0 + change_count = 0 + result = {'action': 'insert_after_rule'} + changed = False + for rule in service.rules: + if (old_rule.rule_type == rule.rule_type and + old_rule.rule_control == rule.rule_control and + old_rule.rule_module_path == rule.rule_module_path): + if (new_rule.rule_type != service.rules[index+1].rule_type or + new_rule.rule_control != + service.rules[index+1].rule_control or + new_rule.rule_module_path != + service.rules[index+1].rule_module_path): + service.rules.insert(index+1, new_rule) + changed = True + if changed: + result['new_rule'] = str(new_rule) + result['after_rule_'+str(change_count)] = str(rule) + change_count += 1 + index += 1 + + result['change_count'] = change_count + return changed, result + + +def remove_module_arguments(service, old_rule, module_args): + result = {'action': 'args_absent'} + changed = False + change_count = 0 + + for rule in service.rules: + if (old_rule.rule_type == rule.rule_type and + old_rule.rule_control == rule.rule_control and + old_rule.rule_module_path == rule.rule_module_path): + for arg_to_remove in module_args: + for arg in rule.rule_module_args: + if arg == arg_to_remove: + rule.rule_module_args.remove(arg) + changed = True + result['removed_arg_'+str(change_count)] = arg + result['from_rule_'+str(change_count)] = str(rule) + change_count += 1 + + result['change_count'] = change_count + return changed, result + + +def add_module_arguments(service, old_rule, module_args): + result = {'action': 'args_present'} + changed = False + change_count = 0 + + for rule in service.rules: + if (old_rule.rule_type == rule.rule_type and + old_rule.rule_control == rule.rule_control and + old_rule.rule_module_path == rule.rule_module_path): + for arg_to_add in module_args: + if "=" in arg_to_add: + pre_string = arg_to_add[:arg_to_add.index('=')+1] + indicies = [i for i, arg + in enumerate(rule.rule_module_args) + if arg.startswith(pre_string)] + if len(indicies) == 0: + rule.rule_module_args.append(arg_to_add) + changed = True + result['added_arg_'+str(change_count)] = arg_to_add + result['to_rule_'+str(change_count)] = str(rule) + change_count += 1 + else: + for i in indicies: + if rule.rule_module_args[i] != arg_to_add: + rule.rule_module_args[i] = arg_to_add + changed = True + result['updated_arg_' + + str(change_count)] = arg_to_add + result['in_rule_' + + str(change_count)] = str(rule) + change_count += 1 + elif arg_to_add not in rule.rule_module_args: + rule.rule_module_args.append(arg_to_add) + changed = True + result['added_arg_'+str(change_count)] = arg_to_add + result['to_rule_'+str(change_count)] = str(rule) + change_count += 1 + result['change_count'] = change_count + return changed, result + + +def write_rules(service): + previous_rule = None + + f = open(service.fname, 'w') + for amble in service.preamble: + f.write(amble+'\n') + + for rule in service.rules: + if (previous_rule is not None and + previous_rule.rule_type != rule.rule_type): + f.write('\n') + f.write(str(rule)+'\n') + previous_rule = rule + f.close() + + +def main(): + + module = AnsibleModule( + argument_spec=dict( + name=dict(required=True, type='str'), + type=dict(required=True, + choices=['account', 'auth', + 'password', 'session']), + control=dict(required=True, type='str'), + module_path=dict(required=True, type='str'), + new_type=dict(required=False, + choices=['account', 'auth', + 'password', 'session']), + new_control=dict(required=False, type='str'), + new_module_path=dict(required=False, type='str'), + module_arguments=dict(required=False, type='list'), + state=dict(required=False, default="updated", + choices=['before', 'after', 'updated', + 'args_absent', 'args_present']), + path=dict(required=False, default='/etc/pam.d', type='str') + ), + supports_check_mode=True, + required_if=[ + ("state", "args_present", ["module_arguments"]), + ("state", "args_absent", ["module_arguments"]) + ] + ) + + service = module.params['name'] + old_type = module.params['type'] + old_control = module.params['control'] + old_module_path = module.params['module_path'] + + new_type = module.params['new_type'] + new_control = module.params['new_control'] + new_module_path = module.params['new_module_path'] + + module_arguments = module.params['module_arguments'] + state = module.params['state'] + + path = module.params['path'] + + pamd = PamdService(path, service, module) + + old_rule = PamdRule(old_type, + old_control, + old_module_path) + new_rule = PamdRule(new_type, + new_control, + new_module_path, + module_arguments) + + try: + if state == 'updated': + change, result = update_rule(pamd, + old_rule, + new_rule) + elif state == 'before': + if (new_rule.rule_control is None or + new_rule.rule_type is None or + new_rule.rule_module_path is None): + + module.fail_json(msg='When inserting a new rule before ' + + 'or after an existing rule, new_type, ' + + 'new_control and new_module_path must ' + + 'all be set.') + change, result = insert_before_rule(pamd, + old_rule, + new_rule) + elif state == 'after': + if (new_rule.rule_control is None or + new_rule.rule_type is None or + new_rule.rule_module_path is None): + + module.fail_json(msg='When inserting a new rule before' + + 'or after an existing rule, new_type,' + + ' new_control and new_module_path must' + + ' all be set.') + change, result = insert_after_rule(pamd, + old_rule, + new_rule) + elif state == 'args_absent': + change, result = remove_module_arguments(pamd, + old_rule, + module_arguments) + elif state == 'args_present': + change, result = add_module_arguments(pamd, + old_rule, + module_arguments) + + if not module.check_mode: + write_rules(pamd) + + except Exception: + e = get_exception() + module.fail_json(msg='error running changing pamd: %s' % str(e)) + facts = {} + facts['pamd'] = {'changed': change, 'result': result} + + module.params['dest'] = pamd.fname + + module.exit_json(changed=change, ansible_facts=facts) + +if __name__ == '__main__': + main() + +# -*- encoding: utf-8 -*- +# This file is distributed under the same license as the Django package. +# +from __future__ import unicode_literals + +# The *_FORMAT strings use the Django date format syntax, +# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date +DATE_FORMAT = 'd F Y' +TIME_FORMAT = 'H:i' +DATETIME_FORMAT = 'd F Y H:i' +YEAR_MONTH_FORMAT = 'F Y' +MONTH_DAY_FORMAT = 'd F' +SHORT_DATE_FORMAT = 'd M Y' +SHORT_DATETIME_FORMAT = 'd M Y H:i' +FIRST_DAY_OF_WEEK = 1 # Pazartesi + +# The *_INPUT_FORMATS strings use the Python strftime format syntax, +# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior +DATE_INPUT_FORMATS = ( + '%d/%m/%Y', '%d/%m/%y', # '25/10/2006', '25/10/06' + '%y-%m-%d', # '06-10-25' + # '%d %B %Y', '%d %b. %Y', # '25 Ekim 2006', '25 Eki. 2006' +) +DATETIME_INPUT_FORMATS = ( + '%d/%m/%Y %H:%M:%S', # '25/10/2006 14:30:59' + '%d/%m/%Y %H:%M:%S.%f', # '25/10/2006 14:30:59.000200' + '%d/%m/%Y %H:%M', # '25/10/2006 14:30' + '%d/%m/%Y', # '25/10/2006' +) +DECIMAL_SEPARATOR = ',' +THOUSAND_SEPARATOR = '.' +NUMBER_GROUPING = 3 + +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2012 United States Government as represented by the +# Administrator of the National Aeronautics and Space Administration. +# All Rights Reserved. +# +# Copyright 2012 Nebula, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from django.conf.urls import patterns # noqa +from django.conf.urls import url # noqa + +from openstack_dashboard.dashboards.project.access_and_security.\ + api_access import views + + +urlpatterns = patterns('', + url(r'^ec2/$', views.download_ec2_bundle, name='ec2'), + url(r'^openrc/$', views.download_rc_file, name='openrc'), +) + +# Copyright 2015 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== + +"""Tests for tensorflow.ops.math_ops.matrix_inverse.""" +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +import numpy as np +import tensorflow as tf + + +class InverseOpTest(tf.test.TestCase): + + def _verifyInverse(self, x): + for np_type in [np.float32, np.float64]: + for adjoint in False, True: + y = x.astype(np_type) + with self.test_session(): + # Verify that x^{-1} * x == Identity matrix. + inv = tf.matrix_inverse(y, adjoint=adjoint) + tf_ans = tf.batch_matmul(inv, y, adj_y=adjoint) + np_ans = np.identity(y.shape[-1]) + if x.ndim > 2: + tiling = list(y.shape) + tiling[-2:] = [1, 1] + np_ans = np.tile(np_ans, tiling) + out = tf_ans.eval() + self.assertAllClose(np_ans, out) + self.assertShapeEqual(y, tf_ans) + + def testNonsymmetric(self): + # 2x2 matrices + matrix1 = np.array([[1., 2.], [3., 4.]]) + matrix2 = np.array([[1., 3.], [3., 5.]]) + self._verifyInverse(matrix1) + self._verifyInverse(matrix2) + # A multidimensional batch of 2x2 matrices + matrix_batch = np.concatenate([np.expand_dims(matrix1, 0), + np.expand_dims(matrix2, 0)]) + matrix_batch = np.tile(matrix_batch, [2, 3, 1, 1]) + self._verifyInverse(matrix_batch) + + def testSymmetricPositiveDefinite(self): + # 2x2 matrices + matrix1 = np.array([[2., 1.], [1., 2.]]) + matrix2 = np.array([[3., -1.], [-1., 3.]]) + self._verifyInverse(matrix1) + self._verifyInverse(matrix2) + # A multidimensional batch of 2x2 matrices + matrix_batch = np.concatenate([np.expand_dims(matrix1, 0), np.expand_dims( + matrix2, 0)]) + matrix_batch = np.tile(matrix_batch, [2, 3, 1, 1]) + self._verifyInverse(matrix_batch) + + def testNonSquareMatrix(self): + # When the inverse of a non-square matrix is attempted we should return + # an error + with self.assertRaises(ValueError): + tf.matrix_inverse(np.array([[1., 2., 3.], [3., 4., 5.]])) + + def testWrongDimensions(self): + # The input to the inverse should be at least a 2-dimensional tensor. + tensor3 = tf.constant([1., 2.]) + with self.assertRaises(ValueError): + tf.matrix_inverse(tensor3) + + def testNotInvertible(self): + # The input should be invertible. + with self.test_session(): + with self.assertRaisesOpError("Input is not invertible."): + # All rows of the matrix below add to zero. + tensor3 = tf.constant([[1., 0., -1.], [-1., 1., 0.], [0., -1., 1.]]) + tf.matrix_inverse(tensor3).eval() + + def testEmpty(self): + self._verifyInverse(np.empty([0, 2, 2])) + self._verifyInverse(np.empty([2, 0, 0])) + + +if __name__ == "__main__": + tf.test.main() + +#!/usr/bin/python +# -*- coding: utf-8 -*- +# Copyright (C) 2006-2009 Søren Roug, European Environment Agency +# +# This is free software. You may redistribute it under the terms +# of the Apache license and the GNU General Public License Version +# 2 or at your option any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# +# Contributor(s): Michael Howitz, gocept gmbh & co. kg +# +# $Id: userfield.py 447 2008-07-10 20:01:30Z roug $ + +"""Class to show and manipulate user fields in odf documents.""" + +import sys +import zipfile + +from odf.text import UserFieldDecl +from odf.namespaces import OFFICENS +from odf.opendocument import load + +OUTENCODING = "utf-8" + + +# OpenDocument v.1.0 section 6.7.1 +VALUE_TYPES = { + 'float': (OFFICENS, u'value'), + 'percentage': (OFFICENS, u'value'), + 'currency': (OFFICENS, u'value'), + 'date': (OFFICENS, u'date-value'), + 'time': (OFFICENS, u'time-value'), + 'boolean': (OFFICENS, u'boolean-value'), + 'string': (OFFICENS, u'string-value'), + } + + +class UserFields(object): + """List, view and manipulate user fields.""" + + # these attributes can be a filename or a file like object + src_file = None + dest_file = None + + def __init__(self, src=None, dest=None): + """Constructor + + src ... source document name, file like object or None for stdin + dest ... destination document name, file like object or None for stdout + + """ + self.src_file = src + self.dest_file = dest + self.document = None + + def loaddoc(self): + if isinstance(self.src_file, basestring): + # src_file is a filename, check if it is a zip-file + if not zipfile.is_zipfile(self.src_file): + raise TypeError("%s is no odt file." % self.src_file) + elif self.src_file is None: + # use stdin if no file given + self.src_file = sys.stdin + + self.document = load(self.src_file) + + def savedoc(self): + # write output + if self.dest_file is None: + # use stdout if no filename given + self.document.save('-') + else: + self.document.save(self.dest_file) + + def list_fields(self): + """List (extract) all known user-fields. + + Returns list of user-field names. + + """ + return [x[0] for x in self.list_fields_and_values()] + + def list_fields_and_values(self, field_names=None): + """List (extract) user-fields with type and value. + + field_names ... list of field names to show or None for all. + + Returns list of tuples (, , ). + + """ + self.loaddoc() + found_fields = [] + all_fields = self.document.getElementsByType(UserFieldDecl) + for f in all_fields: + value_type = f.getAttribute('valuetype') + if value_type == 'string': + value = f.getAttribute('stringvalue') + else: + value = f.getAttribute('value') + field_name = f.getAttribute('name') + + if field_names is None or field_name in field_names: + found_fields.append((field_name.encode(OUTENCODING), + value_type.encode(OUTENCODING), + value.encode(OUTENCODING))) + return found_fields + + def list_values(self, field_names): + """Extract the contents of given field names from the file. + + field_names ... list of field names + + Returns list of field values. + + """ + return [x[2] for x in self.list_fields_and_values(field_names)] + + def get(self, field_name): + """Extract the contents of this field from the file. + + Returns field value or None if field does not exist. + + """ + values = self.list_values([field_name]) + if not values: + return None + return values[0] + + def get_type_and_value(self, field_name): + """Extract the type and contents of this field from the file. + + Returns tuple (, ) or None if field does not exist. + + """ + fields = self.list_fields_and_values([field_name]) + if not fields: + return None + field_name, value_type, value = fields[0] + return value_type, value + + def update(self, data): + """Set the value of user fields. The field types will be the same. + + data ... dict, with field name as key, field value as value + + Returns None + + """ + self.loaddoc() + all_fields = self.document.getElementsByType(UserFieldDecl) + for f in all_fields: + field_name = f.getAttribute('name') + if data.has_key(field_name): + value_type = f.getAttribute('valuetype') + value = data.get(field_name) + if value_type == 'string': + f.setAttribute('stringvalue', value) + else: + f.setAttribute('value', value) + self.savedoc() + + +#!/usr/bin/env python +# +# Copyright 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""A class to keep track of devices across builds and report state.""" +import logging +import optparse +import os +import smtplib +import sys +import re +import urllib + +import bb_annotations + +sys.path.append(os.path.join(os.path.dirname(__file__), '..')) +from pylib import android_commands +from pylib import constants +from pylib import perf_tests_helper +from pylib.cmd_helper import GetCmdOutput + + +def DeviceInfo(serial, options): + """Gathers info on a device via various adb calls. + + Args: + serial: The serial of the attached device to construct info about. + + Returns: + Tuple of device type, build id, report as a string, error messages, and + boolean indicating whether or not device can be used for testing. + """ + + device_adb = android_commands.AndroidCommands(serial) + + # TODO(navabi): Replace AdbShellCmd with device_adb. + device_type = device_adb.GetBuildProduct() + device_build = device_adb.GetBuildId() + device_build_type = device_adb.GetBuildType() + device_product_name = device_adb.GetProductName() + + setup_wizard_disabled = device_adb.GetSetupWizardStatus() == 'DISABLED' + battery = device_adb.GetBatteryInfo() + install_output = GetCmdOutput( + ['%s/build/android/adb_install_apk.py' % constants.DIR_SOURCE_ROOT, '--apk', + '%s/build/android/CheckInstallApk-debug.apk' % constants.DIR_SOURCE_ROOT]) + + def _GetData(re_expression, line, lambda_function=lambda x:x): + if not line: + return 'Unknown' + found = re.findall(re_expression, line) + if found and len(found): + return lambda_function(found[0]) + return 'Unknown' + + install_speed = _GetData('(\d+) KB/s', install_output) + ac_power = _GetData('AC powered: (\w+)', battery) + battery_level = _GetData('level: (\d+)', battery) + battery_temp = _GetData('temperature: (\d+)', battery, + lambda x: float(x) / 10.0) + imei_slice = _GetData('Device ID = (\d+)', + device_adb.GetSubscriberInfo(), + lambda x: x[-6:]) + report = ['Device %s (%s)' % (serial, device_type), + ' Build: %s (%s)' % + (device_build, device_adb.GetBuildFingerprint()), + ' Battery: %s%%' % battery_level, + ' Battery temp: %s' % battery_temp, + ' IMEI slice: %s' % imei_slice, + ' Wifi IP: %s' % device_adb.GetWifiIP(), + ' Install Speed: %s KB/s' % install_speed, + ''] + + errors = [] + if battery_level < 15: + errors += ['Device critically low in battery. Turning off device.'] + if (not setup_wizard_disabled and device_build_type != 'user' and + not options.no_provisioning_check): + errors += ['Setup wizard not disabled. Was it provisioned correctly?'] + if device_product_name == 'mantaray' and ac_power != 'true': + errors += ['Mantaray device not connected to AC power.'] + # TODO(navabi): Insert warning once we have a better handle of what install + # speeds to expect. The following lines were causing too many alerts. + # if install_speed < 500: + # errors += ['Device install speed too low. Do not use for testing.'] + + # Causing the device status check step fail for slow install speed or low + # battery currently is too disruptive to the bots (especially try bots). + # Turn off devices with low battery and the step does not fail. + if battery_level < 15: + device_adb.EnableAdbRoot() + device_adb.Shutdown() + full_report = '\n'.join(report) + return device_type, device_build, battery_level, full_report, errors, True + + +def CheckForMissingDevices(options, adb_online_devs): + """Uses file of previous online devices to detect broken phones. + + Args: + options: out_dir parameter of options argument is used as the base + directory to load and update the cache file. + adb_online_devs: A list of serial numbers of the currently visible + and online attached devices. + """ + # TODO(navabi): remove this once the bug that causes different number + # of devices to be detected between calls is fixed. + logger = logging.getLogger() + logger.setLevel(logging.INFO) + + out_dir = os.path.abspath(options.out_dir) + + def ReadDeviceList(file_name): + devices_path = os.path.join(out_dir, file_name) + devices = [] + try: + with open(devices_path) as f: + devices = f.read().splitlines() + except IOError: + # Ignore error, file might not exist + pass + return devices + + def WriteDeviceList(file_name, device_list): + path = os.path.join(out_dir, file_name) + if not os.path.exists(out_dir): + os.makedirs(out_dir) + with open(path, 'w') as f: + # Write devices currently visible plus devices previously seen. + f.write('\n'.join(set(device_list))) + + last_devices_path = os.path.join(out_dir, '.last_devices') + last_devices = ReadDeviceList('.last_devices') + missing_devs = list(set(last_devices) - set(adb_online_devs)) + + all_known_devices = list(set(adb_online_devs) | set(last_devices)) + WriteDeviceList('.last_devices', all_known_devices) + WriteDeviceList('.last_missing', missing_devs) + + if not all_known_devices: + # This can happen if for some reason the .last_devices file is not + # present or if it was empty. + return ['No online devices. Have any devices been plugged in?'] + if missing_devs: + devices_missing_msg = '%d devices not detected.' % len(missing_devs) + bb_annotations.PrintSummaryText(devices_missing_msg) + + # TODO(navabi): Debug by printing both output from GetCmdOutput and + # GetAttachedDevices to compare results. + crbug_link = ('https://code.google.com/p/chromium/issues/entry?summary=' + '%s&comment=%s&labels=Restrict-View-Google,OS-Android,Infra' % + (urllib.quote('Device Offline'), + urllib.quote('Buildbot: %s %s\n' + 'Build: %s\n' + '(please don\'t change any labels)' % + (os.environ.get('BUILDBOT_BUILDERNAME'), + os.environ.get('BUILDBOT_SLAVENAME'), + os.environ.get('BUILDBOT_BUILDNUMBER'))))) + return ['Current online devices: %s' % adb_online_devs, + '%s are no longer visible. Were they removed?\n' % missing_devs, + 'SHERIFF:\n', + '@@@STEP_LINK@Click here to file a bug@%s@@@\n' % crbug_link, + 'Cache file: %s\n\n' % last_devices_path, + 'adb devices: %s' % GetCmdOutput(['adb', 'devices']), + 'adb devices(GetAttachedDevices): %s' % + android_commands.GetAttachedDevices()] + else: + new_devs = set(adb_online_devs) - set(last_devices) + if new_devs and os.path.exists(last_devices_path): + bb_annotations.PrintWarning() + bb_annotations.PrintSummaryText( + '%d new devices detected' % len(new_devs)) + print ('New devices detected %s. And now back to your ' + 'regularly scheduled program.' % list(new_devs)) + + +def SendDeviceStatusAlert(msg): + from_address = 'buildbot@chromium.org' + to_address = 'chromium-android-device-alerts@google.com' + bot_name = os.environ.get('BUILDBOT_BUILDERNAME') + slave_name = os.environ.get('BUILDBOT_SLAVENAME') + subject = 'Device status check errors on %s, %s.' % (slave_name, bot_name) + msg_body = '\r\n'.join(['From: %s' % from_address, 'To: %s' % to_address, + 'Subject: %s' % subject, '', msg]) + try: + server = smtplib.SMTP('localhost') + server.sendmail(from_address, [to_address], msg_body) + server.quit() + except Exception as e: + print 'Failed to send alert email. Error: %s' % e + + +def main(): + parser = optparse.OptionParser() + parser.add_option('', '--out-dir', + help='Directory where the device path is stored', + default=os.path.join(constants.DIR_SOURCE_ROOT, 'out')) + parser.add_option('--no-provisioning-check', + help='Will not check if devices are provisioned properly.') + parser.add_option('--device-status-dashboard', + help='Output device status data for dashboard.') + options, args = parser.parse_args() + if args: + parser.error('Unknown options %s' % args) + devices = android_commands.GetAttachedDevices() + # TODO(navabi): Test to make sure this fails and then fix call + offline_devices = android_commands.GetAttachedDevices(hardware=False, + emulator=False, + offline=True) + + types, builds, batteries, reports, errors = [], [], [], [], [] + fail_step_lst = [] + if devices: + types, builds, batteries, reports, errors, fail_step_lst = ( + zip(*[DeviceInfo(dev, options) for dev in devices])) + + err_msg = CheckForMissingDevices(options, devices) or [] + + unique_types = list(set(types)) + unique_builds = list(set(builds)) + + bb_annotations.PrintMsg('Online devices: %d. Device types %s, builds %s' + % (len(devices), unique_types, unique_builds)) + print '\n'.join(reports) + + for serial, dev_errors in zip(devices, errors): + if dev_errors: + err_msg += ['%s errors:' % serial] + err_msg += [' %s' % error for error in dev_errors] + + if err_msg: + bb_annotations.PrintWarning() + msg = '\n'.join(err_msg) + print msg + SendDeviceStatusAlert(msg) + + if options.device_status_dashboard: + perf_tests_helper.PrintPerfResult('BotDevices', 'OnlineDevices', + [len(devices)], 'devices') + perf_tests_helper.PrintPerfResult('BotDevices', 'OfflineDevices', + [len(offline_devices)], 'devices', + 'unimportant') + for serial, battery in zip(devices, batteries): + perf_tests_helper.PrintPerfResult('DeviceBattery', serial, [battery], '%', + 'unimportant') + + if False in fail_step_lst: + # TODO(navabi): Build fails on device status check step if there exists any + # devices with critically low battery or install speed. Remove those devices + # from testing, allowing build to continue with good devices. + return 1 + + if not devices: + return 1 + + +if __name__ == '__main__': + sys.exit(main()) + +# -*- coding: utf-8 -*- +""" + werkzeug.formparser + ~~~~~~~~~~~~~~~~~~~ + + This module implements the form parsing. It supports url-encoded forms + as well as non-nested multipart uploads. + + :copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details. + :license: BSD, see LICENSE for more details. +""" +import re +import codecs +from io import BytesIO +from tempfile import TemporaryFile +from itertools import chain, repeat, tee +from functools import update_wrapper + +from werkzeug._compat import to_native, text_type +from werkzeug.urls import url_decode_stream +from werkzeug.wsgi import make_line_iter, \ + get_input_stream, get_content_length +from werkzeug.datastructures import Headers, FileStorage, MultiDict +from werkzeug.http import parse_options_header + + +#: an iterator that yields empty strings +_empty_string_iter = repeat('') + +#: a regular expression for multipart boundaries +_multipart_boundary_re = re.compile('^[ -~]{0,200}[!-~]$') + +#: supported http encodings that are also available in python we support +#: for multipart messages. +_supported_multipart_encodings = frozenset(['base64', 'quoted-printable']) + + +def default_stream_factory(total_content_length, filename, content_type, + content_length=None): + """The stream factory that is used per default.""" + if total_content_length > 1024 * 500: + return TemporaryFile('wb+') + return BytesIO() + + +def parse_form_data(environ, stream_factory=None, charset='utf-8', + errors='replace', max_form_memory_size=None, + max_content_length=None, cls=None, + silent=True): + """Parse the form data in the environ and return it as tuple in the form + ``(stream, form, files)``. You should only call this method if the + transport method is `POST`, `PUT`, or `PATCH`. + + If the mimetype of the data transmitted is `multipart/form-data` the + files multidict will be filled with `FileStorage` objects. If the + mimetype is unknown the input stream is wrapped and returned as first + argument, else the stream is empty. + + This is a shortcut for the common usage of :class:`FormDataParser`. + + Have a look at :ref:`dealing-with-request-data` for more details. + + .. versionadded:: 0.5 + The `max_form_memory_size`, `max_content_length` and + `cls` parameters were added. + + .. versionadded:: 0.5.1 + The optional `silent` flag was added. + + :param environ: the WSGI environment to be used for parsing. + :param stream_factory: An optional callable that returns a new read and + writeable file descriptor. This callable works + the same as :meth:`~BaseResponse._get_file_stream`. + :param charset: The character set for URL and url encoded form data. + :param errors: The encoding error behavior. + :param max_form_memory_size: the maximum number of bytes to be accepted for + in-memory stored form data. If the data + exceeds the value specified an + :exc:`~exceptions.RequestEntityTooLarge` + exception is raised. + :param max_content_length: If this is provided and the transmitted data + is longer than this value an + :exc:`~exceptions.RequestEntityTooLarge` + exception is raised. + :param cls: an optional dict class to use. If this is not specified + or `None` the default :class:`MultiDict` is used. + :param silent: If set to False parsing errors will not be caught. + :return: A tuple in the form ``(stream, form, files)``. + """ + return FormDataParser(stream_factory, charset, errors, + max_form_memory_size, max_content_length, + cls, silent).parse_from_environ(environ) + + +def exhaust_stream(f): + """Helper decorator for methods that exhausts the stream on return.""" + + def wrapper(self, stream, *args, **kwargs): + try: + return f(self, stream, *args, **kwargs) + finally: + exhaust = getattr(stream, 'exhaust', None) + if exhaust is not None: + exhaust() + else: + while 1: + chunk = stream.read(1024 * 64) + if not chunk: + break + return update_wrapper(wrapper, f) + + +class FormDataParser(object): + + """This class implements parsing of form data for Werkzeug. By itself + it can parse multipart and url encoded form data. It can be subclassed + and extended but for most mimetypes it is a better idea to use the + untouched stream and expose it as separate attributes on a request + object. + + .. versionadded:: 0.8 + + :param stream_factory: An optional callable that returns a new read and + writeable file descriptor. This callable works + the same as :meth:`~BaseResponse._get_file_stream`. + :param charset: The character set for URL and url encoded form data. + :param errors: The encoding error behavior. + :param max_form_memory_size: the maximum number of bytes to be accepted for + in-memory stored form data. If the data + exceeds the value specified an + :exc:`~exceptions.RequestEntityTooLarge` + exception is raised. + :param max_content_length: If this is provided and the transmitted data + is longer than this value an + :exc:`~exceptions.RequestEntityTooLarge` + exception is raised. + :param cls: an optional dict class to use. If this is not specified + or `None` the default :class:`MultiDict` is used. + :param silent: If set to False parsing errors will not be caught. + """ + + def __init__(self, stream_factory=None, charset='utf-8', + errors='replace', max_form_memory_size=None, + max_content_length=None, cls=None, + silent=True): + if stream_factory is None: + stream_factory = default_stream_factory + self.stream_factory = stream_factory + self.charset = charset + self.errors = errors + self.max_form_memory_size = max_form_memory_size + self.max_content_length = max_content_length + if cls is None: + cls = MultiDict + self.cls = cls + self.silent = silent + + def get_parse_func(self, mimetype, options): + return self.parse_functions.get(mimetype) + + def parse_from_environ(self, environ): + """Parses the information from the environment as form data. + + :param environ: the WSGI environment to be used for parsing. + :return: A tuple in the form ``(stream, form, files)``. + """ + content_type = environ.get('CONTENT_TYPE', '') + content_length = get_content_length(environ) + mimetype, options = parse_options_header(content_type) + return self.parse(get_input_stream(environ), mimetype, + content_length, options) + + def parse(self, stream, mimetype, content_length, options=None): + """Parses the information from the given stream, mimetype, + content length and mimetype parameters. + + :param stream: an input stream + :param mimetype: the mimetype of the data + :param content_length: the content length of the incoming data + :param options: optional mimetype parameters (used for + the multipart boundary for instance) + :return: A tuple in the form ``(stream, form, files)``. + """ + if self.max_content_length is not None and \ + content_length is not None and \ + content_length > self.max_content_length: + raise exceptions.RequestEntityTooLarge() + if options is None: + options = {} + + parse_func = self.get_parse_func(mimetype, options) + if parse_func is not None: + try: + return parse_func(self, stream, mimetype, + content_length, options) + except ValueError: + if not self.silent: + raise + + return stream, self.cls(), self.cls() + + @exhaust_stream + def _parse_multipart(self, stream, mimetype, content_length, options): + parser = MultiPartParser(self.stream_factory, self.charset, self.errors, + max_form_memory_size=self.max_form_memory_size, + cls=self.cls) + boundary = options.get('boundary') + if boundary is None: + raise ValueError('Missing boundary') + if isinstance(boundary, text_type): + boundary = boundary.encode('ascii') + form, files = parser.parse(stream, boundary, content_length) + return stream, form, files + + @exhaust_stream + def _parse_urlencoded(self, stream, mimetype, content_length, options): + if self.max_form_memory_size is not None and \ + content_length is not None and \ + content_length > self.max_form_memory_size: + raise exceptions.RequestEntityTooLarge() + form = url_decode_stream(stream, self.charset, + errors=self.errors, cls=self.cls) + return stream, form, self.cls() + + #: mapping of mimetypes to parsing functions + parse_functions = { + 'multipart/form-data': _parse_multipart, + 'application/x-www-form-urlencoded': _parse_urlencoded, + 'application/x-url-encoded': _parse_urlencoded + } + + +def is_valid_multipart_boundary(boundary): + """Checks if the string given is a valid multipart boundary.""" + return _multipart_boundary_re.match(boundary) is not None + + +def _line_parse(line): + """Removes line ending characters and returns a tuple (`stripped_line`, + `is_terminated`). + """ + if line[-2:] in ['\r\n', b'\r\n']: + return line[:-2], True + elif line[-1:] in ['\r', '\n', b'\r', b'\n']: + return line[:-1], True + return line, False + + +def parse_multipart_headers(iterable): + """Parses multipart headers from an iterable that yields lines (including + the trailing newline symbol). The iterable has to be newline terminated. + + The iterable will stop at the line where the headers ended so it can be + further consumed. + + :param iterable: iterable of strings that are newline terminated + """ + result = [] + for line in iterable: + line = to_native(line) + line, line_terminated = _line_parse(line) + if not line_terminated: + raise ValueError('unexpected end of line in multipart header') + if not line: + break + elif line[0] in ' \t' and result: + key, value = result[-1] + result[-1] = (key, value + '\n ' + line[1:]) + else: + parts = line.split(':', 1) + if len(parts) == 2: + result.append((parts[0].strip(), parts[1].strip())) + + # we link the list to the headers, no need to create a copy, the + # list was not shared anyways. + return Headers(result) + + +_begin_form = 'begin_form' +_begin_file = 'begin_file' +_cont = 'cont' +_end = 'end' + + +class MultiPartParser(object): + + def __init__(self, stream_factory=None, charset='utf-8', errors='replace', + max_form_memory_size=None, cls=None, buffer_size=64 * 1024): + self.charset = charset + self.errors = errors + self.max_form_memory_size = max_form_memory_size + self.stream_factory = default_stream_factory if stream_factory is None else stream_factory + self.cls = MultiDict if cls is None else cls + + # make sure the buffer size is divisible by four so that we can base64 + # decode chunk by chunk + assert buffer_size % 4 == 0, 'buffer size has to be divisible by 4' + # also the buffer size has to be at least 1024 bytes long or long headers + # will freak out the system + assert buffer_size >= 1024, 'buffer size has to be at least 1KB' + + self.buffer_size = buffer_size + + def _fix_ie_filename(self, filename): + """Internet Explorer 6 transmits the full file name if a file is + uploaded. This function strips the full path if it thinks the + filename is Windows-like absolute. + """ + if filename[1:3] == ':\\' or filename[:2] == '\\\\': + return filename.split('\\')[-1] + return filename + + def _find_terminator(self, iterator): + """The terminator might have some additional newlines before it. + There is at least one application that sends additional newlines + before headers (the python setuptools package). + """ + for line in iterator: + if not line: + break + line = line.strip() + if line: + return line + return b'' + + def fail(self, message): + raise ValueError(message) + + def get_part_encoding(self, headers): + transfer_encoding = headers.get('content-transfer-encoding') + if transfer_encoding is not None and \ + transfer_encoding in _supported_multipart_encodings: + return transfer_encoding + + def get_part_charset(self, headers): + # Figure out input charset for current part + content_type = headers.get('content-type') + if content_type: + mimetype, ct_params = parse_options_header(content_type) + return ct_params.get('charset', self.charset) + return self.charset + + def start_file_streaming(self, filename, headers, total_content_length): + if isinstance(filename, bytes): + filename = filename.decode(self.charset, self.errors) + filename = self._fix_ie_filename(filename) + content_type = headers.get('content-type') + try: + content_length = int(headers['content-length']) + except (KeyError, ValueError): + content_length = 0 + container = self.stream_factory(total_content_length, content_type, + filename, content_length) + return filename, container + + def in_memory_threshold_reached(self, bytes): + raise exceptions.RequestEntityTooLarge() + + def validate_boundary(self, boundary): + if not boundary: + self.fail('Missing boundary') + if not is_valid_multipart_boundary(boundary): + self.fail('Invalid boundary: %s' % boundary) + if len(boundary) > self.buffer_size: # pragma: no cover + # this should never happen because we check for a minimum size + # of 1024 and boundaries may not be longer than 200. The only + # situation when this happens is for non debug builds where + # the assert is skipped. + self.fail('Boundary longer than buffer size') + + def parse_lines(self, file, boundary, content_length, cap_at_buffer=True): + """Generate parts of + ``('begin_form', (headers, name))`` + ``('begin_file', (headers, name, filename))`` + ``('cont', bytestring)`` + ``('end', None)`` + + Always obeys the grammar + parts = ( begin_form cont* end | + begin_file cont* end )* + """ + next_part = b'--' + boundary + last_part = next_part + b'--' + + iterator = chain(make_line_iter(file, limit=content_length, + buffer_size=self.buffer_size, + cap_at_buffer=cap_at_buffer), + _empty_string_iter) + + terminator = self._find_terminator(iterator) + + if terminator == last_part: + return + elif terminator != next_part: + self.fail('Expected boundary at start of multipart data') + + while terminator != last_part: + headers = parse_multipart_headers(iterator) + + disposition = headers.get('content-disposition') + if disposition is None: + self.fail('Missing Content-Disposition header') + disposition, extra = parse_options_header(disposition) + transfer_encoding = self.get_part_encoding(headers) + name = extra.get('name') + filename = extra.get('filename') + + # if no content type is given we stream into memory. A list is + # used as a temporary container. + if filename is None: + yield _begin_form, (headers, name) + + # otherwise we parse the rest of the headers and ask the stream + # factory for something we can write in. + else: + yield _begin_file, (headers, name, filename) + + buf = b'' + for line in iterator: + if not line: + self.fail('unexpected end of stream') + + if line[:2] == b'--': + terminator = line.rstrip() + if terminator in (next_part, last_part): + break + + if transfer_encoding is not None: + if transfer_encoding == 'base64': + transfer_encoding = 'base64_codec' + try: + line = codecs.decode(line, transfer_encoding) + except Exception: + self.fail('could not decode transfer encoded chunk') + + # we have something in the buffer from the last iteration. + # this is usually a newline delimiter. + if buf: + yield _cont, buf + buf = b'' + + # If the line ends with windows CRLF we write everything except + # the last two bytes. In all other cases however we write + # everything except the last byte. If it was a newline, that's + # fine, otherwise it does not matter because we will write it + # the next iteration. this ensures we do not write the + # final newline into the stream. That way we do not have to + # truncate the stream. However we do have to make sure that + # if something else than a newline is in there we write it + # out. + if line[-2:] == b'\r\n': + buf = b'\r\n' + cutoff = -2 + else: + buf = line[-1:] + cutoff = -1 + yield _cont, line[:cutoff] + + else: # pragma: no cover + raise ValueError('unexpected end of part') + + # if we have a leftover in the buffer that is not a newline + # character we have to flush it, otherwise we will chop of + # certain values. + if buf not in (b'', b'\r', b'\n', b'\r\n'): + yield _cont, buf + + yield _end, None + + def parse_parts(self, file, boundary, content_length): + """Generate ``('file', (name, val))`` and + ``('form', (name, val))`` parts. + """ + in_memory = 0 + + for ellt, ell in self.parse_lines(file, boundary, content_length): + if ellt == _begin_file: + headers, name, filename = ell + is_file = True + guard_memory = False + filename, container = self.start_file_streaming( + filename, headers, content_length) + _write = container.write + + elif ellt == _begin_form: + headers, name = ell + is_file = False + container = [] + _write = container.append + guard_memory = self.max_form_memory_size is not None + + elif ellt == _cont: + _write(ell) + # if we write into memory and there is a memory size limit we + # count the number of bytes in memory and raise an exception if + # there is too much data in memory. + if guard_memory: + in_memory += len(ell) + if in_memory > self.max_form_memory_size: + self.in_memory_threshold_reached(in_memory) + + elif ellt == _end: + if is_file: + container.seek(0) + yield ('file', + (name, FileStorage(container, filename, name, + headers=headers))) + else: + part_charset = self.get_part_charset(headers) + yield ('form', + (name, b''.join(container).decode( + part_charset, self.errors))) + + def parse(self, file, boundary, content_length): + formstream, filestream = tee( + self.parse_parts(file, boundary, content_length), 2) + form = (p[1] for p in formstream if p[0] == 'form') + files = (p[1] for p in filestream if p[0] == 'file') + return self.cls(form), self.cls(files) + + +from werkzeug import exceptions + +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import json + +from django.utils.translation import ugettext_lazy as _ + +from horizon import exceptions +from horizon import forms +from horizon import messages + +from openstack_dashboard import api +from openstack_dashboard.dashboards.admin.aggregates import constants + +INDEX_URL = constants.AGGREGATES_INDEX_URL + + +class UpdateAggregateForm(forms.SelfHandlingForm): + name = forms.CharField(label=_("Name"), + max_length=255) + availability_zone = forms.CharField(label=_("Availability Zone"), + max_length=255) + + def __init__(self, request, *args, **kwargs): + super(UpdateAggregateForm, self).__init__(request, *args, **kwargs) + + def handle(self, request, data): + id = self.initial['id'] + name = data['name'] + availability_zone = data['availability_zone'] + aggregate = {'name': name} + if availability_zone: + aggregate['availability_zone'] = availability_zone + try: + api.nova.aggregate_update(request, id, aggregate) + message = (_('Successfully updated aggregate: "%s."') + % data['name']) + messages.success(request, message) + except Exception: + exceptions.handle(request, + _('Unable to update the aggregate.')) + return True + + +class UpdateMetadataForm(forms.SelfHandlingForm): + + def handle(self, request, data): + id = self.initial['id'] + old_metadata = self.initial['metadata'] + + try: + new_metadata = json.loads(self.data['metadata']) + + metadata = dict( + (item['key'], str(item['value'])) + for item in new_metadata + ) + + for key in old_metadata: + if key not in metadata: + metadata[key] = None + + api.nova.aggregate_set_metadata(request, id, metadata) + message = _('Metadata successfully updated.') + messages.success(request, message) + except Exception: + msg = _('Unable to update the aggregate metadata.') + exceptions.handle(request, msg) + + return False + return True + +from __future__ import unicode_literals + +import httplib +import logging + +from modularodm import Q +from modularodm.storage.base import KeyExistsException + +from flask import request + +from framework.auth import Auth +from framework.exceptions import HTTPError +from framework.auth.decorators import must_be_signed + +from website.models import User +from website.project.decorators import ( + must_not_be_registration, must_have_addon, +) +from website.util import rubeus +from website.project.model import has_anonymous_link + +from website.files import models +from website.addons.osfstorage import utils +from website.addons.osfstorage import decorators +from website.addons.osfstorage import settings as osf_storage_settings + + +logger = logging.getLogger(__name__) + + +def osf_storage_root(node_settings, auth, **kwargs): + """Build HGrid JSON for root node. Note: include node URLs for client-side + URL creation for uploaded files. + """ + node = node_settings.owner + root = rubeus.build_addon_root( + node_settings=node_settings, + name='', + permissions=auth, + user=auth.user, + nodeUrl=node.url, + nodeApiUrl=node.api_url, + ) + return [root] + + +def make_error(code, message_short=None, message_long=None): + data = {} + if message_short: + data['message_short'] = message_short + if message_long: + data['message_long'] = message_long + return HTTPError(code, data=data) + + +@must_be_signed +@must_have_addon('osfstorage', 'node') +def osfstorage_update_metadata(node_addon, payload, **kwargs): + try: + version_id = payload['version'] + metadata = payload['metadata'] + except KeyError: + raise HTTPError(httplib.BAD_REQUEST) + + version = models.FileVersion.load(version_id) + + if version is None: + raise HTTPError(httplib.NOT_FOUND) + + version.update_metadata(metadata) + + return {'status': 'success'} + +@must_be_signed +@decorators.autoload_filenode(must_be='file') +def osfstorage_get_revisions(file_node, node_addon, payload, **kwargs): + is_anon = has_anonymous_link(node_addon.owner, Auth(private_key=request.args.get('view_only'))) + + # Return revisions in descending order + return { + 'revisions': [ + utils.serialize_revision(node_addon.owner, file_node, version, index=len(file_node.versions) - idx - 1, anon=is_anon) + for idx, version in enumerate(reversed(file_node.versions)) + ] + } + + +@decorators.waterbutler_opt_hook +def osfstorage_copy_hook(source, destination, name=None, **kwargs): + return source.copy_under(destination, name=name).serialize(), httplib.CREATED + + +@decorators.waterbutler_opt_hook +def osfstorage_move_hook(source, destination, name=None, **kwargs): + return source.move_under(destination, name=name).serialize(), httplib.OK + + +@must_be_signed +@decorators.autoload_filenode(default_root=True) +def osfstorage_get_lineage(file_node, node_addon, **kwargs): + #TODO Profile + list(models.OsfStorageFolder.find(Q('node', 'eq', node_addon.owner))) + + lineage = [] + + while file_node: + lineage.append(file_node.serialize()) + file_node = file_node.parent + + return {'data': lineage} + + +@must_be_signed +@decorators.autoload_filenode(default_root=True) +def osfstorage_get_metadata(file_node, **kwargs): + try: + # TODO This should change to version as its internal it can be changed anytime + version = int(request.args.get('revision')) + except (ValueError, TypeError): # If its not a number + version = -1 + return file_node.serialize(version=version, include_full=True) + + +@must_be_signed +@decorators.autoload_filenode(must_be='folder') +def osfstorage_get_children(file_node, **kwargs): + return [ + child.serialize() + for child in file_node.children + ] + + +@must_be_signed +@must_not_be_registration +@decorators.autoload_filenode(must_be='folder') +def osfstorage_create_child(file_node, payload, node_addon, **kwargs): + parent = file_node # Just for clarity + name = payload.get('name') + user = User.load(payload.get('user')) + is_folder = payload.get('kind') == 'folder' + + if not (name or user) or '/' in name: + raise HTTPError(httplib.BAD_REQUEST) + + try: + if is_folder: + created, file_node = True, parent.append_folder(name) + else: + created, file_node = True, parent.append_file(name) + except KeyExistsException: + created, file_node = False, parent.find_child_by_name(name, kind=int(not is_folder)) + + if not created and is_folder: + raise HTTPError(httplib.CONFLICT, data={ + 'message': 'Cannot create folder "{name}" because a file or folder already exists at path "{path}"'.format( + name=file_node.name, + path=file_node.materialized_path, + ) + }) + + if not is_folder: + try: + version = file_node.create_version( + user, + dict(payload['settings'], **dict( + payload['worker'], **{ + 'object': payload['metadata']['name'], + 'service': payload['metadata']['provider'], + }) + ), + dict(payload['metadata'], **payload['hashes']) + ) + version_id = version._id + archive_exists = version.archive is not None + except KeyError: + raise HTTPError(httplib.BAD_REQUEST) + else: + version_id = None + archive_exists = False + + return { + 'status': 'success', + 'archive': not archive_exists, # Should waterbutler also archive this file + 'data': file_node.serialize(), + 'version': version_id, + }, httplib.CREATED if created else httplib.OK + + +@must_be_signed +@must_not_be_registration +@decorators.autoload_filenode() +def osfstorage_delete(file_node, payload, node_addon, **kwargs): + auth = Auth(User.load(payload['user'])) + + #TODO Auth check? + if not auth: + raise HTTPError(httplib.BAD_REQUEST) + + if file_node == node_addon.get_root(): + raise HTTPError(httplib.BAD_REQUEST) + + file_node.delete() + + return {'status': 'success'} + + +@must_be_signed +@decorators.autoload_filenode(must_be='file') +def osfstorage_download(file_node, payload, node_addon, **kwargs): + if not request.args.get('version'): + version_id = None + else: + try: + version_id = int(request.args['version']) + except ValueError: + raise make_error(httplib.BAD_REQUEST, 'Version must be an integer if not specified') + + version = file_node.get_version(version_id, required=True) + + if request.args.get('mode') not in ('render', ): + utils.update_analytics(node_addon.owner, file_node._id, int(version.identifier)) + + return { + 'data': { + 'name': file_node.name, + 'path': version.location_hash, + }, + 'settings': { + osf_storage_settings.WATERBUTLER_RESOURCE: version.location[osf_storage_settings.WATERBUTLER_RESOURCE], + }, + } + +from helper import permission_required, check_args +import flask; from flask import request, g +from werkzeug import exceptions as ex + +import model +from model import user, commit +from helper import allow_origins + +blueprint = flask.Blueprint("users", __name__, url_prefix="/user") + +@blueprint.route('/account') +@permission_required() +def self_account(): + return g.user.to_dict() + +@blueprint.route('/') +def user_account(user): + return exUser(user).to_dict() + +@blueprint.route('/account/commits') +def self_commits(): + return commit.by_user(g.user).to_dict() + +@blueprint.route('//commits') +def user_commits(): + if not model.user.exists(user): + raise ex.NotFound("No user " + user) + return commit.by_user(user) + +@blueprint.route('/login', methods=['POST']) +@allow_origins +def user_login(): + """get a token to use for authentication throughout the rest of the site""" + #NOTE: no permission required for this part because it uses an + #alternative login method (username & password rather than token) + #and declares the user object on its own + #CONSIDER: add a delay for password based login to prevent excessive attempts + + check_args('username', 'password') + g.user = user.auth(g.args['username'], g.args['password'], + ip=request.remote_addr) + if not g.user: + raise ex.Unauthorized('Bad username or password.') + + return { + 'message': 'login successful', + 'token': g.user.token, + } + +@blueprint.route('/logout', methods=['POST']) +@permission_required() +def user_logout(): + g.user.logout() + return {'message': 'logout successful'} + +@blueprint.route('/update', methods=['POST']) +@permission_required() +def user_update_self(): + modified = [] + for i in g.user.public_attrs: + if i in g.args.keys(): + g.user.raw += {i: g.args[i]} + modified.append(i) + return {'message': 'Update successful', 'modified': modified} + +@blueprint.route('/update/', methods=['POST']) +@permission_required('modify-other') +def user_update_other(user): + #other = exUser(user) + + modified = [] + for i in user.User.public_attrs: + if i in g.args.keys(): + g.user.raw += {i: g.args[i]} + modified.append(i) + + # if g.user.has_perm('modify-perm'): + # if 'perms' in request.json.keys: + # if + # other.perms += + return {'message': 'Update successful', 'modified': modified} + +@blueprint.route('/signup', methods=['POST']) +@permission_required('make-user') +def signup(): + check_args(g.args, 'name', 'password') + u = user.new_user( + g.args['name'], + g.args['password'], + g.args) + return {'message': 'signup successful', 'user': u} + +# @blueprint.route('/users//delete', methods=['DELETE']) +# @permission_required('remove-user') +# def remove_user(user): +# """Remove user""" +# pass +# # u = exUser(user) + + +def exUser(user): + try: + return user.User(user) + except ValueError: + raise ex.NotFound('User ' + user + ' not found') + +# +# Copyright 2013 Quantopian, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Tests for the zipline.finance package +""" +import itertools +import operator + +import pytz + +from unittest import TestCase +from datetime import datetime, timedelta + +import numpy as np + +from nose.tools import timed + +from six.moves import range + +import zipline.protocol +from zipline.protocol import Event, DATASOURCE_TYPE + +import zipline.utils.factory as factory +import zipline.utils.simfactory as simfactory + +from zipline.finance.blotter import Blotter +from zipline.gens.composites import date_sorted_sources + +from zipline.finance.trading import TradingEnvironment +from zipline.finance.execution import MarketOrder, LimitOrder +from zipline.finance.trading import SimulationParameters + +from zipline.finance.performance import PerformanceTracker +from zipline.utils.test_utils import( + setup_logger, + teardown_logger, + assert_single_position +) + +DEFAULT_TIMEOUT = 15 # seconds +EXTENDED_TIMEOUT = 90 + +_multiprocess_can_split_ = False + + +class FinanceTestCase(TestCase): + + @classmethod + def setUpClass(cls): + cls.env = TradingEnvironment() + cls.env.write_data(equities_identifiers=[1, 133]) + + @classmethod + def tearDownClass(cls): + del cls.env + + def setUp(self): + self.zipline_test_config = { + 'sid': 133, + } + + setup_logger(self) + + def tearDown(self): + teardown_logger(self) + + @timed(DEFAULT_TIMEOUT) + def test_factory_daily(self): + sim_params = factory.create_simulation_parameters() + trade_source = factory.create_daily_trade_source( + [133], + sim_params, + env=self.env, + ) + prev = None + for trade in trade_source: + if prev: + self.assertTrue(trade.dt > prev.dt) + prev = trade + + @timed(EXTENDED_TIMEOUT) + def test_full_zipline(self): + # provide enough trades to ensure all orders are filled. + self.zipline_test_config['order_count'] = 100 + # making a small order amount, so that each order is filled + # in a single transaction, and txn_count == order_count. + self.zipline_test_config['order_amount'] = 25 + # No transactions can be filled on the first trade, so + # we have one extra trade to ensure all orders are filled. + self.zipline_test_config['trade_count'] = 101 + full_zipline = simfactory.create_test_zipline( + **self.zipline_test_config) + assert_single_position(self, full_zipline) + + # TODO: write tests for short sales + # TODO: write a test to do massive buying or shorting. + + @timed(DEFAULT_TIMEOUT) + def test_partially_filled_orders(self): + + # create a scenario where order size and trade size are equal + # so that orders must be spread out over several trades. + params = { + 'trade_count': 360, + 'trade_amount': 100, + 'trade_interval': timedelta(minutes=1), + 'order_count': 2, + 'order_amount': 100, + 'order_interval': timedelta(minutes=1), + # because we placed an order for 100 shares, and the volume + # of each trade is 100, the simulator should spread the order + # into 4 trades of 25 shares per order. + 'expected_txn_count': 8, + 'expected_txn_volume': 2 * 100 + } + + self.transaction_sim(**params) + + # same scenario, but with short sales + params2 = { + 'trade_count': 360, + 'trade_amount': 100, + 'trade_interval': timedelta(minutes=1), + 'order_count': 2, + 'order_amount': -100, + 'order_interval': timedelta(minutes=1), + 'expected_txn_count': 8, + 'expected_txn_volume': 2 * -100 + } + + self.transaction_sim(**params2) + + @timed(DEFAULT_TIMEOUT) + def test_collapsing_orders(self): + # create a scenario where order.amount <<< trade.volume + # to test that several orders can be covered properly by one trade, + # but are represented by multiple transactions. + params1 = { + 'trade_count': 6, + 'trade_amount': 100, + 'trade_interval': timedelta(hours=1), + 'order_count': 24, + 'order_amount': 1, + 'order_interval': timedelta(minutes=1), + # because we placed an orders totaling less than 25% of one trade + # the simulator should produce just one transaction. + 'expected_txn_count': 24, + 'expected_txn_volume': 24 + } + self.transaction_sim(**params1) + + # second verse, same as the first. except short! + params2 = { + 'trade_count': 6, + 'trade_amount': 100, + 'trade_interval': timedelta(hours=1), + 'order_count': 24, + 'order_amount': -1, + 'order_interval': timedelta(minutes=1), + 'expected_txn_count': 24, + 'expected_txn_volume': -24 + } + self.transaction_sim(**params2) + + # Runs the collapsed trades over daily trade intervals. + # Ensuring that our delay works for daily intervals as well. + params3 = { + 'trade_count': 6, + 'trade_amount': 100, + 'trade_interval': timedelta(days=1), + 'order_count': 24, + 'order_amount': 1, + 'order_interval': timedelta(minutes=1), + 'expected_txn_count': 24, + 'expected_txn_volume': 24 + } + self.transaction_sim(**params3) + + @timed(DEFAULT_TIMEOUT) + def test_alternating_long_short(self): + # create a scenario where we alternate buys and sells + params1 = { + 'trade_count': int(6.5 * 60 * 4), + 'trade_amount': 100, + 'trade_interval': timedelta(minutes=1), + 'order_count': 4, + 'order_amount': 10, + 'order_interval': timedelta(hours=24), + 'alternate': True, + 'complete_fill': True, + 'expected_txn_count': 4, + 'expected_txn_volume': 0 # equal buys and sells + } + self.transaction_sim(**params1) + + def transaction_sim(self, **params): + """ This is a utility method that asserts expected + results for conversion of orders to transactions given a + trade history""" + + trade_count = params['trade_count'] + trade_interval = params['trade_interval'] + order_count = params['order_count'] + order_amount = params['order_amount'] + order_interval = params['order_interval'] + expected_txn_count = params['expected_txn_count'] + expected_txn_volume = params['expected_txn_volume'] + # optional parameters + # --------------------- + # if present, alternate between long and short sales + alternate = params.get('alternate') + # if present, expect transaction amounts to match orders exactly. + complete_fill = params.get('complete_fill') + + sid = 1 + sim_params = factory.create_simulation_parameters() + blotter = Blotter() + price = [10.1] * trade_count + volume = [100] * trade_count + start_date = sim_params.first_open + + generated_trades = factory.create_trade_history( + sid, + price, + volume, + trade_interval, + sim_params, + env=self.env, + ) + + if alternate: + alternator = -1 + else: + alternator = 1 + + order_date = start_date + for i in range(order_count): + + blotter.set_date(order_date) + blotter.order(sid, order_amount * alternator ** i, MarketOrder()) + + order_date = order_date + order_interval + # move after market orders to just after market next + # market open. + if order_date.hour >= 21: + if order_date.minute >= 00: + order_date = order_date + timedelta(days=1) + order_date = order_date.replace(hour=14, minute=30) + + # there should now be one open order list stored under the sid + oo = blotter.open_orders + self.assertEqual(len(oo), 1) + self.assertTrue(sid in oo) + order_list = oo[sid][:] # make copy + self.assertEqual(order_count, len(order_list)) + + for i in range(order_count): + order = order_list[i] + self.assertEqual(order.sid, sid) + self.assertEqual(order.amount, order_amount * alternator ** i) + + tracker = PerformanceTracker(sim_params, env=self.env) + + benchmark_returns = [ + Event({'dt': dt, + 'returns': ret, + 'type': + zipline.protocol.DATASOURCE_TYPE.BENCHMARK, + 'source_id': 'benchmarks'}) + for dt, ret in self.env.benchmark_returns.iteritems() + if dt.date() >= sim_params.period_start.date() and + dt.date() <= sim_params.period_end.date() + ] + + generated_events = date_sorted_sources(generated_trades, + benchmark_returns) + + # this approximates the loop inside TradingSimulationClient + transactions = [] + for dt, events in itertools.groupby(generated_events, + operator.attrgetter('dt')): + for event in events: + if event.type == DATASOURCE_TYPE.TRADE: + + for txn, order in blotter.process_trade(event): + transactions.append(txn) + tracker.process_transaction(txn) + elif event.type == DATASOURCE_TYPE.BENCHMARK: + tracker.process_benchmark(event) + elif event.type == DATASOURCE_TYPE.TRADE: + tracker.process_trade(event) + + if complete_fill: + self.assertEqual(len(transactions), len(order_list)) + + total_volume = 0 + for i in range(len(transactions)): + txn = transactions[i] + total_volume += txn.amount + if complete_fill: + order = order_list[i] + self.assertEqual(order.amount, txn.amount) + + self.assertEqual(total_volume, expected_txn_volume) + self.assertEqual(len(transactions), expected_txn_count) + + cumulative_pos = tracker.cumulative_performance.positions[sid] + self.assertEqual(total_volume, cumulative_pos.amount) + + # the open orders should not contain sid. + oo = blotter.open_orders + self.assertNotIn(sid, oo, "Entry is removed when no open orders") + + def test_blotter_processes_splits(self): + sim_params = factory.create_simulation_parameters() + blotter = Blotter() + blotter.set_date(sim_params.period_start) + + # set up two open limit orders with very low limit prices, + # one for sid 1 and one for sid 2 + blotter.order(1, 100, LimitOrder(10)) + blotter.order(2, 100, LimitOrder(10)) + + # send in a split for sid 2 + split_event = factory.create_split(2, 0.33333, + sim_params.period_start + + timedelta(days=1)) + + blotter.process_split(split_event) + + for sid in [1, 2]: + order_lists = blotter.open_orders[sid] + self.assertIsNotNone(order_lists) + self.assertEqual(1, len(order_lists)) + + aapl_order = blotter.open_orders[1][0].to_dict() + fls_order = blotter.open_orders[2][0].to_dict() + + # make sure the aapl order didn't change + self.assertEqual(100, aapl_order['amount']) + self.assertEqual(10, aapl_order['limit']) + self.assertEqual(1, aapl_order['sid']) + + # make sure the fls order did change + # to 300 shares at 3.33 + self.assertEqual(300, fls_order['amount']) + self.assertEqual(3.33, fls_order['limit']) + self.assertEqual(2, fls_order['sid']) + + +class TradingEnvironmentTestCase(TestCase): + """ + Tests for date management utilities in zipline.finance.trading. + """ + + def setUp(self): + setup_logger(self) + + def tearDown(self): + teardown_logger(self) + + @classmethod + def setUpClass(cls): + cls.env = TradingEnvironment() + + @classmethod + def tearDownClass(cls): + del cls.env + + @timed(DEFAULT_TIMEOUT) + def test_is_trading_day(self): + # holidays taken from: http://www.nyse.com/press/1191407641943.html + new_years = datetime(2008, 1, 1, tzinfo=pytz.utc) + mlk_day = datetime(2008, 1, 21, tzinfo=pytz.utc) + presidents = datetime(2008, 2, 18, tzinfo=pytz.utc) + good_friday = datetime(2008, 3, 21, tzinfo=pytz.utc) + memorial_day = datetime(2008, 5, 26, tzinfo=pytz.utc) + july_4th = datetime(2008, 7, 4, tzinfo=pytz.utc) + labor_day = datetime(2008, 9, 1, tzinfo=pytz.utc) + tgiving = datetime(2008, 11, 27, tzinfo=pytz.utc) + christmas = datetime(2008, 5, 25, tzinfo=pytz.utc) + a_saturday = datetime(2008, 8, 2, tzinfo=pytz.utc) + a_sunday = datetime(2008, 10, 12, tzinfo=pytz.utc) + holidays = [ + new_years, + mlk_day, + presidents, + good_friday, + memorial_day, + july_4th, + labor_day, + tgiving, + christmas, + a_saturday, + a_sunday + ] + + for holiday in holidays: + self.assertTrue(not self.env.is_trading_day(holiday)) + + first_trading_day = datetime(2008, 1, 2, tzinfo=pytz.utc) + last_trading_day = datetime(2008, 12, 31, tzinfo=pytz.utc) + workdays = [first_trading_day, last_trading_day] + + for workday in workdays: + self.assertTrue(self.env.is_trading_day(workday)) + + def test_simulation_parameters(self): + env = SimulationParameters( + period_start=datetime(2008, 1, 1, tzinfo=pytz.utc), + period_end=datetime(2008, 12, 31, tzinfo=pytz.utc), + capital_base=100000, + env=self.env, + ) + + self.assertTrue(env.last_close.month == 12) + self.assertTrue(env.last_close.day == 31) + + @timed(DEFAULT_TIMEOUT) + def test_sim_params_days_in_period(self): + + # January 2008 + # Su Mo Tu We Th Fr Sa + # 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 + + params = SimulationParameters( + period_start=datetime(2007, 12, 31, tzinfo=pytz.utc), + period_end=datetime(2008, 1, 7, tzinfo=pytz.utc), + capital_base=100000, + env=self.env, + ) + + expected_trading_days = ( + datetime(2007, 12, 31, tzinfo=pytz.utc), + # Skip new years + # holidays taken from: http://www.nyse.com/press/1191407641943.html + datetime(2008, 1, 2, tzinfo=pytz.utc), + datetime(2008, 1, 3, tzinfo=pytz.utc), + datetime(2008, 1, 4, tzinfo=pytz.utc), + # Skip Saturday + # Skip Sunday + datetime(2008, 1, 7, tzinfo=pytz.utc) + ) + + num_expected_trading_days = 5 + self.assertEquals(num_expected_trading_days, params.days_in_period) + np.testing.assert_array_equal(expected_trading_days, + params.trading_days.tolist()) + + @timed(DEFAULT_TIMEOUT) + def test_market_minute_window(self): + + # January 2008 + # Su Mo Tu We Th Fr Sa + # 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 + + us_east = pytz.timezone('US/Eastern') + utc = pytz.utc + + # 10:01 AM Eastern on January 7th.. + start = us_east.localize(datetime(2008, 1, 7, 10, 1)) + utc_start = start.astimezone(utc) + + # Get the next 10 minutes + minutes = self.env.market_minute_window( + utc_start, 10, + ) + self.assertEqual(len(minutes), 10) + for i in range(10): + self.assertEqual(minutes[i], utc_start + timedelta(minutes=i)) + + # Get the previous 10 minutes. + minutes = self.env.market_minute_window( + utc_start, 10, step=-1, + ) + self.assertEqual(len(minutes), 10) + for i in range(10): + self.assertEqual(minutes[i], utc_start + timedelta(minutes=-i)) + + # Get the next 900 minutes, including utc_start, rolling over into the + # next two days. + # Should include: + # Today: 10:01 AM -> 4:00 PM (360 minutes) + # Tomorrow: 9:31 AM -> 4:00 PM (390 minutes, 750 total) + # Last Day: 9:31 AM -> 12:00 PM (150 minutes, 900 total) + minutes = self.env.market_minute_window( + utc_start, 900, + ) + today = self.env.market_minutes_for_day(start)[30:] + tomorrow = self.env.market_minutes_for_day( + start + timedelta(days=1) + ) + last_day = self.env.market_minutes_for_day( + start + timedelta(days=2))[:150] + + self.assertEqual(len(minutes), 900) + self.assertEqual(minutes[0], utc_start) + self.assertTrue(all(today == minutes[:360])) + self.assertTrue(all(tomorrow == minutes[360:750])) + self.assertTrue(all(last_day == minutes[750:])) + + # Get the previous 801 minutes, including utc_start, rolling over into + # Friday the 4th and Thursday the 3rd. + # Should include: + # Today: 10:01 AM -> 9:31 AM (31 minutes) + # Friday: 4:00 PM -> 9:31 AM (390 minutes, 421 total) + # Thursday: 4:00 PM -> 9:41 AM (380 minutes, 801 total) + minutes = self.env.market_minute_window( + utc_start, 801, step=-1, + ) + + today = self.env.market_minutes_for_day(start)[30::-1] + # minus an extra two days from each of these to account for the two + # weekend days we skipped + friday = self.env.market_minutes_for_day( + start + timedelta(days=-3), + )[::-1] + thursday = self.env.market_minutes_for_day( + start + timedelta(days=-4), + )[:9:-1] + + self.assertEqual(len(minutes), 801) + self.assertEqual(minutes[0], utc_start) + self.assertTrue(all(today == minutes[:31])) + self.assertTrue(all(friday == minutes[31:421])) + self.assertTrue(all(thursday == minutes[421:])) + + def test_max_date(self): + max_date = datetime(2008, 8, 1, tzinfo=pytz.utc) + env = TradingEnvironment(max_date=max_date) + + self.assertLessEqual(env.last_trading_day, max_date) + self.assertLessEqual(env.treasury_curves.index[-1], + max_date) + +# ---------------------------------------------------------------------- +# Numenta Platform for Intelligent Computing (NuPIC) +# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement +# with Numenta, Inc., for a separate license for this software code, the +# following terms and conditions apply: +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero Public License version 3 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU Affero Public License for more details. +# +# You should have received a copy of the GNU Affero Public License +# along with this program. If not, see http://www.gnu.org/licenses. +# +# http://numenta.org/licenses/ +# ---------------------------------------------------------------------- + +""" +This file defines RandomPictureExplorer, an explorer for +PictureSensor. +""" + +# Third-party imports +import numpy + +# Local imports +from nupic.vision.regions.PictureSensor import PictureSensor + +#+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= +# RandomPictureExplorer + +class RandomPictureExplorer(PictureSensor.PictureExplorer): + """ + Presents smoothly varying sequences of randomly selected + categories that sweep across the canvas at particular + velocities. + """ + + @classmethod + def queryRelevantParams(klass): + """ + Returns a sequence of parameter names that are relevant to + the operation of the explorer. + + May be extended or overridden by sub-classes as appropriate. + """ + return ( 'width', 'height', + 'sweepOffMode', 'maxOffset', + 'minVelocity', 'maxVelocity', + 'minAngularPosn', 'maxAngularPosn', + 'minAngularVelocity', 'maxAngularVelocity', + ) + + def initSequence(self, state, params): + """ + Create the state associated with a new sequence. + + @param state: a dict containing the default values for new + sequence state. This dict will contain the following keys + (additional keys may be added by the method implementation): + catIndex - the 0-based index of the category + that will be used for the sequence; + posnX - the initial X position of the pattern's reference + point for the new sequence; + posnY - the initial Y position of the pattern's reference + point for the new sequence; + velocityX - the initial horizontal velocity of the + pattern's reference point for the new sequence; + velocityY - the initial vertical velocity of the + pattern's reference point for the new sequence; + angularPosn - the initial angular position (in degrees) of + the pattern for the new sequence; + angularVelocity - the initial angular velocity (in degrees + per iteration) of the pattern for the new sequence; + + Must be overridden by sub-classes, and must not invoke this base class method. + """ + iteration = self._getIterCount() + + patternSize = state['patternSize'] + slopX = (params['width'] - patternSize) // 2 + slopY = 0 + if params['sweepOffMode']: + slopX = abs(slopX) + slopY = abs(slopY) + if params['maxOffset'] != -1: + slopX = min(abs(slopX), params['maxOffset']) + slopY = min(abs(slopY), params['maxOffset']) + posnX = self._rng.choice(xrange(-slopX, slopX + 1)) + posnY = self._rng.choice(xrange(-slopY, slopY + 1)) + # Choose a category random + catIndex = self._chooseCategory() + velocityX = self._rng.choice([-1, +1]) \ + * self._rng.choice(xrange(params['minVelocity'], params['maxVelocity'] + 1)) + velocityY = self._rng.choice([-1, +1]) \ + * self._rng.choice(xrange(params['minVelocity'], params['maxVelocity'] + 1)) + # Choose rotational params + angularPosn = params['minAngularPosn'] + self._rng.random() \ + * (params['maxAngularPosn'] - params['minAngularPosn']) + angularVelocity = params['minAngularVelocity'] + self._rng.random() \ + * (params['maxAngularVelocity'] - params['minAngularVelocity']) + + # Make sure we don't allow stationary (no velocity) + if params['maxVelocity'] > 0: + if velocityX == 0 and velocityY == 0: + velocityX, velocityY = self._rng.choice(numpy.array( + [(-1, -1), (-1, 1), (1, -1), (1, 1)], dtype=int) \ + * max(1, params['minVelocity'])) + + # Override default state + state['posnX'] = posnX + state['posnY'] = posnY + state['catIndex'] = catIndex + state['velocityX'] = velocityX + state['velocityY'] = velocityY + state['angularPosn'] = angularPosn + state['angularVelocity'] = angularVelocity + + + def updateSequence(self, state, params): + """ + Update the state associated with an existing sequence. + + @param state: dict containing the + @returns: None + + Must be overridden by sub-classes, and must not invoke this base class method. + """ + state['posnX'] += state['velocityX'] + state['posnY'] += state['velocityY'] + # Apply angular rotation (expressed in degrees) + angularPosn = state['angularPosn'] + state['angularVelocity'] + rotations = angularPosn / 360.0 + netRotations = rotations - round(rotations) + angularPosn = netRotations * 360.0 + state['angularPosn'] = angularPosn + +#!/usr/bin/env python + +# +# Copyright 2012 the V8 project authors. All rights reserved. +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +# +# Emits a C++ file to be compiled and linked into libv8 to support postmortem +# debugging tools. Most importantly, this tool emits constants describing V8 +# internals: +# +# v8dbg_type_CLASS__TYPE = VALUE Describes class type values +# v8dbg_class_CLASS__FIELD__TYPE = OFFSET Describes class fields +# v8dbg_parent_CLASS__PARENT Describes class hierarchy +# v8dbg_frametype_NAME = VALUE Describes stack frame values +# v8dbg_off_fp_NAME = OFFSET Frame pointer offsets +# v8dbg_prop_NAME = OFFSET Object property offsets +# v8dbg_NAME = VALUE Miscellaneous values +# +# These constants are declared as global integers so that they'll be present in +# the generated libv8 binary. +# + +import re +import sys + +# +# Miscellaneous constants, tags, and masks used for object identification. +# +consts_misc = [ + { 'name': 'FirstNonstringType', 'value': 'FIRST_NONSTRING_TYPE' }, + + { 'name': 'IsNotStringMask', 'value': 'kIsNotStringMask' }, + { 'name': 'StringTag', 'value': 'kStringTag' }, + { 'name': 'NotStringTag', 'value': 'kNotStringTag' }, + + { 'name': 'StringEncodingMask', 'value': 'kStringEncodingMask' }, + { 'name': 'TwoByteStringTag', 'value': 'kTwoByteStringTag' }, + { 'name': 'OneByteStringTag', 'value': 'kOneByteStringTag' }, + + { 'name': 'StringRepresentationMask', + 'value': 'kStringRepresentationMask' }, + { 'name': 'SeqStringTag', 'value': 'kSeqStringTag' }, + { 'name': 'ConsStringTag', 'value': 'kConsStringTag' }, + { 'name': 'ExternalStringTag', 'value': 'kExternalStringTag' }, + { 'name': 'SlicedStringTag', 'value': 'kSlicedStringTag' }, + + { 'name': 'HeapObjectTag', 'value': 'kHeapObjectTag' }, + { 'name': 'HeapObjectTagMask', 'value': 'kHeapObjectTagMask' }, + { 'name': 'SmiTag', 'value': 'kSmiTag' }, + { 'name': 'SmiTagMask', 'value': 'kSmiTagMask' }, + { 'name': 'SmiValueShift', 'value': 'kSmiTagSize' }, + { 'name': 'SmiShiftSize', 'value': 'kSmiShiftSize' }, + { 'name': 'PointerSizeLog2', 'value': 'kPointerSizeLog2' }, + + { 'name': 'OddballFalse', 'value': 'Oddball::kFalse' }, + { 'name': 'OddballTrue', 'value': 'Oddball::kTrue' }, + { 'name': 'OddballTheHole', 'value': 'Oddball::kTheHole' }, + { 'name': 'OddballNull', 'value': 'Oddball::kNull' }, + { 'name': 'OddballArgumentMarker', 'value': 'Oddball::kArgumentMarker' }, + { 'name': 'OddballUndefined', 'value': 'Oddball::kUndefined' }, + { 'name': 'OddballUninitialized', 'value': 'Oddball::kUninitialized' }, + { 'name': 'OddballOther', 'value': 'Oddball::kOther' }, + { 'name': 'OddballException', 'value': 'Oddball::kException' }, + + { 'name': 'prop_idx_first', + 'value': 'DescriptorArray::kFirstIndex' }, + { 'name': 'prop_type_field', + 'value': 'DATA' }, + { 'name': 'prop_type_mask', + 'value': 'PropertyDetails::TypeField::kMask' }, + { 'name': 'prop_index_mask', + 'value': 'PropertyDetails::FieldIndexField::kMask' }, + { 'name': 'prop_index_shift', + 'value': 'PropertyDetails::FieldIndexField::kShift' }, + { 'name': 'prop_representation_mask', + 'value': 'PropertyDetails::RepresentationField::kMask' }, + { 'name': 'prop_representation_shift', + 'value': 'PropertyDetails::RepresentationField::kShift' }, + { 'name': 'prop_representation_integer8', + 'value': 'Representation::Kind::kInteger8' }, + { 'name': 'prop_representation_uinteger8', + 'value': 'Representation::Kind::kUInteger8' }, + { 'name': 'prop_representation_integer16', + 'value': 'Representation::Kind::kInteger16' }, + { 'name': 'prop_representation_uinteger16', + 'value': 'Representation::Kind::kUInteger16' }, + { 'name': 'prop_representation_smi', + 'value': 'Representation::Kind::kSmi' }, + { 'name': 'prop_representation_integer32', + 'value': 'Representation::Kind::kInteger32' }, + { 'name': 'prop_representation_double', + 'value': 'Representation::Kind::kDouble' }, + { 'name': 'prop_representation_heapobject', + 'value': 'Representation::Kind::kHeapObject' }, + { 'name': 'prop_representation_tagged', + 'value': 'Representation::Kind::kTagged' }, + { 'name': 'prop_representation_external', + 'value': 'Representation::Kind::kExternal' }, + + { 'name': 'prop_desc_key', + 'value': 'DescriptorArray::kDescriptorKey' }, + { 'name': 'prop_desc_details', + 'value': 'DescriptorArray::kDescriptorDetails' }, + { 'name': 'prop_desc_value', + 'value': 'DescriptorArray::kDescriptorValue' }, + { 'name': 'prop_desc_size', + 'value': 'DescriptorArray::kDescriptorSize' }, + + { 'name': 'elements_fast_holey_elements', + 'value': 'FAST_HOLEY_ELEMENTS' }, + { 'name': 'elements_fast_elements', + 'value': 'FAST_ELEMENTS' }, + { 'name': 'elements_dictionary_elements', + 'value': 'DICTIONARY_ELEMENTS' }, + + { 'name': 'bit_field2_elements_kind_mask', + 'value': 'Map::ElementsKindBits::kMask' }, + { 'name': 'bit_field2_elements_kind_shift', + 'value': 'Map::ElementsKindBits::kShift' }, + { 'name': 'bit_field3_dictionary_map_shift', + 'value': 'Map::DictionaryMap::kShift' }, + { 'name': 'bit_field3_number_of_own_descriptors_mask', + 'value': 'Map::NumberOfOwnDescriptorsBits::kMask' }, + { 'name': 'bit_field3_number_of_own_descriptors_shift', + 'value': 'Map::NumberOfOwnDescriptorsBits::kShift' }, + + { 'name': 'off_fp_context', + 'value': 'StandardFrameConstants::kContextOffset' }, + { 'name': 'off_fp_constant_pool', + 'value': 'StandardFrameConstants::kConstantPoolOffset' }, + { 'name': 'off_fp_marker', + 'value': 'StandardFrameConstants::kMarkerOffset' }, + { 'name': 'off_fp_function', + 'value': 'JavaScriptFrameConstants::kFunctionOffset' }, + { 'name': 'off_fp_args', + 'value': 'JavaScriptFrameConstants::kLastParameterOffset' }, + + { 'name': 'scopeinfo_idx_nparams', + 'value': 'ScopeInfo::kParameterCount' }, + { 'name': 'scopeinfo_idx_nstacklocals', + 'value': 'ScopeInfo::kStackLocalCount' }, + { 'name': 'scopeinfo_idx_ncontextlocals', + 'value': 'ScopeInfo::kContextLocalCount' }, + { 'name': 'scopeinfo_idx_ncontextglobals', + 'value': 'ScopeInfo::kContextGlobalCount' }, + { 'name': 'scopeinfo_idx_first_vars', + 'value': 'ScopeInfo::kVariablePartIndex' }, + + { 'name': 'sharedfunctioninfo_start_position_mask', + 'value': 'SharedFunctionInfo::kStartPositionMask' }, + { 'name': 'sharedfunctioninfo_start_position_shift', + 'value': 'SharedFunctionInfo::kStartPositionShift' }, + + { 'name': 'jsarray_buffer_was_neutered_mask', + 'value': 'JSArrayBuffer::WasNeutered::kMask' }, + { 'name': 'jsarray_buffer_was_neutered_shift', + 'value': 'JSArrayBuffer::WasNeutered::kShift' }, +]; + +# +# The following useful fields are missing accessors, so we define fake ones. +# +extras_accessors = [ + 'JSFunction, context, Context, kContextOffset', + 'Context, closure_index, int, CLOSURE_INDEX', + 'Context, native_context_index, int, NATIVE_CONTEXT_INDEX', + 'Context, previous_index, int, PREVIOUS_INDEX', + 'Context, min_context_slots, int, MIN_CONTEXT_SLOTS', + 'HeapObject, map, Map, kMapOffset', + 'JSObject, elements, Object, kElementsOffset', + 'FixedArray, data, uintptr_t, kHeaderSize', + 'JSArrayBuffer, backing_store, Object, kBackingStoreOffset', + 'JSArrayBufferView, byte_offset, Object, kByteOffsetOffset', + 'JSTypedArray, length, Object, kLengthOffset', + 'Map, instance_attributes, int, kInstanceAttributesOffset', + 'Map, inobject_properties_or_constructor_function_index, int, kInObjectPropertiesOrConstructorFunctionIndexOffset', + 'Map, instance_size, int, kInstanceSizeOffset', + 'Map, bit_field, char, kBitFieldOffset', + 'Map, bit_field2, char, kBitField2Offset', + 'Map, bit_field3, int, kBitField3Offset', + 'Map, prototype, Object, kPrototypeOffset', + 'NameDictionaryShape, prefix_size, int, kPrefixSize', + 'NameDictionaryShape, entry_size, int, kEntrySize', + 'NameDictionary, prefix_start_index, int, kPrefixStartIndex', + 'SeededNumberDictionaryShape, prefix_size, int, kPrefixSize', + 'UnseededNumberDictionaryShape, prefix_size, int, kPrefixSize', + 'NumberDictionaryShape, entry_size, int, kEntrySize', + 'Oddball, kind_offset, int, kKindOffset', + 'HeapNumber, value, double, kValueOffset', + 'ConsString, first, String, kFirstOffset', + 'ConsString, second, String, kSecondOffset', + 'ExternalString, resource, Object, kResourceOffset', + 'SeqOneByteString, chars, char, kHeaderSize', + 'SeqTwoByteString, chars, char, kHeaderSize', + 'SharedFunctionInfo, code, Code, kCodeOffset', + 'SharedFunctionInfo, scope_info, ScopeInfo, kScopeInfoOffset', + 'SlicedString, parent, String, kParentOffset', + 'Code, instruction_start, uintptr_t, kHeaderSize', + 'Code, instruction_size, int, kInstructionSizeOffset', +]; + +# +# The following is a whitelist of classes we expect to find when scanning the +# source code. This list is not exhaustive, but it's still useful to identify +# when this script gets out of sync with the source. See load_objects(). +# +expected_classes = [ + 'ConsString', 'FixedArray', 'HeapNumber', 'JSArray', 'JSFunction', + 'JSObject', 'JSRegExp', 'JSValue', 'Map', 'Oddball', 'Script', + 'SeqOneByteString', 'SharedFunctionInfo' +]; + + +# +# The following structures store high-level representations of the structures +# for which we're going to emit descriptive constants. +# +types = {}; # set of all type names +typeclasses = {}; # maps type names to corresponding class names +klasses = {}; # known classes, including parents +fields = []; # field declarations + +header = ''' +/* + * This file is generated by %s. Do not edit directly. + */ + +#include "src/v8.h" +#include "src/frames.h" +#include "src/frames-inl.h" /* for architecture-specific frame constants */ + +using namespace v8::internal; + +extern "C" { + +/* stack frame constants */ +#define FRAME_CONST(value, klass) \ + int v8dbg_frametype_##klass = StackFrame::value; + +STACK_FRAME_TYPE_LIST(FRAME_CONST) + +#undef FRAME_CONST + +''' % sys.argv[0]; + +footer = ''' +} +''' + +# +# Get the base class +# +def get_base_class(klass): + if (klass == 'Object'): + return klass; + + if (not (klass in klasses)): + return None; + + k = klasses[klass]; + + return get_base_class(k['parent']); + +# +# Loads class hierarchy and type information from "objects.h". +# +def load_objects(): + objfilename = sys.argv[2]; + objfile = open(objfilename, 'r'); + in_insttype = False; + + typestr = ''; + + # + # Construct a dictionary for the classes we're sure should be present. + # + checktypes = {}; + for klass in expected_classes: + checktypes[klass] = True; + + # + # Iterate objects.h line-by-line to collect type and class information. + # For types, we accumulate a string representing the entire InstanceType + # enum definition and parse it later because it's easier to do so + # without the embedded newlines. + # + for line in objfile: + if (line.startswith('enum InstanceType {')): + in_insttype = True; + continue; + + if (in_insttype and line.startswith('};')): + in_insttype = False; + continue; + + line = re.sub('//.*', '', line.strip()); + + if (in_insttype): + typestr += line; + continue; + + match = re.match('class (\w[^:]*)(: public (\w[^{]*))?\s*{\s*', + line); + + if (match): + klass = match.group(1).strip(); + pklass = match.group(3); + if (pklass): + pklass = pklass.strip(); + klasses[klass] = { 'parent': pklass }; + + # + # Process the instance type declaration. + # + entries = typestr.split(','); + for entry in entries: + types[re.sub('\s*=.*', '', entry).lstrip()] = True; + + # + # Infer class names for each type based on a systematic transformation. + # For example, "JS_FUNCTION_TYPE" becomes "JSFunction". We find the + # class for each type rather than the other way around because there are + # fewer cases where one type maps to more than one class than the other + # way around. + # + for type in types: + # + # Symbols and Strings are implemented using the same classes. + # + usetype = re.sub('SYMBOL_', 'STRING_', type); + + # + # REGEXP behaves like REG_EXP, as in JS_REGEXP_TYPE => JSRegExp. + # + usetype = re.sub('_REGEXP_', '_REG_EXP_', usetype); + + # + # Remove the "_TYPE" suffix and then convert to camel case, + # except that a "JS" prefix remains uppercase (as in + # "JS_FUNCTION_TYPE" => "JSFunction"). + # + if (not usetype.endswith('_TYPE')): + continue; + + usetype = usetype[0:len(usetype) - len('_TYPE')]; + parts = usetype.split('_'); + cctype = ''; + + if (parts[0] == 'JS'): + cctype = 'JS'; + start = 1; + else: + cctype = ''; + start = 0; + + for ii in range(start, len(parts)): + part = parts[ii]; + cctype += part[0].upper() + part[1:].lower(); + + # + # Mapping string types is more complicated. Both types and + # class names for Strings specify a representation (e.g., Seq, + # Cons, External, or Sliced) and an encoding (TwoByte/OneByte), + # In the simplest case, both of these are explicit in both + # names, as in: + # + # EXTERNAL_ONE_BYTE_STRING_TYPE => ExternalOneByteString + # + # However, either the representation or encoding can be omitted + # from the type name, in which case "Seq" and "TwoByte" are + # assumed, as in: + # + # STRING_TYPE => SeqTwoByteString + # + # Additionally, sometimes the type name has more information + # than the class, as in: + # + # CONS_ONE_BYTE_STRING_TYPE => ConsString + # + # To figure this out dynamically, we first check for a + # representation and encoding and add them if they're not + # present. If that doesn't yield a valid class name, then we + # strip out the representation. + # + if (cctype.endswith('String')): + if (cctype.find('Cons') == -1 and + cctype.find('External') == -1 and + cctype.find('Sliced') == -1): + if (cctype.find('OneByte') != -1): + cctype = re.sub('OneByteString$', + 'SeqOneByteString', cctype); + else: + cctype = re.sub('String$', + 'SeqString', cctype); + + if (cctype.find('OneByte') == -1): + cctype = re.sub('String$', 'TwoByteString', + cctype); + + if (not (cctype in klasses)): + cctype = re.sub('OneByte', '', cctype); + cctype = re.sub('TwoByte', '', cctype); + + # + # Despite all that, some types have no corresponding class. + # + if (cctype in klasses): + typeclasses[type] = cctype; + if (cctype in checktypes): + del checktypes[cctype]; + + if (len(checktypes) > 0): + for klass in checktypes: + print('error: expected class \"%s\" not found' % klass); + + sys.exit(1); + + +# +# For a given macro call, pick apart the arguments and return an object +# describing the corresponding output constant. See load_fields(). +# +def parse_field(call): + # Replace newlines with spaces. + for ii in range(0, len(call)): + if (call[ii] == '\n'): + call[ii] == ' '; + + idx = call.find('('); + kind = call[0:idx]; + rest = call[idx + 1: len(call) - 1]; + args = re.split('\s*,\s*', rest); + + consts = []; + + if (kind == 'ACCESSORS' or kind == 'ACCESSORS_GCSAFE'): + klass = args[0]; + field = args[1]; + dtype = args[2]; + offset = args[3]; + + return ({ + 'name': 'class_%s__%s__%s' % (klass, field, dtype), + 'value': '%s::%s' % (klass, offset) + }); + + assert(kind == 'SMI_ACCESSORS' or kind == 'ACCESSORS_TO_SMI'); + klass = args[0]; + field = args[1]; + offset = args[2]; + + return ({ + 'name': 'class_%s__%s__%s' % (klass, field, 'SMI'), + 'value': '%s::%s' % (klass, offset) + }); + +# +# Load field offset information from objects-inl.h. +# +def load_fields(): + inlfilename = sys.argv[3]; + inlfile = open(inlfilename, 'r'); + + # + # Each class's fields and the corresponding offsets are described in the + # source by calls to macros like "ACCESSORS" (and friends). All we do + # here is extract these macro invocations, taking into account that they + # may span multiple lines and may contain nested parentheses. We also + # call parse_field() to pick apart the invocation. + # + prefixes = [ 'ACCESSORS', 'ACCESSORS_GCSAFE', + 'SMI_ACCESSORS', 'ACCESSORS_TO_SMI' ]; + current = ''; + opens = 0; + + for line in inlfile: + if (opens > 0): + # Continuation line + for ii in range(0, len(line)): + if (line[ii] == '('): + opens += 1; + elif (line[ii] == ')'): + opens -= 1; + + if (opens == 0): + break; + + current += line[0:ii + 1]; + continue; + + for prefix in prefixes: + if (not line.startswith(prefix + '(')): + continue; + + if (len(current) > 0): + fields.append(parse_field(current)); + current = ''; + + for ii in range(len(prefix), len(line)): + if (line[ii] == '('): + opens += 1; + elif (line[ii] == ')'): + opens -= 1; + + if (opens == 0): + break; + + current += line[0:ii + 1]; + + if (len(current) > 0): + fields.append(parse_field(current)); + current = ''; + + for body in extras_accessors: + fields.append(parse_field('ACCESSORS(%s)' % body)); + +# +# Emit a block of constants. +# +def emit_set(out, consts): + # Fix up overzealous parses. This could be done inside the + # parsers but as there are several, it's easiest to do it here. + ws = re.compile('\s+') + for const in consts: + name = ws.sub('', const['name']) + value = ws.sub('', str(const['value'])) # Can be a number. + out.write('int v8dbg_%s = %s;\n' % (name, value)) + out.write('\n'); + +# +# Emit the whole output file. +# +def emit_config(): + out = file(sys.argv[1], 'w'); + + out.write(header); + + out.write('/* miscellaneous constants */\n'); + emit_set(out, consts_misc); + + out.write('/* class type information */\n'); + consts = []; + keys = typeclasses.keys(); + keys.sort(); + for typename in keys: + klass = typeclasses[typename]; + consts.append({ + 'name': 'type_%s__%s' % (klass, typename), + 'value': typename + }); + + emit_set(out, consts); + + out.write('/* class hierarchy information */\n'); + consts = []; + keys = klasses.keys(); + keys.sort(); + for klassname in keys: + pklass = klasses[klassname]['parent']; + bklass = get_base_class(klassname); + if (bklass != 'Object'): + continue; + if (pklass == None): + continue; + + consts.append({ + 'name': 'parent_%s__%s' % (klassname, pklass), + 'value': 0 + }); + + emit_set(out, consts); + + out.write('/* field information */\n'); + emit_set(out, fields); + + out.write(footer); + +if (len(sys.argv) < 4): + print('usage: %s output.cc objects.h objects-inl.h' % sys.argv[0]); + sys.exit(2); + +load_objects(); +load_fields(); +emit_config(); + +"""The tests for Alarm control panel device conditions.""" +import pytest + +from homeassistant.components.alarm_control_panel import DOMAIN +import homeassistant.components.automation as automation +from homeassistant.const import ( + STATE_ALARM_ARMED_AWAY, + STATE_ALARM_ARMED_CUSTOM_BYPASS, + STATE_ALARM_ARMED_HOME, + STATE_ALARM_ARMED_NIGHT, + STATE_ALARM_DISARMED, + STATE_ALARM_TRIGGERED, +) +from homeassistant.helpers import device_registry +from homeassistant.setup import async_setup_component + +from tests.common import ( + MockConfigEntry, + assert_lists_same, + async_get_device_automations, + async_mock_service, + mock_device_registry, + mock_registry, +) + + +@pytest.fixture +def device_reg(hass): + """Return an empty, loaded, registry.""" + return mock_device_registry(hass) + + +@pytest.fixture +def entity_reg(hass): + """Return an empty, loaded, registry.""" + return mock_registry(hass) + + +@pytest.fixture +def calls(hass): + """Track calls to a mock service.""" + return async_mock_service(hass, "test", "automation") + + +async def test_get_no_conditions(hass, device_reg, entity_reg): + """Test we get the expected conditions from a alarm_control_panel.""" + config_entry = MockConfigEntry(domain="test", data={}) + config_entry.add_to_hass(hass) + device_entry = device_reg.async_get_or_create( + config_entry_id=config_entry.entry_id, + connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")}, + ) + entity_reg.async_get_or_create(DOMAIN, "test", "5678", device_id=device_entry.id) + conditions = await async_get_device_automations(hass, "condition", device_entry.id) + assert_lists_same(conditions, []) + + +async def test_get_minimum_conditions(hass, device_reg, entity_reg): + """Test we get the expected conditions from a alarm_control_panel.""" + config_entry = MockConfigEntry(domain="test", data={}) + config_entry.add_to_hass(hass) + device_entry = device_reg.async_get_or_create( + config_entry_id=config_entry.entry_id, + connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")}, + ) + entity_reg.async_get_or_create(DOMAIN, "test", "5678", device_id=device_entry.id) + hass.states.async_set( + "alarm_control_panel.test_5678", "attributes", {"supported_features": 0} + ) + expected_conditions = [ + { + "condition": "device", + "domain": DOMAIN, + "type": "is_disarmed", + "device_id": device_entry.id, + "entity_id": f"{DOMAIN}.test_5678", + }, + { + "condition": "device", + "domain": DOMAIN, + "type": "is_triggered", + "device_id": device_entry.id, + "entity_id": f"{DOMAIN}.test_5678", + }, + ] + + conditions = await async_get_device_automations(hass, "condition", device_entry.id) + assert_lists_same(conditions, expected_conditions) + + +async def test_get_maximum_conditions(hass, device_reg, entity_reg): + """Test we get the expected conditions from a alarm_control_panel.""" + config_entry = MockConfigEntry(domain="test", data={}) + config_entry.add_to_hass(hass) + device_entry = device_reg.async_get_or_create( + config_entry_id=config_entry.entry_id, + connections={(device_registry.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")}, + ) + entity_reg.async_get_or_create(DOMAIN, "test", "5678", device_id=device_entry.id) + hass.states.async_set( + "alarm_control_panel.test_5678", "attributes", {"supported_features": 31} + ) + expected_conditions = [ + { + "condition": "device", + "domain": DOMAIN, + "type": "is_disarmed", + "device_id": device_entry.id, + "entity_id": f"{DOMAIN}.test_5678", + }, + { + "condition": "device", + "domain": DOMAIN, + "type": "is_triggered", + "device_id": device_entry.id, + "entity_id": f"{DOMAIN}.test_5678", + }, + { + "condition": "device", + "domain": DOMAIN, + "type": "is_armed_home", + "device_id": device_entry.id, + "entity_id": f"{DOMAIN}.test_5678", + }, + { + "condition": "device", + "domain": DOMAIN, + "type": "is_armed_away", + "device_id": device_entry.id, + "entity_id": f"{DOMAIN}.test_5678", + }, + { + "condition": "device", + "domain": DOMAIN, + "type": "is_armed_night", + "device_id": device_entry.id, + "entity_id": f"{DOMAIN}.test_5678", + }, + { + "condition": "device", + "domain": DOMAIN, + "type": "is_armed_custom_bypass", + "device_id": device_entry.id, + "entity_id": f"{DOMAIN}.test_5678", + }, + ] + + conditions = await async_get_device_automations(hass, "condition", device_entry.id) + assert_lists_same(conditions, expected_conditions) + + +async def test_if_state(hass, calls): + """Test for all conditions.""" + assert await async_setup_component( + hass, + automation.DOMAIN, + { + automation.DOMAIN: [ + { + "trigger": {"platform": "event", "event_type": "test_event1"}, + "condition": [ + { + "condition": "device", + "domain": DOMAIN, + "device_id": "", + "entity_id": "alarm_control_panel.entity", + "type": "is_triggered", + } + ], + "action": { + "service": "test.automation", + "data_template": { + "some": "is_triggered - {{ trigger.platform }} - {{ trigger.event.event_type }}" + }, + }, + }, + { + "trigger": {"platform": "event", "event_type": "test_event2"}, + "condition": [ + { + "condition": "device", + "domain": DOMAIN, + "device_id": "", + "entity_id": "alarm_control_panel.entity", + "type": "is_disarmed", + } + ], + "action": { + "service": "test.automation", + "data_template": { + "some": "is_disarmed - {{ trigger.platform }} - {{ trigger.event.event_type }}" + }, + }, + }, + { + "trigger": {"platform": "event", "event_type": "test_event3"}, + "condition": [ + { + "condition": "device", + "domain": DOMAIN, + "device_id": "", + "entity_id": "alarm_control_panel.entity", + "type": "is_armed_home", + } + ], + "action": { + "service": "test.automation", + "data_template": { + "some": "is_armed_home - {{ trigger.platform }} - {{ trigger.event.event_type }}" + }, + }, + }, + { + "trigger": {"platform": "event", "event_type": "test_event4"}, + "condition": [ + { + "condition": "device", + "domain": DOMAIN, + "device_id": "", + "entity_id": "alarm_control_panel.entity", + "type": "is_armed_away", + } + ], + "action": { + "service": "test.automation", + "data_template": { + "some": "is_armed_away - {{ trigger.platform }} - {{ trigger.event.event_type }}" + }, + }, + }, + { + "trigger": {"platform": "event", "event_type": "test_event5"}, + "condition": [ + { + "condition": "device", + "domain": DOMAIN, + "device_id": "", + "entity_id": "alarm_control_panel.entity", + "type": "is_armed_night", + } + ], + "action": { + "service": "test.automation", + "data_template": { + "some": "is_armed_night - {{ trigger.platform }} - {{ trigger.event.event_type }}" + }, + }, + }, + { + "trigger": {"platform": "event", "event_type": "test_event6"}, + "condition": [ + { + "condition": "device", + "domain": DOMAIN, + "device_id": "", + "entity_id": "alarm_control_panel.entity", + "type": "is_armed_custom_bypass", + } + ], + "action": { + "service": "test.automation", + "data_template": { + "some": "is_armed_custom_bypass - {{ trigger.platform }} - {{ trigger.event.event_type }}" + }, + }, + }, + ] + }, + ) + hass.states.async_set("alarm_control_panel.entity", STATE_ALARM_TRIGGERED) + hass.bus.async_fire("test_event1") + hass.bus.async_fire("test_event2") + hass.bus.async_fire("test_event3") + hass.bus.async_fire("test_event4") + hass.bus.async_fire("test_event5") + hass.bus.async_fire("test_event6") + await hass.async_block_till_done() + assert len(calls) == 1 + assert calls[0].data["some"] == "is_triggered - event - test_event1" + + hass.states.async_set("alarm_control_panel.entity", STATE_ALARM_DISARMED) + hass.bus.async_fire("test_event1") + hass.bus.async_fire("test_event2") + hass.bus.async_fire("test_event3") + hass.bus.async_fire("test_event4") + hass.bus.async_fire("test_event5") + hass.bus.async_fire("test_event6") + await hass.async_block_till_done() + assert len(calls) == 2 + assert calls[1].data["some"] == "is_disarmed - event - test_event2" + + hass.states.async_set("alarm_control_panel.entity", STATE_ALARM_ARMED_HOME) + hass.bus.async_fire("test_event1") + hass.bus.async_fire("test_event2") + hass.bus.async_fire("test_event3") + hass.bus.async_fire("test_event4") + hass.bus.async_fire("test_event5") + hass.bus.async_fire("test_event6") + await hass.async_block_till_done() + assert len(calls) == 3 + assert calls[2].data["some"] == "is_armed_home - event - test_event3" + + hass.states.async_set("alarm_control_panel.entity", STATE_ALARM_ARMED_AWAY) + hass.bus.async_fire("test_event1") + hass.bus.async_fire("test_event2") + hass.bus.async_fire("test_event3") + hass.bus.async_fire("test_event4") + hass.bus.async_fire("test_event5") + hass.bus.async_fire("test_event6") + await hass.async_block_till_done() + assert len(calls) == 4 + assert calls[3].data["some"] == "is_armed_away - event - test_event4" + + hass.states.async_set("alarm_control_panel.entity", STATE_ALARM_ARMED_NIGHT) + hass.bus.async_fire("test_event1") + hass.bus.async_fire("test_event2") + hass.bus.async_fire("test_event3") + hass.bus.async_fire("test_event4") + hass.bus.async_fire("test_event5") + hass.bus.async_fire("test_event6") + await hass.async_block_till_done() + assert len(calls) == 5 + assert calls[4].data["some"] == "is_armed_night - event - test_event5" + + hass.states.async_set("alarm_control_panel.entity", STATE_ALARM_ARMED_CUSTOM_BYPASS) + hass.bus.async_fire("test_event1") + hass.bus.async_fire("test_event2") + hass.bus.async_fire("test_event3") + hass.bus.async_fire("test_event4") + hass.bus.async_fire("test_event5") + hass.bus.async_fire("test_event6") + await hass.async_block_till_done() + assert len(calls) == 6 + assert calls[5].data["some"] == "is_armed_custom_bypass - event - test_event6" + +import datetime + +from django.db import models +from django.contrib.contenttypes.models import ContentType +from django.contrib.sites.models import Site +from django.contrib.auth.models import User +from django.utils.translation import ugettext_lazy as _ +from django.conf import settings + +MIN_PHOTO_DIMENSION = 5 +MAX_PHOTO_DIMENSION = 1000 + +# Option codes for comment-form hidden fields. +PHOTOS_REQUIRED = 'pr' +PHOTOS_OPTIONAL = 'pa' +RATINGS_REQUIRED = 'rr' +RATINGS_OPTIONAL = 'ra' +IS_PUBLIC = 'ip' + +# What users get if they don't have any karma. +DEFAULT_KARMA = 5 +KARMA_NEEDED_BEFORE_DISPLAYED = 3 + + +class CommentManager(models.Manager): + def get_security_hash(self, options, photo_options, rating_options, target): + """ + Returns the MD5 hash of the given options (a comma-separated string such as + 'pa,ra') and target (something like 'lcom.eventtimes:5157'). Used to + validate that submitted form options have not been tampered-with. + """ + import md5 + return md5.new(options + photo_options + rating_options + target + settings.SECRET_KEY).hexdigest() + + def get_rating_options(self, rating_string): + """ + Given a rating_string, this returns a tuple of (rating_range, options). + >>> s = "scale:1-10|First_category|Second_category" + >>> Comment.objects.get_rating_options(s) + ([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], ['First category', 'Second category']) + """ + rating_range, options = rating_string.split('|', 1) + rating_range = range(int(rating_range[6:].split('-')[0]), int(rating_range[6:].split('-')[1])+1) + choices = [c.replace('_', ' ') for c in options.split('|')] + return rating_range, choices + + def get_list_with_karma(self, **kwargs): + """ + Returns a list of Comment objects matching the given lookup terms, with + _karma_total_good and _karma_total_bad filled. + """ + extra_kwargs = {} + extra_kwargs.setdefault('select', {}) + extra_kwargs['select']['_karma_total_good'] = 'SELECT COUNT(*) FROM comments_karmascore, comments_comment WHERE comments_karmascore.comment_id=comments_comment.id AND score=1' + extra_kwargs['select']['_karma_total_bad'] = 'SELECT COUNT(*) FROM comments_karmascore, comments_comment WHERE comments_karmascore.comment_id=comments_comment.id AND score=-1' + return self.filter(**kwargs).extra(**extra_kwargs) + + def user_is_moderator(self, user): + if user.is_superuser: + return True + for g in user.groups.all(): + if g.id == settings.COMMENTS_MODERATORS_GROUP: + return True + return False + + +class Comment(models.Model): + """A comment by a registered user.""" + user = models.ForeignKey(User) + content_type = models.ForeignKey(ContentType) + object_id = models.IntegerField(_('object ID')) + headline = models.CharField(_('headline'), max_length=255, blank=True) + comment = models.TextField(_('comment'), max_length=3000) + rating1 = models.PositiveSmallIntegerField(_('rating #1'), blank=True, null=True) + rating2 = models.PositiveSmallIntegerField(_('rating #2'), blank=True, null=True) + rating3 = models.PositiveSmallIntegerField(_('rating #3'), blank=True, null=True) + rating4 = models.PositiveSmallIntegerField(_('rating #4'), blank=True, null=True) + rating5 = models.PositiveSmallIntegerField(_('rating #5'), blank=True, null=True) + rating6 = models.PositiveSmallIntegerField(_('rating #6'), blank=True, null=True) + rating7 = models.PositiveSmallIntegerField(_('rating #7'), blank=True, null=True) + rating8 = models.PositiveSmallIntegerField(_('rating #8'), blank=True, null=True) + # This field designates whether to use this row's ratings in aggregate + # functions (summaries). We need this because people are allowed to post + # multiple reviews on the same thing, but the system will only use the + # latest one (with valid_rating=True) in tallying the reviews. + valid_rating = models.BooleanField(_('is valid rating')) + submit_date = models.DateTimeField(_('date/time submitted'), auto_now_add=True) + is_public = models.BooleanField(_('is public')) + ip_address = models.IPAddressField(_('IP address'), blank=True, null=True) + is_removed = models.BooleanField(_('is removed'), help_text=_('Check this box if the comment is inappropriate. A "This comment has been removed" message will be displayed instead.')) + site = models.ForeignKey(Site) + objects = CommentManager() + + class Meta: + verbose_name = _('comment') + verbose_name_plural = _('comments') + ordering = ('-submit_date',) + + def __unicode__(self): + return "%s: %s..." % (self.user.username, self.comment[:100]) + + def get_absolute_url(self): + try: + return self.get_content_object().get_absolute_url() + "#c" + str(self.id) + except AttributeError: + return "" + + def get_crossdomain_url(self): + return "/r/%d/%d/" % (self.content_type_id, self.object_id) + + def get_flag_url(self): + return "/comments/flag/%s/" % self.id + + def get_deletion_url(self): + return "/comments/delete/%s/" % self.id + + def get_content_object(self): + """ + Returns the object that this comment is a comment on. Returns None if + the object no longer exists. + """ + from django.core.exceptions import ObjectDoesNotExist + try: + return self.content_type.get_object_for_this_type(pk=self.object_id) + except ObjectDoesNotExist: + return None + + get_content_object.short_description = _('Content object') + + def _fill_karma_cache(self): + """Helper function that populates good/bad karma caches.""" + good, bad = 0, 0 + for k in self.karmascore_set: + if k.score == -1: + bad +=1 + elif k.score == 1: + good +=1 + self._karma_total_good, self._karma_total_bad = good, bad + + def get_good_karma_total(self): + if not hasattr(self, "_karma_total_good"): + self._fill_karma_cache() + return self._karma_total_good + + def get_bad_karma_total(self): + if not hasattr(self, "_karma_total_bad"): + self._fill_karma_cache() + return self._karma_total_bad + + def get_karma_total(self): + if not hasattr(self, "_karma_total_good") or not hasattr(self, "_karma_total_bad"): + self._fill_karma_cache() + return self._karma_total_good + self._karma_total_bad + + def get_as_text(self): + return _('Posted by %(user)s at %(date)s\n\n%(comment)s\n\nhttp://%(domain)s%(url)s') % \ + {'user': self.user.username, 'date': self.submit_date, + 'comment': self.comment, 'domain': self.site.domain, 'url': self.get_absolute_url()} + + +class FreeComment(models.Model): + """A comment by a non-registered user.""" + content_type = models.ForeignKey(ContentType) + object_id = models.IntegerField(_('object ID')) + comment = models.TextField(_('comment'), max_length=3000) + person_name = models.CharField(_("person's name"), max_length=50) + submit_date = models.DateTimeField(_('date/time submitted'), auto_now_add=True) + is_public = models.BooleanField(_('is public')) + ip_address = models.IPAddressField(_('ip address')) + # TODO: Change this to is_removed, like Comment + approved = models.BooleanField(_('approved by staff')) + site = models.ForeignKey(Site) + + class Meta: + verbose_name = _('free comment') + verbose_name_plural = _('free comments') + ordering = ('-submit_date',) + + def __unicode__(self): + return "%s: %s..." % (self.person_name, self.comment[:100]) + + def get_absolute_url(self): + try: + return self.get_content_object().get_absolute_url() + "#c" + str(self.id) + except AttributeError: + return "" + + def get_content_object(self): + """ + Returns the object that this comment is a comment on. Returns None if + the object no longer exists. + """ + from django.core.exceptions import ObjectDoesNotExist + try: + return self.content_type.get_object_for_this_type(pk=self.object_id) + except ObjectDoesNotExist: + return None + + get_content_object.short_description = _('Content object') + + +class KarmaScoreManager(models.Manager): + def vote(self, user_id, comment_id, score): + try: + karma = self.get(comment__pk=comment_id, user__pk=user_id) + except self.model.DoesNotExist: + karma = self.model(None, user_id=user_id, comment_id=comment_id, score=score, scored_date=datetime.datetime.now()) + karma.save() + else: + karma.score = score + karma.scored_date = datetime.datetime.now() + karma.save() + + def get_pretty_score(self, score): + """ + Given a score between -1 and 1 (inclusive), returns the same score on a + scale between 1 and 10 (inclusive), as an integer. + """ + if score is None: + return DEFAULT_KARMA + return int(round((4.5 * score) + 5.5)) + + +class KarmaScore(models.Model): + user = models.ForeignKey(User) + comment = models.ForeignKey(Comment) + score = models.SmallIntegerField(_('score'), db_index=True) + scored_date = models.DateTimeField(_('score date'), auto_now=True) + objects = KarmaScoreManager() + + class Meta: + verbose_name = _('karma score') + verbose_name_plural = _('karma scores') + unique_together = (('user', 'comment'),) + + def __unicode__(self): + return _("%(score)d rating by %(user)s") % {'score': self.score, 'user': self.user} + + +class UserFlagManager(models.Manager): + def flag(self, comment, user): + """ + Flags the given comment by the given user. If the comment has already + been flagged by the user, or it was a comment posted by the user, + nothing happens. + """ + if int(comment.user_id) == int(user.id): + return # A user can't flag his own comment. Fail silently. + try: + f = self.get(user__pk=user.id, comment__pk=comment.id) + except self.model.DoesNotExist: + from django.core.mail import mail_managers + f = self.model(None, user.id, comment.id, None) + message = _('This comment was flagged by %(user)s:\n\n%(text)s') % {'user': user.username, 'text': comment.get_as_text()} + mail_managers('Comment flagged', message, fail_silently=True) + f.save() + + +class UserFlag(models.Model): + user = models.ForeignKey(User) + comment = models.ForeignKey(Comment) + flag_date = models.DateTimeField(_('flag date'), auto_now_add=True) + objects = UserFlagManager() + + class Meta: + verbose_name = _('user flag') + verbose_name_plural = _('user flags') + unique_together = (('user', 'comment'),) + + def __unicode__(self): + return _("Flag by %r") % self.user + + +class ModeratorDeletion(models.Model): + user = models.ForeignKey(User, verbose_name='moderator') + comment = models.ForeignKey(Comment) + deletion_date = models.DateTimeField(_('deletion date'), auto_now_add=True) + + class Meta: + verbose_name = _('moderator deletion') + verbose_name_plural = _('moderator deletions') + unique_together = (('user', 'comment'),) + + def __unicode__(self): + return _("Moderator deletion by %r") % self.user + +# Register the admin options for these models. +# TODO: Maybe this should live in a separate module admin.py, but how would we +# ensure that module was loaded? + +from django.contrib import admin + +class CommentAdmin(admin.ModelAdmin): + fieldsets = ( + (None, {'fields': ('content_type', 'object_id', 'site')}), + ('Content', {'fields': ('user', 'headline', 'comment')}), + ('Ratings', {'fields': ('rating1', 'rating2', 'rating3', 'rating4', 'rating5', 'rating6', 'rating7', 'rating8', 'valid_rating')}), + ('Meta', {'fields': ('is_public', 'is_removed', 'ip_address')}), + ) + list_display = ('user', 'submit_date', 'content_type', 'get_content_object') + list_filter = ('submit_date',) + date_hierarchy = 'submit_date' + search_fields = ('comment', 'user__username') + raw_id_fields = ('user',) + +class FreeCommentAdmin(admin.ModelAdmin): + fieldsets = ( + (None, {'fields': ('content_type', 'object_id', 'site')}), + ('Content', {'fields': ('person_name', 'comment')}), + ('Meta', {'fields': ('is_public', 'ip_address', 'approved')}), + ) + list_display = ('person_name', 'submit_date', 'content_type', 'get_content_object') + list_filter = ('submit_date',) + date_hierarchy = 'submit_date' + search_fields = ('comment', 'person_name') + +admin.site.register(Comment, CommentAdmin) +admin.site.register(FreeComment, FreeCommentAdmin) + +# -*- coding: utf-8 -*- +#------------------------------------------------------------ +# tvspot - XBMC Add-on by Juarrox (juarrox@gmail.com) +# Version 0.2.9 (18.07.2014) +#------------------------------------------------------------ +# License: GPL (http://www.gnu.org/licenses/gpl-3.0.html) +# Gracias a la librería plugintools de Jesús (www.mimediacenter.info) + + +import os +import sys +import urllib +import urllib2 +import re +import shutil +import zipfile + +import xbmc +import xbmcgui +import xbmcaddon +import xbmcplugin + +import plugintools + + + +home = xbmc.translatePath(os.path.join('special://home/addons/plugin.video.tvspot/', '')) +tools = xbmc.translatePath(os.path.join('special://home/addons/plugin.video.tvspot/resources/tools', '')) +addons = xbmc.translatePath(os.path.join('special://home/addons/', '')) +art = xbmc.translatePath(os.path.join('special://home/addons/plugin.video.tvspot/art', '')) +tmp = xbmc.translatePath(os.path.join('special://home/addons/plugin.video.tvspot/tmp', '')) +playlists = xbmc.translatePath(os.path.join('special://home/addons/playlists', '')) + +icon = art + 'icon.png' +fanart = 'fanart.jpg' + + + +def resolve_iguide(params): + plugintools.log("[tvspot 4.0].resolve_iguide " + repr(params) ) + + url = params.get("url") + url = url.strip() + # plugintools.log("URL antes de resolver= " + url) + + iguide_palco = {"rtmp": "rtmp://live2.iguide.to/redirect","swfurl": "http://cdn1.iguide.to/player/secure_player_iguide_embed_token.swf" , "pageurl": "http://www.iguide.to/", "token":'#ed%h0#w18623jsda6523lDGD'} + iguide_user = {"rtmp": "","swfurl": "" , "pageurl": "", "token":""} + + url_extracted = url.split(" ") + for entry in url_extracted: + if entry.startswith("rtmp"): + entry = entry.replace("rtmp=", "") + entry = entry.replace("rtmp://$OPT:rtmp-raw=", "") + iguide_user["rtmp"]=entry + elif entry.startswith("playpath"): + entry = entry.replace("playpath=", "") + iguide_user["playpath"]=entry + elif entry.startswith("swfUrl"): + entry = entry.replace("swfUrl=", "") + iguide_user["swfurl"]=entry + elif entry.startswith("pageUrl"): + entry = entry.replace("pageUrl=", "") + iguide_user["pageurl"]=entry + elif entry.startswith("token"): + entry = entry.replace("token=", "") + iguide_user["token"]=entry + + if url.endswith("Conn=S:OK") == True: + # plugintools.log("No tiene sufijo. Lo añadimos... ") + url = url.replace("Conn=S:OK", "") + + if url.startswith("rtmp://$OPT") == True: + # plugintools.log("No tiene prefijo. Lo añadimos... ") + url = url.replace("rtmp://$OPT:rtmp-raw=", "") + + plugintools.log("URL Iguide= " + url) + params["url"] = url + play_iguide(iguide_palco, iguide_user) + + + +def resolve_ucaster(params): + plugintools.log("[tvspot 4.0].resolve_ucaster " + repr(params) ) + + url = params.get("url") + url = url.strip() + plugintools.log("URL antes de resolver= " + url) + + if url.endswith("Conn=S:OK") == False: + plugintools.log("No tiene sufijo. Lo añadimos... ") + url = url + " Conn=S:OK" + + if url.startswith("rtmp://$OPT") == True: + plugintools.log("No tiene prefijo. Lo añadimos... ") + url = "rtmp://$OPT:rtmp-raw=" + url + + + plugintools.log("URL Ucaster= " + url) + params["url"] = url + return params + + +def play_iguide(iguide_palco, iguide_user): + plugintools.log("[tvspot 4.0].iGuide tvspot= " + repr(iguide_palco) ) + plugintools.log("[tvspot 4.0].iGuide User= " + repr(iguide_user) ) + + playlist = xbmc.PlayList( xbmc.PLAYLIST_VIDEO ) + playlist.clear() + + url = iguide_user.get("rtmp") + " playpath=" + iguide_user.get("playpath") + " swfUrl=" + iguide_user.get("swfurl") + " live=1 pageUrl=" + iguide_user.get("pageurl") + " token=" + iguide_user.get("token") + url_user = iguide_user.get("rtmp") + " playpath=" + iguide_user.get("playpath") + " swfUrl=" + iguide_user.get("swfurl") + " live=1 pageUrl=" + iguide_user.get("pageurl") + " token=" + iguide_user.get("token") + url_palco = iguide_palco.get("rtmp") + " playpath=" + iguide_user.get("playpath") + " swfUrl=" + iguide_palco.get("swfurl") + " live=1 pageUrl=" + iguide_user.get("pageurl") + " token=" + iguide_palco.get("token") + url_refixed = iguide_palco.get("rtmp") + " playpath=" + iguide_user.get("playpath") + " swfUrl=" + iguide_palco.get("swfurl") + " live=1 pageUrl=" + iguide_palco.get("pageurl") + " token=" + iguide_palco.get("token") + " Conn=S:OK" + + msg = "Resolviendo enlace ... " + xbmc.executebuiltin("Notification(%s,%s,%i,%s)" % ('tvspot', msg, 3 , art+'icon.png')) + + playlist.add(url_user) + plugintools.log("[tvspot 0.2.87b playing URL playlist... "+url_palco) + playlist.add(url_palco) + plugintools.log("[tvspot 0.2.87b fixing URL by tvspot... "+url_refixed) + playlist.add(url_refixed) + plugintools.log("[tvspot 0.2.87b parsing URL... "+url_user) + # xbmc.Player( xbmc.PLAYER_CORE_MPLAYER ).play(playlist) + + +from __future__ import unicode_literals + +import re +from unittest import TestCase + +from django import forms +from django.core import validators +from django.core.exceptions import ValidationError + + +class UserForm(forms.Form): + full_name = forms.CharField( + max_length=50, + validators=[ + validators.validate_integer, + validators.validate_email, + ] + ) + string = forms.CharField( + max_length=50, + validators=[ + validators.RegexValidator( + regex='^[a-zA-Z]*$', + message="Letters only.", + ) + ] + ) + ignore_case_string = forms.CharField( + max_length=50, + validators=[ + validators.RegexValidator( + regex='^[a-z]*$', + message="Letters only.", + flags=re.IGNORECASE, + ) + ] + + ) + + +class TestFieldWithValidators(TestCase): + def test_all_errors_get_reported(self): + form = UserForm({'full_name': 'not int nor mail', 'string': '2 is not correct', 'ignore_case_string': "IgnORE Case strIng"}) + self.assertRaises(ValidationError, form.fields['full_name'].clean, 'not int nor mail') + + try: + form.fields['full_name'].clean('not int nor mail') + except ValidationError as e: + self.assertEqual(2, len(e.messages)) + + self.assertFalse(form.is_valid()) + self.assertEqual(form.errors['string'], ["Letters only."]) + self.assertEqual(form.errors['string'], ["Letters only."]) + +import numpy as np + +from pycqed.simulations import chevron_sim as chs + + +class TestChevronSim: + + @classmethod + def setup_class(cls): + cls.e_min = -0.0322 + cls.e_max = 0.0322 + cls.e_points = 20 + cls.time_stop = 60 + cls.time_step = 4 + cls.bias_tee = lambda self, t, a, b, c: t * a ** 2 + t * b + c + + # self.distortion = lambda t: self.lowpass_s(t, 2) + cls.distortion = lambda self, t: self.bias_tee(t, 0., 2e-5, 1) + + cls.time_vec = np.arange(0., cls.time_stop, cls.time_step) + cls.freq_vec = np.linspace(cls.e_min, cls.e_max, cls.e_points) + + def test_output_shape(self): + """ + Trivial test that just checks if there is nothing that broke the + chevron sims in a way that breaks it. + """ + + result = chs.chevron(2.*np.pi*(6.552 - 4.8), + self.e_min, self.e_max, + self.e_points, + np.pi*0.0385, + self.time_stop, + self.time_step, + self.distortion) + assert np.shape(result) == (len(self.freq_vec), len(self.time_vec)+1) + +# -*- coding: utf-8 -*- +# +# ----------------------------------------------------------------------------------- +# Copyright (c) Microsoft Open Technologies (Shanghai) Co. Ltd. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# ----------------------------------------------------------------------------------- + +import sys + +sys.path.append("..") + +from hackathon import ( + RequiredFeature, + Component, + Context, +) +from hackathon.database.models import ( + Experiment, + DockerContainer, + HackathonAzureKey, + PortBinding, + DockerHostServer, +) +from hackathon.constants import ( + EStatus, + PortBindingType, + VEStatus, + HEALTH, +) +from compiler.ast import ( + flatten, +) +from threading import ( + Lock, +) +from hackathon.template.docker_template_unit import ( + DockerTemplateUnit, +) +from hackathon.azureformation.endpoint import ( + Endpoint +) +from docker_formation_base import ( + DockerFormationBase, +) +from hackathon.azureformation.service import ( + Service, +) +from hackathon.hackathon_response import ( + internal_server_error +) +from hackathon.constants import ( + HEALTH_STATUS, +) +import json +import requests +from datetime import timedelta + + +class HostedDockerFormation(DockerFormationBase, Component): + template_manager = RequiredFeature("template_manager") + hackathon_manager = RequiredFeature("hackathon_manager") + scheduler = RequiredFeature("scheduler") + """ + Docker resource management based on docker remote api v1.18 + Host resource are required. Azure key required in case of azure. + """ + application_json = {'content-type': 'application/json'} + host_ports = [] + host_port_max_num = 30 + docker_host_manager = RequiredFeature("docker_host_manager") + + def __init__(self): + self.lock = Lock() + + def report_health(self): + """Report health of DockerHostServers + + :rtype: dict + :return health status item of docker. OK when all servers running, Warning if some of them working, Error if no server running + """ + try: + hosts = self.db.find_all_objects(DockerHostServer) + alive = 0 + for host in hosts: + if self.ping(host): + alive += 1 + if alive == len(hosts): + return { + HEALTH.STATUS: HEALTH_STATUS.OK + } + elif alive > 0: + return { + HEALTH.STATUS: HEALTH_STATUS.WARNING, + HEALTH.DESCRIPTION: 'at least one docker host servers are down' + } + else: + return { + HEALTH.STATUS: HEALTH_STATUS.ERROR, + HEALTH.DESCRIPTION: 'all docker host servers are down' + } + except Exception as e: + return { + HEALTH.STATUS: HEALTH_STATUS.ERROR, + HEALTH.DESCRIPTION: e.message + } + + def get_available_host_port(self, docker_host, private_port): + """ + We use double operation to ensure ports not conflicted, first we get ports from host machine, but in multiple + threads situation, the interval between two requests is too short, maybe the first thread do not get port + ended, so the host machine don't update ports in time, thus the second thread may get the same port. + To avoid this condition, we use static variable host_ports to cache the latest host_port_max_num ports. + Every thread visit variable host_ports is synchronized. + To save space, we will release the ports if the number over host_port_max_num. + :param docker_host: + :param private_port: + :return: + """ + self.log.debug("try to assign docker port %d on server %r" % (private_port, docker_host)) + containers = self.__containers_info(docker_host) + host_ports = flatten(map(lambda p: p['Ports'], containers)) + + # todo if azure return -1 + def sub(port): + return port["PublicPort"] if "PublicPort" in port else -1 + + host_public_ports = map(lambda x: sub(x), host_ports) + return self.__get_available_host_port(host_public_ports, private_port) + + def stop(self, name, **kwargs): + """ + stop a container + :param name: container's name + :param docker_host: host machine where container running + :return: + """ + container = kwargs["container"] + expr_id = kwargs["expr_id"] + docker_host = self.docker_host_manager.get_host_server_by_id(container.host_server_id) + if self.__get_container(name, docker_host) is not None: + containers_url = '%s/containers/%s/stop' % (self.get_vm_url(docker_host), name) + req = requests.post(containers_url) + self.log.debug(req.content) + self.__stop_container(expr_id, container, docker_host) + + def delete(self, name, **kwargs): + """ + delete a container + :param name: + :param docker_host: + :return: + """ + container = kwargs["container"] + expr_id = kwargs["expr_id"] + docker_host = self.docker_host_manager.get_host_server_by_id(container.host_server_id) + containers_url = '%s/containers/%s?force=1' % (self.get_vm_url(docker_host), name) + req = requests.delete(containers_url) + self.log.debug(req.content) + + self.__stop_container(expr_id, container, docker_host) + + def start(self, unit, **kwargs): + """ + In this function, we create a container and then start a container + :param unit: docker template unit + :param docker_host: + :return: + """ + virtual_environment = kwargs["virtual_environment"] + hackathon = kwargs["hackathon"] + experiment = kwargs["experiment"] + container_name = unit.get_name() + host_server = self.docker_host_manager.get_available_docker_host(1, hackathon) + + container = DockerContainer(experiment, + name=container_name, + host_server_id=host_server.id, + virtual_environment=virtual_environment, + image=unit.get_image_with_tag()) + self.db.add_object(container) + self.db.commit() + + # port binding + ps = map(lambda p: + [p.port_from, p.port_to], + self.__assign_ports(experiment, host_server, virtual_environment, unit.get_ports())) + + # guacamole config + guacamole = unit.get_remote() + port_cfg = filter(lambda p: + p[DockerTemplateUnit.PORTS_PORT] == guacamole[DockerTemplateUnit.REMOTE_PORT], + unit.get_ports()) + if len(port_cfg) > 0: + gc = { + "displayname": container_name, + "name": container_name, + "protocol": guacamole[DockerTemplateUnit.REMOTE_PROTOCOL], + "hostname": host_server.public_ip, + "port": port_cfg[0]["public_port"] + } + if DockerTemplateUnit.REMOTE_USERNAME in guacamole: + gc["username"] = guacamole[DockerTemplateUnit.REMOTE_USERNAME] + if DockerTemplateUnit.REMOTE_PASSWORD in guacamole: + gc["password"] = guacamole[DockerTemplateUnit.REMOTE_PASSWORD] + # save guacamole config into DB + virtual_environment.remote_paras = json.dumps(gc) + + exist = self.__get_container(container_name, host_server) + if exist is not None: + container.container_id = exist["Id"] + host_server.container_count += 1 + self.db.commit() + else: + container_config = unit.get_container_config() + # create container + try: + container_create_result = self.__create(host_server, container_config, container_name) + except Exception as e: + self.log.error(e) + self.log.error("container %s fail to create" % container_name) + return None + container.container_id = container_create_result["Id"] + # start container + try: + self.__start(host_server, container_create_result["Id"]) + host_server.container_count += 1 + self.db.commit() + except Exception as e: + self.log.error(e) + self.log.error("container %s fail to start" % container["Id"]) + return None + # check + if self.__get_container(container_name, host_server) is None: + self.log.error( + "container %s has started, but can not find it in containers' info, maybe it exited again." + % container_name) + return None + + self.log.debug("starting container %s is ended ... " % container_name) + virtual_environment.status = VEStatus.RUNNING + self.db.commit() + return container + + def get_vm_url(self, docker_host): + return 'http://%s:%d' % (docker_host.public_dns, docker_host.public_docker_api_port) + + def pull_image(self, context): + docker_host, image_name, tag = context.docker_host, context.image_name, context.tag + pull_image_url = self.get_vm_url(docker_host) + "/images/create?fromImage=" + image_name + '&tag=' + tag + self.log.debug(" send request to pull image:" + pull_image_url) + return requests.post(pull_image_url) + + def get_pulled_images(self, docker_host): + get_images_url = self.get_vm_url(docker_host) + "/images/json?all=0" + current_images_info = json.loads(requests.get(get_images_url).content) # [{},{},{}] + current_images_tags = map(lambda x: x['RepoTags'], current_images_info) # [[],[],[]] + return flatten(current_images_tags) # [ imange:tag, image:tag ] + + def ensure_images(self): + hackathons = self.hackathon_manager.get_online_hackathons() + map(lambda h: self.__ensure_images_for_hackathon(h), hackathons) + + def check_container_status_is_normal(self, docker_container): + """check container's running status on docker host + + if status is Running or Restarting returns True , else returns False + + :type docker_container: DockerContainer + :param docker_container: the container that you want to check + + :type boolean + :return True: the container running status is running or restarting , else returns False + + """ + docker_host = self.db.find_first_object_by(DockerHostServer, id=docker_container.host_server_id) + if docker_host is not None: + container_info = self.__get_container_info_by_container_id(docker_host, docker_container.container_id) + if container_info is None: + return False + return container_info['State']['Running'] or container_info['State']['Restarting'] + else: + return False + + def ping(self, docker_host): + """Ping docker host to check running status + + :type docker_host : DockerHostServer + :param docker_host: the hots that you want to check docker service running status + + :type boolean + :return: True: running status is OK, else return False + + """ + try: + ping_url = '%s/_ping' % self.__get_vm_url(docker_host) + req = requests.get(ping_url) + self.log.debug(req.content) + return req.status_code == 200 and req.content == 'OK' + except Exception as e: + self.log.error(e) + return False + + # --------------------------------------------- helper function ---------------------------------------------# + + def __name_match(self, id, lists): + for list in lists: + if id in list: + return True + return False + + def __get_schedule_job_id(self, hackathon): + return "pull_images_for_hackathon_%s" % hackathon.id + + def __ensure_images_for_hackathon(self, hackathon): + # only ensure those alauda is disabled + if hackathon.is_alauda_enabled(): + self.log.debug("schedule job of hackathon '%s(%d)' removed for alauda enabled" % + (hackathon.name, hackathon.id)) + self.scheduler.remove_job(self.__get_schedule_job_id(hackathon)) + return + + self.log.debug("adding schedule job to ensure images for hackathon [%d]%s" % (hackathon.id, hackathon.name)) + next_run_time = self.util.get_now() + timedelta(seconds=3) + context = Context(hackathon_id=hackathon.id) + self.scheduler.add_interval(feature="template_manager", + method="pull_images_for_hackathon", + id=self.__get_schedule_job_id(hackathon), + context=context, + next_run_time=next_run_time, + minutes=60) + + def __get_vm_url(self, docker_host): + return 'http://%s:%d' % (docker_host.public_dns, docker_host.public_docker_api_port) + + def __clear_ports_cache(self): + """ + cache ports, if ports' number more than host_port_max_num, release the ports. + But if there is a thread apply new ports, we will do this operation in the next loop. + Because the host machine do not update the ports information, + if we release ports now, the new ports will be lost. + :return: + """ + num = self.db.count(Experiment, Experiment.status == EStatus.STARTING) + if num > 0: + self.log.debug("there are %d experiment is starting, host ports will updated in next loop" % num) + return + self.log.debug("-----release ports cache successfully------") + self.host_ports = [] + + def __stop_container(self, expr_id, container, docker_host): + self.__release_ports(expr_id, docker_host) + docker_host.container_count -= 1 + if docker_host.container_count < 0: + docker_host.container_count = 0 + self.db.commit() + + def __containers_info(self, docker_host): + containers_url = '%s/containers/json' % self.get_vm_url(docker_host) + req = requests.get(containers_url) + self.log.debug(req.content) + return self.util.convert(json.loads(req.content)) + + def __get_available_host_port(self, port_bindings, port): + """ + simple lock mechanism, visit static variable ports synchronize, because port_bindings is not in real-time, + so we should cache the latest ports, when the cache ports number is more than host_port_max_num, + we will release it to save space. + :param port_bindings: + :param port: + :return: + """ + self.lock.acquire() + try: + host_port = port + 10000 + while host_port in port_bindings or host_port in self.host_ports: + host_port += 1 + if host_port >= 65535: + self.log.error("port used up on this host server") + raise Exception("no port available") + if len(self.host_ports) >= self.host_port_max_num: + self.__clear_ports_cache() + self.host_ports.append(host_port) + self.log.debug("host_port is %d " % host_port) + return host_port + finally: + self.lock.release() + + def __get_container(self, name, docker_host): + containers = self.__containers_info(docker_host) + return next((c for c in containers if name in c["Names"] or '/' + name in c["Names"]), None) + + def __create(self, docker_host, container_config, container_name): + """ + only create a container, in this step, we cannot start a container. + :param docker_host: + :param container_config: + :param container_name: + :return: + """ + containers_url = '%s/containers/create?name=%s' % (self.get_vm_url(docker_host), container_name) + req = requests.post(containers_url, data=json.dumps(container_config), headers=self.application_json) + self.log.debug(req.content) + container = json.loads(req.content) + if container is None: + raise AssertionError("container is none") + return container + + def __start(self, docker_host, container_id): + """ + start a container + :param docker_host: + :param container_id: + :return: + """ + url = '%s/containers/%s/start' % (self.get_vm_url(docker_host), container_id) + req = requests.post(url, headers=self.application_json) + self.log.debug(req.content) + + def __get_available_public_ports(self, expr_id, host_server, host_ports): + self.log.debug("starting to get azure ports") + ep = Endpoint(Service(self.load_azure_key_id(expr_id))) + host_server_name = host_server.vm_name + host_server_dns = host_server.public_dns.split('.')[0] + public_endpoints = ep.assign_public_endpoints(host_server_dns, 'Production', host_server_name, host_ports) + if not isinstance(public_endpoints, list): + self.log.debug("failed to get public ports") + return internal_server_error('cannot get public ports') + self.log.debug("public ports : %s" % public_endpoints) + return public_endpoints + + def load_azure_key_id(self, expr_id): + expr = self.db.get_object(Experiment, expr_id) + hak = self.db.find_first_object_by(HackathonAzureKey, hackathon_id=expr.hackathon_id) + return hak.azure_key_id + + def __assign_ports(self, expr, host_server, ve, port_cfg): + """ + assign ports from host server + :param expr: + :param host_server: + :param ve: + :param port_cfg: + :return: + """ + # get 'host_port' + map(lambda p: + p.update( + {DockerTemplateUnit.PORTS_HOST_PORT: self.get_available_host_port(host_server, p[ + DockerTemplateUnit.PORTS_PORT])} + ), + port_cfg) + + # get 'public' cfg + public_ports_cfg = filter(lambda p: DockerTemplateUnit.PORTS_PUBLIC in p, port_cfg) + host_ports = [u[DockerTemplateUnit.PORTS_HOST_PORT] for u in public_ports_cfg] + if self.util.safe_get_config("environment", "prod") == "local": + map(lambda cfg: cfg.update({DockerTemplateUnit.PORTS_PUBLIC_PORT: cfg[DockerTemplateUnit.PORTS_HOST_PORT]}), + public_ports_cfg) + else: + public_ports = self.__get_available_public_ports(expr.id, host_server, host_ports) + for i in range(len(public_ports_cfg)): + public_ports_cfg[i][DockerTemplateUnit.PORTS_PUBLIC_PORT] = public_ports[i] + + binding_dockers = [] + + # update port binding + for public_cfg in public_ports_cfg: + binding_cloud_service = PortBinding(name=public_cfg[DockerTemplateUnit.PORTS_NAME], + port_from=public_cfg[DockerTemplateUnit.PORTS_PUBLIC_PORT], + port_to=public_cfg[DockerTemplateUnit.PORTS_HOST_PORT], + binding_type=PortBindingType.CLOUD_SERVICE, + binding_resource_id=host_server.id, + virtual_environment=ve, + experiment=expr, + url=public_cfg[DockerTemplateUnit.PORTS_URL] + if DockerTemplateUnit.PORTS_URL in public_cfg else None) + binding_docker = PortBinding(name=public_cfg[DockerTemplateUnit.PORTS_NAME], + port_from=public_cfg[DockerTemplateUnit.PORTS_HOST_PORT], + port_to=public_cfg[DockerTemplateUnit.PORTS_PORT], + binding_type=PortBindingType.DOCKER, + binding_resource_id=host_server.id, + virtual_environment=ve, + experiment=expr) + binding_dockers.append(binding_docker) + self.db.add_object(binding_cloud_service) + self.db.add_object(binding_docker) + self.db.commit() + + local_ports_cfg = filter(lambda p: DockerTemplateUnit.PORTS_PUBLIC not in p, port_cfg) + for local_cfg in local_ports_cfg: + port_binding = PortBinding(name=local_cfg[DockerTemplateUnit.PORTS_NAME], + port_from=local_cfg[DockerTemplateUnit.PORTS_HOST_PORT], + port_to=local_cfg[DockerTemplateUnit.PORTS_PORT], + binding_type=PortBindingType.DOCKER, + binding_resource_id=host_server.id, + virtual_environment=ve, + experiment=expr) + binding_dockers.append(port_binding) + self.db.add_object(port_binding) + self.db.commit() + return binding_dockers + + def __release_ports(self, expr_id, host_server): + """ + release the specified experiment's ports + """ + self.log.debug("Begin to release ports: expr_id: %d, host_server: %r" % (expr_id, host_server)) + ports_binding = self.db.find_all_objects_by(PortBinding, experiment_id=expr_id) + if ports_binding is not None: + docker_binding = filter( + lambda u: self.util.safe_get_config("environment", "prod") != "local" and u.binding_type == 1, + ports_binding) + ports_to = [d.port_to for d in docker_binding] + if len(ports_to) != 0: + self.__release_public_ports(expr_id, host_server, ports_to) + for port in ports_binding: + self.db.delete_object(port) + self.db.commit() + self.log.debug("End to release ports: expr_id: %d, host_server: %r" % (expr_id, host_server)) + + def __release_public_ports(self, expr_id, host_server, host_ports): + ep = Endpoint(Service(self.load_azure_key_id(expr_id))) + host_server_name = host_server.vm_name + host_server_dns = host_server.public_dns.split('.')[0] + self.log.debug("starting to release ports ... ") + ep.release_public_endpoints(host_server_dns, 'Production', host_server_name, host_ports) + + def __get_container_info_by_container_id(self, docker_host, container_id): + """get a container info by container_id from a docker host + + :type docker_host: str|unicode + :param: the docker host which you want to search container from + + :type container_id: str|unicode + :param as a parameter that you want to search container though docker remote API + + :return dic object of the container info if not None + """ + try: + get_container_url = self.get_vm_url(docker_host) + "/container/%s/json?all=0" % container_id + req = requests.get(get_container_url) + if req.status_code >= 200 and req.status_code < 300 : + container_info = json.loads(req.content) + return container_info + return None + except Exception as ex: + self.log.error(ex) + return None + +# +# ElementTree +# $Id: SimpleXMLTreeBuilder.py 3225 2007-08-27 21:32:08Z fredrik $ +# +# A simple XML tree builder, based on Python's xmllib +# +# Note that due to bugs in xmllib, this builder does not fully support +# namespaces (unqualified attributes are put in the default namespace, +# instead of being left as is). Run this module as a script to find +# out if this affects your Python version. +# +# history: +# 2001-10-20 fl created +# 2002-05-01 fl added namespace support for xmllib +# 2002-08-17 fl added xmllib sanity test +# +# Copyright (c) 1999-2004 by Fredrik Lundh. All rights reserved. +# +# fredrik@pythonware.com +# http://www.pythonware.com +# +# -------------------------------------------------------------------- +# The ElementTree toolkit is +# +# Copyright (c) 1999-2007 by Fredrik Lundh +# +# By obtaining, using, and/or copying this software and/or its +# associated documentation, you agree that you have read, understood, +# and will comply with the following terms and conditions: +# +# Permission to use, copy, modify, and distribute this software and +# its associated documentation for any purpose and without fee is +# hereby granted, provided that the above copyright notice appears in +# all copies, and that both that copyright notice and this permission +# notice appear in supporting documentation, and that the name of +# Secret Labs AB or the author not be used in advertising or publicity +# pertaining to distribution of the software without specific, written +# prior permission. +# +# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD +# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- +# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR +# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY +# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. +# -------------------------------------------------------------------- + +## +# Tools to build element trees from XML files, using xmllib. +# This module can be used instead of the standard tree builder, for +# Python versions where "expat" is not available (such as 1.5.2). +#

+# Note that due to bugs in xmllib, the namespace support is +# not reliable (you can run the module as a script to find out exactly +# how unreliable it is on your Python version). +## + +import xmllib, string + +import ElementTree + +## +# ElementTree builder for XML source data. +# +# @see elementtree.ElementTree + +class TreeBuilder(xmllib.XMLParser): + + def __init__(self, html=0, target=None, encoding=None): + self.__builder = ElementTree.TreeBuilder() + if html: + import htmlentitydefs + self.entitydefs.update(htmlentitydefs.entitydefs) + xmllib.XMLParser.__init__(self) + + ## + # Feeds data to the parser. + # + # @param data Encoded data. + + def feed(self, data): + xmllib.XMLParser.feed(self, data) + + ## + # Finishes feeding data to the parser. + # + # @return An element structure. + # @defreturn Element + + def close(self): + xmllib.XMLParser.close(self) + return self.__builder.close() + + def handle_data(self, data): + self.__builder.data(data) + + handle_cdata = handle_data + + def unknown_starttag(self, tag, attrs): + attrib = {} + for key, value in attrs.items(): + attrib[fixname(key)] = value + self.__builder.start(fixname(tag), attrib) + + def unknown_endtag(self, tag): + self.__builder.end(fixname(tag)) + + +def fixname(name, split=string.split): + # xmllib in 2.0 and later provides limited (and slightly broken) + # support for XML namespaces. + if " " not in name: + return name + return "{%s}%s" % tuple(split(name, " ", 1)) + + +if __name__ == "__main__": + import sys + # sanity check: look for known namespace bugs in xmllib + p = TreeBuilder() + text = """\ + + + + """ + p.feed(text) + tree = p.close() + status = [] + # check for bugs in the xmllib implementation + tag = tree.find("{default}tag") + if tag is None: + status.append("namespaces not supported") + if tag is not None and tag.get("{default}attribute"): + status.append("default namespace applied to unqualified attribute") + # report bugs + if status: + print "xmllib doesn't work properly in this Python version:" + for bug in status: + print "-", bug + else: + print "congratulations; no problems found in xmllib" + +from __future__ import absolute_import, print_function, unicode_literals, division +from time import sleep + +# This file is part of the ISIS IBEX application. +# Copyright (C) 2012-2016 Science & Technology Facilities Council. +# All rights reserved. +# +# This program is distributed in the hope that it will be useful. +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v1.0 which accompanies this distribution. +# EXCEPT AS EXPRESSLY SET FORTH IN THE ECLIPSE PUBLIC LICENSE V1.0, THE PROGRAM +# AND ACCOMPANYING MATERIALS ARE PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES +# OR CONDITIONS OF ANY KIND. See the Eclipse Public License v1.0 for more details. +# +# You should have received a copy of the Eclipse Public License v1.0 +# along with this program; if not, you can obtain a copy from +# https://www.eclipse.org/org/documents/epl-v10.php or +# http://opensource.org/licenses/eclipse-1.0.php +from BlockServer.core.macros import MACROS +from server_common.utilities import print_and_log +from concurrent.futures import ThreadPoolExecutor + +# Number of threads to serve caputs +NUMBER_OF_CAPUT_THREADS = 20 + +try: + from genie_python.channel_access_exceptions import UnableToConnectToPVException, ReadAccessException +except ImportError: + class UnableToConnectToPVException(IOError): + """ + The system is unable to connect to a PV for some reason. + """ + def __init__(self, pv_name, err): + super(UnableToConnectToPVException, self).__init__("Unable to connect to PV {0}: {1}".format(pv_name, err)) + + class ReadAccessException(IOError): + """ + PV exists but its value is unavailable to read. + """ + + def __init__(self, pv_name): + super(ReadAccessException, self).__init__("Read access denied for PV {}".format(pv_name)) + +try: + # noinspection PyUnresolvedReferences + from genie_python.genie_cachannel_wrapper import CaChannelWrapper, EXIST_TIMEOUT +except ImportError: + print("ERROR: No genie_python on the system can not import CaChannelWrapper!") + +try: + from genie_python.genie_cachannel_wrapper import AlarmSeverity, AlarmCondition as AlarmStatus +except ImportError: + from enum import IntEnum + + + class AlarmSeverity(IntEnum): + """ + Enum for severity of alarm + """ + No = 0 + Minor = 1 + Major = 2 + Invalid = 3 + + + class AlarmStatus(IntEnum): + """ + Enum for status of alarm + """ + BadSub = 16 + Calc = 12 + Comm = 9 + Cos = 8 + Disable = 18 + High = 4 + HiHi = 3 + HwLimit = 11 + Link = 14 + Lolo = 5 + Low = 6 + No = 0 + Read = 1 + ReadAccess = 20 + Scam = 13 + Simm = 19 + Soft = 15 + State = 7 + Timeout = 10 + UDF = 17 + Write = 2 + WriteAccess = 21 + + +def _create_caput_pool(): + """ + Returns: thread pool for the caputs, making sure it works for older versions of python + """ + try: + executor = ThreadPoolExecutor(max_workers=NUMBER_OF_CAPUT_THREADS, thread_name_prefix="ChannelAccess_Pool") + except TypeError: + executor = ThreadPoolExecutor(max_workers=NUMBER_OF_CAPUT_THREADS) + print("WARNING: thread_name_prefix does not exist for ThreadPoolExecutor in this python, " + "caput pool has generic name.") + return executor + + +class ChannelAccess(object): + # Create a thread poll so that threads are reused and so ca contexts that each thread gets are shared. This also + # caps the number of ca library threads. 20 is chosen as being probably enough but limited. + thread_pool = _create_caput_pool() + + @staticmethod + def wait_for_tasks(): + """ + Wait for all requested tasks to complete, i.e. all caputs. + + It does this by shutting down the current threadpool waiting for all tasks to complete and then create a new + pool. + """ + ChannelAccess.thread_pool.shutdown() + ChannelAccess.thread_pool = _create_caput_pool() + + @staticmethod + def caget(name, as_string=False, timeout=None): + """Uses CaChannelWrapper from genie_python to get a pv value. We import CaChannelWrapper when used as this means + the tests can run without having genie_python installed + + Args: + name (string): The name of the PV to be read + as_string (bool, optional): Set to read a char array as a string, defaults to false + timeout (float, None): timeout value to use; None for use default timeout + + Returns: + obj : The value of the requested PV, None if no value was read + """ + try: + if timeout is None: + return CaChannelWrapper.get_pv_value(name, as_string) + else: + return CaChannelWrapper.get_pv_value(name, as_string, timeout=timeout) + + except Exception as err: + # Probably has timed out + print_and_log(str(err)) + return None + + @staticmethod + def caput(name, value, wait=False, set_pv_value=None, safe_not_quick=True): + """ + Uses CaChannelWrapper from genie_python to set a pv value. Waiting will put the call in a thread so the order + is no longer guarenteed. Also if the call take time a queue will be formed of put tasks. + + We import CaChannelWrapper when used as this means the tests can run without having genie_python installed + + Args: + name (string): The name of the PV to be set + value (object): The data to send to the PV + wait (bool, optional): Wait for the PV to set before returning + set_pv_value: function to call to set a pv, used only in testing; None to use CaChannelWrapper set value + safe_not_quick (bool): True run all checks while setting the pv, False don't run checks just write the value, + e.g. disp check + Returns: + None: if wait is False + Future: if wait if True + """ + if set_pv_value is None: + # We need to put the default here rather than as a python default argument because the linux build does + # not have CaChannelWrapper. The argument default would be looked up at class load time, causing the + # linux build to fail to load the entire class. + set_pv_value = CaChannelWrapper.set_pv_value + + def _put_value(): + set_pv_value(name, value, wait, safe_not_quick=safe_not_quick) + + if wait: + # If waiting then run in this thread. + _put_value() + return None + else: + # If not waiting, run in a different thread. + # Even if not waiting genie_python sometimes takes a while to return from a set_pv_value call. + return ChannelAccess.thread_pool.submit(_put_value) + + @staticmethod + def caput_retry_on_fail(pv_name, value, retry_count=5, safe_not_quick=True): + """ + Write to a pv and check the value is set, retry if not; raise if run out of retries + Args: + pv_name: pv name to write to + value: value to write + retry_count: number of retries + safe_not_quick (bool): True run all checks while setting the pv, False don't run checks just write the value, + e.g. disp check + Raises: + IOError: if pv can not be set + + """ + current_value = None + for _ in range(retry_count): + ChannelAccess.caput(pv_name, value, wait=True, safe_not_quick=safe_not_quick) + current_value = ChannelAccess.caget(pv_name) + if current_value == value: + break + else: + raise IOError("PV value can not be set, pv {}, was {} expected {}".format(pv_name, current_value, value)) + + @staticmethod + def pv_exists(name, timeout=None): + """ + See if the PV exists. + + Args: + name (string): The PV name. + timeout(optional): How long to wait for the PV to "appear". + + Returns: + True if exists, otherwise False. + """ + if timeout is None: + timeout = EXIST_TIMEOUT + return CaChannelWrapper.pv_exists(name, timeout) + + @staticmethod + def add_monitor(name, call_back_function): + """ + Add a callback to a pv which responds on a monitor (i.e. value change). This currently only tested for + numbers. + Args: + name: name of the pv + call_back_function: the callback function, arguments are value, + alarm severity (AlarmSeverity), + alarm status (AlarmStatus) + """ + CaChannelWrapper.add_monitor(name, call_back_function) + + @staticmethod + def poll(): + """ + Flush the send buffer and execute any outstanding background activity for all connected pvs. + NB Connected pv is one which is in the cache + """ + CaChannelWrapper.poll() + + @staticmethod + def clear_monitor(name): + """ + Clears the monitor on a pv if it exists + """ + try: + CaChannelWrapper.get_chan(name).clear_channel() + except UnableToConnectToPVException: + pass + + +class ManagerModeRequiredException(Exception): + """ + Exception to be thrown if manager mode was required, but not enabled, for an operation. + """ + def __init__(self, *args, **kwargs): + super(ManagerModeRequiredException, self).__init__(*args, **kwargs) + + +def verify_manager_mode(channel_access=ChannelAccess(), message="Operation must be performed in manager mode"): + """ + Verifies that manager mode is active, throwing an error if it was not active. + + Args: + channel_access (ChannelAccess, optional): the channel access class to use + message (str): Message given to exception if manager mode was not enabled. + + Raises: + ManagerModeRequiredException: if manager mode was not enabled or was unable to connect + """ + try: + is_manager = channel_access.caget("{}CS:MANAGER".format(MACROS["$(MYPVPREFIX)"])).lower() == "yes" + except UnableToConnectToPVException as e: + raise ManagerModeRequiredException("Manager mode is required, but the manager mode PV did not connect " + "(caused by: {})".format(e)) + except ReadAccessException as e: + raise ManagerModeRequiredException("Manager mode is required, but the manager mode PV could not be read " + "(caused by: {})".format(e)) + except Exception as e: + raise ManagerModeRequiredException("Manager mode is required, but an unknown exception occurred " + "(caused by: {})".format(e)) + + if not is_manager: + raise ManagerModeRequiredException(message) + + +def maximum_severity(*alarms): + """ + Get the alarm with maximum severity (or first if items have equal severity) + Args: + *alarms (Tuple[AlarmSeverity, AlarmStatus]): alarms to choose from + + Returns: + (Optional[Tuple[AlarmSeverity, AlarmStatus]]) alarm with maximum severity; none for no arguments + """ + + maximum_severity_alarm = None + + for alarm in alarms: + if maximum_severity_alarm is None or alarm[0] > maximum_severity_alarm[0]: + maximum_severity_alarm = alarm + + return maximum_severity_alarm + +from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers + + +import pybindgen.settings +import warnings + +class ErrorHandler(pybindgen.settings.ErrorHandler): + def handle_error(self, wrapper, exception, traceback_): + warnings.warn("exception %r in wrapper %s" % (exception, wrapper)) + return True +pybindgen.settings.error_handler = ErrorHandler() + + +import sys + +def module_init(): + root_module = Module('ns.uan', cpp_namespace='::ns3') + return root_module + +def register_types(module): + root_module = module.get_root() + + ## address.h (module 'network'): ns3::Address [class] + module.add_class('Address', import_from_module='ns.network') + ## address.h (module 'network'): ns3::Address::MaxSize_e [enumeration] + module.add_enum('MaxSize_e', ['MAX_SIZE'], outer_class=root_module['ns3::Address'], import_from_module='ns.network') + ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList [class] + module.add_class('AttributeConstructionList', import_from_module='ns.core') + ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item [struct] + module.add_class('Item', import_from_module='ns.core', outer_class=root_module['ns3::AttributeConstructionList']) + ## buffer.h (module 'network'): ns3::Buffer [class] + module.add_class('Buffer', import_from_module='ns.network') + ## buffer.h (module 'network'): ns3::Buffer::Iterator [class] + module.add_class('Iterator', import_from_module='ns.network', outer_class=root_module['ns3::Buffer']) + ## packet.h (module 'network'): ns3::ByteTagIterator [class] + module.add_class('ByteTagIterator', import_from_module='ns.network') + ## packet.h (module 'network'): ns3::ByteTagIterator::Item [class] + module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagIterator']) + ## byte-tag-list.h (module 'network'): ns3::ByteTagList [class] + module.add_class('ByteTagList', import_from_module='ns.network') + ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator [class] + module.add_class('Iterator', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagList']) + ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item [struct] + module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::ByteTagList::Iterator']) + ## callback.h (module 'core'): ns3::CallbackBase [class] + module.add_class('CallbackBase', import_from_module='ns.core') + ## device-energy-model-container.h (module 'energy'): ns3::DeviceEnergyModelContainer [class] + module.add_class('DeviceEnergyModelContainer', import_from_module='ns.energy') + ## energy-model-helper.h (module 'energy'): ns3::DeviceEnergyModelHelper [class] + module.add_class('DeviceEnergyModelHelper', allow_subclassing=True, import_from_module='ns.energy') + ## energy-model-helper.h (module 'energy'): ns3::EnergySourceHelper [class] + module.add_class('EnergySourceHelper', allow_subclassing=True, import_from_module='ns.energy') + ## event-id.h (module 'core'): ns3::EventId [class] + module.add_class('EventId', import_from_module='ns.core') + ## hash.h (module 'core'): ns3::Hasher [class] + module.add_class('Hasher', import_from_module='ns.core') + ## ipv4-address.h (module 'network'): ns3::Ipv4Address [class] + module.add_class('Ipv4Address', import_from_module='ns.network') + ## ipv4-address.h (module 'network'): ns3::Ipv4Address [class] + root_module['ns3::Ipv4Address'].implicitly_converts_to(root_module['ns3::Address']) + ## ipv4-address.h (module 'network'): ns3::Ipv4Mask [class] + module.add_class('Ipv4Mask', import_from_module='ns.network') + ## ipv6-address.h (module 'network'): ns3::Ipv6Address [class] + module.add_class('Ipv6Address', import_from_module='ns.network') + ## ipv6-address.h (module 'network'): ns3::Ipv6Address [class] + root_module['ns3::Ipv6Address'].implicitly_converts_to(root_module['ns3::Address']) + ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix [class] + module.add_class('Ipv6Prefix', import_from_module='ns.network') + ## mac48-address.h (module 'network'): ns3::Mac48Address [class] + module.add_class('Mac48Address', import_from_module='ns.network') + ## mac48-address.h (module 'network'): ns3::Mac48Address [class] + root_module['ns3::Mac48Address'].implicitly_converts_to(root_module['ns3::Address']) + ## net-device-container.h (module 'network'): ns3::NetDeviceContainer [class] + module.add_class('NetDeviceContainer', import_from_module='ns.network') + ## node-container.h (module 'network'): ns3::NodeContainer [class] + module.add_class('NodeContainer', import_from_module='ns.network') + ## object-base.h (module 'core'): ns3::ObjectBase [class] + module.add_class('ObjectBase', allow_subclassing=True, import_from_module='ns.core') + ## object.h (module 'core'): ns3::ObjectDeleter [struct] + module.add_class('ObjectDeleter', import_from_module='ns.core') + ## object-factory.h (module 'core'): ns3::ObjectFactory [class] + module.add_class('ObjectFactory', import_from_module='ns.core') + ## packet-metadata.h (module 'network'): ns3::PacketMetadata [class] + module.add_class('PacketMetadata', import_from_module='ns.network') + ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [struct] + module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::PacketMetadata']) + ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [enumeration] + module.add_enum('', ['PAYLOAD', 'HEADER', 'TRAILER'], outer_class=root_module['ns3::PacketMetadata::Item'], import_from_module='ns.network') + ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator [class] + module.add_class('ItemIterator', import_from_module='ns.network', outer_class=root_module['ns3::PacketMetadata']) + ## packet.h (module 'network'): ns3::PacketTagIterator [class] + module.add_class('PacketTagIterator', import_from_module='ns.network') + ## packet.h (module 'network'): ns3::PacketTagIterator::Item [class] + module.add_class('Item', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagIterator']) + ## packet-tag-list.h (module 'network'): ns3::PacketTagList [class] + module.add_class('PacketTagList', import_from_module='ns.network') + ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData [struct] + module.add_class('TagData', import_from_module='ns.network', outer_class=root_module['ns3::PacketTagList']) + ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData_e [enumeration] + module.add_enum('TagData_e', ['MAX_SIZE'], outer_class=root_module['ns3::PacketTagList::TagData'], import_from_module='ns.network') + ## uan-mac-rc.h (module 'uan'): ns3::Reservation [class] + module.add_class('Reservation') + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount [class] + module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Object', 'ns3::ObjectBase', 'ns3::ObjectDeleter'], parent=root_module['ns3::ObjectBase'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) + ## simulator.h (module 'core'): ns3::Simulator [class] + module.add_class('Simulator', destructor_visibility='private', import_from_module='ns.core') + ## tag.h (module 'network'): ns3::Tag [class] + module.add_class('Tag', import_from_module='ns.network', parent=root_module['ns3::ObjectBase']) + ## tag-buffer.h (module 'network'): ns3::TagBuffer [class] + module.add_class('TagBuffer', import_from_module='ns.network') + ## uan-prop-model.h (module 'uan'): ns3::Tap [class] + module.add_class('Tap') + ## nstime.h (module 'core'): ns3::TimeWithUnit [class] + module.add_class('TimeWithUnit', import_from_module='ns.core') + ## traced-value.h (module 'core'): ns3::TracedValue [class] + module.add_class('TracedValue', import_from_module='ns.core', template_parameters=['double']) + ## type-id.h (module 'core'): ns3::TypeId [class] + module.add_class('TypeId', import_from_module='ns.core') + ## type-id.h (module 'core'): ns3::TypeId::AttributeFlag [enumeration] + module.add_enum('AttributeFlag', ['ATTR_GET', 'ATTR_SET', 'ATTR_CONSTRUCT', 'ATTR_SGC'], outer_class=root_module['ns3::TypeId'], import_from_module='ns.core') + ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation [struct] + module.add_class('AttributeInformation', import_from_module='ns.core', outer_class=root_module['ns3::TypeId']) + ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation [struct] + module.add_class('TraceSourceInformation', import_from_module='ns.core', outer_class=root_module['ns3::TypeId']) + ## uan-address.h (module 'uan'): ns3::UanAddress [class] + module.add_class('UanAddress') + ## uan-address.h (module 'uan'): ns3::UanAddress [class] + root_module['ns3::UanAddress'].implicitly_converts_to(root_module['ns3::Address']) + ## uan-helper.h (module 'uan'): ns3::UanHelper [class] + module.add_class('UanHelper') + ## uan-tx-mode.h (module 'uan'): ns3::UanModesList [class] + module.add_class('UanModesList') + ## uan-transducer.h (module 'uan'): ns3::UanPacketArrival [class] + module.add_class('UanPacketArrival') + ## uan-prop-model.h (module 'uan'): ns3::UanPdp [class] + module.add_class('UanPdp') + ## uan-phy.h (module 'uan'): ns3::UanPhyListener [class] + module.add_class('UanPhyListener', allow_subclassing=True) + ## uan-tx-mode.h (module 'uan'): ns3::UanTxMode [class] + module.add_class('UanTxMode') + ## uan-tx-mode.h (module 'uan'): ns3::UanTxMode::ModulationType [enumeration] + module.add_enum('ModulationType', ['PSK', 'QAM', 'FSK', 'OTHER'], outer_class=root_module['ns3::UanTxMode']) + ## uan-tx-mode.h (module 'uan'): ns3::UanTxModeFactory [class] + module.add_class('UanTxModeFactory') + ## vector.h (module 'core'): ns3::Vector2D [class] + module.add_class('Vector2D', import_from_module='ns.core') + ## vector.h (module 'core'): ns3::Vector3D [class] + module.add_class('Vector3D', import_from_module='ns.core') + ## empty.h (module 'core'): ns3::empty [class] + module.add_class('empty', import_from_module='ns.core') + ## int64x64-double.h (module 'core'): ns3::int64x64_t [class] + module.add_class('int64x64_t', import_from_module='ns.core') + ## int64x64-double.h (module 'core'): ns3::int64x64_t::impl_type [enumeration] + module.add_enum('impl_type', ['int128_impl', 'cairo_impl', 'ld_impl'], outer_class=root_module['ns3::int64x64_t'], import_from_module='ns.core') + ## acoustic-modem-energy-model-helper.h (module 'uan'): ns3::AcousticModemEnergyModelHelper [class] + module.add_class('AcousticModemEnergyModelHelper', parent=root_module['ns3::DeviceEnergyModelHelper']) + ## chunk.h (module 'network'): ns3::Chunk [class] + module.add_class('Chunk', import_from_module='ns.network', parent=root_module['ns3::ObjectBase']) + ## header.h (module 'network'): ns3::Header [class] + module.add_class('Header', import_from_module='ns.network', parent=root_module['ns3::Chunk']) + ## object.h (module 'core'): ns3::Object [class] + module.add_class('Object', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >']) + ## object.h (module 'core'): ns3::Object::AggregateIterator [class] + module.add_class('AggregateIterator', import_from_module='ns.core', outer_class=root_module['ns3::Object']) + ## random-variable-stream.h (module 'core'): ns3::RandomVariableStream [class] + module.add_class('RandomVariableStream', import_from_module='ns.core', parent=root_module['ns3::Object']) + ## random-variable-stream.h (module 'core'): ns3::SequentialRandomVariable [class] + module.add_class('SequentialRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream']) + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount > [class] + module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount > [class] + module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeChecker', 'ns3::empty', 'ns3::DefaultDeleter'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount > [class] + module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeValue', 'ns3::empty', 'ns3::DefaultDeleter'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount > [class] + module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::CallbackImplBase', 'ns3::empty', 'ns3::DefaultDeleter'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount > [class] + module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::EventImpl', 'ns3::empty', 'ns3::DefaultDeleter'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount > [class] + module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Hash::Implementation', 'ns3::empty', 'ns3::DefaultDeleter'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount > [class] + module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::NixVector', 'ns3::empty', 'ns3::DefaultDeleter'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount > [class] + module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Packet', 'ns3::empty', 'ns3::DefaultDeleter'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount > [class] + module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount')) + ## nstime.h (module 'core'): ns3::Time [class] + module.add_class('Time', import_from_module='ns.core') + ## nstime.h (module 'core'): ns3::Time::Unit [enumeration] + module.add_enum('Unit', ['Y', 'D', 'H', 'MIN', 'S', 'MS', 'US', 'NS', 'PS', 'FS', 'LAST'], outer_class=root_module['ns3::Time'], import_from_module='ns.core') + ## nstime.h (module 'core'): ns3::Time [class] + root_module['ns3::Time'].implicitly_converts_to(root_module['ns3::int64x64_t']) + ## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor [class] + module.add_class('TraceSourceAccessor', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter >']) + ## trailer.h (module 'network'): ns3::Trailer [class] + module.add_class('Trailer', import_from_module='ns.network', parent=root_module['ns3::Chunk']) + ## random-variable-stream.h (module 'core'): ns3::TriangularRandomVariable [class] + module.add_class('TriangularRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream']) + ## uan-header-common.h (module 'uan'): ns3::UanHeaderCommon [class] + module.add_class('UanHeaderCommon', parent=root_module['ns3::Header']) + ## uan-header-rc.h (module 'uan'): ns3::UanHeaderRcAck [class] + module.add_class('UanHeaderRcAck', parent=root_module['ns3::Header']) + ## uan-header-rc.h (module 'uan'): ns3::UanHeaderRcCts [class] + module.add_class('UanHeaderRcCts', parent=root_module['ns3::Header']) + ## uan-header-rc.h (module 'uan'): ns3::UanHeaderRcCtsGlobal [class] + module.add_class('UanHeaderRcCtsGlobal', parent=root_module['ns3::Header']) + ## uan-header-rc.h (module 'uan'): ns3::UanHeaderRcData [class] + module.add_class('UanHeaderRcData', parent=root_module['ns3::Header']) + ## uan-header-rc.h (module 'uan'): ns3::UanHeaderRcRts [class] + module.add_class('UanHeaderRcRts', parent=root_module['ns3::Header']) + ## uan-mac.h (module 'uan'): ns3::UanMac [class] + module.add_class('UanMac', parent=root_module['ns3::Object']) + ## uan-mac-aloha.h (module 'uan'): ns3::UanMacAloha [class] + module.add_class('UanMacAloha', parent=root_module['ns3::UanMac']) + ## uan-mac-cw.h (module 'uan'): ns3::UanMacCw [class] + module.add_class('UanMacCw', parent=[root_module['ns3::UanMac'], root_module['ns3::UanPhyListener']]) + ## uan-mac-rc.h (module 'uan'): ns3::UanMacRc [class] + module.add_class('UanMacRc', parent=root_module['ns3::UanMac']) + ## uan-mac-rc.h (module 'uan'): ns3::UanMacRc [enumeration] + module.add_enum('', ['TYPE_DATA', 'TYPE_GWPING', 'TYPE_RTS', 'TYPE_CTS', 'TYPE_ACK'], outer_class=root_module['ns3::UanMacRc']) + ## uan-mac-rc-gw.h (module 'uan'): ns3::UanMacRcGw [class] + module.add_class('UanMacRcGw', parent=root_module['ns3::UanMac']) + ## uan-noise-model.h (module 'uan'): ns3::UanNoiseModel [class] + module.add_class('UanNoiseModel', parent=root_module['ns3::Object']) + ## uan-noise-model-default.h (module 'uan'): ns3::UanNoiseModelDefault [class] + module.add_class('UanNoiseModelDefault', parent=root_module['ns3::UanNoiseModel']) + ## uan-phy.h (module 'uan'): ns3::UanPhy [class] + module.add_class('UanPhy', parent=root_module['ns3::Object']) + ## uan-phy.h (module 'uan'): ns3::UanPhy::State [enumeration] + module.add_enum('State', ['IDLE', 'CCABUSY', 'RX', 'TX', 'SLEEP'], outer_class=root_module['ns3::UanPhy']) + ## uan-phy.h (module 'uan'): ns3::UanPhyCalcSinr [class] + module.add_class('UanPhyCalcSinr', parent=root_module['ns3::Object']) + ## uan-phy-gen.h (module 'uan'): ns3::UanPhyCalcSinrDefault [class] + module.add_class('UanPhyCalcSinrDefault', parent=root_module['ns3::UanPhyCalcSinr']) + ## uan-phy-dual.h (module 'uan'): ns3::UanPhyCalcSinrDual [class] + module.add_class('UanPhyCalcSinrDual', parent=root_module['ns3::UanPhyCalcSinr']) + ## uan-phy-gen.h (module 'uan'): ns3::UanPhyCalcSinrFhFsk [class] + module.add_class('UanPhyCalcSinrFhFsk', parent=root_module['ns3::UanPhyCalcSinr']) + ## uan-phy-dual.h (module 'uan'): ns3::UanPhyDual [class] + module.add_class('UanPhyDual', parent=root_module['ns3::UanPhy']) + ## uan-phy-gen.h (module 'uan'): ns3::UanPhyGen [class] + module.add_class('UanPhyGen', parent=root_module['ns3::UanPhy']) + ## uan-phy.h (module 'uan'): ns3::UanPhyPer [class] + module.add_class('UanPhyPer', parent=root_module['ns3::Object']) + ## uan-phy-gen.h (module 'uan'): ns3::UanPhyPerGenDefault [class] + module.add_class('UanPhyPerGenDefault', parent=root_module['ns3::UanPhyPer']) + ## uan-phy-gen.h (module 'uan'): ns3::UanPhyPerUmodem [class] + module.add_class('UanPhyPerUmodem', parent=root_module['ns3::UanPhyPer']) + ## uan-prop-model.h (module 'uan'): ns3::UanPropModel [class] + module.add_class('UanPropModel', parent=root_module['ns3::Object']) + ## uan-prop-model-ideal.h (module 'uan'): ns3::UanPropModelIdeal [class] + module.add_class('UanPropModelIdeal', parent=root_module['ns3::UanPropModel']) + ## uan-prop-model-thorp.h (module 'uan'): ns3::UanPropModelThorp [class] + module.add_class('UanPropModelThorp', parent=root_module['ns3::UanPropModel']) + ## uan-transducer.h (module 'uan'): ns3::UanTransducer [class] + module.add_class('UanTransducer', parent=root_module['ns3::Object']) + ## uan-transducer.h (module 'uan'): ns3::UanTransducer::State [enumeration] + module.add_enum('State', ['TX', 'RX'], outer_class=root_module['ns3::UanTransducer']) + ## uan-transducer-hd.h (module 'uan'): ns3::UanTransducerHd [class] + module.add_class('UanTransducerHd', parent=root_module['ns3::UanTransducer']) + ## random-variable-stream.h (module 'core'): ns3::UniformRandomVariable [class] + module.add_class('UniformRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream']) + ## random-variable-stream.h (module 'core'): ns3::WeibullRandomVariable [class] + module.add_class('WeibullRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream']) + ## random-variable-stream.h (module 'core'): ns3::ZetaRandomVariable [class] + module.add_class('ZetaRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream']) + ## random-variable-stream.h (module 'core'): ns3::ZipfRandomVariable [class] + module.add_class('ZipfRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream']) + ## attribute.h (module 'core'): ns3::AttributeAccessor [class] + module.add_class('AttributeAccessor', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter >']) + ## attribute.h (module 'core'): ns3::AttributeChecker [class] + module.add_class('AttributeChecker', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter >']) + ## attribute.h (module 'core'): ns3::AttributeValue [class] + module.add_class('AttributeValue', allow_subclassing=False, automatic_type_narrowing=True, import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter >']) + ## boolean.h (module 'core'): ns3::BooleanChecker [class] + module.add_class('BooleanChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) + ## boolean.h (module 'core'): ns3::BooleanValue [class] + module.add_class('BooleanValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) + ## callback.h (module 'core'): ns3::CallbackChecker [class] + module.add_class('CallbackChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) + ## callback.h (module 'core'): ns3::CallbackImplBase [class] + module.add_class('CallbackImplBase', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter >']) + ## callback.h (module 'core'): ns3::CallbackValue [class] + module.add_class('CallbackValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) + ## channel.h (module 'network'): ns3::Channel [class] + module.add_class('Channel', import_from_module='ns.network', parent=root_module['ns3::Object']) + ## random-variable-stream.h (module 'core'): ns3::ConstantRandomVariable [class] + module.add_class('ConstantRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream']) + ## random-variable-stream.h (module 'core'): ns3::DeterministicRandomVariable [class] + module.add_class('DeterministicRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream']) + ## device-energy-model.h (module 'energy'): ns3::DeviceEnergyModel [class] + module.add_class('DeviceEnergyModel', import_from_module='ns.energy', parent=root_module['ns3::Object']) + ## double.h (module 'core'): ns3::DoubleValue [class] + module.add_class('DoubleValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) + ## random-variable-stream.h (module 'core'): ns3::EmpiricalRandomVariable [class] + module.add_class('EmpiricalRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream']) + ## attribute.h (module 'core'): ns3::EmptyAttributeValue [class] + module.add_class('EmptyAttributeValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) + ## energy-harvester.h (module 'energy'): ns3::EnergyHarvester [class] + module.add_class('EnergyHarvester', import_from_module='ns.energy', parent=root_module['ns3::Object']) + ## energy-source.h (module 'energy'): ns3::EnergySource [class] + module.add_class('EnergySource', import_from_module='ns.energy', parent=root_module['ns3::Object']) + ## energy-source-container.h (module 'energy'): ns3::EnergySourceContainer [class] + module.add_class('EnergySourceContainer', import_from_module='ns.energy', parent=root_module['ns3::Object']) + ## enum.h (module 'core'): ns3::EnumChecker [class] + module.add_class('EnumChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) + ## enum.h (module 'core'): ns3::EnumValue [class] + module.add_class('EnumValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) + ## random-variable-stream.h (module 'core'): ns3::ErlangRandomVariable [class] + module.add_class('ErlangRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream']) + ## event-impl.h (module 'core'): ns3::EventImpl [class] + module.add_class('EventImpl', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter >']) + ## random-variable-stream.h (module 'core'): ns3::ExponentialRandomVariable [class] + module.add_class('ExponentialRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream']) + ## random-variable-stream.h (module 'core'): ns3::GammaRandomVariable [class] + module.add_class('GammaRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream']) + ## integer.h (module 'core'): ns3::IntegerValue [class] + module.add_class('IntegerValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) + ## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker [class] + module.add_class('Ipv4AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) + ## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue [class] + module.add_class('Ipv4AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) + ## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker [class] + module.add_class('Ipv4MaskChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) + ## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue [class] + module.add_class('Ipv4MaskValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) + ## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker [class] + module.add_class('Ipv6AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) + ## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue [class] + module.add_class('Ipv6AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) + ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker [class] + module.add_class('Ipv6PrefixChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) + ## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue [class] + module.add_class('Ipv6PrefixValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) + ## random-variable-stream.h (module 'core'): ns3::LogNormalRandomVariable [class] + module.add_class('LogNormalRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream']) + ## mac48-address.h (module 'network'): ns3::Mac48AddressChecker [class] + module.add_class('Mac48AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) + ## mac48-address.h (module 'network'): ns3::Mac48AddressValue [class] + module.add_class('Mac48AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) + ## mobility-model.h (module 'mobility'): ns3::MobilityModel [class] + module.add_class('MobilityModel', import_from_module='ns.mobility', parent=root_module['ns3::Object']) + ## net-device.h (module 'network'): ns3::NetDevice [class] + module.add_class('NetDevice', import_from_module='ns.network', parent=root_module['ns3::Object']) + ## net-device.h (module 'network'): ns3::NetDevice::PacketType [enumeration] + module.add_enum('PacketType', ['PACKET_HOST', 'NS3_PACKET_HOST', 'PACKET_BROADCAST', 'NS3_PACKET_BROADCAST', 'PACKET_MULTICAST', 'NS3_PACKET_MULTICAST', 'PACKET_OTHERHOST', 'NS3_PACKET_OTHERHOST'], outer_class=root_module['ns3::NetDevice'], import_from_module='ns.network') + ## nix-vector.h (module 'network'): ns3::NixVector [class] + module.add_class('NixVector', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter >']) + ## node.h (module 'network'): ns3::Node [class] + module.add_class('Node', import_from_module='ns.network', parent=root_module['ns3::Object']) + ## random-variable-stream.h (module 'core'): ns3::NormalRandomVariable [class] + module.add_class('NormalRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream']) + ## object-factory.h (module 'core'): ns3::ObjectFactoryChecker [class] + module.add_class('ObjectFactoryChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) + ## object-factory.h (module 'core'): ns3::ObjectFactoryValue [class] + module.add_class('ObjectFactoryValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) + ## packet.h (module 'network'): ns3::Packet [class] + module.add_class('Packet', import_from_module='ns.network', parent=root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter >']) + ## random-variable-stream.h (module 'core'): ns3::ParetoRandomVariable [class] + module.add_class('ParetoRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream']) + ## pointer.h (module 'core'): ns3::PointerChecker [class] + module.add_class('PointerChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) + ## pointer.h (module 'core'): ns3::PointerValue [class] + module.add_class('PointerValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) + ## nstime.h (module 'core'): ns3::TimeValue [class] + module.add_class('TimeValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) + ## type-id.h (module 'core'): ns3::TypeIdChecker [class] + module.add_class('TypeIdChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) + ## type-id.h (module 'core'): ns3::TypeIdValue [class] + module.add_class('TypeIdValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) + ## uan-channel.h (module 'uan'): ns3::UanChannel [class] + module.add_class('UanChannel', parent=root_module['ns3::Channel']) + ## uan-tx-mode.h (module 'uan'): ns3::UanModesListChecker [class] + module.add_class('UanModesListChecker', parent=root_module['ns3::AttributeChecker']) + ## uan-tx-mode.h (module 'uan'): ns3::UanModesListValue [class] + module.add_class('UanModesListValue', parent=root_module['ns3::AttributeValue']) + ## uan-net-device.h (module 'uan'): ns3::UanNetDevice [class] + module.add_class('UanNetDevice', parent=root_module['ns3::NetDevice']) + ## uinteger.h (module 'core'): ns3::UintegerValue [class] + module.add_class('UintegerValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) + ## vector.h (module 'core'): ns3::Vector2DChecker [class] + module.add_class('Vector2DChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) + ## vector.h (module 'core'): ns3::Vector2DValue [class] + module.add_class('Vector2DValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) + ## vector.h (module 'core'): ns3::Vector3DChecker [class] + module.add_class('Vector3DChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker']) + ## vector.h (module 'core'): ns3::Vector3DValue [class] + module.add_class('Vector3DValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue']) + ## acoustic-modem-energy-model.h (module 'uan'): ns3::AcousticModemEnergyModel [class] + module.add_class('AcousticModemEnergyModel', parent=root_module['ns3::DeviceEnergyModel']) + ## address.h (module 'network'): ns3::AddressChecker [class] + module.add_class('AddressChecker', import_from_module='ns.network', parent=root_module['ns3::AttributeChecker']) + ## address.h (module 'network'): ns3::AddressValue [class] + module.add_class('AddressValue', import_from_module='ns.network', parent=root_module['ns3::AttributeValue']) + module.add_container('std::list< std::pair< ns3::Ptr< ns3::Packet >, ns3::UanAddress > >', 'std::pair< ns3::Ptr< ns3::Packet >, ns3::UanAddress >', container_type=u'list') + module.add_container('std::vector< ns3::Tap >', 'ns3::Tap', container_type=u'vector') + module.add_container('std::vector< std::complex< double > >', 'std::complex< double >', container_type=u'vector') + module.add_container('std::vector< double >', 'double', container_type=u'vector') + module.add_container('std::set< unsigned char >', 'unsigned char', container_type=u'set') + module.add_container('std::list< ns3::UanPacketArrival >', 'ns3::UanPacketArrival', container_type=u'list') + module.add_container('std::list< ns3::Ptr< ns3::UanPhy > >', 'ns3::Ptr< ns3::UanPhy >', container_type=u'list') + module.add_container('std::vector< std::pair< ns3::Ptr< ns3::UanNetDevice >, ns3::Ptr< ns3::UanTransducer > > >', 'std::pair< ns3::Ptr< ns3::UanNetDevice >, ns3::Ptr< ns3::UanTransducer > >', container_type=u'vector') + module.add_container('std::list< ns3::Ptr< ns3::UanTransducer > >', 'ns3::Ptr< ns3::UanTransducer >', container_type=u'list') + typehandlers.add_type_alias(u'ns3::Vector3DValue', u'ns3::VectorValue') + typehandlers.add_type_alias(u'ns3::Vector3DValue*', u'ns3::VectorValue*') + typehandlers.add_type_alias(u'ns3::Vector3DValue&', u'ns3::VectorValue&') + module.add_typedef(root_module['ns3::Vector3DValue'], 'VectorValue') + typehandlers.add_type_alias(u'ns3::Vector3D', u'ns3::Vector') + typehandlers.add_type_alias(u'ns3::Vector3D*', u'ns3::Vector*') + typehandlers.add_type_alias(u'ns3::Vector3D&', u'ns3::Vector&') + module.add_typedef(root_module['ns3::Vector3D'], 'Vector') + typehandlers.add_type_alias(u'ns3::Vector3DChecker', u'ns3::VectorChecker') + typehandlers.add_type_alias(u'ns3::Vector3DChecker*', u'ns3::VectorChecker*') + typehandlers.add_type_alias(u'ns3::Vector3DChecker&', u'ns3::VectorChecker&') + module.add_typedef(root_module['ns3::Vector3DChecker'], 'VectorChecker') + + ## Register a nested module for the namespace FatalImpl + + nested_module = module.add_cpp_namespace('FatalImpl') + register_types_ns3_FatalImpl(nested_module) + + + ## Register a nested module for the namespace Hash + + nested_module = module.add_cpp_namespace('Hash') + register_types_ns3_Hash(nested_module) + + + ## Register a nested module for the namespace TracedValueCallback + + nested_module = module.add_cpp_namespace('TracedValueCallback') + register_types_ns3_TracedValueCallback(nested_module) + + + ## Register a nested module for the namespace internal + + nested_module = module.add_cpp_namespace('internal') + register_types_ns3_internal(nested_module) + + +def register_types_ns3_FatalImpl(module): + root_module = module.get_root() + + +def register_types_ns3_Hash(module): + root_module = module.get_root() + + ## hash-function.h (module 'core'): ns3::Hash::Implementation [class] + module.add_class('Implementation', import_from_module='ns.core', parent=root_module['ns3::SimpleRefCount< ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter >']) + typehandlers.add_type_alias(u'uint32_t ( * ) ( char const *, size_t ) *', u'ns3::Hash::Hash32Function_ptr') + typehandlers.add_type_alias(u'uint32_t ( * ) ( char const *, size_t ) **', u'ns3::Hash::Hash32Function_ptr*') + typehandlers.add_type_alias(u'uint32_t ( * ) ( char const *, size_t ) *&', u'ns3::Hash::Hash32Function_ptr&') + typehandlers.add_type_alias(u'uint64_t ( * ) ( char const *, size_t ) *', u'ns3::Hash::Hash64Function_ptr') + typehandlers.add_type_alias(u'uint64_t ( * ) ( char const *, size_t ) **', u'ns3::Hash::Hash64Function_ptr*') + typehandlers.add_type_alias(u'uint64_t ( * ) ( char const *, size_t ) *&', u'ns3::Hash::Hash64Function_ptr&') + + ## Register a nested module for the namespace Function + + nested_module = module.add_cpp_namespace('Function') + register_types_ns3_Hash_Function(nested_module) + + +def register_types_ns3_Hash_Function(module): + root_module = module.get_root() + + ## hash-fnv.h (module 'core'): ns3::Hash::Function::Fnv1a [class] + module.add_class('Fnv1a', import_from_module='ns.core', parent=root_module['ns3::Hash::Implementation']) + ## hash-function.h (module 'core'): ns3::Hash::Function::Hash32 [class] + module.add_class('Hash32', import_from_module='ns.core', parent=root_module['ns3::Hash::Implementation']) + ## hash-function.h (module 'core'): ns3::Hash::Function::Hash64 [class] + module.add_class('Hash64', import_from_module='ns.core', parent=root_module['ns3::Hash::Implementation']) + ## hash-murmur3.h (module 'core'): ns3::Hash::Function::Murmur3 [class] + module.add_class('Murmur3', import_from_module='ns.core', parent=root_module['ns3::Hash::Implementation']) + +def register_types_ns3_TracedValueCallback(module): + root_module = module.get_root() + + typehandlers.add_type_alias(u'void ( * ) ( int8_t, int8_t ) *', u'ns3::TracedValueCallback::Int8') + typehandlers.add_type_alias(u'void ( * ) ( int8_t, int8_t ) **', u'ns3::TracedValueCallback::Int8*') + typehandlers.add_type_alias(u'void ( * ) ( int8_t, int8_t ) *&', u'ns3::TracedValueCallback::Int8&') + typehandlers.add_type_alias(u'void ( * ) ( uint8_t, uint8_t ) *', u'ns3::TracedValueCallback::Uint8') + typehandlers.add_type_alias(u'void ( * ) ( uint8_t, uint8_t ) **', u'ns3::TracedValueCallback::Uint8*') + typehandlers.add_type_alias(u'void ( * ) ( uint8_t, uint8_t ) *&', u'ns3::TracedValueCallback::Uint8&') + typehandlers.add_type_alias(u'void ( * ) ( double, double ) *', u'ns3::TracedValueCallback::Double') + typehandlers.add_type_alias(u'void ( * ) ( double, double ) **', u'ns3::TracedValueCallback::Double*') + typehandlers.add_type_alias(u'void ( * ) ( double, double ) *&', u'ns3::TracedValueCallback::Double&') + typehandlers.add_type_alias(u'void ( * ) ( uint32_t, uint32_t ) *', u'ns3::TracedValueCallback::Uint32') + typehandlers.add_type_alias(u'void ( * ) ( uint32_t, uint32_t ) **', u'ns3::TracedValueCallback::Uint32*') + typehandlers.add_type_alias(u'void ( * ) ( uint32_t, uint32_t ) *&', u'ns3::TracedValueCallback::Uint32&') + typehandlers.add_type_alias(u'void ( * ) ( ns3::Time, ns3::Time ) *', u'ns3::TracedValueCallback::Time') + typehandlers.add_type_alias(u'void ( * ) ( ns3::Time, ns3::Time ) **', u'ns3::TracedValueCallback::Time*') + typehandlers.add_type_alias(u'void ( * ) ( ns3::Time, ns3::Time ) *&', u'ns3::TracedValueCallback::Time&') + typehandlers.add_type_alias(u'void ( * ) ( bool, bool ) *', u'ns3::TracedValueCallback::Bool') + typehandlers.add_type_alias(u'void ( * ) ( bool, bool ) **', u'ns3::TracedValueCallback::Bool*') + typehandlers.add_type_alias(u'void ( * ) ( bool, bool ) *&', u'ns3::TracedValueCallback::Bool&') + typehandlers.add_type_alias(u'void ( * ) ( int16_t, int16_t ) *', u'ns3::TracedValueCallback::Int16') + typehandlers.add_type_alias(u'void ( * ) ( int16_t, int16_t ) **', u'ns3::TracedValueCallback::Int16*') + typehandlers.add_type_alias(u'void ( * ) ( int16_t, int16_t ) *&', u'ns3::TracedValueCallback::Int16&') + typehandlers.add_type_alias(u'void ( * ) ( int32_t, int32_t ) *', u'ns3::TracedValueCallback::Int32') + typehandlers.add_type_alias(u'void ( * ) ( int32_t, int32_t ) **', u'ns3::TracedValueCallback::Int32*') + typehandlers.add_type_alias(u'void ( * ) ( int32_t, int32_t ) *&', u'ns3::TracedValueCallback::Int32&') + typehandlers.add_type_alias(u'void ( * ) ( uint16_t, uint16_t ) *', u'ns3::TracedValueCallback::Uint16') + typehandlers.add_type_alias(u'void ( * ) ( uint16_t, uint16_t ) **', u'ns3::TracedValueCallback::Uint16*') + typehandlers.add_type_alias(u'void ( * ) ( uint16_t, uint16_t ) *&', u'ns3::TracedValueCallback::Uint16&') + +def register_types_ns3_internal(module): + root_module = module.get_root() + + +def register_methods(root_module): + register_Ns3Address_methods(root_module, root_module['ns3::Address']) + register_Ns3AttributeConstructionList_methods(root_module, root_module['ns3::AttributeConstructionList']) + register_Ns3AttributeConstructionListItem_methods(root_module, root_module['ns3::AttributeConstructionList::Item']) + register_Ns3Buffer_methods(root_module, root_module['ns3::Buffer']) + register_Ns3BufferIterator_methods(root_module, root_module['ns3::Buffer::Iterator']) + register_Ns3ByteTagIterator_methods(root_module, root_module['ns3::ByteTagIterator']) + register_Ns3ByteTagIteratorItem_methods(root_module, root_module['ns3::ByteTagIterator::Item']) + register_Ns3ByteTagList_methods(root_module, root_module['ns3::ByteTagList']) + register_Ns3ByteTagListIterator_methods(root_module, root_module['ns3::ByteTagList::Iterator']) + register_Ns3ByteTagListIteratorItem_methods(root_module, root_module['ns3::ByteTagList::Iterator::Item']) + register_Ns3CallbackBase_methods(root_module, root_module['ns3::CallbackBase']) + register_Ns3DeviceEnergyModelContainer_methods(root_module, root_module['ns3::DeviceEnergyModelContainer']) + register_Ns3DeviceEnergyModelHelper_methods(root_module, root_module['ns3::DeviceEnergyModelHelper']) + register_Ns3EnergySourceHelper_methods(root_module, root_module['ns3::EnergySourceHelper']) + register_Ns3EventId_methods(root_module, root_module['ns3::EventId']) + register_Ns3Hasher_methods(root_module, root_module['ns3::Hasher']) + register_Ns3Ipv4Address_methods(root_module, root_module['ns3::Ipv4Address']) + register_Ns3Ipv4Mask_methods(root_module, root_module['ns3::Ipv4Mask']) + register_Ns3Ipv6Address_methods(root_module, root_module['ns3::Ipv6Address']) + register_Ns3Ipv6Prefix_methods(root_module, root_module['ns3::Ipv6Prefix']) + register_Ns3Mac48Address_methods(root_module, root_module['ns3::Mac48Address']) + register_Ns3NetDeviceContainer_methods(root_module, root_module['ns3::NetDeviceContainer']) + register_Ns3NodeContainer_methods(root_module, root_module['ns3::NodeContainer']) + register_Ns3ObjectBase_methods(root_module, root_module['ns3::ObjectBase']) + register_Ns3ObjectDeleter_methods(root_module, root_module['ns3::ObjectDeleter']) + register_Ns3ObjectFactory_methods(root_module, root_module['ns3::ObjectFactory']) + register_Ns3PacketMetadata_methods(root_module, root_module['ns3::PacketMetadata']) + register_Ns3PacketMetadataItem_methods(root_module, root_module['ns3::PacketMetadata::Item']) + register_Ns3PacketMetadataItemIterator_methods(root_module, root_module['ns3::PacketMetadata::ItemIterator']) + register_Ns3PacketTagIterator_methods(root_module, root_module['ns3::PacketTagIterator']) + register_Ns3PacketTagIteratorItem_methods(root_module, root_module['ns3::PacketTagIterator::Item']) + register_Ns3PacketTagList_methods(root_module, root_module['ns3::PacketTagList']) + register_Ns3PacketTagListTagData_methods(root_module, root_module['ns3::PacketTagList::TagData']) + register_Ns3Reservation_methods(root_module, root_module['ns3::Reservation']) + register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, root_module['ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter >']) + register_Ns3Simulator_methods(root_module, root_module['ns3::Simulator']) + register_Ns3Tag_methods(root_module, root_module['ns3::Tag']) + register_Ns3TagBuffer_methods(root_module, root_module['ns3::TagBuffer']) + register_Ns3Tap_methods(root_module, root_module['ns3::Tap']) + register_Ns3TimeWithUnit_methods(root_module, root_module['ns3::TimeWithUnit']) + register_Ns3TracedValue__Double_methods(root_module, root_module['ns3::TracedValue< double >']) + register_Ns3TypeId_methods(root_module, root_module['ns3::TypeId']) + register_Ns3TypeIdAttributeInformation_methods(root_module, root_module['ns3::TypeId::AttributeInformation']) + register_Ns3TypeIdTraceSourceInformation_methods(root_module, root_module['ns3::TypeId::TraceSourceInformation']) + register_Ns3UanAddress_methods(root_module, root_module['ns3::UanAddress']) + register_Ns3UanHelper_methods(root_module, root_module['ns3::UanHelper']) + register_Ns3UanModesList_methods(root_module, root_module['ns3::UanModesList']) + register_Ns3UanPacketArrival_methods(root_module, root_module['ns3::UanPacketArrival']) + register_Ns3UanPdp_methods(root_module, root_module['ns3::UanPdp']) + register_Ns3UanPhyListener_methods(root_module, root_module['ns3::UanPhyListener']) + register_Ns3UanTxMode_methods(root_module, root_module['ns3::UanTxMode']) + register_Ns3UanTxModeFactory_methods(root_module, root_module['ns3::UanTxModeFactory']) + register_Ns3Vector2D_methods(root_module, root_module['ns3::Vector2D']) + register_Ns3Vector3D_methods(root_module, root_module['ns3::Vector3D']) + register_Ns3Empty_methods(root_module, root_module['ns3::empty']) + register_Ns3Int64x64_t_methods(root_module, root_module['ns3::int64x64_t']) + register_Ns3AcousticModemEnergyModelHelper_methods(root_module, root_module['ns3::AcousticModemEnergyModelHelper']) + register_Ns3Chunk_methods(root_module, root_module['ns3::Chunk']) + register_Ns3Header_methods(root_module, root_module['ns3::Header']) + register_Ns3Object_methods(root_module, root_module['ns3::Object']) + register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator']) + register_Ns3RandomVariableStream_methods(root_module, root_module['ns3::RandomVariableStream']) + register_Ns3SequentialRandomVariable_methods(root_module, root_module['ns3::SequentialRandomVariable']) + register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter >']) + register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter >']) + register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter >']) + register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter >']) + register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter >']) + register_Ns3SimpleRefCount__Ns3HashImplementation_Ns3Empty_Ns3DefaultDeleter__lt__ns3HashImplementation__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter >']) + register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter >']) + register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter >']) + register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter >']) + register_Ns3Time_methods(root_module, root_module['ns3::Time']) + register_Ns3TraceSourceAccessor_methods(root_module, root_module['ns3::TraceSourceAccessor']) + register_Ns3Trailer_methods(root_module, root_module['ns3::Trailer']) + register_Ns3TriangularRandomVariable_methods(root_module, root_module['ns3::TriangularRandomVariable']) + register_Ns3UanHeaderCommon_methods(root_module, root_module['ns3::UanHeaderCommon']) + register_Ns3UanHeaderRcAck_methods(root_module, root_module['ns3::UanHeaderRcAck']) + register_Ns3UanHeaderRcCts_methods(root_module, root_module['ns3::UanHeaderRcCts']) + register_Ns3UanHeaderRcCtsGlobal_methods(root_module, root_module['ns3::UanHeaderRcCtsGlobal']) + register_Ns3UanHeaderRcData_methods(root_module, root_module['ns3::UanHeaderRcData']) + register_Ns3UanHeaderRcRts_methods(root_module, root_module['ns3::UanHeaderRcRts']) + register_Ns3UanMac_methods(root_module, root_module['ns3::UanMac']) + register_Ns3UanMacAloha_methods(root_module, root_module['ns3::UanMacAloha']) + register_Ns3UanMacCw_methods(root_module, root_module['ns3::UanMacCw']) + register_Ns3UanMacRc_methods(root_module, root_module['ns3::UanMacRc']) + register_Ns3UanMacRcGw_methods(root_module, root_module['ns3::UanMacRcGw']) + register_Ns3UanNoiseModel_methods(root_module, root_module['ns3::UanNoiseModel']) + register_Ns3UanNoiseModelDefault_methods(root_module, root_module['ns3::UanNoiseModelDefault']) + register_Ns3UanPhy_methods(root_module, root_module['ns3::UanPhy']) + register_Ns3UanPhyCalcSinr_methods(root_module, root_module['ns3::UanPhyCalcSinr']) + register_Ns3UanPhyCalcSinrDefault_methods(root_module, root_module['ns3::UanPhyCalcSinrDefault']) + register_Ns3UanPhyCalcSinrDual_methods(root_module, root_module['ns3::UanPhyCalcSinrDual']) + register_Ns3UanPhyCalcSinrFhFsk_methods(root_module, root_module['ns3::UanPhyCalcSinrFhFsk']) + register_Ns3UanPhyDual_methods(root_module, root_module['ns3::UanPhyDual']) + register_Ns3UanPhyGen_methods(root_module, root_module['ns3::UanPhyGen']) + register_Ns3UanPhyPer_methods(root_module, root_module['ns3::UanPhyPer']) + register_Ns3UanPhyPerGenDefault_methods(root_module, root_module['ns3::UanPhyPerGenDefault']) + register_Ns3UanPhyPerUmodem_methods(root_module, root_module['ns3::UanPhyPerUmodem']) + register_Ns3UanPropModel_methods(root_module, root_module['ns3::UanPropModel']) + register_Ns3UanPropModelIdeal_methods(root_module, root_module['ns3::UanPropModelIdeal']) + register_Ns3UanPropModelThorp_methods(root_module, root_module['ns3::UanPropModelThorp']) + register_Ns3UanTransducer_methods(root_module, root_module['ns3::UanTransducer']) + register_Ns3UanTransducerHd_methods(root_module, root_module['ns3::UanTransducerHd']) + register_Ns3UniformRandomVariable_methods(root_module, root_module['ns3::UniformRandomVariable']) + register_Ns3WeibullRandomVariable_methods(root_module, root_module['ns3::WeibullRandomVariable']) + register_Ns3ZetaRandomVariable_methods(root_module, root_module['ns3::ZetaRandomVariable']) + register_Ns3ZipfRandomVariable_methods(root_module, root_module['ns3::ZipfRandomVariable']) + register_Ns3AttributeAccessor_methods(root_module, root_module['ns3::AttributeAccessor']) + register_Ns3AttributeChecker_methods(root_module, root_module['ns3::AttributeChecker']) + register_Ns3AttributeValue_methods(root_module, root_module['ns3::AttributeValue']) + register_Ns3BooleanChecker_methods(root_module, root_module['ns3::BooleanChecker']) + register_Ns3BooleanValue_methods(root_module, root_module['ns3::BooleanValue']) + register_Ns3CallbackChecker_methods(root_module, root_module['ns3::CallbackChecker']) + register_Ns3CallbackImplBase_methods(root_module, root_module['ns3::CallbackImplBase']) + register_Ns3CallbackValue_methods(root_module, root_module['ns3::CallbackValue']) + register_Ns3Channel_methods(root_module, root_module['ns3::Channel']) + register_Ns3ConstantRandomVariable_methods(root_module, root_module['ns3::ConstantRandomVariable']) + register_Ns3DeterministicRandomVariable_methods(root_module, root_module['ns3::DeterministicRandomVariable']) + register_Ns3DeviceEnergyModel_methods(root_module, root_module['ns3::DeviceEnergyModel']) + register_Ns3DoubleValue_methods(root_module, root_module['ns3::DoubleValue']) + register_Ns3EmpiricalRandomVariable_methods(root_module, root_module['ns3::EmpiricalRandomVariable']) + register_Ns3EmptyAttributeValue_methods(root_module, root_module['ns3::EmptyAttributeValue']) + register_Ns3EnergyHarvester_methods(root_module, root_module['ns3::EnergyHarvester']) + register_Ns3EnergySource_methods(root_module, root_module['ns3::EnergySource']) + register_Ns3EnergySourceContainer_methods(root_module, root_module['ns3::EnergySourceContainer']) + register_Ns3EnumChecker_methods(root_module, root_module['ns3::EnumChecker']) + register_Ns3EnumValue_methods(root_module, root_module['ns3::EnumValue']) + register_Ns3ErlangRandomVariable_methods(root_module, root_module['ns3::ErlangRandomVariable']) + register_Ns3EventImpl_methods(root_module, root_module['ns3::EventImpl']) + register_Ns3ExponentialRandomVariable_methods(root_module, root_module['ns3::ExponentialRandomVariable']) + register_Ns3GammaRandomVariable_methods(root_module, root_module['ns3::GammaRandomVariable']) + register_Ns3IntegerValue_methods(root_module, root_module['ns3::IntegerValue']) + register_Ns3Ipv4AddressChecker_methods(root_module, root_module['ns3::Ipv4AddressChecker']) + register_Ns3Ipv4AddressValue_methods(root_module, root_module['ns3::Ipv4AddressValue']) + register_Ns3Ipv4MaskChecker_methods(root_module, root_module['ns3::Ipv4MaskChecker']) + register_Ns3Ipv4MaskValue_methods(root_module, root_module['ns3::Ipv4MaskValue']) + register_Ns3Ipv6AddressChecker_methods(root_module, root_module['ns3::Ipv6AddressChecker']) + register_Ns3Ipv6AddressValue_methods(root_module, root_module['ns3::Ipv6AddressValue']) + register_Ns3Ipv6PrefixChecker_methods(root_module, root_module['ns3::Ipv6PrefixChecker']) + register_Ns3Ipv6PrefixValue_methods(root_module, root_module['ns3::Ipv6PrefixValue']) + register_Ns3LogNormalRandomVariable_methods(root_module, root_module['ns3::LogNormalRandomVariable']) + register_Ns3Mac48AddressChecker_methods(root_module, root_module['ns3::Mac48AddressChecker']) + register_Ns3Mac48AddressValue_methods(root_module, root_module['ns3::Mac48AddressValue']) + register_Ns3MobilityModel_methods(root_module, root_module['ns3::MobilityModel']) + register_Ns3NetDevice_methods(root_module, root_module['ns3::NetDevice']) + register_Ns3NixVector_methods(root_module, root_module['ns3::NixVector']) + register_Ns3Node_methods(root_module, root_module['ns3::Node']) + register_Ns3NormalRandomVariable_methods(root_module, root_module['ns3::NormalRandomVariable']) + register_Ns3ObjectFactoryChecker_methods(root_module, root_module['ns3::ObjectFactoryChecker']) + register_Ns3ObjectFactoryValue_methods(root_module, root_module['ns3::ObjectFactoryValue']) + register_Ns3Packet_methods(root_module, root_module['ns3::Packet']) + register_Ns3ParetoRandomVariable_methods(root_module, root_module['ns3::ParetoRandomVariable']) + register_Ns3PointerChecker_methods(root_module, root_module['ns3::PointerChecker']) + register_Ns3PointerValue_methods(root_module, root_module['ns3::PointerValue']) + register_Ns3TimeValue_methods(root_module, root_module['ns3::TimeValue']) + register_Ns3TypeIdChecker_methods(root_module, root_module['ns3::TypeIdChecker']) + register_Ns3TypeIdValue_methods(root_module, root_module['ns3::TypeIdValue']) + register_Ns3UanChannel_methods(root_module, root_module['ns3::UanChannel']) + register_Ns3UanModesListChecker_methods(root_module, root_module['ns3::UanModesListChecker']) + register_Ns3UanModesListValue_methods(root_module, root_module['ns3::UanModesListValue']) + register_Ns3UanNetDevice_methods(root_module, root_module['ns3::UanNetDevice']) + register_Ns3UintegerValue_methods(root_module, root_module['ns3::UintegerValue']) + register_Ns3Vector2DChecker_methods(root_module, root_module['ns3::Vector2DChecker']) + register_Ns3Vector2DValue_methods(root_module, root_module['ns3::Vector2DValue']) + register_Ns3Vector3DChecker_methods(root_module, root_module['ns3::Vector3DChecker']) + register_Ns3Vector3DValue_methods(root_module, root_module['ns3::Vector3DValue']) + register_Ns3AcousticModemEnergyModel_methods(root_module, root_module['ns3::AcousticModemEnergyModel']) + register_Ns3AddressChecker_methods(root_module, root_module['ns3::AddressChecker']) + register_Ns3AddressValue_methods(root_module, root_module['ns3::AddressValue']) + register_Ns3HashImplementation_methods(root_module, root_module['ns3::Hash::Implementation']) + register_Ns3HashFunctionFnv1a_methods(root_module, root_module['ns3::Hash::Function::Fnv1a']) + register_Ns3HashFunctionHash32_methods(root_module, root_module['ns3::Hash::Function::Hash32']) + register_Ns3HashFunctionHash64_methods(root_module, root_module['ns3::Hash::Function::Hash64']) + register_Ns3HashFunctionMurmur3_methods(root_module, root_module['ns3::Hash::Function::Murmur3']) + return + +def register_Ns3Address_methods(root_module, cls): + cls.add_binary_comparison_operator('<') + cls.add_binary_comparison_operator('!=') + cls.add_output_stream_operator() + cls.add_binary_comparison_operator('==') + ## address.h (module 'network'): ns3::Address::Address() [constructor] + cls.add_constructor([]) + ## address.h (module 'network'): ns3::Address::Address(uint8_t type, uint8_t const * buffer, uint8_t len) [constructor] + cls.add_constructor([param('uint8_t', 'type'), param('uint8_t const *', 'buffer'), param('uint8_t', 'len')]) + ## address.h (module 'network'): ns3::Address::Address(ns3::Address const & address) [copy constructor] + cls.add_constructor([param('ns3::Address const &', 'address')]) + ## address.h (module 'network'): bool ns3::Address::CheckCompatible(uint8_t type, uint8_t len) const [member function] + cls.add_method('CheckCompatible', + 'bool', + [param('uint8_t', 'type'), param('uint8_t', 'len')], + is_const=True) + ## address.h (module 'network'): uint32_t ns3::Address::CopyAllFrom(uint8_t const * buffer, uint8_t len) [member function] + cls.add_method('CopyAllFrom', + 'uint32_t', + [param('uint8_t const *', 'buffer'), param('uint8_t', 'len')]) + ## address.h (module 'network'): uint32_t ns3::Address::CopyAllTo(uint8_t * buffer, uint8_t len) const [member function] + cls.add_method('CopyAllTo', + 'uint32_t', + [param('uint8_t *', 'buffer'), param('uint8_t', 'len')], + is_const=True) + ## address.h (module 'network'): uint32_t ns3::Address::CopyFrom(uint8_t const * buffer, uint8_t len) [member function] + cls.add_method('CopyFrom', + 'uint32_t', + [param('uint8_t const *', 'buffer'), param('uint8_t', 'len')]) + ## address.h (module 'network'): uint32_t ns3::Address::CopyTo(uint8_t * buffer) const [member function] + cls.add_method('CopyTo', + 'uint32_t', + [param('uint8_t *', 'buffer')], + is_const=True) + ## address.h (module 'network'): void ns3::Address::Deserialize(ns3::TagBuffer buffer) [member function] + cls.add_method('Deserialize', + 'void', + [param('ns3::TagBuffer', 'buffer')]) + ## address.h (module 'network'): uint8_t ns3::Address::GetLength() const [member function] + cls.add_method('GetLength', + 'uint8_t', + [], + is_const=True) + ## address.h (module 'network'): uint32_t ns3::Address::GetSerializedSize() const [member function] + cls.add_method('GetSerializedSize', + 'uint32_t', + [], + is_const=True) + ## address.h (module 'network'): bool ns3::Address::IsInvalid() const [member function] + cls.add_method('IsInvalid', + 'bool', + [], + is_const=True) + ## address.h (module 'network'): bool ns3::Address::IsMatchingType(uint8_t type) const [member function] + cls.add_method('IsMatchingType', + 'bool', + [param('uint8_t', 'type')], + is_const=True) + ## address.h (module 'network'): static uint8_t ns3::Address::Register() [member function] + cls.add_method('Register', + 'uint8_t', + [], + is_static=True) + ## address.h (module 'network'): void ns3::Address::Serialize(ns3::TagBuffer buffer) const [member function] + cls.add_method('Serialize', + 'void', + [param('ns3::TagBuffer', 'buffer')], + is_const=True) + return + +def register_Ns3AttributeConstructionList_methods(root_module, cls): + ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList(ns3::AttributeConstructionList const & arg0) [copy constructor] + cls.add_constructor([param('ns3::AttributeConstructionList const &', 'arg0')]) + ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList() [constructor] + cls.add_constructor([]) + ## attribute-construction-list.h (module 'core'): void ns3::AttributeConstructionList::Add(std::string name, ns3::Ptr checker, ns3::Ptr value) [member function] + cls.add_method('Add', + 'void', + [param('std::string', 'name'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker'), param('ns3::Ptr< ns3::AttributeValue >', 'value')]) + ## attribute-construction-list.h (module 'core'): std::_List_const_iterator ns3::AttributeConstructionList::Begin() const [member function] + cls.add_method('Begin', + 'std::_List_const_iterator< ns3::AttributeConstructionList::Item >', + [], + is_const=True) + ## attribute-construction-list.h (module 'core'): std::_List_const_iterator ns3::AttributeConstructionList::End() const [member function] + cls.add_method('End', + 'std::_List_const_iterator< ns3::AttributeConstructionList::Item >', + [], + is_const=True) + ## attribute-construction-list.h (module 'core'): ns3::Ptr ns3::AttributeConstructionList::Find(ns3::Ptr checker) const [member function] + cls.add_method('Find', + 'ns3::Ptr< ns3::AttributeValue >', + [param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')], + is_const=True) + return + +def register_Ns3AttributeConstructionListItem_methods(root_module, cls): + ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item() [constructor] + cls.add_constructor([]) + ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::Item(ns3::AttributeConstructionList::Item const & arg0) [copy constructor] + cls.add_constructor([param('ns3::AttributeConstructionList::Item const &', 'arg0')]) + ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::checker [variable] + cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False) + ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::name [variable] + cls.add_instance_attribute('name', 'std::string', is_const=False) + ## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::Item::value [variable] + cls.add_instance_attribute('value', 'ns3::Ptr< ns3::AttributeValue >', is_const=False) + return + +def register_Ns3Buffer_methods(root_module, cls): + ## buffer.h (module 'network'): ns3::Buffer::Buffer() [constructor] + cls.add_constructor([]) + ## buffer.h (module 'network'): ns3::Buffer::Buffer(uint32_t dataSize) [constructor] + cls.add_constructor([param('uint32_t', 'dataSize')]) + ## buffer.h (module 'network'): ns3::Buffer::Buffer(uint32_t dataSize, bool initialize) [constructor] + cls.add_constructor([param('uint32_t', 'dataSize'), param('bool', 'initialize')]) + ## buffer.h (module 'network'): ns3::Buffer::Buffer(ns3::Buffer const & o) [copy constructor] + cls.add_constructor([param('ns3::Buffer const &', 'o')]) + ## buffer.h (module 'network'): void ns3::Buffer::AddAtEnd(uint32_t end) [member function] + cls.add_method('AddAtEnd', + 'void', + [param('uint32_t', 'end')]) + ## buffer.h (module 'network'): void ns3::Buffer::AddAtEnd(ns3::Buffer const & o) [member function] + cls.add_method('AddAtEnd', + 'void', + [param('ns3::Buffer const &', 'o')]) + ## buffer.h (module 'network'): void ns3::Buffer::AddAtStart(uint32_t start) [member function] + cls.add_method('AddAtStart', + 'void', + [param('uint32_t', 'start')]) + ## buffer.h (module 'network'): ns3::Buffer::Iterator ns3::Buffer::Begin() const [member function] + cls.add_method('Begin', + 'ns3::Buffer::Iterator', + [], + is_const=True) + ## buffer.h (module 'network'): void ns3::Buffer::CopyData(std::ostream * os, uint32_t size) const [member function] + cls.add_method('CopyData', + 'void', + [param('std::ostream *', 'os'), param('uint32_t', 'size')], + is_const=True) + ## buffer.h (module 'network'): uint32_t ns3::Buffer::CopyData(uint8_t * buffer, uint32_t size) const [member function] + cls.add_method('CopyData', + 'uint32_t', + [param('uint8_t *', 'buffer'), param('uint32_t', 'size')], + is_const=True) + ## buffer.h (module 'network'): ns3::Buffer ns3::Buffer::CreateFragment(uint32_t start, uint32_t length) const [member function] + cls.add_method('CreateFragment', + 'ns3::Buffer', + [param('uint32_t', 'start'), param('uint32_t', 'length')], + is_const=True) + ## buffer.h (module 'network'): uint32_t ns3::Buffer::Deserialize(uint8_t const * buffer, uint32_t size) [member function] + cls.add_method('Deserialize', + 'uint32_t', + [param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) + ## buffer.h (module 'network'): ns3::Buffer::Iterator ns3::Buffer::End() const [member function] + cls.add_method('End', + 'ns3::Buffer::Iterator', + [], + is_const=True) + ## buffer.h (module 'network'): uint32_t ns3::Buffer::GetSerializedSize() const [member function] + cls.add_method('GetSerializedSize', + 'uint32_t', + [], + is_const=True) + ## buffer.h (module 'network'): uint32_t ns3::Buffer::GetSize() const [member function] + cls.add_method('GetSize', + 'uint32_t', + [], + is_const=True) + ## buffer.h (module 'network'): uint8_t const * ns3::Buffer::PeekData() const [member function] + cls.add_method('PeekData', + 'uint8_t const *', + [], + is_const=True) + ## buffer.h (module 'network'): void ns3::Buffer::RemoveAtEnd(uint32_t end) [member function] + cls.add_method('RemoveAtEnd', + 'void', + [param('uint32_t', 'end')]) + ## buffer.h (module 'network'): void ns3::Buffer::RemoveAtStart(uint32_t start) [member function] + cls.add_method('RemoveAtStart', + 'void', + [param('uint32_t', 'start')]) + ## buffer.h (module 'network'): uint32_t ns3::Buffer::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function] + cls.add_method('Serialize', + 'uint32_t', + [param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')], + is_const=True) + return + +def register_Ns3BufferIterator_methods(root_module, cls): + ## buffer.h (module 'network'): ns3::Buffer::Iterator::Iterator(ns3::Buffer::Iterator const & arg0) [copy constructor] + cls.add_constructor([param('ns3::Buffer::Iterator const &', 'arg0')]) + ## buffer.h (module 'network'): ns3::Buffer::Iterator::Iterator() [constructor] + cls.add_constructor([]) + ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::CalculateIpChecksum(uint16_t size) [member function] + cls.add_method('CalculateIpChecksum', + 'uint16_t', + [param('uint16_t', 'size')]) + ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::CalculateIpChecksum(uint16_t size, uint32_t initialChecksum) [member function] + cls.add_method('CalculateIpChecksum', + 'uint16_t', + [param('uint16_t', 'size'), param('uint32_t', 'initialChecksum')]) + ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetDistanceFrom(ns3::Buffer::Iterator const & o) const [member function] + cls.add_method('GetDistanceFrom', + 'uint32_t', + [param('ns3::Buffer::Iterator const &', 'o')], + is_const=True) + ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::GetSize() const [member function] + cls.add_method('GetSize', + 'uint32_t', + [], + is_const=True) + ## buffer.h (module 'network'): bool ns3::Buffer::Iterator::IsEnd() const [member function] + cls.add_method('IsEnd', + 'bool', + [], + is_const=True) + ## buffer.h (module 'network'): bool ns3::Buffer::Iterator::IsStart() const [member function] + cls.add_method('IsStart', + 'bool', + [], + is_const=True) + ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Next() [member function] + cls.add_method('Next', + 'void', + []) + ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Next(uint32_t delta) [member function] + cls.add_method('Next', + 'void', + [param('uint32_t', 'delta')]) + ## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::PeekU8() [member function] + cls.add_method('PeekU8', + 'uint8_t', + []) + ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev() [member function] + cls.add_method('Prev', + 'void', + []) + ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Prev(uint32_t delta) [member function] + cls.add_method('Prev', + 'void', + [param('uint32_t', 'delta')]) + ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(uint8_t * buffer, uint32_t size) [member function] + cls.add_method('Read', + 'void', + [param('uint8_t *', 'buffer'), param('uint32_t', 'size')]) + ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Read(ns3::Buffer::Iterator start, uint32_t size) [member function] + cls.add_method('Read', + 'void', + [param('ns3::Buffer::Iterator', 'start'), param('uint32_t', 'size')]) + ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadLsbtohU16() [member function] + cls.add_method('ReadLsbtohU16', + 'uint16_t', + []) + ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadLsbtohU32() [member function] + cls.add_method('ReadLsbtohU32', + 'uint32_t', + []) + ## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadLsbtohU64() [member function] + cls.add_method('ReadLsbtohU64', + 'uint64_t', + []) + ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadNtohU16() [member function] + cls.add_method('ReadNtohU16', + 'uint16_t', + []) + ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadNtohU32() [member function] + cls.add_method('ReadNtohU32', + 'uint32_t', + []) + ## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadNtohU64() [member function] + cls.add_method('ReadNtohU64', + 'uint64_t', + []) + ## buffer.h (module 'network'): uint16_t ns3::Buffer::Iterator::ReadU16() [member function] + cls.add_method('ReadU16', + 'uint16_t', + []) + ## buffer.h (module 'network'): uint32_t ns3::Buffer::Iterator::ReadU32() [member function] + cls.add_method('ReadU32', + 'uint32_t', + []) + ## buffer.h (module 'network'): uint64_t ns3::Buffer::Iterator::ReadU64() [member function] + cls.add_method('ReadU64', + 'uint64_t', + []) + ## buffer.h (module 'network'): uint8_t ns3::Buffer::Iterator::ReadU8() [member function] + cls.add_method('ReadU8', + 'uint8_t', + []) + ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Write(uint8_t const * buffer, uint32_t size) [member function] + cls.add_method('Write', + 'void', + [param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) + ## buffer.h (module 'network'): void ns3::Buffer::Iterator::Write(ns3::Buffer::Iterator start, ns3::Buffer::Iterator end) [member function] + cls.add_method('Write', + 'void', + [param('ns3::Buffer::Iterator', 'start'), param('ns3::Buffer::Iterator', 'end')]) + ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU16(uint16_t data) [member function] + cls.add_method('WriteHtolsbU16', + 'void', + [param('uint16_t', 'data')]) + ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU32(uint32_t data) [member function] + cls.add_method('WriteHtolsbU32', + 'void', + [param('uint32_t', 'data')]) + ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtolsbU64(uint64_t data) [member function] + cls.add_method('WriteHtolsbU64', + 'void', + [param('uint64_t', 'data')]) + ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU16(uint16_t data) [member function] + cls.add_method('WriteHtonU16', + 'void', + [param('uint16_t', 'data')]) + ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU32(uint32_t data) [member function] + cls.add_method('WriteHtonU32', + 'void', + [param('uint32_t', 'data')]) + ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteHtonU64(uint64_t data) [member function] + cls.add_method('WriteHtonU64', + 'void', + [param('uint64_t', 'data')]) + ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU16(uint16_t data) [member function] + cls.add_method('WriteU16', + 'void', + [param('uint16_t', 'data')]) + ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU32(uint32_t data) [member function] + cls.add_method('WriteU32', + 'void', + [param('uint32_t', 'data')]) + ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU64(uint64_t data) [member function] + cls.add_method('WriteU64', + 'void', + [param('uint64_t', 'data')]) + ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU8(uint8_t data) [member function] + cls.add_method('WriteU8', + 'void', + [param('uint8_t', 'data')]) + ## buffer.h (module 'network'): void ns3::Buffer::Iterator::WriteU8(uint8_t data, uint32_t len) [member function] + cls.add_method('WriteU8', + 'void', + [param('uint8_t', 'data'), param('uint32_t', 'len')]) + return + +def register_Ns3ByteTagIterator_methods(root_module, cls): + ## packet.h (module 'network'): ns3::ByteTagIterator::ByteTagIterator(ns3::ByteTagIterator const & arg0) [copy constructor] + cls.add_constructor([param('ns3::ByteTagIterator const &', 'arg0')]) + ## packet.h (module 'network'): bool ns3::ByteTagIterator::HasNext() const [member function] + cls.add_method('HasNext', + 'bool', + [], + is_const=True) + ## packet.h (module 'network'): ns3::ByteTagIterator::Item ns3::ByteTagIterator::Next() [member function] + cls.add_method('Next', + 'ns3::ByteTagIterator::Item', + []) + return + +def register_Ns3ByteTagIteratorItem_methods(root_module, cls): + ## packet.h (module 'network'): ns3::ByteTagIterator::Item::Item(ns3::ByteTagIterator::Item const & arg0) [copy constructor] + cls.add_constructor([param('ns3::ByteTagIterator::Item const &', 'arg0')]) + ## packet.h (module 'network'): uint32_t ns3::ByteTagIterator::Item::GetEnd() const [member function] + cls.add_method('GetEnd', + 'uint32_t', + [], + is_const=True) + ## packet.h (module 'network'): uint32_t ns3::ByteTagIterator::Item::GetStart() const [member function] + cls.add_method('GetStart', + 'uint32_t', + [], + is_const=True) + ## packet.h (module 'network'): void ns3::ByteTagIterator::Item::GetTag(ns3::Tag & tag) const [member function] + cls.add_method('GetTag', + 'void', + [param('ns3::Tag &', 'tag')], + is_const=True) + ## packet.h (module 'network'): ns3::TypeId ns3::ByteTagIterator::Item::GetTypeId() const [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_const=True) + return + +def register_Ns3ByteTagList_methods(root_module, cls): + ## byte-tag-list.h (module 'network'): ns3::ByteTagList::ByteTagList() [constructor] + cls.add_constructor([]) + ## byte-tag-list.h (module 'network'): ns3::ByteTagList::ByteTagList(ns3::ByteTagList const & o) [copy constructor] + cls.add_constructor([param('ns3::ByteTagList const &', 'o')]) + ## byte-tag-list.h (module 'network'): ns3::TagBuffer ns3::ByteTagList::Add(ns3::TypeId tid, uint32_t bufferSize, int32_t start, int32_t end) [member function] + cls.add_method('Add', + 'ns3::TagBuffer', + [param('ns3::TypeId', 'tid'), param('uint32_t', 'bufferSize'), param('int32_t', 'start'), param('int32_t', 'end')]) + ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::Add(ns3::ByteTagList const & o) [member function] + cls.add_method('Add', + 'void', + [param('ns3::ByteTagList const &', 'o')]) + ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::AddAtEnd(int32_t appendOffset) [member function] + cls.add_method('AddAtEnd', + 'void', + [param('int32_t', 'appendOffset')]) + ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::AddAtStart(int32_t prependOffset) [member function] + cls.add_method('AddAtStart', + 'void', + [param('int32_t', 'prependOffset')]) + ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::Adjust(int32_t adjustment) [member function] + cls.add_method('Adjust', + 'void', + [param('int32_t', 'adjustment')]) + ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator ns3::ByteTagList::Begin(int32_t offsetStart, int32_t offsetEnd) const [member function] + cls.add_method('Begin', + 'ns3::ByteTagList::Iterator', + [param('int32_t', 'offsetStart'), param('int32_t', 'offsetEnd')], + is_const=True) + ## byte-tag-list.h (module 'network'): void ns3::ByteTagList::RemoveAll() [member function] + cls.add_method('RemoveAll', + 'void', + []) + return + +def register_Ns3ByteTagListIterator_methods(root_module, cls): + ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Iterator(ns3::ByteTagList::Iterator const & arg0) [copy constructor] + cls.add_constructor([param('ns3::ByteTagList::Iterator const &', 'arg0')]) + ## byte-tag-list.h (module 'network'): uint32_t ns3::ByteTagList::Iterator::GetOffsetStart() const [member function] + cls.add_method('GetOffsetStart', + 'uint32_t', + [], + is_const=True) + ## byte-tag-list.h (module 'network'): bool ns3::ByteTagList::Iterator::HasNext() const [member function] + cls.add_method('HasNext', + 'bool', + [], + is_const=True) + ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item ns3::ByteTagList::Iterator::Next() [member function] + cls.add_method('Next', + 'ns3::ByteTagList::Iterator::Item', + []) + return + +def register_Ns3ByteTagListIteratorItem_methods(root_module, cls): + ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::Item(ns3::ByteTagList::Iterator::Item const & arg0) [copy constructor] + cls.add_constructor([param('ns3::ByteTagList::Iterator::Item const &', 'arg0')]) + ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::Item(ns3::TagBuffer buf) [constructor] + cls.add_constructor([param('ns3::TagBuffer', 'buf')]) + ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::buf [variable] + cls.add_instance_attribute('buf', 'ns3::TagBuffer', is_const=False) + ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::end [variable] + cls.add_instance_attribute('end', 'int32_t', is_const=False) + ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::size [variable] + cls.add_instance_attribute('size', 'uint32_t', is_const=False) + ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::start [variable] + cls.add_instance_attribute('start', 'int32_t', is_const=False) + ## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item::tid [variable] + cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False) + return + +def register_Ns3CallbackBase_methods(root_module, cls): + ## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::CallbackBase const & arg0) [copy constructor] + cls.add_constructor([param('ns3::CallbackBase const &', 'arg0')]) + ## callback.h (module 'core'): ns3::CallbackBase::CallbackBase() [constructor] + cls.add_constructor([]) + ## callback.h (module 'core'): ns3::Ptr ns3::CallbackBase::GetImpl() const [member function] + cls.add_method('GetImpl', + 'ns3::Ptr< ns3::CallbackImplBase >', + [], + is_const=True) + ## callback.h (module 'core'): ns3::CallbackBase::CallbackBase(ns3::Ptr impl) [constructor] + cls.add_constructor([param('ns3::Ptr< ns3::CallbackImplBase >', 'impl')], + visibility='protected') + return + +def register_Ns3DeviceEnergyModelContainer_methods(root_module, cls): + ## device-energy-model-container.h (module 'energy'): ns3::DeviceEnergyModelContainer::DeviceEnergyModelContainer(ns3::DeviceEnergyModelContainer const & arg0) [copy constructor] + cls.add_constructor([param('ns3::DeviceEnergyModelContainer const &', 'arg0')]) + ## device-energy-model-container.h (module 'energy'): ns3::DeviceEnergyModelContainer::DeviceEnergyModelContainer() [constructor] + cls.add_constructor([]) + ## device-energy-model-container.h (module 'energy'): ns3::DeviceEnergyModelContainer::DeviceEnergyModelContainer(ns3::Ptr model) [constructor] + cls.add_constructor([param('ns3::Ptr< ns3::DeviceEnergyModel >', 'model')]) + ## device-energy-model-container.h (module 'energy'): ns3::DeviceEnergyModelContainer::DeviceEnergyModelContainer(std::string modelName) [constructor] + cls.add_constructor([param('std::string', 'modelName')]) + ## device-energy-model-container.h (module 'energy'): ns3::DeviceEnergyModelContainer::DeviceEnergyModelContainer(ns3::DeviceEnergyModelContainer const & a, ns3::DeviceEnergyModelContainer const & b) [constructor] + cls.add_constructor([param('ns3::DeviceEnergyModelContainer const &', 'a'), param('ns3::DeviceEnergyModelContainer const &', 'b')]) + ## device-energy-model-container.h (module 'energy'): void ns3::DeviceEnergyModelContainer::Add(ns3::DeviceEnergyModelContainer container) [member function] + cls.add_method('Add', + 'void', + [param('ns3::DeviceEnergyModelContainer', 'container')]) + ## device-energy-model-container.h (module 'energy'): void ns3::DeviceEnergyModelContainer::Add(ns3::Ptr model) [member function] + cls.add_method('Add', + 'void', + [param('ns3::Ptr< ns3::DeviceEnergyModel >', 'model')]) + ## device-energy-model-container.h (module 'energy'): void ns3::DeviceEnergyModelContainer::Add(std::string modelName) [member function] + cls.add_method('Add', + 'void', + [param('std::string', 'modelName')]) + ## device-energy-model-container.h (module 'energy'): __gnu_cxx::__normal_iterator*,std::vector, std::allocator > > > ns3::DeviceEnergyModelContainer::Begin() const [member function] + cls.add_method('Begin', + '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::DeviceEnergyModel > const, std::vector< ns3::Ptr< ns3::DeviceEnergyModel > > >', + [], + is_const=True) + ## device-energy-model-container.h (module 'energy'): void ns3::DeviceEnergyModelContainer::Clear() [member function] + cls.add_method('Clear', + 'void', + []) + ## device-energy-model-container.h (module 'energy'): __gnu_cxx::__normal_iterator*,std::vector, std::allocator > > > ns3::DeviceEnergyModelContainer::End() const [member function] + cls.add_method('End', + '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::DeviceEnergyModel > const, std::vector< ns3::Ptr< ns3::DeviceEnergyModel > > >', + [], + is_const=True) + ## device-energy-model-container.h (module 'energy'): ns3::Ptr ns3::DeviceEnergyModelContainer::Get(uint32_t i) const [member function] + cls.add_method('Get', + 'ns3::Ptr< ns3::DeviceEnergyModel >', + [param('uint32_t', 'i')], + is_const=True) + ## device-energy-model-container.h (module 'energy'): uint32_t ns3::DeviceEnergyModelContainer::GetN() const [member function] + cls.add_method('GetN', + 'uint32_t', + [], + is_const=True) + return + +def register_Ns3DeviceEnergyModelHelper_methods(root_module, cls): + ## energy-model-helper.h (module 'energy'): ns3::DeviceEnergyModelHelper::DeviceEnergyModelHelper() [constructor] + cls.add_constructor([]) + ## energy-model-helper.h (module 'energy'): ns3::DeviceEnergyModelHelper::DeviceEnergyModelHelper(ns3::DeviceEnergyModelHelper const & arg0) [copy constructor] + cls.add_constructor([param('ns3::DeviceEnergyModelHelper const &', 'arg0')]) + ## energy-model-helper.h (module 'energy'): ns3::DeviceEnergyModelContainer ns3::DeviceEnergyModelHelper::Install(ns3::Ptr device, ns3::Ptr source) const [member function] + cls.add_method('Install', + 'ns3::DeviceEnergyModelContainer', + [param('ns3::Ptr< ns3::NetDevice >', 'device'), param('ns3::Ptr< ns3::EnergySource >', 'source')], + is_const=True) + ## energy-model-helper.h (module 'energy'): ns3::DeviceEnergyModelContainer ns3::DeviceEnergyModelHelper::Install(ns3::NetDeviceContainer deviceContainer, ns3::EnergySourceContainer sourceContainer) const [member function] + cls.add_method('Install', + 'ns3::DeviceEnergyModelContainer', + [param('ns3::NetDeviceContainer', 'deviceContainer'), param('ns3::EnergySourceContainer', 'sourceContainer')], + is_const=True) + ## energy-model-helper.h (module 'energy'): void ns3::DeviceEnergyModelHelper::Set(std::string name, ns3::AttributeValue const & v) [member function] + cls.add_method('Set', + 'void', + [param('std::string', 'name'), param('ns3::AttributeValue const &', 'v')], + is_pure_virtual=True, is_virtual=True) + ## energy-model-helper.h (module 'energy'): ns3::Ptr ns3::DeviceEnergyModelHelper::DoInstall(ns3::Ptr device, ns3::Ptr source) const [member function] + cls.add_method('DoInstall', + 'ns3::Ptr< ns3::DeviceEnergyModel >', + [param('ns3::Ptr< ns3::NetDevice >', 'device'), param('ns3::Ptr< ns3::EnergySource >', 'source')], + is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True) + return + +def register_Ns3EnergySourceHelper_methods(root_module, cls): + ## energy-model-helper.h (module 'energy'): ns3::EnergySourceHelper::EnergySourceHelper() [constructor] + cls.add_constructor([]) + ## energy-model-helper.h (module 'energy'): ns3::EnergySourceHelper::EnergySourceHelper(ns3::EnergySourceHelper const & arg0) [copy constructor] + cls.add_constructor([param('ns3::EnergySourceHelper const &', 'arg0')]) + ## energy-model-helper.h (module 'energy'): ns3::EnergySourceContainer ns3::EnergySourceHelper::Install(ns3::Ptr node) const [member function] + cls.add_method('Install', + 'ns3::EnergySourceContainer', + [param('ns3::Ptr< ns3::Node >', 'node')], + is_const=True) + ## energy-model-helper.h (module 'energy'): ns3::EnergySourceContainer ns3::EnergySourceHelper::Install(ns3::NodeContainer c) const [member function] + cls.add_method('Install', + 'ns3::EnergySourceContainer', + [param('ns3::NodeContainer', 'c')], + is_const=True) + ## energy-model-helper.h (module 'energy'): ns3::EnergySourceContainer ns3::EnergySourceHelper::Install(std::string nodeName) const [member function] + cls.add_method('Install', + 'ns3::EnergySourceContainer', + [param('std::string', 'nodeName')], + is_const=True) + ## energy-model-helper.h (module 'energy'): ns3::EnergySourceContainer ns3::EnergySourceHelper::InstallAll() const [member function] + cls.add_method('InstallAll', + 'ns3::EnergySourceContainer', + [], + is_const=True) + ## energy-model-helper.h (module 'energy'): void ns3::EnergySourceHelper::Set(std::string name, ns3::AttributeValue const & v) [member function] + cls.add_method('Set', + 'void', + [param('std::string', 'name'), param('ns3::AttributeValue const &', 'v')], + is_pure_virtual=True, is_virtual=True) + ## energy-model-helper.h (module 'energy'): ns3::Ptr ns3::EnergySourceHelper::DoInstall(ns3::Ptr node) const [member function] + cls.add_method('DoInstall', + 'ns3::Ptr< ns3::EnergySource >', + [param('ns3::Ptr< ns3::Node >', 'node')], + is_pure_virtual=True, is_const=True, visibility='private', is_virtual=True) + return + +def register_Ns3EventId_methods(root_module, cls): + cls.add_binary_comparison_operator('!=') + cls.add_binary_comparison_operator('==') + ## event-id.h (module 'core'): ns3::EventId::EventId(ns3::EventId const & arg0) [copy constructor] + cls.add_constructor([param('ns3::EventId const &', 'arg0')]) + ## event-id.h (module 'core'): ns3::EventId::EventId() [constructor] + cls.add_constructor([]) + ## event-id.h (module 'core'): ns3::EventId::EventId(ns3::Ptr const & impl, uint64_t ts, uint32_t context, uint32_t uid) [constructor] + cls.add_constructor([param('ns3::Ptr< ns3::EventImpl > const &', 'impl'), param('uint64_t', 'ts'), param('uint32_t', 'context'), param('uint32_t', 'uid')]) + ## event-id.h (module 'core'): void ns3::EventId::Cancel() [member function] + cls.add_method('Cancel', + 'void', + []) + ## event-id.h (module 'core'): uint32_t ns3::EventId::GetContext() const [member function] + cls.add_method('GetContext', + 'uint32_t', + [], + is_const=True) + ## event-id.h (module 'core'): uint64_t ns3::EventId::GetTs() const [member function] + cls.add_method('GetTs', + 'uint64_t', + [], + is_const=True) + ## event-id.h (module 'core'): uint32_t ns3::EventId::GetUid() const [member function] + cls.add_method('GetUid', + 'uint32_t', + [], + is_const=True) + ## event-id.h (module 'core'): bool ns3::EventId::IsExpired() const [member function] + cls.add_method('IsExpired', + 'bool', + [], + is_const=True) + ## event-id.h (module 'core'): bool ns3::EventId::IsRunning() const [member function] + cls.add_method('IsRunning', + 'bool', + [], + is_const=True) + ## event-id.h (module 'core'): ns3::EventImpl * ns3::EventId::PeekEventImpl() const [member function] + cls.add_method('PeekEventImpl', + 'ns3::EventImpl *', + [], + is_const=True) + return + +def register_Ns3Hasher_methods(root_module, cls): + ## hash.h (module 'core'): ns3::Hasher::Hasher(ns3::Hasher const & arg0) [copy constructor] + cls.add_constructor([param('ns3::Hasher const &', 'arg0')]) + ## hash.h (module 'core'): ns3::Hasher::Hasher() [constructor] + cls.add_constructor([]) + ## hash.h (module 'core'): ns3::Hasher::Hasher(ns3::Ptr hp) [constructor] + cls.add_constructor([param('ns3::Ptr< ns3::Hash::Implementation >', 'hp')]) + ## hash.h (module 'core'): uint32_t ns3::Hasher::GetHash32(char const * buffer, size_t const size) [member function] + cls.add_method('GetHash32', + 'uint32_t', + [param('char const *', 'buffer'), param('size_t const', 'size')]) + ## hash.h (module 'core'): uint32_t ns3::Hasher::GetHash32(std::string const s) [member function] + cls.add_method('GetHash32', + 'uint32_t', + [param('std::string const', 's')]) + ## hash.h (module 'core'): uint64_t ns3::Hasher::GetHash64(char const * buffer, size_t const size) [member function] + cls.add_method('GetHash64', + 'uint64_t', + [param('char const *', 'buffer'), param('size_t const', 'size')]) + ## hash.h (module 'core'): uint64_t ns3::Hasher::GetHash64(std::string const s) [member function] + cls.add_method('GetHash64', + 'uint64_t', + [param('std::string const', 's')]) + ## hash.h (module 'core'): ns3::Hasher & ns3::Hasher::clear() [member function] + cls.add_method('clear', + 'ns3::Hasher &', + []) + return + +def register_Ns3Ipv4Address_methods(root_module, cls): + cls.add_binary_comparison_operator('<') + cls.add_binary_comparison_operator('!=') + cls.add_output_stream_operator() + cls.add_binary_comparison_operator('==') + ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(ns3::Ipv4Address const & arg0) [copy constructor] + cls.add_constructor([param('ns3::Ipv4Address const &', 'arg0')]) + ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address() [constructor] + cls.add_constructor([]) + ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(uint32_t address) [constructor] + cls.add_constructor([param('uint32_t', 'address')]) + ## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(char const * address) [constructor] + cls.add_constructor([param('char const *', 'address')]) + ## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4Address::CombineMask(ns3::Ipv4Mask const & mask) const [member function] + cls.add_method('CombineMask', + 'ns3::Ipv4Address', + [param('ns3::Ipv4Mask const &', 'mask')], + is_const=True) + ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::ConvertFrom(ns3::Address const & address) [member function] + cls.add_method('ConvertFrom', + 'ns3::Ipv4Address', + [param('ns3::Address const &', 'address')], + is_static=True) + ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::Deserialize(uint8_t const * buf) [member function] + cls.add_method('Deserialize', + 'ns3::Ipv4Address', + [param('uint8_t const *', 'buf')], + is_static=True) + ## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Address::Get() const [member function] + cls.add_method('Get', + 'uint32_t', + [], + is_const=True) + ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetAny() [member function] + cls.add_method('GetAny', + 'ns3::Ipv4Address', + [], + is_static=True) + ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetBroadcast() [member function] + cls.add_method('GetBroadcast', + 'ns3::Ipv4Address', + [], + is_static=True) + ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetLoopback() [member function] + cls.add_method('GetLoopback', + 'ns3::Ipv4Address', + [], + is_static=True) + ## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4Address::GetSubnetDirectedBroadcast(ns3::Ipv4Mask const & mask) const [member function] + cls.add_method('GetSubnetDirectedBroadcast', + 'ns3::Ipv4Address', + [param('ns3::Ipv4Mask const &', 'mask')], + is_const=True) + ## ipv4-address.h (module 'network'): static ns3::Ipv4Address ns3::Ipv4Address::GetZero() [member function] + cls.add_method('GetZero', + 'ns3::Ipv4Address', + [], + is_static=True) + ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsBroadcast() const [member function] + cls.add_method('IsBroadcast', + 'bool', + [], + is_const=True) + ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsEqual(ns3::Ipv4Address const & other) const [member function] + cls.add_method('IsEqual', + 'bool', + [param('ns3::Ipv4Address const &', 'other')], + is_const=True) + ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsLocalMulticast() const [member function] + cls.add_method('IsLocalMulticast', + 'bool', + [], + is_const=True) + ## ipv4-address.h (module 'network'): static bool ns3::Ipv4Address::IsMatchingType(ns3::Address const & address) [member function] + cls.add_method('IsMatchingType', + 'bool', + [param('ns3::Address const &', 'address')], + is_static=True) + ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsMulticast() const [member function] + cls.add_method('IsMulticast', + 'bool', + [], + is_const=True) + ## ipv4-address.h (module 'network'): bool ns3::Ipv4Address::IsSubnetDirectedBroadcast(ns3::Ipv4Mask const & mask) const [member function] + cls.add_method('IsSubnetDirectedBroadcast', + 'bool', + [param('ns3::Ipv4Mask const &', 'mask')], + is_const=True) + ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Print(std::ostream & os) const [member function] + cls.add_method('Print', + 'void', + [param('std::ostream &', 'os')], + is_const=True) + ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Serialize(uint8_t * buf) const [member function] + cls.add_method('Serialize', + 'void', + [param('uint8_t *', 'buf')], + is_const=True) + ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Set(uint32_t address) [member function] + cls.add_method('Set', + 'void', + [param('uint32_t', 'address')]) + ## ipv4-address.h (module 'network'): void ns3::Ipv4Address::Set(char const * address) [member function] + cls.add_method('Set', + 'void', + [param('char const *', 'address')]) + return + +def register_Ns3Ipv4Mask_methods(root_module, cls): + cls.add_binary_comparison_operator('!=') + cls.add_output_stream_operator() + cls.add_binary_comparison_operator('==') + ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(ns3::Ipv4Mask const & arg0) [copy constructor] + cls.add_constructor([param('ns3::Ipv4Mask const &', 'arg0')]) + ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask() [constructor] + cls.add_constructor([]) + ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(uint32_t mask) [constructor] + cls.add_constructor([param('uint32_t', 'mask')]) + ## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(char const * mask) [constructor] + cls.add_constructor([param('char const *', 'mask')]) + ## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Mask::Get() const [member function] + cls.add_method('Get', + 'uint32_t', + [], + is_const=True) + ## ipv4-address.h (module 'network'): uint32_t ns3::Ipv4Mask::GetInverse() const [member function] + cls.add_method('GetInverse', + 'uint32_t', + [], + is_const=True) + ## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetLoopback() [member function] + cls.add_method('GetLoopback', + 'ns3::Ipv4Mask', + [], + is_static=True) + ## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetOnes() [member function] + cls.add_method('GetOnes', + 'ns3::Ipv4Mask', + [], + is_static=True) + ## ipv4-address.h (module 'network'): uint16_t ns3::Ipv4Mask::GetPrefixLength() const [member function] + cls.add_method('GetPrefixLength', + 'uint16_t', + [], + is_const=True) + ## ipv4-address.h (module 'network'): static ns3::Ipv4Mask ns3::Ipv4Mask::GetZero() [member function] + cls.add_method('GetZero', + 'ns3::Ipv4Mask', + [], + is_static=True) + ## ipv4-address.h (module 'network'): bool ns3::Ipv4Mask::IsEqual(ns3::Ipv4Mask other) const [member function] + cls.add_method('IsEqual', + 'bool', + [param('ns3::Ipv4Mask', 'other')], + is_const=True) + ## ipv4-address.h (module 'network'): bool ns3::Ipv4Mask::IsMatch(ns3::Ipv4Address a, ns3::Ipv4Address b) const [member function] + cls.add_method('IsMatch', + 'bool', + [param('ns3::Ipv4Address', 'a'), param('ns3::Ipv4Address', 'b')], + is_const=True) + ## ipv4-address.h (module 'network'): void ns3::Ipv4Mask::Print(std::ostream & os) const [member function] + cls.add_method('Print', + 'void', + [param('std::ostream &', 'os')], + is_const=True) + ## ipv4-address.h (module 'network'): void ns3::Ipv4Mask::Set(uint32_t mask) [member function] + cls.add_method('Set', + 'void', + [param('uint32_t', 'mask')]) + return + +def register_Ns3Ipv6Address_methods(root_module, cls): + cls.add_binary_comparison_operator('<') + cls.add_binary_comparison_operator('!=') + cls.add_output_stream_operator() + cls.add_binary_comparison_operator('==') + ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address() [constructor] + cls.add_constructor([]) + ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(char const * address) [constructor] + cls.add_constructor([param('char const *', 'address')]) + ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(uint8_t * address) [constructor] + cls.add_constructor([param('uint8_t *', 'address')]) + ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(ns3::Ipv6Address const & addr) [copy constructor] + cls.add_constructor([param('ns3::Ipv6Address const &', 'addr')]) + ## ipv6-address.h (module 'network'): ns3::Ipv6Address::Ipv6Address(ns3::Ipv6Address const * addr) [constructor] + cls.add_constructor([param('ns3::Ipv6Address const *', 'addr')]) + ## ipv6-address.h (module 'network'): ns3::Ipv6Address ns3::Ipv6Address::CombinePrefix(ns3::Ipv6Prefix const & prefix) [member function] + cls.add_method('CombinePrefix', + 'ns3::Ipv6Address', + [param('ns3::Ipv6Prefix const &', 'prefix')]) + ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::ConvertFrom(ns3::Address const & address) [member function] + cls.add_method('ConvertFrom', + 'ns3::Ipv6Address', + [param('ns3::Address const &', 'address')], + is_static=True) + ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::Deserialize(uint8_t const * buf) [member function] + cls.add_method('Deserialize', + 'ns3::Ipv6Address', + [param('uint8_t const *', 'buf')], + is_static=True) + ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllHostsMulticast() [member function] + cls.add_method('GetAllHostsMulticast', + 'ns3::Ipv6Address', + [], + is_static=True) + ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllNodesMulticast() [member function] + cls.add_method('GetAllNodesMulticast', + 'ns3::Ipv6Address', + [], + is_static=True) + ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAllRoutersMulticast() [member function] + cls.add_method('GetAllRoutersMulticast', + 'ns3::Ipv6Address', + [], + is_static=True) + ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetAny() [member function] + cls.add_method('GetAny', + 'ns3::Ipv6Address', + [], + is_static=True) + ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::GetBytes(uint8_t * buf) const [member function] + cls.add_method('GetBytes', + 'void', + [param('uint8_t *', 'buf')], + is_const=True) + ## ipv6-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv6Address::GetIpv4MappedAddress() const [member function] + cls.add_method('GetIpv4MappedAddress', + 'ns3::Ipv4Address', + [], + is_const=True) + ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetLoopback() [member function] + cls.add_method('GetLoopback', + 'ns3::Ipv6Address', + [], + is_static=True) + ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetOnes() [member function] + cls.add_method('GetOnes', + 'ns3::Ipv6Address', + [], + is_static=True) + ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::GetZero() [member function] + cls.add_method('GetZero', + 'ns3::Ipv6Address', + [], + is_static=True) + ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllHostsMulticast() const [member function] + cls.add_method('IsAllHostsMulticast', + 'bool', + [], + is_const=True) + ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllNodesMulticast() const [member function] + cls.add_method('IsAllNodesMulticast', + 'bool', + [], + is_const=True) + ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAllRoutersMulticast() const [member function] + cls.add_method('IsAllRoutersMulticast', + 'bool', + [], + is_const=True) + ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsAny() const [member function] + cls.add_method('IsAny', + 'bool', + [], + is_const=True) + ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsDocumentation() const [member function] + cls.add_method('IsDocumentation', + 'bool', + [], + is_const=True) + ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsEqual(ns3::Ipv6Address const & other) const [member function] + cls.add_method('IsEqual', + 'bool', + [param('ns3::Ipv6Address const &', 'other')], + is_const=True) + ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsIpv4MappedAddress() const [member function] + cls.add_method('IsIpv4MappedAddress', + 'bool', + [], + is_const=True) + ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLinkLocal() const [member function] + cls.add_method('IsLinkLocal', + 'bool', + [], + is_const=True) + ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLinkLocalMulticast() const [member function] + cls.add_method('IsLinkLocalMulticast', + 'bool', + [], + is_const=True) + ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsLocalhost() const [member function] + cls.add_method('IsLocalhost', + 'bool', + [], + is_const=True) + ## ipv6-address.h (module 'network'): static bool ns3::Ipv6Address::IsMatchingType(ns3::Address const & address) [member function] + cls.add_method('IsMatchingType', + 'bool', + [param('ns3::Address const &', 'address')], + is_static=True) + ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsMulticast() const [member function] + cls.add_method('IsMulticast', + 'bool', + [], + is_const=True) + ## ipv6-address.h (module 'network'): bool ns3::Ipv6Address::IsSolicitedMulticast() const [member function] + cls.add_method('IsSolicitedMulticast', + 'bool', + [], + is_const=True) + ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress(ns3::Mac16Address addr, ns3::Ipv6Address prefix) [member function] + cls.add_method('MakeAutoconfiguredAddress', + 'ns3::Ipv6Address', + [param('ns3::Mac16Address', 'addr'), param('ns3::Ipv6Address', 'prefix')], + is_static=True) + ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress(ns3::Mac48Address addr, ns3::Ipv6Address prefix) [member function] + cls.add_method('MakeAutoconfiguredAddress', + 'ns3::Ipv6Address', + [param('ns3::Mac48Address', 'addr'), param('ns3::Ipv6Address', 'prefix')], + is_static=True) + ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredAddress(ns3::Mac64Address addr, ns3::Ipv6Address prefix) [member function] + cls.add_method('MakeAutoconfiguredAddress', + 'ns3::Ipv6Address', + [param('ns3::Mac64Address', 'addr'), param('ns3::Ipv6Address', 'prefix')], + is_static=True) + ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(ns3::Mac16Address mac) [member function] + cls.add_method('MakeAutoconfiguredLinkLocalAddress', + 'ns3::Ipv6Address', + [param('ns3::Mac16Address', 'mac')], + is_static=True) + ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(ns3::Mac48Address mac) [member function] + cls.add_method('MakeAutoconfiguredLinkLocalAddress', + 'ns3::Ipv6Address', + [param('ns3::Mac48Address', 'mac')], + is_static=True) + ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeAutoconfiguredLinkLocalAddress(ns3::Mac64Address mac) [member function] + cls.add_method('MakeAutoconfiguredLinkLocalAddress', + 'ns3::Ipv6Address', + [param('ns3::Mac64Address', 'mac')], + is_static=True) + ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeIpv4MappedAddress(ns3::Ipv4Address addr) [member function] + cls.add_method('MakeIpv4MappedAddress', + 'ns3::Ipv6Address', + [param('ns3::Ipv4Address', 'addr')], + is_static=True) + ## ipv6-address.h (module 'network'): static ns3::Ipv6Address ns3::Ipv6Address::MakeSolicitedAddress(ns3::Ipv6Address addr) [member function] + cls.add_method('MakeSolicitedAddress', + 'ns3::Ipv6Address', + [param('ns3::Ipv6Address', 'addr')], + is_static=True) + ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Print(std::ostream & os) const [member function] + cls.add_method('Print', + 'void', + [param('std::ostream &', 'os')], + is_const=True) + ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Serialize(uint8_t * buf) const [member function] + cls.add_method('Serialize', + 'void', + [param('uint8_t *', 'buf')], + is_const=True) + ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Set(char const * address) [member function] + cls.add_method('Set', + 'void', + [param('char const *', 'address')]) + ## ipv6-address.h (module 'network'): void ns3::Ipv6Address::Set(uint8_t * address) [member function] + cls.add_method('Set', + 'void', + [param('uint8_t *', 'address')]) + return + +def register_Ns3Ipv6Prefix_methods(root_module, cls): + cls.add_binary_comparison_operator('!=') + cls.add_output_stream_operator() + cls.add_binary_comparison_operator('==') + ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix() [constructor] + cls.add_constructor([]) + ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(uint8_t * prefix) [constructor] + cls.add_constructor([param('uint8_t *', 'prefix')]) + ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(char const * prefix) [constructor] + cls.add_constructor([param('char const *', 'prefix')]) + ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(uint8_t prefix) [constructor] + cls.add_constructor([param('uint8_t', 'prefix')]) + ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(ns3::Ipv6Prefix const & prefix) [copy constructor] + cls.add_constructor([param('ns3::Ipv6Prefix const &', 'prefix')]) + ## ipv6-address.h (module 'network'): ns3::Ipv6Prefix::Ipv6Prefix(ns3::Ipv6Prefix const * prefix) [constructor] + cls.add_constructor([param('ns3::Ipv6Prefix const *', 'prefix')]) + ## ipv6-address.h (module 'network'): void ns3::Ipv6Prefix::GetBytes(uint8_t * buf) const [member function] + cls.add_method('GetBytes', + 'void', + [param('uint8_t *', 'buf')], + is_const=True) + ## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetLoopback() [member function] + cls.add_method('GetLoopback', + 'ns3::Ipv6Prefix', + [], + is_static=True) + ## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetOnes() [member function] + cls.add_method('GetOnes', + 'ns3::Ipv6Prefix', + [], + is_static=True) + ## ipv6-address.h (module 'network'): uint8_t ns3::Ipv6Prefix::GetPrefixLength() const [member function] + cls.add_method('GetPrefixLength', + 'uint8_t', + [], + is_const=True) + ## ipv6-address.h (module 'network'): static ns3::Ipv6Prefix ns3::Ipv6Prefix::GetZero() [member function] + cls.add_method('GetZero', + 'ns3::Ipv6Prefix', + [], + is_static=True) + ## ipv6-address.h (module 'network'): bool ns3::Ipv6Prefix::IsEqual(ns3::Ipv6Prefix const & other) const [member function] + cls.add_method('IsEqual', + 'bool', + [param('ns3::Ipv6Prefix const &', 'other')], + is_const=True) + ## ipv6-address.h (module 'network'): bool ns3::Ipv6Prefix::IsMatch(ns3::Ipv6Address a, ns3::Ipv6Address b) const [member function] + cls.add_method('IsMatch', + 'bool', + [param('ns3::Ipv6Address', 'a'), param('ns3::Ipv6Address', 'b')], + is_const=True) + ## ipv6-address.h (module 'network'): void ns3::Ipv6Prefix::Print(std::ostream & os) const [member function] + cls.add_method('Print', + 'void', + [param('std::ostream &', 'os')], + is_const=True) + return + +def register_Ns3Mac48Address_methods(root_module, cls): + cls.add_binary_comparison_operator('<') + cls.add_binary_comparison_operator('!=') + cls.add_output_stream_operator() + cls.add_binary_comparison_operator('==') + ## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address(ns3::Mac48Address const & arg0) [copy constructor] + cls.add_constructor([param('ns3::Mac48Address const &', 'arg0')]) + ## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address() [constructor] + cls.add_constructor([]) + ## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address(char const * str) [constructor] + cls.add_constructor([param('char const *', 'str')]) + ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::Allocate() [member function] + cls.add_method('Allocate', + 'ns3::Mac48Address', + [], + is_static=True) + ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::ConvertFrom(ns3::Address const & address) [member function] + cls.add_method('ConvertFrom', + 'ns3::Mac48Address', + [param('ns3::Address const &', 'address')], + is_static=True) + ## mac48-address.h (module 'network'): void ns3::Mac48Address::CopyFrom(uint8_t const * buffer) [member function] + cls.add_method('CopyFrom', + 'void', + [param('uint8_t const *', 'buffer')]) + ## mac48-address.h (module 'network'): void ns3::Mac48Address::CopyTo(uint8_t * buffer) const [member function] + cls.add_method('CopyTo', + 'void', + [param('uint8_t *', 'buffer')], + is_const=True) + ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetBroadcast() [member function] + cls.add_method('GetBroadcast', + 'ns3::Mac48Address', + [], + is_static=True) + ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticast(ns3::Ipv4Address address) [member function] + cls.add_method('GetMulticast', + 'ns3::Mac48Address', + [param('ns3::Ipv4Address', 'address')], + is_static=True) + ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticast(ns3::Ipv6Address address) [member function] + cls.add_method('GetMulticast', + 'ns3::Mac48Address', + [param('ns3::Ipv6Address', 'address')], + is_static=True) + ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticast6Prefix() [member function] + cls.add_method('GetMulticast6Prefix', + 'ns3::Mac48Address', + [], + is_static=True) + ## mac48-address.h (module 'network'): static ns3::Mac48Address ns3::Mac48Address::GetMulticastPrefix() [member function] + cls.add_method('GetMulticastPrefix', + 'ns3::Mac48Address', + [], + is_static=True) + ## mac48-address.h (module 'network'): bool ns3::Mac48Address::IsBroadcast() const [member function] + cls.add_method('IsBroadcast', + 'bool', + [], + is_const=True) + ## mac48-address.h (module 'network'): bool ns3::Mac48Address::IsGroup() const [member function] + cls.add_method('IsGroup', + 'bool', + [], + is_const=True) + ## mac48-address.h (module 'network'): static bool ns3::Mac48Address::IsMatchingType(ns3::Address const & address) [member function] + cls.add_method('IsMatchingType', + 'bool', + [param('ns3::Address const &', 'address')], + is_static=True) + return + +def register_Ns3NetDeviceContainer_methods(root_module, cls): + ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(ns3::NetDeviceContainer const & arg0) [copy constructor] + cls.add_constructor([param('ns3::NetDeviceContainer const &', 'arg0')]) + ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer() [constructor] + cls.add_constructor([]) + ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(ns3::Ptr dev) [constructor] + cls.add_constructor([param('ns3::Ptr< ns3::NetDevice >', 'dev')]) + ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(std::string devName) [constructor] + cls.add_constructor([param('std::string', 'devName')]) + ## net-device-container.h (module 'network'): ns3::NetDeviceContainer::NetDeviceContainer(ns3::NetDeviceContainer const & a, ns3::NetDeviceContainer const & b) [constructor] + cls.add_constructor([param('ns3::NetDeviceContainer const &', 'a'), param('ns3::NetDeviceContainer const &', 'b')]) + ## net-device-container.h (module 'network'): void ns3::NetDeviceContainer::Add(ns3::NetDeviceContainer other) [member function] + cls.add_method('Add', + 'void', + [param('ns3::NetDeviceContainer', 'other')]) + ## net-device-container.h (module 'network'): void ns3::NetDeviceContainer::Add(ns3::Ptr device) [member function] + cls.add_method('Add', + 'void', + [param('ns3::Ptr< ns3::NetDevice >', 'device')]) + ## net-device-container.h (module 'network'): void ns3::NetDeviceContainer::Add(std::string deviceName) [member function] + cls.add_method('Add', + 'void', + [param('std::string', 'deviceName')]) + ## net-device-container.h (module 'network'): __gnu_cxx::__normal_iterator*,std::vector, std::allocator > > > ns3::NetDeviceContainer::Begin() const [member function] + cls.add_method('Begin', + '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::NetDevice > const, std::vector< ns3::Ptr< ns3::NetDevice > > >', + [], + is_const=True) + ## net-device-container.h (module 'network'): __gnu_cxx::__normal_iterator*,std::vector, std::allocator > > > ns3::NetDeviceContainer::End() const [member function] + cls.add_method('End', + '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::NetDevice > const, std::vector< ns3::Ptr< ns3::NetDevice > > >', + [], + is_const=True) + ## net-device-container.h (module 'network'): ns3::Ptr ns3::NetDeviceContainer::Get(uint32_t i) const [member function] + cls.add_method('Get', + 'ns3::Ptr< ns3::NetDevice >', + [param('uint32_t', 'i')], + is_const=True) + ## net-device-container.h (module 'network'): uint32_t ns3::NetDeviceContainer::GetN() const [member function] + cls.add_method('GetN', + 'uint32_t', + [], + is_const=True) + return + +def register_Ns3NodeContainer_methods(root_module, cls): + ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & arg0) [copy constructor] + cls.add_constructor([param('ns3::NodeContainer const &', 'arg0')]) + ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer() [constructor] + cls.add_constructor([]) + ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::Ptr node) [constructor] + cls.add_constructor([param('ns3::Ptr< ns3::Node >', 'node')]) + ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(std::string nodeName) [constructor] + cls.add_constructor([param('std::string', 'nodeName')]) + ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b) [constructor] + cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b')]) + ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b, ns3::NodeContainer const & c) [constructor] + cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b'), param('ns3::NodeContainer const &', 'c')]) + ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b, ns3::NodeContainer const & c, ns3::NodeContainer const & d) [constructor] + cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b'), param('ns3::NodeContainer const &', 'c'), param('ns3::NodeContainer const &', 'd')]) + ## node-container.h (module 'network'): ns3::NodeContainer::NodeContainer(ns3::NodeContainer const & a, ns3::NodeContainer const & b, ns3::NodeContainer const & c, ns3::NodeContainer const & d, ns3::NodeContainer const & e) [constructor] + cls.add_constructor([param('ns3::NodeContainer const &', 'a'), param('ns3::NodeContainer const &', 'b'), param('ns3::NodeContainer const &', 'c'), param('ns3::NodeContainer const &', 'd'), param('ns3::NodeContainer const &', 'e')]) + ## node-container.h (module 'network'): void ns3::NodeContainer::Add(ns3::NodeContainer other) [member function] + cls.add_method('Add', + 'void', + [param('ns3::NodeContainer', 'other')]) + ## node-container.h (module 'network'): void ns3::NodeContainer::Add(ns3::Ptr node) [member function] + cls.add_method('Add', + 'void', + [param('ns3::Ptr< ns3::Node >', 'node')]) + ## node-container.h (module 'network'): void ns3::NodeContainer::Add(std::string nodeName) [member function] + cls.add_method('Add', + 'void', + [param('std::string', 'nodeName')]) + ## node-container.h (module 'network'): __gnu_cxx::__normal_iterator*,std::vector, std::allocator > > > ns3::NodeContainer::Begin() const [member function] + cls.add_method('Begin', + '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node > const, std::vector< ns3::Ptr< ns3::Node > > >', + [], + is_const=True) + ## node-container.h (module 'network'): void ns3::NodeContainer::Create(uint32_t n) [member function] + cls.add_method('Create', + 'void', + [param('uint32_t', 'n')]) + ## node-container.h (module 'network'): void ns3::NodeContainer::Create(uint32_t n, uint32_t systemId) [member function] + cls.add_method('Create', + 'void', + [param('uint32_t', 'n'), param('uint32_t', 'systemId')]) + ## node-container.h (module 'network'): __gnu_cxx::__normal_iterator*,std::vector, std::allocator > > > ns3::NodeContainer::End() const [member function] + cls.add_method('End', + '__gnu_cxx::__normal_iterator< ns3::Ptr< ns3::Node > const, std::vector< ns3::Ptr< ns3::Node > > >', + [], + is_const=True) + ## node-container.h (module 'network'): ns3::Ptr ns3::NodeContainer::Get(uint32_t i) const [member function] + cls.add_method('Get', + 'ns3::Ptr< ns3::Node >', + [param('uint32_t', 'i')], + is_const=True) + ## node-container.h (module 'network'): static ns3::NodeContainer ns3::NodeContainer::GetGlobal() [member function] + cls.add_method('GetGlobal', + 'ns3::NodeContainer', + [], + is_static=True) + ## node-container.h (module 'network'): uint32_t ns3::NodeContainer::GetN() const [member function] + cls.add_method('GetN', + 'uint32_t', + [], + is_const=True) + return + +def register_Ns3ObjectBase_methods(root_module, cls): + ## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase() [constructor] + cls.add_constructor([]) + ## object-base.h (module 'core'): ns3::ObjectBase::ObjectBase(ns3::ObjectBase const & arg0) [copy constructor] + cls.add_constructor([param('ns3::ObjectBase const &', 'arg0')]) + ## object-base.h (module 'core'): void ns3::ObjectBase::GetAttribute(std::string name, ns3::AttributeValue & value) const [member function] + cls.add_method('GetAttribute', + 'void', + [param('std::string', 'name'), param('ns3::AttributeValue &', 'value')], + is_const=True) + ## object-base.h (module 'core'): bool ns3::ObjectBase::GetAttributeFailSafe(std::string name, ns3::AttributeValue & value) const [member function] + cls.add_method('GetAttributeFailSafe', + 'bool', + [param('std::string', 'name'), param('ns3::AttributeValue &', 'value')], + is_const=True) + ## object-base.h (module 'core'): ns3::TypeId ns3::ObjectBase::GetInstanceTypeId() const [member function] + cls.add_method('GetInstanceTypeId', + 'ns3::TypeId', + [], + is_pure_virtual=True, is_const=True, is_virtual=True) + ## object-base.h (module 'core'): static ns3::TypeId ns3::ObjectBase::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) + ## object-base.h (module 'core'): void ns3::ObjectBase::SetAttribute(std::string name, ns3::AttributeValue const & value) [member function] + cls.add_method('SetAttribute', + 'void', + [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')]) + ## object-base.h (module 'core'): bool ns3::ObjectBase::SetAttributeFailSafe(std::string name, ns3::AttributeValue const & value) [member function] + cls.add_method('SetAttributeFailSafe', + 'bool', + [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')]) + ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function] + cls.add_method('TraceConnect', + 'bool', + [param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')]) + ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceConnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function] + cls.add_method('TraceConnectWithoutContext', + 'bool', + [param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')]) + ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnect(std::string name, std::string context, ns3::CallbackBase const & cb) [member function] + cls.add_method('TraceDisconnect', + 'bool', + [param('std::string', 'name'), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')]) + ## object-base.h (module 'core'): bool ns3::ObjectBase::TraceDisconnectWithoutContext(std::string name, ns3::CallbackBase const & cb) [member function] + cls.add_method('TraceDisconnectWithoutContext', + 'bool', + [param('std::string', 'name'), param('ns3::CallbackBase const &', 'cb')]) + ## object-base.h (module 'core'): void ns3::ObjectBase::ConstructSelf(ns3::AttributeConstructionList const & attributes) [member function] + cls.add_method('ConstructSelf', + 'void', + [param('ns3::AttributeConstructionList const &', 'attributes')], + visibility='protected') + ## object-base.h (module 'core'): void ns3::ObjectBase::NotifyConstructionCompleted() [member function] + cls.add_method('NotifyConstructionCompleted', + 'void', + [], + visibility='protected', is_virtual=True) + return + +def register_Ns3ObjectDeleter_methods(root_module, cls): + ## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter() [constructor] + cls.add_constructor([]) + ## object.h (module 'core'): ns3::ObjectDeleter::ObjectDeleter(ns3::ObjectDeleter const & arg0) [copy constructor] + cls.add_constructor([param('ns3::ObjectDeleter const &', 'arg0')]) + ## object.h (module 'core'): static void ns3::ObjectDeleter::Delete(ns3::Object * object) [member function] + cls.add_method('Delete', + 'void', + [param('ns3::Object *', 'object')], + is_static=True) + return + +def register_Ns3ObjectFactory_methods(root_module, cls): + cls.add_output_stream_operator() + ## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory(ns3::ObjectFactory const & arg0) [copy constructor] + cls.add_constructor([param('ns3::ObjectFactory const &', 'arg0')]) + ## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory() [constructor] + cls.add_constructor([]) + ## object-factory.h (module 'core'): ns3::ObjectFactory::ObjectFactory(std::string typeId) [constructor] + cls.add_constructor([param('std::string', 'typeId')]) + ## object-factory.h (module 'core'): ns3::Ptr ns3::ObjectFactory::Create() const [member function] + cls.add_method('Create', + 'ns3::Ptr< ns3::Object >', + [], + is_const=True) + ## object-factory.h (module 'core'): ns3::TypeId ns3::ObjectFactory::GetTypeId() const [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_const=True) + ## object-factory.h (module 'core'): void ns3::ObjectFactory::Set(std::string name, ns3::AttributeValue const & value) [member function] + cls.add_method('Set', + 'void', + [param('std::string', 'name'), param('ns3::AttributeValue const &', 'value')]) + ## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(ns3::TypeId tid) [member function] + cls.add_method('SetTypeId', + 'void', + [param('ns3::TypeId', 'tid')]) + ## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(char const * tid) [member function] + cls.add_method('SetTypeId', + 'void', + [param('char const *', 'tid')]) + ## object-factory.h (module 'core'): void ns3::ObjectFactory::SetTypeId(std::string tid) [member function] + cls.add_method('SetTypeId', + 'void', + [param('std::string', 'tid')]) + return + +def register_Ns3PacketMetadata_methods(root_module, cls): + ## packet-metadata.h (module 'network'): ns3::PacketMetadata::PacketMetadata(uint64_t uid, uint32_t size) [constructor] + cls.add_constructor([param('uint64_t', 'uid'), param('uint32_t', 'size')]) + ## packet-metadata.h (module 'network'): ns3::PacketMetadata::PacketMetadata(ns3::PacketMetadata const & o) [copy constructor] + cls.add_constructor([param('ns3::PacketMetadata const &', 'o')]) + ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddAtEnd(ns3::PacketMetadata const & o) [member function] + cls.add_method('AddAtEnd', + 'void', + [param('ns3::PacketMetadata const &', 'o')]) + ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddHeader(ns3::Header const & header, uint32_t size) [member function] + cls.add_method('AddHeader', + 'void', + [param('ns3::Header const &', 'header'), param('uint32_t', 'size')]) + ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddPaddingAtEnd(uint32_t end) [member function] + cls.add_method('AddPaddingAtEnd', + 'void', + [param('uint32_t', 'end')]) + ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::AddTrailer(ns3::Trailer const & trailer, uint32_t size) [member function] + cls.add_method('AddTrailer', + 'void', + [param('ns3::Trailer const &', 'trailer'), param('uint32_t', 'size')]) + ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator ns3::PacketMetadata::BeginItem(ns3::Buffer buffer) const [member function] + cls.add_method('BeginItem', + 'ns3::PacketMetadata::ItemIterator', + [param('ns3::Buffer', 'buffer')], + is_const=True) + ## packet-metadata.h (module 'network'): ns3::PacketMetadata ns3::PacketMetadata::CreateFragment(uint32_t start, uint32_t end) const [member function] + cls.add_method('CreateFragment', + 'ns3::PacketMetadata', + [param('uint32_t', 'start'), param('uint32_t', 'end')], + is_const=True) + ## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::Deserialize(uint8_t const * buffer, uint32_t size) [member function] + cls.add_method('Deserialize', + 'uint32_t', + [param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) + ## packet-metadata.h (module 'network'): static void ns3::PacketMetadata::Enable() [member function] + cls.add_method('Enable', + 'void', + [], + is_static=True) + ## packet-metadata.h (module 'network'): static void ns3::PacketMetadata::EnableChecking() [member function] + cls.add_method('EnableChecking', + 'void', + [], + is_static=True) + ## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::GetSerializedSize() const [member function] + cls.add_method('GetSerializedSize', + 'uint32_t', + [], + is_const=True) + ## packet-metadata.h (module 'network'): uint64_t ns3::PacketMetadata::GetUid() const [member function] + cls.add_method('GetUid', + 'uint64_t', + [], + is_const=True) + ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveAtEnd(uint32_t end) [member function] + cls.add_method('RemoveAtEnd', + 'void', + [param('uint32_t', 'end')]) + ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveAtStart(uint32_t start) [member function] + cls.add_method('RemoveAtStart', + 'void', + [param('uint32_t', 'start')]) + ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveHeader(ns3::Header const & header, uint32_t size) [member function] + cls.add_method('RemoveHeader', + 'void', + [param('ns3::Header const &', 'header'), param('uint32_t', 'size')]) + ## packet-metadata.h (module 'network'): void ns3::PacketMetadata::RemoveTrailer(ns3::Trailer const & trailer, uint32_t size) [member function] + cls.add_method('RemoveTrailer', + 'void', + [param('ns3::Trailer const &', 'trailer'), param('uint32_t', 'size')]) + ## packet-metadata.h (module 'network'): uint32_t ns3::PacketMetadata::Serialize(uint8_t * buffer, uint32_t maxSize) const [member function] + cls.add_method('Serialize', + 'uint32_t', + [param('uint8_t *', 'buffer'), param('uint32_t', 'maxSize')], + is_const=True) + return + +def register_Ns3PacketMetadataItem_methods(root_module, cls): + ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::Item() [constructor] + cls.add_constructor([]) + ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::Item(ns3::PacketMetadata::Item const & arg0) [copy constructor] + cls.add_constructor([param('ns3::PacketMetadata::Item const &', 'arg0')]) + ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::current [variable] + cls.add_instance_attribute('current', 'ns3::Buffer::Iterator', is_const=False) + ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentSize [variable] + cls.add_instance_attribute('currentSize', 'uint32_t', is_const=False) + ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentTrimedFromEnd [variable] + cls.add_instance_attribute('currentTrimedFromEnd', 'uint32_t', is_const=False) + ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::currentTrimedFromStart [variable] + cls.add_instance_attribute('currentTrimedFromStart', 'uint32_t', is_const=False) + ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::isFragment [variable] + cls.add_instance_attribute('isFragment', 'bool', is_const=False) + ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::tid [variable] + cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False) + return + +def register_Ns3PacketMetadataItemIterator_methods(root_module, cls): + ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator::ItemIterator(ns3::PacketMetadata::ItemIterator const & arg0) [copy constructor] + cls.add_constructor([param('ns3::PacketMetadata::ItemIterator const &', 'arg0')]) + ## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator::ItemIterator(ns3::PacketMetadata const * metadata, ns3::Buffer buffer) [constructor] + cls.add_constructor([param('ns3::PacketMetadata const *', 'metadata'), param('ns3::Buffer', 'buffer')]) + ## packet-metadata.h (module 'network'): bool ns3::PacketMetadata::ItemIterator::HasNext() const [member function] + cls.add_method('HasNext', + 'bool', + [], + is_const=True) + ## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item ns3::PacketMetadata::ItemIterator::Next() [member function] + cls.add_method('Next', + 'ns3::PacketMetadata::Item', + []) + return + +def register_Ns3PacketTagIterator_methods(root_module, cls): + ## packet.h (module 'network'): ns3::PacketTagIterator::PacketTagIterator(ns3::PacketTagIterator const & arg0) [copy constructor] + cls.add_constructor([param('ns3::PacketTagIterator const &', 'arg0')]) + ## packet.h (module 'network'): bool ns3::PacketTagIterator::HasNext() const [member function] + cls.add_method('HasNext', + 'bool', + [], + is_const=True) + ## packet.h (module 'network'): ns3::PacketTagIterator::Item ns3::PacketTagIterator::Next() [member function] + cls.add_method('Next', + 'ns3::PacketTagIterator::Item', + []) + return + +def register_Ns3PacketTagIteratorItem_methods(root_module, cls): + ## packet.h (module 'network'): ns3::PacketTagIterator::Item::Item(ns3::PacketTagIterator::Item const & arg0) [copy constructor] + cls.add_constructor([param('ns3::PacketTagIterator::Item const &', 'arg0')]) + ## packet.h (module 'network'): void ns3::PacketTagIterator::Item::GetTag(ns3::Tag & tag) const [member function] + cls.add_method('GetTag', + 'void', + [param('ns3::Tag &', 'tag')], + is_const=True) + ## packet.h (module 'network'): ns3::TypeId ns3::PacketTagIterator::Item::GetTypeId() const [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_const=True) + return + +def register_Ns3PacketTagList_methods(root_module, cls): + ## packet-tag-list.h (module 'network'): ns3::PacketTagList::PacketTagList() [constructor] + cls.add_constructor([]) + ## packet-tag-list.h (module 'network'): ns3::PacketTagList::PacketTagList(ns3::PacketTagList const & o) [copy constructor] + cls.add_constructor([param('ns3::PacketTagList const &', 'o')]) + ## packet-tag-list.h (module 'network'): void ns3::PacketTagList::Add(ns3::Tag const & tag) const [member function] + cls.add_method('Add', + 'void', + [param('ns3::Tag const &', 'tag')], + is_const=True) + ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData const * ns3::PacketTagList::Head() const [member function] + cls.add_method('Head', + 'ns3::PacketTagList::TagData const *', + [], + is_const=True) + ## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Peek(ns3::Tag & tag) const [member function] + cls.add_method('Peek', + 'bool', + [param('ns3::Tag &', 'tag')], + is_const=True) + ## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Remove(ns3::Tag & tag) [member function] + cls.add_method('Remove', + 'bool', + [param('ns3::Tag &', 'tag')]) + ## packet-tag-list.h (module 'network'): void ns3::PacketTagList::RemoveAll() [member function] + cls.add_method('RemoveAll', + 'void', + []) + ## packet-tag-list.h (module 'network'): bool ns3::PacketTagList::Replace(ns3::Tag & tag) [member function] + cls.add_method('Replace', + 'bool', + [param('ns3::Tag &', 'tag')]) + return + +def register_Ns3PacketTagListTagData_methods(root_module, cls): + ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData() [constructor] + cls.add_constructor([]) + ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::TagData(ns3::PacketTagList::TagData const & arg0) [copy constructor] + cls.add_constructor([param('ns3::PacketTagList::TagData const &', 'arg0')]) + ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::count [variable] + cls.add_instance_attribute('count', 'uint32_t', is_const=False) + ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::data [variable] + cls.add_instance_attribute('data', 'uint8_t [ 21 ]', is_const=False) + ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::next [variable] + cls.add_instance_attribute('next', 'ns3::PacketTagList::TagData *', is_const=False) + ## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData::tid [variable] + cls.add_instance_attribute('tid', 'ns3::TypeId', is_const=False) + return + +def register_Ns3Reservation_methods(root_module, cls): + ## uan-mac-rc.h (module 'uan'): ns3::Reservation::Reservation(ns3::Reservation const & arg0) [copy constructor] + cls.add_constructor([param('ns3::Reservation const &', 'arg0')]) + ## uan-mac-rc.h (module 'uan'): ns3::Reservation::Reservation() [constructor] + cls.add_constructor([]) + ## uan-mac-rc.h (module 'uan'): ns3::Reservation::Reservation(std::list, ns3::UanAddress>, std::allocator, ns3::UanAddress> > > & list, uint8_t frameNo, uint32_t maxPkts=0) [constructor] + cls.add_constructor([param('std::list< std::pair< ns3::Ptr< ns3::Packet >, ns3::UanAddress > > &', 'list'), param('uint8_t', 'frameNo'), param('uint32_t', 'maxPkts', default_value='0')]) + ## uan-mac-rc.h (module 'uan'): void ns3::Reservation::AddTimestamp(ns3::Time t) [member function] + cls.add_method('AddTimestamp', + 'void', + [param('ns3::Time', 't')]) + ## uan-mac-rc.h (module 'uan'): uint8_t ns3::Reservation::GetFrameNo() const [member function] + cls.add_method('GetFrameNo', + 'uint8_t', + [], + is_const=True) + ## uan-mac-rc.h (module 'uan'): uint32_t ns3::Reservation::GetLength() const [member function] + cls.add_method('GetLength', + 'uint32_t', + [], + is_const=True) + ## uan-mac-rc.h (module 'uan'): uint32_t ns3::Reservation::GetNoFrames() const [member function] + cls.add_method('GetNoFrames', + 'uint32_t', + [], + is_const=True) + ## uan-mac-rc.h (module 'uan'): std::list, ns3::UanAddress>, std::allocator, ns3::UanAddress> > > const & ns3::Reservation::GetPktList() const [member function] + cls.add_method('GetPktList', + 'std::list< std::pair< ns3::Ptr< ns3::Packet >, ns3::UanAddress > > const &', + [], + is_const=True) + ## uan-mac-rc.h (module 'uan'): uint8_t ns3::Reservation::GetRetryNo() const [member function] + cls.add_method('GetRetryNo', + 'uint8_t', + [], + is_const=True) + ## uan-mac-rc.h (module 'uan'): ns3::Time ns3::Reservation::GetTimestamp(uint8_t n) const [member function] + cls.add_method('GetTimestamp', + 'ns3::Time', + [param('uint8_t', 'n')], + is_const=True) + ## uan-mac-rc.h (module 'uan'): void ns3::Reservation::IncrementRetry() [member function] + cls.add_method('IncrementRetry', + 'void', + []) + ## uan-mac-rc.h (module 'uan'): bool ns3::Reservation::IsTransmitted() const [member function] + cls.add_method('IsTransmitted', + 'bool', + [], + is_const=True) + ## uan-mac-rc.h (module 'uan'): void ns3::Reservation::SetFrameNo(uint8_t fn) [member function] + cls.add_method('SetFrameNo', + 'void', + [param('uint8_t', 'fn')]) + ## uan-mac-rc.h (module 'uan'): void ns3::Reservation::SetTransmitted(bool t=true) [member function] + cls.add_method('SetTransmitted', + 'void', + [param('bool', 't', default_value='true')]) + return + +def register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, cls): + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount::SimpleRefCount() [constructor] + cls.add_constructor([]) + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount::SimpleRefCount(ns3::SimpleRefCount const & o) [copy constructor] + cls.add_constructor([param('ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter > const &', 'o')]) + ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount::Cleanup() [member function] + cls.add_method('Cleanup', + 'void', + [], + is_static=True) + return + +def register_Ns3Simulator_methods(root_module, cls): + ## simulator.h (module 'core'): ns3::Simulator::Simulator(ns3::Simulator const & arg0) [copy constructor] + cls.add_constructor([param('ns3::Simulator const &', 'arg0')]) + ## simulator.h (module 'core'): static void ns3::Simulator::Cancel(ns3::EventId const & id) [member function] + cls.add_method('Cancel', + 'void', + [param('ns3::EventId const &', 'id')], + is_static=True) + ## simulator.h (module 'core'): static void ns3::Simulator::Destroy() [member function] + cls.add_method('Destroy', + 'void', + [], + is_static=True) + ## simulator.h (module 'core'): static uint32_t ns3::Simulator::GetContext() [member function] + cls.add_method('GetContext', + 'uint32_t', + [], + is_static=True) + ## simulator.h (module 'core'): static ns3::Time ns3::Simulator::GetDelayLeft(ns3::EventId const & id) [member function] + cls.add_method('GetDelayLeft', + 'ns3::Time', + [param('ns3::EventId const &', 'id')], + is_static=True) + ## simulator.h (module 'core'): static ns3::Ptr ns3::Simulator::GetImplementation() [member function] + cls.add_method('GetImplementation', + 'ns3::Ptr< ns3::SimulatorImpl >', + [], + is_static=True) + ## simulator.h (module 'core'): static ns3::Time ns3::Simulator::GetMaximumSimulationTime() [member function] + cls.add_method('GetMaximumSimulationTime', + 'ns3::Time', + [], + is_static=True) + ## simulator.h (module 'core'): static uint32_t ns3::Simulator::GetSystemId() [member function] + cls.add_method('GetSystemId', + 'uint32_t', + [], + is_static=True) + ## simulator.h (module 'core'): static bool ns3::Simulator::IsExpired(ns3::EventId const & id) [member function] + cls.add_method('IsExpired', + 'bool', + [param('ns3::EventId const &', 'id')], + is_static=True) + ## simulator.h (module 'core'): static bool ns3::Simulator::IsFinished() [member function] + cls.add_method('IsFinished', + 'bool', + [], + is_static=True) + ## simulator.h (module 'core'): static ns3::Time ns3::Simulator::Now() [member function] + cls.add_method('Now', + 'ns3::Time', + [], + is_static=True) + ## simulator.h (module 'core'): static void ns3::Simulator::Remove(ns3::EventId const & id) [member function] + cls.add_method('Remove', + 'void', + [param('ns3::EventId const &', 'id')], + is_static=True) + ## simulator.h (module 'core'): static void ns3::Simulator::SetImplementation(ns3::Ptr impl) [member function] + cls.add_method('SetImplementation', + 'void', + [param('ns3::Ptr< ns3::SimulatorImpl >', 'impl')], + is_static=True) + ## simulator.h (module 'core'): static void ns3::Simulator::SetScheduler(ns3::ObjectFactory schedulerFactory) [member function] + cls.add_method('SetScheduler', + 'void', + [param('ns3::ObjectFactory', 'schedulerFactory')], + is_static=True) + ## simulator.h (module 'core'): static void ns3::Simulator::Stop() [member function] + cls.add_method('Stop', + 'void', + [], + is_static=True) + ## simulator.h (module 'core'): static void ns3::Simulator::Stop(ns3::Time const & delay) [member function] + cls.add_method('Stop', + 'void', + [param('ns3::Time const &', 'delay')], + is_static=True) + return + +def register_Ns3Tag_methods(root_module, cls): + ## tag.h (module 'network'): ns3::Tag::Tag() [constructor] + cls.add_constructor([]) + ## tag.h (module 'network'): ns3::Tag::Tag(ns3::Tag const & arg0) [copy constructor] + cls.add_constructor([param('ns3::Tag const &', 'arg0')]) + ## tag.h (module 'network'): void ns3::Tag::Deserialize(ns3::TagBuffer i) [member function] + cls.add_method('Deserialize', + 'void', + [param('ns3::TagBuffer', 'i')], + is_pure_virtual=True, is_virtual=True) + ## tag.h (module 'network'): uint32_t ns3::Tag::GetSerializedSize() const [member function] + cls.add_method('GetSerializedSize', + 'uint32_t', + [], + is_pure_virtual=True, is_const=True, is_virtual=True) + ## tag.h (module 'network'): static ns3::TypeId ns3::Tag::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) + ## tag.h (module 'network'): void ns3::Tag::Print(std::ostream & os) const [member function] + cls.add_method('Print', + 'void', + [param('std::ostream &', 'os')], + is_pure_virtual=True, is_const=True, is_virtual=True) + ## tag.h (module 'network'): void ns3::Tag::Serialize(ns3::TagBuffer i) const [member function] + cls.add_method('Serialize', + 'void', + [param('ns3::TagBuffer', 'i')], + is_pure_virtual=True, is_const=True, is_virtual=True) + return + +def register_Ns3TagBuffer_methods(root_module, cls): + ## tag-buffer.h (module 'network'): ns3::TagBuffer::TagBuffer(ns3::TagBuffer const & arg0) [copy constructor] + cls.add_constructor([param('ns3::TagBuffer const &', 'arg0')]) + ## tag-buffer.h (module 'network'): ns3::TagBuffer::TagBuffer(uint8_t * start, uint8_t * end) [constructor] + cls.add_constructor([param('uint8_t *', 'start'), param('uint8_t *', 'end')]) + ## tag-buffer.h (module 'network'): void ns3::TagBuffer::CopyFrom(ns3::TagBuffer o) [member function] + cls.add_method('CopyFrom', + 'void', + [param('ns3::TagBuffer', 'o')]) + ## tag-buffer.h (module 'network'): void ns3::TagBuffer::Read(uint8_t * buffer, uint32_t size) [member function] + cls.add_method('Read', + 'void', + [param('uint8_t *', 'buffer'), param('uint32_t', 'size')]) + ## tag-buffer.h (module 'network'): double ns3::TagBuffer::ReadDouble() [member function] + cls.add_method('ReadDouble', + 'double', + []) + ## tag-buffer.h (module 'network'): uint16_t ns3::TagBuffer::ReadU16() [member function] + cls.add_method('ReadU16', + 'uint16_t', + []) + ## tag-buffer.h (module 'network'): uint32_t ns3::TagBuffer::ReadU32() [member function] + cls.add_method('ReadU32', + 'uint32_t', + []) + ## tag-buffer.h (module 'network'): uint64_t ns3::TagBuffer::ReadU64() [member function] + cls.add_method('ReadU64', + 'uint64_t', + []) + ## tag-buffer.h (module 'network'): uint8_t ns3::TagBuffer::ReadU8() [member function] + cls.add_method('ReadU8', + 'uint8_t', + []) + ## tag-buffer.h (module 'network'): void ns3::TagBuffer::TrimAtEnd(uint32_t trim) [member function] + cls.add_method('TrimAtEnd', + 'void', + [param('uint32_t', 'trim')]) + ## tag-buffer.h (module 'network'): void ns3::TagBuffer::Write(uint8_t const * buffer, uint32_t size) [member function] + cls.add_method('Write', + 'void', + [param('uint8_t const *', 'buffer'), param('uint32_t', 'size')]) + ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteDouble(double v) [member function] + cls.add_method('WriteDouble', + 'void', + [param('double', 'v')]) + ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU16(uint16_t data) [member function] + cls.add_method('WriteU16', + 'void', + [param('uint16_t', 'data')]) + ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU32(uint32_t data) [member function] + cls.add_method('WriteU32', + 'void', + [param('uint32_t', 'data')]) + ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU64(uint64_t v) [member function] + cls.add_method('WriteU64', + 'void', + [param('uint64_t', 'v')]) + ## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU8(uint8_t v) [member function] + cls.add_method('WriteU8', + 'void', + [param('uint8_t', 'v')]) + return + +def register_Ns3Tap_methods(root_module, cls): + ## uan-prop-model.h (module 'uan'): ns3::Tap::Tap(ns3::Tap const & arg0) [copy constructor] + cls.add_constructor([param('ns3::Tap const &', 'arg0')]) + ## uan-prop-model.h (module 'uan'): ns3::Tap::Tap() [constructor] + cls.add_constructor([]) + ## uan-prop-model.h (module 'uan'): ns3::Tap::Tap(ns3::Time delay, std::complex amp) [constructor] + cls.add_constructor([param('ns3::Time', 'delay'), param('std::complex< double >', 'amp')]) + ## uan-prop-model.h (module 'uan'): std::complex ns3::Tap::GetAmp() const [member function] + cls.add_method('GetAmp', + 'std::complex< double >', + [], + is_const=True) + ## uan-prop-model.h (module 'uan'): ns3::Time ns3::Tap::GetDelay() const [member function] + cls.add_method('GetDelay', + 'ns3::Time', + [], + is_const=True) + return + +def register_Ns3TimeWithUnit_methods(root_module, cls): + cls.add_output_stream_operator() + ## nstime.h (module 'core'): ns3::TimeWithUnit::TimeWithUnit(ns3::TimeWithUnit const & arg0) [copy constructor] + cls.add_constructor([param('ns3::TimeWithUnit const &', 'arg0')]) + ## nstime.h (module 'core'): ns3::TimeWithUnit::TimeWithUnit(ns3::Time const time, ns3::Time::Unit const unit) [constructor] + cls.add_constructor([param('ns3::Time const', 'time'), param('ns3::Time::Unit const', 'unit')]) + return + +def register_Ns3TracedValue__Double_methods(root_module, cls): + ## traced-value.h (module 'core'): ns3::TracedValue::TracedValue() [constructor] + cls.add_constructor([]) + ## traced-value.h (module 'core'): ns3::TracedValue::TracedValue(ns3::TracedValue const & o) [copy constructor] + cls.add_constructor([param('ns3::TracedValue< double > const &', 'o')]) + ## traced-value.h (module 'core'): ns3::TracedValue::TracedValue(double const & v) [constructor] + cls.add_constructor([param('double const &', 'v')]) + ## traced-value.h (module 'core'): void ns3::TracedValue::Connect(ns3::CallbackBase const & cb, std::basic_string,std::allocator > path) [member function] + cls.add_method('Connect', + 'void', + [param('ns3::CallbackBase const &', 'cb'), param('std::string', 'path')]) + ## traced-value.h (module 'core'): void ns3::TracedValue::ConnectWithoutContext(ns3::CallbackBase const & cb) [member function] + cls.add_method('ConnectWithoutContext', + 'void', + [param('ns3::CallbackBase const &', 'cb')]) + ## traced-value.h (module 'core'): void ns3::TracedValue::Disconnect(ns3::CallbackBase const & cb, std::basic_string,std::allocator > path) [member function] + cls.add_method('Disconnect', + 'void', + [param('ns3::CallbackBase const &', 'cb'), param('std::string', 'path')]) + ## traced-value.h (module 'core'): void ns3::TracedValue::DisconnectWithoutContext(ns3::CallbackBase const & cb) [member function] + cls.add_method('DisconnectWithoutContext', + 'void', + [param('ns3::CallbackBase const &', 'cb')]) + ## traced-value.h (module 'core'): double ns3::TracedValue::Get() const [member function] + cls.add_method('Get', + 'double', + [], + is_const=True) + ## traced-value.h (module 'core'): void ns3::TracedValue::Set(double const & v) [member function] + cls.add_method('Set', + 'void', + [param('double const &', 'v')]) + return + +def register_Ns3TypeId_methods(root_module, cls): + cls.add_binary_comparison_operator('<') + cls.add_binary_comparison_operator('!=') + cls.add_output_stream_operator() + cls.add_binary_comparison_operator('==') + ## type-id.h (module 'core'): ns3::TypeId::TypeId(char const * name) [constructor] + cls.add_constructor([param('char const *', 'name')]) + ## type-id.h (module 'core'): ns3::TypeId::TypeId() [constructor] + cls.add_constructor([]) + ## type-id.h (module 'core'): ns3::TypeId::TypeId(ns3::TypeId const & o) [copy constructor] + cls.add_constructor([param('ns3::TypeId const &', 'o')]) + ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, ns3::AttributeValue const & initialValue, ns3::Ptr accessor, ns3::Ptr checker) [member function] + cls.add_method('AddAttribute', + 'ns3::TypeId', + [param('std::string', 'name'), param('std::string', 'help'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')]) + ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddAttribute(std::string name, std::string help, uint32_t flags, ns3::AttributeValue const & initialValue, ns3::Ptr accessor, ns3::Ptr checker) [member function] + cls.add_method('AddAttribute', + 'ns3::TypeId', + [param('std::string', 'name'), param('std::string', 'help'), param('uint32_t', 'flags'), param('ns3::AttributeValue const &', 'initialValue'), param('ns3::Ptr< ns3::AttributeAccessor const >', 'accessor'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')]) + ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr accessor) [member function] + cls.add_method('AddTraceSource', + 'ns3::TypeId', + [param('std::string', 'name'), param('std::string', 'help'), param('ns3::Ptr< ns3::TraceSourceAccessor const >', 'accessor')], + deprecated=True) + ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr accessor, std::string callback) [member function] + cls.add_method('AddTraceSource', + 'ns3::TypeId', + [param('std::string', 'name'), param('std::string', 'help'), param('ns3::Ptr< ns3::TraceSourceAccessor const >', 'accessor'), param('std::string', 'callback')]) + ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation ns3::TypeId::GetAttribute(uint32_t i) const [member function] + cls.add_method('GetAttribute', + 'ns3::TypeId::AttributeInformation', + [param('uint32_t', 'i')], + is_const=True) + ## type-id.h (module 'core'): std::string ns3::TypeId::GetAttributeFullName(uint32_t i) const [member function] + cls.add_method('GetAttributeFullName', + 'std::string', + [param('uint32_t', 'i')], + is_const=True) + ## type-id.h (module 'core'): uint32_t ns3::TypeId::GetAttributeN() const [member function] + cls.add_method('GetAttributeN', + 'uint32_t', + [], + is_const=True) + ## type-id.h (module 'core'): ns3::Callback ns3::TypeId::GetConstructor() const [member function] + cls.add_method('GetConstructor', + 'ns3::Callback< ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', + [], + is_const=True) + ## type-id.h (module 'core'): std::string ns3::TypeId::GetGroupName() const [member function] + cls.add_method('GetGroupName', + 'std::string', + [], + is_const=True) + ## type-id.h (module 'core'): uint32_t ns3::TypeId::GetHash() const [member function] + cls.add_method('GetHash', + 'uint32_t', + [], + is_const=True) + ## type-id.h (module 'core'): std::string ns3::TypeId::GetName() const [member function] + cls.add_method('GetName', + 'std::string', + [], + is_const=True) + ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::GetParent() const [member function] + cls.add_method('GetParent', + 'ns3::TypeId', + [], + is_const=True) + ## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::GetRegistered(uint32_t i) [member function] + cls.add_method('GetRegistered', + 'ns3::TypeId', + [param('uint32_t', 'i')], + is_static=True) + ## type-id.h (module 'core'): static uint32_t ns3::TypeId::GetRegisteredN() [member function] + cls.add_method('GetRegisteredN', + 'uint32_t', + [], + is_static=True) + ## type-id.h (module 'core'): std::size_t ns3::TypeId::GetSize() const [member function] + cls.add_method('GetSize', + 'std::size_t', + [], + is_const=True) + ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation ns3::TypeId::GetTraceSource(uint32_t i) const [member function] + cls.add_method('GetTraceSource', + 'ns3::TypeId::TraceSourceInformation', + [param('uint32_t', 'i')], + is_const=True) + ## type-id.h (module 'core'): uint32_t ns3::TypeId::GetTraceSourceN() const [member function] + cls.add_method('GetTraceSourceN', + 'uint32_t', + [], + is_const=True) + ## type-id.h (module 'core'): uint16_t ns3::TypeId::GetUid() const [member function] + cls.add_method('GetUid', + 'uint16_t', + [], + is_const=True) + ## type-id.h (module 'core'): bool ns3::TypeId::HasConstructor() const [member function] + cls.add_method('HasConstructor', + 'bool', + [], + is_const=True) + ## type-id.h (module 'core'): bool ns3::TypeId::HasParent() const [member function] + cls.add_method('HasParent', + 'bool', + [], + is_const=True) + ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::HideFromDocumentation() [member function] + cls.add_method('HideFromDocumentation', + 'ns3::TypeId', + []) + ## type-id.h (module 'core'): bool ns3::TypeId::IsChildOf(ns3::TypeId other) const [member function] + cls.add_method('IsChildOf', + 'bool', + [param('ns3::TypeId', 'other')], + is_const=True) + ## type-id.h (module 'core'): bool ns3::TypeId::LookupAttributeByName(std::string name, ns3::TypeId::AttributeInformation * info) const [member function] + cls.add_method('LookupAttributeByName', + 'bool', + [param('std::string', 'name'), param('ns3::TypeId::AttributeInformation *', 'info', transfer_ownership=False)], + is_const=True) + ## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::LookupByHash(uint32_t hash) [member function] + cls.add_method('LookupByHash', + 'ns3::TypeId', + [param('uint32_t', 'hash')], + is_static=True) + ## type-id.h (module 'core'): static bool ns3::TypeId::LookupByHashFailSafe(uint32_t hash, ns3::TypeId * tid) [member function] + cls.add_method('LookupByHashFailSafe', + 'bool', + [param('uint32_t', 'hash'), param('ns3::TypeId *', 'tid')], + is_static=True) + ## type-id.h (module 'core'): static ns3::TypeId ns3::TypeId::LookupByName(std::string name) [member function] + cls.add_method('LookupByName', + 'ns3::TypeId', + [param('std::string', 'name')], + is_static=True) + ## type-id.h (module 'core'): ns3::Ptr ns3::TypeId::LookupTraceSourceByName(std::string name) const [member function] + cls.add_method('LookupTraceSourceByName', + 'ns3::Ptr< ns3::TraceSourceAccessor const >', + [param('std::string', 'name')], + is_const=True) + ## type-id.h (module 'core'): bool ns3::TypeId::MustHideFromDocumentation() const [member function] + cls.add_method('MustHideFromDocumentation', + 'bool', + [], + is_const=True) + ## type-id.h (module 'core'): bool ns3::TypeId::SetAttributeInitialValue(uint32_t i, ns3::Ptr initialValue) [member function] + cls.add_method('SetAttributeInitialValue', + 'bool', + [param('uint32_t', 'i'), param('ns3::Ptr< ns3::AttributeValue const >', 'initialValue')]) + ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetGroupName(std::string groupName) [member function] + cls.add_method('SetGroupName', + 'ns3::TypeId', + [param('std::string', 'groupName')]) + ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetParent(ns3::TypeId tid) [member function] + cls.add_method('SetParent', + 'ns3::TypeId', + [param('ns3::TypeId', 'tid')]) + ## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetSize(std::size_t size) [member function] + cls.add_method('SetSize', + 'ns3::TypeId', + [param('std::size_t', 'size')]) + ## type-id.h (module 'core'): void ns3::TypeId::SetUid(uint16_t tid) [member function] + cls.add_method('SetUid', + 'void', + [param('uint16_t', 'tid')]) + return + +def register_Ns3TypeIdAttributeInformation_methods(root_module, cls): + ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation() [constructor] + cls.add_constructor([]) + ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::AttributeInformation(ns3::TypeId::AttributeInformation const & arg0) [copy constructor] + cls.add_constructor([param('ns3::TypeId::AttributeInformation const &', 'arg0')]) + ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::accessor [variable] + cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::AttributeAccessor const >', is_const=False) + ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::checker [variable] + cls.add_instance_attribute('checker', 'ns3::Ptr< ns3::AttributeChecker const >', is_const=False) + ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::flags [variable] + cls.add_instance_attribute('flags', 'uint32_t', is_const=False) + ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::help [variable] + cls.add_instance_attribute('help', 'std::string', is_const=False) + ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::initialValue [variable] + cls.add_instance_attribute('initialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False) + ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::name [variable] + cls.add_instance_attribute('name', 'std::string', is_const=False) + ## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::originalInitialValue [variable] + cls.add_instance_attribute('originalInitialValue', 'ns3::Ptr< ns3::AttributeValue const >', is_const=False) + return + +def register_Ns3TypeIdTraceSourceInformation_methods(root_module, cls): + ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation() [constructor] + cls.add_constructor([]) + ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::TraceSourceInformation(ns3::TypeId::TraceSourceInformation const & arg0) [copy constructor] + cls.add_constructor([param('ns3::TypeId::TraceSourceInformation const &', 'arg0')]) + ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::accessor [variable] + cls.add_instance_attribute('accessor', 'ns3::Ptr< ns3::TraceSourceAccessor const >', is_const=False) + ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::callback [variable] + cls.add_instance_attribute('callback', 'std::string', is_const=False) + ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::help [variable] + cls.add_instance_attribute('help', 'std::string', is_const=False) + ## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::name [variable] + cls.add_instance_attribute('name', 'std::string', is_const=False) + return + +def register_Ns3UanAddress_methods(root_module, cls): + cls.add_binary_comparison_operator('<') + cls.add_binary_comparison_operator('!=') + cls.add_output_stream_operator() + cls.add_binary_comparison_operator('==') + ## uan-address.h (module 'uan'): ns3::UanAddress::UanAddress(ns3::UanAddress const & arg0) [copy constructor] + cls.add_constructor([param('ns3::UanAddress const &', 'arg0')]) + ## uan-address.h (module 'uan'): ns3::UanAddress::UanAddress() [constructor] + cls.add_constructor([]) + ## uan-address.h (module 'uan'): ns3::UanAddress::UanAddress(uint8_t addr) [constructor] + cls.add_constructor([param('uint8_t', 'addr')]) + ## uan-address.h (module 'uan'): static ns3::UanAddress ns3::UanAddress::Allocate() [member function] + cls.add_method('Allocate', + 'ns3::UanAddress', + [], + is_static=True) + ## uan-address.h (module 'uan'): static ns3::UanAddress ns3::UanAddress::ConvertFrom(ns3::Address const & address) [member function] + cls.add_method('ConvertFrom', + 'ns3::UanAddress', + [param('ns3::Address const &', 'address')], + is_static=True) + ## uan-address.h (module 'uan'): void ns3::UanAddress::CopyFrom(uint8_t const * pBuffer) [member function] + cls.add_method('CopyFrom', + 'void', + [param('uint8_t const *', 'pBuffer')]) + ## uan-address.h (module 'uan'): void ns3::UanAddress::CopyTo(uint8_t * pBuffer) [member function] + cls.add_method('CopyTo', + 'void', + [param('uint8_t *', 'pBuffer')]) + ## uan-address.h (module 'uan'): uint8_t ns3::UanAddress::GetAsInt() const [member function] + cls.add_method('GetAsInt', + 'uint8_t', + [], + is_const=True) + ## uan-address.h (module 'uan'): static ns3::UanAddress ns3::UanAddress::GetBroadcast() [member function] + cls.add_method('GetBroadcast', + 'ns3::UanAddress', + [], + is_static=True) + ## uan-address.h (module 'uan'): static bool ns3::UanAddress::IsMatchingType(ns3::Address const & address) [member function] + cls.add_method('IsMatchingType', + 'bool', + [param('ns3::Address const &', 'address')], + is_static=True) + return + +def register_Ns3UanHelper_methods(root_module, cls): + ## uan-helper.h (module 'uan'): ns3::UanHelper::UanHelper(ns3::UanHelper const & arg0) [copy constructor] + cls.add_constructor([param('ns3::UanHelper const &', 'arg0')]) + ## uan-helper.h (module 'uan'): ns3::UanHelper::UanHelper() [constructor] + cls.add_constructor([]) + ## uan-helper.h (module 'uan'): int64_t ns3::UanHelper::AssignStreams(ns3::NetDeviceContainer c, int64_t stream) [member function] + cls.add_method('AssignStreams', + 'int64_t', + [param('ns3::NetDeviceContainer', 'c'), param('int64_t', 'stream')]) + ## uan-helper.h (module 'uan'): static void ns3::UanHelper::EnableAscii(std::ostream & os, uint32_t nodeid, uint32_t deviceid) [member function] + cls.add_method('EnableAscii', + 'void', + [param('std::ostream &', 'os'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid')], + is_static=True) + ## uan-helper.h (module 'uan'): static void ns3::UanHelper::EnableAscii(std::ostream & os, ns3::NetDeviceContainer d) [member function] + cls.add_method('EnableAscii', + 'void', + [param('std::ostream &', 'os'), param('ns3::NetDeviceContainer', 'd')], + is_static=True) + ## uan-helper.h (module 'uan'): static void ns3::UanHelper::EnableAscii(std::ostream & os, ns3::NodeContainer n) [member function] + cls.add_method('EnableAscii', + 'void', + [param('std::ostream &', 'os'), param('ns3::NodeContainer', 'n')], + is_static=True) + ## uan-helper.h (module 'uan'): static void ns3::UanHelper::EnableAsciiAll(std::ostream & os) [member function] + cls.add_method('EnableAsciiAll', + 'void', + [param('std::ostream &', 'os')], + is_static=True) + ## uan-helper.h (module 'uan'): ns3::NetDeviceContainer ns3::UanHelper::Install(ns3::NodeContainer c) const [member function] + cls.add_method('Install', + 'ns3::NetDeviceContainer', + [param('ns3::NodeContainer', 'c')], + is_const=True) + ## uan-helper.h (module 'uan'): ns3::NetDeviceContainer ns3::UanHelper::Install(ns3::NodeContainer c, ns3::Ptr channel) const [member function] + cls.add_method('Install', + 'ns3::NetDeviceContainer', + [param('ns3::NodeContainer', 'c'), param('ns3::Ptr< ns3::UanChannel >', 'channel')], + is_const=True) + ## uan-helper.h (module 'uan'): ns3::Ptr ns3::UanHelper::Install(ns3::Ptr node, ns3::Ptr channel) const [member function] + cls.add_method('Install', + 'ns3::Ptr< ns3::UanNetDevice >', + [param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::Ptr< ns3::UanChannel >', 'channel')], + is_const=True) + ## uan-helper.h (module 'uan'): void ns3::UanHelper::SetMac(std::string type, std::string n0="", ns3::AttributeValue const & v0=ns3::EmptyAttributeValue(), std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue(), std::string n5="", ns3::AttributeValue const & v5=ns3::EmptyAttributeValue(), std::string n6="", ns3::AttributeValue const & v6=ns3::EmptyAttributeValue(), std::string n7="", ns3::AttributeValue const & v7=ns3::EmptyAttributeValue()) [member function] + cls.add_method('SetMac', + 'void', + [param('std::string', 'type'), param('std::string', 'n0', default_value='""'), param('ns3::AttributeValue const &', 'v0', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n5', default_value='""'), param('ns3::AttributeValue const &', 'v5', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n6', default_value='""'), param('ns3::AttributeValue const &', 'v6', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n7', default_value='""'), param('ns3::AttributeValue const &', 'v7', default_value='ns3::EmptyAttributeValue()')]) + ## uan-helper.h (module 'uan'): void ns3::UanHelper::SetPhy(std::string phyType, std::string n0="", ns3::AttributeValue const & v0=ns3::EmptyAttributeValue(), std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue(), std::string n5="", ns3::AttributeValue const & v5=ns3::EmptyAttributeValue(), std::string n6="", ns3::AttributeValue const & v6=ns3::EmptyAttributeValue(), std::string n7="", ns3::AttributeValue const & v7=ns3::EmptyAttributeValue()) [member function] + cls.add_method('SetPhy', + 'void', + [param('std::string', 'phyType'), param('std::string', 'n0', default_value='""'), param('ns3::AttributeValue const &', 'v0', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n5', default_value='""'), param('ns3::AttributeValue const &', 'v5', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n6', default_value='""'), param('ns3::AttributeValue const &', 'v6', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n7', default_value='""'), param('ns3::AttributeValue const &', 'v7', default_value='ns3::EmptyAttributeValue()')]) + ## uan-helper.h (module 'uan'): void ns3::UanHelper::SetTransducer(std::string type, std::string n0="", ns3::AttributeValue const & v0=ns3::EmptyAttributeValue(), std::string n1="", ns3::AttributeValue const & v1=ns3::EmptyAttributeValue(), std::string n2="", ns3::AttributeValue const & v2=ns3::EmptyAttributeValue(), std::string n3="", ns3::AttributeValue const & v3=ns3::EmptyAttributeValue(), std::string n4="", ns3::AttributeValue const & v4=ns3::EmptyAttributeValue(), std::string n5="", ns3::AttributeValue const & v5=ns3::EmptyAttributeValue(), std::string n6="", ns3::AttributeValue const & v6=ns3::EmptyAttributeValue(), std::string n7="", ns3::AttributeValue const & v7=ns3::EmptyAttributeValue()) [member function] + cls.add_method('SetTransducer', + 'void', + [param('std::string', 'type'), param('std::string', 'n0', default_value='""'), param('ns3::AttributeValue const &', 'v0', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n1', default_value='""'), param('ns3::AttributeValue const &', 'v1', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n2', default_value='""'), param('ns3::AttributeValue const &', 'v2', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n3', default_value='""'), param('ns3::AttributeValue const &', 'v3', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n4', default_value='""'), param('ns3::AttributeValue const &', 'v4', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n5', default_value='""'), param('ns3::AttributeValue const &', 'v5', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n6', default_value='""'), param('ns3::AttributeValue const &', 'v6', default_value='ns3::EmptyAttributeValue()'), param('std::string', 'n7', default_value='""'), param('ns3::AttributeValue const &', 'v7', default_value='ns3::EmptyAttributeValue()')]) + return + +def register_Ns3UanModesList_methods(root_module, cls): + cls.add_output_stream_operator() + ## uan-tx-mode.h (module 'uan'): ns3::UanModesList::UanModesList(ns3::UanModesList const & arg0) [copy constructor] + cls.add_constructor([param('ns3::UanModesList const &', 'arg0')]) + ## uan-tx-mode.h (module 'uan'): ns3::UanModesList::UanModesList() [constructor] + cls.add_constructor([]) + ## uan-tx-mode.h (module 'uan'): void ns3::UanModesList::AppendMode(ns3::UanTxMode mode) [member function] + cls.add_method('AppendMode', + 'void', + [param('ns3::UanTxMode', 'mode')]) + ## uan-tx-mode.h (module 'uan'): void ns3::UanModesList::DeleteMode(uint32_t num) [member function] + cls.add_method('DeleteMode', + 'void', + [param('uint32_t', 'num')]) + ## uan-tx-mode.h (module 'uan'): uint32_t ns3::UanModesList::GetNModes() const [member function] + cls.add_method('GetNModes', + 'uint32_t', + [], + is_const=True) + return + +def register_Ns3UanPacketArrival_methods(root_module, cls): + ## uan-transducer.h (module 'uan'): ns3::UanPacketArrival::UanPacketArrival(ns3::UanPacketArrival const & arg0) [copy constructor] + cls.add_constructor([param('ns3::UanPacketArrival const &', 'arg0')]) + ## uan-transducer.h (module 'uan'): ns3::UanPacketArrival::UanPacketArrival() [constructor] + cls.add_constructor([]) + ## uan-transducer.h (module 'uan'): ns3::UanPacketArrival::UanPacketArrival(ns3::Ptr packet, double rxPowerDb, ns3::UanTxMode txMode, ns3::UanPdp pdp, ns3::Time arrTime) [constructor] + cls.add_constructor([param('ns3::Ptr< ns3::Packet >', 'packet'), param('double', 'rxPowerDb'), param('ns3::UanTxMode', 'txMode'), param('ns3::UanPdp', 'pdp'), param('ns3::Time', 'arrTime')]) + ## uan-transducer.h (module 'uan'): ns3::Time ns3::UanPacketArrival::GetArrivalTime() const [member function] + cls.add_method('GetArrivalTime', + 'ns3::Time', + [], + is_const=True) + ## uan-transducer.h (module 'uan'): ns3::Ptr ns3::UanPacketArrival::GetPacket() const [member function] + cls.add_method('GetPacket', + 'ns3::Ptr< ns3::Packet >', + [], + is_const=True) + ## uan-transducer.h (module 'uan'): ns3::UanPdp ns3::UanPacketArrival::GetPdp() const [member function] + cls.add_method('GetPdp', + 'ns3::UanPdp', + [], + is_const=True) + ## uan-transducer.h (module 'uan'): double ns3::UanPacketArrival::GetRxPowerDb() const [member function] + cls.add_method('GetRxPowerDb', + 'double', + [], + is_const=True) + ## uan-transducer.h (module 'uan'): ns3::UanTxMode const & ns3::UanPacketArrival::GetTxMode() const [member function] + cls.add_method('GetTxMode', + 'ns3::UanTxMode const &', + [], + is_const=True) + return + +def register_Ns3UanPdp_methods(root_module, cls): + cls.add_output_stream_operator() + ## uan-prop-model.h (module 'uan'): ns3::UanPdp::UanPdp(ns3::UanPdp const & arg0) [copy constructor] + cls.add_constructor([param('ns3::UanPdp const &', 'arg0')]) + ## uan-prop-model.h (module 'uan'): ns3::UanPdp::UanPdp() [constructor] + cls.add_constructor([]) + ## uan-prop-model.h (module 'uan'): ns3::UanPdp::UanPdp(std::vector > taps, ns3::Time resolution) [constructor] + cls.add_constructor([param('std::vector< ns3::Tap >', 'taps'), param('ns3::Time', 'resolution')]) + ## uan-prop-model.h (module 'uan'): ns3::UanPdp::UanPdp(std::vector,std::allocator > > arrivals, ns3::Time resolution) [constructor] + cls.add_constructor([param('std::vector< std::complex< double > >', 'arrivals'), param('ns3::Time', 'resolution')]) + ## uan-prop-model.h (module 'uan'): ns3::UanPdp::UanPdp(std::vector > arrivals, ns3::Time resolution) [constructor] + cls.add_constructor([param('std::vector< double >', 'arrivals'), param('ns3::Time', 'resolution')]) + ## uan-prop-model.h (module 'uan'): static ns3::UanPdp ns3::UanPdp::CreateImpulsePdp() [member function] + cls.add_method('CreateImpulsePdp', + 'ns3::UanPdp', + [], + is_static=True) + ## uan-prop-model.h (module 'uan'): __gnu_cxx::__normal_iterator > > ns3::UanPdp::GetBegin() const [member function] + cls.add_method('GetBegin', + '__gnu_cxx::__normal_iterator< ns3::Tap const *, std::vector< ns3::Tap > >', + [], + is_const=True) + ## uan-prop-model.h (module 'uan'): __gnu_cxx::__normal_iterator > > ns3::UanPdp::GetEnd() const [member function] + cls.add_method('GetEnd', + '__gnu_cxx::__normal_iterator< ns3::Tap const *, std::vector< ns3::Tap > >', + [], + is_const=True) + ## uan-prop-model.h (module 'uan'): uint32_t ns3::UanPdp::GetNTaps() const [member function] + cls.add_method('GetNTaps', + 'uint32_t', + [], + is_const=True) + ## uan-prop-model.h (module 'uan'): ns3::Time ns3::UanPdp::GetResolution() const [member function] + cls.add_method('GetResolution', + 'ns3::Time', + [], + is_const=True) + ## uan-prop-model.h (module 'uan'): ns3::Tap const & ns3::UanPdp::GetTap(uint32_t i) const [member function] + cls.add_method('GetTap', + 'ns3::Tap const &', + [param('uint32_t', 'i')], + is_const=True) + ## uan-prop-model.h (module 'uan'): void ns3::UanPdp::SetNTaps(uint32_t nTaps) [member function] + cls.add_method('SetNTaps', + 'void', + [param('uint32_t', 'nTaps')]) + ## uan-prop-model.h (module 'uan'): void ns3::UanPdp::SetResolution(ns3::Time resolution) [member function] + cls.add_method('SetResolution', + 'void', + [param('ns3::Time', 'resolution')]) + ## uan-prop-model.h (module 'uan'): void ns3::UanPdp::SetTap(std::complex arrival, uint32_t index) [member function] + cls.add_method('SetTap', + 'void', + [param('std::complex< double >', 'arrival'), param('uint32_t', 'index')]) + ## uan-prop-model.h (module 'uan'): std::complex ns3::UanPdp::SumTapsC(ns3::Time begin, ns3::Time end) const [member function] + cls.add_method('SumTapsC', + 'std::complex< double >', + [param('ns3::Time', 'begin'), param('ns3::Time', 'end')], + is_const=True) + ## uan-prop-model.h (module 'uan'): std::complex ns3::UanPdp::SumTapsFromMaxC(ns3::Time delay, ns3::Time duration) const [member function] + cls.add_method('SumTapsFromMaxC', + 'std::complex< double >', + [param('ns3::Time', 'delay'), param('ns3::Time', 'duration')], + is_const=True) + ## uan-prop-model.h (module 'uan'): double ns3::UanPdp::SumTapsFromMaxNc(ns3::Time delay, ns3::Time duration) const [member function] + cls.add_method('SumTapsFromMaxNc', + 'double', + [param('ns3::Time', 'delay'), param('ns3::Time', 'duration')], + is_const=True) + ## uan-prop-model.h (module 'uan'): double ns3::UanPdp::SumTapsNc(ns3::Time begin, ns3::Time end) const [member function] + cls.add_method('SumTapsNc', + 'double', + [param('ns3::Time', 'begin'), param('ns3::Time', 'end')], + is_const=True) + return + +def register_Ns3UanPhyListener_methods(root_module, cls): + ## uan-phy.h (module 'uan'): ns3::UanPhyListener::UanPhyListener() [constructor] + cls.add_constructor([]) + ## uan-phy.h (module 'uan'): ns3::UanPhyListener::UanPhyListener(ns3::UanPhyListener const & arg0) [copy constructor] + cls.add_constructor([param('ns3::UanPhyListener const &', 'arg0')]) + ## uan-phy.h (module 'uan'): void ns3::UanPhyListener::NotifyCcaEnd() [member function] + cls.add_method('NotifyCcaEnd', + 'void', + [], + is_pure_virtual=True, is_virtual=True) + ## uan-phy.h (module 'uan'): void ns3::UanPhyListener::NotifyCcaStart() [member function] + cls.add_method('NotifyCcaStart', + 'void', + [], + is_pure_virtual=True, is_virtual=True) + ## uan-phy.h (module 'uan'): void ns3::UanPhyListener::NotifyRxEndError() [member function] + cls.add_method('NotifyRxEndError', + 'void', + [], + is_pure_virtual=True, is_virtual=True) + ## uan-phy.h (module 'uan'): void ns3::UanPhyListener::NotifyRxEndOk() [member function] + cls.add_method('NotifyRxEndOk', + 'void', + [], + is_pure_virtual=True, is_virtual=True) + ## uan-phy.h (module 'uan'): void ns3::UanPhyListener::NotifyRxStart() [member function] + cls.add_method('NotifyRxStart', + 'void', + [], + is_pure_virtual=True, is_virtual=True) + ## uan-phy.h (module 'uan'): void ns3::UanPhyListener::NotifyTxStart(ns3::Time duration) [member function] + cls.add_method('NotifyTxStart', + 'void', + [param('ns3::Time', 'duration')], + is_pure_virtual=True, is_virtual=True) + return + +def register_Ns3UanTxMode_methods(root_module, cls): + cls.add_output_stream_operator() + ## uan-tx-mode.h (module 'uan'): ns3::UanTxMode::UanTxMode(ns3::UanTxMode const & arg0) [copy constructor] + cls.add_constructor([param('ns3::UanTxMode const &', 'arg0')]) + ## uan-tx-mode.h (module 'uan'): ns3::UanTxMode::UanTxMode() [constructor] + cls.add_constructor([]) + ## uan-tx-mode.h (module 'uan'): uint32_t ns3::UanTxMode::GetBandwidthHz() const [member function] + cls.add_method('GetBandwidthHz', + 'uint32_t', + [], + is_const=True) + ## uan-tx-mode.h (module 'uan'): uint32_t ns3::UanTxMode::GetCenterFreqHz() const [member function] + cls.add_method('GetCenterFreqHz', + 'uint32_t', + [], + is_const=True) + ## uan-tx-mode.h (module 'uan'): uint32_t ns3::UanTxMode::GetConstellationSize() const [member function] + cls.add_method('GetConstellationSize', + 'uint32_t', + [], + is_const=True) + ## uan-tx-mode.h (module 'uan'): uint32_t ns3::UanTxMode::GetDataRateBps() const [member function] + cls.add_method('GetDataRateBps', + 'uint32_t', + [], + is_const=True) + ## uan-tx-mode.h (module 'uan'): ns3::UanTxMode::ModulationType ns3::UanTxMode::GetModType() const [member function] + cls.add_method('GetModType', + 'ns3::UanTxMode::ModulationType', + [], + is_const=True) + ## uan-tx-mode.h (module 'uan'): std::string ns3::UanTxMode::GetName() const [member function] + cls.add_method('GetName', + 'std::string', + [], + is_const=True) + ## uan-tx-mode.h (module 'uan'): uint32_t ns3::UanTxMode::GetPhyRateSps() const [member function] + cls.add_method('GetPhyRateSps', + 'uint32_t', + [], + is_const=True) + ## uan-tx-mode.h (module 'uan'): uint32_t ns3::UanTxMode::GetUid() const [member function] + cls.add_method('GetUid', + 'uint32_t', + [], + is_const=True) + return + +def register_Ns3UanTxModeFactory_methods(root_module, cls): + ## uan-tx-mode.h (module 'uan'): ns3::UanTxModeFactory::UanTxModeFactory(ns3::UanTxModeFactory const & arg0) [copy constructor] + cls.add_constructor([param('ns3::UanTxModeFactory const &', 'arg0')]) + ## uan-tx-mode.h (module 'uan'): ns3::UanTxModeFactory::UanTxModeFactory() [constructor] + cls.add_constructor([]) + ## uan-tx-mode.h (module 'uan'): static ns3::UanTxMode ns3::UanTxModeFactory::CreateMode(ns3::UanTxMode::ModulationType type, uint32_t dataRateBps, uint32_t phyRateSps, uint32_t cfHz, uint32_t bwHz, uint32_t constSize, std::string name) [member function] + cls.add_method('CreateMode', + 'ns3::UanTxMode', + [param('ns3::UanTxMode::ModulationType', 'type'), param('uint32_t', 'dataRateBps'), param('uint32_t', 'phyRateSps'), param('uint32_t', 'cfHz'), param('uint32_t', 'bwHz'), param('uint32_t', 'constSize'), param('std::string', 'name')], + is_static=True) + ## uan-tx-mode.h (module 'uan'): static ns3::UanTxMode ns3::UanTxModeFactory::GetMode(std::string name) [member function] + cls.add_method('GetMode', + 'ns3::UanTxMode', + [param('std::string', 'name')], + is_static=True) + ## uan-tx-mode.h (module 'uan'): static ns3::UanTxMode ns3::UanTxModeFactory::GetMode(uint32_t uid) [member function] + cls.add_method('GetMode', + 'ns3::UanTxMode', + [param('uint32_t', 'uid')], + is_static=True) + return + +def register_Ns3Vector2D_methods(root_module, cls): + cls.add_output_stream_operator() + ## vector.h (module 'core'): ns3::Vector2D::Vector2D(ns3::Vector2D const & arg0) [copy constructor] + cls.add_constructor([param('ns3::Vector2D const &', 'arg0')]) + ## vector.h (module 'core'): ns3::Vector2D::Vector2D(double _x, double _y) [constructor] + cls.add_constructor([param('double', '_x'), param('double', '_y')]) + ## vector.h (module 'core'): ns3::Vector2D::Vector2D() [constructor] + cls.add_constructor([]) + ## vector.h (module 'core'): ns3::Vector2D::x [variable] + cls.add_instance_attribute('x', 'double', is_const=False) + ## vector.h (module 'core'): ns3::Vector2D::y [variable] + cls.add_instance_attribute('y', 'double', is_const=False) + return + +def register_Ns3Vector3D_methods(root_module, cls): + cls.add_output_stream_operator() + ## vector.h (module 'core'): ns3::Vector3D::Vector3D(ns3::Vector3D const & arg0) [copy constructor] + cls.add_constructor([param('ns3::Vector3D const &', 'arg0')]) + ## vector.h (module 'core'): ns3::Vector3D::Vector3D(double _x, double _y, double _z) [constructor] + cls.add_constructor([param('double', '_x'), param('double', '_y'), param('double', '_z')]) + ## vector.h (module 'core'): ns3::Vector3D::Vector3D() [constructor] + cls.add_constructor([]) + ## vector.h (module 'core'): ns3::Vector3D::x [variable] + cls.add_instance_attribute('x', 'double', is_const=False) + ## vector.h (module 'core'): ns3::Vector3D::y [variable] + cls.add_instance_attribute('y', 'double', is_const=False) + ## vector.h (module 'core'): ns3::Vector3D::z [variable] + cls.add_instance_attribute('z', 'double', is_const=False) + return + +def register_Ns3Empty_methods(root_module, cls): + ## empty.h (module 'core'): ns3::empty::empty() [constructor] + cls.add_constructor([]) + ## empty.h (module 'core'): ns3::empty::empty(ns3::empty const & arg0) [copy constructor] + cls.add_constructor([param('ns3::empty const &', 'arg0')]) + return + +def register_Ns3Int64x64_t_methods(root_module, cls): + cls.add_binary_numeric_operator('*', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right')) + cls.add_binary_numeric_operator('+', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right')) + cls.add_binary_numeric_operator('-', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right')) + cls.add_unary_numeric_operator('-') + cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], root_module['ns3::int64x64_t'], param('ns3::int64x64_t const &', u'right')) + cls.add_binary_comparison_operator('<') + cls.add_binary_comparison_operator('>') + cls.add_binary_comparison_operator('!=') + cls.add_inplace_numeric_operator('*=', param('ns3::int64x64_t const &', u'right')) + cls.add_inplace_numeric_operator('+=', param('ns3::int64x64_t const &', u'right')) + cls.add_inplace_numeric_operator('-=', param('ns3::int64x64_t const &', u'right')) + cls.add_inplace_numeric_operator('/=', param('ns3::int64x64_t const &', u'right')) + cls.add_output_stream_operator() + cls.add_binary_comparison_operator('<=') + cls.add_binary_comparison_operator('==') + cls.add_binary_comparison_operator('>=') + ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t() [constructor] + cls.add_constructor([]) + ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(double v) [constructor] + cls.add_constructor([param('double', 'v')]) + ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long double v) [constructor] + cls.add_constructor([param('long double', 'v')]) + ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(int v) [constructor] + cls.add_constructor([param('int', 'v')]) + ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long int v) [constructor] + cls.add_constructor([param('long int', 'v')]) + ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long long int v) [constructor] + cls.add_constructor([param('long long int', 'v')]) + ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(unsigned int v) [constructor] + cls.add_constructor([param('unsigned int', 'v')]) + ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long unsigned int v) [constructor] + cls.add_constructor([param('long unsigned int', 'v')]) + ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(long long unsigned int v) [constructor] + cls.add_constructor([param('long long unsigned int', 'v')]) + ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(int64_t hi, uint64_t lo) [constructor] + cls.add_constructor([param('int64_t', 'hi'), param('uint64_t', 'lo')]) + ## int64x64-double.h (module 'core'): ns3::int64x64_t::int64x64_t(ns3::int64x64_t const & o) [copy constructor] + cls.add_constructor([param('ns3::int64x64_t const &', 'o')]) + ## int64x64-double.h (module 'core'): double ns3::int64x64_t::GetDouble() const [member function] + cls.add_method('GetDouble', + 'double', + [], + is_const=True) + ## int64x64-double.h (module 'core'): int64_t ns3::int64x64_t::GetHigh() const [member function] + cls.add_method('GetHigh', + 'int64_t', + [], + is_const=True) + ## int64x64-double.h (module 'core'): uint64_t ns3::int64x64_t::GetLow() const [member function] + cls.add_method('GetLow', + 'uint64_t', + [], + is_const=True) + ## int64x64-double.h (module 'core'): static ns3::int64x64_t ns3::int64x64_t::Invert(uint64_t v) [member function] + cls.add_method('Invert', + 'ns3::int64x64_t', + [param('uint64_t', 'v')], + is_static=True) + ## int64x64-double.h (module 'core'): void ns3::int64x64_t::MulByInvert(ns3::int64x64_t const & o) [member function] + cls.add_method('MulByInvert', + 'void', + [param('ns3::int64x64_t const &', 'o')]) + ## int64x64-double.h (module 'core'): ns3::int64x64_t::implementation [variable] + cls.add_static_attribute('implementation', 'ns3::int64x64_t::impl_type const', is_const=True) + return + +def register_Ns3AcousticModemEnergyModelHelper_methods(root_module, cls): + ## acoustic-modem-energy-model-helper.h (module 'uan'): ns3::AcousticModemEnergyModelHelper::AcousticModemEnergyModelHelper(ns3::AcousticModemEnergyModelHelper const & arg0) [copy constructor] + cls.add_constructor([param('ns3::AcousticModemEnergyModelHelper const &', 'arg0')]) + ## acoustic-modem-energy-model-helper.h (module 'uan'): ns3::AcousticModemEnergyModelHelper::AcousticModemEnergyModelHelper() [constructor] + cls.add_constructor([]) + ## acoustic-modem-energy-model-helper.h (module 'uan'): void ns3::AcousticModemEnergyModelHelper::Set(std::string name, ns3::AttributeValue const & v) [member function] + cls.add_method('Set', + 'void', + [param('std::string', 'name'), param('ns3::AttributeValue const &', 'v')], + is_virtual=True) + ## acoustic-modem-energy-model-helper.h (module 'uan'): void ns3::AcousticModemEnergyModelHelper::SetDepletionCallback(ns3::Callback callback) [member function] + cls.add_method('SetDepletionCallback', + 'void', + [param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')]) + ## acoustic-modem-energy-model-helper.h (module 'uan'): ns3::Ptr ns3::AcousticModemEnergyModelHelper::DoInstall(ns3::Ptr device, ns3::Ptr source) const [member function] + cls.add_method('DoInstall', + 'ns3::Ptr< ns3::DeviceEnergyModel >', + [param('ns3::Ptr< ns3::NetDevice >', 'device'), param('ns3::Ptr< ns3::EnergySource >', 'source')], + is_const=True, visibility='private', is_virtual=True) + return + +def register_Ns3Chunk_methods(root_module, cls): + ## chunk.h (module 'network'): ns3::Chunk::Chunk() [constructor] + cls.add_constructor([]) + ## chunk.h (module 'network'): ns3::Chunk::Chunk(ns3::Chunk const & arg0) [copy constructor] + cls.add_constructor([param('ns3::Chunk const &', 'arg0')]) + ## chunk.h (module 'network'): uint32_t ns3::Chunk::Deserialize(ns3::Buffer::Iterator start) [member function] + cls.add_method('Deserialize', + 'uint32_t', + [param('ns3::Buffer::Iterator', 'start')], + is_pure_virtual=True, is_virtual=True) + ## chunk.h (module 'network'): static ns3::TypeId ns3::Chunk::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) + ## chunk.h (module 'network'): void ns3::Chunk::Print(std::ostream & os) const [member function] + cls.add_method('Print', + 'void', + [param('std::ostream &', 'os')], + is_pure_virtual=True, is_const=True, is_virtual=True) + return + +def register_Ns3Header_methods(root_module, cls): + cls.add_output_stream_operator() + ## header.h (module 'network'): ns3::Header::Header() [constructor] + cls.add_constructor([]) + ## header.h (module 'network'): ns3::Header::Header(ns3::Header const & arg0) [copy constructor] + cls.add_constructor([param('ns3::Header const &', 'arg0')]) + ## header.h (module 'network'): uint32_t ns3::Header::Deserialize(ns3::Buffer::Iterator start) [member function] + cls.add_method('Deserialize', + 'uint32_t', + [param('ns3::Buffer::Iterator', 'start')], + is_pure_virtual=True, is_virtual=True) + ## header.h (module 'network'): uint32_t ns3::Header::GetSerializedSize() const [member function] + cls.add_method('GetSerializedSize', + 'uint32_t', + [], + is_pure_virtual=True, is_const=True, is_virtual=True) + ## header.h (module 'network'): static ns3::TypeId ns3::Header::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) + ## header.h (module 'network'): void ns3::Header::Print(std::ostream & os) const [member function] + cls.add_method('Print', + 'void', + [param('std::ostream &', 'os')], + is_pure_virtual=True, is_const=True, is_virtual=True) + ## header.h (module 'network'): void ns3::Header::Serialize(ns3::Buffer::Iterator start) const [member function] + cls.add_method('Serialize', + 'void', + [param('ns3::Buffer::Iterator', 'start')], + is_pure_virtual=True, is_const=True, is_virtual=True) + return + +def register_Ns3Object_methods(root_module, cls): + ## object.h (module 'core'): ns3::Object::Object() [constructor] + cls.add_constructor([]) + ## object.h (module 'core'): void ns3::Object::AggregateObject(ns3::Ptr other) [member function] + cls.add_method('AggregateObject', + 'void', + [param('ns3::Ptr< ns3::Object >', 'other')]) + ## object.h (module 'core'): void ns3::Object::Dispose() [member function] + cls.add_method('Dispose', + 'void', + []) + ## object.h (module 'core'): ns3::Object::AggregateIterator ns3::Object::GetAggregateIterator() const [member function] + cls.add_method('GetAggregateIterator', + 'ns3::Object::AggregateIterator', + [], + is_const=True) + ## object.h (module 'core'): ns3::TypeId ns3::Object::GetInstanceTypeId() const [member function] + cls.add_method('GetInstanceTypeId', + 'ns3::TypeId', + [], + is_const=True, is_virtual=True) + ## object.h (module 'core'): static ns3::TypeId ns3::Object::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) + ## object.h (module 'core'): void ns3::Object::Initialize() [member function] + cls.add_method('Initialize', + 'void', + []) + ## object.h (module 'core'): ns3::Object::Object(ns3::Object const & o) [copy constructor] + cls.add_constructor([param('ns3::Object const &', 'o')], + visibility='protected') + ## object.h (module 'core'): void ns3::Object::DoDispose() [member function] + cls.add_method('DoDispose', + 'void', + [], + visibility='protected', is_virtual=True) + ## object.h (module 'core'): void ns3::Object::DoInitialize() [member function] + cls.add_method('DoInitialize', + 'void', + [], + visibility='protected', is_virtual=True) + ## object.h (module 'core'): void ns3::Object::NotifyNewAggregate() [member function] + cls.add_method('NotifyNewAggregate', + 'void', + [], + visibility='protected', is_virtual=True) + return + +def register_Ns3ObjectAggregateIterator_methods(root_module, cls): + ## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator(ns3::Object::AggregateIterator const & arg0) [copy constructor] + cls.add_constructor([param('ns3::Object::AggregateIterator const &', 'arg0')]) + ## object.h (module 'core'): ns3::Object::AggregateIterator::AggregateIterator() [constructor] + cls.add_constructor([]) + ## object.h (module 'core'): bool ns3::Object::AggregateIterator::HasNext() const [member function] + cls.add_method('HasNext', + 'bool', + [], + is_const=True) + ## object.h (module 'core'): ns3::Ptr ns3::Object::AggregateIterator::Next() [member function] + cls.add_method('Next', + 'ns3::Ptr< ns3::Object const >', + []) + return + +def register_Ns3RandomVariableStream_methods(root_module, cls): + ## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::RandomVariableStream::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) + ## random-variable-stream.h (module 'core'): ns3::RandomVariableStream::RandomVariableStream() [constructor] + cls.add_constructor([]) + ## random-variable-stream.h (module 'core'): void ns3::RandomVariableStream::SetStream(int64_t stream) [member function] + cls.add_method('SetStream', + 'void', + [param('int64_t', 'stream')]) + ## random-variable-stream.h (module 'core'): int64_t ns3::RandomVariableStream::GetStream() const [member function] + cls.add_method('GetStream', + 'int64_t', + [], + is_const=True) + ## random-variable-stream.h (module 'core'): void ns3::RandomVariableStream::SetAntithetic(bool isAntithetic) [member function] + cls.add_method('SetAntithetic', + 'void', + [param('bool', 'isAntithetic')]) + ## random-variable-stream.h (module 'core'): bool ns3::RandomVariableStream::IsAntithetic() const [member function] + cls.add_method('IsAntithetic', + 'bool', + [], + is_const=True) + ## random-variable-stream.h (module 'core'): double ns3::RandomVariableStream::GetValue() [member function] + cls.add_method('GetValue', + 'double', + [], + is_pure_virtual=True, is_virtual=True) + ## random-variable-stream.h (module 'core'): uint32_t ns3::RandomVariableStream::GetInteger() [member function] + cls.add_method('GetInteger', + 'uint32_t', + [], + is_pure_virtual=True, is_virtual=True) + ## random-variable-stream.h (module 'core'): ns3::RngStream * ns3::RandomVariableStream::Peek() const [member function] + cls.add_method('Peek', + 'ns3::RngStream *', + [], + is_const=True, visibility='protected') + return + +def register_Ns3SequentialRandomVariable_methods(root_module, cls): + ## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::SequentialRandomVariable::GetTypeId() [member function] + cls.add_method('GetTypeId', + 'ns3::TypeId', + [], + is_static=True) + ## random-variable-stream.h (module 'core'): ns3::SequentialRandomVariable::SequentialRandomVariable() [constructor] + cls.add_constructor([]) + ## random-variable-stream.h (module 'core'): double ns3::SequentialRandomVariable::GetMin() const [member function] + cls.add_method('GetMin', + 'double', + [], + is_const=True) + ## random-variable-stream.h (module 'core'): double ns3::SequentialRandomVariable::GetMax() const [member function] + cls.add_method('GetMax', + 'double', + [], + is_const=True) + ## random-variable-stream.h (module 'core'): ns3::Ptr ns3::SequentialRandomVariable::GetIncrement() const [member function] + cls.add_method('GetIncrement', + 'ns3::Ptr< ns3::RandomVariableStream >', + [], + is_const=True) + ## random-variable-stream.h (module 'core'): uint32_t ns3::SequentialRandomVariable::GetConsecutive() const [member function] + cls.add_method('GetConsecutive', + 'uint32_t', + [], + is_const=True) + ## random-variable-stream.h (module 'core'): double ns3::SequentialRandomVariable::GetValue() [member function] + cls.add_method('GetValue', + 'double', + [], + is_virtual=True) + ## random-variable-stream.h (module 'core'): uint32_t ns3::SequentialRandomVariable::GetInteger() [member function] + cls.add_method('GetInteger', + 'uint32_t', + [], + is_virtual=True) + return + +def register_Ns3SimpleRefCount__Ns3AttributeAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeAccessor__gt___methods(root_module, cls): + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount >::SimpleRefCount() [constructor] + cls.add_constructor([]) + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount >::SimpleRefCount(ns3::SimpleRefCount > const & o) [copy constructor] + cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter< ns3::AttributeAccessor > > const &', 'o')]) + ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount >::Cleanup() [member function] + cls.add_method('Cleanup', + 'void', + [], + is_static=True) + return + +def register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, cls): + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount >::SimpleRefCount() [constructor] + cls.add_constructor([]) + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount >::SimpleRefCount(ns3::SimpleRefCount > const & o) [copy constructor] + cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter< ns3::AttributeChecker > > const &', 'o')]) + ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount >::Cleanup() [member function] + cls.add_method('Cleanup', + 'void', + [], + is_static=True) + return + +def register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, cls): + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount >::SimpleRefCount() [constructor] + cls.add_constructor([]) + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount >::SimpleRefCount(ns3::SimpleRefCount > const & o) [copy constructor] + cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter< ns3::AttributeValue > > const &', 'o')]) + ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount >::Cleanup() [member function] + cls.add_method('Cleanup', + 'void', + [], + is_static=True) + return + +def register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, cls): + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount >::SimpleRefCount() [constructor] + cls.add_constructor([]) + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount >::SimpleRefCount(ns3::SimpleRefCount > const & o) [copy constructor] + cls.add_constructor([param('ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter< ns3::CallbackImplBase > > const &', 'o')]) + ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount >::Cleanup() [member function] + cls.add_method('Cleanup', + 'void', + [], + is_static=True) + return + +def register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, cls): + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount >::SimpleRefCount() [constructor] + cls.add_constructor([]) + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount >::SimpleRefCount(ns3::SimpleRefCount > const & o) [copy constructor] + cls.add_constructor([param('ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter< ns3::EventImpl > > const &', 'o')]) + ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount >::Cleanup() [member function] + cls.add_method('Cleanup', + 'void', + [], + is_static=True) + return + +def register_Ns3SimpleRefCount__Ns3HashImplementation_Ns3Empty_Ns3DefaultDeleter__lt__ns3HashImplementation__gt___methods(root_module, cls): + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount >::SimpleRefCount() [constructor] + cls.add_constructor([]) + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount >::SimpleRefCount(ns3::SimpleRefCount > const & o) [copy constructor] + cls.add_constructor([param('ns3::SimpleRefCount< ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter< ns3::Hash::Implementation > > const &', 'o')]) + ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount >::Cleanup() [member function] + cls.add_method('Cleanup', + 'void', + [], + is_static=True) + return + +def register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, cls): + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount >::SimpleRefCount() [constructor] + cls.add_constructor([]) + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount >::SimpleRefCount(ns3::SimpleRefCount > const & o) [copy constructor] + cls.add_constructor([param('ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter< ns3::NixVector > > const &', 'o')]) + ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount >::Cleanup() [member function] + cls.add_method('Cleanup', + 'void', + [], + is_static=True) + return + +def register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, cls): + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount >::SimpleRefCount() [constructor] + cls.add_constructor([]) + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount >::SimpleRefCount(ns3::SimpleRefCount > const & o) [copy constructor] + cls.add_constructor([param('ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter< ns3::Packet > > const &', 'o')]) + ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount >::Cleanup() [member function] + cls.add_method('Cleanup', + 'void', + [], + is_static=True) + return + +def register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, cls): + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount >::SimpleRefCount() [constructor] + cls.add_constructor([]) + ## simple-ref-count.h (module 'core'): ns3::SimpleRefCount >::SimpleRefCount(ns3::SimpleRefCount > const & o) [copy constructor] + cls.add_constructor([param('ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter< ns3::TraceSourceAccessor > > const &', 'o')]) + ## simple-ref-count.h (module 'core'): static void ns3::SimpleRefCount >::Cleanup() [member function] + cls.add_method('Cleanup', + 'void', + [], + is_static=True) + return + +def register_Ns3Time_methods(root_module, cls): + cls.add_binary_numeric_operator('*', root_module['ns3::Time'], root_module['ns3::Time'], param('int64_t const &', u'right')) + cls.add_binary_numeric_operator('+', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', u'right')) + cls.add_binary_numeric_operator('-', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::Time const &', u'right')) + cls.add_binary_numeric_operator('/', root_module['ns3::Time'], root_module['ns3::Time'], param('int64_t const &', u'right')) + cls.add_binary_comparison_operator('<') + cls.add_binary_comparison_operator('>') + cls.add_binary_comparison_operator('!=') + cls.add_inplace_numeric_operator('+=', param('ns3::Time const &', u'right')) + cls.add_inplace_numeric_operator('-=', param('ns3::Time const &', u'right')) + cls.add_output_stream_operator() + cls.add_binary_comparison_operator('<=') + cls.add_binary_comparison_operator('==') + cls.add_binary_comparison_operator('>=') + ## nstime.h (module 'core'): ns3::Time::Time() [constructor] + cls.add_constructor([]) + ## nstime.h (module 'core'): ns3::Time::Time(ns3::Time const & o) [copy constructor] + cls.add_constructor([param('ns3::Time const &', 'o')]) + ## nstime.h (module 'core'): ns3::Time::Time(double v) [constructor] + cls.add_constructor([param('double', 'v')]) + ## nstime.h (module 'core'): ns3::Time::Time(int v) [constructor] + cls.add_constructor([param('int', 'v')]) + ## nstime.h (module 'core'): ns3::Time::Time(long int v) [constructor] + cls.add_constructor([param('long int', 'v')]) + ## nstime.h (module 'core'): ns3::Time::Time(long long int v) [constructor] + cls.add_constructor([param('long long int', 'v')]) + ## nstime.h (module 'core'): ns3::Time::Time(unsigned int v) [constructor] + cls.add_constructor([param('unsigned int', 'v')]) + ## nstime.h (module 'core'): ns3::Time::Time(long unsigned int v) [constructor] + cls.add_constructor([param('long unsigned int', 'v')]) + ## nstime.h (module 'core'): ns3::Time::Time(long long unsigned int v) [constructor] + cls.add_constructor([param('long long unsigned int', 'v')]) + ## nstime.h (module 'core'): ns3::Time::Time(ns3::int64x64_t const & v) [constructor] + cls.add_constructor([param('ns3::int64x64_t const &', 'v')]) + ## nstime.h (module 'core'): ns3::Time::Time(std::string const & s) [constructor] + cls.add_constructor([param('std::string const &', 's')]) + ## nstime.h (module 'core'): ns3::TimeWithUnit ns3::Time::As(ns3::Time::Unit const unit) const [member function] + cls.add_method('As', + 'ns3::TimeWithUnit', + [param('ns3::Time::Unit const', 'unit')], + is_const=True) + ## nstime.h (module 'core'): int ns3::Time::Compare(ns3::Time const & o) const [member function] + cls.add_method('Compare', + 'int', + [param('ns3::Time const &', 'o')], + is_const=True) + ## nstime.h (module 'core'): static ns3::Time ns3::Time::From(ns3::int64x64_t const & value) [member function] + cls.add_method('From', + 'ns3::Time', + [param('ns3::int64x64_t const &', 'value')], + is_static=True) + ## nstime.h (module 'core'): static ns3::Time ns3::Time::From(ns3::int64x64_t const & value, ns3::Time::Unit unit) [member function] + cls.add_method('From', + 'ns3::Time', + [param('ns3::int64x64_t const &', 'value'), param('ns3::Time::Unit', 'unit')], + is_static=True) + ## nstime.h (module 'core'): static ns3::Time ns3::Time::FromDouble(double value, ns3::Time::Unit unit) [member function] + cls.add_method('FromDouble', + 'ns3::Time', + [param('double', 'value'), param('ns3::Time::Unit', 'unit')], + is_static=True) + ## nstime.h (module 'core'): static ns3::Time ns3::Time::FromInteger(uint64_t value, ns3::Time::Unit unit) [member function] + cls.add_method('FromInteger', + 'ns3::Time', + [param('uint64_t', 'value'), param('ns3::Time::Unit', 'unit')], + is_static=True) + ## nstime.h (module 'core'): double ns3::Time::GetDays() const [member function] + cls.add_method('GetDays', + 'double', + [], + is_const=True) + ## nstime.h (module 'core'): double ns3::Time::GetDouble() const [member function] + cls.add_method('GetDouble', + 'double', + [], + is_const=True) + ## nstime.h (module 'core'): int64_t ns3::Time::GetFemtoSeconds() const [member function] + cls.add_method('GetFemtoSeconds', + 'int64_t', + [], + is_const=True) + ## nstime.h (module 'core'): double ns3::Time::GetHours() const [member function] + cls.add_method('GetHours', + 'double', + [], + is_const=True) + ## nstime.h (module 'core'): int64_t ns3::Time::GetInteger() const [member function] + cls.add_method('GetInteger', + 'int64_t', + [], + is_const=True) + ## nstime.h (module 'core'): int64_t ns3::Time::GetMicroSeconds() const [member function] + cls.add_method('GetMicroSeconds', + 'int64_t', + [], + is_const=True) + ## nstime.h (module 'core'): int64_t ns3::Time::GetMilliSeconds() const [member function] + cls.add_method('GetMilliSeconds', + 'int64_t', + [], + is_const=True) + ## nstime.h (module 'core'): double ns3::Time::GetMinutes() const [member function] + cls.add_method('GetMinutes', + 'double', + [], + is_const=True) + ## nstime.h (module 'core'): int64_t ns3::Time::GetNanoSeconds() const [member function] + cls.add_method('GetNanoSeconds', + 'int64_t', + [], + is_const=True) + ## nstime.h (module 'core'): int64_t ns3::Time::GetPicoSeconds() const [member function] + cls.add_method('GetPicoSeconds', + 'int64_t', + [], + is_const=True) + ## nstime.h (module 'core'): static ns3::Time::Unit ns3::Time::GetResolution() [member function] + cls.add_method('GetResolution', + 'ns3::Time::Unit', + [], + is_static=True) + ## nstime.h (module 'core'): double ns3::Time::GetSeconds() const [member function] + cls.add_method('GetSeconds', + 'double', + [], + is_const=True) + ## nstime.h (module 'core'): int64_t ns3::Time::GetTimeStep() const [member function] + cls.add_method('GetTimeStep', + 'int64_t', + [], + is_const=True) + ## nstime.h (module 'core'): double ns3::Time::GetYears() const [member function] + cls.add_method('GetYears', + 'double', + [], + is_const=True) + ## nstime.h (module 'core'): bool ns3::Time::IsNegative() const [member function] + cls.add_method('IsNegative', + 'bool', + [], + is_const=True) + ## nstime.h (module 'core'): bool ns3::Time::IsPositive() const [member function] + cls.add_method('IsPositive', + 'bool', + [], + is_const=True) + ## nstime.h (module 'core'): bool ns3::Time::IsStrictlyNegative() const [member function] + cls.add_method('IsStrictlyNegative', + 'bool', + [], + is_const=True) + ## nstime.h (module 'core'): bool ns3::Time::IsStrictlyPositive() const [member function] + cls.add_method('IsStrictlyPositive', + 'bool', + [], + is_const=True) + ## nstime.h (module 'core'): bool ns3::Time::IsZero() const [member function] + cls.add_method('IsZero', + 'bool', + [], + is_const=True) + ## nstime.h (module 'core'): static ns3::Time ns3::Time::Max() [member function] + cls.add_method('Max', + 'ns3::Time', + [], + is_static=True) + ## nstime.h (module 'core'): static ns3::Time ns3::Time::Min() [member function] + cls.add_method('Min', + 'ns3::Time', + [], + is_static=True) + ## nstime.h (module 'core'): static void ns3::Time::SetResolution(ns3::Time::Unit resolution) [member function] + cls.add_method('SetResolution', + 'void', + [param('ns3::Time::Unit', 'resolution')], + is_static=True) + ## nstime.h (module 'core'): static bool ns3::Time::StaticInit() [member function] + cls.add_method('StaticInit', + 'bool', + [], + is_static=True) + ## nstime.h (module 'core'): ns3::int64x64_t ns3::Time::To(ns3::Time::Unit unit) const [member function] + cls.add_method('To', + 'ns3::int64x64_t', + [param('ns3::Time::Unit', 'unit')], + is_const=True) + ## nstime.h (module 'core'): double ns3::Time::ToDouble(ns3::Time::Unit unit) const [member function] + cls.add_method('ToDouble', + 'double', + [param('ns3::Time::Unit', 'unit')], + is_const=True) + ## nstime.h (module 'core'): int64_t ns3::Time::ToInteger(ns3::Time::Unit unit) const [member function] + cls.add_method('ToInteger', + 'int64_t', + [param('ns3::Time::Unit', 'unit')], + is_const=True) + return + +def register_Ns3TraceSourceAccessor_methods(root_module, cls): + ## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor(ns3::TraceSourceAccessor const & arg0) [copy constructor] + cls.add_constructor([param('ns3::TraceSourceAccessor const &', 'arg0')]) + ## trace-source-accessor.h (module 'core'): ns3::TraceSourceAccessor::TraceSourceAccessor() [constructor] + cls.add_constructor([]) + ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Connect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function] + cls.add_method('Connect', + 'bool', + [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')], + is_pure_virtual=True, is_const=True, is_virtual=True) + ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::ConnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function] + cls.add_method('ConnectWithoutContext', + 'bool', + [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')], + is_pure_virtual=True, is_const=True, is_virtual=True) + ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::Disconnect(ns3::ObjectBase * obj, std::string context, ns3::CallbackBase const & cb) const [member function] + cls.add_method('Disconnect', + 'bool', + [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('std::string', 'context'), param('ns3::CallbackBase const &', 'cb')], + is_pure_virtual=True, is_const=True, is_virtual=True) + ## trace-source-accessor.h (module 'core'): bool ns3::TraceSourceAccessor::DisconnectWithoutContext(ns3::ObjectBase * obj, ns3::CallbackBase const & cb) const [member function] + cls.add_method('DisconnectWithoutContext', + 'bool', + [param('ns3::ObjectBase *', 'obj', transfer_ownership=False), param('ns3::CallbackBase const &', 'cb')], + is_pure_virtual=True, is_const=True, is_virtual=True) + return + +def register_Ns3Trailer_methods(root_module, cls): + cls.add_output_stream_operator() + ## trailer.h (module 'network'): ns3::Trailer::Trailer() [constructor] + cls.add_constructor([]) + ## trailer.h (module 'network'): ns3::Trailer::Trailer(ns3::Trailer const & arg0) [copy constructor] + cls.add_constructor([param('ns3::Trailer const &', 'arg0')]) + ## trailer.h (module 'network'): uint32_t ns3::Trailer::Deserialize(ns3::Buffer::Iterator end) [member function] + cls.add_method('Deserialize', + 'uint32_t', + [param('ns3::Buffer::Iterator', 'end')], + is_pure_virtual=True, is_virtual=True) + ## trailer.h (module 'network'): uint32_t ns3::Trailer::GetSerializedSize() const [member function] + cls.add_method('GetSerializedSize', + 'uint32_t', + [], + is_pure_virtual=True, is_const=True, is_virtual=True) + ## trailer.h (module 'network'): static ns3::TypeId ns3::Trailer::GetTypeId() [member function]