src
stringlengths 721
1.04M
|
|---|
from ideFoam.ofCase import OfCase
class OfMesher( OfCase ):
additionalFiles = [
"blockMeshDict",
"snappyHexMeshDict",
"extrudeMeshDict",
"surfaceFeatureExtractDict"
]
handledFiles = OfCase.handledFiles + additionalFiles
def __init__(self, *args, extrudeMeshDict=None,
snappyHexMeshDict=None,
surfaceFeatureExtractDict=None,
blockMeshDict=None,
refineMeshDicts=[],
setSelections=[],
**kwargs):
"""
Same arguments as OfCase + some boundary input files
"""
OfCase.__init__(self, *args, **kwargs)
self.blockMeshDict = blockMeshDict
self.snappyHexMeshDict = snappyHexMeshDict
self.surfaceFeatureExtractDict = surfaceFeatureExtractDict
self.extrudeMeshDict = extrudeMeshDict
self.refineMeshDicts = refineMeshDicts
self.setSelections = setSelections
def writeFiles(self):
OfCase.writeFiles(self)
for i in self.refineMeshDicts :
i.writeFile()
for i in self.setSelections :
i.writeFile()
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2016 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.
# ==============================================================================
r"""Downloads and converts Flowers data to TFRecords of TF-Example protos.
This module downloads the Flowers data, uncompresses it, reads the files
that make up the Flowers data and creates two TFRecord datasets: one for train
and one for test. Each TFRecord dataset is comprised of a set of TF-Example
protocol buffers, each of which contain a single image and label.
The script should take about a minute to run.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
import os
import random
import sys
import argparse
import tensorflow as tf
from datasets import dataset_utils
# The number of images in the validation set.
_NUM_VALIDATION = 350
# Seed for repeatability.
_RANDOM_SEED = 0
# The number of shards per dataset split.
_NUM_SHARDS = 5
class ImageReader(object):
"""Helper class that provides TensorFlow image coding utilities."""
def __init__(self):
# Initializes function that decodes RGB JPEG data.
self._decode_png_data = tf.placeholder(dtype=tf.string)
self._decode_png = tf.image.decode_png(self._decode_png_data, channels=3)
def read_image_dims(self, sess, image_data):
image = self.decode_png(sess, image_data)
return image.shape[0], image.shape[1]
def decode_png(self, sess, image_data):
image = sess.run(self._decode_png,
feed_dict={self._decode_png_data: image_data})
assert len(image.shape) == 3
assert image.shape[2] == 3
return image
def _get_filenames_and_classes(dataset_dir):
"""Returns a list of filenames and inferred class names.
Args:
dataset_dir: A directory containing a set of subdirectories representing
class names. Each subdirectory should contain PNG or JPG encoded images.
Returns:
A list of image file paths, relative to `dataset_dir` and the list of
subdirectories, representing class names.
"""
pedestrian_root = os.path.join(dataset_dir, 'pedestrian_photos')
directories = []
class_names = []
for filename in os.listdir(pedestrian_root):
path = os.path.join(pedestrian_root, filename)
if os.path.isdir(path):
directories.append(path)
class_names.append(filename)
photo_filenames = []
for directory in directories:
for filename in os.listdir(directory):
path = os.path.join(directory, filename)
photo_filenames.append(path)
return photo_filenames, sorted(class_names)
def _get_dataset_filename(dataset_dir, split_name, shard_id):
output_filename = 'pedestrian_%s_%05d-of-%05d.tfrecord' % (
split_name, shard_id, _NUM_SHARDS)
return os.path.join(dataset_dir, output_filename)
def _convert_dataset(split_name, filenames, class_names_to_ids, dataset_dir):
"""Converts the given filenames to a TFRecord dataset.
Args:
split_name: The name of the dataset, either 'train' or 'validation'.
filenames: A list of absolute paths to png or jpg images.
class_names_to_ids: A dictionary from class names (strings) to ids
(integers).
dataset_dir: The directory where the converted datasets are stored.
"""
assert split_name in ['train', 'validation']
num_per_shard = int(math.ceil(len(filenames) / float(_NUM_SHARDS)))
with tf.Graph().as_default():
image_reader = ImageReader()
with tf.Session('') as sess:
for shard_id in range(_NUM_SHARDS):
output_filename = _get_dataset_filename(
dataset_dir, split_name, shard_id)
with tf.python_io.TFRecordWriter(output_filename) as tfrecord_writer:
start_ndx = shard_id * num_per_shard
end_ndx = min((shard_id+1) * num_per_shard, len(filenames))
for i in range(start_ndx, end_ndx):
sys.stdout.write('\r>> Converting image %d/%d shard %d' % (
i+1, len(filenames), shard_id))
sys.stdout.flush()
# Read the filename:
image_data = tf.gfile.FastGFile(filenames[i], 'rb').read()
height, width = image_reader.read_image_dims(sess, image_data)
class_name = os.path.basename(os.path.dirname(filenames[i]))
class_id = class_names_to_ids[class_name]
example = dataset_utils.image_to_tfexample(
image_data, b'png', height, width, class_id)
tfrecord_writer.write(example.SerializeToString())
sys.stdout.write('\n')
sys.stdout.flush()
def _clean_up_temporary_files(dataset_dir):
"""Removes temporary files used to create the dataset.
Args:
dataset_dir: The directory where the temporary files are stored.
"""
filename = _DATA_URL.split('/')[-1]
filepath = os.path.join(dataset_dir, filename)
tf.gfile.Remove(filepath)
tmp_dir = os.path.join(dataset_dir, 'pedestrian_photos')
tf.gfile.DeleteRecursively(tmp_dir)
def _dataset_exists(dataset_dir):
for split_name in ['train', 'validation']:
for shard_id in range(_NUM_SHARDS):
output_filename = _get_dataset_filename(
dataset_dir, split_name, shard_id)
if not tf.gfile.Exists(output_filename):
return False
return True
def run(dataset_dir):
"""Runs the download and conversion operation.
Args:
dataset_dir: The dataset directory where the dataset is stored.
"""
if not tf.gfile.Exists(dataset_dir):
tf.gfile.MakeDirs(dataset_dir)
if _dataset_exists(dataset_dir):
print('Dataset files already exist. Exiting without re-creating them.')
return
photo_filenames, class_names = _get_filenames_and_classes(dataset_dir)
class_names_to_ids = dict(zip(class_names, range(len(class_names))))
# Divide into train and test:
random.seed(_RANDOM_SEED)
random.shuffle(photo_filenames)
training_filenames = photo_filenames[_NUM_VALIDATION:]
validation_filenames = photo_filenames[:_NUM_VALIDATION]
# First, convert the training and validation sets.
_convert_dataset('train', training_filenames, class_names_to_ids,
dataset_dir)
_convert_dataset('validation', validation_filenames, class_names_to_ids,
dataset_dir)
# Finally, write the labels file:
labels_to_class_names = dict(zip(range(len(class_names)), class_names))
dataset_utils.write_label_file(labels_to_class_names, dataset_dir)
#_clean_up_temporary_files(dataset_dir)
print('\nFinished converting the Flowers dataset!')
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='convert dataset to tf records')
parser.add_argument('dataset_dir', help='path to the dataset')
args = parser.parse_args()
run(args.dataset_dir)
|
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.network', cpp_namespace='::ns3')
return root_module
def register_types(module):
root_module = module.get_root()
## packetbb.h (module 'network'): ns3::PbbAddressLength [enumeration]
module.add_enum('PbbAddressLength', ['IPV4', 'IPV6'])
## ethernet-header.h (module 'network'): ns3::ethernet_header_t [enumeration]
module.add_enum('ethernet_header_t', ['LENGTH', 'VLAN', 'QINQ'])
## queue-size.h (module 'network'): ns3::QueueSizeUnit [enumeration]
module.add_enum('QueueSizeUnit', ['PACKETS', 'BYTES'])
## log.h (module 'core'): ns3::LogLevel [enumeration]
module.add_enum('LogLevel', ['LOG_NONE', 'LOG_ERROR', 'LOG_LEVEL_ERROR', 'LOG_WARN', 'LOG_LEVEL_WARN', 'LOG_DEBUG', 'LOG_LEVEL_DEBUG', 'LOG_INFO', 'LOG_LEVEL_INFO', 'LOG_FUNCTION', 'LOG_LEVEL_FUNCTION', 'LOG_LOGIC', 'LOG_LEVEL_LOGIC', 'LOG_ALL', 'LOG_LEVEL_ALL', 'LOG_PREFIX_FUNC', 'LOG_PREFIX_TIME', 'LOG_PREFIX_NODE', 'LOG_PREFIX_LEVEL', 'LOG_PREFIX_ALL'], import_from_module='ns.core')
## address.h (module 'network'): ns3::Address [class]
module.add_class('Address')
## address.h (module 'network'): ns3::Address::MaxSize_e [enumeration]
module.add_enum('MaxSize_e', ['MAX_SIZE'], outer_class=root_module['ns3::Address'])
## application-container.h (module 'network'): ns3::ApplicationContainer [class]
module.add_class('ApplicationContainer')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::Application > > const_iterator', u'ns3::ApplicationContainer::Iterator')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::Application > > const_iterator*', u'ns3::ApplicationContainer::Iterator*')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::Application > > const_iterator&', u'ns3::ApplicationContainer::Iterator&')
## ascii-file.h (module 'network'): ns3::AsciiFile [class]
module.add_class('AsciiFile')
## trace-helper.h (module 'network'): ns3::AsciiTraceHelper [class]
module.add_class('AsciiTraceHelper')
## trace-helper.h (module 'network'): ns3::AsciiTraceHelperForDevice [class]
module.add_class('AsciiTraceHelperForDevice', allow_subclassing=True)
## 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'])
typehandlers.add_type_alias(u'std::list< ns3::AttributeConstructionList::Item > const_iterator', u'ns3::AttributeConstructionList::CIterator')
typehandlers.add_type_alias(u'std::list< ns3::AttributeConstructionList::Item > const_iterator*', u'ns3::AttributeConstructionList::CIterator*')
typehandlers.add_type_alias(u'std::list< ns3::AttributeConstructionList::Item > const_iterator&', u'ns3::AttributeConstructionList::CIterator&')
## buffer.h (module 'network'): ns3::Buffer [class]
module.add_class('Buffer')
## buffer.h (module 'network'): ns3::Buffer::Iterator [class]
module.add_class('Iterator', outer_class=root_module['ns3::Buffer'])
## packet.h (module 'network'): ns3::ByteTagIterator [class]
module.add_class('ByteTagIterator')
## packet.h (module 'network'): ns3::ByteTagIterator::Item [class]
module.add_class('Item', outer_class=root_module['ns3::ByteTagIterator'])
## byte-tag-list.h (module 'network'): ns3::ByteTagList [class]
module.add_class('ByteTagList')
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator [class]
module.add_class('Iterator', outer_class=root_module['ns3::ByteTagList'])
## byte-tag-list.h (module 'network'): ns3::ByteTagList::Iterator::Item [struct]
module.add_class('Item', outer_class=root_module['ns3::ByteTagList::Iterator'])
## callback.h (module 'core'): ns3::CallbackBase [class]
module.add_class('CallbackBase', import_from_module='ns.core')
## channel-list.h (module 'network'): ns3::ChannelList [class]
module.add_class('ChannelList')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::Channel > > const_iterator', u'ns3::ChannelList::Iterator')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::Channel > > const_iterator*', u'ns3::ChannelList::Iterator*')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::Channel > > const_iterator&', u'ns3::ChannelList::Iterator&')
## data-output-interface.h (module 'stats'): ns3::DataOutputCallback [class]
module.add_class('DataOutputCallback', allow_subclassing=True, import_from_module='ns.stats')
## data-rate.h (module 'network'): ns3::DataRate [class]
module.add_class('DataRate')
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::AttributeAccessor> [struct]
module.add_class('DefaultDeleter', import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::AttributeChecker> [struct]
module.add_class('DefaultDeleter', import_from_module='ns.core', template_parameters=['ns3::AttributeChecker'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::AttributeValue> [struct]
module.add_class('DefaultDeleter', import_from_module='ns.core', template_parameters=['ns3::AttributeValue'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::CallbackImplBase> [struct]
module.add_class('DefaultDeleter', import_from_module='ns.core', template_parameters=['ns3::CallbackImplBase'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::EventImpl> [struct]
module.add_class('DefaultDeleter', import_from_module='ns.core', template_parameters=['ns3::EventImpl'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::Hash::Implementation> [struct]
module.add_class('DefaultDeleter', import_from_module='ns.core', template_parameters=['ns3::Hash::Implementation'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::NetDeviceQueue> [struct]
module.add_class('DefaultDeleter', template_parameters=['ns3::NetDeviceQueue'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::NixVector> [struct]
module.add_class('DefaultDeleter', template_parameters=['ns3::NixVector'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::OutputStreamWrapper> [struct]
module.add_class('DefaultDeleter', template_parameters=['ns3::OutputStreamWrapper'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::Packet> [struct]
module.add_class('DefaultDeleter', template_parameters=['ns3::Packet'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::PbbAddressBlock> [struct]
module.add_class('DefaultDeleter', template_parameters=['ns3::PbbAddressBlock'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::PbbMessage> [struct]
module.add_class('DefaultDeleter', template_parameters=['ns3::PbbMessage'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::PbbTlv> [struct]
module.add_class('DefaultDeleter', template_parameters=['ns3::PbbTlv'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::QueueItem> [struct]
module.add_class('DefaultDeleter', template_parameters=['ns3::QueueItem'])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::TraceSourceAccessor> [struct]
module.add_class('DefaultDeleter', import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor'])
## delay-jitter-estimation.h (module 'network'): ns3::DelayJitterEstimation [class]
module.add_class('DelayJitterEstimation')
## 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')
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress [class]
module.add_class('Inet6SocketAddress')
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress [class]
root_module['ns3::Inet6SocketAddress'].implicitly_converts_to(root_module['ns3::Address'])
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress [class]
module.add_class('InetSocketAddress')
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress [class]
root_module['ns3::InetSocketAddress'].implicitly_converts_to(root_module['ns3::Address'])
## ipv4-address.h (module 'network'): ns3::Ipv4Address [class]
module.add_class('Ipv4Address')
## 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')
## ipv6-address.h (module 'network'): ns3::Ipv6Address [class]
module.add_class('Ipv6Address')
## 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')
## log.h (module 'core'): ns3::LogComponent [class]
module.add_class('LogComponent', import_from_module='ns.core')
typehandlers.add_type_alias(u'std::map< std::string, ns3::LogComponent * >', u'ns3::LogComponent::ComponentList')
typehandlers.add_type_alias(u'std::map< std::string, ns3::LogComponent * >*', u'ns3::LogComponent::ComponentList*')
typehandlers.add_type_alias(u'std::map< std::string, ns3::LogComponent * >&', u'ns3::LogComponent::ComponentList&')
## mac16-address.h (module 'network'): ns3::Mac16Address [class]
module.add_class('Mac16Address')
## mac16-address.h (module 'network'): ns3::Mac16Address [class]
root_module['ns3::Mac16Address'].implicitly_converts_to(root_module['ns3::Address'])
## mac48-address.h (module 'network'): ns3::Mac48Address [class]
module.add_class('Mac48Address')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Mac48Address )', u'ns3::Mac48Address::TracedCallback')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Mac48Address )*', u'ns3::Mac48Address::TracedCallback*')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Mac48Address )&', u'ns3::Mac48Address::TracedCallback&')
## mac48-address.h (module 'network'): ns3::Mac48Address [class]
root_module['ns3::Mac48Address'].implicitly_converts_to(root_module['ns3::Address'])
## mac64-address.h (module 'network'): ns3::Mac64Address [class]
module.add_class('Mac64Address')
## mac64-address.h (module 'network'): ns3::Mac64Address [class]
root_module['ns3::Mac64Address'].implicitly_converts_to(root_module['ns3::Address'])
## mac8-address.h (module 'network'): ns3::Mac8Address [class]
module.add_class('Mac8Address')
## mac8-address.h (module 'network'): ns3::Mac8Address [class]
root_module['ns3::Mac8Address'].implicitly_converts_to(root_module['ns3::Address'])
## net-device-container.h (module 'network'): ns3::NetDeviceContainer [class]
module.add_class('NetDeviceContainer')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::NetDevice > > const_iterator', u'ns3::NetDeviceContainer::Iterator')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::NetDevice > > const_iterator*', u'ns3::NetDeviceContainer::Iterator*')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::NetDevice > > const_iterator&', u'ns3::NetDeviceContainer::Iterator&')
## node-container.h (module 'network'): ns3::NodeContainer [class]
module.add_class('NodeContainer')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::Node > > const_iterator', u'ns3::NodeContainer::Iterator')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::Node > > const_iterator*', u'ns3::NodeContainer::Iterator*')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::Node > > const_iterator&', u'ns3::NodeContainer::Iterator&')
## node-list.h (module 'network'): ns3::NodeList [class]
module.add_class('NodeList')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::Node > > const_iterator', u'ns3::NodeList::Iterator')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::Node > > const_iterator*', u'ns3::NodeList::Iterator*')
typehandlers.add_type_alias(u'std::vector< ns3::Ptr< ns3::Node > > const_iterator&', u'ns3::NodeList::Iterator&')
## non-copyable.h (module 'core'): ns3::NonCopyable [class]
module.add_class('NonCopyable', destructor_visibility='protected', import_from_module='ns.core')
## 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')
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item [struct]
module.add_class('Item', outer_class=root_module['ns3::PacketMetadata'])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::ItemType [enumeration]
module.add_enum('ItemType', ['PAYLOAD', 'HEADER', 'TRAILER'], outer_class=root_module['ns3::PacketMetadata::Item'])
## packet-metadata.h (module 'network'): ns3::PacketMetadata::ItemIterator [class]
module.add_class('ItemIterator', outer_class=root_module['ns3::PacketMetadata'])
## packet-socket-address.h (module 'network'): ns3::PacketSocketAddress [class]
module.add_class('PacketSocketAddress')
## packet-socket-address.h (module 'network'): ns3::PacketSocketAddress [class]
root_module['ns3::PacketSocketAddress'].implicitly_converts_to(root_module['ns3::Address'])
## packet-socket-helper.h (module 'network'): ns3::PacketSocketHelper [class]
module.add_class('PacketSocketHelper')
## packet.h (module 'network'): ns3::PacketTagIterator [class]
module.add_class('PacketTagIterator')
## packet.h (module 'network'): ns3::PacketTagIterator::Item [class]
module.add_class('Item', outer_class=root_module['ns3::PacketTagIterator'])
## packet-tag-list.h (module 'network'): ns3::PacketTagList [class]
module.add_class('PacketTagList')
## packet-tag-list.h (module 'network'): ns3::PacketTagList::TagData [struct]
module.add_class('TagData', outer_class=root_module['ns3::PacketTagList'])
## log.h (module 'core'): ns3::ParameterLogger [class]
module.add_class('ParameterLogger', import_from_module='ns.core')
## packetbb.h (module 'network'): ns3::PbbAddressTlvBlock [class]
module.add_class('PbbAddressTlvBlock')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbAddressTlv > > iterator', u'ns3::PbbAddressTlvBlock::Iterator')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbAddressTlv > > iterator*', u'ns3::PbbAddressTlvBlock::Iterator*')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbAddressTlv > > iterator&', u'ns3::PbbAddressTlvBlock::Iterator&')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbAddressTlv > > const_iterator', u'ns3::PbbAddressTlvBlock::ConstIterator')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbAddressTlv > > const_iterator*', u'ns3::PbbAddressTlvBlock::ConstIterator*')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbAddressTlv > > const_iterator&', u'ns3::PbbAddressTlvBlock::ConstIterator&')
## packetbb.h (module 'network'): ns3::PbbTlvBlock [class]
module.add_class('PbbTlvBlock')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbTlv > > iterator', u'ns3::PbbTlvBlock::Iterator')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbTlv > > iterator*', u'ns3::PbbTlvBlock::Iterator*')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbTlv > > iterator&', u'ns3::PbbTlvBlock::Iterator&')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbTlv > > const_iterator', u'ns3::PbbTlvBlock::ConstIterator')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbTlv > > const_iterator*', u'ns3::PbbTlvBlock::ConstIterator*')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbTlv > > const_iterator&', u'ns3::PbbTlvBlock::ConstIterator&')
## pcap-file.h (module 'network'): ns3::PcapFile [class]
module.add_class('PcapFile')
## trace-helper.h (module 'network'): ns3::PcapHelper [class]
module.add_class('PcapHelper')
## trace-helper.h (module 'network'): ns3::PcapHelper::DataLinkType [enumeration]
module.add_enum('DataLinkType', ['DLT_NULL', 'DLT_EN10MB', 'DLT_PPP', 'DLT_RAW', 'DLT_IEEE802_11', 'DLT_LINUX_SLL', 'DLT_PRISM_HEADER', 'DLT_IEEE802_11_RADIO', 'DLT_IEEE802_15_4', 'DLT_NETLINK'], outer_class=root_module['ns3::PcapHelper'])
## trace-helper.h (module 'network'): ns3::PcapHelperForDevice [class]
module.add_class('PcapHelperForDevice', allow_subclassing=True)
## queue-size.h (module 'network'): ns3::QueueSize [class]
module.add_class('QueueSize')
## sequence-number.h (module 'network'): ns3::SequenceNumber<unsigned int, int> [class]
module.add_class('SequenceNumber32')
## sequence-number.h (module 'network'): ns3::SequenceNumber<unsigned short, short> [class]
module.add_class('SequenceNumber16')
## simple-net-device-helper.h (module 'network'): ns3::SimpleNetDeviceHelper [class]
module.add_class('SimpleNetDeviceHelper')
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> [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')
## simulator.h (module 'core'): ns3::Simulator [enumeration]
module.add_enum('', ['NO_CONTEXT'], outer_class=root_module['ns3::Simulator'], import_from_module='ns.core')
## data-calculator.h (module 'stats'): ns3::StatisticalSummary [class]
module.add_class('StatisticalSummary', allow_subclassing=True, import_from_module='ns.stats')
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs [class]
module.add_class('SystemWallClockMs', import_from_module='ns.core')
## tag.h (module 'network'): ns3::Tag [class]
module.add_class('Tag', parent=root_module['ns3::ObjectBase'])
## tag-buffer.h (module 'network'): ns3::TagBuffer [class]
module.add_class('TagBuffer')
## nstime.h (module 'core'): ns3::TimeWithUnit [class]
module.add_class('TimeWithUnit', import_from_module='ns.core')
## traced-value.h (module 'core'): ns3::TracedValue<unsigned int> [class]
module.add_class('TracedValue', import_from_module='ns.core', template_parameters=['unsigned int'])
## 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::SupportLevel [enumeration]
module.add_enum('SupportLevel', ['SUPPORTED', 'DEPRECATED', 'OBSOLETE'], 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'])
typehandlers.add_type_alias(u'uint32_t', u'ns3::TypeId::hash_t')
typehandlers.add_type_alias(u'uint32_t*', u'ns3::TypeId::hash_t*')
typehandlers.add_type_alias(u'uint32_t&', u'ns3::TypeId::hash_t&')
## empty.h (module 'core'): ns3::empty [class]
module.add_class('empty', import_from_module='ns.core')
## int64x64-128.h (module 'core'): ns3::int64x64_t [class]
module.add_class('int64x64_t', import_from_module='ns.core')
## int64x64-128.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')
## chunk.h (module 'network'): ns3::Chunk [class]
module.add_class('Chunk', parent=root_module['ns3::ObjectBase'])
## packet-socket.h (module 'network'): ns3::DeviceNameTag [class]
module.add_class('DeviceNameTag', parent=root_module['ns3::Tag'])
## flow-id-tag.h (module 'network'): ns3::FlowIdTag [class]
module.add_class('FlowIdTag', parent=root_module['ns3::Tag'])
## header.h (module 'network'): ns3::Header [class]
module.add_class('Header', parent=root_module['ns3::Chunk'])
## llc-snap-header.h (module 'network'): ns3::LlcSnapHeader [class]
module.add_class('LlcSnapHeader', parent=root_module['ns3::Header'])
## 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'])
## packet-burst.h (module 'network'): ns3::PacketBurst [class]
module.add_class('PacketBurst', parent=root_module['ns3::Object'])
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::PacketBurst const > )', u'ns3::PacketBurst::TracedCallback')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::PacketBurst const > )*', u'ns3::PacketBurst::TracedCallback*')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::PacketBurst const > )&', u'ns3::PacketBurst::TracedCallback&')
## packet-socket.h (module 'network'): ns3::PacketSocketTag [class]
module.add_class('PacketSocketTag', parent=root_module['ns3::Tag'])
## pcap-file-wrapper.h (module 'network'): ns3::PcapFileWrapper [class]
module.add_class('PcapFileWrapper', parent=root_module['ns3::Object'])
## queue.h (module 'network'): ns3::QueueBase [class]
module.add_class('QueueBase', parent=root_module['ns3::Object'])
## queue-limits.h (module 'network'): ns3::QueueLimits [class]
module.add_class('QueueLimits', parent=root_module['ns3::Object'])
## radiotap-header.h (module 'network'): ns3::RadiotapHeader [class]
module.add_class('RadiotapHeader', parent=root_module['ns3::Header'])
## radiotap-header.h (module 'network'): ns3::RadiotapHeader::FrameFlag [enumeration]
module.add_enum('FrameFlag', ['FRAME_FLAG_NONE', 'FRAME_FLAG_CFP', 'FRAME_FLAG_SHORT_PREAMBLE', 'FRAME_FLAG_WEP', 'FRAME_FLAG_FRAGMENTED', 'FRAME_FLAG_FCS_INCLUDED', 'FRAME_FLAG_DATA_PADDING', 'FRAME_FLAG_BAD_FCS', 'FRAME_FLAG_SHORT_GUARD'], outer_class=root_module['ns3::RadiotapHeader'])
## radiotap-header.h (module 'network'): ns3::RadiotapHeader::ChannelFlags [enumeration]
module.add_enum('ChannelFlags', ['CHANNEL_FLAG_NONE', 'CHANNEL_FLAG_TURBO', 'CHANNEL_FLAG_CCK', 'CHANNEL_FLAG_OFDM', 'CHANNEL_FLAG_SPECTRUM_2GHZ', 'CHANNEL_FLAG_SPECTRUM_5GHZ', 'CHANNEL_FLAG_PASSIVE', 'CHANNEL_FLAG_DYNAMIC', 'CHANNEL_FLAG_GFSK'], outer_class=root_module['ns3::RadiotapHeader'])
## radiotap-header.h (module 'network'): ns3::RadiotapHeader::McsKnown [enumeration]
module.add_enum('McsKnown', ['MCS_KNOWN_NONE', 'MCS_KNOWN_BANDWIDTH', 'MCS_KNOWN_INDEX', 'MCS_KNOWN_GUARD_INTERVAL', 'MCS_KNOWN_HT_FORMAT', 'MCS_KNOWN_FEC_TYPE', 'MCS_KNOWN_STBC', 'MCS_KNOWN_NESS', 'MCS_KNOWN_NESS_BIT_1'], outer_class=root_module['ns3::RadiotapHeader'])
## radiotap-header.h (module 'network'): ns3::RadiotapHeader::McsFlags [enumeration]
module.add_enum('McsFlags', ['MCS_FLAGS_NONE', 'MCS_FLAGS_BANDWIDTH_40', 'MCS_FLAGS_BANDWIDTH_20L', 'MCS_FLAGS_BANDWIDTH_20U', 'MCS_FLAGS_GUARD_INTERVAL', 'MCS_FLAGS_HT_GREENFIELD', 'MCS_FLAGS_FEC_TYPE', 'MCS_FLAGS_STBC_STREAMS', 'MCS_FLAGS_NESS_BIT_0'], outer_class=root_module['ns3::RadiotapHeader'])
## radiotap-header.h (module 'network'): ns3::RadiotapHeader::AmpduFlags [enumeration]
module.add_enum('AmpduFlags', ['A_MPDU_STATUS_NONE', 'A_MPDU_STATUS_REPORT_ZERO_LENGTH', 'A_MPDU_STATUS_IS_ZERO_LENGTH', 'A_MPDU_STATUS_LAST_KNOWN', 'A_MPDU_STATUS_LAST', 'A_MPDU_STATUS_DELIMITER_CRC_ERROR', 'A_MPDU_STATUS_DELIMITER_CRC_KNOWN'], outer_class=root_module['ns3::RadiotapHeader'])
## radiotap-header.h (module 'network'): ns3::RadiotapHeader::VhtKnown [enumeration]
module.add_enum('VhtKnown', ['VHT_KNOWN_NONE', 'VHT_KNOWN_STBC', 'VHT_KNOWN_TXOP_PS_NOT_ALLOWED', 'VHT_KNOWN_GUARD_INTERVAL', 'VHT_KNOWN_SHORT_GI_NSYM_DISAMBIGUATION', 'VHT_KNOWN_LDPC_EXTRA_OFDM_SYMBOL', 'VHT_KNOWN_BEAMFORMED', 'VHT_KNOWN_BANDWIDTH', 'VHT_KNOWN_GROUP_ID', 'VHT_KNOWN_PARTIAL_AID'], outer_class=root_module['ns3::RadiotapHeader'])
## radiotap-header.h (module 'network'): ns3::RadiotapHeader::VhtFlags [enumeration]
module.add_enum('VhtFlags', ['VHT_FLAGS_NONE', 'VHT_FLAGS_STBC', 'VHT_FLAGS_TXOP_PS_NOT_ALLOWED', 'VHT_FLAGS_GUARD_INTERVAL', 'VHT_FLAGS_SHORT_GI_NSYM_DISAMBIGUATION', 'VHT_FLAGS_LDPC_EXTRA_OFDM_SYMBOL', 'VHT_FLAGS_BEAMFORMED'], outer_class=root_module['ns3::RadiotapHeader'])
## radiotap-header.h (module 'network'): ns3::RadiotapHeader::HeData1 [enumeration]
module.add_enum('HeData1', ['HE_DATA1_FORMAT_EXT_SU', 'HE_DATA1_FORMAT_MU', 'HE_DATA1_FORMAT_TRIG', 'HE_DATA1_BSS_COLOR_KNOWN', 'HE_DATA1_BEAM_CHANGE_KNOWN', 'HE_DATA1_UL_DL_KNOWN', 'HE_DATA1_DATA_MCS_KNOWN', 'HE_DATA1_DATA_DCM_KNOWN', 'HE_DATA1_CODING_KNOWN', 'HE_DATA1_LDPC_XSYMSEG_KNOWN', 'HE_DATA1_STBC_KNOWN', 'HE_DATA1_SPTL_REUSE_KNOWN', 'HE_DATA1_SPTL_REUSE2_KNOWN', 'HE_DATA1_SPTL_REUSE3_KNOWN', 'HE_DATA1_SPTL_REUSE4_KNOWN', 'HE_DATA1_BW_RU_ALLOC_KNOWN', 'HE_DATA1_DOPPLER_KNOWN'], outer_class=root_module['ns3::RadiotapHeader'])
## radiotap-header.h (module 'network'): ns3::RadiotapHeader::HeData2 [enumeration]
module.add_enum('HeData2', ['HE_DATA2_PRISEC_80_KNOWN', 'HE_DATA2_GI_KNOWN', 'HE_DATA2_NUM_LTF_SYMS_KNOWN', 'HE_DATA2_PRE_FEC_PAD_KNOWN', 'HE_DATA2_TXBF_KNOWN', 'HE_DATA2_PE_DISAMBIG_KNOWN', 'HE_DATA2_TXOP_KNOWN', 'HE_DATA2_MIDAMBLE_KNOWN', 'HE_DATA2_RU_OFFSET', 'HE_DATA2_RU_OFFSET_KNOWN', 'HE_DATA2_PRISEC_80_SEC'], outer_class=root_module['ns3::RadiotapHeader'])
## radiotap-header.h (module 'network'): ns3::RadiotapHeader::HeData3 [enumeration]
module.add_enum('HeData3', ['HE_DATA3_BSS_COLOR', 'HE_DATA3_BEAM_CHANGE', 'HE_DATA3_UL_DL', 'HE_DATA3_DATA_MCS', 'HE_DATA3_DATA_DCM', 'HE_DATA3_CODING', 'HE_DATA3_LDPC_XSYMSEG', 'HE_DATA3_STBC'], outer_class=root_module['ns3::RadiotapHeader'])
## radiotap-header.h (module 'network'): ns3::RadiotapHeader::HeData5 [enumeration]
module.add_enum('HeData5', ['HE_DATA5_DATA_BW_RU_ALLOC_40MHZ', 'HE_DATA5_DATA_BW_RU_ALLOC_80MHZ', 'HE_DATA5_DATA_BW_RU_ALLOC_160MHZ', 'HE_DATA5_DATA_BW_RU_ALLOC_26T', 'HE_DATA5_DATA_BW_RU_ALLOC_52T', 'HE_DATA5_DATA_BW_RU_ALLOC_106T', 'HE_DATA5_DATA_BW_RU_ALLOC_242T', 'HE_DATA5_DATA_BW_RU_ALLOC_484T', 'HE_DATA5_DATA_BW_RU_ALLOC_996T', 'HE_DATA5_DATA_BW_RU_ALLOC_2x996T', 'HE_DATA5_GI_1_6', 'HE_DATA5_GI_3_2', 'HE_DATA5_LTF_SYM_SIZE', 'HE_DATA5_NUM_LTF_SYMS', 'HE_DATA5_PRE_FEC_PAD', 'HE_DATA5_TXBF', 'HE_DATA5_PE_DISAMBIG'], outer_class=root_module['ns3::RadiotapHeader'])
## 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<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeAccessor>'], 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<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeChecker', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeChecker>'], 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<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::AttributeValue', 'ns3::empty', 'ns3::DefaultDeleter<ns3::AttributeValue>'], 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<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::CallbackImplBase', 'ns3::empty', 'ns3::DefaultDeleter<ns3::CallbackImplBase>'], 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<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::EventImpl', 'ns3::empty', 'ns3::DefaultDeleter<ns3::EventImpl>'], 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<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::Hash::Implementation', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Hash::Implementation>'], 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<ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter<ns3::NetDeviceQueue> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::NetDeviceQueue', 'ns3::empty', 'ns3::DefaultDeleter<ns3::NetDeviceQueue>'], 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<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::NixVector', 'ns3::empty', 'ns3::DefaultDeleter<ns3::NixVector>'], 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<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::OutputStreamWrapper', 'ns3::empty', 'ns3::DefaultDeleter<ns3::OutputStreamWrapper>'], 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<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::Packet', 'ns3::empty', 'ns3::DefaultDeleter<ns3::Packet>'], 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<ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::PbbAddressBlock', 'ns3::empty', 'ns3::DefaultDeleter<ns3::PbbAddressBlock>'], 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<ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter<ns3::PbbMessage> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::PbbMessage', 'ns3::empty', 'ns3::DefaultDeleter<ns3::PbbMessage>'], 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<ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter<ns3::PbbPacket> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::PbbPacket', 'ns3::Header', 'ns3::DefaultDeleter<ns3::PbbPacket>'], parent=root_module['ns3::Header'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter<ns3::PbbTlv> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::PbbTlv', 'ns3::empty', 'ns3::DefaultDeleter<ns3::PbbTlv>'], 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<ns3::QueueItem, ns3::empty, ns3::DefaultDeleter<ns3::QueueItem> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, template_parameters=['ns3::QueueItem', 'ns3::empty', 'ns3::DefaultDeleter<ns3::QueueItem>'], 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<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > [class]
module.add_class('SimpleRefCount', automatic_type_narrowing=True, import_from_module='ns.core', template_parameters=['ns3::TraceSourceAccessor', 'ns3::empty', 'ns3::DefaultDeleter<ns3::TraceSourceAccessor>'], parent=root_module['ns3::empty'], memory_policy=cppclass.ReferenceCountingMethodsPolicy(incref_method='Ref', decref_method='Unref', peekref_method='GetReferenceCount'))
## sll-header.h (module 'network'): ns3::SllHeader [class]
module.add_class('SllHeader', parent=root_module['ns3::Header'])
## sll-header.h (module 'network'): ns3::SllHeader::PacketType [enumeration]
module.add_enum('PacketType', ['UNICAST_FROM_PEER_TO_ME', 'BROADCAST_BY_PEER', 'MULTICAST_BY_PEER', 'INTERCEPTED_PACKET', 'SENT_BY_US'], outer_class=root_module['ns3::SllHeader'])
## socket.h (module 'network'): ns3::Socket [class]
module.add_class('Socket', parent=root_module['ns3::Object'])
## socket.h (module 'network'): ns3::Socket::SocketErrno [enumeration]
module.add_enum('SocketErrno', ['ERROR_NOTERROR', 'ERROR_ISCONN', 'ERROR_NOTCONN', 'ERROR_MSGSIZE', 'ERROR_AGAIN', 'ERROR_SHUTDOWN', 'ERROR_OPNOTSUPP', 'ERROR_AFNOSUPPORT', 'ERROR_INVAL', 'ERROR_BADF', 'ERROR_NOROUTETOHOST', 'ERROR_NODEV', 'ERROR_ADDRNOTAVAIL', 'ERROR_ADDRINUSE', 'SOCKET_ERRNO_LAST'], outer_class=root_module['ns3::Socket'])
## socket.h (module 'network'): ns3::Socket::SocketType [enumeration]
module.add_enum('SocketType', ['NS3_SOCK_STREAM', 'NS3_SOCK_SEQPACKET', 'NS3_SOCK_DGRAM', 'NS3_SOCK_RAW'], outer_class=root_module['ns3::Socket'])
## socket.h (module 'network'): ns3::Socket::SocketPriority [enumeration]
module.add_enum('SocketPriority', ['NS3_PRIO_BESTEFFORT', 'NS3_PRIO_FILLER', 'NS3_PRIO_BULK', 'NS3_PRIO_INTERACTIVE_BULK', 'NS3_PRIO_INTERACTIVE', 'NS3_PRIO_CONTROL'], outer_class=root_module['ns3::Socket'])
## socket.h (module 'network'): ns3::Socket::Ipv6MulticastFilterMode [enumeration]
module.add_enum('Ipv6MulticastFilterMode', ['INCLUDE', 'EXCLUDE'], outer_class=root_module['ns3::Socket'])
## socket-factory.h (module 'network'): ns3::SocketFactory [class]
module.add_class('SocketFactory', parent=root_module['ns3::Object'])
## socket.h (module 'network'): ns3::SocketIpTosTag [class]
module.add_class('SocketIpTosTag', parent=root_module['ns3::Tag'])
## socket.h (module 'network'): ns3::SocketIpTtlTag [class]
module.add_class('SocketIpTtlTag', parent=root_module['ns3::Tag'])
## socket.h (module 'network'): ns3::SocketIpv6HopLimitTag [class]
module.add_class('SocketIpv6HopLimitTag', parent=root_module['ns3::Tag'])
## socket.h (module 'network'): ns3::SocketIpv6TclassTag [class]
module.add_class('SocketIpv6TclassTag', parent=root_module['ns3::Tag'])
## socket.h (module 'network'): ns3::SocketPriorityTag [class]
module.add_class('SocketPriorityTag', parent=root_module['ns3::Tag'])
## socket.h (module 'network'): ns3::SocketSetDontFragmentTag [class]
module.add_class('SocketSetDontFragmentTag', parent=root_module['ns3::Tag'])
## 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')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Time )', u'ns3::Time::TracedCallback')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Time )*', u'ns3::Time::TracedCallback*')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Time )&', u'ns3::Time::TracedCallback&')
## 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<ns3::TraceSourceAccessor> >'])
## trailer.h (module 'network'): ns3::Trailer [class]
module.add_class('Trailer', 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'])
## 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'])
## application.h (module 'network'): ns3::Application [class]
module.add_class('Application', parent=root_module['ns3::Object'])
typehandlers.add_type_alias(u'void ( * ) ( ns3::Time const &, ns3::Address const & )', u'ns3::Application::DelayAddressCallback')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Time const &, ns3::Address const & )*', u'ns3::Application::DelayAddressCallback*')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Time const &, ns3::Address const & )&', u'ns3::Application::DelayAddressCallback&')
typehandlers.add_type_alias(u'void ( * ) ( std::string const &, std::string const & )', u'ns3::Application::StateTransitionCallback')
typehandlers.add_type_alias(u'void ( * ) ( std::string const &, std::string const & )*', u'ns3::Application::StateTransitionCallback*')
typehandlers.add_type_alias(u'void ( * ) ( std::string const &, std::string const & )&', u'ns3::Application::StateTransitionCallback&')
## 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<ns3::AttributeAccessor> >'])
## 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<ns3::AttributeChecker> >'])
## 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<ns3::AttributeValue> >'])
## 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<ns3::CallbackImplBase> >'])
## 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', 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'])
## data-calculator.h (module 'stats'): ns3::DataCalculator [class]
module.add_class('DataCalculator', import_from_module='ns.stats', parent=root_module['ns3::Object'])
## data-collection-object.h (module 'stats'): ns3::DataCollectionObject [class]
module.add_class('DataCollectionObject', import_from_module='ns.stats', parent=root_module['ns3::Object'])
## data-output-interface.h (module 'stats'): ns3::DataOutputInterface [class]
module.add_class('DataOutputInterface', import_from_module='ns.stats', parent=root_module['ns3::Object'])
## data-rate.h (module 'network'): ns3::DataRateChecker [class]
module.add_class('DataRateChecker', parent=root_module['ns3::AttributeChecker'])
## data-rate.h (module 'network'): ns3::DataRateValue [class]
module.add_class('DataRateValue', parent=root_module['ns3::AttributeValue'])
## random-variable-stream.h (module 'core'): ns3::DeterministicRandomVariable [class]
module.add_class('DeterministicRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## double.h (module 'core'): ns3::DoubleValue [class]
module.add_class('DoubleValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## dynamic-queue-limits.h (module 'network'): ns3::DynamicQueueLimits [class]
module.add_class('DynamicQueueLimits', parent=root_module['ns3::QueueLimits'])
## 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::EmptyAttributeAccessor [class]
module.add_class('EmptyAttributeAccessor', import_from_module='ns.core', parent=root_module['ns3::AttributeAccessor'])
## attribute.h (module 'core'): ns3::EmptyAttributeChecker [class]
module.add_class('EmptyAttributeChecker', import_from_module='ns.core', parent=root_module['ns3::AttributeChecker'])
## attribute.h (module 'core'): ns3::EmptyAttributeValue [class]
module.add_class('EmptyAttributeValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## 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'])
## error-model.h (module 'network'): ns3::ErrorModel [class]
module.add_class('ErrorModel', parent=root_module['ns3::Object'])
## ethernet-header.h (module 'network'): ns3::EthernetHeader [class]
module.add_class('EthernetHeader', parent=root_module['ns3::Header'])
## ethernet-trailer.h (module 'network'): ns3::EthernetTrailer [class]
module.add_class('EthernetTrailer', parent=root_module['ns3::Trailer'])
## 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<ns3::EventImpl> >'])
## 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', parent=root_module['ns3::AttributeChecker'])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue [class]
module.add_class('Ipv4AddressValue', parent=root_module['ns3::AttributeValue'])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker [class]
module.add_class('Ipv4MaskChecker', parent=root_module['ns3::AttributeChecker'])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue [class]
module.add_class('Ipv4MaskValue', parent=root_module['ns3::AttributeValue'])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker [class]
module.add_class('Ipv6AddressChecker', parent=root_module['ns3::AttributeChecker'])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue [class]
module.add_class('Ipv6AddressValue', parent=root_module['ns3::AttributeValue'])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker [class]
module.add_class('Ipv6PrefixChecker', parent=root_module['ns3::AttributeChecker'])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue [class]
module.add_class('Ipv6PrefixValue', parent=root_module['ns3::AttributeValue'])
## error-model.h (module 'network'): ns3::ListErrorModel [class]
module.add_class('ListErrorModel', parent=root_module['ns3::ErrorModel'])
## random-variable-stream.h (module 'core'): ns3::LogNormalRandomVariable [class]
module.add_class('LogNormalRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## mac16-address.h (module 'network'): ns3::Mac16AddressChecker [class]
module.add_class('Mac16AddressChecker', parent=root_module['ns3::AttributeChecker'])
## mac16-address.h (module 'network'): ns3::Mac16AddressValue [class]
module.add_class('Mac16AddressValue', parent=root_module['ns3::AttributeValue'])
## mac48-address.h (module 'network'): ns3::Mac48AddressChecker [class]
module.add_class('Mac48AddressChecker', parent=root_module['ns3::AttributeChecker'])
## mac48-address.h (module 'network'): ns3::Mac48AddressValue [class]
module.add_class('Mac48AddressValue', parent=root_module['ns3::AttributeValue'])
## mac64-address.h (module 'network'): ns3::Mac64AddressChecker [class]
module.add_class('Mac64AddressChecker', parent=root_module['ns3::AttributeChecker'])
## mac64-address.h (module 'network'): ns3::Mac64AddressValue [class]
module.add_class('Mac64AddressValue', parent=root_module['ns3::AttributeValue'])
## basic-data-calculators.h (module 'stats'): ns3::MinMaxAvgTotalCalculator<unsigned int> [class]
module.add_class('MinMaxAvgTotalCalculator', import_from_module='ns.stats', template_parameters=['unsigned int'], parent=[root_module['ns3::DataCalculator'], root_module['ns3::StatisticalSummary']])
## net-device.h (module 'network'): ns3::NetDevice [class]
module.add_class('NetDevice', 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'])
typehandlers.add_type_alias(u'void ( * ) ( )', u'ns3::NetDevice::LinkChangeTracedCallback')
typehandlers.add_type_alias(u'void ( * ) ( )*', u'ns3::NetDevice::LinkChangeTracedCallback*')
typehandlers.add_type_alias(u'void ( * ) ( )&', u'ns3::NetDevice::LinkChangeTracedCallback&')
typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::NetDevice::ReceiveCallback')
typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::NetDevice::ReceiveCallback*')
typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::NetDevice::ReceiveCallback&')
typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', u'ns3::NetDevice::PromiscReceiveCallback')
typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::NetDevice::PromiscReceiveCallback*')
typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::NetDevice::PromiscReceiveCallback&')
## net-device-queue-interface.h (module 'network'): ns3::NetDeviceQueue [class]
module.add_class('NetDeviceQueue', parent=root_module['ns3::SimpleRefCount< ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter<ns3::NetDeviceQueue> >'])
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::NetDeviceQueue::WakeCallback')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::NetDeviceQueue::WakeCallback*')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::NetDeviceQueue::WakeCallback&')
## net-device-queue-interface.h (module 'network'): ns3::NetDeviceQueueInterface [class]
module.add_class('NetDeviceQueueInterface', parent=root_module['ns3::Object'])
typehandlers.add_type_alias(u'std::function< unsigned long long ( ns3::Ptr< ns3::QueueItem > ) >', u'ns3::NetDeviceQueueInterface::SelectQueueCallback')
typehandlers.add_type_alias(u'std::function< unsigned long long ( ns3::Ptr< ns3::QueueItem > ) >*', u'ns3::NetDeviceQueueInterface::SelectQueueCallback*')
typehandlers.add_type_alias(u'std::function< unsigned long long ( ns3::Ptr< ns3::QueueItem > ) >&', u'ns3::NetDeviceQueueInterface::SelectQueueCallback&')
## nix-vector.h (module 'network'): ns3::NixVector [class]
module.add_class('NixVector', parent=root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >'])
## node.h (module 'network'): ns3::Node [class]
module.add_class('Node', parent=root_module['ns3::Object'])
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', u'ns3::Node::ProtocolHandler')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::Node::ProtocolHandler*')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::Node::ProtocolHandler&')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::Node::DeviceAdditionListener')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::Node::DeviceAdditionListener*')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::Node::DeviceAdditionListener&')
## 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'])
## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper [class]
module.add_class('OutputStreamWrapper', parent=root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >'])
## packet.h (module 'network'): ns3::Packet [class]
module.add_class('Packet', parent=root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >'])
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const > )', u'ns3::Packet::TracedCallback')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const > )*', u'ns3::Packet::TracedCallback*')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const > )&', u'ns3::Packet::TracedCallback&')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const >, ns3::Address const & )', u'ns3::Packet::AddressTracedCallback')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const >, ns3::Address const & )*', u'ns3::Packet::AddressTracedCallback*')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const >, ns3::Address const & )&', u'ns3::Packet::AddressTracedCallback&')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const > const, ns3::Address const &, ns3::Address const & )', u'ns3::Packet::TwoAddressTracedCallback')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const > const, ns3::Address const &, ns3::Address const & )*', u'ns3::Packet::TwoAddressTracedCallback*')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const > const, ns3::Address const &, ns3::Address const & )&', u'ns3::Packet::TwoAddressTracedCallback&')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const >, ns3::Mac48Address )', u'ns3::Packet::Mac48AddressTracedCallback')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const >, ns3::Mac48Address )*', u'ns3::Packet::Mac48AddressTracedCallback*')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const >, ns3::Mac48Address )&', u'ns3::Packet::Mac48AddressTracedCallback&')
typehandlers.add_type_alias(u'void ( * ) ( uint32_t, uint32_t )', u'ns3::Packet::SizeTracedCallback')
typehandlers.add_type_alias(u'void ( * ) ( uint32_t, uint32_t )*', u'ns3::Packet::SizeTracedCallback*')
typehandlers.add_type_alias(u'void ( * ) ( uint32_t, uint32_t )&', u'ns3::Packet::SizeTracedCallback&')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const >, double )', u'ns3::Packet::SinrTracedCallback')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const >, double )*', u'ns3::Packet::SinrTracedCallback*')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::Packet const >, double )&', u'ns3::Packet::SinrTracedCallback&')
## packet-data-calculators.h (module 'network'): ns3::PacketSizeMinMaxAvgTotalCalculator [class]
module.add_class('PacketSizeMinMaxAvgTotalCalculator', parent=root_module['ns3::MinMaxAvgTotalCalculator< unsigned int >'])
## packet-socket.h (module 'network'): ns3::PacketSocket [class]
module.add_class('PacketSocket', parent=root_module['ns3::Socket'])
## packet-socket-client.h (module 'network'): ns3::PacketSocketClient [class]
module.add_class('PacketSocketClient', parent=root_module['ns3::Application'])
## packet-socket-factory.h (module 'network'): ns3::PacketSocketFactory [class]
module.add_class('PacketSocketFactory', parent=root_module['ns3::SocketFactory'])
## packet-socket-server.h (module 'network'): ns3::PacketSocketServer [class]
module.add_class('PacketSocketServer', parent=root_module['ns3::Application'])
## random-variable-stream.h (module 'core'): ns3::ParetoRandomVariable [class]
module.add_class('ParetoRandomVariable', import_from_module='ns.core', parent=root_module['ns3::RandomVariableStream'])
## packetbb.h (module 'network'): ns3::PbbAddressBlock [class]
module.add_class('PbbAddressBlock', parent=root_module['ns3::SimpleRefCount< ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> >'])
typehandlers.add_type_alias(u'std::list< ns3::Address > iterator', u'ns3::PbbAddressBlock::AddressIterator')
typehandlers.add_type_alias(u'std::list< ns3::Address > iterator*', u'ns3::PbbAddressBlock::AddressIterator*')
typehandlers.add_type_alias(u'std::list< ns3::Address > iterator&', u'ns3::PbbAddressBlock::AddressIterator&')
typehandlers.add_type_alias(u'std::list< ns3::Address > const_iterator', u'ns3::PbbAddressBlock::ConstAddressIterator')
typehandlers.add_type_alias(u'std::list< ns3::Address > const_iterator*', u'ns3::PbbAddressBlock::ConstAddressIterator*')
typehandlers.add_type_alias(u'std::list< ns3::Address > const_iterator&', u'ns3::PbbAddressBlock::ConstAddressIterator&')
typehandlers.add_type_alias(u'std::list< unsigned char > iterator', u'ns3::PbbAddressBlock::PrefixIterator')
typehandlers.add_type_alias(u'std::list< unsigned char > iterator*', u'ns3::PbbAddressBlock::PrefixIterator*')
typehandlers.add_type_alias(u'std::list< unsigned char > iterator&', u'ns3::PbbAddressBlock::PrefixIterator&')
typehandlers.add_type_alias(u'std::list< unsigned char > const_iterator', u'ns3::PbbAddressBlock::ConstPrefixIterator')
typehandlers.add_type_alias(u'std::list< unsigned char > const_iterator*', u'ns3::PbbAddressBlock::ConstPrefixIterator*')
typehandlers.add_type_alias(u'std::list< unsigned char > const_iterator&', u'ns3::PbbAddressBlock::ConstPrefixIterator&')
typehandlers.add_type_alias(u'ns3::PbbAddressTlvBlock::Iterator', u'ns3::PbbAddressBlock::TlvIterator')
typehandlers.add_type_alias(u'ns3::PbbAddressTlvBlock::Iterator*', u'ns3::PbbAddressBlock::TlvIterator*')
typehandlers.add_type_alias(u'ns3::PbbAddressTlvBlock::Iterator&', u'ns3::PbbAddressBlock::TlvIterator&')
typehandlers.add_type_alias(u'ns3::PbbAddressTlvBlock::ConstIterator', u'ns3::PbbAddressBlock::ConstTlvIterator')
typehandlers.add_type_alias(u'ns3::PbbAddressTlvBlock::ConstIterator*', u'ns3::PbbAddressBlock::ConstTlvIterator*')
typehandlers.add_type_alias(u'ns3::PbbAddressTlvBlock::ConstIterator&', u'ns3::PbbAddressBlock::ConstTlvIterator&')
## packetbb.h (module 'network'): ns3::PbbAddressBlockIpv4 [class]
module.add_class('PbbAddressBlockIpv4', parent=root_module['ns3::PbbAddressBlock'])
## packetbb.h (module 'network'): ns3::PbbAddressBlockIpv6 [class]
module.add_class('PbbAddressBlockIpv6', parent=root_module['ns3::PbbAddressBlock'])
## packetbb.h (module 'network'): ns3::PbbMessage [class]
module.add_class('PbbMessage', parent=root_module['ns3::SimpleRefCount< ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter<ns3::PbbMessage> >'])
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbTlv > > iterator', u'ns3::PbbMessage::TlvIterator')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbTlv > > iterator*', u'ns3::PbbMessage::TlvIterator*')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbTlv > > iterator&', u'ns3::PbbMessage::TlvIterator&')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbTlv > > const_iterator', u'ns3::PbbMessage::ConstTlvIterator')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbTlv > > const_iterator*', u'ns3::PbbMessage::ConstTlvIterator*')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbTlv > > const_iterator&', u'ns3::PbbMessage::ConstTlvIterator&')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbAddressBlock > > iterator', u'ns3::PbbMessage::AddressBlockIterator')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbAddressBlock > > iterator*', u'ns3::PbbMessage::AddressBlockIterator*')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbAddressBlock > > iterator&', u'ns3::PbbMessage::AddressBlockIterator&')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbAddressBlock > > const_iterator', u'ns3::PbbMessage::ConstAddressBlockIterator')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbAddressBlock > > const_iterator*', u'ns3::PbbMessage::ConstAddressBlockIterator*')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbAddressBlock > > const_iterator&', u'ns3::PbbMessage::ConstAddressBlockIterator&')
## packetbb.h (module 'network'): ns3::PbbMessageIpv4 [class]
module.add_class('PbbMessageIpv4', parent=root_module['ns3::PbbMessage'])
## packetbb.h (module 'network'): ns3::PbbMessageIpv6 [class]
module.add_class('PbbMessageIpv6', parent=root_module['ns3::PbbMessage'])
## packetbb.h (module 'network'): ns3::PbbPacket [class]
module.add_class('PbbPacket', parent=root_module['ns3::SimpleRefCount< ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter<ns3::PbbPacket> >'])
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbTlv > > iterator', u'ns3::PbbPacket::TlvIterator')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbTlv > > iterator*', u'ns3::PbbPacket::TlvIterator*')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbTlv > > iterator&', u'ns3::PbbPacket::TlvIterator&')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbTlv > > const_iterator', u'ns3::PbbPacket::ConstTlvIterator')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbTlv > > const_iterator*', u'ns3::PbbPacket::ConstTlvIterator*')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbTlv > > const_iterator&', u'ns3::PbbPacket::ConstTlvIterator&')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbMessage > > iterator', u'ns3::PbbPacket::MessageIterator')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbMessage > > iterator*', u'ns3::PbbPacket::MessageIterator*')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbMessage > > iterator&', u'ns3::PbbPacket::MessageIterator&')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbMessage > > const_iterator', u'ns3::PbbPacket::ConstMessageIterator')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbMessage > > const_iterator*', u'ns3::PbbPacket::ConstMessageIterator*')
typehandlers.add_type_alias(u'std::list< ns3::Ptr< ns3::PbbMessage > > const_iterator&', u'ns3::PbbPacket::ConstMessageIterator&')
## packetbb.h (module 'network'): ns3::PbbTlv [class]
module.add_class('PbbTlv', parent=root_module['ns3::SimpleRefCount< ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter<ns3::PbbTlv> >'])
## probe.h (module 'stats'): ns3::Probe [class]
module.add_class('Probe', import_from_module='ns.stats', parent=root_module['ns3::DataCollectionObject'])
## queue.h (module 'network'): ns3::Queue<ns3::Packet> [class]
module.add_class('Queue', template_parameters=['ns3::Packet'], parent=root_module['ns3::QueueBase'])
typehandlers.add_type_alias(u'ns3::Packet', u'ns3::Queue< ns3::Packet > ItemType')
typehandlers.add_type_alias(u'ns3::Packet*', u'ns3::Queue< ns3::Packet > ItemType*')
typehandlers.add_type_alias(u'ns3::Packet&', u'ns3::Queue< ns3::Packet > ItemType&')
module.add_typedef(root_module['ns3::Packet'], 'ItemType')
## queue.h (module 'network'): ns3::Queue<ns3::QueueDiscItem> [class]
module.add_class('Queue', template_parameters=['ns3::QueueDiscItem'], parent=root_module['ns3::QueueBase'])
typehandlers.add_type_alias(u'ns3::QueueDiscItem', u'ns3::Queue< ns3::QueueDiscItem > ItemType')
typehandlers.add_type_alias(u'ns3::QueueDiscItem*', u'ns3::Queue< ns3::QueueDiscItem > ItemType*')
typehandlers.add_type_alias(u'ns3::QueueDiscItem&', u'ns3::Queue< ns3::QueueDiscItem > ItemType&')
## queue-item.h (module 'network'): ns3::QueueItem [class]
module.add_class('QueueItem', parent=root_module['ns3::SimpleRefCount< ns3::QueueItem, ns3::empty, ns3::DefaultDeleter<ns3::QueueItem> >'])
## queue-item.h (module 'network'): ns3::QueueItem::Uint8Values [enumeration]
module.add_enum('Uint8Values', ['IP_DSFIELD'], outer_class=root_module['ns3::QueueItem'])
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::QueueItem const > )', u'ns3::QueueItem::TracedCallback')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::QueueItem const > )*', u'ns3::QueueItem::TracedCallback*')
typehandlers.add_type_alias(u'void ( * ) ( ns3::Ptr< ns3::QueueItem const > )&', u'ns3::QueueItem::TracedCallback&')
## queue-size.h (module 'network'): ns3::QueueSizeChecker [class]
module.add_class('QueueSizeChecker', parent=root_module['ns3::AttributeChecker'])
## queue-size.h (module 'network'): ns3::QueueSizeValue [class]
module.add_class('QueueSizeValue', parent=root_module['ns3::AttributeValue'])
## error-model.h (module 'network'): ns3::RateErrorModel [class]
module.add_class('RateErrorModel', parent=root_module['ns3::ErrorModel'])
## error-model.h (module 'network'): ns3::RateErrorModel::ErrorUnit [enumeration]
module.add_enum('ErrorUnit', ['ERROR_UNIT_BIT', 'ERROR_UNIT_BYTE', 'ERROR_UNIT_PACKET'], outer_class=root_module['ns3::RateErrorModel'])
## error-model.h (module 'network'): ns3::ReceiveListErrorModel [class]
module.add_class('ReceiveListErrorModel', parent=root_module['ns3::ErrorModel'])
## simple-channel.h (module 'network'): ns3::SimpleChannel [class]
module.add_class('SimpleChannel', parent=root_module['ns3::Channel'])
## simple-net-device.h (module 'network'): ns3::SimpleNetDevice [class]
module.add_class('SimpleNetDevice', parent=root_module['ns3::NetDevice'])
## 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'])
## uinteger.h (module 'core'): ns3::UintegerValue [class]
module.add_class('UintegerValue', import_from_module='ns.core', parent=root_module['ns3::AttributeValue'])
## address.h (module 'network'): ns3::AddressChecker [class]
module.add_class('AddressChecker', parent=root_module['ns3::AttributeChecker'])
## address.h (module 'network'): ns3::AddressValue [class]
module.add_class('AddressValue', parent=root_module['ns3::AttributeValue'])
## error-model.h (module 'network'): ns3::BinaryErrorModel [class]
module.add_class('BinaryErrorModel', parent=root_module['ns3::ErrorModel'])
## error-model.h (module 'network'): ns3::BurstErrorModel [class]
module.add_class('BurstErrorModel', parent=root_module['ns3::ErrorModel'])
## callback.h (module 'core'): ns3::CallbackImpl<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', template_parameters=['bool', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<const ns3::Packet>', 'unsigned short', 'const ns3::Address &', 'const ns3::Address &', 'ns3::NetDevice::PacketType', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## callback.h (module 'core'): ns3::CallbackImpl<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', import_from_module='ns.core', template_parameters=['bool', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<const ns3::Packet>', 'unsigned short', 'const ns3::Address &', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## callback.h (module 'core'): ns3::CallbackImpl<bool, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', import_from_module='ns.core', template_parameters=['bool', 'ns3::Ptr<ns3::Socket>', 'const ns3::Address &', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## callback.h (module 'core'): ns3::CallbackImpl<ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', import_from_module='ns.core', template_parameters=['ns3::ObjectBase *', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<const ns3::Packet>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', import_from_module='ns.core', template_parameters=['void', 'ns3::Ptr<const ns3::Packet>', 'const ns3::Address &', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<const ns3::Packet>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', import_from_module='ns.core', template_parameters=['void', 'ns3::Ptr<const ns3::Packet>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<const ns3::QueueDiscItem>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', import_from_module='ns.core', template_parameters=['void', 'ns3::Ptr<const ns3::QueueDiscItem>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', template_parameters=['void', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<const ns3::Packet>', 'unsigned short', 'const ns3::Address &', 'const ns3::Address &', 'ns3::NetDevice::PacketType', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', import_from_module='ns.core', template_parameters=['void', 'ns3::Ptr<ns3::NetDevice>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', import_from_module='ns.core', template_parameters=['void', 'ns3::Ptr<ns3::Socket>', 'const ns3::Address &', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', import_from_module='ns.core', template_parameters=['void', 'ns3::Ptr<ns3::Socket>', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', import_from_module='ns.core', template_parameters=['void', 'ns3::Ptr<ns3::Socket>', 'unsigned int', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', import_from_module='ns.core', template_parameters=['void', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## callback.h (module 'core'): ns3::CallbackImpl<void, unsigned int, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> [class]
module.add_class('CallbackImpl', import_from_module='ns.core', template_parameters=['void', 'unsigned int', 'unsigned int', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'], parent=root_module['ns3::CallbackImplBase'])
## basic-data-calculators.h (module 'stats'): ns3::CounterCalculator<unsigned int> [class]
module.add_class('CounterCalculator', import_from_module='ns.stats', template_parameters=['unsigned int'], parent=root_module['ns3::DataCalculator'])
## drop-tail-queue.h (module 'network'): ns3::DropTailQueue<ns3::Packet> [class]
module.add_class('DropTailQueue', template_parameters=['ns3::Packet'], parent=root_module['ns3::Queue< ns3::Packet >'])
## drop-tail-queue.h (module 'network'): ns3::DropTailQueue<ns3::QueueDiscItem> [class]
module.add_class('DropTailQueue', template_parameters=['ns3::QueueDiscItem'], parent=root_module['ns3::Queue< ns3::QueueDiscItem >'])
## error-channel.h (module 'network'): ns3::ErrorChannel [class]
module.add_class('ErrorChannel', parent=root_module['ns3::SimpleChannel'])
## packet-data-calculators.h (module 'network'): ns3::PacketCounterCalculator [class]
module.add_class('PacketCounterCalculator', parent=root_module['ns3::CounterCalculator< unsigned int >'])
## packet-probe.h (module 'network'): ns3::PacketProbe [class]
module.add_class('PacketProbe', parent=root_module['ns3::Probe'])
## packetbb.h (module 'network'): ns3::PbbAddressTlv [class]
module.add_class('PbbAddressTlv', parent=root_module['ns3::PbbTlv'])
## queue-item.h (module 'network'): ns3::QueueDiscItem [class]
module.add_class('QueueDiscItem', parent=root_module['ns3::QueueItem'])
module.add_container('std::map< std::string, ns3::LogComponent * >', ('std::string', 'ns3::LogComponent *'), container_type=u'map')
module.add_container('std::list< ns3::Ptr< ns3::Packet > >', 'ns3::Ptr< ns3::Packet >', container_type=u'list')
module.add_container('std::vector< ns3::Ipv6Address >', 'ns3::Ipv6Address', container_type=u'vector')
module.add_container('std::list< unsigned int >', 'unsigned int', container_type=u'list')
typehandlers.add_type_alias(u'ns3::SequenceNumber< unsigned int, int >', u'ns3::SequenceNumber32')
typehandlers.add_type_alias(u'ns3::SequenceNumber< unsigned int, int >*', u'ns3::SequenceNumber32*')
typehandlers.add_type_alias(u'ns3::SequenceNumber< unsigned int, int >&', u'ns3::SequenceNumber32&')
typehandlers.add_type_alias(u'ns3::SequenceNumber< unsigned short, short >', u'ns3::SequenceNumber16')
typehandlers.add_type_alias(u'ns3::SequenceNumber< unsigned short, short >*', u'ns3::SequenceNumber16*')
typehandlers.add_type_alias(u'ns3::SequenceNumber< unsigned short, short >&', u'ns3::SequenceNumber16&')
typehandlers.add_type_alias(u'ns3::SequenceNumber< unsigned char, signed char >', u'ns3::SequenceNumber8')
typehandlers.add_type_alias(u'ns3::SequenceNumber< unsigned char, signed char >*', u'ns3::SequenceNumber8*')
typehandlers.add_type_alias(u'ns3::SequenceNumber< unsigned char, signed char >&', u'ns3::SequenceNumber8&')
typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::GenericPhyTxStartCallback')
typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::GenericPhyTxStartCallback*')
typehandlers.add_type_alias(u'ns3::Callback< bool, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::GenericPhyTxStartCallback&')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::GenericPhyTxEndCallback')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::GenericPhyTxEndCallback*')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::GenericPhyTxEndCallback&')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::GenericPhyRxStartCallback')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::GenericPhyRxStartCallback*')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::GenericPhyRxStartCallback&')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::GenericPhyRxEndErrorCallback')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::GenericPhyRxEndErrorCallback*')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::GenericPhyRxEndErrorCallback&')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', u'ns3::GenericPhyRxEndOkCallback')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >*', u'ns3::GenericPhyRxEndOkCallback*')
typehandlers.add_type_alias(u'ns3::Callback< void, ns3::Ptr< ns3::Packet >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >&', u'ns3::GenericPhyRxEndOkCallback&')
typehandlers.add_type_alias(u'void ( * ) ( std::ostream & )', u'ns3::TimePrinter')
typehandlers.add_type_alias(u'void ( * ) ( std::ostream & )*', u'ns3::TimePrinter*')
typehandlers.add_type_alias(u'void ( * ) ( std::ostream & )&', u'ns3::TimePrinter&')
typehandlers.add_type_alias(u'void ( * ) ( std::ostream & )', u'ns3::NodePrinter')
typehandlers.add_type_alias(u'void ( * ) ( std::ostream & )*', u'ns3::NodePrinter*')
typehandlers.add_type_alias(u'void ( * ) ( std::ostream & )&', u'ns3::NodePrinter&')
## 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 addressUtils
nested_module = module.add_cpp_namespace('addressUtils')
register_types_ns3_addressUtils(nested_module)
## Register a nested module for the namespace internal
nested_module = module.add_cpp_namespace('internal')
register_types_ns3_internal(nested_module)
## Register a nested module for the namespace tests
nested_module = module.add_cpp_namespace('tests')
register_types_ns3_tests(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<ns3::Hash::Implementation> >'])
typehandlers.add_type_alias(u'uint32_t ( * ) ( char const *, std::size_t const )', u'ns3::Hash::Hash32Function_ptr')
typehandlers.add_type_alias(u'uint32_t ( * ) ( char const *, std::size_t const )*', u'ns3::Hash::Hash32Function_ptr*')
typehandlers.add_type_alias(u'uint32_t ( * ) ( char const *, std::size_t const )&', u'ns3::Hash::Hash32Function_ptr&')
typehandlers.add_type_alias(u'uint64_t ( * ) ( char const *, std::size_t const )', u'ns3::Hash::Hash64Function_ptr')
typehandlers.add_type_alias(u'uint64_t ( * ) ( char const *, std::size_t const )*', u'ns3::Hash::Hash64Function_ptr*')
typehandlers.add_type_alias(u'uint64_t ( * ) ( char const *, std::size_t const )&', 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 ( * ) ( 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 ( * ) ( ns3::SequenceNumber32, ns3::SequenceNumber32 )', u'ns3::TracedValueCallback::SequenceNumber32')
typehandlers.add_type_alias(u'void ( * ) ( ns3::SequenceNumber32, ns3::SequenceNumber32 )*', u'ns3::TracedValueCallback::SequenceNumber32*')
typehandlers.add_type_alias(u'void ( * ) ( ns3::SequenceNumber32, ns3::SequenceNumber32 )&', u'ns3::TracedValueCallback::SequenceNumber32&')
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 ( * ) ( 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 ( * ) ( 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 ( * ) ( 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&')
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 ( * ) ( 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 ( * ) ( 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 ( * ) ( )', u'ns3::TracedValueCallback::Void')
typehandlers.add_type_alias(u'void ( * ) ( )*', u'ns3::TracedValueCallback::Void*')
typehandlers.add_type_alias(u'void ( * ) ( )&', u'ns3::TracedValueCallback::Void&')
def register_types_ns3_addressUtils(module):
root_module = module.get_root()
def register_types_ns3_internal(module):
root_module = module.get_root()
def register_types_ns3_tests(module):
root_module = module.get_root()
def register_methods(root_module):
register_Ns3Address_methods(root_module, root_module['ns3::Address'])
register_Ns3ApplicationContainer_methods(root_module, root_module['ns3::ApplicationContainer'])
register_Ns3AsciiFile_methods(root_module, root_module['ns3::AsciiFile'])
register_Ns3AsciiTraceHelper_methods(root_module, root_module['ns3::AsciiTraceHelper'])
register_Ns3AsciiTraceHelperForDevice_methods(root_module, root_module['ns3::AsciiTraceHelperForDevice'])
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_Ns3ChannelList_methods(root_module, root_module['ns3::ChannelList'])
register_Ns3DataOutputCallback_methods(root_module, root_module['ns3::DataOutputCallback'])
register_Ns3DataRate_methods(root_module, root_module['ns3::DataRate'])
register_Ns3DefaultDeleter__Ns3AttributeAccessor_methods(root_module, root_module['ns3::DefaultDeleter< ns3::AttributeAccessor >'])
register_Ns3DefaultDeleter__Ns3AttributeChecker_methods(root_module, root_module['ns3::DefaultDeleter< ns3::AttributeChecker >'])
register_Ns3DefaultDeleter__Ns3AttributeValue_methods(root_module, root_module['ns3::DefaultDeleter< ns3::AttributeValue >'])
register_Ns3DefaultDeleter__Ns3CallbackImplBase_methods(root_module, root_module['ns3::DefaultDeleter< ns3::CallbackImplBase >'])
register_Ns3DefaultDeleter__Ns3EventImpl_methods(root_module, root_module['ns3::DefaultDeleter< ns3::EventImpl >'])
register_Ns3DefaultDeleter__Ns3HashImplementation_methods(root_module, root_module['ns3::DefaultDeleter< ns3::Hash::Implementation >'])
register_Ns3DefaultDeleter__Ns3NetDeviceQueue_methods(root_module, root_module['ns3::DefaultDeleter< ns3::NetDeviceQueue >'])
register_Ns3DefaultDeleter__Ns3NixVector_methods(root_module, root_module['ns3::DefaultDeleter< ns3::NixVector >'])
register_Ns3DefaultDeleter__Ns3OutputStreamWrapper_methods(root_module, root_module['ns3::DefaultDeleter< ns3::OutputStreamWrapper >'])
register_Ns3DefaultDeleter__Ns3Packet_methods(root_module, root_module['ns3::DefaultDeleter< ns3::Packet >'])
register_Ns3DefaultDeleter__Ns3PbbAddressBlock_methods(root_module, root_module['ns3::DefaultDeleter< ns3::PbbAddressBlock >'])
register_Ns3DefaultDeleter__Ns3PbbMessage_methods(root_module, root_module['ns3::DefaultDeleter< ns3::PbbMessage >'])
register_Ns3DefaultDeleter__Ns3PbbTlv_methods(root_module, root_module['ns3::DefaultDeleter< ns3::PbbTlv >'])
register_Ns3DefaultDeleter__Ns3QueueItem_methods(root_module, root_module['ns3::DefaultDeleter< ns3::QueueItem >'])
register_Ns3DefaultDeleter__Ns3TraceSourceAccessor_methods(root_module, root_module['ns3::DefaultDeleter< ns3::TraceSourceAccessor >'])
register_Ns3DelayJitterEstimation_methods(root_module, root_module['ns3::DelayJitterEstimation'])
register_Ns3EventId_methods(root_module, root_module['ns3::EventId'])
register_Ns3Hasher_methods(root_module, root_module['ns3::Hasher'])
register_Ns3Inet6SocketAddress_methods(root_module, root_module['ns3::Inet6SocketAddress'])
register_Ns3InetSocketAddress_methods(root_module, root_module['ns3::InetSocketAddress'])
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_Ns3LogComponent_methods(root_module, root_module['ns3::LogComponent'])
register_Ns3Mac16Address_methods(root_module, root_module['ns3::Mac16Address'])
register_Ns3Mac48Address_methods(root_module, root_module['ns3::Mac48Address'])
register_Ns3Mac64Address_methods(root_module, root_module['ns3::Mac64Address'])
register_Ns3Mac8Address_methods(root_module, root_module['ns3::Mac8Address'])
register_Ns3NetDeviceContainer_methods(root_module, root_module['ns3::NetDeviceContainer'])
register_Ns3NodeContainer_methods(root_module, root_module['ns3::NodeContainer'])
register_Ns3NodeList_methods(root_module, root_module['ns3::NodeList'])
register_Ns3NonCopyable_methods(root_module, root_module['ns3::NonCopyable'])
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_Ns3PacketSocketAddress_methods(root_module, root_module['ns3::PacketSocketAddress'])
register_Ns3PacketSocketHelper_methods(root_module, root_module['ns3::PacketSocketHelper'])
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_Ns3ParameterLogger_methods(root_module, root_module['ns3::ParameterLogger'])
register_Ns3PbbAddressTlvBlock_methods(root_module, root_module['ns3::PbbAddressTlvBlock'])
register_Ns3PbbTlvBlock_methods(root_module, root_module['ns3::PbbTlvBlock'])
register_Ns3PcapFile_methods(root_module, root_module['ns3::PcapFile'])
register_Ns3PcapHelper_methods(root_module, root_module['ns3::PcapHelper'])
register_Ns3PcapHelperForDevice_methods(root_module, root_module['ns3::PcapHelperForDevice'])
register_Ns3QueueSize_methods(root_module, root_module['ns3::QueueSize'])
register_Ns3SequenceNumber32_methods(root_module, root_module['ns3::SequenceNumber32'])
register_Ns3SequenceNumber16_methods(root_module, root_module['ns3::SequenceNumber16'])
register_Ns3SimpleNetDeviceHelper_methods(root_module, root_module['ns3::SimpleNetDeviceHelper'])
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_Ns3StatisticalSummary_methods(root_module, root_module['ns3::StatisticalSummary'])
register_Ns3SystemWallClockMs_methods(root_module, root_module['ns3::SystemWallClockMs'])
register_Ns3Tag_methods(root_module, root_module['ns3::Tag'])
register_Ns3TagBuffer_methods(root_module, root_module['ns3::TagBuffer'])
register_Ns3TimeWithUnit_methods(root_module, root_module['ns3::TimeWithUnit'])
register_Ns3TracedValue__Unsigned_int_methods(root_module, root_module['ns3::TracedValue< unsigned int >'])
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_Ns3Empty_methods(root_module, root_module['ns3::empty'])
register_Ns3Int64x64_t_methods(root_module, root_module['ns3::int64x64_t'])
register_Ns3Chunk_methods(root_module, root_module['ns3::Chunk'])
register_Ns3DeviceNameTag_methods(root_module, root_module['ns3::DeviceNameTag'])
register_Ns3FlowIdTag_methods(root_module, root_module['ns3::FlowIdTag'])
register_Ns3Header_methods(root_module, root_module['ns3::Header'])
register_Ns3LlcSnapHeader_methods(root_module, root_module['ns3::LlcSnapHeader'])
register_Ns3Object_methods(root_module, root_module['ns3::Object'])
register_Ns3ObjectAggregateIterator_methods(root_module, root_module['ns3::Object::AggregateIterator'])
register_Ns3PacketBurst_methods(root_module, root_module['ns3::PacketBurst'])
register_Ns3PacketSocketTag_methods(root_module, root_module['ns3::PacketSocketTag'])
register_Ns3PcapFileWrapper_methods(root_module, root_module['ns3::PcapFileWrapper'])
register_Ns3QueueBase_methods(root_module, root_module['ns3::QueueBase'])
register_Ns3QueueLimits_methods(root_module, root_module['ns3::QueueLimits'])
register_Ns3RadiotapHeader_methods(root_module, root_module['ns3::RadiotapHeader'])
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<ns3::AttributeAccessor> >'])
register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >'])
register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >'])
register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >'])
register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >'])
register_Ns3SimpleRefCount__Ns3HashImplementation_Ns3Empty_Ns3DefaultDeleter__lt__ns3HashImplementation__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> >'])
register_Ns3SimpleRefCount__Ns3NetDeviceQueue_Ns3Empty_Ns3DefaultDeleter__lt__ns3NetDeviceQueue__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter<ns3::NetDeviceQueue> >'])
register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >'])
register_Ns3SimpleRefCount__Ns3OutputStreamWrapper_Ns3Empty_Ns3DefaultDeleter__lt__ns3OutputStreamWrapper__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >'])
register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >'])
register_Ns3SimpleRefCount__Ns3PbbAddressBlock_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbAddressBlock__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> >'])
register_Ns3SimpleRefCount__Ns3PbbMessage_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbMessage__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter<ns3::PbbMessage> >'])
register_Ns3SimpleRefCount__Ns3PbbPacket_Ns3Header_Ns3DefaultDeleter__lt__ns3PbbPacket__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter<ns3::PbbPacket> >'])
register_Ns3SimpleRefCount__Ns3PbbTlv_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbTlv__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter<ns3::PbbTlv> >'])
register_Ns3SimpleRefCount__Ns3QueueItem_Ns3Empty_Ns3DefaultDeleter__lt__ns3QueueItem__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::QueueItem, ns3::empty, ns3::DefaultDeleter<ns3::QueueItem> >'])
register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, root_module['ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >'])
register_Ns3SllHeader_methods(root_module, root_module['ns3::SllHeader'])
register_Ns3Socket_methods(root_module, root_module['ns3::Socket'])
register_Ns3SocketFactory_methods(root_module, root_module['ns3::SocketFactory'])
register_Ns3SocketIpTosTag_methods(root_module, root_module['ns3::SocketIpTosTag'])
register_Ns3SocketIpTtlTag_methods(root_module, root_module['ns3::SocketIpTtlTag'])
register_Ns3SocketIpv6HopLimitTag_methods(root_module, root_module['ns3::SocketIpv6HopLimitTag'])
register_Ns3SocketIpv6TclassTag_methods(root_module, root_module['ns3::SocketIpv6TclassTag'])
register_Ns3SocketPriorityTag_methods(root_module, root_module['ns3::SocketPriorityTag'])
register_Ns3SocketSetDontFragmentTag_methods(root_module, root_module['ns3::SocketSetDontFragmentTag'])
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_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_Ns3Application_methods(root_module, root_module['ns3::Application'])
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_Ns3DataCalculator_methods(root_module, root_module['ns3::DataCalculator'])
register_Ns3DataCollectionObject_methods(root_module, root_module['ns3::DataCollectionObject'])
register_Ns3DataOutputInterface_methods(root_module, root_module['ns3::DataOutputInterface'])
register_Ns3DataRateChecker_methods(root_module, root_module['ns3::DataRateChecker'])
register_Ns3DataRateValue_methods(root_module, root_module['ns3::DataRateValue'])
register_Ns3DeterministicRandomVariable_methods(root_module, root_module['ns3::DeterministicRandomVariable'])
register_Ns3DoubleValue_methods(root_module, root_module['ns3::DoubleValue'])
register_Ns3DynamicQueueLimits_methods(root_module, root_module['ns3::DynamicQueueLimits'])
register_Ns3EmpiricalRandomVariable_methods(root_module, root_module['ns3::EmpiricalRandomVariable'])
register_Ns3EmptyAttributeAccessor_methods(root_module, root_module['ns3::EmptyAttributeAccessor'])
register_Ns3EmptyAttributeChecker_methods(root_module, root_module['ns3::EmptyAttributeChecker'])
register_Ns3EmptyAttributeValue_methods(root_module, root_module['ns3::EmptyAttributeValue'])
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_Ns3ErrorModel_methods(root_module, root_module['ns3::ErrorModel'])
register_Ns3EthernetHeader_methods(root_module, root_module['ns3::EthernetHeader'])
register_Ns3EthernetTrailer_methods(root_module, root_module['ns3::EthernetTrailer'])
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_Ns3ListErrorModel_methods(root_module, root_module['ns3::ListErrorModel'])
register_Ns3LogNormalRandomVariable_methods(root_module, root_module['ns3::LogNormalRandomVariable'])
register_Ns3Mac16AddressChecker_methods(root_module, root_module['ns3::Mac16AddressChecker'])
register_Ns3Mac16AddressValue_methods(root_module, root_module['ns3::Mac16AddressValue'])
register_Ns3Mac48AddressChecker_methods(root_module, root_module['ns3::Mac48AddressChecker'])
register_Ns3Mac48AddressValue_methods(root_module, root_module['ns3::Mac48AddressValue'])
register_Ns3Mac64AddressChecker_methods(root_module, root_module['ns3::Mac64AddressChecker'])
register_Ns3Mac64AddressValue_methods(root_module, root_module['ns3::Mac64AddressValue'])
register_Ns3MinMaxAvgTotalCalculator__Unsigned_int_methods(root_module, root_module['ns3::MinMaxAvgTotalCalculator< unsigned int >'])
register_Ns3NetDevice_methods(root_module, root_module['ns3::NetDevice'])
register_Ns3NetDeviceQueue_methods(root_module, root_module['ns3::NetDeviceQueue'])
register_Ns3NetDeviceQueueInterface_methods(root_module, root_module['ns3::NetDeviceQueueInterface'])
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_Ns3OutputStreamWrapper_methods(root_module, root_module['ns3::OutputStreamWrapper'])
register_Ns3Packet_methods(root_module, root_module['ns3::Packet'])
register_Ns3PacketSizeMinMaxAvgTotalCalculator_methods(root_module, root_module['ns3::PacketSizeMinMaxAvgTotalCalculator'])
register_Ns3PacketSocket_methods(root_module, root_module['ns3::PacketSocket'])
register_Ns3PacketSocketClient_methods(root_module, root_module['ns3::PacketSocketClient'])
register_Ns3PacketSocketFactory_methods(root_module, root_module['ns3::PacketSocketFactory'])
register_Ns3PacketSocketServer_methods(root_module, root_module['ns3::PacketSocketServer'])
register_Ns3ParetoRandomVariable_methods(root_module, root_module['ns3::ParetoRandomVariable'])
register_Ns3PbbAddressBlock_methods(root_module, root_module['ns3::PbbAddressBlock'])
register_Ns3PbbAddressBlockIpv4_methods(root_module, root_module['ns3::PbbAddressBlockIpv4'])
register_Ns3PbbAddressBlockIpv6_methods(root_module, root_module['ns3::PbbAddressBlockIpv6'])
register_Ns3PbbMessage_methods(root_module, root_module['ns3::PbbMessage'])
register_Ns3PbbMessageIpv4_methods(root_module, root_module['ns3::PbbMessageIpv4'])
register_Ns3PbbMessageIpv6_methods(root_module, root_module['ns3::PbbMessageIpv6'])
register_Ns3PbbPacket_methods(root_module, root_module['ns3::PbbPacket'])
register_Ns3PbbTlv_methods(root_module, root_module['ns3::PbbTlv'])
register_Ns3Probe_methods(root_module, root_module['ns3::Probe'])
register_Ns3Queue__Ns3Packet_methods(root_module, root_module['ns3::Queue< ns3::Packet >'])
register_Ns3Queue__Ns3QueueDiscItem_methods(root_module, root_module['ns3::Queue< ns3::QueueDiscItem >'])
register_Ns3QueueItem_methods(root_module, root_module['ns3::QueueItem'])
register_Ns3QueueSizeChecker_methods(root_module, root_module['ns3::QueueSizeChecker'])
register_Ns3QueueSizeValue_methods(root_module, root_module['ns3::QueueSizeValue'])
register_Ns3RateErrorModel_methods(root_module, root_module['ns3::RateErrorModel'])
register_Ns3ReceiveListErrorModel_methods(root_module, root_module['ns3::ReceiveListErrorModel'])
register_Ns3SimpleChannel_methods(root_module, root_module['ns3::SimpleChannel'])
register_Ns3SimpleNetDevice_methods(root_module, root_module['ns3::SimpleNetDevice'])
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_Ns3UintegerValue_methods(root_module, root_module['ns3::UintegerValue'])
register_Ns3AddressChecker_methods(root_module, root_module['ns3::AddressChecker'])
register_Ns3AddressValue_methods(root_module, root_module['ns3::AddressValue'])
register_Ns3BinaryErrorModel_methods(root_module, root_module['ns3::BinaryErrorModel'])
register_Ns3BurstErrorModel_methods(root_module, root_module['ns3::BurstErrorModel'])
register_Ns3CallbackImpl__Bool_Ns3Ptr__lt__ns3NetDevice__gt___Ns3Ptr__lt__const_ns3Packet__gt___Unsigned_short_Const_ns3Address___amp___Const_ns3Address___amp___Ns3NetDevicePacketType_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Bool_Ns3Ptr__lt__ns3NetDevice__gt___Ns3Ptr__lt__const_ns3Packet__gt___Unsigned_short_Const_ns3Address___amp___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Bool_Ns3Ptr__lt__ns3Socket__gt___Const_ns3Address___amp___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< bool, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Ns3ObjectBase___star___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Void_Ns3Ptr__lt__const_ns3Packet__gt___Const_ns3Address___amp___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< void, ns3::Ptr<const ns3::Packet>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Void_Ns3Ptr__lt__const_ns3Packet__gt___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< void, ns3::Ptr<const ns3::Packet>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Void_Ns3Ptr__lt__const_ns3QueueDiscItem__gt___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< void, ns3::Ptr<const ns3::QueueDiscItem>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Void_Ns3Ptr__lt__ns3NetDevice__gt___Ns3Ptr__lt__const_ns3Packet__gt___Unsigned_short_Const_ns3Address___amp___Const_ns3Address___amp___Ns3NetDevicePacketType_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Void_Ns3Ptr__lt__ns3NetDevice__gt___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< void, ns3::Ptr<ns3::NetDevice>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Void_Ns3Ptr__lt__ns3Socket__gt___Const_ns3Address___amp___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< void, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Void_Ns3Ptr__lt__ns3Socket__gt___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Void_Ns3Ptr__lt__ns3Socket__gt___Unsigned_int_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Void_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CallbackImpl__Void_Unsigned_int_Unsigned_int_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, root_module['ns3::CallbackImpl< void, unsigned int, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >'])
register_Ns3CounterCalculator__Unsigned_int_methods(root_module, root_module['ns3::CounterCalculator< unsigned int >'])
register_Ns3DropTailQueue__Ns3Packet_methods(root_module, root_module['ns3::DropTailQueue< ns3::Packet >'])
register_Ns3DropTailQueue__Ns3QueueDiscItem_methods(root_module, root_module['ns3::DropTailQueue< ns3::QueueDiscItem >'])
register_Ns3ErrorChannel_methods(root_module, root_module['ns3::ErrorChannel'])
register_Ns3PacketCounterCalculator_methods(root_module, root_module['ns3::PacketCounterCalculator'])
register_Ns3PacketProbe_methods(root_module, root_module['ns3::PacketProbe'])
register_Ns3PbbAddressTlv_methods(root_module, root_module['ns3::PbbAddressTlv'])
register_Ns3QueueDiscItem_methods(root_module, root_module['ns3::QueueDiscItem'])
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_binary_comparison_operator('<')
cls.add_output_stream_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) [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_Ns3ApplicationContainer_methods(root_module, cls):
## application-container.h (module 'network'): ns3::ApplicationContainer::ApplicationContainer(ns3::ApplicationContainer const & arg0) [constructor]
cls.add_constructor([param('ns3::ApplicationContainer const &', 'arg0')])
## application-container.h (module 'network'): ns3::ApplicationContainer::ApplicationContainer() [constructor]
cls.add_constructor([])
## application-container.h (module 'network'): ns3::ApplicationContainer::ApplicationContainer(ns3::Ptr<ns3::Application> application) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Application >', 'application')])
## application-container.h (module 'network'): ns3::ApplicationContainer::ApplicationContainer(std::string name) [constructor]
cls.add_constructor([param('std::string', 'name')])
## application-container.h (module 'network'): void ns3::ApplicationContainer::Add(ns3::ApplicationContainer other) [member function]
cls.add_method('Add',
'void',
[param('ns3::ApplicationContainer', 'other')])
## application-container.h (module 'network'): void ns3::ApplicationContainer::Add(ns3::Ptr<ns3::Application> application) [member function]
cls.add_method('Add',
'void',
[param('ns3::Ptr< ns3::Application >', 'application')])
## application-container.h (module 'network'): void ns3::ApplicationContainer::Add(std::string name) [member function]
cls.add_method('Add',
'void',
[param('std::string', 'name')])
## application-container.h (module 'network'): ns3::ApplicationContainer::Iterator ns3::ApplicationContainer::Begin() const [member function]
cls.add_method('Begin',
'ns3::ApplicationContainer::Iterator',
[],
is_const=True)
## application-container.h (module 'network'): ns3::ApplicationContainer::Iterator ns3::ApplicationContainer::End() const [member function]
cls.add_method('End',
'ns3::ApplicationContainer::Iterator',
[],
is_const=True)
## application-container.h (module 'network'): ns3::Ptr<ns3::Application> ns3::ApplicationContainer::Get(uint32_t i) const [member function]
cls.add_method('Get',
'ns3::Ptr< ns3::Application >',
[param('uint32_t', 'i')],
is_const=True)
## application-container.h (module 'network'): uint32_t ns3::ApplicationContainer::GetN() const [member function]
cls.add_method('GetN',
'uint32_t',
[],
is_const=True)
## application-container.h (module 'network'): void ns3::ApplicationContainer::Start(ns3::Time start) [member function]
cls.add_method('Start',
'void',
[param('ns3::Time', 'start')])
## application-container.h (module 'network'): void ns3::ApplicationContainer::StartWithJitter(ns3::Time start, ns3::Ptr<ns3::RandomVariableStream> rv) [member function]
cls.add_method('StartWithJitter',
'void',
[param('ns3::Time', 'start'), param('ns3::Ptr< ns3::RandomVariableStream >', 'rv')])
## application-container.h (module 'network'): void ns3::ApplicationContainer::Stop(ns3::Time stop) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time', 'stop')])
return
def register_Ns3AsciiFile_methods(root_module, cls):
## ascii-file.h (module 'network'): ns3::AsciiFile::AsciiFile() [constructor]
cls.add_constructor([])
## ascii-file.h (module 'network'): bool ns3::AsciiFile::Fail() const [member function]
cls.add_method('Fail',
'bool',
[],
is_const=True)
## ascii-file.h (module 'network'): bool ns3::AsciiFile::Eof() const [member function]
cls.add_method('Eof',
'bool',
[],
is_const=True)
## ascii-file.h (module 'network'): void ns3::AsciiFile::Open(std::string const & filename, std::ios_base::openmode mode) [member function]
cls.add_method('Open',
'void',
[param('std::string const &', 'filename'), param('std::ios_base::openmode', 'mode')])
## ascii-file.h (module 'network'): void ns3::AsciiFile::Close() [member function]
cls.add_method('Close',
'void',
[])
## ascii-file.h (module 'network'): void ns3::AsciiFile::Read(std::string & line) [member function]
cls.add_method('Read',
'void',
[param('std::string &', 'line')])
## ascii-file.h (module 'network'): static bool ns3::AsciiFile::Diff(std::string const & f1, std::string const & f2, uint64_t & lineNumber) [member function]
cls.add_method('Diff',
'bool',
[param('std::string const &', 'f1'), param('std::string const &', 'f2'), param('uint64_t &', 'lineNumber')],
is_static=True)
return
def register_Ns3AsciiTraceHelper_methods(root_module, cls):
## trace-helper.h (module 'network'): ns3::AsciiTraceHelper::AsciiTraceHelper(ns3::AsciiTraceHelper const & arg0) [constructor]
cls.add_constructor([param('ns3::AsciiTraceHelper const &', 'arg0')])
## trace-helper.h (module 'network'): ns3::AsciiTraceHelper::AsciiTraceHelper() [constructor]
cls.add_constructor([])
## trace-helper.h (module 'network'): ns3::Ptr<ns3::OutputStreamWrapper> ns3::AsciiTraceHelper::CreateFileStream(std::string filename, std::ios_base::openmode filemode=std::ios_base::out) [member function]
cls.add_method('CreateFileStream',
'ns3::Ptr< ns3::OutputStreamWrapper >',
[param('std::string', 'filename'), param('std::ios_base::openmode', 'filemode', default_value='std::ios_base::out')])
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultDequeueSinkWithContext(ns3::Ptr<ns3::OutputStreamWrapper> file, std::string context, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('DefaultDequeueSinkWithContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('std::string', 'context'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultDequeueSinkWithoutContext(ns3::Ptr<ns3::OutputStreamWrapper> file, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('DefaultDequeueSinkWithoutContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultDropSinkWithContext(ns3::Ptr<ns3::OutputStreamWrapper> file, std::string context, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('DefaultDropSinkWithContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('std::string', 'context'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultDropSinkWithoutContext(ns3::Ptr<ns3::OutputStreamWrapper> file, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('DefaultDropSinkWithoutContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultEnqueueSinkWithContext(ns3::Ptr<ns3::OutputStreamWrapper> file, std::string context, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('DefaultEnqueueSinkWithContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('std::string', 'context'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultEnqueueSinkWithoutContext(ns3::Ptr<ns3::OutputStreamWrapper> file, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('DefaultEnqueueSinkWithoutContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultReceiveSinkWithContext(ns3::Ptr<ns3::OutputStreamWrapper> file, std::string context, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('DefaultReceiveSinkWithContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('std::string', 'context'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): static void ns3::AsciiTraceHelper::DefaultReceiveSinkWithoutContext(ns3::Ptr<ns3::OutputStreamWrapper> file, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('DefaultReceiveSinkWithoutContext',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'file'), param('ns3::Ptr< ns3::Packet const >', 'p')],
is_static=True)
## trace-helper.h (module 'network'): std::string ns3::AsciiTraceHelper::GetFilenameFromDevice(std::string prefix, ns3::Ptr<ns3::NetDevice> device, bool useObjectNames=true) [member function]
cls.add_method('GetFilenameFromDevice',
'std::string',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'device'), param('bool', 'useObjectNames', default_value='true')])
## trace-helper.h (module 'network'): std::string ns3::AsciiTraceHelper::GetFilenameFromInterfacePair(std::string prefix, ns3::Ptr<ns3::Object> object, uint32_t interface, bool useObjectNames=true) [member function]
cls.add_method('GetFilenameFromInterfacePair',
'std::string',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::Object >', 'object'), param('uint32_t', 'interface'), param('bool', 'useObjectNames', default_value='true')])
return
def register_Ns3AsciiTraceHelperForDevice_methods(root_module, cls):
## trace-helper.h (module 'network'): ns3::AsciiTraceHelperForDevice::AsciiTraceHelperForDevice(ns3::AsciiTraceHelperForDevice const & arg0) [constructor]
cls.add_constructor([param('ns3::AsciiTraceHelperForDevice const &', 'arg0')])
## trace-helper.h (module 'network'): ns3::AsciiTraceHelperForDevice::AsciiTraceHelperForDevice() [constructor]
cls.add_constructor([])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool explicitFilename=false) [member function]
cls.add_method('EnableAscii',
'void',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'explicitFilename', default_value='false')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, ns3::Ptr<ns3::NetDevice> nd) [member function]
cls.add_method('EnableAscii',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('ns3::Ptr< ns3::NetDevice >', 'nd')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, std::string ndName, bool explicitFilename=false) [member function]
cls.add_method('EnableAscii',
'void',
[param('std::string', 'prefix'), param('std::string', 'ndName'), param('bool', 'explicitFilename', default_value='false')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, std::string ndName) [member function]
cls.add_method('EnableAscii',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('std::string', 'ndName')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, ns3::NetDeviceContainer d) [member function]
cls.add_method('EnableAscii',
'void',
[param('std::string', 'prefix'), param('ns3::NetDeviceContainer', 'd')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, ns3::NetDeviceContainer d) [member function]
cls.add_method('EnableAscii',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('ns3::NetDeviceContainer', 'd')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, ns3::NodeContainer n) [member function]
cls.add_method('EnableAscii',
'void',
[param('std::string', 'prefix'), param('ns3::NodeContainer', 'n')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, ns3::NodeContainer n) [member function]
cls.add_method('EnableAscii',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('ns3::NodeContainer', 'n')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(std::string prefix, uint32_t nodeid, uint32_t deviceid, bool explicitFilename) [member function]
cls.add_method('EnableAscii',
'void',
[param('std::string', 'prefix'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid'), param('bool', 'explicitFilename')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAscii(ns3::Ptr<ns3::OutputStreamWrapper> stream, uint32_t nodeid, uint32_t deviceid) [member function]
cls.add_method('EnableAscii',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAsciiAll(std::string prefix) [member function]
cls.add_method('EnableAsciiAll',
'void',
[param('std::string', 'prefix')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAsciiAll(ns3::Ptr<ns3::OutputStreamWrapper> stream) [member function]
cls.add_method('EnableAsciiAll',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream')])
## trace-helper.h (module 'network'): void ns3::AsciiTraceHelperForDevice::EnableAsciiInternal(ns3::Ptr<ns3::OutputStreamWrapper> stream, std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool explicitFilename) [member function]
cls.add_method('EnableAsciiInternal',
'void',
[param('ns3::Ptr< ns3::OutputStreamWrapper >', 'stream'), param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'explicitFilename')],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3AttributeConstructionList_methods(root_module, cls):
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::AttributeConstructionList(ns3::AttributeConstructionList const & arg0) [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<const ns3::AttributeChecker> checker, ns3::Ptr<ns3::AttributeValue> 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'): ns3::AttributeConstructionList::CIterator ns3::AttributeConstructionList::Begin() const [member function]
cls.add_method('Begin',
'ns3::AttributeConstructionList::CIterator',
[],
is_const=True)
## attribute-construction-list.h (module 'core'): ns3::AttributeConstructionList::CIterator ns3::AttributeConstructionList::End() const [member function]
cls.add_method('End',
'ns3::AttributeConstructionList::CIterator',
[],
is_const=True)
## attribute-construction-list.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeConstructionList::Find(ns3::Ptr<const ns3::AttributeChecker> 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) [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(ns3::Buffer const & o) [constructor]
cls.add_constructor([param('ns3::Buffer const &', 'o')])
## 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'): 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) [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::GetRemainingSize() const [member function]
cls.add_method('GetRemainingSize',
'uint32_t',
[],
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) [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) [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) [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) [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) [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) [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::CallbackImplBase> 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<ns3::CallbackImplBase> impl) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::CallbackImplBase >', 'impl')],
visibility='protected')
return
def register_Ns3ChannelList_methods(root_module, cls):
## channel-list.h (module 'network'): ns3::ChannelList::ChannelList() [constructor]
cls.add_constructor([])
## channel-list.h (module 'network'): ns3::ChannelList::ChannelList(ns3::ChannelList const & arg0) [constructor]
cls.add_constructor([param('ns3::ChannelList const &', 'arg0')])
## channel-list.h (module 'network'): static uint32_t ns3::ChannelList::Add(ns3::Ptr<ns3::Channel> channel) [member function]
cls.add_method('Add',
'uint32_t',
[param('ns3::Ptr< ns3::Channel >', 'channel')],
is_static=True)
## channel-list.h (module 'network'): static ns3::ChannelList::Iterator ns3::ChannelList::Begin() [member function]
cls.add_method('Begin',
'ns3::ChannelList::Iterator',
[],
is_static=True)
## channel-list.h (module 'network'): static ns3::ChannelList::Iterator ns3::ChannelList::End() [member function]
cls.add_method('End',
'ns3::ChannelList::Iterator',
[],
is_static=True)
## channel-list.h (module 'network'): static ns3::Ptr<ns3::Channel> ns3::ChannelList::GetChannel(uint32_t n) [member function]
cls.add_method('GetChannel',
'ns3::Ptr< ns3::Channel >',
[param('uint32_t', 'n')],
is_static=True)
## channel-list.h (module 'network'): static uint32_t ns3::ChannelList::GetNChannels() [member function]
cls.add_method('GetNChannels',
'uint32_t',
[],
is_static=True)
return
def register_Ns3DataOutputCallback_methods(root_module, cls):
## data-output-interface.h (module 'stats'): ns3::DataOutputCallback::DataOutputCallback() [constructor]
cls.add_constructor([])
## data-output-interface.h (module 'stats'): ns3::DataOutputCallback::DataOutputCallback(ns3::DataOutputCallback const & arg0) [constructor]
cls.add_constructor([param('ns3::DataOutputCallback const &', 'arg0')])
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, int val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('int', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, uint32_t val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('uint32_t', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, double val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('double', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, std::string val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('std::string', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputSingleton(std::string key, std::string variable, ns3::Time val) [member function]
cls.add_method('OutputSingleton',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('ns3::Time', 'val')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputCallback::OutputStatistic(std::string key, std::string variable, ns3::StatisticalSummary const * statSum) [member function]
cls.add_method('OutputStatistic',
'void',
[param('std::string', 'key'), param('std::string', 'variable'), param('ns3::StatisticalSummary const *', 'statSum')],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3DataRate_methods(root_module, cls):
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('<=')
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('>')
cls.add_binary_comparison_operator('>=')
## data-rate.h (module 'network'): ns3::DataRate::DataRate(ns3::DataRate const & arg0) [constructor]
cls.add_constructor([param('ns3::DataRate const &', 'arg0')])
## data-rate.h (module 'network'): ns3::DataRate::DataRate() [constructor]
cls.add_constructor([])
## data-rate.h (module 'network'): ns3::DataRate::DataRate(uint64_t bps) [constructor]
cls.add_constructor([param('uint64_t', 'bps')])
## data-rate.h (module 'network'): ns3::DataRate::DataRate(std::string rate) [constructor]
cls.add_constructor([param('std::string', 'rate')])
## data-rate.h (module 'network'): ns3::Time ns3::DataRate::CalculateBitsTxTime(uint32_t bits) const [member function]
cls.add_method('CalculateBitsTxTime',
'ns3::Time',
[param('uint32_t', 'bits')],
is_const=True)
## data-rate.h (module 'network'): ns3::Time ns3::DataRate::CalculateBytesTxTime(uint32_t bytes) const [member function]
cls.add_method('CalculateBytesTxTime',
'ns3::Time',
[param('uint32_t', 'bytes')],
is_const=True)
## data-rate.h (module 'network'): double ns3::DataRate::CalculateTxTime(uint32_t bytes) const [member function]
cls.add_method('CalculateTxTime',
'double',
[param('uint32_t', 'bytes')],
deprecated=True, is_const=True)
## data-rate.h (module 'network'): uint64_t ns3::DataRate::GetBitRate() const [member function]
cls.add_method('GetBitRate',
'uint64_t',
[],
is_const=True)
return
def register_Ns3DefaultDeleter__Ns3AttributeAccessor_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::AttributeAccessor>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::AttributeAccessor>::DefaultDeleter(ns3::DefaultDeleter<ns3::AttributeAccessor> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::AttributeAccessor > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::AttributeAccessor>::Delete(ns3::AttributeAccessor * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::AttributeAccessor *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3AttributeChecker_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::AttributeChecker>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::AttributeChecker>::DefaultDeleter(ns3::DefaultDeleter<ns3::AttributeChecker> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::AttributeChecker > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::AttributeChecker>::Delete(ns3::AttributeChecker * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::AttributeChecker *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3AttributeValue_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::AttributeValue>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::AttributeValue>::DefaultDeleter(ns3::DefaultDeleter<ns3::AttributeValue> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::AttributeValue > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::AttributeValue>::Delete(ns3::AttributeValue * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::AttributeValue *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3CallbackImplBase_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::CallbackImplBase>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::CallbackImplBase>::DefaultDeleter(ns3::DefaultDeleter<ns3::CallbackImplBase> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::CallbackImplBase > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::CallbackImplBase>::Delete(ns3::CallbackImplBase * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::CallbackImplBase *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3EventImpl_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::EventImpl>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::EventImpl>::DefaultDeleter(ns3::DefaultDeleter<ns3::EventImpl> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::EventImpl > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::EventImpl>::Delete(ns3::EventImpl * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::EventImpl *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3HashImplementation_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::Hash::Implementation>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::Hash::Implementation>::DefaultDeleter(ns3::DefaultDeleter<ns3::Hash::Implementation> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::Hash::Implementation > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::Hash::Implementation>::Delete(ns3::Hash::Implementation * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::Hash::Implementation *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3NetDeviceQueue_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::NetDeviceQueue>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::NetDeviceQueue>::DefaultDeleter(ns3::DefaultDeleter<ns3::NetDeviceQueue> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::NetDeviceQueue > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::NetDeviceQueue>::Delete(ns3::NetDeviceQueue * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::NetDeviceQueue *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3NixVector_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::NixVector>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::NixVector>::DefaultDeleter(ns3::DefaultDeleter<ns3::NixVector> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::NixVector > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::NixVector>::Delete(ns3::NixVector * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::NixVector *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3OutputStreamWrapper_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::OutputStreamWrapper>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::OutputStreamWrapper>::DefaultDeleter(ns3::DefaultDeleter<ns3::OutputStreamWrapper> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::OutputStreamWrapper > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::OutputStreamWrapper>::Delete(ns3::OutputStreamWrapper * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::OutputStreamWrapper *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3Packet_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::Packet>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::Packet>::DefaultDeleter(ns3::DefaultDeleter<ns3::Packet> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::Packet > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::Packet>::Delete(ns3::Packet * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::Packet *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3PbbAddressBlock_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::PbbAddressBlock>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::PbbAddressBlock>::DefaultDeleter(ns3::DefaultDeleter<ns3::PbbAddressBlock> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::PbbAddressBlock > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::PbbAddressBlock>::Delete(ns3::PbbAddressBlock * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::PbbAddressBlock *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3PbbMessage_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::PbbMessage>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::PbbMessage>::DefaultDeleter(ns3::DefaultDeleter<ns3::PbbMessage> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::PbbMessage > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::PbbMessage>::Delete(ns3::PbbMessage * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::PbbMessage *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3PbbTlv_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::PbbTlv>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::PbbTlv>::DefaultDeleter(ns3::DefaultDeleter<ns3::PbbTlv> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::PbbTlv > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::PbbTlv>::Delete(ns3::PbbTlv * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::PbbTlv *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3QueueItem_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::QueueItem>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::QueueItem>::DefaultDeleter(ns3::DefaultDeleter<ns3::QueueItem> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::QueueItem > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::QueueItem>::Delete(ns3::QueueItem * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::QueueItem *', 'object')],
is_static=True)
return
def register_Ns3DefaultDeleter__Ns3TraceSourceAccessor_methods(root_module, cls):
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::TraceSourceAccessor>::DefaultDeleter() [constructor]
cls.add_constructor([])
## default-deleter.h (module 'core'): ns3::DefaultDeleter<ns3::TraceSourceAccessor>::DefaultDeleter(ns3::DefaultDeleter<ns3::TraceSourceAccessor> const & arg0) [constructor]
cls.add_constructor([param('ns3::DefaultDeleter< ns3::TraceSourceAccessor > const &', 'arg0')])
## default-deleter.h (module 'core'): static void ns3::DefaultDeleter<ns3::TraceSourceAccessor>::Delete(ns3::TraceSourceAccessor * object) [member function]
cls.add_method('Delete',
'void',
[param('ns3::TraceSourceAccessor *', 'object')],
is_static=True)
return
def register_Ns3DelayJitterEstimation_methods(root_module, cls):
## delay-jitter-estimation.h (module 'network'): ns3::DelayJitterEstimation::DelayJitterEstimation(ns3::DelayJitterEstimation const & arg0) [constructor]
cls.add_constructor([param('ns3::DelayJitterEstimation const &', 'arg0')])
## delay-jitter-estimation.h (module 'network'): ns3::DelayJitterEstimation::DelayJitterEstimation() [constructor]
cls.add_constructor([])
## delay-jitter-estimation.h (module 'network'): ns3::Time ns3::DelayJitterEstimation::GetLastDelay() const [member function]
cls.add_method('GetLastDelay',
'ns3::Time',
[],
is_const=True)
## delay-jitter-estimation.h (module 'network'): uint64_t ns3::DelayJitterEstimation::GetLastJitter() const [member function]
cls.add_method('GetLastJitter',
'uint64_t',
[],
is_const=True)
## delay-jitter-estimation.h (module 'network'): static void ns3::DelayJitterEstimation::PrepareTx(ns3::Ptr<const ns3::Packet> packet) [member function]
cls.add_method('PrepareTx',
'void',
[param('ns3::Ptr< ns3::Packet const >', 'packet')],
is_static=True)
## delay-jitter-estimation.h (module 'network'): void ns3::DelayJitterEstimation::RecordRx(ns3::Ptr<const ns3::Packet> packet) [member function]
cls.add_method('RecordRx',
'void',
[param('ns3::Ptr< ns3::Packet const >', 'packet')])
return
def register_Ns3EventId_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<')
## event-id.h (module 'core'): ns3::EventId::EventId(ns3::EventId const & arg0) [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<ns3::EventImpl> 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) [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<ns3::Hash::Implementation> hp) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Hash::Implementation >', 'hp')])
## hash.h (module 'core'): uint32_t ns3::Hasher::GetHash32(char const * buffer, std::size_t const size) [member function]
cls.add_method('GetHash32',
'uint32_t',
[param('char const *', 'buffer'), param('std::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, std::size_t const size) [member function]
cls.add_method('GetHash64',
'uint64_t',
[param('char const *', 'buffer'), param('std::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_Ns3Inet6SocketAddress_methods(root_module, cls):
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(ns3::Inet6SocketAddress const & arg0) [constructor]
cls.add_constructor([param('ns3::Inet6SocketAddress const &', 'arg0')])
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(ns3::Ipv6Address ipv6, uint16_t port) [constructor]
cls.add_constructor([param('ns3::Ipv6Address', 'ipv6'), param('uint16_t', 'port')])
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(ns3::Ipv6Address ipv6) [constructor]
cls.add_constructor([param('ns3::Ipv6Address', 'ipv6')])
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(uint16_t port) [constructor]
cls.add_constructor([param('uint16_t', 'port')])
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(char const * ipv6, uint16_t port) [constructor]
cls.add_constructor([param('char const *', 'ipv6'), param('uint16_t', 'port')])
## inet6-socket-address.h (module 'network'): ns3::Inet6SocketAddress::Inet6SocketAddress(char const * ipv6) [constructor]
cls.add_constructor([param('char const *', 'ipv6')])
## inet6-socket-address.h (module 'network'): static ns3::Inet6SocketAddress ns3::Inet6SocketAddress::ConvertFrom(ns3::Address const & addr) [member function]
cls.add_method('ConvertFrom',
'ns3::Inet6SocketAddress',
[param('ns3::Address const &', 'addr')],
is_static=True)
## inet6-socket-address.h (module 'network'): ns3::Ipv6Address ns3::Inet6SocketAddress::GetIpv6() const [member function]
cls.add_method('GetIpv6',
'ns3::Ipv6Address',
[],
is_const=True)
## inet6-socket-address.h (module 'network'): uint16_t ns3::Inet6SocketAddress::GetPort() const [member function]
cls.add_method('GetPort',
'uint16_t',
[],
is_const=True)
## inet6-socket-address.h (module 'network'): static bool ns3::Inet6SocketAddress::IsMatchingType(ns3::Address const & addr) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'addr')],
is_static=True)
## inet6-socket-address.h (module 'network'): void ns3::Inet6SocketAddress::SetIpv6(ns3::Ipv6Address ipv6) [member function]
cls.add_method('SetIpv6',
'void',
[param('ns3::Ipv6Address', 'ipv6')])
## inet6-socket-address.h (module 'network'): void ns3::Inet6SocketAddress::SetPort(uint16_t port) [member function]
cls.add_method('SetPort',
'void',
[param('uint16_t', 'port')])
return
def register_Ns3InetSocketAddress_methods(root_module, cls):
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(ns3::InetSocketAddress const & arg0) [constructor]
cls.add_constructor([param('ns3::InetSocketAddress const &', 'arg0')])
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(ns3::Ipv4Address ipv4, uint16_t port) [constructor]
cls.add_constructor([param('ns3::Ipv4Address', 'ipv4'), param('uint16_t', 'port')])
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(ns3::Ipv4Address ipv4) [constructor]
cls.add_constructor([param('ns3::Ipv4Address', 'ipv4')])
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(uint16_t port) [constructor]
cls.add_constructor([param('uint16_t', 'port')])
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(char const * ipv4, uint16_t port) [constructor]
cls.add_constructor([param('char const *', 'ipv4'), param('uint16_t', 'port')])
## inet-socket-address.h (module 'network'): ns3::InetSocketAddress::InetSocketAddress(char const * ipv4) [constructor]
cls.add_constructor([param('char const *', 'ipv4')])
## inet-socket-address.h (module 'network'): static ns3::InetSocketAddress ns3::InetSocketAddress::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::InetSocketAddress',
[param('ns3::Address const &', 'address')],
is_static=True)
## inet-socket-address.h (module 'network'): ns3::Ipv4Address ns3::InetSocketAddress::GetIpv4() const [member function]
cls.add_method('GetIpv4',
'ns3::Ipv4Address',
[],
is_const=True)
## inet-socket-address.h (module 'network'): uint16_t ns3::InetSocketAddress::GetPort() const [member function]
cls.add_method('GetPort',
'uint16_t',
[],
is_const=True)
## inet-socket-address.h (module 'network'): uint8_t ns3::InetSocketAddress::GetTos() const [member function]
cls.add_method('GetTos',
'uint8_t',
[],
is_const=True)
## inet-socket-address.h (module 'network'): static bool ns3::InetSocketAddress::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'address')],
is_static=True)
## inet-socket-address.h (module 'network'): void ns3::InetSocketAddress::SetIpv4(ns3::Ipv4Address address) [member function]
cls.add_method('SetIpv4',
'void',
[param('ns3::Ipv4Address', 'address')])
## inet-socket-address.h (module 'network'): void ns3::InetSocketAddress::SetPort(uint16_t port) [member function]
cls.add_method('SetPort',
'void',
[param('uint16_t', 'port')])
## inet-socket-address.h (module 'network'): void ns3::InetSocketAddress::SetTos(uint8_t tos) [member function]
cls.add_method('SetTos',
'void',
[param('uint8_t', 'tos')])
return
def register_Ns3Ipv4Address_methods(root_module, cls):
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<')
## ipv4-address.h (module 'network'): ns3::Ipv4Address::Ipv4Address(ns3::Ipv4Address const & arg0) [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::IsAny() const [member function]
cls.add_method('IsAny',
'bool',
[],
is_const=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'): bool ns3::Ipv4Address::IsLocalhost() const [member function]
cls.add_method('IsLocalhost',
'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_output_stream_operator()
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
## ipv4-address.h (module 'network'): ns3::Ipv4Mask::Ipv4Mask(ns3::Ipv4Mask const & arg0) [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_output_stream_operator()
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_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) [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',
[],
deprecated=True, 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::MakeAutoconfiguredAddress(ns3::Mac8Address addr, ns3::Ipv6Address prefix) [member function]
cls.add_method('MakeAutoconfiguredAddress',
'ns3::Ipv6Address',
[param('ns3::Mac8Address', '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::MakeAutoconfiguredLinkLocalAddress(ns3::Mac8Address mac) [member function]
cls.add_method('MakeAutoconfiguredLinkLocalAddress',
'ns3::Ipv6Address',
[param('ns3::Mac8Address', '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_output_stream_operator()
cls.add_binary_comparison_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) [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_Ns3LogComponent_methods(root_module, cls):
## log.h (module 'core'): ns3::LogComponent::LogComponent(ns3::LogComponent const & arg0) [constructor]
cls.add_constructor([param('ns3::LogComponent const &', 'arg0')])
## log.h (module 'core'): ns3::LogComponent::LogComponent(std::string const & name, std::string const & file, ns3::LogLevel const mask=::ns3::LogLevel::LOG_NONE) [constructor]
cls.add_constructor([param('std::string const &', 'name'), param('std::string const &', 'file'), param('ns3::LogLevel const', 'mask', default_value='::ns3::LogLevel::LOG_NONE')])
## log.h (module 'core'): void ns3::LogComponent::Disable(ns3::LogLevel const level) [member function]
cls.add_method('Disable',
'void',
[param('ns3::LogLevel const', 'level')])
## log.h (module 'core'): void ns3::LogComponent::Enable(ns3::LogLevel const level) [member function]
cls.add_method('Enable',
'void',
[param('ns3::LogLevel const', 'level')])
## log.h (module 'core'): std::string ns3::LogComponent::File() const [member function]
cls.add_method('File',
'std::string',
[],
is_const=True)
## log.h (module 'core'): static ns3::LogComponent::ComponentList * ns3::LogComponent::GetComponentList() [member function]
cls.add_method('GetComponentList',
'ns3::LogComponent::ComponentList *',
[],
is_static=True)
## log.h (module 'core'): static std::string ns3::LogComponent::GetLevelLabel(ns3::LogLevel const level) [member function]
cls.add_method('GetLevelLabel',
'std::string',
[param('ns3::LogLevel const', 'level')],
is_static=True)
## log.h (module 'core'): bool ns3::LogComponent::IsEnabled(ns3::LogLevel const level) const [member function]
cls.add_method('IsEnabled',
'bool',
[param('ns3::LogLevel const', 'level')],
is_const=True)
## log.h (module 'core'): bool ns3::LogComponent::IsNoneEnabled() const [member function]
cls.add_method('IsNoneEnabled',
'bool',
[],
is_const=True)
## log.h (module 'core'): char const * ns3::LogComponent::Name() const [member function]
cls.add_method('Name',
'char const *',
[],
is_const=True)
## log.h (module 'core'): void ns3::LogComponent::SetMask(ns3::LogLevel const level) [member function]
cls.add_method('SetMask',
'void',
[param('ns3::LogLevel const', 'level')])
return
def register_Ns3Mac16Address_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<')
cls.add_output_stream_operator()
## mac16-address.h (module 'network'): ns3::Mac16Address::Mac16Address(ns3::Mac16Address const & arg0) [constructor]
cls.add_constructor([param('ns3::Mac16Address const &', 'arg0')])
## mac16-address.h (module 'network'): ns3::Mac16Address::Mac16Address() [constructor]
cls.add_constructor([])
## mac16-address.h (module 'network'): ns3::Mac16Address::Mac16Address(char const * str) [constructor]
cls.add_constructor([param('char const *', 'str')])
## mac16-address.h (module 'network'): static ns3::Mac16Address ns3::Mac16Address::Allocate() [member function]
cls.add_method('Allocate',
'ns3::Mac16Address',
[],
is_static=True)
## mac16-address.h (module 'network'): static ns3::Mac16Address ns3::Mac16Address::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::Mac16Address',
[param('ns3::Address const &', 'address')],
is_static=True)
## mac16-address.h (module 'network'): void ns3::Mac16Address::CopyFrom(uint8_t const * buffer) [member function]
cls.add_method('CopyFrom',
'void',
[param('uint8_t const *', 'buffer')])
## mac16-address.h (module 'network'): void ns3::Mac16Address::CopyTo(uint8_t * buffer) const [member function]
cls.add_method('CopyTo',
'void',
[param('uint8_t *', 'buffer')],
is_const=True)
## mac16-address.h (module 'network'): static bool ns3::Mac16Address::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'address')],
is_static=True)
return
def register_Ns3Mac48Address_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<')
cls.add_output_stream_operator()
## mac48-address.h (module 'network'): ns3::Mac48Address::Mac48Address(ns3::Mac48Address const & arg0) [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_Ns3Mac64Address_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<')
cls.add_output_stream_operator()
## mac64-address.h (module 'network'): ns3::Mac64Address::Mac64Address(ns3::Mac64Address const & arg0) [constructor]
cls.add_constructor([param('ns3::Mac64Address const &', 'arg0')])
## mac64-address.h (module 'network'): ns3::Mac64Address::Mac64Address() [constructor]
cls.add_constructor([])
## mac64-address.h (module 'network'): ns3::Mac64Address::Mac64Address(char const * str) [constructor]
cls.add_constructor([param('char const *', 'str')])
## mac64-address.h (module 'network'): static ns3::Mac64Address ns3::Mac64Address::Allocate() [member function]
cls.add_method('Allocate',
'ns3::Mac64Address',
[],
is_static=True)
## mac64-address.h (module 'network'): static ns3::Mac64Address ns3::Mac64Address::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::Mac64Address',
[param('ns3::Address const &', 'address')],
is_static=True)
## mac64-address.h (module 'network'): void ns3::Mac64Address::CopyFrom(uint8_t const * buffer) [member function]
cls.add_method('CopyFrom',
'void',
[param('uint8_t const *', 'buffer')])
## mac64-address.h (module 'network'): void ns3::Mac64Address::CopyTo(uint8_t * buffer) const [member function]
cls.add_method('CopyTo',
'void',
[param('uint8_t *', 'buffer')],
is_const=True)
## mac64-address.h (module 'network'): static bool ns3::Mac64Address::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'address')],
is_static=True)
return
def register_Ns3Mac8Address_methods(root_module, cls):
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
cls.add_output_stream_operator()
## mac8-address.h (module 'network'): ns3::Mac8Address::Mac8Address(ns3::Mac8Address const & arg0) [constructor]
cls.add_constructor([param('ns3::Mac8Address const &', 'arg0')])
## mac8-address.h (module 'network'): ns3::Mac8Address::Mac8Address() [constructor]
cls.add_constructor([])
## mac8-address.h (module 'network'): ns3::Mac8Address::Mac8Address(uint8_t addr) [constructor]
cls.add_constructor([param('uint8_t', 'addr')])
## mac8-address.h (module 'network'): static ns3::Mac8Address ns3::Mac8Address::Allocate() [member function]
cls.add_method('Allocate',
'ns3::Mac8Address',
[],
is_static=True)
## mac8-address.h (module 'network'): static ns3::Mac8Address ns3::Mac8Address::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::Mac8Address',
[param('ns3::Address const &', 'address')],
is_static=True)
## mac8-address.h (module 'network'): void ns3::Mac8Address::CopyFrom(uint8_t const * pBuffer) [member function]
cls.add_method('CopyFrom',
'void',
[param('uint8_t const *', 'pBuffer')])
## mac8-address.h (module 'network'): void ns3::Mac8Address::CopyTo(uint8_t * pBuffer) const [member function]
cls.add_method('CopyTo',
'void',
[param('uint8_t *', 'pBuffer')],
is_const=True)
## mac8-address.h (module 'network'): static ns3::Mac8Address ns3::Mac8Address::GetBroadcast() [member function]
cls.add_method('GetBroadcast',
'ns3::Mac8Address',
[],
is_static=True)
## mac8-address.h (module 'network'): static bool ns3::Mac8Address::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) [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<ns3::NetDevice> 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<ns3::NetDevice> 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'): ns3::NetDeviceContainer::Iterator ns3::NetDeviceContainer::Begin() const [member function]
cls.add_method('Begin',
'ns3::NetDeviceContainer::Iterator',
[],
is_const=True)
## net-device-container.h (module 'network'): ns3::NetDeviceContainer::Iterator ns3::NetDeviceContainer::End() const [member function]
cls.add_method('End',
'ns3::NetDeviceContainer::Iterator',
[],
is_const=True)
## net-device-container.h (module 'network'): ns3::Ptr<ns3::NetDevice> 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) [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<ns3::Node> 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<ns3::Node> 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'): ns3::NodeContainer::Iterator ns3::NodeContainer::Begin() const [member function]
cls.add_method('Begin',
'ns3::NodeContainer::Iterator',
[],
is_const=True)
## node-container.h (module 'network'): bool ns3::NodeContainer::Contains(uint32_t id) const [member function]
cls.add_method('Contains',
'bool',
[param('uint32_t', 'id')],
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'): ns3::NodeContainer::Iterator ns3::NodeContainer::End() const [member function]
cls.add_method('End',
'ns3::NodeContainer::Iterator',
[],
is_const=True)
## node-container.h (module 'network'): ns3::Ptr<ns3::Node> 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_Ns3NodeList_methods(root_module, cls):
## node-list.h (module 'network'): ns3::NodeList::NodeList() [constructor]
cls.add_constructor([])
## node-list.h (module 'network'): ns3::NodeList::NodeList(ns3::NodeList const & arg0) [constructor]
cls.add_constructor([param('ns3::NodeList const &', 'arg0')])
## node-list.h (module 'network'): static uint32_t ns3::NodeList::Add(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('Add',
'uint32_t',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_static=True)
## node-list.h (module 'network'): static ns3::NodeList::Iterator ns3::NodeList::Begin() [member function]
cls.add_method('Begin',
'ns3::NodeList::Iterator',
[],
is_static=True)
## node-list.h (module 'network'): static ns3::NodeList::Iterator ns3::NodeList::End() [member function]
cls.add_method('End',
'ns3::NodeList::Iterator',
[],
is_static=True)
## node-list.h (module 'network'): static uint32_t ns3::NodeList::GetNNodes() [member function]
cls.add_method('GetNNodes',
'uint32_t',
[],
is_static=True)
## node-list.h (module 'network'): static ns3::Ptr<ns3::Node> ns3::NodeList::GetNode(uint32_t n) [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[param('uint32_t', 'n')],
is_static=True)
return
def register_Ns3NonCopyable_methods(root_module, cls):
## non-copyable.h (module 'core'): ns3::NonCopyable::NonCopyable() [constructor]
cls.add_constructor([],
visibility='protected')
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) [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) [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) [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::Object> 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) [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) [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)
## packet-metadata.h (module 'network'): ns3::PacketMetadata::Item::type [variable]
cls.add_instance_attribute('type', 'ns3::PacketMetadata::Item::ItemType', 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) [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_Ns3PacketSocketAddress_methods(root_module, cls):
## packet-socket-address.h (module 'network'): ns3::PacketSocketAddress::PacketSocketAddress(ns3::PacketSocketAddress const & arg0) [constructor]
cls.add_constructor([param('ns3::PacketSocketAddress const &', 'arg0')])
## packet-socket-address.h (module 'network'): ns3::PacketSocketAddress::PacketSocketAddress() [constructor]
cls.add_constructor([])
## packet-socket-address.h (module 'network'): static ns3::PacketSocketAddress ns3::PacketSocketAddress::ConvertFrom(ns3::Address const & address) [member function]
cls.add_method('ConvertFrom',
'ns3::PacketSocketAddress',
[param('ns3::Address const &', 'address')],
is_static=True)
## packet-socket-address.h (module 'network'): ns3::Address ns3::PacketSocketAddress::GetPhysicalAddress() const [member function]
cls.add_method('GetPhysicalAddress',
'ns3::Address',
[],
is_const=True)
## packet-socket-address.h (module 'network'): uint16_t ns3::PacketSocketAddress::GetProtocol() const [member function]
cls.add_method('GetProtocol',
'uint16_t',
[],
is_const=True)
## packet-socket-address.h (module 'network'): uint32_t ns3::PacketSocketAddress::GetSingleDevice() const [member function]
cls.add_method('GetSingleDevice',
'uint32_t',
[],
is_const=True)
## packet-socket-address.h (module 'network'): static bool ns3::PacketSocketAddress::IsMatchingType(ns3::Address const & address) [member function]
cls.add_method('IsMatchingType',
'bool',
[param('ns3::Address const &', 'address')],
is_static=True)
## packet-socket-address.h (module 'network'): bool ns3::PacketSocketAddress::IsSingleDevice() const [member function]
cls.add_method('IsSingleDevice',
'bool',
[],
is_const=True)
## packet-socket-address.h (module 'network'): void ns3::PacketSocketAddress::SetAllDevices() [member function]
cls.add_method('SetAllDevices',
'void',
[])
## packet-socket-address.h (module 'network'): void ns3::PacketSocketAddress::SetPhysicalAddress(ns3::Address const address) [member function]
cls.add_method('SetPhysicalAddress',
'void',
[param('ns3::Address const', 'address')])
## packet-socket-address.h (module 'network'): void ns3::PacketSocketAddress::SetProtocol(uint16_t protocol) [member function]
cls.add_method('SetProtocol',
'void',
[param('uint16_t', 'protocol')])
## packet-socket-address.h (module 'network'): void ns3::PacketSocketAddress::SetSingleDevice(uint32_t device) [member function]
cls.add_method('SetSingleDevice',
'void',
[param('uint32_t', 'device')])
return
def register_Ns3PacketSocketHelper_methods(root_module, cls):
## packet-socket-helper.h (module 'network'): ns3::PacketSocketHelper::PacketSocketHelper() [constructor]
cls.add_constructor([])
## packet-socket-helper.h (module 'network'): ns3::PacketSocketHelper::PacketSocketHelper(ns3::PacketSocketHelper const & arg0) [constructor]
cls.add_constructor([param('ns3::PacketSocketHelper const &', 'arg0')])
## packet-socket-helper.h (module 'network'): void ns3::PacketSocketHelper::Install(ns3::Ptr<ns3::Node> node) const [member function]
cls.add_method('Install',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_const=True)
## packet-socket-helper.h (module 'network'): void ns3::PacketSocketHelper::Install(std::string nodeName) const [member function]
cls.add_method('Install',
'void',
[param('std::string', 'nodeName')],
is_const=True)
## packet-socket-helper.h (module 'network'): void ns3::PacketSocketHelper::Install(ns3::NodeContainer c) const [member function]
cls.add_method('Install',
'void',
[param('ns3::NodeContainer', 'c')],
is_const=True)
return
def register_Ns3PacketTagIterator_methods(root_module, cls):
## packet.h (module 'network'): ns3::PacketTagIterator::PacketTagIterator(ns3::PacketTagIterator const & arg0) [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) [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) [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) [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 [ 1 ]', 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::size [variable]
cls.add_instance_attribute('size', 'uint32_t', 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_Ns3ParameterLogger_methods(root_module, cls):
## log.h (module 'core'): ns3::ParameterLogger::ParameterLogger(ns3::ParameterLogger const & arg0) [constructor]
cls.add_constructor([param('ns3::ParameterLogger const &', 'arg0')])
## log.h (module 'core'): ns3::ParameterLogger::ParameterLogger(std::ostream & os) [constructor]
cls.add_constructor([param('std::ostream &', 'os')])
return
def register_Ns3PbbAddressTlvBlock_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
## packetbb.h (module 'network'): ns3::PbbAddressTlvBlock::PbbAddressTlvBlock(ns3::PbbAddressTlvBlock const & arg0) [constructor]
cls.add_constructor([param('ns3::PbbAddressTlvBlock const &', 'arg0')])
## packetbb.h (module 'network'): ns3::PbbAddressTlvBlock::PbbAddressTlvBlock() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressTlv> ns3::PbbAddressTlvBlock::Back() const [member function]
cls.add_method('Back',
'ns3::Ptr< ns3::PbbAddressTlv >',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbAddressTlvBlock::Iterator ns3::PbbAddressTlvBlock::Begin() [member function]
cls.add_method('Begin',
'ns3::PbbAddressTlvBlock::Iterator',
[])
## packetbb.h (module 'network'): ns3::PbbAddressTlvBlock::ConstIterator ns3::PbbAddressTlvBlock::Begin() const [member function]
cls.add_method('Begin',
'ns3::PbbAddressTlvBlock::ConstIterator',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::Clear() [member function]
cls.add_method('Clear',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::Deserialize(ns3::Buffer::Iterator & start) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::Buffer::Iterator &', 'start')])
## packetbb.h (module 'network'): bool ns3::PbbAddressTlvBlock::Empty() const [member function]
cls.add_method('Empty',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbAddressTlvBlock::Iterator ns3::PbbAddressTlvBlock::End() [member function]
cls.add_method('End',
'ns3::PbbAddressTlvBlock::Iterator',
[])
## packetbb.h (module 'network'): ns3::PbbAddressTlvBlock::ConstIterator ns3::PbbAddressTlvBlock::End() const [member function]
cls.add_method('End',
'ns3::PbbAddressTlvBlock::ConstIterator',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbAddressTlvBlock::Iterator ns3::PbbAddressTlvBlock::Erase(ns3::PbbAddressTlvBlock::Iterator position) [member function]
cls.add_method('Erase',
'ns3::PbbAddressTlvBlock::Iterator',
[param('std::list< ns3::Ptr< ns3::PbbAddressTlv > > iterator', 'position')])
## packetbb.h (module 'network'): ns3::PbbAddressTlvBlock::Iterator ns3::PbbAddressTlvBlock::Erase(ns3::PbbAddressTlvBlock::Iterator first, ns3::PbbAddressTlvBlock::Iterator last) [member function]
cls.add_method('Erase',
'ns3::PbbAddressTlvBlock::Iterator',
[param('std::list< ns3::Ptr< ns3::PbbAddressTlv > > iterator', 'first'), param('std::list< ns3::Ptr< ns3::PbbAddressTlv > > iterator', 'last')])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressTlv> ns3::PbbAddressTlvBlock::Front() const [member function]
cls.add_method('Front',
'ns3::Ptr< ns3::PbbAddressTlv >',
[],
is_const=True)
## packetbb.h (module 'network'): uint32_t ns3::PbbAddressTlvBlock::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbAddressTlvBlock::Iterator ns3::PbbAddressTlvBlock::Insert(ns3::PbbAddressTlvBlock::Iterator position, ns3::Ptr<ns3::PbbAddressTlv> const tlv) [member function]
cls.add_method('Insert',
'ns3::PbbAddressTlvBlock::Iterator',
[param('std::list< ns3::Ptr< ns3::PbbAddressTlv > > iterator', 'position'), param('ns3::Ptr< ns3::PbbAddressTlv > const', 'tlv')])
## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::PopBack() [member function]
cls.add_method('PopBack',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::PopFront() [member function]
cls.add_method('PopFront',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::Print(std::ostream & os, int level) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os'), param('int', 'level')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::PushBack(ns3::Ptr<ns3::PbbAddressTlv> tlv) [member function]
cls.add_method('PushBack',
'void',
[param('ns3::Ptr< ns3::PbbAddressTlv >', 'tlv')])
## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::PushFront(ns3::Ptr<ns3::PbbAddressTlv> tlv) [member function]
cls.add_method('PushFront',
'void',
[param('ns3::Ptr< ns3::PbbAddressTlv >', 'tlv')])
## packetbb.h (module 'network'): void ns3::PbbAddressTlvBlock::Serialize(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True)
## packetbb.h (module 'network'): int ns3::PbbAddressTlvBlock::Size() const [member function]
cls.add_method('Size',
'int',
[],
is_const=True)
return
def register_Ns3PbbTlvBlock_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
## packetbb.h (module 'network'): ns3::PbbTlvBlock::PbbTlvBlock(ns3::PbbTlvBlock const & arg0) [constructor]
cls.add_constructor([param('ns3::PbbTlvBlock const &', 'arg0')])
## packetbb.h (module 'network'): ns3::PbbTlvBlock::PbbTlvBlock() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> ns3::PbbTlvBlock::Back() const [member function]
cls.add_method('Back',
'ns3::Ptr< ns3::PbbTlv >',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbTlvBlock::Iterator ns3::PbbTlvBlock::Begin() [member function]
cls.add_method('Begin',
'ns3::PbbTlvBlock::Iterator',
[])
## packetbb.h (module 'network'): ns3::PbbTlvBlock::ConstIterator ns3::PbbTlvBlock::Begin() const [member function]
cls.add_method('Begin',
'ns3::PbbTlvBlock::ConstIterator',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbTlvBlock::Clear() [member function]
cls.add_method('Clear',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbTlvBlock::Deserialize(ns3::Buffer::Iterator & start) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::Buffer::Iterator &', 'start')])
## packetbb.h (module 'network'): bool ns3::PbbTlvBlock::Empty() const [member function]
cls.add_method('Empty',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbTlvBlock::Iterator ns3::PbbTlvBlock::End() [member function]
cls.add_method('End',
'ns3::PbbTlvBlock::Iterator',
[])
## packetbb.h (module 'network'): ns3::PbbTlvBlock::ConstIterator ns3::PbbTlvBlock::End() const [member function]
cls.add_method('End',
'ns3::PbbTlvBlock::ConstIterator',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbTlvBlock::Iterator ns3::PbbTlvBlock::Erase(ns3::PbbTlvBlock::Iterator position) [member function]
cls.add_method('Erase',
'ns3::PbbTlvBlock::Iterator',
[param('std::list< ns3::Ptr< ns3::PbbTlv > > iterator', 'position')])
## packetbb.h (module 'network'): ns3::PbbTlvBlock::Iterator ns3::PbbTlvBlock::Erase(ns3::PbbTlvBlock::Iterator first, ns3::PbbTlvBlock::Iterator last) [member function]
cls.add_method('Erase',
'ns3::PbbTlvBlock::Iterator',
[param('std::list< ns3::Ptr< ns3::PbbTlv > > iterator', 'first'), param('std::list< ns3::Ptr< ns3::PbbTlv > > iterator', 'last')])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> ns3::PbbTlvBlock::Front() const [member function]
cls.add_method('Front',
'ns3::Ptr< ns3::PbbTlv >',
[],
is_const=True)
## packetbb.h (module 'network'): uint32_t ns3::PbbTlvBlock::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbTlvBlock::Iterator ns3::PbbTlvBlock::Insert(ns3::PbbTlvBlock::Iterator position, ns3::Ptr<ns3::PbbTlv> const tlv) [member function]
cls.add_method('Insert',
'ns3::PbbTlvBlock::Iterator',
[param('std::list< ns3::Ptr< ns3::PbbTlv > > iterator', 'position'), param('ns3::Ptr< ns3::PbbTlv > const', 'tlv')])
## packetbb.h (module 'network'): void ns3::PbbTlvBlock::PopBack() [member function]
cls.add_method('PopBack',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbTlvBlock::PopFront() [member function]
cls.add_method('PopFront',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbTlvBlock::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbTlvBlock::Print(std::ostream & os, int level) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os'), param('int', 'level')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbTlvBlock::PushBack(ns3::Ptr<ns3::PbbTlv> tlv) [member function]
cls.add_method('PushBack',
'void',
[param('ns3::Ptr< ns3::PbbTlv >', 'tlv')])
## packetbb.h (module 'network'): void ns3::PbbTlvBlock::PushFront(ns3::Ptr<ns3::PbbTlv> tlv) [member function]
cls.add_method('PushFront',
'void',
[param('ns3::Ptr< ns3::PbbTlv >', 'tlv')])
## packetbb.h (module 'network'): void ns3::PbbTlvBlock::Serialize(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True)
## packetbb.h (module 'network'): int ns3::PbbTlvBlock::Size() const [member function]
cls.add_method('Size',
'int',
[],
is_const=True)
return
def register_Ns3PcapFile_methods(root_module, cls):
## pcap-file.h (module 'network'): ns3::PcapFile::PcapFile() [constructor]
cls.add_constructor([])
## pcap-file.h (module 'network'): void ns3::PcapFile::Clear() [member function]
cls.add_method('Clear',
'void',
[])
## pcap-file.h (module 'network'): void ns3::PcapFile::Close() [member function]
cls.add_method('Close',
'void',
[])
## pcap-file.h (module 'network'): static bool ns3::PcapFile::Diff(std::string const & f1, std::string const & f2, uint32_t & sec, uint32_t & usec, uint32_t & packets, uint32_t snapLen=ns3::PcapFile::SNAPLEN_DEFAULT) [member function]
cls.add_method('Diff',
'bool',
[param('std::string const &', 'f1'), param('std::string const &', 'f2'), param('uint32_t &', 'sec'), param('uint32_t &', 'usec'), param('uint32_t &', 'packets'), param('uint32_t', 'snapLen', default_value='ns3::PcapFile::SNAPLEN_DEFAULT')],
is_static=True)
## pcap-file.h (module 'network'): bool ns3::PcapFile::Eof() const [member function]
cls.add_method('Eof',
'bool',
[],
is_const=True)
## pcap-file.h (module 'network'): bool ns3::PcapFile::Fail() const [member function]
cls.add_method('Fail',
'bool',
[],
is_const=True)
## pcap-file.h (module 'network'): uint32_t ns3::PcapFile::GetDataLinkType() [member function]
cls.add_method('GetDataLinkType',
'uint32_t',
[])
## pcap-file.h (module 'network'): uint32_t ns3::PcapFile::GetMagic() [member function]
cls.add_method('GetMagic',
'uint32_t',
[])
## pcap-file.h (module 'network'): uint32_t ns3::PcapFile::GetSigFigs() [member function]
cls.add_method('GetSigFigs',
'uint32_t',
[])
## pcap-file.h (module 'network'): uint32_t ns3::PcapFile::GetSnapLen() [member function]
cls.add_method('GetSnapLen',
'uint32_t',
[])
## pcap-file.h (module 'network'): bool ns3::PcapFile::GetSwapMode() [member function]
cls.add_method('GetSwapMode',
'bool',
[])
## pcap-file.h (module 'network'): int32_t ns3::PcapFile::GetTimeZoneOffset() [member function]
cls.add_method('GetTimeZoneOffset',
'int32_t',
[])
## pcap-file.h (module 'network'): uint16_t ns3::PcapFile::GetVersionMajor() [member function]
cls.add_method('GetVersionMajor',
'uint16_t',
[])
## pcap-file.h (module 'network'): uint16_t ns3::PcapFile::GetVersionMinor() [member function]
cls.add_method('GetVersionMinor',
'uint16_t',
[])
## pcap-file.h (module 'network'): void ns3::PcapFile::Init(uint32_t dataLinkType, uint32_t snapLen=ns3::PcapFile::SNAPLEN_DEFAULT, int32_t timeZoneCorrection=ns3::PcapFile::ZONE_DEFAULT, bool swapMode=false, bool nanosecMode=false) [member function]
cls.add_method('Init',
'void',
[param('uint32_t', 'dataLinkType'), param('uint32_t', 'snapLen', default_value='ns3::PcapFile::SNAPLEN_DEFAULT'), param('int32_t', 'timeZoneCorrection', default_value='ns3::PcapFile::ZONE_DEFAULT'), param('bool', 'swapMode', default_value='false'), param('bool', 'nanosecMode', default_value='false')])
## pcap-file.h (module 'network'): bool ns3::PcapFile::IsNanoSecMode() [member function]
cls.add_method('IsNanoSecMode',
'bool',
[])
## pcap-file.h (module 'network'): void ns3::PcapFile::Open(std::string const & filename, std::ios_base::openmode mode) [member function]
cls.add_method('Open',
'void',
[param('std::string const &', 'filename'), param('std::ios_base::openmode', 'mode')])
## pcap-file.h (module 'network'): void ns3::PcapFile::Read(uint8_t * const data, uint32_t maxBytes, uint32_t & tsSec, uint32_t & tsUsec, uint32_t & inclLen, uint32_t & origLen, uint32_t & readLen) [member function]
cls.add_method('Read',
'void',
[param('uint8_t * const', 'data'), param('uint32_t', 'maxBytes'), param('uint32_t &', 'tsSec'), param('uint32_t &', 'tsUsec'), param('uint32_t &', 'inclLen'), param('uint32_t &', 'origLen'), param('uint32_t &', 'readLen')])
## pcap-file.h (module 'network'): void ns3::PcapFile::Write(uint32_t tsSec, uint32_t tsUsec, uint8_t const * const data, uint32_t totalLen) [member function]
cls.add_method('Write',
'void',
[param('uint32_t', 'tsSec'), param('uint32_t', 'tsUsec'), param('uint8_t const * const', 'data'), param('uint32_t', 'totalLen')])
## pcap-file.h (module 'network'): void ns3::PcapFile::Write(uint32_t tsSec, uint32_t tsUsec, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('Write',
'void',
[param('uint32_t', 'tsSec'), param('uint32_t', 'tsUsec'), param('ns3::Ptr< ns3::Packet const >', 'p')])
## pcap-file.h (module 'network'): void ns3::PcapFile::Write(uint32_t tsSec, uint32_t tsUsec, ns3::Header const & header, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('Write',
'void',
[param('uint32_t', 'tsSec'), param('uint32_t', 'tsUsec'), param('ns3::Header const &', 'header'), param('ns3::Ptr< ns3::Packet const >', 'p')])
## pcap-file.h (module 'network'): ns3::PcapFile::SNAPLEN_DEFAULT [variable]
cls.add_static_attribute('SNAPLEN_DEFAULT', 'uint32_t const', is_const=True)
## pcap-file.h (module 'network'): ns3::PcapFile::ZONE_DEFAULT [variable]
cls.add_static_attribute('ZONE_DEFAULT', 'int32_t const', is_const=True)
return
def register_Ns3PcapHelper_methods(root_module, cls):
## trace-helper.h (module 'network'): ns3::PcapHelper::PcapHelper(ns3::PcapHelper const & arg0) [constructor]
cls.add_constructor([param('ns3::PcapHelper const &', 'arg0')])
## trace-helper.h (module 'network'): ns3::PcapHelper::PcapHelper() [constructor]
cls.add_constructor([])
## trace-helper.h (module 'network'): ns3::Ptr<ns3::PcapFileWrapper> ns3::PcapHelper::CreateFile(std::string filename, std::ios_base::openmode filemode, ns3::PcapHelper::DataLinkType dataLinkType, uint32_t snapLen=std::numeric_limits<unsigned int>::max(), int32_t tzCorrection=0) [member function]
cls.add_method('CreateFile',
'ns3::Ptr< ns3::PcapFileWrapper >',
[param('std::string', 'filename'), param('std::ios_base::openmode', 'filemode'), param('ns3::PcapHelper::DataLinkType', 'dataLinkType'), param('uint32_t', 'snapLen', default_value='std::numeric_limits<unsigned int>::max()'), param('int32_t', 'tzCorrection', default_value='0')])
## trace-helper.h (module 'network'): std::string ns3::PcapHelper::GetFilenameFromDevice(std::string prefix, ns3::Ptr<ns3::NetDevice> device, bool useObjectNames=true) [member function]
cls.add_method('GetFilenameFromDevice',
'std::string',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'device'), param('bool', 'useObjectNames', default_value='true')])
## trace-helper.h (module 'network'): std::string ns3::PcapHelper::GetFilenameFromInterfacePair(std::string prefix, ns3::Ptr<ns3::Object> object, uint32_t interface, bool useObjectNames=true) [member function]
cls.add_method('GetFilenameFromInterfacePair',
'std::string',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::Object >', 'object'), param('uint32_t', 'interface'), param('bool', 'useObjectNames', default_value='true')])
return
def register_Ns3PcapHelperForDevice_methods(root_module, cls):
## trace-helper.h (module 'network'): ns3::PcapHelperForDevice::PcapHelperForDevice(ns3::PcapHelperForDevice const & arg0) [constructor]
cls.add_constructor([param('ns3::PcapHelperForDevice const &', 'arg0')])
## trace-helper.h (module 'network'): ns3::PcapHelperForDevice::PcapHelperForDevice() [constructor]
cls.add_constructor([])
## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool promiscuous=false, bool explicitFilename=false) [member function]
cls.add_method('EnablePcap',
'void',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'promiscuous', default_value='false'), param('bool', 'explicitFilename', default_value='false')])
## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, std::string ndName, bool promiscuous=false, bool explicitFilename=false) [member function]
cls.add_method('EnablePcap',
'void',
[param('std::string', 'prefix'), param('std::string', 'ndName'), param('bool', 'promiscuous', default_value='false'), param('bool', 'explicitFilename', default_value='false')])
## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, ns3::NetDeviceContainer d, bool promiscuous=false) [member function]
cls.add_method('EnablePcap',
'void',
[param('std::string', 'prefix'), param('ns3::NetDeviceContainer', 'd'), param('bool', 'promiscuous', default_value='false')])
## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, ns3::NodeContainer n, bool promiscuous=false) [member function]
cls.add_method('EnablePcap',
'void',
[param('std::string', 'prefix'), param('ns3::NodeContainer', 'n'), param('bool', 'promiscuous', default_value='false')])
## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcap(std::string prefix, uint32_t nodeid, uint32_t deviceid, bool promiscuous=false) [member function]
cls.add_method('EnablePcap',
'void',
[param('std::string', 'prefix'), param('uint32_t', 'nodeid'), param('uint32_t', 'deviceid'), param('bool', 'promiscuous', default_value='false')])
## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcapAll(std::string prefix, bool promiscuous=false) [member function]
cls.add_method('EnablePcapAll',
'void',
[param('std::string', 'prefix'), param('bool', 'promiscuous', default_value='false')])
## trace-helper.h (module 'network'): void ns3::PcapHelperForDevice::EnablePcapInternal(std::string prefix, ns3::Ptr<ns3::NetDevice> nd, bool promiscuous, bool explicitFilename) [member function]
cls.add_method('EnablePcapInternal',
'void',
[param('std::string', 'prefix'), param('ns3::Ptr< ns3::NetDevice >', 'nd'), param('bool', 'promiscuous'), param('bool', 'explicitFilename')],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3QueueSize_methods(root_module, cls):
cls.add_output_stream_operator()
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('<=')
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('>')
cls.add_binary_comparison_operator('>=')
## queue-size.h (module 'network'): ns3::QueueSize::QueueSize(ns3::QueueSize const & arg0) [constructor]
cls.add_constructor([param('ns3::QueueSize const &', 'arg0')])
## queue-size.h (module 'network'): ns3::QueueSize::QueueSize() [constructor]
cls.add_constructor([])
## queue-size.h (module 'network'): ns3::QueueSize::QueueSize(ns3::QueueSizeUnit unit, uint32_t value) [constructor]
cls.add_constructor([param('ns3::QueueSizeUnit', 'unit'), param('uint32_t', 'value')])
## queue-size.h (module 'network'): ns3::QueueSize::QueueSize(std::string size) [constructor]
cls.add_constructor([param('std::string', 'size')])
## queue-size.h (module 'network'): ns3::QueueSizeUnit ns3::QueueSize::GetUnit() const [member function]
cls.add_method('GetUnit',
'ns3::QueueSizeUnit',
[],
is_const=True)
## queue-size.h (module 'network'): uint32_t ns3::QueueSize::GetValue() const [member function]
cls.add_method('GetValue',
'uint32_t',
[],
is_const=True)
return
def register_Ns3SequenceNumber32_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_binary_numeric_operator('+', root_module['ns3::SequenceNumber32'], root_module['ns3::SequenceNumber32'], param('ns3::SequenceNumber< unsigned int, int > const &', u'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::SequenceNumber32'], root_module['ns3::SequenceNumber32'], param('int', u'right'))
cls.add_inplace_numeric_operator('+=', param('int', u'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::SequenceNumber32'], root_module['ns3::SequenceNumber32'], param('int', u'right'))
cls.add_inplace_numeric_operator('-=', param('int', u'right'))
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('<=')
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('>')
cls.add_binary_comparison_operator('>=')
## sequence-number.h (module 'network'): ns3::SequenceNumber<unsigned int, int>::SequenceNumber() [constructor]
cls.add_constructor([])
## sequence-number.h (module 'network'): ns3::SequenceNumber<unsigned int, int>::SequenceNumber(unsigned int value) [constructor]
cls.add_constructor([param('unsigned int', 'value')])
## sequence-number.h (module 'network'): ns3::SequenceNumber<unsigned int, int>::SequenceNumber(ns3::SequenceNumber<unsigned int, int> const & value) [constructor]
cls.add_constructor([param('ns3::SequenceNumber< unsigned int, int > const &', 'value')])
## sequence-number.h (module 'network'): unsigned int ns3::SequenceNumber<unsigned int, int>::GetValue() const [member function]
cls.add_method('GetValue',
'unsigned int',
[],
is_const=True)
return
def register_Ns3SequenceNumber16_methods(root_module, cls):
cls.add_binary_comparison_operator('!=')
cls.add_binary_numeric_operator('+', root_module['ns3::SequenceNumber16'], root_module['ns3::SequenceNumber16'], param('ns3::SequenceNumber< unsigned short, short > const &', u'right'))
cls.add_binary_numeric_operator('+', root_module['ns3::SequenceNumber16'], root_module['ns3::SequenceNumber16'], param('short int', u'right'))
cls.add_inplace_numeric_operator('+=', param('short int', u'right'))
cls.add_binary_numeric_operator('-', root_module['ns3::SequenceNumber16'], root_module['ns3::SequenceNumber16'], param('short int', u'right'))
cls.add_inplace_numeric_operator('-=', param('short int', u'right'))
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('<=')
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('>')
cls.add_binary_comparison_operator('>=')
## sequence-number.h (module 'network'): ns3::SequenceNumber<unsigned short, short>::SequenceNumber() [constructor]
cls.add_constructor([])
## sequence-number.h (module 'network'): ns3::SequenceNumber<unsigned short, short>::SequenceNumber(short unsigned int value) [constructor]
cls.add_constructor([param('short unsigned int', 'value')])
## sequence-number.h (module 'network'): ns3::SequenceNumber<unsigned short, short>::SequenceNumber(ns3::SequenceNumber<unsigned short, short> const & value) [constructor]
cls.add_constructor([param('ns3::SequenceNumber< unsigned short, short > const &', 'value')])
## sequence-number.h (module 'network'): short unsigned int ns3::SequenceNumber<unsigned short, short>::GetValue() const [member function]
cls.add_method('GetValue',
'short unsigned int',
[],
is_const=True)
return
def register_Ns3SimpleNetDeviceHelper_methods(root_module, cls):
## simple-net-device-helper.h (module 'network'): ns3::SimpleNetDeviceHelper::SimpleNetDeviceHelper(ns3::SimpleNetDeviceHelper const & arg0) [constructor]
cls.add_constructor([param('ns3::SimpleNetDeviceHelper const &', 'arg0')])
## simple-net-device-helper.h (module 'network'): ns3::SimpleNetDeviceHelper::SimpleNetDeviceHelper() [constructor]
cls.add_constructor([])
## simple-net-device-helper.h (module 'network'): ns3::NetDeviceContainer ns3::SimpleNetDeviceHelper::Install(ns3::Ptr<ns3::Node> node) const [member function]
cls.add_method('Install',
'ns3::NetDeviceContainer',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_const=True)
## simple-net-device-helper.h (module 'network'): ns3::NetDeviceContainer ns3::SimpleNetDeviceHelper::Install(ns3::Ptr<ns3::Node> node, ns3::Ptr<ns3::SimpleChannel> channel) const [member function]
cls.add_method('Install',
'ns3::NetDeviceContainer',
[param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::Ptr< ns3::SimpleChannel >', 'channel')],
is_const=True)
## simple-net-device-helper.h (module 'network'): ns3::NetDeviceContainer ns3::SimpleNetDeviceHelper::Install(ns3::NodeContainer const & c) const [member function]
cls.add_method('Install',
'ns3::NetDeviceContainer',
[param('ns3::NodeContainer const &', 'c')],
is_const=True)
## simple-net-device-helper.h (module 'network'): ns3::NetDeviceContainer ns3::SimpleNetDeviceHelper::Install(ns3::NodeContainer const & c, ns3::Ptr<ns3::SimpleChannel> channel) const [member function]
cls.add_method('Install',
'ns3::NetDeviceContainer',
[param('ns3::NodeContainer const &', 'c'), param('ns3::Ptr< ns3::SimpleChannel >', 'channel')],
is_const=True)
## simple-net-device-helper.h (module 'network'): void ns3::SimpleNetDeviceHelper::SetChannel(std::string type, 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()) [member function]
cls.add_method('SetChannel',
'void',
[param('std::string', 'type'), 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()')])
## simple-net-device-helper.h (module 'network'): void ns3::SimpleNetDeviceHelper::SetChannelAttribute(std::string n1, ns3::AttributeValue const & v1) [member function]
cls.add_method('SetChannelAttribute',
'void',
[param('std::string', 'n1'), param('ns3::AttributeValue const &', 'v1')])
## simple-net-device-helper.h (module 'network'): void ns3::SimpleNetDeviceHelper::SetDeviceAttribute(std::string n1, ns3::AttributeValue const & v1) [member function]
cls.add_method('SetDeviceAttribute',
'void',
[param('std::string', 'n1'), param('ns3::AttributeValue const &', 'v1')])
## simple-net-device-helper.h (module 'network'): void ns3::SimpleNetDeviceHelper::SetNetDevicePointToPointMode(bool pointToPointMode) [member function]
cls.add_method('SetNetDevicePointToPointMode',
'void',
[param('bool', 'pointToPointMode')])
## simple-net-device-helper.h (module 'network'): void ns3::SimpleNetDeviceHelper::SetQueue(std::string type, 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()) [member function]
cls.add_method('SetQueue',
'void',
[param('std::string', 'type'), 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()')])
return
def register_Ns3SimpleRefCount__Ns3Object_Ns3ObjectBase_Ns3ObjectDeleter_methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::SimpleRefCount(ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter> const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter > const &', 'o')])
return
def register_Ns3Simulator_methods(root_module, cls):
## simulator.h (module 'core'): ns3::Simulator::Simulator(ns3::Simulator const & arg0) [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 uint64_t ns3::Simulator::GetEventCount() [member function]
cls.add_method('GetEventCount',
'uint64_t',
[],
is_static=True)
## simulator.h (module 'core'): static ns3::Ptr<ns3::SimulatorImpl> 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<ns3::SimulatorImpl> 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_Ns3StatisticalSummary_methods(root_module, cls):
## data-calculator.h (module 'stats'): ns3::StatisticalSummary::StatisticalSummary() [constructor]
cls.add_constructor([])
## data-calculator.h (module 'stats'): ns3::StatisticalSummary::StatisticalSummary(ns3::StatisticalSummary const & arg0) [constructor]
cls.add_constructor([param('ns3::StatisticalSummary const &', 'arg0')])
## data-calculator.h (module 'stats'): long int ns3::StatisticalSummary::getCount() const [member function]
cls.add_method('getCount',
'long int',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getMax() const [member function]
cls.add_method('getMax',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getMean() const [member function]
cls.add_method('getMean',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getMin() const [member function]
cls.add_method('getMin',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getSqrSum() const [member function]
cls.add_method('getSqrSum',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getStddev() const [member function]
cls.add_method('getStddev',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getSum() const [member function]
cls.add_method('getSum',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): double ns3::StatisticalSummary::getVariance() const [member function]
cls.add_method('getVariance',
'double',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3SystemWallClockMs_methods(root_module, cls):
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs::SystemWallClockMs(ns3::SystemWallClockMs const & arg0) [constructor]
cls.add_constructor([param('ns3::SystemWallClockMs const &', 'arg0')])
## system-wall-clock-ms.h (module 'core'): ns3::SystemWallClockMs::SystemWallClockMs() [constructor]
cls.add_constructor([])
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::End() [member function]
cls.add_method('End',
'int64_t',
[])
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::GetElapsedReal() const [member function]
cls.add_method('GetElapsedReal',
'int64_t',
[],
is_const=True)
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::GetElapsedSystem() const [member function]
cls.add_method('GetElapsedSystem',
'int64_t',
[],
is_const=True)
## system-wall-clock-ms.h (module 'core'): int64_t ns3::SystemWallClockMs::GetElapsedUser() const [member function]
cls.add_method('GetElapsedUser',
'int64_t',
[],
is_const=True)
## system-wall-clock-ms.h (module 'core'): void ns3::SystemWallClockMs::Start() [member function]
cls.add_method('Start',
'void',
[])
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) [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) [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 v) [member function]
cls.add_method('WriteU16',
'void',
[param('uint16_t', 'v')])
## tag-buffer.h (module 'network'): void ns3::TagBuffer::WriteU32(uint32_t v) [member function]
cls.add_method('WriteU32',
'void',
[param('uint32_t', 'v')])
## 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_Ns3TimeWithUnit_methods(root_module, cls):
cls.add_output_stream_operator()
## nstime.h (module 'core'): ns3::TimeWithUnit::TimeWithUnit(ns3::TimeWithUnit const & arg0) [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__Unsigned_int_methods(root_module, cls):
## traced-value.h (module 'core'): ns3::TracedValue<unsigned int>::TracedValue() [constructor]
cls.add_constructor([])
## traced-value.h (module 'core'): ns3::TracedValue<unsigned int>::TracedValue(ns3::TracedValue<unsigned int> const & o) [constructor]
cls.add_constructor([param('ns3::TracedValue< unsigned int > const &', 'o')])
## traced-value.h (module 'core'): ns3::TracedValue<unsigned int>::TracedValue(unsigned int const & v) [constructor]
cls.add_constructor([param('unsigned int const &', 'v')])
## traced-value.h (module 'core'): ns3::TracedValue<unsigned int>::TracedValue(ns3::TracedValue<unsigned int> const & other) [constructor]
cls.add_constructor([param('ns3::TracedValue< unsigned int > const &', 'other')])
## traced-value.h (module 'core'): ns3::TracedValue<unsigned int>::TracedValue(ns3::TracedValue<unsigned int> const & other) [constructor]
cls.add_constructor([param('ns3::TracedValue< unsigned int > const &', 'other')])
## traced-value.h (module 'core'): void ns3::TracedValue<unsigned int>::Connect(ns3::CallbackBase const & cb, std::string 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<unsigned int>::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<unsigned int>::Disconnect(ns3::CallbackBase const & cb, std::string 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<unsigned int>::DisconnectWithoutContext(ns3::CallbackBase const & cb) [member function]
cls.add_method('DisconnectWithoutContext',
'void',
[param('ns3::CallbackBase const &', 'cb')])
## traced-value.h (module 'core'): unsigned int ns3::TracedValue<unsigned int>::Get() const [member function]
cls.add_method('Get',
'unsigned int',
[],
is_const=True)
## traced-value.h (module 'core'): void ns3::TracedValue<unsigned int>::Set(unsigned int const & v) [member function]
cls.add_method('Set',
'void',
[param('unsigned int 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) [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<const ns3::AttributeAccessor> accessor, ns3::Ptr<const ns3::AttributeChecker> checker, ns3::TypeId::SupportLevel supportLevel=::ns3::TypeId::SupportLevel::SUPPORTED, std::string const & supportMsg="") [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'), param('ns3::TypeId::SupportLevel', 'supportLevel', default_value='::ns3::TypeId::SupportLevel::SUPPORTED'), param('std::string const &', 'supportMsg', default_value='""')])
## 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<const ns3::AttributeAccessor> accessor, ns3::Ptr<const ns3::AttributeChecker> checker, ns3::TypeId::SupportLevel supportLevel=::ns3::TypeId::SupportLevel::SUPPORTED, std::string const & supportMsg="") [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'), param('ns3::TypeId::SupportLevel', 'supportLevel', default_value='::ns3::TypeId::SupportLevel::SUPPORTED'), param('std::string const &', 'supportMsg', default_value='""')])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::AddTraceSource(std::string name, std::string help, ns3::Ptr<const ns3::TraceSourceAccessor> 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<const ns3::TraceSourceAccessor> accessor, std::string callback, ns3::TypeId::SupportLevel supportLevel=::ns3::TypeId::SupportLevel::SUPPORTED, std::string const & supportMsg="") [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'), param('ns3::TypeId::SupportLevel', 'supportLevel', default_value='::ns3::TypeId::SupportLevel::SUPPORTED'), param('std::string const &', 'supportMsg', default_value='""')])
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation ns3::TypeId::GetAttribute(std::size_t i) const [member function]
cls.add_method('GetAttribute',
'ns3::TypeId::AttributeInformation',
[param('std::size_t', 'i')],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeId::GetAttributeFullName(std::size_t i) const [member function]
cls.add_method('GetAttributeFullName',
'std::string',
[param('std::size_t', 'i')],
is_const=True)
## type-id.h (module 'core'): std::size_t ns3::TypeId::GetAttributeN() const [member function]
cls.add_method('GetAttributeN',
'std::size_t',
[],
is_const=True)
## type-id.h (module 'core'): ns3::Callback<ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> 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'): ns3::TypeId::hash_t ns3::TypeId::GetHash() const [member function]
cls.add_method('GetHash',
'ns3::TypeId::hash_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(uint16_t i) [member function]
cls.add_method('GetRegistered',
'ns3::TypeId',
[param('uint16_t', 'i')],
is_static=True)
## type-id.h (module 'core'): static uint16_t ns3::TypeId::GetRegisteredN() [member function]
cls.add_method('GetRegisteredN',
'uint16_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(std::size_t i) const [member function]
cls.add_method('GetTraceSource',
'ns3::TypeId::TraceSourceInformation',
[param('std::size_t', 'i')],
is_const=True)
## type-id.h (module 'core'): std::size_t ns3::TypeId::GetTraceSourceN() const [member function]
cls.add_method('GetTraceSourceN',
'std::size_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(ns3::TypeId::hash_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(ns3::TypeId::hash_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<const ns3::TraceSourceAccessor> 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'): ns3::Ptr<const ns3::TraceSourceAccessor> ns3::TypeId::LookupTraceSourceByName(std::string name, ns3::TypeId::TraceSourceInformation * info) const [member function]
cls.add_method('LookupTraceSourceByName',
'ns3::Ptr< ns3::TraceSourceAccessor const >',
[param('std::string', 'name'), param('ns3::TypeId::TraceSourceInformation *', 'info')],
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(std::size_t i, ns3::Ptr<const ns3::AttributeValue> initialValue) [member function]
cls.add_method('SetAttributeInitialValue',
'bool',
[param('std::size_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::SetParent() [member function]
cls.add_method('SetParent',
'ns3::TypeId',
[],
template_parameters=[u'ns3::QueueBase'])
## type-id.h (module 'core'): ns3::TypeId ns3::TypeId::SetParent() [member function]
cls.add_method('SetParent',
'ns3::TypeId',
[],
template_parameters=[u'ns3::Object'])
## 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 uid) [member function]
cls.add_method('SetUid',
'void',
[param('uint16_t', 'uid')])
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) [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)
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)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::supportLevel [variable]
cls.add_instance_attribute('supportLevel', 'ns3::TypeId::SupportLevel', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::AttributeInformation::supportMsg [variable]
cls.add_instance_attribute('supportMsg', 'std::string', 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) [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)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::supportLevel [variable]
cls.add_instance_attribute('supportLevel', 'ns3::TypeId::SupportLevel', is_const=False)
## type-id.h (module 'core'): ns3::TypeId::TraceSourceInformation::supportMsg [variable]
cls.add_instance_attribute('supportMsg', 'std::string', 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) [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::Time'], root_module['ns3::int64x64_t'], param('ns3::Time 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_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_comparison_operator('!=')
cls.add_binary_comparison_operator('<=')
cls.add_binary_comparison_operator('>=')
cls.add_output_stream_operator()
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_unary_numeric_operator('-')
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t() [constructor]
cls.add_constructor([])
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t(double const value) [constructor]
cls.add_constructor([param('double const', 'value')])
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t(long double const value) [constructor]
cls.add_constructor([param('long double const', 'value')])
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t(int const v) [constructor]
cls.add_constructor([param('int const', 'v')])
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t(long int const v) [constructor]
cls.add_constructor([param('long int const', 'v')])
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t(long long int const v) [constructor]
cls.add_constructor([param('long long int const', 'v')])
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t(unsigned int const v) [constructor]
cls.add_constructor([param('unsigned int const', 'v')])
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t(long unsigned int const v) [constructor]
cls.add_constructor([param('long unsigned int const', 'v')])
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t(long long unsigned int const v) [constructor]
cls.add_constructor([param('long long unsigned int const', 'v')])
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t(int64_t const hi, uint64_t const lo) [constructor]
cls.add_constructor([param('int64_t const', 'hi'), param('uint64_t const', 'lo')])
## int64x64-128.h (module 'core'): ns3::int64x64_t::int64x64_t(ns3::int64x64_t const & o) [constructor]
cls.add_constructor([param('ns3::int64x64_t const &', 'o')])
## int64x64-128.h (module 'core'): double ns3::int64x64_t::GetDouble() const [member function]
cls.add_method('GetDouble',
'double',
[],
is_const=True)
## int64x64-128.h (module 'core'): int64_t ns3::int64x64_t::GetHigh() const [member function]
cls.add_method('GetHigh',
'int64_t',
[],
is_const=True)
## int64x64-128.h (module 'core'): uint64_t ns3::int64x64_t::GetLow() const [member function]
cls.add_method('GetLow',
'uint64_t',
[],
is_const=True)
## int64x64-128.h (module 'core'): static ns3::int64x64_t ns3::int64x64_t::Invert(uint64_t const v) [member function]
cls.add_method('Invert',
'ns3::int64x64_t',
[param('uint64_t const', 'v')],
is_static=True)
## int64x64-128.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-128.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_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) [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'): uint32_t ns3::Chunk::Deserialize(ns3::Buffer::Iterator start, ns3::Buffer::Iterator end) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start'), param('ns3::Buffer::Iterator', 'end')],
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_Ns3DeviceNameTag_methods(root_module, cls):
## packet-socket.h (module 'network'): ns3::DeviceNameTag::DeviceNameTag(ns3::DeviceNameTag const & arg0) [constructor]
cls.add_constructor([param('ns3::DeviceNameTag const &', 'arg0')])
## packet-socket.h (module 'network'): ns3::DeviceNameTag::DeviceNameTag() [constructor]
cls.add_constructor([])
## packet-socket.h (module 'network'): void ns3::DeviceNameTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## packet-socket.h (module 'network'): std::string ns3::DeviceNameTag::GetDeviceName() const [member function]
cls.add_method('GetDeviceName',
'std::string',
[],
is_const=True)
## packet-socket.h (module 'network'): ns3::TypeId ns3::DeviceNameTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): uint32_t ns3::DeviceNameTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): static ns3::TypeId ns3::DeviceNameTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## packet-socket.h (module 'network'): void ns3::DeviceNameTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): void ns3::DeviceNameTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): void ns3::DeviceNameTag::SetDeviceName(std::string n) [member function]
cls.add_method('SetDeviceName',
'void',
[param('std::string', 'n')])
return
def register_Ns3FlowIdTag_methods(root_module, cls):
## flow-id-tag.h (module 'network'): ns3::FlowIdTag::FlowIdTag(ns3::FlowIdTag const & arg0) [constructor]
cls.add_constructor([param('ns3::FlowIdTag const &', 'arg0')])
## flow-id-tag.h (module 'network'): ns3::FlowIdTag::FlowIdTag() [constructor]
cls.add_constructor([])
## flow-id-tag.h (module 'network'): ns3::FlowIdTag::FlowIdTag(uint32_t flowId) [constructor]
cls.add_constructor([param('uint32_t', 'flowId')])
## flow-id-tag.h (module 'network'): static uint32_t ns3::FlowIdTag::AllocateFlowId() [member function]
cls.add_method('AllocateFlowId',
'uint32_t',
[],
is_static=True)
## flow-id-tag.h (module 'network'): void ns3::FlowIdTag::Deserialize(ns3::TagBuffer buf) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'buf')],
is_virtual=True)
## flow-id-tag.h (module 'network'): uint32_t ns3::FlowIdTag::GetFlowId() const [member function]
cls.add_method('GetFlowId',
'uint32_t',
[],
is_const=True)
## flow-id-tag.h (module 'network'): ns3::TypeId ns3::FlowIdTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## flow-id-tag.h (module 'network'): uint32_t ns3::FlowIdTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## flow-id-tag.h (module 'network'): static ns3::TypeId ns3::FlowIdTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## flow-id-tag.h (module 'network'): void ns3::FlowIdTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## flow-id-tag.h (module 'network'): void ns3::FlowIdTag::Serialize(ns3::TagBuffer buf) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'buf')],
is_const=True, is_virtual=True)
## flow-id-tag.h (module 'network'): void ns3::FlowIdTag::SetFlowId(uint32_t flowId) [member function]
cls.add_method('SetFlowId',
'void',
[param('uint32_t', 'flowId')])
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) [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_Ns3LlcSnapHeader_methods(root_module, cls):
## llc-snap-header.h (module 'network'): ns3::LlcSnapHeader::LlcSnapHeader(ns3::LlcSnapHeader const & arg0) [constructor]
cls.add_constructor([param('ns3::LlcSnapHeader const &', 'arg0')])
## llc-snap-header.h (module 'network'): ns3::LlcSnapHeader::LlcSnapHeader() [constructor]
cls.add_constructor([])
## llc-snap-header.h (module 'network'): uint32_t ns3::LlcSnapHeader::Deserialize(ns3::Buffer::Iterator start) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start')],
is_virtual=True)
## llc-snap-header.h (module 'network'): ns3::TypeId ns3::LlcSnapHeader::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## llc-snap-header.h (module 'network'): uint32_t ns3::LlcSnapHeader::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## llc-snap-header.h (module 'network'): uint16_t ns3::LlcSnapHeader::GetType() [member function]
cls.add_method('GetType',
'uint16_t',
[])
## llc-snap-header.h (module 'network'): static ns3::TypeId ns3::LlcSnapHeader::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## llc-snap-header.h (module 'network'): void ns3::LlcSnapHeader::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## llc-snap-header.h (module 'network'): void ns3::LlcSnapHeader::Serialize(ns3::Buffer::Iterator start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'start')],
is_const=True, is_virtual=True)
## llc-snap-header.h (module 'network'): void ns3::LlcSnapHeader::SetType(uint16_t type) [member function]
cls.add_method('SetType',
'void',
[param('uint16_t', 'type')])
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<ns3::Object> 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'): bool ns3::Object::IsInitialized() const [member function]
cls.add_method('IsInitialized',
'bool',
[],
is_const=True)
## object.h (module 'core'): ns3::Object::Object(ns3::Object const & o) [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) [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<const ns3::Object> ns3::Object::AggregateIterator::Next() [member function]
cls.add_method('Next',
'ns3::Ptr< ns3::Object const >',
[])
return
def register_Ns3PacketBurst_methods(root_module, cls):
## packet-burst.h (module 'network'): ns3::PacketBurst::PacketBurst(ns3::PacketBurst const & arg0) [constructor]
cls.add_constructor([param('ns3::PacketBurst const &', 'arg0')])
## packet-burst.h (module 'network'): ns3::PacketBurst::PacketBurst() [constructor]
cls.add_constructor([])
## packet-burst.h (module 'network'): void ns3::PacketBurst::AddPacket(ns3::Ptr<ns3::Packet> packet) [member function]
cls.add_method('AddPacket',
'void',
[param('ns3::Ptr< ns3::Packet >', 'packet')])
## packet-burst.h (module 'network'): std::list<ns3::Ptr<ns3::Packet>, std::allocator<ns3::Ptr<ns3::Packet> > >::const_iterator ns3::PacketBurst::Begin() const [member function]
cls.add_method('Begin',
'std::list< ns3::Ptr< ns3::Packet > > const_iterator',
[],
is_const=True)
## packet-burst.h (module 'network'): ns3::Ptr<ns3::PacketBurst> ns3::PacketBurst::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::PacketBurst >',
[],
is_const=True)
## packet-burst.h (module 'network'): std::list<ns3::Ptr<ns3::Packet>, std::allocator<ns3::Ptr<ns3::Packet> > >::const_iterator ns3::PacketBurst::End() const [member function]
cls.add_method('End',
'std::list< ns3::Ptr< ns3::Packet > > const_iterator',
[],
is_const=True)
## packet-burst.h (module 'network'): uint32_t ns3::PacketBurst::GetNPackets() const [member function]
cls.add_method('GetNPackets',
'uint32_t',
[],
is_const=True)
## packet-burst.h (module 'network'): std::list<ns3::Ptr<ns3::Packet>, std::allocator<ns3::Ptr<ns3::Packet> > > ns3::PacketBurst::GetPackets() const [member function]
cls.add_method('GetPackets',
'std::list< ns3::Ptr< ns3::Packet > >',
[],
is_const=True)
## packet-burst.h (module 'network'): uint32_t ns3::PacketBurst::GetSize() const [member function]
cls.add_method('GetSize',
'uint32_t',
[],
is_const=True)
## packet-burst.h (module 'network'): static ns3::TypeId ns3::PacketBurst::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## packet-burst.h (module 'network'): void ns3::PacketBurst::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3PacketSocketTag_methods(root_module, cls):
## packet-socket.h (module 'network'): ns3::PacketSocketTag::PacketSocketTag(ns3::PacketSocketTag const & arg0) [constructor]
cls.add_constructor([param('ns3::PacketSocketTag const &', 'arg0')])
## packet-socket.h (module 'network'): ns3::PacketSocketTag::PacketSocketTag() [constructor]
cls.add_constructor([])
## packet-socket.h (module 'network'): void ns3::PacketSocketTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## packet-socket.h (module 'network'): ns3::Address ns3::PacketSocketTag::GetDestAddress() const [member function]
cls.add_method('GetDestAddress',
'ns3::Address',
[],
is_const=True)
## packet-socket.h (module 'network'): ns3::TypeId ns3::PacketSocketTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): ns3::NetDevice::PacketType ns3::PacketSocketTag::GetPacketType() const [member function]
cls.add_method('GetPacketType',
'ns3::NetDevice::PacketType',
[],
is_const=True)
## packet-socket.h (module 'network'): uint32_t ns3::PacketSocketTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): static ns3::TypeId ns3::PacketSocketTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## packet-socket.h (module 'network'): void ns3::PacketSocketTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): void ns3::PacketSocketTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): void ns3::PacketSocketTag::SetDestAddress(ns3::Address a) [member function]
cls.add_method('SetDestAddress',
'void',
[param('ns3::Address', 'a')])
## packet-socket.h (module 'network'): void ns3::PacketSocketTag::SetPacketType(ns3::NetDevice::PacketType t) [member function]
cls.add_method('SetPacketType',
'void',
[param('ns3::NetDevice::PacketType', 't')])
return
def register_Ns3PcapFileWrapper_methods(root_module, cls):
## pcap-file-wrapper.h (module 'network'): static ns3::TypeId ns3::PcapFileWrapper::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## pcap-file-wrapper.h (module 'network'): ns3::PcapFileWrapper::PcapFileWrapper() [constructor]
cls.add_constructor([])
## pcap-file-wrapper.h (module 'network'): bool ns3::PcapFileWrapper::Fail() const [member function]
cls.add_method('Fail',
'bool',
[],
is_const=True)
## pcap-file-wrapper.h (module 'network'): bool ns3::PcapFileWrapper::Eof() const [member function]
cls.add_method('Eof',
'bool',
[],
is_const=True)
## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Clear() [member function]
cls.add_method('Clear',
'void',
[])
## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Open(std::string const & filename, std::ios_base::openmode mode) [member function]
cls.add_method('Open',
'void',
[param('std::string const &', 'filename'), param('std::ios_base::openmode', 'mode')])
## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Close() [member function]
cls.add_method('Close',
'void',
[])
## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Init(uint32_t dataLinkType, uint32_t snapLen=std::numeric_limits<unsigned int>::max(), int32_t tzCorrection=ns3::PcapFile::ZONE_DEFAULT) [member function]
cls.add_method('Init',
'void',
[param('uint32_t', 'dataLinkType'), param('uint32_t', 'snapLen', default_value='std::numeric_limits<unsigned int>::max()'), param('int32_t', 'tzCorrection', default_value='ns3::PcapFile::ZONE_DEFAULT')])
## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Write(ns3::Time t, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('Write',
'void',
[param('ns3::Time', 't'), param('ns3::Ptr< ns3::Packet const >', 'p')])
## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Write(ns3::Time t, ns3::Header const & header, ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('Write',
'void',
[param('ns3::Time', 't'), param('ns3::Header const &', 'header'), param('ns3::Ptr< ns3::Packet const >', 'p')])
## pcap-file-wrapper.h (module 'network'): void ns3::PcapFileWrapper::Write(ns3::Time t, uint8_t const * buffer, uint32_t length) [member function]
cls.add_method('Write',
'void',
[param('ns3::Time', 't'), param('uint8_t const *', 'buffer'), param('uint32_t', 'length')])
## pcap-file-wrapper.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::PcapFileWrapper::Read(ns3::Time & t) [member function]
cls.add_method('Read',
'ns3::Ptr< ns3::Packet >',
[param('ns3::Time &', 't')])
## pcap-file-wrapper.h (module 'network'): uint32_t ns3::PcapFileWrapper::GetMagic() [member function]
cls.add_method('GetMagic',
'uint32_t',
[])
## pcap-file-wrapper.h (module 'network'): uint16_t ns3::PcapFileWrapper::GetVersionMajor() [member function]
cls.add_method('GetVersionMajor',
'uint16_t',
[])
## pcap-file-wrapper.h (module 'network'): uint16_t ns3::PcapFileWrapper::GetVersionMinor() [member function]
cls.add_method('GetVersionMinor',
'uint16_t',
[])
## pcap-file-wrapper.h (module 'network'): int32_t ns3::PcapFileWrapper::GetTimeZoneOffset() [member function]
cls.add_method('GetTimeZoneOffset',
'int32_t',
[])
## pcap-file-wrapper.h (module 'network'): uint32_t ns3::PcapFileWrapper::GetSigFigs() [member function]
cls.add_method('GetSigFigs',
'uint32_t',
[])
## pcap-file-wrapper.h (module 'network'): uint32_t ns3::PcapFileWrapper::GetSnapLen() [member function]
cls.add_method('GetSnapLen',
'uint32_t',
[])
## pcap-file-wrapper.h (module 'network'): uint32_t ns3::PcapFileWrapper::GetDataLinkType() [member function]
cls.add_method('GetDataLinkType',
'uint32_t',
[])
return
def register_Ns3QueueBase_methods(root_module, cls):
## queue.h (module 'network'): ns3::QueueBase::QueueBase(ns3::QueueBase const & arg0) [constructor]
cls.add_constructor([param('ns3::QueueBase const &', 'arg0')])
## queue.h (module 'network'): ns3::QueueBase::QueueBase() [constructor]
cls.add_constructor([])
## queue.h (module 'network'): static void ns3::QueueBase::AppendItemTypeIfNotPresent(std::string & typeId, std::string const & itemType) [member function]
cls.add_method('AppendItemTypeIfNotPresent',
'void',
[param('std::string &', 'typeId'), param('std::string const &', 'itemType')],
is_static=True)
## queue.h (module 'network'): ns3::QueueSize ns3::QueueBase::GetCurrentSize() const [member function]
cls.add_method('GetCurrentSize',
'ns3::QueueSize',
[],
is_const=True)
## queue.h (module 'network'): ns3::QueueSize ns3::QueueBase::GetMaxSize() const [member function]
cls.add_method('GetMaxSize',
'ns3::QueueSize',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::QueueBase::GetNBytes() const [member function]
cls.add_method('GetNBytes',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::QueueBase::GetNPackets() const [member function]
cls.add_method('GetNPackets',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::QueueBase::GetTotalDroppedBytes() const [member function]
cls.add_method('GetTotalDroppedBytes',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::QueueBase::GetTotalDroppedBytesAfterDequeue() const [member function]
cls.add_method('GetTotalDroppedBytesAfterDequeue',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::QueueBase::GetTotalDroppedBytesBeforeEnqueue() const [member function]
cls.add_method('GetTotalDroppedBytesBeforeEnqueue',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::QueueBase::GetTotalDroppedPackets() const [member function]
cls.add_method('GetTotalDroppedPackets',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::QueueBase::GetTotalDroppedPacketsAfterDequeue() const [member function]
cls.add_method('GetTotalDroppedPacketsAfterDequeue',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::QueueBase::GetTotalDroppedPacketsBeforeEnqueue() const [member function]
cls.add_method('GetTotalDroppedPacketsBeforeEnqueue',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::QueueBase::GetTotalReceivedBytes() const [member function]
cls.add_method('GetTotalReceivedBytes',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): uint32_t ns3::QueueBase::GetTotalReceivedPackets() const [member function]
cls.add_method('GetTotalReceivedPackets',
'uint32_t',
[],
is_const=True)
## queue.h (module 'network'): static ns3::TypeId ns3::QueueBase::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## queue.h (module 'network'): bool ns3::QueueBase::IsEmpty() const [member function]
cls.add_method('IsEmpty',
'bool',
[],
is_const=True)
## queue.h (module 'network'): void ns3::QueueBase::ResetStatistics() [member function]
cls.add_method('ResetStatistics',
'void',
[])
## queue.h (module 'network'): void ns3::QueueBase::SetMaxSize(ns3::QueueSize size) [member function]
cls.add_method('SetMaxSize',
'void',
[param('ns3::QueueSize', 'size')])
return
def register_Ns3QueueLimits_methods(root_module, cls):
## queue-limits.h (module 'network'): ns3::QueueLimits::QueueLimits() [constructor]
cls.add_constructor([])
## queue-limits.h (module 'network'): ns3::QueueLimits::QueueLimits(ns3::QueueLimits const & arg0) [constructor]
cls.add_constructor([param('ns3::QueueLimits const &', 'arg0')])
## queue-limits.h (module 'network'): int32_t ns3::QueueLimits::Available() const [member function]
cls.add_method('Available',
'int32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## queue-limits.h (module 'network'): void ns3::QueueLimits::Completed(uint32_t count) [member function]
cls.add_method('Completed',
'void',
[param('uint32_t', 'count')],
is_pure_virtual=True, is_virtual=True)
## queue-limits.h (module 'network'): static ns3::TypeId ns3::QueueLimits::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## queue-limits.h (module 'network'): void ns3::QueueLimits::Queued(uint32_t count) [member function]
cls.add_method('Queued',
'void',
[param('uint32_t', 'count')],
is_pure_virtual=True, is_virtual=True)
## queue-limits.h (module 'network'): void ns3::QueueLimits::Reset() [member function]
cls.add_method('Reset',
'void',
[],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3RadiotapHeader_methods(root_module, cls):
## radiotap-header.h (module 'network'): ns3::RadiotapHeader::RadiotapHeader(ns3::RadiotapHeader const & arg0) [constructor]
cls.add_constructor([param('ns3::RadiotapHeader const &', 'arg0')])
## radiotap-header.h (module 'network'): ns3::RadiotapHeader::RadiotapHeader() [constructor]
cls.add_constructor([])
## radiotap-header.h (module 'network'): uint32_t ns3::RadiotapHeader::Deserialize(ns3::Buffer::Iterator start) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start')],
is_virtual=True)
## radiotap-header.h (module 'network'): ns3::TypeId ns3::RadiotapHeader::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## radiotap-header.h (module 'network'): uint32_t ns3::RadiotapHeader::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## radiotap-header.h (module 'network'): static ns3::TypeId ns3::RadiotapHeader::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::Serialize(ns3::Buffer::Iterator start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'start')],
is_const=True, is_virtual=True)
## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetAmpduStatus(uint32_t referenceNumber, uint16_t flags, uint8_t crc) [member function]
cls.add_method('SetAmpduStatus',
'void',
[param('uint32_t', 'referenceNumber'), param('uint16_t', 'flags'), param('uint8_t', 'crc')])
## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetAntennaNoisePower(double noise) [member function]
cls.add_method('SetAntennaNoisePower',
'void',
[param('double', 'noise')])
## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetAntennaSignalPower(double signal) [member function]
cls.add_method('SetAntennaSignalPower',
'void',
[param('double', 'signal')])
## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetChannelFrequencyAndFlags(uint16_t frequency, uint16_t flags) [member function]
cls.add_method('SetChannelFrequencyAndFlags',
'void',
[param('uint16_t', 'frequency'), param('uint16_t', 'flags')])
## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetFrameFlags(uint8_t flags) [member function]
cls.add_method('SetFrameFlags',
'void',
[param('uint8_t', 'flags')])
## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetHeFields(uint16_t data1, uint16_t data2, uint16_t data3, uint16_t data5) [member function]
cls.add_method('SetHeFields',
'void',
[param('uint16_t', 'data1'), param('uint16_t', 'data2'), param('uint16_t', 'data3'), param('uint16_t', 'data5')])
## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetMcsFields(uint8_t known, uint8_t flags, uint8_t mcs) [member function]
cls.add_method('SetMcsFields',
'void',
[param('uint8_t', 'known'), param('uint8_t', 'flags'), param('uint8_t', 'mcs')])
## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetRate(uint8_t rate) [member function]
cls.add_method('SetRate',
'void',
[param('uint8_t', 'rate')])
## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetTsft(uint64_t tsft) [member function]
cls.add_method('SetTsft',
'void',
[param('uint64_t', 'tsft')])
## radiotap-header.h (module 'network'): void ns3::RadiotapHeader::SetVhtFields(uint16_t known, uint8_t flags, uint8_t bandwidth, uint8_t * mcs_nss, uint8_t coding, uint8_t group_id, uint16_t partial_aid) [member function]
cls.add_method('SetVhtFields',
'void',
[param('uint16_t', 'known'), param('uint8_t', 'flags'), param('uint8_t', 'bandwidth'), param('uint8_t *', 'mcs_nss'), param('uint8_t', 'coding'), param('uint8_t', 'group_id'), param('uint16_t', 'partial_aid')])
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::RandomVariableStream> 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<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter<ns3::AttributeAccessor> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeAccessor, ns3::empty, ns3::DefaultDeleter< ns3::AttributeAccessor > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3AttributeChecker_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeChecker__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter<ns3::AttributeChecker> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeChecker, ns3::empty, ns3::DefaultDeleter< ns3::AttributeChecker > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3AttributeValue_Ns3Empty_Ns3DefaultDeleter__lt__ns3AttributeValue__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> >::SimpleRefCount(ns3::SimpleRefCount<ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter<ns3::AttributeValue> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::AttributeValue, ns3::empty, ns3::DefaultDeleter< ns3::AttributeValue > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3CallbackImplBase_Ns3Empty_Ns3DefaultDeleter__lt__ns3CallbackImplBase__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> >::SimpleRefCount(ns3::SimpleRefCount<ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter<ns3::CallbackImplBase> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::CallbackImplBase, ns3::empty, ns3::DefaultDeleter< ns3::CallbackImplBase > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3EventImpl_Ns3Empty_Ns3DefaultDeleter__lt__ns3EventImpl__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> >::SimpleRefCount(ns3::SimpleRefCount<ns3::EventImpl, ns3::empty, ns3::DefaultDeleter<ns3::EventImpl> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::EventImpl, ns3::empty, ns3::DefaultDeleter< ns3::EventImpl > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3HashImplementation_Ns3Empty_Ns3DefaultDeleter__lt__ns3HashImplementation__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> >::SimpleRefCount(ns3::SimpleRefCount<ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter<ns3::Hash::Implementation> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::Hash::Implementation, ns3::empty, ns3::DefaultDeleter< ns3::Hash::Implementation > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3NetDeviceQueue_Ns3Empty_Ns3DefaultDeleter__lt__ns3NetDeviceQueue__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter<ns3::NetDeviceQueue> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter<ns3::NetDeviceQueue> >::SimpleRefCount(ns3::SimpleRefCount<ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter<ns3::NetDeviceQueue> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::NetDeviceQueue, ns3::empty, ns3::DefaultDeleter< ns3::NetDeviceQueue > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3NixVector_Ns3Empty_Ns3DefaultDeleter__lt__ns3NixVector__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> >::SimpleRefCount(ns3::SimpleRefCount<ns3::NixVector, ns3::empty, ns3::DefaultDeleter<ns3::NixVector> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::NixVector, ns3::empty, ns3::DefaultDeleter< ns3::NixVector > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3OutputStreamWrapper_Ns3Empty_Ns3DefaultDeleter__lt__ns3OutputStreamWrapper__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> >::SimpleRefCount(ns3::SimpleRefCount<ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter<ns3::OutputStreamWrapper> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::OutputStreamWrapper, ns3::empty, ns3::DefaultDeleter< ns3::OutputStreamWrapper > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3Packet_Ns3Empty_Ns3DefaultDeleter__lt__ns3Packet__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> >::SimpleRefCount(ns3::SimpleRefCount<ns3::Packet, ns3::empty, ns3::DefaultDeleter<ns3::Packet> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::Packet, ns3::empty, ns3::DefaultDeleter< ns3::Packet > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3PbbAddressBlock_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbAddressBlock__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> >::SimpleRefCount(ns3::SimpleRefCount<ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter<ns3::PbbAddressBlock> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::PbbAddressBlock, ns3::empty, ns3::DefaultDeleter< ns3::PbbAddressBlock > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3PbbMessage_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbMessage__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter<ns3::PbbMessage> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter<ns3::PbbMessage> >::SimpleRefCount(ns3::SimpleRefCount<ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter<ns3::PbbMessage> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::PbbMessage, ns3::empty, ns3::DefaultDeleter< ns3::PbbMessage > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3PbbPacket_Ns3Header_Ns3DefaultDeleter__lt__ns3PbbPacket__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter<ns3::PbbPacket> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter<ns3::PbbPacket> >::SimpleRefCount(ns3::SimpleRefCount<ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter<ns3::PbbPacket> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::PbbPacket, ns3::Header, ns3::DefaultDeleter< ns3::PbbPacket > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3PbbTlv_Ns3Empty_Ns3DefaultDeleter__lt__ns3PbbTlv__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter<ns3::PbbTlv> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter<ns3::PbbTlv> >::SimpleRefCount(ns3::SimpleRefCount<ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter<ns3::PbbTlv> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::PbbTlv, ns3::empty, ns3::DefaultDeleter< ns3::PbbTlv > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3QueueItem_Ns3Empty_Ns3DefaultDeleter__lt__ns3QueueItem__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::QueueItem, ns3::empty, ns3::DefaultDeleter<ns3::QueueItem> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::QueueItem, ns3::empty, ns3::DefaultDeleter<ns3::QueueItem> >::SimpleRefCount(ns3::SimpleRefCount<ns3::QueueItem, ns3::empty, ns3::DefaultDeleter<ns3::QueueItem> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::QueueItem, ns3::empty, ns3::DefaultDeleter< ns3::QueueItem > > const &', 'o')])
return
def register_Ns3SimpleRefCount__Ns3TraceSourceAccessor_Ns3Empty_Ns3DefaultDeleter__lt__ns3TraceSourceAccessor__gt___methods(root_module, cls):
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount() [constructor]
cls.add_constructor([])
## simple-ref-count.h (module 'core'): ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> >::SimpleRefCount(ns3::SimpleRefCount<ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter<ns3::TraceSourceAccessor> > const & o) [constructor]
cls.add_constructor([param('ns3::SimpleRefCount< ns3::TraceSourceAccessor, ns3::empty, ns3::DefaultDeleter< ns3::TraceSourceAccessor > > const &', 'o')])
return
def register_Ns3SllHeader_methods(root_module, cls):
## sll-header.h (module 'network'): ns3::SllHeader::SllHeader(ns3::SllHeader const & arg0) [constructor]
cls.add_constructor([param('ns3::SllHeader const &', 'arg0')])
## sll-header.h (module 'network'): ns3::SllHeader::SllHeader() [constructor]
cls.add_constructor([])
## sll-header.h (module 'network'): uint32_t ns3::SllHeader::Deserialize(ns3::Buffer::Iterator start) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start')],
is_virtual=True)
## sll-header.h (module 'network'): uint16_t ns3::SllHeader::GetArpType() const [member function]
cls.add_method('GetArpType',
'uint16_t',
[],
is_const=True)
## sll-header.h (module 'network'): ns3::TypeId ns3::SllHeader::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## sll-header.h (module 'network'): ns3::SllHeader::PacketType ns3::SllHeader::GetPacketType() const [member function]
cls.add_method('GetPacketType',
'ns3::SllHeader::PacketType',
[],
is_const=True)
## sll-header.h (module 'network'): uint32_t ns3::SllHeader::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## sll-header.h (module 'network'): static ns3::TypeId ns3::SllHeader::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## sll-header.h (module 'network'): void ns3::SllHeader::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## sll-header.h (module 'network'): void ns3::SllHeader::Serialize(ns3::Buffer::Iterator start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'start')],
is_const=True, is_virtual=True)
## sll-header.h (module 'network'): void ns3::SllHeader::SetArpType(uint16_t arphdType) [member function]
cls.add_method('SetArpType',
'void',
[param('uint16_t', 'arphdType')])
## sll-header.h (module 'network'): void ns3::SllHeader::SetPacketType(ns3::SllHeader::PacketType type) [member function]
cls.add_method('SetPacketType',
'void',
[param('ns3::SllHeader::PacketType', 'type')])
return
def register_Ns3Socket_methods(root_module, cls):
## socket.h (module 'network'): ns3::Socket::Socket(ns3::Socket const & arg0) [constructor]
cls.add_constructor([param('ns3::Socket const &', 'arg0')])
## socket.h (module 'network'): ns3::Socket::Socket() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): int ns3::Socket::Bind(ns3::Address const & address) [member function]
cls.add_method('Bind',
'int',
[param('ns3::Address const &', 'address')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Bind() [member function]
cls.add_method('Bind',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Bind6() [member function]
cls.add_method('Bind6',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::BindToNetDevice(ns3::Ptr<ns3::NetDevice> netdevice) [member function]
cls.add_method('BindToNetDevice',
'void',
[param('ns3::Ptr< ns3::NetDevice >', 'netdevice')],
is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Close() [member function]
cls.add_method('Close',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Connect(ns3::Address const & address) [member function]
cls.add_method('Connect',
'int',
[param('ns3::Address const &', 'address')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): static ns3::Ptr<ns3::Socket> ns3::Socket::CreateSocket(ns3::Ptr<ns3::Node> node, ns3::TypeId tid) [member function]
cls.add_method('CreateSocket',
'ns3::Ptr< ns3::Socket >',
[param('ns3::Ptr< ns3::Node >', 'node'), param('ns3::TypeId', 'tid')],
is_static=True)
## socket.h (module 'network'): bool ns3::Socket::GetAllowBroadcast() const [member function]
cls.add_method('GetAllowBroadcast',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::Socket::GetBoundNetDevice() [member function]
cls.add_method('GetBoundNetDevice',
'ns3::Ptr< ns3::NetDevice >',
[])
## socket.h (module 'network'): ns3::Socket::SocketErrno ns3::Socket::GetErrno() const [member function]
cls.add_method('GetErrno',
'ns3::Socket::SocketErrno',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::Socket::GetIpTos() const [member function]
cls.add_method('GetIpTos',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): uint8_t ns3::Socket::GetIpTtl() const [member function]
cls.add_method('GetIpTtl',
'uint8_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::Socket::GetIpv6HopLimit() const [member function]
cls.add_method('GetIpv6HopLimit',
'uint8_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::Socket::GetIpv6Tclass() const [member function]
cls.add_method('GetIpv6Tclass',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): ns3::Ptr<ns3::Node> ns3::Socket::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::GetPeerName(ns3::Address & address) const [member function]
cls.add_method('GetPeerName',
'int',
[param('ns3::Address &', 'address')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::Socket::GetPriority() const [member function]
cls.add_method('GetPriority',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): uint32_t ns3::Socket::GetRxAvailable() const [member function]
cls.add_method('GetRxAvailable',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::GetSockName(ns3::Address & address) const [member function]
cls.add_method('GetSockName',
'int',
[param('ns3::Address &', 'address')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): ns3::Socket::SocketType ns3::Socket::GetSocketType() const [member function]
cls.add_method('GetSocketType',
'ns3::Socket::SocketType',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::Socket::GetTxAvailable() const [member function]
cls.add_method('GetTxAvailable',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## socket.h (module 'network'): static ns3::TypeId ns3::Socket::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): static uint8_t ns3::Socket::IpTos2Priority(uint8_t ipTos) [member function]
cls.add_method('IpTos2Priority',
'uint8_t',
[param('uint8_t', 'ipTos')],
is_static=True)
## socket.h (module 'network'): void ns3::Socket::Ipv6JoinGroup(ns3::Ipv6Address address, ns3::Socket::Ipv6MulticastFilterMode filterMode, std::vector<ns3::Ipv6Address, std::allocator<ns3::Ipv6Address> > sourceAddresses) [member function]
cls.add_method('Ipv6JoinGroup',
'void',
[param('ns3::Ipv6Address', 'address'), param('ns3::Socket::Ipv6MulticastFilterMode', 'filterMode'), param('std::vector< ns3::Ipv6Address >', 'sourceAddresses')],
is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::Ipv6JoinGroup(ns3::Ipv6Address address) [member function]
cls.add_method('Ipv6JoinGroup',
'void',
[param('ns3::Ipv6Address', 'address')],
is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::Ipv6LeaveGroup() [member function]
cls.add_method('Ipv6LeaveGroup',
'void',
[],
is_virtual=True)
## socket.h (module 'network'): bool ns3::Socket::IsIpRecvTos() const [member function]
cls.add_method('IsIpRecvTos',
'bool',
[],
is_const=True)
## socket.h (module 'network'): bool ns3::Socket::IsIpRecvTtl() const [member function]
cls.add_method('IsIpRecvTtl',
'bool',
[],
is_const=True)
## socket.h (module 'network'): bool ns3::Socket::IsIpv6RecvHopLimit() const [member function]
cls.add_method('IsIpv6RecvHopLimit',
'bool',
[],
is_const=True)
## socket.h (module 'network'): bool ns3::Socket::IsIpv6RecvTclass() const [member function]
cls.add_method('IsIpv6RecvTclass',
'bool',
[],
is_const=True)
## socket.h (module 'network'): bool ns3::Socket::IsRecvPktInfo() const [member function]
cls.add_method('IsRecvPktInfo',
'bool',
[],
is_const=True)
## socket.h (module 'network'): int ns3::Socket::Listen() [member function]
cls.add_method('Listen',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::Recv(uint32_t maxSize, uint32_t flags) [member function]
cls.add_method('Recv',
'ns3::Ptr< ns3::Packet >',
[param('uint32_t', 'maxSize'), param('uint32_t', 'flags')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::Recv() [member function]
cls.add_method('Recv',
'ns3::Ptr< ns3::Packet >',
[])
## socket.h (module 'network'): int ns3::Socket::Recv(uint8_t * buf, uint32_t size, uint32_t flags) [member function]
cls.add_method('Recv',
'int',
[param('uint8_t *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags')])
## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::RecvFrom(uint32_t maxSize, uint32_t flags, ns3::Address & fromAddress) [member function]
cls.add_method('RecvFrom',
'ns3::Ptr< ns3::Packet >',
[param('uint32_t', 'maxSize'), param('uint32_t', 'flags'), param('ns3::Address &', 'fromAddress')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Socket::RecvFrom(ns3::Address & fromAddress) [member function]
cls.add_method('RecvFrom',
'ns3::Ptr< ns3::Packet >',
[param('ns3::Address &', 'fromAddress')])
## socket.h (module 'network'): int ns3::Socket::RecvFrom(uint8_t * buf, uint32_t size, uint32_t flags, ns3::Address & fromAddress) [member function]
cls.add_method('RecvFrom',
'int',
[param('uint8_t *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags'), param('ns3::Address &', 'fromAddress')])
## socket.h (module 'network'): int ns3::Socket::Send(ns3::Ptr<ns3::Packet> p, uint32_t flags) [member function]
cls.add_method('Send',
'int',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('uint32_t', 'flags')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::Send(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('Send',
'int',
[param('ns3::Ptr< ns3::Packet >', 'p')])
## socket.h (module 'network'): int ns3::Socket::Send(uint8_t const * buf, uint32_t size, uint32_t flags) [member function]
cls.add_method('Send',
'int',
[param('uint8_t const *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags')])
## socket.h (module 'network'): int ns3::Socket::SendTo(ns3::Ptr<ns3::Packet> p, uint32_t flags, ns3::Address const & toAddress) [member function]
cls.add_method('SendTo',
'int',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('uint32_t', 'flags'), param('ns3::Address const &', 'toAddress')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::SendTo(uint8_t const * buf, uint32_t size, uint32_t flags, ns3::Address const & address) [member function]
cls.add_method('SendTo',
'int',
[param('uint8_t const *', 'buf'), param('uint32_t', 'size'), param('uint32_t', 'flags'), param('ns3::Address const &', 'address')])
## socket.h (module 'network'): void ns3::Socket::SetAcceptCallback(ns3::Callback<bool, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> connectionRequest, ns3::Callback<void, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> newConnectionCreated) [member function]
cls.add_method('SetAcceptCallback',
'void',
[param('ns3::Callback< bool, ns3::Ptr< ns3::Socket >, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'connectionRequest'), param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'newConnectionCreated')])
## socket.h (module 'network'): bool ns3::Socket::SetAllowBroadcast(bool allowBroadcast) [member function]
cls.add_method('SetAllowBroadcast',
'bool',
[param('bool', 'allowBroadcast')],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::SetCloseCallbacks(ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> normalClose, ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> errorClose) [member function]
cls.add_method('SetCloseCallbacks',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'normalClose'), param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'errorClose')])
## socket.h (module 'network'): void ns3::Socket::SetConnectCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> connectionSucceeded, ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> connectionFailed) [member function]
cls.add_method('SetConnectCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'connectionSucceeded'), param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'connectionFailed')])
## socket.h (module 'network'): void ns3::Socket::SetDataSentCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> dataSent) [member function]
cls.add_method('SetDataSentCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'dataSent')])
## socket.h (module 'network'): void ns3::Socket::SetIpRecvTos(bool ipv4RecvTos) [member function]
cls.add_method('SetIpRecvTos',
'void',
[param('bool', 'ipv4RecvTos')])
## socket.h (module 'network'): void ns3::Socket::SetIpRecvTtl(bool ipv4RecvTtl) [member function]
cls.add_method('SetIpRecvTtl',
'void',
[param('bool', 'ipv4RecvTtl')])
## socket.h (module 'network'): void ns3::Socket::SetIpTos(uint8_t ipTos) [member function]
cls.add_method('SetIpTos',
'void',
[param('uint8_t', 'ipTos')])
## socket.h (module 'network'): void ns3::Socket::SetIpTtl(uint8_t ipTtl) [member function]
cls.add_method('SetIpTtl',
'void',
[param('uint8_t', 'ipTtl')],
is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::SetIpv6HopLimit(uint8_t ipHopLimit) [member function]
cls.add_method('SetIpv6HopLimit',
'void',
[param('uint8_t', 'ipHopLimit')],
is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::SetIpv6RecvHopLimit(bool ipv6RecvHopLimit) [member function]
cls.add_method('SetIpv6RecvHopLimit',
'void',
[param('bool', 'ipv6RecvHopLimit')])
## socket.h (module 'network'): void ns3::Socket::SetIpv6RecvTclass(bool ipv6RecvTclass) [member function]
cls.add_method('SetIpv6RecvTclass',
'void',
[param('bool', 'ipv6RecvTclass')])
## socket.h (module 'network'): void ns3::Socket::SetIpv6Tclass(int ipTclass) [member function]
cls.add_method('SetIpv6Tclass',
'void',
[param('int', 'ipTclass')])
## socket.h (module 'network'): void ns3::Socket::SetPriority(uint8_t priority) [member function]
cls.add_method('SetPriority',
'void',
[param('uint8_t', 'priority')])
## socket.h (module 'network'): void ns3::Socket::SetRecvCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> arg0) [member function]
cls.add_method('SetRecvCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'arg0')])
## socket.h (module 'network'): void ns3::Socket::SetRecvPktInfo(bool flag) [member function]
cls.add_method('SetRecvPktInfo',
'void',
[param('bool', 'flag')])
## socket.h (module 'network'): void ns3::Socket::SetSendCallback(ns3::Callback<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> sendCb) [member function]
cls.add_method('SetSendCallback',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::Socket >, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'sendCb')])
## socket.h (module 'network'): int ns3::Socket::ShutdownRecv() [member function]
cls.add_method('ShutdownRecv',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): int ns3::Socket::ShutdownSend() [member function]
cls.add_method('ShutdownSend',
'int',
[],
is_pure_virtual=True, is_virtual=True)
## socket.h (module 'network'): void ns3::Socket::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## socket.h (module 'network'): bool ns3::Socket::IsManualIpTtl() const [member function]
cls.add_method('IsManualIpTtl',
'bool',
[],
is_const=True, visibility='protected')
## socket.h (module 'network'): bool ns3::Socket::IsManualIpv6HopLimit() const [member function]
cls.add_method('IsManualIpv6HopLimit',
'bool',
[],
is_const=True, visibility='protected')
## socket.h (module 'network'): bool ns3::Socket::IsManualIpv6Tclass() const [member function]
cls.add_method('IsManualIpv6Tclass',
'bool',
[],
is_const=True, visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyConnectionFailed() [member function]
cls.add_method('NotifyConnectionFailed',
'void',
[],
visibility='protected')
## socket.h (module 'network'): bool ns3::Socket::NotifyConnectionRequest(ns3::Address const & from) [member function]
cls.add_method('NotifyConnectionRequest',
'bool',
[param('ns3::Address const &', 'from')],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyConnectionSucceeded() [member function]
cls.add_method('NotifyConnectionSucceeded',
'void',
[],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyDataRecv() [member function]
cls.add_method('NotifyDataRecv',
'void',
[],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyDataSent(uint32_t size) [member function]
cls.add_method('NotifyDataSent',
'void',
[param('uint32_t', 'size')],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyErrorClose() [member function]
cls.add_method('NotifyErrorClose',
'void',
[],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyNewConnectionCreated(ns3::Ptr<ns3::Socket> socket, ns3::Address const & from) [member function]
cls.add_method('NotifyNewConnectionCreated',
'void',
[param('ns3::Ptr< ns3::Socket >', 'socket'), param('ns3::Address const &', 'from')],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifyNormalClose() [member function]
cls.add_method('NotifyNormalClose',
'void',
[],
visibility='protected')
## socket.h (module 'network'): void ns3::Socket::NotifySend(uint32_t spaceAvailable) [member function]
cls.add_method('NotifySend',
'void',
[param('uint32_t', 'spaceAvailable')],
visibility='protected')
return
def register_Ns3SocketFactory_methods(root_module, cls):
## socket-factory.h (module 'network'): ns3::SocketFactory::SocketFactory(ns3::SocketFactory const & arg0) [constructor]
cls.add_constructor([param('ns3::SocketFactory const &', 'arg0')])
## socket-factory.h (module 'network'): ns3::SocketFactory::SocketFactory() [constructor]
cls.add_constructor([])
## socket-factory.h (module 'network'): ns3::Ptr<ns3::Socket> ns3::SocketFactory::CreateSocket() [member function]
cls.add_method('CreateSocket',
'ns3::Ptr< ns3::Socket >',
[],
is_pure_virtual=True, is_virtual=True)
## socket-factory.h (module 'network'): static ns3::TypeId ns3::SocketFactory::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
return
def register_Ns3SocketIpTosTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketIpTosTag::SocketIpTosTag(ns3::SocketIpTosTag const & arg0) [constructor]
cls.add_constructor([param('ns3::SocketIpTosTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketIpTosTag::SocketIpTosTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketIpTosTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): ns3::TypeId ns3::SocketIpTosTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketIpTosTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::SocketIpTosTag::GetTos() const [member function]
cls.add_method('GetTos',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketIpTosTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): void ns3::SocketIpTosTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpTosTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpTosTag::SetTos(uint8_t tos) [member function]
cls.add_method('SetTos',
'void',
[param('uint8_t', 'tos')])
return
def register_Ns3SocketIpTtlTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketIpTtlTag::SocketIpTtlTag(ns3::SocketIpTtlTag const & arg0) [constructor]
cls.add_constructor([param('ns3::SocketIpTtlTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketIpTtlTag::SocketIpTtlTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketIpTtlTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): ns3::TypeId ns3::SocketIpTtlTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketIpTtlTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::SocketIpTtlTag::GetTtl() const [member function]
cls.add_method('GetTtl',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketIpTtlTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): void ns3::SocketIpTtlTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpTtlTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpTtlTag::SetTtl(uint8_t ttl) [member function]
cls.add_method('SetTtl',
'void',
[param('uint8_t', 'ttl')])
return
def register_Ns3SocketIpv6HopLimitTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketIpv6HopLimitTag::SocketIpv6HopLimitTag(ns3::SocketIpv6HopLimitTag const & arg0) [constructor]
cls.add_constructor([param('ns3::SocketIpv6HopLimitTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketIpv6HopLimitTag::SocketIpv6HopLimitTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketIpv6HopLimitTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::SocketIpv6HopLimitTag::GetHopLimit() const [member function]
cls.add_method('GetHopLimit',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): ns3::TypeId ns3::SocketIpv6HopLimitTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketIpv6HopLimitTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketIpv6HopLimitTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): void ns3::SocketIpv6HopLimitTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpv6HopLimitTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpv6HopLimitTag::SetHopLimit(uint8_t hopLimit) [member function]
cls.add_method('SetHopLimit',
'void',
[param('uint8_t', 'hopLimit')])
return
def register_Ns3SocketIpv6TclassTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketIpv6TclassTag::SocketIpv6TclassTag(ns3::SocketIpv6TclassTag const & arg0) [constructor]
cls.add_constructor([param('ns3::SocketIpv6TclassTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketIpv6TclassTag::SocketIpv6TclassTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketIpv6TclassTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): ns3::TypeId ns3::SocketIpv6TclassTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketIpv6TclassTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::SocketIpv6TclassTag::GetTclass() const [member function]
cls.add_method('GetTclass',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketIpv6TclassTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): void ns3::SocketIpv6TclassTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpv6TclassTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketIpv6TclassTag::SetTclass(uint8_t tclass) [member function]
cls.add_method('SetTclass',
'void',
[param('uint8_t', 'tclass')])
return
def register_Ns3SocketPriorityTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketPriorityTag::SocketPriorityTag(ns3::SocketPriorityTag const & arg0) [constructor]
cls.add_constructor([param('ns3::SocketPriorityTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketPriorityTag::SocketPriorityTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketPriorityTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): ns3::TypeId ns3::SocketPriorityTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint8_t ns3::SocketPriorityTag::GetPriority() const [member function]
cls.add_method('GetPriority',
'uint8_t',
[],
is_const=True)
## socket.h (module 'network'): uint32_t ns3::SocketPriorityTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketPriorityTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): void ns3::SocketPriorityTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketPriorityTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketPriorityTag::SetPriority(uint8_t priority) [member function]
cls.add_method('SetPriority',
'void',
[param('uint8_t', 'priority')])
return
def register_Ns3SocketSetDontFragmentTag_methods(root_module, cls):
## socket.h (module 'network'): ns3::SocketSetDontFragmentTag::SocketSetDontFragmentTag(ns3::SocketSetDontFragmentTag const & arg0) [constructor]
cls.add_constructor([param('ns3::SocketSetDontFragmentTag const &', 'arg0')])
## socket.h (module 'network'): ns3::SocketSetDontFragmentTag::SocketSetDontFragmentTag() [constructor]
cls.add_constructor([])
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Deserialize(ns3::TagBuffer i) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_virtual=True)
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Disable() [member function]
cls.add_method('Disable',
'void',
[])
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Enable() [member function]
cls.add_method('Enable',
'void',
[])
## socket.h (module 'network'): ns3::TypeId ns3::SocketSetDontFragmentTag::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): uint32_t ns3::SocketSetDontFragmentTag::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## socket.h (module 'network'): static ns3::TypeId ns3::SocketSetDontFragmentTag::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## socket.h (module 'network'): bool ns3::SocketSetDontFragmentTag::IsEnabled() const [member function]
cls.add_method('IsEnabled',
'bool',
[],
is_const=True)
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## socket.h (module 'network'): void ns3::SocketSetDontFragmentTag::Serialize(ns3::TagBuffer i) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::TagBuffer', 'i')],
is_const=True, is_virtual=True)
return
def register_Ns3Time_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
cls.add_binary_comparison_operator('<=')
cls.add_binary_comparison_operator('>=')
cls.add_binary_comparison_operator('<')
cls.add_binary_comparison_operator('>')
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_numeric_operator('*', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::int64x64_t const &', u'right'))
cls.add_binary_numeric_operator('/', root_module['ns3::int64x64_t'], 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_numeric_operator('/', root_module['ns3::Time'], root_module['ns3::Time'], param('ns3::int64x64_t const &', u'right'))
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()
## nstime.h (module 'core'): ns3::Time::Time() [constructor]
cls.add_constructor([])
## nstime.h (module 'core'): ns3::Time::Time(ns3::Time const & o) [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) [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) [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::Deserialize(ns3::Buffer::Iterator start, ns3::Buffer::Iterator end) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start'), param('ns3::Buffer::Iterator', 'end')],
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]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## trailer.h (module 'network'): void ns3::Trailer::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)
## trailer.h (module 'network'): void ns3::Trailer::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_Ns3TriangularRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::TriangularRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::TriangularRandomVariable::TriangularRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::TriangularRandomVariable::GetMean() const [member function]
cls.add_method('GetMean',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::TriangularRandomVariable::GetMin() const [member function]
cls.add_method('GetMin',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::TriangularRandomVariable::GetMax() const [member function]
cls.add_method('GetMax',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::TriangularRandomVariable::GetValue(double mean, double min, double max) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'mean'), param('double', 'min'), param('double', 'max')])
## random-variable-stream.h (module 'core'): uint32_t ns3::TriangularRandomVariable::GetInteger(uint32_t mean, uint32_t min, uint32_t max) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'mean'), param('uint32_t', 'min'), param('uint32_t', 'max')])
## random-variable-stream.h (module 'core'): double ns3::TriangularRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::TriangularRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3UniformRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::UniformRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::UniformRandomVariable::UniformRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::UniformRandomVariable::GetMin() const [member function]
cls.add_method('GetMin',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::UniformRandomVariable::GetMax() const [member function]
cls.add_method('GetMax',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::UniformRandomVariable::GetValue(double min, double max) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'min'), param('double', 'max')])
## random-variable-stream.h (module 'core'): uint32_t ns3::UniformRandomVariable::GetInteger(uint32_t min, uint32_t max) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'min'), param('uint32_t', 'max')])
## random-variable-stream.h (module 'core'): double ns3::UniformRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::UniformRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3WeibullRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::WeibullRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::WeibullRandomVariable::WeibullRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::WeibullRandomVariable::GetScale() const [member function]
cls.add_method('GetScale',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::WeibullRandomVariable::GetShape() const [member function]
cls.add_method('GetShape',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::WeibullRandomVariable::GetBound() const [member function]
cls.add_method('GetBound',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::WeibullRandomVariable::GetValue(double scale, double shape, double bound) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'scale'), param('double', 'shape'), param('double', 'bound')])
## random-variable-stream.h (module 'core'): uint32_t ns3::WeibullRandomVariable::GetInteger(uint32_t scale, uint32_t shape, uint32_t bound) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'scale'), param('uint32_t', 'shape'), param('uint32_t', 'bound')])
## random-variable-stream.h (module 'core'): double ns3::WeibullRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::WeibullRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3ZetaRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::ZetaRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::ZetaRandomVariable::ZetaRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::ZetaRandomVariable::GetAlpha() const [member function]
cls.add_method('GetAlpha',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ZetaRandomVariable::GetValue(double alpha) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'alpha')])
## random-variable-stream.h (module 'core'): uint32_t ns3::ZetaRandomVariable::GetInteger(uint32_t alpha) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'alpha')])
## random-variable-stream.h (module 'core'): double ns3::ZetaRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::ZetaRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3ZipfRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::ZipfRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::ZipfRandomVariable::ZipfRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): uint32_t ns3::ZipfRandomVariable::GetN() const [member function]
cls.add_method('GetN',
'uint32_t',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ZipfRandomVariable::GetAlpha() const [member function]
cls.add_method('GetAlpha',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ZipfRandomVariable::GetValue(uint32_t n, double alpha) [member function]
cls.add_method('GetValue',
'double',
[param('uint32_t', 'n'), param('double', 'alpha')])
## random-variable-stream.h (module 'core'): uint32_t ns3::ZipfRandomVariable::GetInteger(uint32_t n, uint32_t alpha) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'n'), param('uint32_t', 'alpha')])
## random-variable-stream.h (module 'core'): double ns3::ZipfRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::ZipfRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3Application_methods(root_module, cls):
## application.h (module 'network'): ns3::Application::Application(ns3::Application const & arg0) [constructor]
cls.add_constructor([param('ns3::Application const &', 'arg0')])
## application.h (module 'network'): ns3::Application::Application() [constructor]
cls.add_constructor([])
## application.h (module 'network'): ns3::Ptr<ns3::Node> ns3::Application::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_const=True)
## application.h (module 'network'): static ns3::TypeId ns3::Application::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## application.h (module 'network'): void ns3::Application::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')])
## application.h (module 'network'): void ns3::Application::SetStartTime(ns3::Time start) [member function]
cls.add_method('SetStartTime',
'void',
[param('ns3::Time', 'start')])
## application.h (module 'network'): void ns3::Application::SetStopTime(ns3::Time stop) [member function]
cls.add_method('SetStopTime',
'void',
[param('ns3::Time', 'stop')])
## application.h (module 'network'): void ns3::Application::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## application.h (module 'network'): void ns3::Application::DoInitialize() [member function]
cls.add_method('DoInitialize',
'void',
[],
visibility='protected', is_virtual=True)
## application.h (module 'network'): void ns3::Application::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## application.h (module 'network'): void ns3::Application::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3AttributeAccessor_methods(root_module, cls):
## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor(ns3::AttributeAccessor const & arg0) [constructor]
cls.add_constructor([param('ns3::AttributeAccessor const &', 'arg0')])
## attribute.h (module 'core'): ns3::AttributeAccessor::AttributeAccessor() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): bool ns3::AttributeAccessor::Get(ns3::ObjectBase const * object, ns3::AttributeValue & attribute) const [member function]
cls.add_method('Get',
'bool',
[param('ns3::ObjectBase const *', 'object'), param('ns3::AttributeValue &', 'attribute')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasGetter() const [member function]
cls.add_method('HasGetter',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::HasSetter() const [member function]
cls.add_method('HasSetter',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeAccessor::Set(ns3::ObjectBase * object, ns3::AttributeValue const & value) const [member function]
cls.add_method('Set',
'bool',
[param('ns3::ObjectBase *', 'object', transfer_ownership=False), param('ns3::AttributeValue const &', 'value')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3AttributeChecker_methods(root_module, cls):
## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker(ns3::AttributeChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::AttributeChecker const &', 'arg0')])
## attribute.h (module 'core'): ns3::AttributeChecker::AttributeChecker() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): bool ns3::AttributeChecker::Check(ns3::AttributeValue const & value) const [member function]
cls.add_method('Check',
'bool',
[param('ns3::AttributeValue const &', 'value')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeChecker::Copy(ns3::AttributeValue const & source, ns3::AttributeValue & destination) const [member function]
cls.add_method('Copy',
'bool',
[param('ns3::AttributeValue const &', 'source'), param('ns3::AttributeValue &', 'destination')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::Create() const [member function]
cls.add_method('Create',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeChecker::CreateValidValue(ns3::AttributeValue const & value) const [member function]
cls.add_method('CreateValidValue',
'ns3::Ptr< ns3::AttributeValue >',
[param('ns3::AttributeValue const &', 'value')],
is_const=True)
## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetUnderlyingTypeInformation() const [member function]
cls.add_method('GetUnderlyingTypeInformation',
'std::string',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): std::string ns3::AttributeChecker::GetValueTypeName() const [member function]
cls.add_method('GetValueTypeName',
'std::string',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeChecker::HasUnderlyingTypeInformation() const [member function]
cls.add_method('HasUnderlyingTypeInformation',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3AttributeValue_methods(root_module, cls):
## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue(ns3::AttributeValue const & arg0) [constructor]
cls.add_constructor([param('ns3::AttributeValue const &', 'arg0')])
## attribute.h (module 'core'): ns3::AttributeValue::AttributeValue() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::AttributeValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::AttributeValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_pure_virtual=True, is_virtual=True)
## attribute.h (module 'core'): std::string ns3::AttributeValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3BooleanChecker_methods(root_module, cls):
## boolean.h (module 'core'): ns3::BooleanChecker::BooleanChecker() [constructor]
cls.add_constructor([])
## boolean.h (module 'core'): ns3::BooleanChecker::BooleanChecker(ns3::BooleanChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::BooleanChecker const &', 'arg0')])
return
def register_Ns3BooleanValue_methods(root_module, cls):
cls.add_output_stream_operator()
## boolean.h (module 'core'): ns3::BooleanValue::BooleanValue(ns3::BooleanValue const & arg0) [constructor]
cls.add_constructor([param('ns3::BooleanValue const &', 'arg0')])
## boolean.h (module 'core'): ns3::BooleanValue::BooleanValue() [constructor]
cls.add_constructor([])
## boolean.h (module 'core'): ns3::BooleanValue::BooleanValue(bool value) [constructor]
cls.add_constructor([param('bool', 'value')])
## boolean.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::BooleanValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## boolean.h (module 'core'): bool ns3::BooleanValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## boolean.h (module 'core'): bool ns3::BooleanValue::Get() const [member function]
cls.add_method('Get',
'bool',
[],
is_const=True)
## boolean.h (module 'core'): std::string ns3::BooleanValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## boolean.h (module 'core'): void ns3::BooleanValue::Set(bool value) [member function]
cls.add_method('Set',
'void',
[param('bool', 'value')])
return
def register_Ns3CallbackChecker_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackChecker::CallbackChecker(ns3::CallbackChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackChecker const &', 'arg0')])
return
def register_Ns3CallbackImplBase_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImplBase::CallbackImplBase(ns3::CallbackImplBase const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImplBase const &', 'arg0')])
## callback.h (module 'core'): std::string ns3::CallbackImplBase::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## callback.h (module 'core'): bool ns3::CallbackImplBase::IsEqual(ns3::Ptr<const ns3::CallbackImplBase> other) const [member function]
cls.add_method('IsEqual',
'bool',
[param('ns3::Ptr< ns3::CallbackImplBase const >', 'other')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::Demangle(std::string const & mangled) [member function]
cls.add_method('Demangle',
'std::string',
[param('std::string const &', 'mangled')],
is_static=True, visibility='protected')
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'ns3::ObjectBase*'])
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'void'])
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'unsigned int'])
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'ns3::Ptr<ns3::NetDevice> '])
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'ns3::Ptr<ns3::Packet const> '])
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'unsigned short'])
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'ns3::Address const&'])
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'ns3::NetDevice::PacketType'])
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'ns3::Ptr<ns3::QueueDiscItem const> '])
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'ns3::Ptr<ns3::Socket> '])
## callback.h (module 'core'): static std::string ns3::CallbackImplBase::GetCppTypeid() [member function]
cls.add_method('GetCppTypeid',
'std::string',
[],
is_static=True, visibility='protected', template_parameters=[u'bool'])
return
def register_Ns3CallbackValue_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackValue const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackValue const &', 'arg0')])
## callback.h (module 'core'): ns3::CallbackValue::CallbackValue() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackValue::CallbackValue(ns3::CallbackBase const & base) [constructor]
cls.add_constructor([param('ns3::CallbackBase const &', 'base')])
## callback.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::CallbackValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): bool ns3::CallbackValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## callback.h (module 'core'): std::string ns3::CallbackValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackValue::Set(ns3::CallbackBase base) [member function]
cls.add_method('Set',
'void',
[param('ns3::CallbackBase', 'base')])
return
def register_Ns3Channel_methods(root_module, cls):
## channel.h (module 'network'): ns3::Channel::Channel(ns3::Channel const & arg0) [constructor]
cls.add_constructor([param('ns3::Channel const &', 'arg0')])
## channel.h (module 'network'): ns3::Channel::Channel() [constructor]
cls.add_constructor([])
## channel.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::Channel::GetDevice(std::size_t i) const [member function]
cls.add_method('GetDevice',
'ns3::Ptr< ns3::NetDevice >',
[param('std::size_t', 'i')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## channel.h (module 'network'): uint32_t ns3::Channel::GetId() const [member function]
cls.add_method('GetId',
'uint32_t',
[],
is_const=True)
## channel.h (module 'network'): std::size_t ns3::Channel::GetNDevices() const [member function]
cls.add_method('GetNDevices',
'std::size_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## channel.h (module 'network'): static ns3::TypeId ns3::Channel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
return
def register_Ns3ConstantRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::ConstantRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::ConstantRandomVariable::ConstantRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::ConstantRandomVariable::GetConstant() const [member function]
cls.add_method('GetConstant',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ConstantRandomVariable::GetValue(double constant) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'constant')])
## random-variable-stream.h (module 'core'): uint32_t ns3::ConstantRandomVariable::GetInteger(uint32_t constant) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'constant')])
## random-variable-stream.h (module 'core'): double ns3::ConstantRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::ConstantRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3DataCalculator_methods(root_module, cls):
## data-calculator.h (module 'stats'): ns3::DataCalculator::DataCalculator(ns3::DataCalculator const & arg0) [constructor]
cls.add_constructor([param('ns3::DataCalculator const &', 'arg0')])
## data-calculator.h (module 'stats'): ns3::DataCalculator::DataCalculator() [constructor]
cls.add_constructor([])
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Disable() [member function]
cls.add_method('Disable',
'void',
[])
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Enable() [member function]
cls.add_method('Enable',
'void',
[])
## data-calculator.h (module 'stats'): std::string ns3::DataCalculator::GetContext() const [member function]
cls.add_method('GetContext',
'std::string',
[],
is_const=True)
## data-calculator.h (module 'stats'): bool ns3::DataCalculator::GetEnabled() const [member function]
cls.add_method('GetEnabled',
'bool',
[],
is_const=True)
## data-calculator.h (module 'stats'): std::string ns3::DataCalculator::GetKey() const [member function]
cls.add_method('GetKey',
'std::string',
[],
is_const=True)
## data-calculator.h (module 'stats'): static ns3::TypeId ns3::DataCalculator::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Output(ns3::DataOutputCallback & callback) const [member function]
cls.add_method('Output',
'void',
[param('ns3::DataOutputCallback &', 'callback')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## data-calculator.h (module 'stats'): void ns3::DataCalculator::SetContext(std::string const context) [member function]
cls.add_method('SetContext',
'void',
[param('std::string const', 'context')])
## data-calculator.h (module 'stats'): void ns3::DataCalculator::SetKey(std::string const key) [member function]
cls.add_method('SetKey',
'void',
[param('std::string const', 'key')])
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Start(ns3::Time const & startTime) [member function]
cls.add_method('Start',
'void',
[param('ns3::Time const &', 'startTime')],
is_virtual=True)
## data-calculator.h (module 'stats'): void ns3::DataCalculator::Stop(ns3::Time const & stopTime) [member function]
cls.add_method('Stop',
'void',
[param('ns3::Time const &', 'stopTime')],
is_virtual=True)
## data-calculator.h (module 'stats'): void ns3::DataCalculator::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3DataCollectionObject_methods(root_module, cls):
## data-collection-object.h (module 'stats'): ns3::DataCollectionObject::DataCollectionObject(ns3::DataCollectionObject const & arg0) [constructor]
cls.add_constructor([param('ns3::DataCollectionObject const &', 'arg0')])
## data-collection-object.h (module 'stats'): ns3::DataCollectionObject::DataCollectionObject() [constructor]
cls.add_constructor([])
## data-collection-object.h (module 'stats'): void ns3::DataCollectionObject::Disable() [member function]
cls.add_method('Disable',
'void',
[])
## data-collection-object.h (module 'stats'): void ns3::DataCollectionObject::Enable() [member function]
cls.add_method('Enable',
'void',
[])
## data-collection-object.h (module 'stats'): std::string ns3::DataCollectionObject::GetName() const [member function]
cls.add_method('GetName',
'std::string',
[],
is_const=True)
## data-collection-object.h (module 'stats'): static ns3::TypeId ns3::DataCollectionObject::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## data-collection-object.h (module 'stats'): bool ns3::DataCollectionObject::IsEnabled() const [member function]
cls.add_method('IsEnabled',
'bool',
[],
is_const=True, is_virtual=True)
## data-collection-object.h (module 'stats'): void ns3::DataCollectionObject::SetName(std::string name) [member function]
cls.add_method('SetName',
'void',
[param('std::string', 'name')])
return
def register_Ns3DataOutputInterface_methods(root_module, cls):
## data-output-interface.h (module 'stats'): ns3::DataOutputInterface::DataOutputInterface(ns3::DataOutputInterface const & arg0) [constructor]
cls.add_constructor([param('ns3::DataOutputInterface const &', 'arg0')])
## data-output-interface.h (module 'stats'): ns3::DataOutputInterface::DataOutputInterface() [constructor]
cls.add_constructor([])
## data-output-interface.h (module 'stats'): std::string ns3::DataOutputInterface::GetFilePrefix() const [member function]
cls.add_method('GetFilePrefix',
'std::string',
[],
is_const=True)
## data-output-interface.h (module 'stats'): static ns3::TypeId ns3::DataOutputInterface::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputInterface::Output(ns3::DataCollector & dc) [member function]
cls.add_method('Output',
'void',
[param('ns3::DataCollector &', 'dc')],
is_pure_virtual=True, is_virtual=True)
## data-output-interface.h (module 'stats'): void ns3::DataOutputInterface::SetFilePrefix(std::string const prefix) [member function]
cls.add_method('SetFilePrefix',
'void',
[param('std::string const', 'prefix')])
## data-output-interface.h (module 'stats'): void ns3::DataOutputInterface::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3DataRateChecker_methods(root_module, cls):
## data-rate.h (module 'network'): ns3::DataRateChecker::DataRateChecker() [constructor]
cls.add_constructor([])
## data-rate.h (module 'network'): ns3::DataRateChecker::DataRateChecker(ns3::DataRateChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::DataRateChecker const &', 'arg0')])
return
def register_Ns3DataRateValue_methods(root_module, cls):
## data-rate.h (module 'network'): ns3::DataRateValue::DataRateValue() [constructor]
cls.add_constructor([])
## data-rate.h (module 'network'): ns3::DataRateValue::DataRateValue(ns3::DataRate const & value) [constructor]
cls.add_constructor([param('ns3::DataRate const &', 'value')])
## data-rate.h (module 'network'): ns3::DataRateValue::DataRateValue(ns3::DataRateValue const & arg0) [constructor]
cls.add_constructor([param('ns3::DataRateValue const &', 'arg0')])
## data-rate.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::DataRateValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## data-rate.h (module 'network'): bool ns3::DataRateValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## data-rate.h (module 'network'): ns3::DataRate ns3::DataRateValue::Get() const [member function]
cls.add_method('Get',
'ns3::DataRate',
[],
is_const=True)
## data-rate.h (module 'network'): std::string ns3::DataRateValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## data-rate.h (module 'network'): void ns3::DataRateValue::Set(ns3::DataRate const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::DataRate const &', 'value')])
return
def register_Ns3DeterministicRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::DeterministicRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::DeterministicRandomVariable::DeterministicRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): void ns3::DeterministicRandomVariable::SetValueArray(double * values, std::size_t length) [member function]
cls.add_method('SetValueArray',
'void',
[param('double *', 'values'), param('std::size_t', 'length')])
## random-variable-stream.h (module 'core'): double ns3::DeterministicRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::DeterministicRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3DoubleValue_methods(root_module, cls):
## double.h (module 'core'): ns3::DoubleValue::DoubleValue() [constructor]
cls.add_constructor([])
## double.h (module 'core'): ns3::DoubleValue::DoubleValue(double const & value) [constructor]
cls.add_constructor([param('double const &', 'value')])
## double.h (module 'core'): ns3::DoubleValue::DoubleValue(ns3::DoubleValue const & arg0) [constructor]
cls.add_constructor([param('ns3::DoubleValue const &', 'arg0')])
## double.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::DoubleValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## double.h (module 'core'): bool ns3::DoubleValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## double.h (module 'core'): double ns3::DoubleValue::Get() const [member function]
cls.add_method('Get',
'double',
[],
is_const=True)
## double.h (module 'core'): std::string ns3::DoubleValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## double.h (module 'core'): void ns3::DoubleValue::Set(double const & value) [member function]
cls.add_method('Set',
'void',
[param('double const &', 'value')])
return
def register_Ns3DynamicQueueLimits_methods(root_module, cls):
## dynamic-queue-limits.h (module 'network'): ns3::DynamicQueueLimits::DynamicQueueLimits(ns3::DynamicQueueLimits const & arg0) [constructor]
cls.add_constructor([param('ns3::DynamicQueueLimits const &', 'arg0')])
## dynamic-queue-limits.h (module 'network'): ns3::DynamicQueueLimits::DynamicQueueLimits() [constructor]
cls.add_constructor([])
## dynamic-queue-limits.h (module 'network'): int32_t ns3::DynamicQueueLimits::Available() const [member function]
cls.add_method('Available',
'int32_t',
[],
is_const=True, is_virtual=True)
## dynamic-queue-limits.h (module 'network'): void ns3::DynamicQueueLimits::Completed(uint32_t count) [member function]
cls.add_method('Completed',
'void',
[param('uint32_t', 'count')],
is_virtual=True)
## dynamic-queue-limits.h (module 'network'): static ns3::TypeId ns3::DynamicQueueLimits::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## dynamic-queue-limits.h (module 'network'): void ns3::DynamicQueueLimits::Queued(uint32_t count) [member function]
cls.add_method('Queued',
'void',
[param('uint32_t', 'count')],
is_virtual=True)
## dynamic-queue-limits.h (module 'network'): void ns3::DynamicQueueLimits::Reset() [member function]
cls.add_method('Reset',
'void',
[],
is_virtual=True)
return
def register_Ns3EmpiricalRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): ns3::EmpiricalRandomVariable::EmpiricalRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): void ns3::EmpiricalRandomVariable::CDF(double v, double c) [member function]
cls.add_method('CDF',
'void',
[param('double', 'v'), param('double', 'c')])
## random-variable-stream.h (module 'core'): uint32_t ns3::EmpiricalRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::EmpiricalRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): double ns3::EmpiricalRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): double ns3::EmpiricalRandomVariable::Interpolate(double c1, double c2, double v1, double v2, double r) [member function]
cls.add_method('Interpolate',
'double',
[param('double', 'c1'), param('double', 'c2'), param('double', 'v1'), param('double', 'v2'), param('double', 'r')],
visibility='private', is_virtual=True)
## random-variable-stream.h (module 'core'): void ns3::EmpiricalRandomVariable::Validate() [member function]
cls.add_method('Validate',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3EmptyAttributeAccessor_methods(root_module, cls):
## attribute.h (module 'core'): ns3::EmptyAttributeAccessor::EmptyAttributeAccessor(ns3::EmptyAttributeAccessor const & arg0) [constructor]
cls.add_constructor([param('ns3::EmptyAttributeAccessor const &', 'arg0')])
## attribute.h (module 'core'): ns3::EmptyAttributeAccessor::EmptyAttributeAccessor() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): bool ns3::EmptyAttributeAccessor::Get(ns3::ObjectBase const * object, ns3::AttributeValue & attribute) const [member function]
cls.add_method('Get',
'bool',
[param('ns3::ObjectBase const *', 'object'), param('ns3::AttributeValue &', 'attribute')],
is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::EmptyAttributeAccessor::HasGetter() const [member function]
cls.add_method('HasGetter',
'bool',
[],
is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::EmptyAttributeAccessor::HasSetter() const [member function]
cls.add_method('HasSetter',
'bool',
[],
is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::EmptyAttributeAccessor::Set(ns3::ObjectBase * object, ns3::AttributeValue const & value) const [member function]
cls.add_method('Set',
'bool',
[param('ns3::ObjectBase *', 'object'), param('ns3::AttributeValue const &', 'value')],
is_const=True, is_virtual=True)
return
def register_Ns3EmptyAttributeChecker_methods(root_module, cls):
## attribute.h (module 'core'): ns3::EmptyAttributeChecker::EmptyAttributeChecker(ns3::EmptyAttributeChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::EmptyAttributeChecker const &', 'arg0')])
## attribute.h (module 'core'): ns3::EmptyAttributeChecker::EmptyAttributeChecker() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): bool ns3::EmptyAttributeChecker::Check(ns3::AttributeValue const & value) const [member function]
cls.add_method('Check',
'bool',
[param('ns3::AttributeValue const &', 'value')],
is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::EmptyAttributeChecker::Copy(ns3::AttributeValue const & source, ns3::AttributeValue & destination) const [member function]
cls.add_method('Copy',
'bool',
[param('ns3::AttributeValue const &', 'source'), param('ns3::AttributeValue &', 'destination')],
is_const=True, is_virtual=True)
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EmptyAttributeChecker::Create() const [member function]
cls.add_method('Create',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## attribute.h (module 'core'): std::string ns3::EmptyAttributeChecker::GetUnderlyingTypeInformation() const [member function]
cls.add_method('GetUnderlyingTypeInformation',
'std::string',
[],
is_const=True, is_virtual=True)
## attribute.h (module 'core'): std::string ns3::EmptyAttributeChecker::GetValueTypeName() const [member function]
cls.add_method('GetValueTypeName',
'std::string',
[],
is_const=True, is_virtual=True)
## attribute.h (module 'core'): bool ns3::EmptyAttributeChecker::HasUnderlyingTypeInformation() const [member function]
cls.add_method('HasUnderlyingTypeInformation',
'bool',
[],
is_const=True, is_virtual=True)
return
def register_Ns3EmptyAttributeValue_methods(root_module, cls):
## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue(ns3::EmptyAttributeValue const & arg0) [constructor]
cls.add_constructor([param('ns3::EmptyAttributeValue const &', 'arg0')])
## attribute.h (module 'core'): ns3::EmptyAttributeValue::EmptyAttributeValue() [constructor]
cls.add_constructor([])
## attribute.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EmptyAttributeValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, visibility='private', is_virtual=True)
## attribute.h (module 'core'): bool ns3::EmptyAttributeValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
visibility='private', is_virtual=True)
## attribute.h (module 'core'): std::string ns3::EmptyAttributeValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, visibility='private', is_virtual=True)
return
def register_Ns3EnumChecker_methods(root_module, cls):
## enum.h (module 'core'): ns3::EnumChecker::EnumChecker(ns3::EnumChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::EnumChecker const &', 'arg0')])
## enum.h (module 'core'): ns3::EnumChecker::EnumChecker() [constructor]
cls.add_constructor([])
## enum.h (module 'core'): void ns3::EnumChecker::Add(int value, std::string name) [member function]
cls.add_method('Add',
'void',
[param('int', 'value'), param('std::string', 'name')])
## enum.h (module 'core'): void ns3::EnumChecker::AddDefault(int value, std::string name) [member function]
cls.add_method('AddDefault',
'void',
[param('int', 'value'), param('std::string', 'name')])
## enum.h (module 'core'): bool ns3::EnumChecker::Check(ns3::AttributeValue const & value) const [member function]
cls.add_method('Check',
'bool',
[param('ns3::AttributeValue const &', 'value')],
is_const=True, is_virtual=True)
## enum.h (module 'core'): bool ns3::EnumChecker::Copy(ns3::AttributeValue const & src, ns3::AttributeValue & dst) const [member function]
cls.add_method('Copy',
'bool',
[param('ns3::AttributeValue const &', 'src'), param('ns3::AttributeValue &', 'dst')],
is_const=True, is_virtual=True)
## enum.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EnumChecker::Create() const [member function]
cls.add_method('Create',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## enum.h (module 'core'): std::string ns3::EnumChecker::GetUnderlyingTypeInformation() const [member function]
cls.add_method('GetUnderlyingTypeInformation',
'std::string',
[],
is_const=True, is_virtual=True)
## enum.h (module 'core'): std::string ns3::EnumChecker::GetValueTypeName() const [member function]
cls.add_method('GetValueTypeName',
'std::string',
[],
is_const=True, is_virtual=True)
## enum.h (module 'core'): bool ns3::EnumChecker::HasUnderlyingTypeInformation() const [member function]
cls.add_method('HasUnderlyingTypeInformation',
'bool',
[],
is_const=True, is_virtual=True)
return
def register_Ns3EnumValue_methods(root_module, cls):
## enum.h (module 'core'): ns3::EnumValue::EnumValue(ns3::EnumValue const & arg0) [constructor]
cls.add_constructor([param('ns3::EnumValue const &', 'arg0')])
## enum.h (module 'core'): ns3::EnumValue::EnumValue() [constructor]
cls.add_constructor([])
## enum.h (module 'core'): ns3::EnumValue::EnumValue(int value) [constructor]
cls.add_constructor([param('int', 'value')])
## enum.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::EnumValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## enum.h (module 'core'): bool ns3::EnumValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## enum.h (module 'core'): int ns3::EnumValue::Get() const [member function]
cls.add_method('Get',
'int',
[],
is_const=True)
## enum.h (module 'core'): std::string ns3::EnumValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## enum.h (module 'core'): void ns3::EnumValue::Set(int value) [member function]
cls.add_method('Set',
'void',
[param('int', 'value')])
return
def register_Ns3ErlangRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::ErlangRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::ErlangRandomVariable::ErlangRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): uint32_t ns3::ErlangRandomVariable::GetK() const [member function]
cls.add_method('GetK',
'uint32_t',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ErlangRandomVariable::GetLambda() const [member function]
cls.add_method('GetLambda',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ErlangRandomVariable::GetValue(uint32_t k, double lambda) [member function]
cls.add_method('GetValue',
'double',
[param('uint32_t', 'k'), param('double', 'lambda')])
## random-variable-stream.h (module 'core'): uint32_t ns3::ErlangRandomVariable::GetInteger(uint32_t k, uint32_t lambda) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'k'), param('uint32_t', 'lambda')])
## random-variable-stream.h (module 'core'): double ns3::ErlangRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::ErlangRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3ErrorModel_methods(root_module, cls):
## error-model.h (module 'network'): ns3::ErrorModel::ErrorModel(ns3::ErrorModel const & arg0) [constructor]
cls.add_constructor([param('ns3::ErrorModel const &', 'arg0')])
## error-model.h (module 'network'): ns3::ErrorModel::ErrorModel() [constructor]
cls.add_constructor([])
## error-model.h (module 'network'): void ns3::ErrorModel::Disable() [member function]
cls.add_method('Disable',
'void',
[])
## error-model.h (module 'network'): void ns3::ErrorModel::Enable() [member function]
cls.add_method('Enable',
'void',
[])
## error-model.h (module 'network'): static ns3::TypeId ns3::ErrorModel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## error-model.h (module 'network'): bool ns3::ErrorModel::IsCorrupt(ns3::Ptr<ns3::Packet> pkt) [member function]
cls.add_method('IsCorrupt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'pkt')])
## error-model.h (module 'network'): bool ns3::ErrorModel::IsEnabled() const [member function]
cls.add_method('IsEnabled',
'bool',
[],
is_const=True)
## error-model.h (module 'network'): void ns3::ErrorModel::Reset() [member function]
cls.add_method('Reset',
'void',
[])
## error-model.h (module 'network'): bool ns3::ErrorModel::DoCorrupt(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorrupt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
is_pure_virtual=True, visibility='private', is_virtual=True)
## error-model.h (module 'network'): void ns3::ErrorModel::DoReset() [member function]
cls.add_method('DoReset',
'void',
[],
is_pure_virtual=True, visibility='private', is_virtual=True)
return
def register_Ns3EthernetHeader_methods(root_module, cls):
## ethernet-header.h (module 'network'): ns3::EthernetHeader::EthernetHeader(ns3::EthernetHeader const & arg0) [constructor]
cls.add_constructor([param('ns3::EthernetHeader const &', 'arg0')])
## ethernet-header.h (module 'network'): ns3::EthernetHeader::EthernetHeader(bool hasPreamble) [constructor]
cls.add_constructor([param('bool', 'hasPreamble')])
## ethernet-header.h (module 'network'): ns3::EthernetHeader::EthernetHeader() [constructor]
cls.add_constructor([])
## ethernet-header.h (module 'network'): uint32_t ns3::EthernetHeader::Deserialize(ns3::Buffer::Iterator start) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start')],
is_virtual=True)
## ethernet-header.h (module 'network'): ns3::Mac48Address ns3::EthernetHeader::GetDestination() const [member function]
cls.add_method('GetDestination',
'ns3::Mac48Address',
[],
is_const=True)
## ethernet-header.h (module 'network'): uint32_t ns3::EthernetHeader::GetHeaderSize() const [member function]
cls.add_method('GetHeaderSize',
'uint32_t',
[],
is_const=True)
## ethernet-header.h (module 'network'): ns3::TypeId ns3::EthernetHeader::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## ethernet-header.h (module 'network'): uint16_t ns3::EthernetHeader::GetLengthType() const [member function]
cls.add_method('GetLengthType',
'uint16_t',
[],
is_const=True)
## ethernet-header.h (module 'network'): ns3::ethernet_header_t ns3::EthernetHeader::GetPacketType() const [member function]
cls.add_method('GetPacketType',
'ns3::ethernet_header_t',
[],
is_const=True)
## ethernet-header.h (module 'network'): uint64_t ns3::EthernetHeader::GetPreambleSfd() const [member function]
cls.add_method('GetPreambleSfd',
'uint64_t',
[],
is_const=True)
## ethernet-header.h (module 'network'): uint32_t ns3::EthernetHeader::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## ethernet-header.h (module 'network'): ns3::Mac48Address ns3::EthernetHeader::GetSource() const [member function]
cls.add_method('GetSource',
'ns3::Mac48Address',
[],
is_const=True)
## ethernet-header.h (module 'network'): static ns3::TypeId ns3::EthernetHeader::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ethernet-header.h (module 'network'): void ns3::EthernetHeader::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## ethernet-header.h (module 'network'): void ns3::EthernetHeader::Serialize(ns3::Buffer::Iterator start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'start')],
is_const=True, is_virtual=True)
## ethernet-header.h (module 'network'): void ns3::EthernetHeader::SetDestination(ns3::Mac48Address destination) [member function]
cls.add_method('SetDestination',
'void',
[param('ns3::Mac48Address', 'destination')])
## ethernet-header.h (module 'network'): void ns3::EthernetHeader::SetLengthType(uint16_t size) [member function]
cls.add_method('SetLengthType',
'void',
[param('uint16_t', 'size')])
## ethernet-header.h (module 'network'): void ns3::EthernetHeader::SetPreambleSfd(uint64_t preambleSfd) [member function]
cls.add_method('SetPreambleSfd',
'void',
[param('uint64_t', 'preambleSfd')])
## ethernet-header.h (module 'network'): void ns3::EthernetHeader::SetSource(ns3::Mac48Address source) [member function]
cls.add_method('SetSource',
'void',
[param('ns3::Mac48Address', 'source')])
return
def register_Ns3EthernetTrailer_methods(root_module, cls):
## ethernet-trailer.h (module 'network'): ns3::EthernetTrailer::EthernetTrailer(ns3::EthernetTrailer const & arg0) [constructor]
cls.add_constructor([param('ns3::EthernetTrailer const &', 'arg0')])
## ethernet-trailer.h (module 'network'): ns3::EthernetTrailer::EthernetTrailer() [constructor]
cls.add_constructor([])
## ethernet-trailer.h (module 'network'): void ns3::EthernetTrailer::CalcFcs(ns3::Ptr<const ns3::Packet> p) [member function]
cls.add_method('CalcFcs',
'void',
[param('ns3::Ptr< ns3::Packet const >', 'p')])
## ethernet-trailer.h (module 'network'): bool ns3::EthernetTrailer::CheckFcs(ns3::Ptr<const ns3::Packet> p) const [member function]
cls.add_method('CheckFcs',
'bool',
[param('ns3::Ptr< ns3::Packet const >', 'p')],
is_const=True)
## ethernet-trailer.h (module 'network'): uint32_t ns3::EthernetTrailer::Deserialize(ns3::Buffer::Iterator end) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'end')],
is_virtual=True)
## ethernet-trailer.h (module 'network'): void ns3::EthernetTrailer::EnableFcs(bool enable) [member function]
cls.add_method('EnableFcs',
'void',
[param('bool', 'enable')])
## ethernet-trailer.h (module 'network'): uint32_t ns3::EthernetTrailer::GetFcs() const [member function]
cls.add_method('GetFcs',
'uint32_t',
[],
is_const=True)
## ethernet-trailer.h (module 'network'): ns3::TypeId ns3::EthernetTrailer::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## ethernet-trailer.h (module 'network'): uint32_t ns3::EthernetTrailer::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## ethernet-trailer.h (module 'network'): uint32_t ns3::EthernetTrailer::GetTrailerSize() const [member function]
cls.add_method('GetTrailerSize',
'uint32_t',
[],
is_const=True)
## ethernet-trailer.h (module 'network'): static ns3::TypeId ns3::EthernetTrailer::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## ethernet-trailer.h (module 'network'): void ns3::EthernetTrailer::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## ethernet-trailer.h (module 'network'): void ns3::EthernetTrailer::Serialize(ns3::Buffer::Iterator end) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'end')],
is_const=True, is_virtual=True)
## ethernet-trailer.h (module 'network'): void ns3::EthernetTrailer::SetFcs(uint32_t fcs) [member function]
cls.add_method('SetFcs',
'void',
[param('uint32_t', 'fcs')])
return
def register_Ns3EventImpl_methods(root_module, cls):
## event-impl.h (module 'core'): ns3::EventImpl::EventImpl(ns3::EventImpl const & arg0) [constructor]
cls.add_constructor([param('ns3::EventImpl const &', 'arg0')])
## event-impl.h (module 'core'): ns3::EventImpl::EventImpl() [constructor]
cls.add_constructor([])
## event-impl.h (module 'core'): void ns3::EventImpl::Cancel() [member function]
cls.add_method('Cancel',
'void',
[])
## event-impl.h (module 'core'): void ns3::EventImpl::Invoke() [member function]
cls.add_method('Invoke',
'void',
[])
## event-impl.h (module 'core'): bool ns3::EventImpl::IsCancelled() [member function]
cls.add_method('IsCancelled',
'bool',
[])
## event-impl.h (module 'core'): void ns3::EventImpl::Notify() [member function]
cls.add_method('Notify',
'void',
[],
is_pure_virtual=True, visibility='protected', is_virtual=True)
return
def register_Ns3ExponentialRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::ExponentialRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::ExponentialRandomVariable::ExponentialRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::ExponentialRandomVariable::GetMean() const [member function]
cls.add_method('GetMean',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ExponentialRandomVariable::GetBound() const [member function]
cls.add_method('GetBound',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ExponentialRandomVariable::GetValue(double mean, double bound) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'mean'), param('double', 'bound')])
## random-variable-stream.h (module 'core'): uint32_t ns3::ExponentialRandomVariable::GetInteger(uint32_t mean, uint32_t bound) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'mean'), param('uint32_t', 'bound')])
## random-variable-stream.h (module 'core'): double ns3::ExponentialRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::ExponentialRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3GammaRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::GammaRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::GammaRandomVariable::GammaRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::GammaRandomVariable::GetAlpha() const [member function]
cls.add_method('GetAlpha',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::GammaRandomVariable::GetBeta() const [member function]
cls.add_method('GetBeta',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::GammaRandomVariable::GetValue(double alpha, double beta) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'alpha'), param('double', 'beta')])
## random-variable-stream.h (module 'core'): uint32_t ns3::GammaRandomVariable::GetInteger(uint32_t alpha, uint32_t beta) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'alpha'), param('uint32_t', 'beta')])
## random-variable-stream.h (module 'core'): double ns3::GammaRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::GammaRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3IntegerValue_methods(root_module, cls):
## integer.h (module 'core'): ns3::IntegerValue::IntegerValue() [constructor]
cls.add_constructor([])
## integer.h (module 'core'): ns3::IntegerValue::IntegerValue(int64_t const & value) [constructor]
cls.add_constructor([param('int64_t const &', 'value')])
## integer.h (module 'core'): ns3::IntegerValue::IntegerValue(ns3::IntegerValue const & arg0) [constructor]
cls.add_constructor([param('ns3::IntegerValue const &', 'arg0')])
## integer.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::IntegerValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## integer.h (module 'core'): bool ns3::IntegerValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## integer.h (module 'core'): int64_t ns3::IntegerValue::Get() const [member function]
cls.add_method('Get',
'int64_t',
[],
is_const=True)
## integer.h (module 'core'): std::string ns3::IntegerValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## integer.h (module 'core'): void ns3::IntegerValue::Set(int64_t const & value) [member function]
cls.add_method('Set',
'void',
[param('int64_t const &', 'value')])
return
def register_Ns3Ipv4AddressChecker_methods(root_module, cls):
## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker::Ipv4AddressChecker() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressChecker::Ipv4AddressChecker(ns3::Ipv4AddressChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv4AddressChecker const &', 'arg0')])
return
def register_Ns3Ipv4AddressValue_methods(root_module, cls):
## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue(ns3::Ipv4Address const & value) [constructor]
cls.add_constructor([param('ns3::Ipv4Address const &', 'value')])
## ipv4-address.h (module 'network'): ns3::Ipv4AddressValue::Ipv4AddressValue(ns3::Ipv4AddressValue const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv4AddressValue const &', 'arg0')])
## ipv4-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv4AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4AddressValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## ipv4-address.h (module 'network'): ns3::Ipv4Address ns3::Ipv4AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Ipv4Address',
[],
is_const=True)
## ipv4-address.h (module 'network'): std::string ns3::Ipv4AddressValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4AddressValue::Set(ns3::Ipv4Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Ipv4Address const &', 'value')])
return
def register_Ns3Ipv4MaskChecker_methods(root_module, cls):
## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker::Ipv4MaskChecker() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskChecker::Ipv4MaskChecker(ns3::Ipv4MaskChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv4MaskChecker const &', 'arg0')])
return
def register_Ns3Ipv4MaskValue_methods(root_module, cls):
## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue() [constructor]
cls.add_constructor([])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue(ns3::Ipv4Mask const & value) [constructor]
cls.add_constructor([param('ns3::Ipv4Mask const &', 'value')])
## ipv4-address.h (module 'network'): ns3::Ipv4MaskValue::Ipv4MaskValue(ns3::Ipv4MaskValue const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv4MaskValue const &', 'arg0')])
## ipv4-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv4MaskValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## ipv4-address.h (module 'network'): bool ns3::Ipv4MaskValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## ipv4-address.h (module 'network'): ns3::Ipv4Mask ns3::Ipv4MaskValue::Get() const [member function]
cls.add_method('Get',
'ns3::Ipv4Mask',
[],
is_const=True)
## ipv4-address.h (module 'network'): std::string ns3::Ipv4MaskValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## ipv4-address.h (module 'network'): void ns3::Ipv4MaskValue::Set(ns3::Ipv4Mask const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Ipv4Mask const &', 'value')])
return
def register_Ns3Ipv6AddressChecker_methods(root_module, cls):
## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker::Ipv6AddressChecker() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressChecker::Ipv6AddressChecker(ns3::Ipv6AddressChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv6AddressChecker const &', 'arg0')])
return
def register_Ns3Ipv6AddressValue_methods(root_module, cls):
## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue(ns3::Ipv6Address const & value) [constructor]
cls.add_constructor([param('ns3::Ipv6Address const &', 'value')])
## ipv6-address.h (module 'network'): ns3::Ipv6AddressValue::Ipv6AddressValue(ns3::Ipv6AddressValue const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv6AddressValue const &', 'arg0')])
## ipv6-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv6AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6AddressValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## ipv6-address.h (module 'network'): ns3::Ipv6Address ns3::Ipv6AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Ipv6Address',
[],
is_const=True)
## ipv6-address.h (module 'network'): std::string ns3::Ipv6AddressValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6AddressValue::Set(ns3::Ipv6Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Ipv6Address const &', 'value')])
return
def register_Ns3Ipv6PrefixChecker_methods(root_module, cls):
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker::Ipv6PrefixChecker() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixChecker::Ipv6PrefixChecker(ns3::Ipv6PrefixChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv6PrefixChecker const &', 'arg0')])
return
def register_Ns3Ipv6PrefixValue_methods(root_module, cls):
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue() [constructor]
cls.add_constructor([])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue(ns3::Ipv6Prefix const & value) [constructor]
cls.add_constructor([param('ns3::Ipv6Prefix const &', 'value')])
## ipv6-address.h (module 'network'): ns3::Ipv6PrefixValue::Ipv6PrefixValue(ns3::Ipv6PrefixValue const & arg0) [constructor]
cls.add_constructor([param('ns3::Ipv6PrefixValue const &', 'arg0')])
## ipv6-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Ipv6PrefixValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## ipv6-address.h (module 'network'): bool ns3::Ipv6PrefixValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## ipv6-address.h (module 'network'): ns3::Ipv6Prefix ns3::Ipv6PrefixValue::Get() const [member function]
cls.add_method('Get',
'ns3::Ipv6Prefix',
[],
is_const=True)
## ipv6-address.h (module 'network'): std::string ns3::Ipv6PrefixValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## ipv6-address.h (module 'network'): void ns3::Ipv6PrefixValue::Set(ns3::Ipv6Prefix const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Ipv6Prefix const &', 'value')])
return
def register_Ns3ListErrorModel_methods(root_module, cls):
## error-model.h (module 'network'): ns3::ListErrorModel::ListErrorModel(ns3::ListErrorModel const & arg0) [constructor]
cls.add_constructor([param('ns3::ListErrorModel const &', 'arg0')])
## error-model.h (module 'network'): ns3::ListErrorModel::ListErrorModel() [constructor]
cls.add_constructor([])
## error-model.h (module 'network'): std::list<unsigned int, std::allocator<unsigned int> > ns3::ListErrorModel::GetList() const [member function]
cls.add_method('GetList',
'std::list< unsigned int >',
[],
is_const=True)
## error-model.h (module 'network'): static ns3::TypeId ns3::ListErrorModel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## error-model.h (module 'network'): void ns3::ListErrorModel::SetList(std::list<unsigned int, std::allocator<unsigned int> > const & packetlist) [member function]
cls.add_method('SetList',
'void',
[param('std::list< unsigned int > const &', 'packetlist')])
## error-model.h (module 'network'): bool ns3::ListErrorModel::DoCorrupt(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorrupt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
visibility='private', is_virtual=True)
## error-model.h (module 'network'): void ns3::ListErrorModel::DoReset() [member function]
cls.add_method('DoReset',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3LogNormalRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::LogNormalRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::LogNormalRandomVariable::LogNormalRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::LogNormalRandomVariable::GetMu() const [member function]
cls.add_method('GetMu',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::LogNormalRandomVariable::GetSigma() const [member function]
cls.add_method('GetSigma',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::LogNormalRandomVariable::GetValue(double mu, double sigma) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'mu'), param('double', 'sigma')])
## random-variable-stream.h (module 'core'): uint32_t ns3::LogNormalRandomVariable::GetInteger(uint32_t mu, uint32_t sigma) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'mu'), param('uint32_t', 'sigma')])
## random-variable-stream.h (module 'core'): double ns3::LogNormalRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::LogNormalRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3Mac16AddressChecker_methods(root_module, cls):
## mac16-address.h (module 'network'): ns3::Mac16AddressChecker::Mac16AddressChecker() [constructor]
cls.add_constructor([])
## mac16-address.h (module 'network'): ns3::Mac16AddressChecker::Mac16AddressChecker(ns3::Mac16AddressChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::Mac16AddressChecker const &', 'arg0')])
return
def register_Ns3Mac16AddressValue_methods(root_module, cls):
## mac16-address.h (module 'network'): ns3::Mac16AddressValue::Mac16AddressValue() [constructor]
cls.add_constructor([])
## mac16-address.h (module 'network'): ns3::Mac16AddressValue::Mac16AddressValue(ns3::Mac16Address const & value) [constructor]
cls.add_constructor([param('ns3::Mac16Address const &', 'value')])
## mac16-address.h (module 'network'): ns3::Mac16AddressValue::Mac16AddressValue(ns3::Mac16AddressValue const & arg0) [constructor]
cls.add_constructor([param('ns3::Mac16AddressValue const &', 'arg0')])
## mac16-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Mac16AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## mac16-address.h (module 'network'): bool ns3::Mac16AddressValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## mac16-address.h (module 'network'): ns3::Mac16Address ns3::Mac16AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Mac16Address',
[],
is_const=True)
## mac16-address.h (module 'network'): std::string ns3::Mac16AddressValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## mac16-address.h (module 'network'): void ns3::Mac16AddressValue::Set(ns3::Mac16Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Mac16Address const &', 'value')])
return
def register_Ns3Mac48AddressChecker_methods(root_module, cls):
## mac48-address.h (module 'network'): ns3::Mac48AddressChecker::Mac48AddressChecker() [constructor]
cls.add_constructor([])
## mac48-address.h (module 'network'): ns3::Mac48AddressChecker::Mac48AddressChecker(ns3::Mac48AddressChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::Mac48AddressChecker const &', 'arg0')])
return
def register_Ns3Mac48AddressValue_methods(root_module, cls):
## mac48-address.h (module 'network'): ns3::Mac48AddressValue::Mac48AddressValue() [constructor]
cls.add_constructor([])
## mac48-address.h (module 'network'): ns3::Mac48AddressValue::Mac48AddressValue(ns3::Mac48Address const & value) [constructor]
cls.add_constructor([param('ns3::Mac48Address const &', 'value')])
## mac48-address.h (module 'network'): ns3::Mac48AddressValue::Mac48AddressValue(ns3::Mac48AddressValue const & arg0) [constructor]
cls.add_constructor([param('ns3::Mac48AddressValue const &', 'arg0')])
## mac48-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Mac48AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## mac48-address.h (module 'network'): bool ns3::Mac48AddressValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## mac48-address.h (module 'network'): ns3::Mac48Address ns3::Mac48AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Mac48Address',
[],
is_const=True)
## mac48-address.h (module 'network'): std::string ns3::Mac48AddressValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## mac48-address.h (module 'network'): void ns3::Mac48AddressValue::Set(ns3::Mac48Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Mac48Address const &', 'value')])
return
def register_Ns3Mac64AddressChecker_methods(root_module, cls):
## mac64-address.h (module 'network'): ns3::Mac64AddressChecker::Mac64AddressChecker() [constructor]
cls.add_constructor([])
## mac64-address.h (module 'network'): ns3::Mac64AddressChecker::Mac64AddressChecker(ns3::Mac64AddressChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::Mac64AddressChecker const &', 'arg0')])
return
def register_Ns3Mac64AddressValue_methods(root_module, cls):
## mac64-address.h (module 'network'): ns3::Mac64AddressValue::Mac64AddressValue() [constructor]
cls.add_constructor([])
## mac64-address.h (module 'network'): ns3::Mac64AddressValue::Mac64AddressValue(ns3::Mac64Address const & value) [constructor]
cls.add_constructor([param('ns3::Mac64Address const &', 'value')])
## mac64-address.h (module 'network'): ns3::Mac64AddressValue::Mac64AddressValue(ns3::Mac64AddressValue const & arg0) [constructor]
cls.add_constructor([param('ns3::Mac64AddressValue const &', 'arg0')])
## mac64-address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::Mac64AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## mac64-address.h (module 'network'): bool ns3::Mac64AddressValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## mac64-address.h (module 'network'): ns3::Mac64Address ns3::Mac64AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Mac64Address',
[],
is_const=True)
## mac64-address.h (module 'network'): std::string ns3::Mac64AddressValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## mac64-address.h (module 'network'): void ns3::Mac64AddressValue::Set(ns3::Mac64Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Mac64Address const &', 'value')])
return
def register_Ns3MinMaxAvgTotalCalculator__Unsigned_int_methods(root_module, cls):
## basic-data-calculators.h (module 'stats'): ns3::MinMaxAvgTotalCalculator<unsigned int>::MinMaxAvgTotalCalculator(ns3::MinMaxAvgTotalCalculator<unsigned int> const & arg0) [constructor]
cls.add_constructor([param('ns3::MinMaxAvgTotalCalculator< unsigned int > const &', 'arg0')])
## basic-data-calculators.h (module 'stats'): ns3::MinMaxAvgTotalCalculator<unsigned int>::MinMaxAvgTotalCalculator() [constructor]
cls.add_constructor([])
## basic-data-calculators.h (module 'stats'): static ns3::TypeId ns3::MinMaxAvgTotalCalculator<unsigned int>::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<unsigned int>::Output(ns3::DataOutputCallback & callback) const [member function]
cls.add_method('Output',
'void',
[param('ns3::DataOutputCallback &', 'callback')],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<unsigned int>::Reset() [member function]
cls.add_method('Reset',
'void',
[])
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<unsigned int>::Update(unsigned int const i) [member function]
cls.add_method('Update',
'void',
[param('unsigned int const', 'i')])
## basic-data-calculators.h (module 'stats'): long int ns3::MinMaxAvgTotalCalculator<unsigned int>::getCount() const [member function]
cls.add_method('getCount',
'long int',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<unsigned int>::getMax() const [member function]
cls.add_method('getMax',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<unsigned int>::getMean() const [member function]
cls.add_method('getMean',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<unsigned int>::getMin() const [member function]
cls.add_method('getMin',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<unsigned int>::getSqrSum() const [member function]
cls.add_method('getSqrSum',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<unsigned int>::getStddev() const [member function]
cls.add_method('getStddev',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<unsigned int>::getSum() const [member function]
cls.add_method('getSum',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): double ns3::MinMaxAvgTotalCalculator<unsigned int>::getVariance() const [member function]
cls.add_method('getVariance',
'double',
[],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): void ns3::MinMaxAvgTotalCalculator<unsigned int>::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3NetDevice_methods(root_module, cls):
## net-device.h (module 'network'): ns3::NetDevice::NetDevice() [constructor]
cls.add_constructor([])
## net-device.h (module 'network'): ns3::NetDevice::NetDevice(ns3::NetDevice const & arg0) [constructor]
cls.add_constructor([param('ns3::NetDevice const &', 'arg0')])
## net-device.h (module 'network'): void ns3::NetDevice::AddLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
cls.add_method('AddLinkChangeCallback',
'void',
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetAddress() const [member function]
cls.add_method('GetAddress',
'ns3::Address',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetBroadcast() const [member function]
cls.add_method('GetBroadcast',
'ns3::Address',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Ptr<ns3::Channel> ns3::NetDevice::GetChannel() const [member function]
cls.add_method('GetChannel',
'ns3::Ptr< ns3::Channel >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): uint32_t ns3::NetDevice::GetIfIndex() const [member function]
cls.add_method('GetIfIndex',
'uint32_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): uint16_t ns3::NetDevice::GetMtu() const [member function]
cls.add_method('GetMtu',
'uint16_t',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetMulticast(ns3::Ipv4Address multicastGroup) const [member function]
cls.add_method('GetMulticast',
'ns3::Address',
[param('ns3::Ipv4Address', 'multicastGroup')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Address ns3::NetDevice::GetMulticast(ns3::Ipv6Address addr) const [member function]
cls.add_method('GetMulticast',
'ns3::Address',
[param('ns3::Ipv6Address', 'addr')],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): ns3::Ptr<ns3::Node> ns3::NetDevice::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): static ns3::TypeId ns3::NetDevice::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsBridge() const [member function]
cls.add_method('IsBridge',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsBroadcast() const [member function]
cls.add_method('IsBroadcast',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsLinkUp() const [member function]
cls.add_method('IsLinkUp',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsMulticast() const [member function]
cls.add_method('IsMulticast',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::IsPointToPoint() const [member function]
cls.add_method('IsPointToPoint',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::NeedsArp() const [member function]
cls.add_method('NeedsArp',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::Send(ns3::Ptr<ns3::Packet> packet, ns3::Address const & dest, uint16_t protocolNumber) [member function]
cls.add_method('Send',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::SendFrom(ns3::Ptr<ns3::Packet> packet, ns3::Address const & source, ns3::Address const & dest, uint16_t protocolNumber) [member function]
cls.add_method('SendFrom',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'source'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetAddress(ns3::Address address) [member function]
cls.add_method('SetAddress',
'void',
[param('ns3::Address', 'address')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetIfIndex(uint32_t const index) [member function]
cls.add_method('SetIfIndex',
'void',
[param('uint32_t const', 'index')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::SetMtu(uint16_t const mtu) [member function]
cls.add_method('SetMtu',
'bool',
[param('uint16_t const', 'mtu')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetPromiscReceiveCallback(ns3::NetDevice::PromiscReceiveCallback cb) [member function]
cls.add_method('SetPromiscReceiveCallback',
'void',
[param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'cb')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): void ns3::NetDevice::SetReceiveCallback(ns3::NetDevice::ReceiveCallback cb) [member function]
cls.add_method('SetReceiveCallback',
'void',
[param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')],
is_pure_virtual=True, is_virtual=True)
## net-device.h (module 'network'): bool ns3::NetDevice::SupportsSendFrom() const [member function]
cls.add_method('SupportsSendFrom',
'bool',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
return
def register_Ns3NetDeviceQueue_methods(root_module, cls):
## net-device-queue-interface.h (module 'network'): ns3::NetDeviceQueue::NetDeviceQueue() [constructor]
cls.add_constructor([])
## net-device-queue-interface.h (module 'network'): void ns3::NetDeviceQueue::Start() [member function]
cls.add_method('Start',
'void',
[],
is_virtual=True)
## net-device-queue-interface.h (module 'network'): void ns3::NetDeviceQueue::Stop() [member function]
cls.add_method('Stop',
'void',
[],
is_virtual=True)
## net-device-queue-interface.h (module 'network'): void ns3::NetDeviceQueue::Wake() [member function]
cls.add_method('Wake',
'void',
[],
is_virtual=True)
## net-device-queue-interface.h (module 'network'): bool ns3::NetDeviceQueue::IsStopped() const [member function]
cls.add_method('IsStopped',
'bool',
[],
is_const=True)
## net-device-queue-interface.h (module 'network'): void ns3::NetDeviceQueue::NotifyAggregatedObject(ns3::Ptr<ns3::NetDeviceQueueInterface> ndqi) [member function]
cls.add_method('NotifyAggregatedObject',
'void',
[param('ns3::Ptr< ns3::NetDeviceQueueInterface >', 'ndqi')])
## net-device-queue-interface.h (module 'network'): void ns3::NetDeviceQueue::SetWakeCallback(ns3::NetDeviceQueue::WakeCallback cb) [member function]
cls.add_method('SetWakeCallback',
'void',
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')],
is_virtual=True)
## net-device-queue-interface.h (module 'network'): void ns3::NetDeviceQueue::NotifyQueuedBytes(uint32_t bytes) [member function]
cls.add_method('NotifyQueuedBytes',
'void',
[param('uint32_t', 'bytes')])
## net-device-queue-interface.h (module 'network'): void ns3::NetDeviceQueue::NotifyTransmittedBytes(uint32_t bytes) [member function]
cls.add_method('NotifyTransmittedBytes',
'void',
[param('uint32_t', 'bytes')])
## net-device-queue-interface.h (module 'network'): void ns3::NetDeviceQueue::ResetQueueLimits() [member function]
cls.add_method('ResetQueueLimits',
'void',
[])
## net-device-queue-interface.h (module 'network'): void ns3::NetDeviceQueue::SetQueueLimits(ns3::Ptr<ns3::QueueLimits> ql) [member function]
cls.add_method('SetQueueLimits',
'void',
[param('ns3::Ptr< ns3::QueueLimits >', 'ql')])
## net-device-queue-interface.h (module 'network'): ns3::Ptr<ns3::QueueLimits> ns3::NetDeviceQueue::GetQueueLimits() [member function]
cls.add_method('GetQueueLimits',
'ns3::Ptr< ns3::QueueLimits >',
[])
## net-device-queue-interface.h (module 'network'): ns3::NetDeviceQueue::NetDeviceQueue(ns3::NetDeviceQueue const & arg0) [constructor]
cls.add_constructor([param('ns3::NetDeviceQueue const &', 'arg0')])
return
def register_Ns3NetDeviceQueueInterface_methods(root_module, cls):
## net-device-queue-interface.h (module 'network'): ns3::NetDeviceQueueInterface::NetDeviceQueueInterface(ns3::NetDeviceQueueInterface const & arg0) [constructor]
cls.add_constructor([param('ns3::NetDeviceQueueInterface const &', 'arg0')])
## net-device-queue-interface.h (module 'network'): ns3::NetDeviceQueueInterface::NetDeviceQueueInterface() [constructor]
cls.add_constructor([])
## net-device-queue-interface.h (module 'network'): std::size_t ns3::NetDeviceQueueInterface::GetNTxQueues() const [member function]
cls.add_method('GetNTxQueues',
'std::size_t',
[],
is_const=True)
## net-device-queue-interface.h (module 'network'): ns3::NetDeviceQueueInterface::SelectQueueCallback ns3::NetDeviceQueueInterface::GetSelectQueueCallback() const [member function]
cls.add_method('GetSelectQueueCallback',
'ns3::NetDeviceQueueInterface::SelectQueueCallback',
[],
is_const=True)
## net-device-queue-interface.h (module 'network'): ns3::Ptr<ns3::NetDeviceQueue> ns3::NetDeviceQueueInterface::GetTxQueue(std::size_t i) const [member function]
cls.add_method('GetTxQueue',
'ns3::Ptr< ns3::NetDeviceQueue >',
[param('std::size_t', 'i')],
is_const=True)
## net-device-queue-interface.h (module 'network'): static ns3::TypeId ns3::NetDeviceQueueInterface::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## net-device-queue-interface.h (module 'network'): void ns3::NetDeviceQueueInterface::SetNTxQueues(std::size_t numTxQueues) [member function]
cls.add_method('SetNTxQueues',
'void',
[param('std::size_t', 'numTxQueues')])
## net-device-queue-interface.h (module 'network'): void ns3::NetDeviceQueueInterface::SetSelectQueueCallback(ns3::NetDeviceQueueInterface::SelectQueueCallback cb) [member function]
cls.add_method('SetSelectQueueCallback',
'void',
[param('std::function< unsigned long long ( ns3::Ptr< ns3::QueueItem > ) >', 'cb')])
## net-device-queue-interface.h (module 'network'): void ns3::NetDeviceQueueInterface::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## net-device-queue-interface.h (module 'network'): void ns3::NetDeviceQueueInterface::NotifyNewAggregate() [member function]
cls.add_method('NotifyNewAggregate',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3NixVector_methods(root_module, cls):
cls.add_output_stream_operator()
## nix-vector.h (module 'network'): ns3::NixVector::NixVector() [constructor]
cls.add_constructor([])
## nix-vector.h (module 'network'): ns3::NixVector::NixVector(ns3::NixVector const & o) [constructor]
cls.add_constructor([param('ns3::NixVector const &', 'o')])
## nix-vector.h (module 'network'): void ns3::NixVector::AddNeighborIndex(uint32_t newBits, uint32_t numberOfBits) [member function]
cls.add_method('AddNeighborIndex',
'void',
[param('uint32_t', 'newBits'), param('uint32_t', 'numberOfBits')])
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::BitCount(uint32_t numberOfNeighbors) const [member function]
cls.add_method('BitCount',
'uint32_t',
[param('uint32_t', 'numberOfNeighbors')],
is_const=True)
## nix-vector.h (module 'network'): ns3::Ptr<ns3::NixVector> ns3::NixVector::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::NixVector >',
[],
is_const=True)
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::Deserialize(uint32_t const * buffer, uint32_t size) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('uint32_t const *', 'buffer'), param('uint32_t', 'size')])
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::ExtractNeighborIndex(uint32_t numberOfBits) [member function]
cls.add_method('ExtractNeighborIndex',
'uint32_t',
[param('uint32_t', 'numberOfBits')])
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::GetRemainingBits() [member function]
cls.add_method('GetRemainingBits',
'uint32_t',
[])
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## nix-vector.h (module 'network'): uint32_t ns3::NixVector::Serialize(uint32_t * buffer, uint32_t maxSize) const [member function]
cls.add_method('Serialize',
'uint32_t',
[param('uint32_t *', 'buffer'), param('uint32_t', 'maxSize')],
is_const=True)
return
def register_Ns3Node_methods(root_module, cls):
## node.h (module 'network'): ns3::Node::Node(ns3::Node const & arg0) [constructor]
cls.add_constructor([param('ns3::Node const &', 'arg0')])
## node.h (module 'network'): ns3::Node::Node() [constructor]
cls.add_constructor([])
## node.h (module 'network'): ns3::Node::Node(uint32_t systemId) [constructor]
cls.add_constructor([param('uint32_t', 'systemId')])
## node.h (module 'network'): uint32_t ns3::Node::AddApplication(ns3::Ptr<ns3::Application> application) [member function]
cls.add_method('AddApplication',
'uint32_t',
[param('ns3::Ptr< ns3::Application >', 'application')])
## node.h (module 'network'): uint32_t ns3::Node::AddDevice(ns3::Ptr<ns3::NetDevice> device) [member function]
cls.add_method('AddDevice',
'uint32_t',
[param('ns3::Ptr< ns3::NetDevice >', 'device')])
## node.h (module 'network'): static bool ns3::Node::ChecksumEnabled() [member function]
cls.add_method('ChecksumEnabled',
'bool',
[],
is_static=True)
## node.h (module 'network'): ns3::Ptr<ns3::Application> ns3::Node::GetApplication(uint32_t index) const [member function]
cls.add_method('GetApplication',
'ns3::Ptr< ns3::Application >',
[param('uint32_t', 'index')],
is_const=True)
## node.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::Node::GetDevice(uint32_t index) const [member function]
cls.add_method('GetDevice',
'ns3::Ptr< ns3::NetDevice >',
[param('uint32_t', 'index')],
is_const=True)
## node.h (module 'network'): uint32_t ns3::Node::GetId() const [member function]
cls.add_method('GetId',
'uint32_t',
[],
is_const=True)
## node.h (module 'network'): ns3::Time ns3::Node::GetLocalTime() const [member function]
cls.add_method('GetLocalTime',
'ns3::Time',
[],
is_const=True)
## node.h (module 'network'): uint32_t ns3::Node::GetNApplications() const [member function]
cls.add_method('GetNApplications',
'uint32_t',
[],
is_const=True)
## node.h (module 'network'): uint32_t ns3::Node::GetNDevices() const [member function]
cls.add_method('GetNDevices',
'uint32_t',
[],
is_const=True)
## node.h (module 'network'): uint32_t ns3::Node::GetSystemId() const [member function]
cls.add_method('GetSystemId',
'uint32_t',
[],
is_const=True)
## node.h (module 'network'): static ns3::TypeId ns3::Node::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## node.h (module 'network'): void ns3::Node::RegisterDeviceAdditionListener(ns3::Node::DeviceAdditionListener listener) [member function]
cls.add_method('RegisterDeviceAdditionListener',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'listener')])
## node.h (module 'network'): void ns3::Node::RegisterProtocolHandler(ns3::Node::ProtocolHandler handler, uint16_t protocolType, ns3::Ptr<ns3::NetDevice> device, bool promiscuous=false) [member function]
cls.add_method('RegisterProtocolHandler',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'handler'), param('uint16_t', 'protocolType'), param('ns3::Ptr< ns3::NetDevice >', 'device'), param('bool', 'promiscuous', default_value='false')])
## node.h (module 'network'): void ns3::Node::UnregisterDeviceAdditionListener(ns3::Node::DeviceAdditionListener listener) [member function]
cls.add_method('UnregisterDeviceAdditionListener',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'listener')])
## node.h (module 'network'): void ns3::Node::UnregisterProtocolHandler(ns3::Node::ProtocolHandler handler) [member function]
cls.add_method('UnregisterProtocolHandler',
'void',
[param('ns3::Callback< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'handler')])
## node.h (module 'network'): void ns3::Node::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## node.h (module 'network'): void ns3::Node::DoInitialize() [member function]
cls.add_method('DoInitialize',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3NormalRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): ns3::NormalRandomVariable::INFINITE_VALUE [variable]
cls.add_static_attribute('INFINITE_VALUE', 'double const', is_const=True)
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::NormalRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::NormalRandomVariable::NormalRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::NormalRandomVariable::GetMean() const [member function]
cls.add_method('GetMean',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::NormalRandomVariable::GetVariance() const [member function]
cls.add_method('GetVariance',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::NormalRandomVariable::GetBound() const [member function]
cls.add_method('GetBound',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::NormalRandomVariable::GetValue(double mean, double variance, double bound=ns3::NormalRandomVariable::INFINITE_VALUE) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'mean'), param('double', 'variance'), param('double', 'bound', default_value='ns3::NormalRandomVariable::INFINITE_VALUE')])
## random-variable-stream.h (module 'core'): uint32_t ns3::NormalRandomVariable::GetInteger(uint32_t mean, uint32_t variance, uint32_t bound) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'mean'), param('uint32_t', 'variance'), param('uint32_t', 'bound')])
## random-variable-stream.h (module 'core'): double ns3::NormalRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::NormalRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3ObjectFactoryChecker_methods(root_module, cls):
## object-factory.h (module 'core'): ns3::ObjectFactoryChecker::ObjectFactoryChecker() [constructor]
cls.add_constructor([])
## object-factory.h (module 'core'): ns3::ObjectFactoryChecker::ObjectFactoryChecker(ns3::ObjectFactoryChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::ObjectFactoryChecker const &', 'arg0')])
return
def register_Ns3ObjectFactoryValue_methods(root_module, cls):
## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue() [constructor]
cls.add_constructor([])
## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue(ns3::ObjectFactory const & value) [constructor]
cls.add_constructor([param('ns3::ObjectFactory const &', 'value')])
## object-factory.h (module 'core'): ns3::ObjectFactoryValue::ObjectFactoryValue(ns3::ObjectFactoryValue const & arg0) [constructor]
cls.add_constructor([param('ns3::ObjectFactoryValue const &', 'arg0')])
## object-factory.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::ObjectFactoryValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## object-factory.h (module 'core'): bool ns3::ObjectFactoryValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## object-factory.h (module 'core'): ns3::ObjectFactory ns3::ObjectFactoryValue::Get() const [member function]
cls.add_method('Get',
'ns3::ObjectFactory',
[],
is_const=True)
## object-factory.h (module 'core'): std::string ns3::ObjectFactoryValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## object-factory.h (module 'core'): void ns3::ObjectFactoryValue::Set(ns3::ObjectFactory const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::ObjectFactory const &', 'value')])
return
def register_Ns3OutputStreamWrapper_methods(root_module, cls):
## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(ns3::OutputStreamWrapper const & arg0) [constructor]
cls.add_constructor([param('ns3::OutputStreamWrapper const &', 'arg0')])
## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(std::string filename, std::ios_base::openmode filemode) [constructor]
cls.add_constructor([param('std::string', 'filename'), param('std::ios_base::openmode', 'filemode')])
## output-stream-wrapper.h (module 'network'): ns3::OutputStreamWrapper::OutputStreamWrapper(std::ostream * os) [constructor]
cls.add_constructor([param('std::ostream *', 'os')])
## output-stream-wrapper.h (module 'network'): std::ostream * ns3::OutputStreamWrapper::GetStream() [member function]
cls.add_method('GetStream',
'std::ostream *',
[])
return
def register_Ns3Packet_methods(root_module, cls):
cls.add_output_stream_operator()
## packet.h (module 'network'): ns3::Packet::Packet() [constructor]
cls.add_constructor([])
## packet.h (module 'network'): ns3::Packet::Packet(ns3::Packet const & o) [constructor]
cls.add_constructor([param('ns3::Packet const &', 'o')])
## packet.h (module 'network'): ns3::Packet::Packet(uint32_t size) [constructor]
cls.add_constructor([param('uint32_t', 'size')])
## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size, bool magic) [constructor]
cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size'), param('bool', 'magic')])
## packet.h (module 'network'): ns3::Packet::Packet(uint8_t const * buffer, uint32_t size) [constructor]
cls.add_constructor([param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## packet.h (module 'network'): void ns3::Packet::AddAtEnd(ns3::Ptr<const ns3::Packet> packet) [member function]
cls.add_method('AddAtEnd',
'void',
[param('ns3::Ptr< ns3::Packet const >', 'packet')])
## packet.h (module 'network'): void ns3::Packet::AddByteTag(ns3::Tag const & tag) const [member function]
cls.add_method('AddByteTag',
'void',
[param('ns3::Tag const &', 'tag')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::AddHeader(ns3::Header const & header) [member function]
cls.add_method('AddHeader',
'void',
[param('ns3::Header const &', 'header')])
## packet.h (module 'network'): void ns3::Packet::AddPacketTag(ns3::Tag const & tag) const [member function]
cls.add_method('AddPacketTag',
'void',
[param('ns3::Tag const &', 'tag')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::AddPaddingAtEnd(uint32_t size) [member function]
cls.add_method('AddPaddingAtEnd',
'void',
[param('uint32_t', 'size')])
## packet.h (module 'network'): void ns3::Packet::AddTrailer(ns3::Trailer const & trailer) [member function]
cls.add_method('AddTrailer',
'void',
[param('ns3::Trailer const &', 'trailer')])
## packet.h (module 'network'): ns3::PacketMetadata::ItemIterator ns3::Packet::BeginItem() const [member function]
cls.add_method('BeginItem',
'ns3::PacketMetadata::ItemIterator',
[],
is_const=True)
## packet.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Packet::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::Packet >',
[],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::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)
## packet.h (module 'network'): void ns3::Packet::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)
## packet.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Packet::CreateFragment(uint32_t start, uint32_t length) const [member function]
cls.add_method('CreateFragment',
'ns3::Ptr< ns3::Packet >',
[param('uint32_t', 'start'), param('uint32_t', 'length')],
is_const=True)
## packet.h (module 'network'): static void ns3::Packet::EnableChecking() [member function]
cls.add_method('EnableChecking',
'void',
[],
is_static=True)
## packet.h (module 'network'): static void ns3::Packet::EnablePrinting() [member function]
cls.add_method('EnablePrinting',
'void',
[],
is_static=True)
## packet.h (module 'network'): bool ns3::Packet::FindFirstMatchingByteTag(ns3::Tag & tag) const [member function]
cls.add_method('FindFirstMatchingByteTag',
'bool',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet.h (module 'network'): ns3::ByteTagIterator ns3::Packet::GetByteTagIterator() const [member function]
cls.add_method('GetByteTagIterator',
'ns3::ByteTagIterator',
[],
is_const=True)
## packet.h (module 'network'): ns3::Ptr<ns3::NixVector> ns3::Packet::GetNixVector() const [member function]
cls.add_method('GetNixVector',
'ns3::Ptr< ns3::NixVector >',
[],
is_const=True)
## packet.h (module 'network'): ns3::PacketTagIterator ns3::Packet::GetPacketTagIterator() const [member function]
cls.add_method('GetPacketTagIterator',
'ns3::PacketTagIterator',
[],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::GetSize() const [member function]
cls.add_method('GetSize',
'uint32_t',
[],
is_const=True)
## packet.h (module 'network'): uint64_t ns3::Packet::GetUid() const [member function]
cls.add_method('GetUid',
'uint64_t',
[],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::PeekHeader(ns3::Header & header) const [member function]
cls.add_method('PeekHeader',
'uint32_t',
[param('ns3::Header &', 'header')],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::PeekHeader(ns3::Header & header, uint32_t size) const [member function]
cls.add_method('PeekHeader',
'uint32_t',
[param('ns3::Header &', 'header'), param('uint32_t', 'size')],
is_const=True)
## packet.h (module 'network'): bool ns3::Packet::PeekPacketTag(ns3::Tag & tag) const [member function]
cls.add_method('PeekPacketTag',
'bool',
[param('ns3::Tag &', 'tag')],
is_const=True)
## packet.h (module 'network'): uint32_t ns3::Packet::PeekTrailer(ns3::Trailer & trailer) [member function]
cls.add_method('PeekTrailer',
'uint32_t',
[param('ns3::Trailer &', 'trailer')])
## packet.h (module 'network'): void ns3::Packet::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::PrintByteTags(std::ostream & os) const [member function]
cls.add_method('PrintByteTags',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::PrintPacketTags(std::ostream & os) const [member function]
cls.add_method('PrintPacketTags',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packet.h (module 'network'): void ns3::Packet::RemoveAllByteTags() [member function]
cls.add_method('RemoveAllByteTags',
'void',
[])
## packet.h (module 'network'): void ns3::Packet::RemoveAllPacketTags() [member function]
cls.add_method('RemoveAllPacketTags',
'void',
[])
## packet.h (module 'network'): void ns3::Packet::RemoveAtEnd(uint32_t size) [member function]
cls.add_method('RemoveAtEnd',
'void',
[param('uint32_t', 'size')])
## packet.h (module 'network'): void ns3::Packet::RemoveAtStart(uint32_t size) [member function]
cls.add_method('RemoveAtStart',
'void',
[param('uint32_t', 'size')])
## packet.h (module 'network'): uint32_t ns3::Packet::RemoveHeader(ns3::Header & header) [member function]
cls.add_method('RemoveHeader',
'uint32_t',
[param('ns3::Header &', 'header')])
## packet.h (module 'network'): uint32_t ns3::Packet::RemoveHeader(ns3::Header & header, uint32_t size) [member function]
cls.add_method('RemoveHeader',
'uint32_t',
[param('ns3::Header &', 'header'), param('uint32_t', 'size')])
## packet.h (module 'network'): bool ns3::Packet::RemovePacketTag(ns3::Tag & tag) [member function]
cls.add_method('RemovePacketTag',
'bool',
[param('ns3::Tag &', 'tag')])
## packet.h (module 'network'): uint32_t ns3::Packet::RemoveTrailer(ns3::Trailer & trailer) [member function]
cls.add_method('RemoveTrailer',
'uint32_t',
[param('ns3::Trailer &', 'trailer')])
## packet.h (module 'network'): bool ns3::Packet::ReplacePacketTag(ns3::Tag & tag) [member function]
cls.add_method('ReplacePacketTag',
'bool',
[param('ns3::Tag &', 'tag')])
## packet.h (module 'network'): uint32_t ns3::Packet::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)
## packet.h (module 'network'): void ns3::Packet::SetNixVector(ns3::Ptr<ns3::NixVector> nixVector) [member function]
cls.add_method('SetNixVector',
'void',
[param('ns3::Ptr< ns3::NixVector >', 'nixVector')])
## packet.h (module 'network'): std::string ns3::Packet::ToString() const [member function]
cls.add_method('ToString',
'std::string',
[],
is_const=True)
return
def register_Ns3PacketSizeMinMaxAvgTotalCalculator_methods(root_module, cls):
## packet-data-calculators.h (module 'network'): ns3::PacketSizeMinMaxAvgTotalCalculator::PacketSizeMinMaxAvgTotalCalculator(ns3::PacketSizeMinMaxAvgTotalCalculator const & arg0) [constructor]
cls.add_constructor([param('ns3::PacketSizeMinMaxAvgTotalCalculator const &', 'arg0')])
## packet-data-calculators.h (module 'network'): ns3::PacketSizeMinMaxAvgTotalCalculator::PacketSizeMinMaxAvgTotalCalculator() [constructor]
cls.add_constructor([])
## packet-data-calculators.h (module 'network'): void ns3::PacketSizeMinMaxAvgTotalCalculator::FrameUpdate(std::string path, ns3::Ptr<const ns3::Packet> packet, ns3::Mac48Address realto) [member function]
cls.add_method('FrameUpdate',
'void',
[param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'realto')])
## packet-data-calculators.h (module 'network'): static ns3::TypeId ns3::PacketSizeMinMaxAvgTotalCalculator::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## packet-data-calculators.h (module 'network'): void ns3::PacketSizeMinMaxAvgTotalCalculator::PacketUpdate(std::string path, ns3::Ptr<const ns3::Packet> packet) [member function]
cls.add_method('PacketUpdate',
'void',
[param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet')])
## packet-data-calculators.h (module 'network'): void ns3::PacketSizeMinMaxAvgTotalCalculator::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3PacketSocket_methods(root_module, cls):
## packet-socket.h (module 'network'): ns3::PacketSocket::PacketSocket(ns3::PacketSocket const & arg0) [constructor]
cls.add_constructor([param('ns3::PacketSocket const &', 'arg0')])
## packet-socket.h (module 'network'): ns3::PacketSocket::PacketSocket() [constructor]
cls.add_constructor([])
## packet-socket.h (module 'network'): int ns3::PacketSocket::Bind() [member function]
cls.add_method('Bind',
'int',
[],
is_virtual=True)
## packet-socket.h (module 'network'): int ns3::PacketSocket::Bind(ns3::Address const & address) [member function]
cls.add_method('Bind',
'int',
[param('ns3::Address const &', 'address')],
is_virtual=True)
## packet-socket.h (module 'network'): int ns3::PacketSocket::Bind6() [member function]
cls.add_method('Bind6',
'int',
[],
is_virtual=True)
## packet-socket.h (module 'network'): int ns3::PacketSocket::Close() [member function]
cls.add_method('Close',
'int',
[],
is_virtual=True)
## packet-socket.h (module 'network'): int ns3::PacketSocket::Connect(ns3::Address const & address) [member function]
cls.add_method('Connect',
'int',
[param('ns3::Address const &', 'address')],
is_virtual=True)
## packet-socket.h (module 'network'): bool ns3::PacketSocket::GetAllowBroadcast() const [member function]
cls.add_method('GetAllowBroadcast',
'bool',
[],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): ns3::Socket::SocketErrno ns3::PacketSocket::GetErrno() const [member function]
cls.add_method('GetErrno',
'ns3::Socket::SocketErrno',
[],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): ns3::Ptr<ns3::Node> ns3::PacketSocket::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): int ns3::PacketSocket::GetPeerName(ns3::Address & address) const [member function]
cls.add_method('GetPeerName',
'int',
[param('ns3::Address &', 'address')],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): uint32_t ns3::PacketSocket::GetRxAvailable() const [member function]
cls.add_method('GetRxAvailable',
'uint32_t',
[],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): int ns3::PacketSocket::GetSockName(ns3::Address & address) const [member function]
cls.add_method('GetSockName',
'int',
[param('ns3::Address &', 'address')],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): ns3::Socket::SocketType ns3::PacketSocket::GetSocketType() const [member function]
cls.add_method('GetSocketType',
'ns3::Socket::SocketType',
[],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): uint32_t ns3::PacketSocket::GetTxAvailable() const [member function]
cls.add_method('GetTxAvailable',
'uint32_t',
[],
is_const=True, is_virtual=True)
## packet-socket.h (module 'network'): static ns3::TypeId ns3::PacketSocket::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## packet-socket.h (module 'network'): int ns3::PacketSocket::Listen() [member function]
cls.add_method('Listen',
'int',
[],
is_virtual=True)
## packet-socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::PacketSocket::Recv(uint32_t maxSize, uint32_t flags) [member function]
cls.add_method('Recv',
'ns3::Ptr< ns3::Packet >',
[param('uint32_t', 'maxSize'), param('uint32_t', 'flags')],
is_virtual=True)
## packet-socket.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::PacketSocket::RecvFrom(uint32_t maxSize, uint32_t flags, ns3::Address & fromAddress) [member function]
cls.add_method('RecvFrom',
'ns3::Ptr< ns3::Packet >',
[param('uint32_t', 'maxSize'), param('uint32_t', 'flags'), param('ns3::Address &', 'fromAddress')],
is_virtual=True)
## packet-socket.h (module 'network'): int ns3::PacketSocket::Send(ns3::Ptr<ns3::Packet> p, uint32_t flags) [member function]
cls.add_method('Send',
'int',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('uint32_t', 'flags')],
is_virtual=True)
## packet-socket.h (module 'network'): int ns3::PacketSocket::SendTo(ns3::Ptr<ns3::Packet> p, uint32_t flags, ns3::Address const & toAddress) [member function]
cls.add_method('SendTo',
'int',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('uint32_t', 'flags'), param('ns3::Address const &', 'toAddress')],
is_virtual=True)
## packet-socket.h (module 'network'): bool ns3::PacketSocket::SetAllowBroadcast(bool allowBroadcast) [member function]
cls.add_method('SetAllowBroadcast',
'bool',
[param('bool', 'allowBroadcast')],
is_virtual=True)
## packet-socket.h (module 'network'): void ns3::PacketSocket::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')])
## packet-socket.h (module 'network'): int ns3::PacketSocket::ShutdownRecv() [member function]
cls.add_method('ShutdownRecv',
'int',
[],
is_virtual=True)
## packet-socket.h (module 'network'): int ns3::PacketSocket::ShutdownSend() [member function]
cls.add_method('ShutdownSend',
'int',
[],
is_virtual=True)
## packet-socket.h (module 'network'): void ns3::PacketSocket::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3PacketSocketClient_methods(root_module, cls):
## packet-socket-client.h (module 'network'): ns3::PacketSocketClient::PacketSocketClient(ns3::PacketSocketClient const & arg0) [constructor]
cls.add_constructor([param('ns3::PacketSocketClient const &', 'arg0')])
## packet-socket-client.h (module 'network'): ns3::PacketSocketClient::PacketSocketClient() [constructor]
cls.add_constructor([])
## packet-socket-client.h (module 'network'): uint8_t ns3::PacketSocketClient::GetPriority() const [member function]
cls.add_method('GetPriority',
'uint8_t',
[],
is_const=True)
## packet-socket-client.h (module 'network'): static ns3::TypeId ns3::PacketSocketClient::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## packet-socket-client.h (module 'network'): void ns3::PacketSocketClient::SetRemote(ns3::PacketSocketAddress addr) [member function]
cls.add_method('SetRemote',
'void',
[param('ns3::PacketSocketAddress', 'addr')])
## packet-socket-client.h (module 'network'): void ns3::PacketSocketClient::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## packet-socket-client.h (module 'network'): void ns3::PacketSocketClient::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## packet-socket-client.h (module 'network'): void ns3::PacketSocketClient::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3PacketSocketFactory_methods(root_module, cls):
## packet-socket-factory.h (module 'network'): ns3::PacketSocketFactory::PacketSocketFactory(ns3::PacketSocketFactory const & arg0) [constructor]
cls.add_constructor([param('ns3::PacketSocketFactory const &', 'arg0')])
## packet-socket-factory.h (module 'network'): ns3::PacketSocketFactory::PacketSocketFactory() [constructor]
cls.add_constructor([])
## packet-socket-factory.h (module 'network'): ns3::Ptr<ns3::Socket> ns3::PacketSocketFactory::CreateSocket() [member function]
cls.add_method('CreateSocket',
'ns3::Ptr< ns3::Socket >',
[],
is_virtual=True)
## packet-socket-factory.h (module 'network'): static ns3::TypeId ns3::PacketSocketFactory::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
return
def register_Ns3PacketSocketServer_methods(root_module, cls):
## packet-socket-server.h (module 'network'): ns3::PacketSocketServer::PacketSocketServer(ns3::PacketSocketServer const & arg0) [constructor]
cls.add_constructor([param('ns3::PacketSocketServer const &', 'arg0')])
## packet-socket-server.h (module 'network'): ns3::PacketSocketServer::PacketSocketServer() [constructor]
cls.add_constructor([])
## packet-socket-server.h (module 'network'): static ns3::TypeId ns3::PacketSocketServer::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## packet-socket-server.h (module 'network'): void ns3::PacketSocketServer::SetLocal(ns3::PacketSocketAddress addr) [member function]
cls.add_method('SetLocal',
'void',
[param('ns3::PacketSocketAddress', 'addr')])
## packet-socket-server.h (module 'network'): void ns3::PacketSocketServer::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
## packet-socket-server.h (module 'network'): void ns3::PacketSocketServer::StartApplication() [member function]
cls.add_method('StartApplication',
'void',
[],
visibility='private', is_virtual=True)
## packet-socket-server.h (module 'network'): void ns3::PacketSocketServer::StopApplication() [member function]
cls.add_method('StopApplication',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3ParetoRandomVariable_methods(root_module, cls):
## random-variable-stream.h (module 'core'): static ns3::TypeId ns3::ParetoRandomVariable::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## random-variable-stream.h (module 'core'): ns3::ParetoRandomVariable::ParetoRandomVariable() [constructor]
cls.add_constructor([])
## random-variable-stream.h (module 'core'): double ns3::ParetoRandomVariable::GetMean() const [member function]
cls.add_method('GetMean',
'double',
[],
deprecated=True, is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ParetoRandomVariable::GetScale() const [member function]
cls.add_method('GetScale',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ParetoRandomVariable::GetShape() const [member function]
cls.add_method('GetShape',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ParetoRandomVariable::GetBound() const [member function]
cls.add_method('GetBound',
'double',
[],
is_const=True)
## random-variable-stream.h (module 'core'): double ns3::ParetoRandomVariable::GetValue(double scale, double shape, double bound) [member function]
cls.add_method('GetValue',
'double',
[param('double', 'scale'), param('double', 'shape'), param('double', 'bound')])
## random-variable-stream.h (module 'core'): uint32_t ns3::ParetoRandomVariable::GetInteger(uint32_t scale, uint32_t shape, uint32_t bound) [member function]
cls.add_method('GetInteger',
'uint32_t',
[param('uint32_t', 'scale'), param('uint32_t', 'shape'), param('uint32_t', 'bound')])
## random-variable-stream.h (module 'core'): double ns3::ParetoRandomVariable::GetValue() [member function]
cls.add_method('GetValue',
'double',
[],
is_virtual=True)
## random-variable-stream.h (module 'core'): uint32_t ns3::ParetoRandomVariable::GetInteger() [member function]
cls.add_method('GetInteger',
'uint32_t',
[],
is_virtual=True)
return
def register_Ns3PbbAddressBlock_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
## packetbb.h (module 'network'): ns3::PbbAddressBlock::PbbAddressBlock(ns3::PbbAddressBlock const & arg0) [constructor]
cls.add_constructor([param('ns3::PbbAddressBlock const &', 'arg0')])
## packetbb.h (module 'network'): ns3::PbbAddressBlock::PbbAddressBlock() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): ns3::Address ns3::PbbAddressBlock::AddressBack() const [member function]
cls.add_method('AddressBack',
'ns3::Address',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbAddressBlock::AddressIterator ns3::PbbAddressBlock::AddressBegin() [member function]
cls.add_method('AddressBegin',
'ns3::PbbAddressBlock::AddressIterator',
[])
## packetbb.h (module 'network'): ns3::PbbAddressBlock::ConstAddressIterator ns3::PbbAddressBlock::AddressBegin() const [member function]
cls.add_method('AddressBegin',
'ns3::PbbAddressBlock::ConstAddressIterator',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::AddressClear() [member function]
cls.add_method('AddressClear',
'void',
[])
## packetbb.h (module 'network'): bool ns3::PbbAddressBlock::AddressEmpty() const [member function]
cls.add_method('AddressEmpty',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbAddressBlock::AddressIterator ns3::PbbAddressBlock::AddressEnd() [member function]
cls.add_method('AddressEnd',
'ns3::PbbAddressBlock::AddressIterator',
[])
## packetbb.h (module 'network'): ns3::PbbAddressBlock::ConstAddressIterator ns3::PbbAddressBlock::AddressEnd() const [member function]
cls.add_method('AddressEnd',
'ns3::PbbAddressBlock::ConstAddressIterator',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbAddressBlock::AddressIterator ns3::PbbAddressBlock::AddressErase(ns3::PbbAddressBlock::AddressIterator position) [member function]
cls.add_method('AddressErase',
'ns3::PbbAddressBlock::AddressIterator',
[param('std::list< ns3::Address > iterator', 'position')])
## packetbb.h (module 'network'): ns3::PbbAddressBlock::AddressIterator ns3::PbbAddressBlock::AddressErase(ns3::PbbAddressBlock::AddressIterator first, ns3::PbbAddressBlock::AddressIterator last) [member function]
cls.add_method('AddressErase',
'ns3::PbbAddressBlock::AddressIterator',
[param('std::list< ns3::Address > iterator', 'first'), param('std::list< ns3::Address > iterator', 'last')])
## packetbb.h (module 'network'): ns3::Address ns3::PbbAddressBlock::AddressFront() const [member function]
cls.add_method('AddressFront',
'ns3::Address',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbAddressBlock::AddressIterator ns3::PbbAddressBlock::AddressInsert(ns3::PbbAddressBlock::AddressIterator position, ns3::Address const value) [member function]
cls.add_method('AddressInsert',
'ns3::PbbAddressBlock::AddressIterator',
[param('std::list< ns3::Address > iterator', 'position'), param('ns3::Address const', 'value')])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::AddressPopBack() [member function]
cls.add_method('AddressPopBack',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::AddressPopFront() [member function]
cls.add_method('AddressPopFront',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::AddressPushBack(ns3::Address address) [member function]
cls.add_method('AddressPushBack',
'void',
[param('ns3::Address', 'address')])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::AddressPushFront(ns3::Address address) [member function]
cls.add_method('AddressPushFront',
'void',
[param('ns3::Address', 'address')])
## packetbb.h (module 'network'): int ns3::PbbAddressBlock::AddressSize() const [member function]
cls.add_method('AddressSize',
'int',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::Deserialize(ns3::Buffer::Iterator & start) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::Buffer::Iterator &', 'start')])
## packetbb.h (module 'network'): uint32_t ns3::PbbAddressBlock::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbAddressBlock::PrefixBack() const [member function]
cls.add_method('PrefixBack',
'uint8_t',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbAddressBlock::PrefixIterator ns3::PbbAddressBlock::PrefixBegin() [member function]
cls.add_method('PrefixBegin',
'ns3::PbbAddressBlock::PrefixIterator',
[])
## packetbb.h (module 'network'): ns3::PbbAddressBlock::ConstPrefixIterator ns3::PbbAddressBlock::PrefixBegin() const [member function]
cls.add_method('PrefixBegin',
'ns3::PbbAddressBlock::ConstPrefixIterator',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::PrefixClear() [member function]
cls.add_method('PrefixClear',
'void',
[])
## packetbb.h (module 'network'): bool ns3::PbbAddressBlock::PrefixEmpty() const [member function]
cls.add_method('PrefixEmpty',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbAddressBlock::PrefixIterator ns3::PbbAddressBlock::PrefixEnd() [member function]
cls.add_method('PrefixEnd',
'ns3::PbbAddressBlock::PrefixIterator',
[])
## packetbb.h (module 'network'): ns3::PbbAddressBlock::ConstPrefixIterator ns3::PbbAddressBlock::PrefixEnd() const [member function]
cls.add_method('PrefixEnd',
'ns3::PbbAddressBlock::ConstPrefixIterator',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbAddressBlock::PrefixIterator ns3::PbbAddressBlock::PrefixErase(ns3::PbbAddressBlock::PrefixIterator position) [member function]
cls.add_method('PrefixErase',
'ns3::PbbAddressBlock::PrefixIterator',
[param('std::list< unsigned char > iterator', 'position')])
## packetbb.h (module 'network'): ns3::PbbAddressBlock::PrefixIterator ns3::PbbAddressBlock::PrefixErase(ns3::PbbAddressBlock::PrefixIterator first, ns3::PbbAddressBlock::PrefixIterator last) [member function]
cls.add_method('PrefixErase',
'ns3::PbbAddressBlock::PrefixIterator',
[param('std::list< unsigned char > iterator', 'first'), param('std::list< unsigned char > iterator', 'last')])
## packetbb.h (module 'network'): uint8_t ns3::PbbAddressBlock::PrefixFront() const [member function]
cls.add_method('PrefixFront',
'uint8_t',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbAddressBlock::PrefixIterator ns3::PbbAddressBlock::PrefixInsert(ns3::PbbAddressBlock::PrefixIterator position, uint8_t const value) [member function]
cls.add_method('PrefixInsert',
'ns3::PbbAddressBlock::PrefixIterator',
[param('std::list< unsigned char > iterator', 'position'), param('uint8_t const', 'value')])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::PrefixPopBack() [member function]
cls.add_method('PrefixPopBack',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::PrefixPopFront() [member function]
cls.add_method('PrefixPopFront',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::PrefixPushBack(uint8_t prefix) [member function]
cls.add_method('PrefixPushBack',
'void',
[param('uint8_t', 'prefix')])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::PrefixPushFront(uint8_t prefix) [member function]
cls.add_method('PrefixPushFront',
'void',
[param('uint8_t', 'prefix')])
## packetbb.h (module 'network'): int ns3::PbbAddressBlock::PrefixSize() const [member function]
cls.add_method('PrefixSize',
'int',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::Print(std::ostream & os, int level) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os'), param('int', 'level')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::Serialize(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True)
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressTlv> ns3::PbbAddressBlock::TlvBack() [member function]
cls.add_method('TlvBack',
'ns3::Ptr< ns3::PbbAddressTlv >',
[])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressTlv> const ns3::PbbAddressBlock::TlvBack() const [member function]
cls.add_method('TlvBack',
'ns3::Ptr< ns3::PbbAddressTlv > const',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbAddressBlock::TlvIterator ns3::PbbAddressBlock::TlvBegin() [member function]
cls.add_method('TlvBegin',
'ns3::PbbAddressBlock::TlvIterator',
[])
## packetbb.h (module 'network'): ns3::PbbAddressBlock::ConstTlvIterator ns3::PbbAddressBlock::TlvBegin() const [member function]
cls.add_method('TlvBegin',
'ns3::PbbAddressBlock::ConstTlvIterator',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::TlvClear() [member function]
cls.add_method('TlvClear',
'void',
[])
## packetbb.h (module 'network'): bool ns3::PbbAddressBlock::TlvEmpty() const [member function]
cls.add_method('TlvEmpty',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbAddressBlock::TlvIterator ns3::PbbAddressBlock::TlvEnd() [member function]
cls.add_method('TlvEnd',
'ns3::PbbAddressBlock::TlvIterator',
[])
## packetbb.h (module 'network'): ns3::PbbAddressBlock::ConstTlvIterator ns3::PbbAddressBlock::TlvEnd() const [member function]
cls.add_method('TlvEnd',
'ns3::PbbAddressBlock::ConstTlvIterator',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbAddressBlock::TlvIterator ns3::PbbAddressBlock::TlvErase(ns3::PbbAddressBlock::TlvIterator position) [member function]
cls.add_method('TlvErase',
'ns3::PbbAddressBlock::TlvIterator',
[param('ns3::PbbAddressTlvBlock::Iterator', 'position')])
## packetbb.h (module 'network'): ns3::PbbAddressBlock::TlvIterator ns3::PbbAddressBlock::TlvErase(ns3::PbbAddressBlock::TlvIterator first, ns3::PbbAddressBlock::TlvIterator last) [member function]
cls.add_method('TlvErase',
'ns3::PbbAddressBlock::TlvIterator',
[param('ns3::PbbAddressTlvBlock::Iterator', 'first'), param('ns3::PbbAddressTlvBlock::Iterator', 'last')])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressTlv> ns3::PbbAddressBlock::TlvFront() [member function]
cls.add_method('TlvFront',
'ns3::Ptr< ns3::PbbAddressTlv >',
[])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressTlv> const ns3::PbbAddressBlock::TlvFront() const [member function]
cls.add_method('TlvFront',
'ns3::Ptr< ns3::PbbAddressTlv > const',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbAddressBlock::TlvIterator ns3::PbbAddressBlock::TlvInsert(ns3::PbbAddressBlock::TlvIterator position, ns3::Ptr<ns3::PbbTlv> const value) [member function]
cls.add_method('TlvInsert',
'ns3::PbbAddressBlock::TlvIterator',
[param('ns3::PbbAddressTlvBlock::Iterator', 'position'), param('ns3::Ptr< ns3::PbbTlv > const', 'value')])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::TlvPopBack() [member function]
cls.add_method('TlvPopBack',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::TlvPopFront() [member function]
cls.add_method('TlvPopFront',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::TlvPushBack(ns3::Ptr<ns3::PbbAddressTlv> address) [member function]
cls.add_method('TlvPushBack',
'void',
[param('ns3::Ptr< ns3::PbbAddressTlv >', 'address')])
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::TlvPushFront(ns3::Ptr<ns3::PbbAddressTlv> address) [member function]
cls.add_method('TlvPushFront',
'void',
[param('ns3::Ptr< ns3::PbbAddressTlv >', 'address')])
## packetbb.h (module 'network'): int ns3::PbbAddressBlock::TlvSize() const [member function]
cls.add_method('TlvSize',
'int',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::Address ns3::PbbAddressBlock::DeserializeAddress(uint8_t * buffer) const [member function]
cls.add_method('DeserializeAddress',
'ns3::Address',
[param('uint8_t *', 'buffer')],
is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbAddressBlock::GetAddressLength() const [member function]
cls.add_method('GetAddressLength',
'uint8_t',
[],
is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::PrintAddress(std::ostream & os, ns3::PbbAddressBlock::ConstAddressIterator iter) const [member function]
cls.add_method('PrintAddress',
'void',
[param('std::ostream &', 'os'), param('std::list< ns3::Address > const_iterator', 'iter')],
is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlock::SerializeAddress(uint8_t * buffer, ns3::PbbAddressBlock::ConstAddressIterator iter) const [member function]
cls.add_method('SerializeAddress',
'void',
[param('uint8_t *', 'buffer'), param('std::list< ns3::Address > const_iterator', 'iter')],
is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True)
return
def register_Ns3PbbAddressBlockIpv4_methods(root_module, cls):
## packetbb.h (module 'network'): ns3::PbbAddressBlockIpv4::PbbAddressBlockIpv4(ns3::PbbAddressBlockIpv4 const & arg0) [constructor]
cls.add_constructor([param('ns3::PbbAddressBlockIpv4 const &', 'arg0')])
## packetbb.h (module 'network'): ns3::PbbAddressBlockIpv4::PbbAddressBlockIpv4() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): ns3::Address ns3::PbbAddressBlockIpv4::DeserializeAddress(uint8_t * buffer) const [member function]
cls.add_method('DeserializeAddress',
'ns3::Address',
[param('uint8_t *', 'buffer')],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbAddressBlockIpv4::GetAddressLength() const [member function]
cls.add_method('GetAddressLength',
'uint8_t',
[],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlockIpv4::PrintAddress(std::ostream & os, ns3::PbbAddressBlock::ConstAddressIterator iter) const [member function]
cls.add_method('PrintAddress',
'void',
[param('std::ostream &', 'os'), param('std::list< ns3::Address > const_iterator', 'iter')],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlockIpv4::SerializeAddress(uint8_t * buffer, ns3::PbbAddressBlock::ConstAddressIterator iter) const [member function]
cls.add_method('SerializeAddress',
'void',
[param('uint8_t *', 'buffer'), param('std::list< ns3::Address > const_iterator', 'iter')],
is_const=True, visibility='protected', is_virtual=True)
return
def register_Ns3PbbAddressBlockIpv6_methods(root_module, cls):
## packetbb.h (module 'network'): ns3::PbbAddressBlockIpv6::PbbAddressBlockIpv6(ns3::PbbAddressBlockIpv6 const & arg0) [constructor]
cls.add_constructor([param('ns3::PbbAddressBlockIpv6 const &', 'arg0')])
## packetbb.h (module 'network'): ns3::PbbAddressBlockIpv6::PbbAddressBlockIpv6() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): ns3::Address ns3::PbbAddressBlockIpv6::DeserializeAddress(uint8_t * buffer) const [member function]
cls.add_method('DeserializeAddress',
'ns3::Address',
[param('uint8_t *', 'buffer')],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbAddressBlockIpv6::GetAddressLength() const [member function]
cls.add_method('GetAddressLength',
'uint8_t',
[],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlockIpv6::PrintAddress(std::ostream & os, ns3::PbbAddressBlock::ConstAddressIterator iter) const [member function]
cls.add_method('PrintAddress',
'void',
[param('std::ostream &', 'os'), param('std::list< ns3::Address > const_iterator', 'iter')],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbAddressBlockIpv6::SerializeAddress(uint8_t * buffer, ns3::PbbAddressBlock::ConstAddressIterator iter) const [member function]
cls.add_method('SerializeAddress',
'void',
[param('uint8_t *', 'buffer'), param('std::list< ns3::Address > const_iterator', 'iter')],
is_const=True, visibility='protected', is_virtual=True)
return
def register_Ns3PbbMessage_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
## packetbb.h (module 'network'): ns3::PbbMessage::PbbMessage(ns3::PbbMessage const & arg0) [constructor]
cls.add_constructor([param('ns3::PbbMessage const &', 'arg0')])
## packetbb.h (module 'network'): ns3::PbbMessage::PbbMessage() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressBlock> ns3::PbbMessage::AddressBlockBack() [member function]
cls.add_method('AddressBlockBack',
'ns3::Ptr< ns3::PbbAddressBlock >',
[])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressBlock> const ns3::PbbMessage::AddressBlockBack() const [member function]
cls.add_method('AddressBlockBack',
'ns3::Ptr< ns3::PbbAddressBlock > const',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbMessage::AddressBlockIterator ns3::PbbMessage::AddressBlockBegin() [member function]
cls.add_method('AddressBlockBegin',
'ns3::PbbMessage::AddressBlockIterator',
[])
## packetbb.h (module 'network'): ns3::PbbMessage::ConstAddressBlockIterator ns3::PbbMessage::AddressBlockBegin() const [member function]
cls.add_method('AddressBlockBegin',
'ns3::PbbMessage::ConstAddressBlockIterator',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::AddressBlockClear() [member function]
cls.add_method('AddressBlockClear',
'void',
[])
## packetbb.h (module 'network'): bool ns3::PbbMessage::AddressBlockEmpty() const [member function]
cls.add_method('AddressBlockEmpty',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbMessage::AddressBlockIterator ns3::PbbMessage::AddressBlockEnd() [member function]
cls.add_method('AddressBlockEnd',
'ns3::PbbMessage::AddressBlockIterator',
[])
## packetbb.h (module 'network'): ns3::PbbMessage::ConstAddressBlockIterator ns3::PbbMessage::AddressBlockEnd() const [member function]
cls.add_method('AddressBlockEnd',
'ns3::PbbMessage::ConstAddressBlockIterator',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbMessage::AddressBlockIterator ns3::PbbMessage::AddressBlockErase(ns3::PbbMessage::AddressBlockIterator position) [member function]
cls.add_method('AddressBlockErase',
'ns3::PbbMessage::AddressBlockIterator',
[param('std::list< ns3::Ptr< ns3::PbbAddressBlock > > iterator', 'position')])
## packetbb.h (module 'network'): ns3::PbbMessage::AddressBlockIterator ns3::PbbMessage::AddressBlockErase(ns3::PbbMessage::AddressBlockIterator first, ns3::PbbMessage::AddressBlockIterator last) [member function]
cls.add_method('AddressBlockErase',
'ns3::PbbMessage::AddressBlockIterator',
[param('std::list< ns3::Ptr< ns3::PbbAddressBlock > > iterator', 'first'), param('std::list< ns3::Ptr< ns3::PbbAddressBlock > > iterator', 'last')])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressBlock> ns3::PbbMessage::AddressBlockFront() [member function]
cls.add_method('AddressBlockFront',
'ns3::Ptr< ns3::PbbAddressBlock >',
[])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressBlock> const ns3::PbbMessage::AddressBlockFront() const [member function]
cls.add_method('AddressBlockFront',
'ns3::Ptr< ns3::PbbAddressBlock > const',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::AddressBlockPopBack() [member function]
cls.add_method('AddressBlockPopBack',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbMessage::AddressBlockPopFront() [member function]
cls.add_method('AddressBlockPopFront',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbMessage::AddressBlockPushBack(ns3::Ptr<ns3::PbbAddressBlock> block) [member function]
cls.add_method('AddressBlockPushBack',
'void',
[param('ns3::Ptr< ns3::PbbAddressBlock >', 'block')])
## packetbb.h (module 'network'): void ns3::PbbMessage::AddressBlockPushFront(ns3::Ptr<ns3::PbbAddressBlock> block) [member function]
cls.add_method('AddressBlockPushFront',
'void',
[param('ns3::Ptr< ns3::PbbAddressBlock >', 'block')])
## packetbb.h (module 'network'): int ns3::PbbMessage::AddressBlockSize() const [member function]
cls.add_method('AddressBlockSize',
'int',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::Deserialize(ns3::Buffer::Iterator & start) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::Buffer::Iterator &', 'start')])
## packetbb.h (module 'network'): static ns3::Ptr<ns3::PbbMessage> ns3::PbbMessage::DeserializeMessage(ns3::Buffer::Iterator & start) [member function]
cls.add_method('DeserializeMessage',
'ns3::Ptr< ns3::PbbMessage >',
[param('ns3::Buffer::Iterator &', 'start')],
is_static=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbMessage::GetHopCount() const [member function]
cls.add_method('GetHopCount',
'uint8_t',
[],
is_const=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbMessage::GetHopLimit() const [member function]
cls.add_method('GetHopLimit',
'uint8_t',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::Address ns3::PbbMessage::GetOriginatorAddress() const [member function]
cls.add_method('GetOriginatorAddress',
'ns3::Address',
[],
is_const=True)
## packetbb.h (module 'network'): uint16_t ns3::PbbMessage::GetSequenceNumber() const [member function]
cls.add_method('GetSequenceNumber',
'uint16_t',
[],
is_const=True)
## packetbb.h (module 'network'): uint32_t ns3::PbbMessage::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbMessage::GetType() const [member function]
cls.add_method('GetType',
'uint8_t',
[],
is_const=True)
## packetbb.h (module 'network'): bool ns3::PbbMessage::HasHopCount() const [member function]
cls.add_method('HasHopCount',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): bool ns3::PbbMessage::HasHopLimit() const [member function]
cls.add_method('HasHopLimit',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): bool ns3::PbbMessage::HasOriginatorAddress() const [member function]
cls.add_method('HasOriginatorAddress',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): bool ns3::PbbMessage::HasSequenceNumber() const [member function]
cls.add_method('HasSequenceNumber',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::Print(std::ostream & os, int level) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os'), param('int', 'level')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::Serialize(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::SetHopCount(uint8_t hopcount) [member function]
cls.add_method('SetHopCount',
'void',
[param('uint8_t', 'hopcount')])
## packetbb.h (module 'network'): void ns3::PbbMessage::SetHopLimit(uint8_t hoplimit) [member function]
cls.add_method('SetHopLimit',
'void',
[param('uint8_t', 'hoplimit')])
## packetbb.h (module 'network'): void ns3::PbbMessage::SetOriginatorAddress(ns3::Address address) [member function]
cls.add_method('SetOriginatorAddress',
'void',
[param('ns3::Address', 'address')])
## packetbb.h (module 'network'): void ns3::PbbMessage::SetSequenceNumber(uint16_t seqnum) [member function]
cls.add_method('SetSequenceNumber',
'void',
[param('uint16_t', 'seqnum')])
## packetbb.h (module 'network'): void ns3::PbbMessage::SetType(uint8_t type) [member function]
cls.add_method('SetType',
'void',
[param('uint8_t', 'type')])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> ns3::PbbMessage::TlvBack() [member function]
cls.add_method('TlvBack',
'ns3::Ptr< ns3::PbbTlv >',
[])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> const ns3::PbbMessage::TlvBack() const [member function]
cls.add_method('TlvBack',
'ns3::Ptr< ns3::PbbTlv > const',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbMessage::TlvIterator ns3::PbbMessage::TlvBegin() [member function]
cls.add_method('TlvBegin',
'ns3::PbbMessage::TlvIterator',
[])
## packetbb.h (module 'network'): ns3::PbbMessage::ConstTlvIterator ns3::PbbMessage::TlvBegin() const [member function]
cls.add_method('TlvBegin',
'ns3::PbbMessage::ConstTlvIterator',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::TlvClear() [member function]
cls.add_method('TlvClear',
'void',
[])
## packetbb.h (module 'network'): bool ns3::PbbMessage::TlvEmpty() const [member function]
cls.add_method('TlvEmpty',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbMessage::TlvIterator ns3::PbbMessage::TlvEnd() [member function]
cls.add_method('TlvEnd',
'ns3::PbbMessage::TlvIterator',
[])
## packetbb.h (module 'network'): ns3::PbbMessage::ConstTlvIterator ns3::PbbMessage::TlvEnd() const [member function]
cls.add_method('TlvEnd',
'ns3::PbbMessage::ConstTlvIterator',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbMessage::TlvIterator ns3::PbbMessage::TlvErase(ns3::PbbMessage::TlvIterator position) [member function]
cls.add_method('TlvErase',
'ns3::PbbMessage::TlvIterator',
[param('std::list< ns3::Ptr< ns3::PbbTlv > > iterator', 'position')])
## packetbb.h (module 'network'): ns3::PbbMessage::TlvIterator ns3::PbbMessage::TlvErase(ns3::PbbMessage::TlvIterator first, ns3::PbbMessage::TlvIterator last) [member function]
cls.add_method('TlvErase',
'ns3::PbbMessage::TlvIterator',
[param('std::list< ns3::Ptr< ns3::PbbTlv > > iterator', 'first'), param('std::list< ns3::Ptr< ns3::PbbTlv > > iterator', 'last')])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> ns3::PbbMessage::TlvFront() [member function]
cls.add_method('TlvFront',
'ns3::Ptr< ns3::PbbTlv >',
[])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> const ns3::PbbMessage::TlvFront() const [member function]
cls.add_method('TlvFront',
'ns3::Ptr< ns3::PbbTlv > const',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::TlvPopBack() [member function]
cls.add_method('TlvPopBack',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbMessage::TlvPopFront() [member function]
cls.add_method('TlvPopFront',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbMessage::TlvPushBack(ns3::Ptr<ns3::PbbTlv> tlv) [member function]
cls.add_method('TlvPushBack',
'void',
[param('ns3::Ptr< ns3::PbbTlv >', 'tlv')])
## packetbb.h (module 'network'): void ns3::PbbMessage::TlvPushFront(ns3::Ptr<ns3::PbbTlv> tlv) [member function]
cls.add_method('TlvPushFront',
'void',
[param('ns3::Ptr< ns3::PbbTlv >', 'tlv')])
## packetbb.h (module 'network'): int ns3::PbbMessage::TlvSize() const [member function]
cls.add_method('TlvSize',
'int',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressBlock> ns3::PbbMessage::AddressBlockDeserialize(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('AddressBlockDeserialize',
'ns3::Ptr< ns3::PbbAddressBlock >',
[param('ns3::Buffer::Iterator &', 'start')],
is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): ns3::Address ns3::PbbMessage::DeserializeOriginatorAddress(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('DeserializeOriginatorAddress',
'ns3::Address',
[param('ns3::Buffer::Iterator &', 'start')],
is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): ns3::PbbAddressLength ns3::PbbMessage::GetAddressLength() const [member function]
cls.add_method('GetAddressLength',
'ns3::PbbAddressLength',
[],
is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::PrintOriginatorAddress(std::ostream & os) const [member function]
cls.add_method('PrintOriginatorAddress',
'void',
[param('std::ostream &', 'os')],
is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbMessage::SerializeOriginatorAddress(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('SerializeOriginatorAddress',
'void',
[param('ns3::Buffer::Iterator &', 'start')],
is_pure_virtual=True, is_const=True, visibility='protected', is_virtual=True)
return
def register_Ns3PbbMessageIpv4_methods(root_module, cls):
## packetbb.h (module 'network'): ns3::PbbMessageIpv4::PbbMessageIpv4(ns3::PbbMessageIpv4 const & arg0) [constructor]
cls.add_constructor([param('ns3::PbbMessageIpv4 const &', 'arg0')])
## packetbb.h (module 'network'): ns3::PbbMessageIpv4::PbbMessageIpv4() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressBlock> ns3::PbbMessageIpv4::AddressBlockDeserialize(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('AddressBlockDeserialize',
'ns3::Ptr< ns3::PbbAddressBlock >',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): ns3::Address ns3::PbbMessageIpv4::DeserializeOriginatorAddress(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('DeserializeOriginatorAddress',
'ns3::Address',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): ns3::PbbAddressLength ns3::PbbMessageIpv4::GetAddressLength() const [member function]
cls.add_method('GetAddressLength',
'ns3::PbbAddressLength',
[],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbMessageIpv4::PrintOriginatorAddress(std::ostream & os) const [member function]
cls.add_method('PrintOriginatorAddress',
'void',
[param('std::ostream &', 'os')],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbMessageIpv4::SerializeOriginatorAddress(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('SerializeOriginatorAddress',
'void',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True, visibility='protected', is_virtual=True)
return
def register_Ns3PbbMessageIpv6_methods(root_module, cls):
## packetbb.h (module 'network'): ns3::PbbMessageIpv6::PbbMessageIpv6(ns3::PbbMessageIpv6 const & arg0) [constructor]
cls.add_constructor([param('ns3::PbbMessageIpv6 const &', 'arg0')])
## packetbb.h (module 'network'): ns3::PbbMessageIpv6::PbbMessageIpv6() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbAddressBlock> ns3::PbbMessageIpv6::AddressBlockDeserialize(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('AddressBlockDeserialize',
'ns3::Ptr< ns3::PbbAddressBlock >',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): ns3::Address ns3::PbbMessageIpv6::DeserializeOriginatorAddress(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('DeserializeOriginatorAddress',
'ns3::Address',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): ns3::PbbAddressLength ns3::PbbMessageIpv6::GetAddressLength() const [member function]
cls.add_method('GetAddressLength',
'ns3::PbbAddressLength',
[],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbMessageIpv6::PrintOriginatorAddress(std::ostream & os) const [member function]
cls.add_method('PrintOriginatorAddress',
'void',
[param('std::ostream &', 'os')],
is_const=True, visibility='protected', is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbMessageIpv6::SerializeOriginatorAddress(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('SerializeOriginatorAddress',
'void',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True, visibility='protected', is_virtual=True)
return
def register_Ns3PbbPacket_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
## packetbb.h (module 'network'): ns3::PbbPacket::PbbPacket(ns3::PbbPacket const & arg0) [constructor]
cls.add_constructor([param('ns3::PbbPacket const &', 'arg0')])
## packetbb.h (module 'network'): ns3::PbbPacket::PbbPacket() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): uint32_t ns3::PbbPacket::Deserialize(ns3::Buffer::Iterator start) [member function]
cls.add_method('Deserialize',
'uint32_t',
[param('ns3::Buffer::Iterator', 'start')],
is_virtual=True)
## packetbb.h (module 'network'): ns3::PbbPacket::TlvIterator ns3::PbbPacket::Erase(ns3::PbbPacket::TlvIterator position) [member function]
cls.add_method('Erase',
'ns3::PbbPacket::TlvIterator',
[param('std::list< ns3::Ptr< ns3::PbbTlv > > iterator', 'position')])
## packetbb.h (module 'network'): ns3::PbbPacket::TlvIterator ns3::PbbPacket::Erase(ns3::PbbPacket::TlvIterator first, ns3::PbbPacket::TlvIterator last) [member function]
cls.add_method('Erase',
'ns3::PbbPacket::TlvIterator',
[param('std::list< ns3::Ptr< ns3::PbbTlv > > iterator', 'first'), param('std::list< ns3::Ptr< ns3::PbbTlv > > iterator', 'last')])
## packetbb.h (module 'network'): ns3::PbbPacket::MessageIterator ns3::PbbPacket::Erase(ns3::PbbPacket::MessageIterator position) [member function]
cls.add_method('Erase',
'ns3::PbbPacket::MessageIterator',
[param('std::list< ns3::Ptr< ns3::PbbMessage > > iterator', 'position')])
## packetbb.h (module 'network'): ns3::PbbPacket::MessageIterator ns3::PbbPacket::Erase(ns3::PbbPacket::MessageIterator first, ns3::PbbPacket::MessageIterator last) [member function]
cls.add_method('Erase',
'ns3::PbbPacket::MessageIterator',
[param('std::list< ns3::Ptr< ns3::PbbMessage > > iterator', 'first'), param('std::list< ns3::Ptr< ns3::PbbMessage > > iterator', 'last')])
## packetbb.h (module 'network'): ns3::TypeId ns3::PbbPacket::GetInstanceTypeId() const [member function]
cls.add_method('GetInstanceTypeId',
'ns3::TypeId',
[],
is_const=True, is_virtual=True)
## packetbb.h (module 'network'): uint16_t ns3::PbbPacket::GetSequenceNumber() const [member function]
cls.add_method('GetSequenceNumber',
'uint16_t',
[],
is_const=True)
## packetbb.h (module 'network'): uint32_t ns3::PbbPacket::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## packetbb.h (module 'network'): static ns3::TypeId ns3::PbbPacket::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbPacket::GetVersion() const [member function]
cls.add_method('GetVersion',
'uint8_t',
[],
is_const=True)
## packetbb.h (module 'network'): bool ns3::PbbPacket::HasSequenceNumber() const [member function]
cls.add_method('HasSequenceNumber',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbMessage> ns3::PbbPacket::MessageBack() [member function]
cls.add_method('MessageBack',
'ns3::Ptr< ns3::PbbMessage >',
[])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbMessage> const ns3::PbbPacket::MessageBack() const [member function]
cls.add_method('MessageBack',
'ns3::Ptr< ns3::PbbMessage > const',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbPacket::MessageIterator ns3::PbbPacket::MessageBegin() [member function]
cls.add_method('MessageBegin',
'ns3::PbbPacket::MessageIterator',
[])
## packetbb.h (module 'network'): ns3::PbbPacket::ConstMessageIterator ns3::PbbPacket::MessageBegin() const [member function]
cls.add_method('MessageBegin',
'ns3::PbbPacket::ConstMessageIterator',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbPacket::MessageClear() [member function]
cls.add_method('MessageClear',
'void',
[])
## packetbb.h (module 'network'): bool ns3::PbbPacket::MessageEmpty() const [member function]
cls.add_method('MessageEmpty',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbPacket::MessageIterator ns3::PbbPacket::MessageEnd() [member function]
cls.add_method('MessageEnd',
'ns3::PbbPacket::MessageIterator',
[])
## packetbb.h (module 'network'): ns3::PbbPacket::ConstMessageIterator ns3::PbbPacket::MessageEnd() const [member function]
cls.add_method('MessageEnd',
'ns3::PbbPacket::ConstMessageIterator',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbMessage> ns3::PbbPacket::MessageFront() [member function]
cls.add_method('MessageFront',
'ns3::Ptr< ns3::PbbMessage >',
[])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbMessage> const ns3::PbbPacket::MessageFront() const [member function]
cls.add_method('MessageFront',
'ns3::Ptr< ns3::PbbMessage > const',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbPacket::MessagePopBack() [member function]
cls.add_method('MessagePopBack',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbPacket::MessagePopFront() [member function]
cls.add_method('MessagePopFront',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbPacket::MessagePushBack(ns3::Ptr<ns3::PbbMessage> message) [member function]
cls.add_method('MessagePushBack',
'void',
[param('ns3::Ptr< ns3::PbbMessage >', 'message')])
## packetbb.h (module 'network'): void ns3::PbbPacket::MessagePushFront(ns3::Ptr<ns3::PbbMessage> message) [member function]
cls.add_method('MessagePushFront',
'void',
[param('ns3::Ptr< ns3::PbbMessage >', 'message')])
## packetbb.h (module 'network'): int ns3::PbbPacket::MessageSize() const [member function]
cls.add_method('MessageSize',
'int',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbPacket::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbPacket::Serialize(ns3::Buffer::Iterator start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator', 'start')],
is_const=True, is_virtual=True)
## packetbb.h (module 'network'): void ns3::PbbPacket::SetSequenceNumber(uint16_t number) [member function]
cls.add_method('SetSequenceNumber',
'void',
[param('uint16_t', 'number')])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> ns3::PbbPacket::TlvBack() [member function]
cls.add_method('TlvBack',
'ns3::Ptr< ns3::PbbTlv >',
[])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> const ns3::PbbPacket::TlvBack() const [member function]
cls.add_method('TlvBack',
'ns3::Ptr< ns3::PbbTlv > const',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbPacket::TlvIterator ns3::PbbPacket::TlvBegin() [member function]
cls.add_method('TlvBegin',
'ns3::PbbPacket::TlvIterator',
[])
## packetbb.h (module 'network'): ns3::PbbPacket::ConstTlvIterator ns3::PbbPacket::TlvBegin() const [member function]
cls.add_method('TlvBegin',
'ns3::PbbPacket::ConstTlvIterator',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbPacket::TlvClear() [member function]
cls.add_method('TlvClear',
'void',
[])
## packetbb.h (module 'network'): bool ns3::PbbPacket::TlvEmpty() const [member function]
cls.add_method('TlvEmpty',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::PbbPacket::TlvIterator ns3::PbbPacket::TlvEnd() [member function]
cls.add_method('TlvEnd',
'ns3::PbbPacket::TlvIterator',
[])
## packetbb.h (module 'network'): ns3::PbbPacket::ConstTlvIterator ns3::PbbPacket::TlvEnd() const [member function]
cls.add_method('TlvEnd',
'ns3::PbbPacket::ConstTlvIterator',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> ns3::PbbPacket::TlvFront() [member function]
cls.add_method('TlvFront',
'ns3::Ptr< ns3::PbbTlv >',
[])
## packetbb.h (module 'network'): ns3::Ptr<ns3::PbbTlv> const ns3::PbbPacket::TlvFront() const [member function]
cls.add_method('TlvFront',
'ns3::Ptr< ns3::PbbTlv > const',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbPacket::TlvPopBack() [member function]
cls.add_method('TlvPopBack',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbPacket::TlvPopFront() [member function]
cls.add_method('TlvPopFront',
'void',
[])
## packetbb.h (module 'network'): void ns3::PbbPacket::TlvPushBack(ns3::Ptr<ns3::PbbTlv> tlv) [member function]
cls.add_method('TlvPushBack',
'void',
[param('ns3::Ptr< ns3::PbbTlv >', 'tlv')])
## packetbb.h (module 'network'): void ns3::PbbPacket::TlvPushFront(ns3::Ptr<ns3::PbbTlv> tlv) [member function]
cls.add_method('TlvPushFront',
'void',
[param('ns3::Ptr< ns3::PbbTlv >', 'tlv')])
## packetbb.h (module 'network'): int ns3::PbbPacket::TlvSize() const [member function]
cls.add_method('TlvSize',
'int',
[],
is_const=True)
return
def register_Ns3PbbTlv_methods(root_module, cls):
cls.add_binary_comparison_operator('==')
cls.add_binary_comparison_operator('!=')
## packetbb.h (module 'network'): ns3::PbbTlv::PbbTlv(ns3::PbbTlv const & arg0) [constructor]
cls.add_constructor([param('ns3::PbbTlv const &', 'arg0')])
## packetbb.h (module 'network'): ns3::PbbTlv::PbbTlv() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): void ns3::PbbTlv::Deserialize(ns3::Buffer::Iterator & start) [member function]
cls.add_method('Deserialize',
'void',
[param('ns3::Buffer::Iterator &', 'start')])
## packetbb.h (module 'network'): uint32_t ns3::PbbTlv::GetSerializedSize() const [member function]
cls.add_method('GetSerializedSize',
'uint32_t',
[],
is_const=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbTlv::GetType() const [member function]
cls.add_method('GetType',
'uint8_t',
[],
is_const=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbTlv::GetTypeExt() const [member function]
cls.add_method('GetTypeExt',
'uint8_t',
[],
is_const=True)
## packetbb.h (module 'network'): ns3::Buffer ns3::PbbTlv::GetValue() const [member function]
cls.add_method('GetValue',
'ns3::Buffer',
[],
is_const=True)
## packetbb.h (module 'network'): bool ns3::PbbTlv::HasTypeExt() const [member function]
cls.add_method('HasTypeExt',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): bool ns3::PbbTlv::HasValue() const [member function]
cls.add_method('HasValue',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbTlv::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbTlv::Print(std::ostream & os, int level) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os'), param('int', 'level')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbTlv::Serialize(ns3::Buffer::Iterator & start) const [member function]
cls.add_method('Serialize',
'void',
[param('ns3::Buffer::Iterator &', 'start')],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbTlv::SetType(uint8_t type) [member function]
cls.add_method('SetType',
'void',
[param('uint8_t', 'type')])
## packetbb.h (module 'network'): void ns3::PbbTlv::SetTypeExt(uint8_t type) [member function]
cls.add_method('SetTypeExt',
'void',
[param('uint8_t', 'type')])
## packetbb.h (module 'network'): void ns3::PbbTlv::SetValue(ns3::Buffer start) [member function]
cls.add_method('SetValue',
'void',
[param('ns3::Buffer', 'start')])
## packetbb.h (module 'network'): void ns3::PbbTlv::SetValue(uint8_t const * buffer, uint32_t size) [member function]
cls.add_method('SetValue',
'void',
[param('uint8_t const *', 'buffer'), param('uint32_t', 'size')])
## packetbb.h (module 'network'): uint8_t ns3::PbbTlv::GetIndexStart() const [member function]
cls.add_method('GetIndexStart',
'uint8_t',
[],
is_const=True, visibility='protected')
## packetbb.h (module 'network'): uint8_t ns3::PbbTlv::GetIndexStop() const [member function]
cls.add_method('GetIndexStop',
'uint8_t',
[],
is_const=True, visibility='protected')
## packetbb.h (module 'network'): bool ns3::PbbTlv::HasIndexStart() const [member function]
cls.add_method('HasIndexStart',
'bool',
[],
is_const=True, visibility='protected')
## packetbb.h (module 'network'): bool ns3::PbbTlv::HasIndexStop() const [member function]
cls.add_method('HasIndexStop',
'bool',
[],
is_const=True, visibility='protected')
## packetbb.h (module 'network'): bool ns3::PbbTlv::IsMultivalue() const [member function]
cls.add_method('IsMultivalue',
'bool',
[],
is_const=True, visibility='protected')
## packetbb.h (module 'network'): void ns3::PbbTlv::SetIndexStart(uint8_t index) [member function]
cls.add_method('SetIndexStart',
'void',
[param('uint8_t', 'index')],
visibility='protected')
## packetbb.h (module 'network'): void ns3::PbbTlv::SetIndexStop(uint8_t index) [member function]
cls.add_method('SetIndexStop',
'void',
[param('uint8_t', 'index')],
visibility='protected')
## packetbb.h (module 'network'): void ns3::PbbTlv::SetMultivalue(bool isMultivalue) [member function]
cls.add_method('SetMultivalue',
'void',
[param('bool', 'isMultivalue')],
visibility='protected')
return
def register_Ns3Probe_methods(root_module, cls):
## probe.h (module 'stats'): ns3::Probe::Probe(ns3::Probe const & arg0) [constructor]
cls.add_constructor([param('ns3::Probe const &', 'arg0')])
## probe.h (module 'stats'): ns3::Probe::Probe() [constructor]
cls.add_constructor([])
## probe.h (module 'stats'): bool ns3::Probe::ConnectByObject(std::string traceSource, ns3::Ptr<ns3::Object> obj) [member function]
cls.add_method('ConnectByObject',
'bool',
[param('std::string', 'traceSource'), param('ns3::Ptr< ns3::Object >', 'obj')],
is_pure_virtual=True, is_virtual=True)
## probe.h (module 'stats'): void ns3::Probe::ConnectByPath(std::string path) [member function]
cls.add_method('ConnectByPath',
'void',
[param('std::string', 'path')],
is_pure_virtual=True, is_virtual=True)
## probe.h (module 'stats'): static ns3::TypeId ns3::Probe::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## probe.h (module 'stats'): bool ns3::Probe::IsEnabled() const [member function]
cls.add_method('IsEnabled',
'bool',
[],
is_const=True, is_virtual=True)
return
def register_Ns3Queue__Ns3Packet_methods(root_module, cls):
## queue.h (module 'network'): static ns3::TypeId ns3::Queue<ns3::Packet>::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## queue.h (module 'network'): ns3::Queue<ns3::Packet>::Queue() [constructor]
cls.add_constructor([])
## queue.h (module 'network'): bool ns3::Queue<ns3::Packet>::Enqueue(ns3::Ptr<ns3::Packet> item) [member function]
cls.add_method('Enqueue',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'item')],
is_pure_virtual=True, is_virtual=True)
## queue.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Queue<ns3::Packet>::Dequeue() [member function]
cls.add_method('Dequeue',
'ns3::Ptr< ns3::Packet >',
[],
is_pure_virtual=True, is_virtual=True)
## queue.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Queue<ns3::Packet>::Remove() [member function]
cls.add_method('Remove',
'ns3::Ptr< ns3::Packet >',
[],
is_pure_virtual=True, is_virtual=True)
## queue.h (module 'network'): ns3::Ptr<const ns3::Packet> ns3::Queue<ns3::Packet>::Peek() const [member function]
cls.add_method('Peek',
'ns3::Ptr< ns3::Packet const >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## queue.h (module 'network'): void ns3::Queue<ns3::Packet>::Flush() [member function]
cls.add_method('Flush',
'void',
[])
## queue.h (module 'network'): ns3::Queue<ns3::Packet>::Queue(ns3::Queue<ns3::Packet> const & arg0) [constructor]
cls.add_constructor([param('ns3::Queue< ns3::Packet > const &', 'arg0')])
## queue.h (module 'network'): ns3::Queue<ns3::Packet>::ConstIterator ns3::Queue<ns3::Packet>::Head() const [member function]
cls.add_method('Head',
'ns3::Queue< ns3::Packet > ConstIterator',
[],
is_const=True, visibility='protected')
## queue.h (module 'network'): ns3::Queue<ns3::Packet>::ConstIterator ns3::Queue<ns3::Packet>::Tail() const [member function]
cls.add_method('Tail',
'ns3::Queue< ns3::Packet > ConstIterator',
[],
is_const=True, visibility='protected')
## queue.h (module 'network'): bool ns3::Queue<ns3::Packet>::DoEnqueue(ns3::Queue<ns3::Packet>::ConstIterator pos, ns3::Ptr<ns3::Packet> item) [member function]
cls.add_method('DoEnqueue',
'bool',
[param('std::list< ns3::Ptr< ns3::Packet > > const_iterator', 'pos'), param('ns3::Ptr< ns3::Packet >', 'item')],
visibility='protected')
## queue.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Queue<ns3::Packet>::DoDequeue(ns3::Queue<ns3::Packet>::ConstIterator pos) [member function]
cls.add_method('DoDequeue',
'ns3::Ptr< ns3::Packet >',
[param('std::list< ns3::Ptr< ns3::Packet > > const_iterator', 'pos')],
visibility='protected')
## queue.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::Queue<ns3::Packet>::DoRemove(ns3::Queue<ns3::Packet>::ConstIterator pos) [member function]
cls.add_method('DoRemove',
'ns3::Ptr< ns3::Packet >',
[param('std::list< ns3::Ptr< ns3::Packet > > const_iterator', 'pos')],
visibility='protected')
## queue.h (module 'network'): ns3::Ptr<const ns3::Packet> ns3::Queue<ns3::Packet>::DoPeek(ns3::Queue<ns3::Packet>::ConstIterator pos) const [member function]
cls.add_method('DoPeek',
'ns3::Ptr< ns3::Packet const >',
[param('std::list< ns3::Ptr< ns3::Packet > > const_iterator', 'pos')],
is_const=True, visibility='protected')
## queue.h (module 'network'): void ns3::Queue<ns3::Packet>::DropBeforeEnqueue(ns3::Ptr<ns3::Packet> item) [member function]
cls.add_method('DropBeforeEnqueue',
'void',
[param('ns3::Ptr< ns3::Packet >', 'item')],
visibility='protected')
## queue.h (module 'network'): void ns3::Queue<ns3::Packet>::DropAfterDequeue(ns3::Ptr<ns3::Packet> item) [member function]
cls.add_method('DropAfterDequeue',
'void',
[param('ns3::Ptr< ns3::Packet >', 'item')],
visibility='protected')
return
def register_Ns3Queue__Ns3QueueDiscItem_methods(root_module, cls):
## queue.h (module 'network'): static ns3::TypeId ns3::Queue<ns3::QueueDiscItem>::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## queue.h (module 'network'): ns3::Queue<ns3::QueueDiscItem>::Queue() [constructor]
cls.add_constructor([])
## queue.h (module 'network'): bool ns3::Queue<ns3::QueueDiscItem>::Enqueue(ns3::Ptr<ns3::QueueDiscItem> item) [member function]
cls.add_method('Enqueue',
'bool',
[param('ns3::Ptr< ns3::QueueDiscItem >', 'item')],
is_pure_virtual=True, is_virtual=True)
## queue.h (module 'network'): ns3::Ptr<ns3::QueueDiscItem> ns3::Queue<ns3::QueueDiscItem>::Dequeue() [member function]
cls.add_method('Dequeue',
'ns3::Ptr< ns3::QueueDiscItem >',
[],
is_pure_virtual=True, is_virtual=True)
## queue.h (module 'network'): ns3::Ptr<ns3::QueueDiscItem> ns3::Queue<ns3::QueueDiscItem>::Remove() [member function]
cls.add_method('Remove',
'ns3::Ptr< ns3::QueueDiscItem >',
[],
is_pure_virtual=True, is_virtual=True)
## queue.h (module 'network'): ns3::Ptr<const ns3::QueueDiscItem> ns3::Queue<ns3::QueueDiscItem>::Peek() const [member function]
cls.add_method('Peek',
'ns3::Ptr< ns3::QueueDiscItem const >',
[],
is_pure_virtual=True, is_const=True, is_virtual=True)
## queue.h (module 'network'): void ns3::Queue<ns3::QueueDiscItem>::Flush() [member function]
cls.add_method('Flush',
'void',
[])
## queue.h (module 'network'): ns3::Queue<ns3::QueueDiscItem>::Queue(ns3::Queue<ns3::QueueDiscItem> const & arg0) [constructor]
cls.add_constructor([param('ns3::Queue< ns3::QueueDiscItem > const &', 'arg0')])
## queue.h (module 'network'): ns3::Queue<ns3::QueueDiscItem>::ConstIterator ns3::Queue<ns3::QueueDiscItem>::Head() const [member function]
cls.add_method('Head',
'ns3::Queue< ns3::QueueDiscItem > ConstIterator',
[],
is_const=True, visibility='protected')
## queue.h (module 'network'): ns3::Queue<ns3::QueueDiscItem>::ConstIterator ns3::Queue<ns3::QueueDiscItem>::Tail() const [member function]
cls.add_method('Tail',
'ns3::Queue< ns3::QueueDiscItem > ConstIterator',
[],
is_const=True, visibility='protected')
## queue.h (module 'network'): bool ns3::Queue<ns3::QueueDiscItem>::DoEnqueue(ns3::Queue<ns3::QueueDiscItem>::ConstIterator pos, ns3::Ptr<ns3::QueueDiscItem> item) [member function]
cls.add_method('DoEnqueue',
'bool',
[param('std::list< ns3::Ptr< ns3::QueueDiscItem > > const_iterator', 'pos'), param('ns3::Ptr< ns3::QueueDiscItem >', 'item')],
visibility='protected')
## queue.h (module 'network'): ns3::Ptr<ns3::QueueDiscItem> ns3::Queue<ns3::QueueDiscItem>::DoDequeue(ns3::Queue<ns3::QueueDiscItem>::ConstIterator pos) [member function]
cls.add_method('DoDequeue',
'ns3::Ptr< ns3::QueueDiscItem >',
[param('std::list< ns3::Ptr< ns3::QueueDiscItem > > const_iterator', 'pos')],
visibility='protected')
## queue.h (module 'network'): ns3::Ptr<ns3::QueueDiscItem> ns3::Queue<ns3::QueueDiscItem>::DoRemove(ns3::Queue<ns3::QueueDiscItem>::ConstIterator pos) [member function]
cls.add_method('DoRemove',
'ns3::Ptr< ns3::QueueDiscItem >',
[param('std::list< ns3::Ptr< ns3::QueueDiscItem > > const_iterator', 'pos')],
visibility='protected')
## queue.h (module 'network'): ns3::Ptr<const ns3::QueueDiscItem> ns3::Queue<ns3::QueueDiscItem>::DoPeek(ns3::Queue<ns3::QueueDiscItem>::ConstIterator pos) const [member function]
cls.add_method('DoPeek',
'ns3::Ptr< ns3::QueueDiscItem const >',
[param('std::list< ns3::Ptr< ns3::QueueDiscItem > > const_iterator', 'pos')],
is_const=True, visibility='protected')
## queue.h (module 'network'): void ns3::Queue<ns3::QueueDiscItem>::DropBeforeEnqueue(ns3::Ptr<ns3::QueueDiscItem> item) [member function]
cls.add_method('DropBeforeEnqueue',
'void',
[param('ns3::Ptr< ns3::QueueDiscItem >', 'item')],
visibility='protected')
## queue.h (module 'network'): void ns3::Queue<ns3::QueueDiscItem>::DropAfterDequeue(ns3::Ptr<ns3::QueueDiscItem> item) [member function]
cls.add_method('DropAfterDequeue',
'void',
[param('ns3::Ptr< ns3::QueueDiscItem >', 'item')],
visibility='protected')
return
def register_Ns3QueueItem_methods(root_module, cls):
cls.add_output_stream_operator()
## queue-item.h (module 'network'): ns3::QueueItem::QueueItem(ns3::Ptr<ns3::Packet> p) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Packet >', 'p')])
## queue-item.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::QueueItem::GetPacket() const [member function]
cls.add_method('GetPacket',
'ns3::Ptr< ns3::Packet >',
[],
is_const=True)
## queue-item.h (module 'network'): uint32_t ns3::QueueItem::GetSize() const [member function]
cls.add_method('GetSize',
'uint32_t',
[],
is_const=True, is_virtual=True)
## queue-item.h (module 'network'): bool ns3::QueueItem::GetUint8Value(ns3::QueueItem::Uint8Values field, uint8_t & value) const [member function]
cls.add_method('GetUint8Value',
'bool',
[param('ns3::QueueItem::Uint8Values', 'field'), param('uint8_t &', 'value')],
is_const=True, is_virtual=True)
## queue-item.h (module 'network'): void ns3::QueueItem::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
return
def register_Ns3QueueSizeChecker_methods(root_module, cls):
## queue-size.h (module 'network'): ns3::QueueSizeChecker::QueueSizeChecker() [constructor]
cls.add_constructor([])
## queue-size.h (module 'network'): ns3::QueueSizeChecker::QueueSizeChecker(ns3::QueueSizeChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::QueueSizeChecker const &', 'arg0')])
return
def register_Ns3QueueSizeValue_methods(root_module, cls):
## queue-size.h (module 'network'): ns3::QueueSizeValue::QueueSizeValue() [constructor]
cls.add_constructor([])
## queue-size.h (module 'network'): ns3::QueueSizeValue::QueueSizeValue(ns3::QueueSize const & value) [constructor]
cls.add_constructor([param('ns3::QueueSize const &', 'value')])
## queue-size.h (module 'network'): ns3::QueueSizeValue::QueueSizeValue(ns3::QueueSizeValue const & arg0) [constructor]
cls.add_constructor([param('ns3::QueueSizeValue const &', 'arg0')])
## queue-size.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::QueueSizeValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## queue-size.h (module 'network'): bool ns3::QueueSizeValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## queue-size.h (module 'network'): ns3::QueueSize ns3::QueueSizeValue::Get() const [member function]
cls.add_method('Get',
'ns3::QueueSize',
[],
is_const=True)
## queue-size.h (module 'network'): std::string ns3::QueueSizeValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## queue-size.h (module 'network'): void ns3::QueueSizeValue::Set(ns3::QueueSize const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::QueueSize const &', 'value')])
return
def register_Ns3RateErrorModel_methods(root_module, cls):
## error-model.h (module 'network'): ns3::RateErrorModel::RateErrorModel(ns3::RateErrorModel const & arg0) [constructor]
cls.add_constructor([param('ns3::RateErrorModel const &', 'arg0')])
## error-model.h (module 'network'): ns3::RateErrorModel::RateErrorModel() [constructor]
cls.add_constructor([])
## error-model.h (module 'network'): int64_t ns3::RateErrorModel::AssignStreams(int64_t stream) [member function]
cls.add_method('AssignStreams',
'int64_t',
[param('int64_t', 'stream')])
## error-model.h (module 'network'): double ns3::RateErrorModel::GetRate() const [member function]
cls.add_method('GetRate',
'double',
[],
is_const=True)
## error-model.h (module 'network'): static ns3::TypeId ns3::RateErrorModel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## error-model.h (module 'network'): ns3::RateErrorModel::ErrorUnit ns3::RateErrorModel::GetUnit() const [member function]
cls.add_method('GetUnit',
'ns3::RateErrorModel::ErrorUnit',
[],
is_const=True)
## error-model.h (module 'network'): void ns3::RateErrorModel::SetRandomVariable(ns3::Ptr<ns3::RandomVariableStream> arg0) [member function]
cls.add_method('SetRandomVariable',
'void',
[param('ns3::Ptr< ns3::RandomVariableStream >', 'arg0')])
## error-model.h (module 'network'): void ns3::RateErrorModel::SetRate(double rate) [member function]
cls.add_method('SetRate',
'void',
[param('double', 'rate')])
## error-model.h (module 'network'): void ns3::RateErrorModel::SetUnit(ns3::RateErrorModel::ErrorUnit error_unit) [member function]
cls.add_method('SetUnit',
'void',
[param('ns3::RateErrorModel::ErrorUnit', 'error_unit')])
## error-model.h (module 'network'): bool ns3::RateErrorModel::DoCorrupt(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorrupt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
visibility='private', is_virtual=True)
## error-model.h (module 'network'): bool ns3::RateErrorModel::DoCorruptBit(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorruptBit',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
visibility='private', is_virtual=True)
## error-model.h (module 'network'): bool ns3::RateErrorModel::DoCorruptByte(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorruptByte',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
visibility='private', is_virtual=True)
## error-model.h (module 'network'): bool ns3::RateErrorModel::DoCorruptPkt(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorruptPkt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
visibility='private', is_virtual=True)
## error-model.h (module 'network'): void ns3::RateErrorModel::DoReset() [member function]
cls.add_method('DoReset',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3ReceiveListErrorModel_methods(root_module, cls):
## error-model.h (module 'network'): ns3::ReceiveListErrorModel::ReceiveListErrorModel(ns3::ReceiveListErrorModel const & arg0) [constructor]
cls.add_constructor([param('ns3::ReceiveListErrorModel const &', 'arg0')])
## error-model.h (module 'network'): ns3::ReceiveListErrorModel::ReceiveListErrorModel() [constructor]
cls.add_constructor([])
## error-model.h (module 'network'): std::list<unsigned int, std::allocator<unsigned int> > ns3::ReceiveListErrorModel::GetList() const [member function]
cls.add_method('GetList',
'std::list< unsigned int >',
[],
is_const=True)
## error-model.h (module 'network'): static ns3::TypeId ns3::ReceiveListErrorModel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## error-model.h (module 'network'): void ns3::ReceiveListErrorModel::SetList(std::list<unsigned int, std::allocator<unsigned int> > const & packetlist) [member function]
cls.add_method('SetList',
'void',
[param('std::list< unsigned int > const &', 'packetlist')])
## error-model.h (module 'network'): bool ns3::ReceiveListErrorModel::DoCorrupt(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorrupt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
visibility='private', is_virtual=True)
## error-model.h (module 'network'): void ns3::ReceiveListErrorModel::DoReset() [member function]
cls.add_method('DoReset',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3SimpleChannel_methods(root_module, cls):
## simple-channel.h (module 'network'): ns3::SimpleChannel::SimpleChannel(ns3::SimpleChannel const & arg0) [constructor]
cls.add_constructor([param('ns3::SimpleChannel const &', 'arg0')])
## simple-channel.h (module 'network'): ns3::SimpleChannel::SimpleChannel() [constructor]
cls.add_constructor([])
## simple-channel.h (module 'network'): void ns3::SimpleChannel::Add(ns3::Ptr<ns3::SimpleNetDevice> device) [member function]
cls.add_method('Add',
'void',
[param('ns3::Ptr< ns3::SimpleNetDevice >', 'device')],
is_virtual=True)
## simple-channel.h (module 'network'): void ns3::SimpleChannel::BlackList(ns3::Ptr<ns3::SimpleNetDevice> from, ns3::Ptr<ns3::SimpleNetDevice> to) [member function]
cls.add_method('BlackList',
'void',
[param('ns3::Ptr< ns3::SimpleNetDevice >', 'from'), param('ns3::Ptr< ns3::SimpleNetDevice >', 'to')],
is_virtual=True)
## simple-channel.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::SimpleChannel::GetDevice(std::size_t i) const [member function]
cls.add_method('GetDevice',
'ns3::Ptr< ns3::NetDevice >',
[param('std::size_t', 'i')],
is_const=True, is_virtual=True)
## simple-channel.h (module 'network'): std::size_t ns3::SimpleChannel::GetNDevices() const [member function]
cls.add_method('GetNDevices',
'std::size_t',
[],
is_const=True, is_virtual=True)
## simple-channel.h (module 'network'): static ns3::TypeId ns3::SimpleChannel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## simple-channel.h (module 'network'): void ns3::SimpleChannel::Send(ns3::Ptr<ns3::Packet> p, uint16_t protocol, ns3::Mac48Address to, ns3::Mac48Address from, ns3::Ptr<ns3::SimpleNetDevice> sender) [member function]
cls.add_method('Send',
'void',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('uint16_t', 'protocol'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from'), param('ns3::Ptr< ns3::SimpleNetDevice >', 'sender')],
is_virtual=True)
## simple-channel.h (module 'network'): void ns3::SimpleChannel::UnBlackList(ns3::Ptr<ns3::SimpleNetDevice> from, ns3::Ptr<ns3::SimpleNetDevice> to) [member function]
cls.add_method('UnBlackList',
'void',
[param('ns3::Ptr< ns3::SimpleNetDevice >', 'from'), param('ns3::Ptr< ns3::SimpleNetDevice >', 'to')],
is_virtual=True)
return
def register_Ns3SimpleNetDevice_methods(root_module, cls):
## simple-net-device.h (module 'network'): ns3::SimpleNetDevice::SimpleNetDevice(ns3::SimpleNetDevice const & arg0) [constructor]
cls.add_constructor([param('ns3::SimpleNetDevice const &', 'arg0')])
## simple-net-device.h (module 'network'): ns3::SimpleNetDevice::SimpleNetDevice() [constructor]
cls.add_constructor([])
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::AddLinkChangeCallback(ns3::Callback<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> callback) [member function]
cls.add_method('AddLinkChangeCallback',
'void',
[param('ns3::Callback< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'callback')],
is_virtual=True)
## simple-net-device.h (module 'network'): ns3::Address ns3::SimpleNetDevice::GetAddress() const [member function]
cls.add_method('GetAddress',
'ns3::Address',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): ns3::Address ns3::SimpleNetDevice::GetBroadcast() const [member function]
cls.add_method('GetBroadcast',
'ns3::Address',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): ns3::Ptr<ns3::Channel> ns3::SimpleNetDevice::GetChannel() const [member function]
cls.add_method('GetChannel',
'ns3::Ptr< ns3::Channel >',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): uint32_t ns3::SimpleNetDevice::GetIfIndex() const [member function]
cls.add_method('GetIfIndex',
'uint32_t',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): uint16_t ns3::SimpleNetDevice::GetMtu() const [member function]
cls.add_method('GetMtu',
'uint16_t',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): ns3::Address ns3::SimpleNetDevice::GetMulticast(ns3::Ipv4Address multicastGroup) const [member function]
cls.add_method('GetMulticast',
'ns3::Address',
[param('ns3::Ipv4Address', 'multicastGroup')],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): ns3::Address ns3::SimpleNetDevice::GetMulticast(ns3::Ipv6Address addr) const [member function]
cls.add_method('GetMulticast',
'ns3::Address',
[param('ns3::Ipv6Address', 'addr')],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): ns3::Ptr<ns3::Node> ns3::SimpleNetDevice::GetNode() const [member function]
cls.add_method('GetNode',
'ns3::Ptr< ns3::Node >',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): ns3::Ptr<ns3::Queue<ns3::Packet> > ns3::SimpleNetDevice::GetQueue() const [member function]
cls.add_method('GetQueue',
'ns3::Ptr< ns3::Queue< ns3::Packet > >',
[],
is_const=True)
## simple-net-device.h (module 'network'): static ns3::TypeId ns3::SimpleNetDevice::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::IsBridge() const [member function]
cls.add_method('IsBridge',
'bool',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::IsBroadcast() const [member function]
cls.add_method('IsBroadcast',
'bool',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::IsLinkUp() const [member function]
cls.add_method('IsLinkUp',
'bool',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::IsMulticast() const [member function]
cls.add_method('IsMulticast',
'bool',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::IsPointToPoint() const [member function]
cls.add_method('IsPointToPoint',
'bool',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::NeedsArp() const [member function]
cls.add_method('NeedsArp',
'bool',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::Receive(ns3::Ptr<ns3::Packet> packet, uint16_t protocol, ns3::Mac48Address to, ns3::Mac48Address from) [member function]
cls.add_method('Receive',
'void',
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('uint16_t', 'protocol'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from')])
## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::Send(ns3::Ptr<ns3::Packet> packet, ns3::Address const & dest, uint16_t protocolNumber) [member function]
cls.add_method('Send',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')],
is_virtual=True)
## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::SendFrom(ns3::Ptr<ns3::Packet> packet, ns3::Address const & source, ns3::Address const & dest, uint16_t protocolNumber) [member function]
cls.add_method('SendFrom',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'packet'), param('ns3::Address const &', 'source'), param('ns3::Address const &', 'dest'), param('uint16_t', 'protocolNumber')],
is_virtual=True)
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetAddress(ns3::Address address) [member function]
cls.add_method('SetAddress',
'void',
[param('ns3::Address', 'address')],
is_virtual=True)
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetChannel(ns3::Ptr<ns3::SimpleChannel> channel) [member function]
cls.add_method('SetChannel',
'void',
[param('ns3::Ptr< ns3::SimpleChannel >', 'channel')])
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetIfIndex(uint32_t const index) [member function]
cls.add_method('SetIfIndex',
'void',
[param('uint32_t const', 'index')],
is_virtual=True)
## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::SetMtu(uint16_t const mtu) [member function]
cls.add_method('SetMtu',
'bool',
[param('uint16_t const', 'mtu')],
is_virtual=True)
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetNode(ns3::Ptr<ns3::Node> node) [member function]
cls.add_method('SetNode',
'void',
[param('ns3::Ptr< ns3::Node >', 'node')],
is_virtual=True)
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetPromiscReceiveCallback(ns3::NetDevice::PromiscReceiveCallback cb) [member function]
cls.add_method('SetPromiscReceiveCallback',
'void',
[param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty >', 'cb')],
is_virtual=True)
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetQueue(ns3::Ptr<ns3::Queue<ns3::Packet> > queue) [member function]
cls.add_method('SetQueue',
'void',
[param('ns3::Ptr< ns3::Queue< ns3::Packet > >', 'queue')])
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetReceiveCallback(ns3::NetDevice::ReceiveCallback cb) [member function]
cls.add_method('SetReceiveCallback',
'void',
[param('ns3::Callback< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty >', 'cb')],
is_virtual=True)
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::SetReceiveErrorModel(ns3::Ptr<ns3::ErrorModel> em) [member function]
cls.add_method('SetReceiveErrorModel',
'void',
[param('ns3::Ptr< ns3::ErrorModel >', 'em')])
## simple-net-device.h (module 'network'): bool ns3::SimpleNetDevice::SupportsSendFrom() const [member function]
cls.add_method('SupportsSendFrom',
'bool',
[],
is_const=True, is_virtual=True)
## simple-net-device.h (module 'network'): void ns3::SimpleNetDevice::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3TimeValue_methods(root_module, cls):
## nstime.h (module 'core'): ns3::TimeValue::TimeValue() [constructor]
cls.add_constructor([])
## nstime.h (module 'core'): ns3::TimeValue::TimeValue(ns3::Time const & value) [constructor]
cls.add_constructor([param('ns3::Time const &', 'value')])
## nstime.h (module 'core'): ns3::TimeValue::TimeValue(ns3::TimeValue const & arg0) [constructor]
cls.add_constructor([param('ns3::TimeValue const &', 'arg0')])
## nstime.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::TimeValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## nstime.h (module 'core'): bool ns3::TimeValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## nstime.h (module 'core'): ns3::Time ns3::TimeValue::Get() const [member function]
cls.add_method('Get',
'ns3::Time',
[],
is_const=True)
## nstime.h (module 'core'): std::string ns3::TimeValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## nstime.h (module 'core'): void ns3::TimeValue::Set(ns3::Time const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Time const &', 'value')])
return
def register_Ns3TypeIdChecker_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeIdChecker::TypeIdChecker(ns3::TypeIdChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::TypeIdChecker const &', 'arg0')])
return
def register_Ns3TypeIdValue_methods(root_module, cls):
## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue() [constructor]
cls.add_constructor([])
## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeId const & value) [constructor]
cls.add_constructor([param('ns3::TypeId const &', 'value')])
## type-id.h (module 'core'): ns3::TypeIdValue::TypeIdValue(ns3::TypeIdValue const & arg0) [constructor]
cls.add_constructor([param('ns3::TypeIdValue const &', 'arg0')])
## type-id.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::TypeIdValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## type-id.h (module 'core'): bool ns3::TypeIdValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## type-id.h (module 'core'): ns3::TypeId ns3::TypeIdValue::Get() const [member function]
cls.add_method('Get',
'ns3::TypeId',
[],
is_const=True)
## type-id.h (module 'core'): std::string ns3::TypeIdValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## type-id.h (module 'core'): void ns3::TypeIdValue::Set(ns3::TypeId const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::TypeId const &', 'value')])
return
def register_Ns3UintegerValue_methods(root_module, cls):
## uinteger.h (module 'core'): ns3::UintegerValue::UintegerValue() [constructor]
cls.add_constructor([])
## uinteger.h (module 'core'): ns3::UintegerValue::UintegerValue(uint64_t const & value) [constructor]
cls.add_constructor([param('uint64_t const &', 'value')])
## uinteger.h (module 'core'): ns3::UintegerValue::UintegerValue(ns3::UintegerValue const & arg0) [constructor]
cls.add_constructor([param('ns3::UintegerValue const &', 'arg0')])
## uinteger.h (module 'core'): ns3::Ptr<ns3::AttributeValue> ns3::UintegerValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## uinteger.h (module 'core'): bool ns3::UintegerValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## uinteger.h (module 'core'): uint64_t ns3::UintegerValue::Get() const [member function]
cls.add_method('Get',
'uint64_t',
[],
is_const=True)
## uinteger.h (module 'core'): std::string ns3::UintegerValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## uinteger.h (module 'core'): void ns3::UintegerValue::Set(uint64_t const & value) [member function]
cls.add_method('Set',
'void',
[param('uint64_t const &', 'value')])
return
def register_Ns3AddressChecker_methods(root_module, cls):
## address.h (module 'network'): ns3::AddressChecker::AddressChecker() [constructor]
cls.add_constructor([])
## address.h (module 'network'): ns3::AddressChecker::AddressChecker(ns3::AddressChecker const & arg0) [constructor]
cls.add_constructor([param('ns3::AddressChecker const &', 'arg0')])
return
def register_Ns3AddressValue_methods(root_module, cls):
## address.h (module 'network'): ns3::AddressValue::AddressValue() [constructor]
cls.add_constructor([])
## address.h (module 'network'): ns3::AddressValue::AddressValue(ns3::Address const & value) [constructor]
cls.add_constructor([param('ns3::Address const &', 'value')])
## address.h (module 'network'): ns3::AddressValue::AddressValue(ns3::AddressValue const & arg0) [constructor]
cls.add_constructor([param('ns3::AddressValue const &', 'arg0')])
## address.h (module 'network'): ns3::Ptr<ns3::AttributeValue> ns3::AddressValue::Copy() const [member function]
cls.add_method('Copy',
'ns3::Ptr< ns3::AttributeValue >',
[],
is_const=True, is_virtual=True)
## address.h (module 'network'): bool ns3::AddressValue::DeserializeFromString(std::string value, ns3::Ptr<const ns3::AttributeChecker> checker) [member function]
cls.add_method('DeserializeFromString',
'bool',
[param('std::string', 'value'), param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_virtual=True)
## address.h (module 'network'): ns3::Address ns3::AddressValue::Get() const [member function]
cls.add_method('Get',
'ns3::Address',
[],
is_const=True)
## address.h (module 'network'): std::string ns3::AddressValue::SerializeToString(ns3::Ptr<const ns3::AttributeChecker> checker) const [member function]
cls.add_method('SerializeToString',
'std::string',
[param('ns3::Ptr< ns3::AttributeChecker const >', 'checker')],
is_const=True, is_virtual=True)
## address.h (module 'network'): void ns3::AddressValue::Set(ns3::Address const & value) [member function]
cls.add_method('Set',
'void',
[param('ns3::Address const &', 'value')])
return
def register_Ns3BinaryErrorModel_methods(root_module, cls):
## error-model.h (module 'network'): ns3::BinaryErrorModel::BinaryErrorModel(ns3::BinaryErrorModel const & arg0) [constructor]
cls.add_constructor([param('ns3::BinaryErrorModel const &', 'arg0')])
## error-model.h (module 'network'): ns3::BinaryErrorModel::BinaryErrorModel() [constructor]
cls.add_constructor([])
## error-model.h (module 'network'): static ns3::TypeId ns3::BinaryErrorModel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## error-model.h (module 'network'): bool ns3::BinaryErrorModel::DoCorrupt(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorrupt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
visibility='private', is_virtual=True)
## error-model.h (module 'network'): void ns3::BinaryErrorModel::DoReset() [member function]
cls.add_method('DoReset',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3BurstErrorModel_methods(root_module, cls):
## error-model.h (module 'network'): ns3::BurstErrorModel::BurstErrorModel(ns3::BurstErrorModel const & arg0) [constructor]
cls.add_constructor([param('ns3::BurstErrorModel const &', 'arg0')])
## error-model.h (module 'network'): ns3::BurstErrorModel::BurstErrorModel() [constructor]
cls.add_constructor([])
## error-model.h (module 'network'): int64_t ns3::BurstErrorModel::AssignStreams(int64_t stream) [member function]
cls.add_method('AssignStreams',
'int64_t',
[param('int64_t', 'stream')])
## error-model.h (module 'network'): double ns3::BurstErrorModel::GetBurstRate() const [member function]
cls.add_method('GetBurstRate',
'double',
[],
is_const=True)
## error-model.h (module 'network'): static ns3::TypeId ns3::BurstErrorModel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## error-model.h (module 'network'): void ns3::BurstErrorModel::SetBurstRate(double rate) [member function]
cls.add_method('SetBurstRate',
'void',
[param('double', 'rate')])
## error-model.h (module 'network'): void ns3::BurstErrorModel::SetRandomBurstSize(ns3::Ptr<ns3::RandomVariableStream> burstSz) [member function]
cls.add_method('SetRandomBurstSize',
'void',
[param('ns3::Ptr< ns3::RandomVariableStream >', 'burstSz')])
## error-model.h (module 'network'): void ns3::BurstErrorModel::SetRandomVariable(ns3::Ptr<ns3::RandomVariableStream> ranVar) [member function]
cls.add_method('SetRandomVariable',
'void',
[param('ns3::Ptr< ns3::RandomVariableStream >', 'ranVar')])
## error-model.h (module 'network'): bool ns3::BurstErrorModel::DoCorrupt(ns3::Ptr<ns3::Packet> p) [member function]
cls.add_method('DoCorrupt',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'p')],
visibility='private', is_virtual=True)
## error-model.h (module 'network'): void ns3::BurstErrorModel::DoReset() [member function]
cls.add_method('DoReset',
'void',
[],
visibility='private', is_virtual=True)
return
def register_Ns3CallbackImpl__Bool_Ns3Ptr__lt__ns3NetDevice__gt___Ns3Ptr__lt__const_ns3Packet__gt___Unsigned_short_Const_ns3Address___amp___Const_ns3Address___amp___Ns3NetDevicePacketType_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): bool ns3::CallbackImpl<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty>::operator()(ns3::Ptr<ns3::NetDevice> arg0, ns3::Ptr<const ns3::Packet> arg1, short unsigned int arg2, ns3::Address const & arg3, ns3::Address const & arg4, ns3::NetDevice::PacketType arg5) [member operator]
cls.add_method('operator()',
'bool',
[param('ns3::Ptr< ns3::NetDevice >', 'arg0'), param('ns3::Ptr< ns3::Packet const >', 'arg1'), param('short unsigned int', 'arg2'), param('ns3::Address const &', 'arg3'), param('ns3::Address const &', 'arg4'), param('ns3::NetDevice::PacketType', 'arg5')],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CallbackImpl__Bool_Ns3Ptr__lt__ns3NetDevice__gt___Ns3Ptr__lt__const_ns3Packet__gt___Unsigned_short_Const_ns3Address___amp___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< bool, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): bool ns3::CallbackImpl<bool, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()(ns3::Ptr<ns3::NetDevice> arg0, ns3::Ptr<const ns3::Packet> arg1, short unsigned int arg2, ns3::Address const & arg3) [member operator]
cls.add_method('operator()',
'bool',
[param('ns3::Ptr< ns3::NetDevice >', 'arg0'), param('ns3::Ptr< ns3::Packet const >', 'arg1'), param('short unsigned int', 'arg2'), param('ns3::Address const &', 'arg3')],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CallbackImpl__Bool_Ns3Ptr__lt__ns3Socket__gt___Const_ns3Address___amp___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<bool, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<bool, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<bool, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< bool, ns3::Ptr< ns3::Socket >, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<bool, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<bool, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): bool ns3::CallbackImpl<bool, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()(ns3::Ptr<ns3::Socket> arg0, ns3::Address const & arg1) [member operator]
cls.add_method('operator()',
'bool',
[param('ns3::Ptr< ns3::Socket >', 'arg0'), param('ns3::Address const &', 'arg1')],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CallbackImpl__Ns3ObjectBase___star___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): ns3::ObjectBase * ns3::CallbackImpl<ns3::ObjectBase *, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()() [member operator]
cls.add_method('operator()',
'ns3::ObjectBase *',
[],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CallbackImpl__Void_Ns3Ptr__lt__const_ns3Packet__gt___Const_ns3Address___amp___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<const ns3::Packet>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<const ns3::Packet>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<void, ns3::Ptr<const ns3::Packet>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< void, ns3::Ptr< ns3::Packet const >, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<void, ns3::Ptr<const ns3::Packet>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<void, ns3::Ptr<const ns3::Packet>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackImpl<void, ns3::Ptr<const ns3::Packet>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()(ns3::Ptr<const ns3::Packet> arg0, ns3::Address const & arg1) [member operator]
cls.add_method('operator()',
'void',
[param('ns3::Ptr< ns3::Packet const >', 'arg0'), param('ns3::Address const &', 'arg1')],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CallbackImpl__Void_Ns3Ptr__lt__const_ns3Packet__gt___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<const ns3::Packet>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<const ns3::Packet>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<void, ns3::Ptr<const ns3::Packet>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< void, ns3::Ptr< ns3::Packet const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<void, ns3::Ptr<const ns3::Packet>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<void, ns3::Ptr<const ns3::Packet>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackImpl<void, ns3::Ptr<const ns3::Packet>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()(ns3::Ptr<const ns3::Packet> arg0) [member operator]
cls.add_method('operator()',
'void',
[param('ns3::Ptr< ns3::Packet const >', 'arg0')],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CallbackImpl__Void_Ns3Ptr__lt__const_ns3QueueDiscItem__gt___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<const ns3::QueueDiscItem>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<const ns3::QueueDiscItem>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<void, ns3::Ptr<const ns3::QueueDiscItem>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< void, ns3::Ptr< ns3::QueueDiscItem const >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<void, ns3::Ptr<const ns3::QueueDiscItem>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<void, ns3::Ptr<const ns3::QueueDiscItem>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackImpl<void, ns3::Ptr<const ns3::QueueDiscItem>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()(ns3::Ptr<const ns3::QueueDiscItem> arg0) [member operator]
cls.add_method('operator()',
'void',
[param('ns3::Ptr< ns3::QueueDiscItem const >', 'arg0')],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CallbackImpl__Void_Ns3Ptr__lt__ns3NetDevice__gt___Ns3Ptr__lt__const_ns3Packet__gt___Unsigned_short_Const_ns3Address___amp___Const_ns3Address___amp___Ns3NetDevicePacketType_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< void, ns3::Ptr< ns3::NetDevice >, ns3::Ptr< ns3::Packet const >, unsigned short, ns3::Address const &, ns3::Address const &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::Ptr<const ns3::Packet>, unsigned short, const ns3::Address &, const ns3::Address &, ns3::NetDevice::PacketType, ns3::empty, ns3::empty, ns3::empty>::operator()(ns3::Ptr<ns3::NetDevice> arg0, ns3::Ptr<const ns3::Packet> arg1, short unsigned int arg2, ns3::Address const & arg3, ns3::Address const & arg4, ns3::NetDevice::PacketType arg5) [member operator]
cls.add_method('operator()',
'void',
[param('ns3::Ptr< ns3::NetDevice >', 'arg0'), param('ns3::Ptr< ns3::Packet const >', 'arg1'), param('short unsigned int', 'arg2'), param('ns3::Address const &', 'arg3'), param('ns3::Address const &', 'arg4'), param('ns3::NetDevice::PacketType', 'arg5')],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CallbackImpl__Void_Ns3Ptr__lt__ns3NetDevice__gt___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< void, ns3::Ptr< ns3::NetDevice >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackImpl<void, ns3::Ptr<ns3::NetDevice>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()(ns3::Ptr<ns3::NetDevice> arg0) [member operator]
cls.add_method('operator()',
'void',
[param('ns3::Ptr< ns3::NetDevice >', 'arg0')],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CallbackImpl__Void_Ns3Ptr__lt__ns3Socket__gt___Const_ns3Address___amp___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< void, ns3::Ptr< ns3::Socket >, ns3::Address const &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, const ns3::Address &, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()(ns3::Ptr<ns3::Socket> arg0, ns3::Address const & arg1) [member operator]
cls.add_method('operator()',
'void',
[param('ns3::Ptr< ns3::Socket >', 'arg0'), param('ns3::Address const &', 'arg1')],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CallbackImpl__Void_Ns3Ptr__lt__ns3Socket__gt___Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< void, ns3::Ptr< ns3::Socket >, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()(ns3::Ptr<ns3::Socket> arg0) [member operator]
cls.add_method('operator()',
'void',
[param('ns3::Ptr< ns3::Socket >', 'arg0')],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CallbackImpl__Void_Ns3Ptr__lt__ns3Socket__gt___Unsigned_int_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< void, ns3::Ptr< ns3::Socket >, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackImpl<void, ns3::Ptr<ns3::Socket>, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()(ns3::Ptr<ns3::Socket> arg0, unsigned int arg1) [member operator]
cls.add_method('operator()',
'void',
[param('ns3::Ptr< ns3::Socket >', 'arg0'), param('unsigned int', 'arg1')],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CallbackImpl__Void_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackImpl<void, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()() [member operator]
cls.add_method('operator()',
'void',
[],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CallbackImpl__Void_Unsigned_int_Unsigned_int_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_Ns3Empty_methods(root_module, cls):
## callback.h (module 'core'): ns3::CallbackImpl<void, unsigned int, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl() [constructor]
cls.add_constructor([])
## callback.h (module 'core'): ns3::CallbackImpl<void, unsigned int, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::CallbackImpl(ns3::CallbackImpl<void, unsigned int, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty> const & arg0) [constructor]
cls.add_constructor([param('ns3::CallbackImpl< void, unsigned int, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty > const &', 'arg0')])
## callback.h (module 'core'): static std::string ns3::CallbackImpl<void, unsigned int, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::DoGetTypeid() [member function]
cls.add_method('DoGetTypeid',
'std::string',
[],
is_static=True)
## callback.h (module 'core'): std::string ns3::CallbackImpl<void, unsigned int, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::GetTypeid() const [member function]
cls.add_method('GetTypeid',
'std::string',
[],
is_const=True, is_virtual=True)
## callback.h (module 'core'): void ns3::CallbackImpl<void, unsigned int, unsigned int, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty, ns3::empty>::operator()(unsigned int arg0, unsigned int arg1) [member operator]
cls.add_method('operator()',
'void',
[param('unsigned int', 'arg0'), param('unsigned int', 'arg1')],
is_pure_virtual=True, is_virtual=True, custom_name=u'__call__')
return
def register_Ns3CounterCalculator__Unsigned_int_methods(root_module, cls):
## basic-data-calculators.h (module 'stats'): ns3::CounterCalculator<unsigned int>::CounterCalculator(ns3::CounterCalculator<unsigned int> const & arg0) [constructor]
cls.add_constructor([param('ns3::CounterCalculator< unsigned int > const &', 'arg0')])
## basic-data-calculators.h (module 'stats'): ns3::CounterCalculator<unsigned int>::CounterCalculator() [constructor]
cls.add_constructor([])
## basic-data-calculators.h (module 'stats'): unsigned int ns3::CounterCalculator<unsigned int>::GetCount() const [member function]
cls.add_method('GetCount',
'unsigned int',
[],
is_const=True)
## basic-data-calculators.h (module 'stats'): static ns3::TypeId ns3::CounterCalculator<unsigned int>::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## basic-data-calculators.h (module 'stats'): void ns3::CounterCalculator<unsigned int>::Output(ns3::DataOutputCallback & callback) const [member function]
cls.add_method('Output',
'void',
[param('ns3::DataOutputCallback &', 'callback')],
is_const=True, is_virtual=True)
## basic-data-calculators.h (module 'stats'): void ns3::CounterCalculator<unsigned int>::Update() [member function]
cls.add_method('Update',
'void',
[])
## basic-data-calculators.h (module 'stats'): void ns3::CounterCalculator<unsigned int>::Update(unsigned int const i) [member function]
cls.add_method('Update',
'void',
[param('unsigned int const', 'i')])
## basic-data-calculators.h (module 'stats'): void ns3::CounterCalculator<unsigned int>::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3DropTailQueue__Ns3Packet_methods(root_module, cls):
## drop-tail-queue.h (module 'network'): static ns3::TypeId ns3::DropTailQueue<ns3::Packet>::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## drop-tail-queue.h (module 'network'): ns3::DropTailQueue<ns3::Packet>::DropTailQueue() [constructor]
cls.add_constructor([])
## drop-tail-queue.h (module 'network'): bool ns3::DropTailQueue<ns3::Packet>::Enqueue(ns3::Ptr<ns3::Packet> item) [member function]
cls.add_method('Enqueue',
'bool',
[param('ns3::Ptr< ns3::Packet >', 'item')],
is_virtual=True)
## drop-tail-queue.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::DropTailQueue<ns3::Packet>::Dequeue() [member function]
cls.add_method('Dequeue',
'ns3::Ptr< ns3::Packet >',
[],
is_virtual=True)
## drop-tail-queue.h (module 'network'): ns3::Ptr<ns3::Packet> ns3::DropTailQueue<ns3::Packet>::Remove() [member function]
cls.add_method('Remove',
'ns3::Ptr< ns3::Packet >',
[],
is_virtual=True)
## drop-tail-queue.h (module 'network'): ns3::Ptr<const ns3::Packet> ns3::DropTailQueue<ns3::Packet>::Peek() const [member function]
cls.add_method('Peek',
'ns3::Ptr< ns3::Packet const >',
[],
is_const=True, is_virtual=True)
## drop-tail-queue.h (module 'network'): ns3::DropTailQueue<ns3::Packet>::DropTailQueue(ns3::DropTailQueue<ns3::Packet> const & arg0) [constructor]
cls.add_constructor([param('ns3::DropTailQueue< ns3::Packet > const &', 'arg0')])
return
def register_Ns3DropTailQueue__Ns3QueueDiscItem_methods(root_module, cls):
## drop-tail-queue.h (module 'network'): static ns3::TypeId ns3::DropTailQueue<ns3::QueueDiscItem>::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## drop-tail-queue.h (module 'network'): ns3::DropTailQueue<ns3::QueueDiscItem>::DropTailQueue() [constructor]
cls.add_constructor([])
## drop-tail-queue.h (module 'network'): bool ns3::DropTailQueue<ns3::QueueDiscItem>::Enqueue(ns3::Ptr<ns3::QueueDiscItem> item) [member function]
cls.add_method('Enqueue',
'bool',
[param('ns3::Ptr< ns3::QueueDiscItem >', 'item')],
is_virtual=True)
## drop-tail-queue.h (module 'network'): ns3::Ptr<ns3::QueueDiscItem> ns3::DropTailQueue<ns3::QueueDiscItem>::Dequeue() [member function]
cls.add_method('Dequeue',
'ns3::Ptr< ns3::QueueDiscItem >',
[],
is_virtual=True)
## drop-tail-queue.h (module 'network'): ns3::Ptr<ns3::QueueDiscItem> ns3::DropTailQueue<ns3::QueueDiscItem>::Remove() [member function]
cls.add_method('Remove',
'ns3::Ptr< ns3::QueueDiscItem >',
[],
is_virtual=True)
## drop-tail-queue.h (module 'network'): ns3::Ptr<const ns3::QueueDiscItem> ns3::DropTailQueue<ns3::QueueDiscItem>::Peek() const [member function]
cls.add_method('Peek',
'ns3::Ptr< ns3::QueueDiscItem const >',
[],
is_const=True, is_virtual=True)
## drop-tail-queue.h (module 'network'): ns3::DropTailQueue<ns3::QueueDiscItem>::DropTailQueue(ns3::DropTailQueue<ns3::QueueDiscItem> const & arg0) [constructor]
cls.add_constructor([param('ns3::DropTailQueue< ns3::QueueDiscItem > const &', 'arg0')])
return
def register_Ns3ErrorChannel_methods(root_module, cls):
## error-channel.h (module 'network'): ns3::ErrorChannel::ErrorChannel(ns3::ErrorChannel const & arg0) [constructor]
cls.add_constructor([param('ns3::ErrorChannel const &', 'arg0')])
## error-channel.h (module 'network'): ns3::ErrorChannel::ErrorChannel() [constructor]
cls.add_constructor([])
## error-channel.h (module 'network'): void ns3::ErrorChannel::Add(ns3::Ptr<ns3::SimpleNetDevice> device) [member function]
cls.add_method('Add',
'void',
[param('ns3::Ptr< ns3::SimpleNetDevice >', 'device')],
is_virtual=True)
## error-channel.h (module 'network'): ns3::Ptr<ns3::NetDevice> ns3::ErrorChannel::GetDevice(std::size_t i) const [member function]
cls.add_method('GetDevice',
'ns3::Ptr< ns3::NetDevice >',
[param('std::size_t', 'i')],
is_const=True, is_virtual=True)
## error-channel.h (module 'network'): std::size_t ns3::ErrorChannel::GetNDevices() const [member function]
cls.add_method('GetNDevices',
'std::size_t',
[],
is_const=True, is_virtual=True)
## error-channel.h (module 'network'): static ns3::TypeId ns3::ErrorChannel::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## error-channel.h (module 'network'): void ns3::ErrorChannel::Send(ns3::Ptr<ns3::Packet> p, uint16_t protocol, ns3::Mac48Address to, ns3::Mac48Address from, ns3::Ptr<ns3::SimpleNetDevice> sender) [member function]
cls.add_method('Send',
'void',
[param('ns3::Ptr< ns3::Packet >', 'p'), param('uint16_t', 'protocol'), param('ns3::Mac48Address', 'to'), param('ns3::Mac48Address', 'from'), param('ns3::Ptr< ns3::SimpleNetDevice >', 'sender')],
is_virtual=True)
## error-channel.h (module 'network'): void ns3::ErrorChannel::SetDuplicateMode(bool mode) [member function]
cls.add_method('SetDuplicateMode',
'void',
[param('bool', 'mode')])
## error-channel.h (module 'network'): void ns3::ErrorChannel::SetDuplicateTime(ns3::Time delay) [member function]
cls.add_method('SetDuplicateTime',
'void',
[param('ns3::Time', 'delay')])
## error-channel.h (module 'network'): void ns3::ErrorChannel::SetJumpingMode(bool mode) [member function]
cls.add_method('SetJumpingMode',
'void',
[param('bool', 'mode')])
## error-channel.h (module 'network'): void ns3::ErrorChannel::SetJumpingTime(ns3::Time delay) [member function]
cls.add_method('SetJumpingTime',
'void',
[param('ns3::Time', 'delay')])
return
def register_Ns3PacketCounterCalculator_methods(root_module, cls):
## packet-data-calculators.h (module 'network'): ns3::PacketCounterCalculator::PacketCounterCalculator(ns3::PacketCounterCalculator const & arg0) [constructor]
cls.add_constructor([param('ns3::PacketCounterCalculator const &', 'arg0')])
## packet-data-calculators.h (module 'network'): ns3::PacketCounterCalculator::PacketCounterCalculator() [constructor]
cls.add_constructor([])
## packet-data-calculators.h (module 'network'): void ns3::PacketCounterCalculator::FrameUpdate(std::string path, ns3::Ptr<const ns3::Packet> packet, ns3::Mac48Address realto) [member function]
cls.add_method('FrameUpdate',
'void',
[param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet'), param('ns3::Mac48Address', 'realto')])
## packet-data-calculators.h (module 'network'): static ns3::TypeId ns3::PacketCounterCalculator::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## packet-data-calculators.h (module 'network'): void ns3::PacketCounterCalculator::PacketUpdate(std::string path, ns3::Ptr<const ns3::Packet> packet) [member function]
cls.add_method('PacketUpdate',
'void',
[param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet')])
## packet-data-calculators.h (module 'network'): void ns3::PacketCounterCalculator::DoDispose() [member function]
cls.add_method('DoDispose',
'void',
[],
visibility='protected', is_virtual=True)
return
def register_Ns3PacketProbe_methods(root_module, cls):
## packet-probe.h (module 'network'): ns3::PacketProbe::PacketProbe(ns3::PacketProbe const & arg0) [constructor]
cls.add_constructor([param('ns3::PacketProbe const &', 'arg0')])
## packet-probe.h (module 'network'): ns3::PacketProbe::PacketProbe() [constructor]
cls.add_constructor([])
## packet-probe.h (module 'network'): bool ns3::PacketProbe::ConnectByObject(std::string traceSource, ns3::Ptr<ns3::Object> obj) [member function]
cls.add_method('ConnectByObject',
'bool',
[param('std::string', 'traceSource'), param('ns3::Ptr< ns3::Object >', 'obj')],
is_virtual=True)
## packet-probe.h (module 'network'): void ns3::PacketProbe::ConnectByPath(std::string path) [member function]
cls.add_method('ConnectByPath',
'void',
[param('std::string', 'path')],
is_virtual=True)
## packet-probe.h (module 'network'): static ns3::TypeId ns3::PacketProbe::GetTypeId() [member function]
cls.add_method('GetTypeId',
'ns3::TypeId',
[],
is_static=True)
## packet-probe.h (module 'network'): void ns3::PacketProbe::SetValue(ns3::Ptr<const ns3::Packet> packet) [member function]
cls.add_method('SetValue',
'void',
[param('ns3::Ptr< ns3::Packet const >', 'packet')])
## packet-probe.h (module 'network'): static void ns3::PacketProbe::SetValueByPath(std::string path, ns3::Ptr<const ns3::Packet> packet) [member function]
cls.add_method('SetValueByPath',
'void',
[param('std::string', 'path'), param('ns3::Ptr< ns3::Packet const >', 'packet')],
is_static=True)
return
def register_Ns3PbbAddressTlv_methods(root_module, cls):
## packetbb.h (module 'network'): ns3::PbbAddressTlv::PbbAddressTlv() [constructor]
cls.add_constructor([])
## packetbb.h (module 'network'): ns3::PbbAddressTlv::PbbAddressTlv(ns3::PbbAddressTlv const & arg0) [constructor]
cls.add_constructor([param('ns3::PbbAddressTlv const &', 'arg0')])
## packetbb.h (module 'network'): uint8_t ns3::PbbAddressTlv::GetIndexStart() const [member function]
cls.add_method('GetIndexStart',
'uint8_t',
[],
is_const=True)
## packetbb.h (module 'network'): uint8_t ns3::PbbAddressTlv::GetIndexStop() const [member function]
cls.add_method('GetIndexStop',
'uint8_t',
[],
is_const=True)
## packetbb.h (module 'network'): bool ns3::PbbAddressTlv::HasIndexStart() const [member function]
cls.add_method('HasIndexStart',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): bool ns3::PbbAddressTlv::HasIndexStop() const [member function]
cls.add_method('HasIndexStop',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): bool ns3::PbbAddressTlv::IsMultivalue() const [member function]
cls.add_method('IsMultivalue',
'bool',
[],
is_const=True)
## packetbb.h (module 'network'): void ns3::PbbAddressTlv::SetIndexStart(uint8_t index) [member function]
cls.add_method('SetIndexStart',
'void',
[param('uint8_t', 'index')])
## packetbb.h (module 'network'): void ns3::PbbAddressTlv::SetIndexStop(uint8_t index) [member function]
cls.add_method('SetIndexStop',
'void',
[param('uint8_t', 'index')])
## packetbb.h (module 'network'): void ns3::PbbAddressTlv::SetMultivalue(bool isMultivalue) [member function]
cls.add_method('SetMultivalue',
'void',
[param('bool', 'isMultivalue')])
return
def register_Ns3QueueDiscItem_methods(root_module, cls):
## queue-item.h (module 'network'): ns3::QueueDiscItem::QueueDiscItem(ns3::Ptr<ns3::Packet> p, ns3::Address const & addr, uint16_t protocol) [constructor]
cls.add_constructor([param('ns3::Ptr< ns3::Packet >', 'p'), param('ns3::Address const &', 'addr'), param('uint16_t', 'protocol')])
## queue-item.h (module 'network'): ns3::Address ns3::QueueDiscItem::GetAddress() const [member function]
cls.add_method('GetAddress',
'ns3::Address',
[],
is_const=True)
## queue-item.h (module 'network'): uint16_t ns3::QueueDiscItem::GetProtocol() const [member function]
cls.add_method('GetProtocol',
'uint16_t',
[],
is_const=True)
## queue-item.h (module 'network'): uint8_t ns3::QueueDiscItem::GetTxQueueIndex() const [member function]
cls.add_method('GetTxQueueIndex',
'uint8_t',
[],
is_const=True)
## queue-item.h (module 'network'): void ns3::QueueDiscItem::SetTxQueueIndex(uint8_t txq) [member function]
cls.add_method('SetTxQueueIndex',
'void',
[param('uint8_t', 'txq')])
## queue-item.h (module 'network'): ns3::Time ns3::QueueDiscItem::GetTimeStamp() const [member function]
cls.add_method('GetTimeStamp',
'ns3::Time',
[],
is_const=True)
## queue-item.h (module 'network'): void ns3::QueueDiscItem::SetTimeStamp(ns3::Time t) [member function]
cls.add_method('SetTimeStamp',
'void',
[param('ns3::Time', 't')])
## queue-item.h (module 'network'): void ns3::QueueDiscItem::AddHeader() [member function]
cls.add_method('AddHeader',
'void',
[],
is_pure_virtual=True, is_virtual=True)
## queue-item.h (module 'network'): void ns3::QueueDiscItem::Print(std::ostream & os) const [member function]
cls.add_method('Print',
'void',
[param('std::ostream &', 'os')],
is_const=True, is_virtual=True)
## queue-item.h (module 'network'): bool ns3::QueueDiscItem::Mark() [member function]
cls.add_method('Mark',
'bool',
[],
is_pure_virtual=True, is_virtual=True)
## queue-item.h (module 'network'): uint32_t ns3::QueueDiscItem::Hash(uint32_t perturbation=0) const [member function]
cls.add_method('Hash',
'uint32_t',
[param('uint32_t', 'perturbation', default_value='0')],
is_const=True, is_virtual=True)
return
def register_Ns3HashImplementation_methods(root_module, cls):
## hash-function.h (module 'core'): ns3::Hash::Implementation::Implementation(ns3::Hash::Implementation const & arg0) [constructor]
cls.add_constructor([param('ns3::Hash::Implementation const &', 'arg0')])
## hash-function.h (module 'core'): ns3::Hash::Implementation::Implementation() [constructor]
cls.add_constructor([])
## hash-function.h (module 'core'): uint32_t ns3::Hash::Implementation::GetHash32(char const * buffer, std::size_t const size) [member function]
cls.add_method('GetHash32',
'uint32_t',
[param('char const *', 'buffer'), param('std::size_t const', 'size')],
is_pure_virtual=True, is_virtual=True)
## hash-function.h (module 'core'): uint64_t ns3::Hash::Implementation::GetHash64(char const * buffer, std::size_t const size) [member function]
cls.add_method('GetHash64',
'uint64_t',
[param('char const *', 'buffer'), param('std::size_t const', 'size')],
is_virtual=True)
## hash-function.h (module 'core'): void ns3::Hash::Implementation::clear() [member function]
cls.add_method('clear',
'void',
[],
is_pure_virtual=True, is_virtual=True)
return
def register_Ns3HashFunctionFnv1a_methods(root_module, cls):
## hash-fnv.h (module 'core'): ns3::Hash::Function::Fnv1a::Fnv1a(ns3::Hash::Function::Fnv1a const & arg0) [constructor]
cls.add_constructor([param('ns3::Hash::Function::Fnv1a const &', 'arg0')])
## hash-fnv.h (module 'core'): ns3::Hash::Function::Fnv1a::Fnv1a() [constructor]
cls.add_constructor([])
## hash-fnv.h (module 'core'): uint32_t ns3::Hash::Function::Fnv1a::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')],
is_virtual=True)
## hash-fnv.h (module 'core'): uint64_t ns3::Hash::Function::Fnv1a::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')],
is_virtual=True)
## hash-fnv.h (module 'core'): void ns3::Hash::Function::Fnv1a::clear() [member function]
cls.add_method('clear',
'void',
[],
is_virtual=True)
return
def register_Ns3HashFunctionHash32_methods(root_module, cls):
## hash-function.h (module 'core'): ns3::Hash::Function::Hash32::Hash32(ns3::Hash::Function::Hash32 const & arg0) [constructor]
cls.add_constructor([param('ns3::Hash::Function::Hash32 const &', 'arg0')])
## hash-function.h (module 'core'): ns3::Hash::Function::Hash32::Hash32(ns3::Hash::Hash32Function_ptr hp) [constructor]
cls.add_constructor([param('ns3::Hash::Hash32Function_ptr', 'hp')])
## hash-function.h (module 'core'): uint32_t ns3::Hash::Function::Hash32::GetHash32(char const * buffer, std::size_t const size) [member function]
cls.add_method('GetHash32',
'uint32_t',
[param('char const *', 'buffer'), param('std::size_t const', 'size')],
is_virtual=True)
## hash-function.h (module 'core'): void ns3::Hash::Function::Hash32::clear() [member function]
cls.add_method('clear',
'void',
[],
is_virtual=True)
return
def register_Ns3HashFunctionHash64_methods(root_module, cls):
## hash-function.h (module 'core'): ns3::Hash::Function::Hash64::Hash64(ns3::Hash::Function::Hash64 const & arg0) [constructor]
cls.add_constructor([param('ns3::Hash::Function::Hash64 const &', 'arg0')])
## hash-function.h (module 'core'): ns3::Hash::Function::Hash64::Hash64(ns3::Hash::Hash64Function_ptr hp) [constructor]
cls.add_constructor([param('ns3::Hash::Hash64Function_ptr', 'hp')])
## hash-function.h (module 'core'): uint32_t ns3::Hash::Function::Hash64::GetHash32(char const * buffer, std::size_t const size) [member function]
cls.add_method('GetHash32',
'uint32_t',
[param('char const *', 'buffer'), param('std::size_t const', 'size')],
is_virtual=True)
## hash-function.h (module 'core'): uint64_t ns3::Hash::Function::Hash64::GetHash64(char const * buffer, std::size_t const size) [member function]
cls.add_method('GetHash64',
'uint64_t',
[param('char const *', 'buffer'), param('std::size_t const', 'size')],
is_virtual=True)
## hash-function.h (module 'core'): void ns3::Hash::Function::Hash64::clear() [member function]
cls.add_method('clear',
'void',
[],
is_virtual=True)
return
def register_Ns3HashFunctionMurmur3_methods(root_module, cls):
## hash-murmur3.h (module 'core'): ns3::Hash::Function::Murmur3::Murmur3(ns3::Hash::Function::Murmur3 const & arg0) [constructor]
cls.add_constructor([param('ns3::Hash::Function::Murmur3 const &', 'arg0')])
## hash-murmur3.h (module 'core'): ns3::Hash::Function::Murmur3::Murmur3() [constructor]
cls.add_constructor([])
## hash-murmur3.h (module 'core'): uint32_t ns3::Hash::Function::Murmur3::GetHash32(char const * buffer, std::size_t const size) [member function]
cls.add_method('GetHash32',
'uint32_t',
[param('char const *', 'buffer'), param('std::size_t const', 'size')],
is_virtual=True)
## hash-murmur3.h (module 'core'): uint64_t ns3::Hash::Function::Murmur3::GetHash64(char const * buffer, std::size_t const size) [member function]
cls.add_method('GetHash64',
'uint64_t',
[param('char const *', 'buffer'), param('std::size_t const', 'size')],
is_virtual=True)
## hash-murmur3.h (module 'core'): void ns3::Hash::Function::Murmur3::clear() [member function]
cls.add_method('clear',
'void',
[],
is_virtual=True)
return
def register_functions(root_module):
module = root_module
## crc32.h (module 'network'): uint32_t ns3::CRC32Calculate(uint8_t const * data, int length) [free function]
module.add_function('CRC32Calculate',
'uint32_t',
[param('uint8_t const *', 'data'), param('int', 'length')])
## address.h (module 'network'): ns3::Ptr<const ns3::AttributeChecker> ns3::MakeAddressChecker() [free function]
module.add_function('MakeAddressChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## data-rate.h (module 'network'): ns3::Ptr<const ns3::AttributeChecker> ns3::MakeDataRateChecker() [free function]
module.add_function('MakeDataRateChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## ipv4-address.h (module 'network'): ns3::Ptr<const ns3::AttributeChecker> ns3::MakeIpv4AddressChecker() [free function]
module.add_function('MakeIpv4AddressChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## ipv4-address.h (module 'network'): ns3::Ptr<const ns3::AttributeChecker> ns3::MakeIpv4MaskChecker() [free function]
module.add_function('MakeIpv4MaskChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## ipv6-address.h (module 'network'): ns3::Ptr<const ns3::AttributeChecker> ns3::MakeIpv6AddressChecker() [free function]
module.add_function('MakeIpv6AddressChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## ipv6-address.h (module 'network'): ns3::Ptr<const ns3::AttributeChecker> ns3::MakeIpv6PrefixChecker() [free function]
module.add_function('MakeIpv6PrefixChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## mac16-address.h (module 'network'): ns3::Ptr<const ns3::AttributeChecker> ns3::MakeMac16AddressChecker() [free function]
module.add_function('MakeMac16AddressChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## mac48-address.h (module 'network'): ns3::Ptr<const ns3::AttributeChecker> ns3::MakeMac48AddressChecker() [free function]
module.add_function('MakeMac48AddressChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## mac64-address.h (module 'network'): ns3::Ptr<const ns3::AttributeChecker> ns3::MakeMac64AddressChecker() [free function]
module.add_function('MakeMac64AddressChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## queue-size.h (module 'network'): ns3::Ptr<const ns3::AttributeChecker> ns3::MakeQueueSizeChecker() [free function]
module.add_function('MakeQueueSizeChecker',
'ns3::Ptr< ns3::AttributeChecker const >',
[])
## address-utils.h (module 'network'): void ns3::ReadFrom(ns3::Buffer::Iterator & i, ns3::Address & ad, uint32_t len) [free function]
module.add_function('ReadFrom',
'void',
[param('ns3::Buffer::Iterator &', 'i'), param('ns3::Address &', 'ad'), param('uint32_t', 'len')])
## address-utils.h (module 'network'): void ns3::ReadFrom(ns3::Buffer::Iterator & i, ns3::Ipv4Address & ad) [free function]
module.add_function('ReadFrom',
'void',
[param('ns3::Buffer::Iterator &', 'i'), param('ns3::Ipv4Address &', 'ad')])
## address-utils.h (module 'network'): void ns3::ReadFrom(ns3::Buffer::Iterator & i, ns3::Ipv6Address & ad) [free function]
module.add_function('ReadFrom',
'void',
[param('ns3::Buffer::Iterator &', 'i'), param('ns3::Ipv6Address &', 'ad')])
## address-utils.h (module 'network'): void ns3::ReadFrom(ns3::Buffer::Iterator & i, ns3::Mac16Address & ad) [free function]
module.add_function('ReadFrom',
'void',
[param('ns3::Buffer::Iterator &', 'i'), param('ns3::Mac16Address &', 'ad')])
## address-utils.h (module 'network'): void ns3::ReadFrom(ns3::Buffer::Iterator & i, ns3::Mac48Address & ad) [free function]
module.add_function('ReadFrom',
'void',
[param('ns3::Buffer::Iterator &', 'i'), param('ns3::Mac48Address &', 'ad')])
## address-utils.h (module 'network'): void ns3::ReadFrom(ns3::Buffer::Iterator & i, ns3::Mac64Address & ad) [free function]
module.add_function('ReadFrom',
'void',
[param('ns3::Buffer::Iterator &', 'i'), param('ns3::Mac64Address &', 'ad')])
## address-utils.h (module 'network'): void ns3::WriteTo(ns3::Buffer::Iterator & i, ns3::Address const & ad) [free function]
module.add_function('WriteTo',
'void',
[param('ns3::Buffer::Iterator &', 'i'), param('ns3::Address const &', 'ad')])
## address-utils.h (module 'network'): void ns3::WriteTo(ns3::Buffer::Iterator & i, ns3::Ipv4Address ad) [free function]
module.add_function('WriteTo',
'void',
[param('ns3::Buffer::Iterator &', 'i'), param('ns3::Ipv4Address', 'ad')])
## address-utils.h (module 'network'): void ns3::WriteTo(ns3::Buffer::Iterator & i, ns3::Ipv6Address ad) [free function]
module.add_function('WriteTo',
'void',
[param('ns3::Buffer::Iterator &', 'i'), param('ns3::Ipv6Address', 'ad')])
## address-utils.h (module 'network'): void ns3::WriteTo(ns3::Buffer::Iterator & i, ns3::Mac16Address ad) [free function]
module.add_function('WriteTo',
'void',
[param('ns3::Buffer::Iterator &', 'i'), param('ns3::Mac16Address', 'ad')])
## address-utils.h (module 'network'): void ns3::WriteTo(ns3::Buffer::Iterator & i, ns3::Mac48Address ad) [free function]
module.add_function('WriteTo',
'void',
[param('ns3::Buffer::Iterator &', 'i'), param('ns3::Mac48Address', 'ad')])
## address-utils.h (module 'network'): void ns3::WriteTo(ns3::Buffer::Iterator & i, ns3::Mac64Address ad) [free function]
module.add_function('WriteTo',
'void',
[param('ns3::Buffer::Iterator &', 'i'), param('ns3::Mac64Address', 'ad')])
register_functions_ns3_FatalImpl(module.add_cpp_namespace('FatalImpl'), root_module)
register_functions_ns3_Hash(module.add_cpp_namespace('Hash'), root_module)
register_functions_ns3_TracedValueCallback(module.add_cpp_namespace('TracedValueCallback'), root_module)
register_functions_ns3_addressUtils(module.add_cpp_namespace('addressUtils'), root_module)
register_functions_ns3_internal(module.add_cpp_namespace('internal'), root_module)
register_functions_ns3_tests(module.add_cpp_namespace('tests'), root_module)
return
def register_functions_ns3_FatalImpl(module, root_module):
return
def register_functions_ns3_Hash(module, root_module):
register_functions_ns3_Hash_Function(module.add_cpp_namespace('Function'), root_module)
return
def register_functions_ns3_Hash_Function(module, root_module):
return
def register_functions_ns3_TracedValueCallback(module, root_module):
return
def register_functions_ns3_addressUtils(module, root_module):
## address-utils.h (module 'network'): bool ns3::addressUtils::IsMulticast(ns3::Address const & ad) [free function]
module.add_function('IsMulticast',
'bool',
[param('ns3::Address const &', 'ad')])
return
def register_functions_ns3_internal(module, root_module):
return
def register_functions_ns3_tests(module, root_module):
return
def main():
out = FileCodeSink(sys.stdout)
root_module = module_init()
register_types(root_module)
register_methods(root_module)
register_functions(root_module)
root_module.generate(out)
if __name__ == '__main__':
main()
|
#!/usr/bin/python
import sys
class CycleFound (Exception):
def __init__(self, path, labels):
self.path = path
self.labels = labels
def __str__(self):
l = len(self.labels)
result = ""
for i in range(0, l):
result = "%s%s %s " % (result, self.path[i], self.labels[i])
return "%s%s" % (result, self.path[l])
def consistent(lbls, recur=False):
if len(lbls) == 0:
return True
if len(lbls) == 1:
assert False
return not (reduce(combine, lbls[1:], lbls[0]) in ['<', '>'])
# if len(lbls) == 2:
# return (lbls[0] == '<>') or (combine(lbls[0], symmetric(lbls[1])) <> '<>')
# else:
# return consistent([combine(lbls[0], lbls[1])] + lbls[2:])
def combine(old, new, loop=False):
if old == '<>' or new == '<>':
return '<>'
if old == new:
return old
if old == '=':
if new.find('=') <> -1:
return '='
return '<>'
if old == '<':
if new == '<=' or new == '<':
return '<'
return '<>'
if old == '>':
if new == '>' or new == '>=':
return '>'
return '<>'
if old == '<=':
if new.find('=') <> -1:
return '='
if old == '>=':
if new.find('=') <> -1:
return '='
if loop:
print old, new
assert False
else:
return combine(new, old, True)
def symmetric(lbl):
return { '<' : '>'
, '<=' : '>='
, '>=' : '<='
, '>' : '<'
, '=' : '='
, '<>' : '<>' }[lbl]
class Graph:
def __init__(self):
self._edges = {}
def edge(self, st, en, lbl, loop=False):
if not self._edges.has_key(st):
self._edges[st] = {}
if self._edges[st].has_key(en):
try:
x = combine(self._edges[st][en], lbl)
self._edges[st][en] = x
except Exception,e:
raise CycleFound([st, en, st], [lbl, self._edges[st][en]])
self._edges[st][en] = lbl
if not loop:
self.edge(en, st, symmetric(lbl), True)
def edges(self, st):
if self._edges.has_key(st):
return self._edges[st]
return {}
def nodes(self):
return self._edges.keys()
def __str__(self):
return "%s" % self._edges
def dump_smt(self, out=sys.stdout):
def name_of(n):
return n.replace('.', '_')
for n in self._edges.keys():
out.write("(define %s::int)\n" % name_of(n))
out.write("\n")
visited = set()
for (x,es) in self._edges.items():
for (y, op) in es.items():
if y in visited:
continue
out.write("(assert (%s %s %s))\n" % (op, name_of(x), name_of(y)))
visited.add(x)
out.write("(exit)\n")
def find_cycle(gr):
visited = set([])
remaining = set(gr.nodes())
while len(remaining) > 0:
root = remaining.pop()
lvisit = set([root])
path = []
labels = []
def find_strict_cycle(st):
if st in path:
f = path.index(st)
if not consistent(labels[f:]):
raise CycleFound(path[f:] + [st], labels[f:])
if st in visited:
return None
path.append(st)
visited.add(st)
for (to, lbl) in gr.edges(st).items():
labels.append(lbl)
find_strict_cycle(to)
labels.pop()
path.pop()
return None
find_strict_cycle(root)
return None
def read_graph(file):
lines = file.readlines()
gr = Graph()
last = None
for ln in lines:
ln = ln.replace(';', '')
parts = ln.split()
if len(parts) == 3:
last = parts[0]
elif len(parts) == 2:
parts = [last, parts[0], parts[1]]
else:
assert False
st = parts[0].strip()
en = parts[2].strip()
gr.edge(st, en, parts[1].strip())
return gr
def test_combine():
lbls = ['<', '>', '<=', '>=', '=']
for x in lbls:
for y in lbls:
combine(x,y)
def test_consistent():
assert not consistent(['>=', '>=', '>'])
assert consistent(['<', '>'])
if __name__ == '__main__':
try:
gr = read_graph(sys.stdin)
res = find_cycle(gr)
print "No cycle found"
except CycleFound,e:
print "Cycle found!"
print e
|
# -*- coding: utf-8 -*-
#
# django-pgcryptoauth documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 21 01:32:47 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
#import sphinx_bootstrap_theme
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = []
# Add any paths that contain templates here, relative to this directory.
#templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'django-staticshard'
copyright = u'2014, Drew Engelson'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.1'
# The full version, including alpha/beta/rc tags.
release = '0.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#html_theme = 'bootstrap'
#html_theme_path = sphinx_bootstrap_theme.get_html_theme_path()
sys.path.append(os.path.abspath('_themes'))
html_theme_path = ['_themes']
html_theme = 'sphinx-theme-okfn'
html_theme_options = {
'logo_icon': '_static/img/elephant-64.png',
'show_okfn_logo': False,
}
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
#html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
html_sidebars = {
'**': ['localtoc.html', 'relations.html', 'sourcelink.html'],
}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'django-staticshard'
# -- Options for LaTeX output --------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'django-staticshard.tex', u'django-staticshard Documentation',
u'Drew Engelson', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'django-staticshard', u'django-staticshard Documentation',
[u'Drew Engelson'], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output ------------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'django-staticshard', u'django-staticshard Documentation',
u'Drew Engelson', 'django-staticshard', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
|
""" Tests the duct component. """
import unittest
import os
import numpy as np
from openmdao.api import Problem, Group
from openmdao.utils.assert_utils import assert_near_equal, assert_check_partials
from pycycle.mp_cycle import Cycle
from pycycle.elements.duct import Duct
from pycycle.elements.flow_start import FlowStart
from pycycle import constants
from pycycle.thermo.cea import species_data
fpath = os.path.dirname(os.path.realpath(__file__))
ref_data = np.loadtxt(fpath + "/reg_data/duct.csv", delimiter=",", skiprows=1)
header = [
'dPqP',
'Qin',
'Fl_I.W',
'Fl_I.V',
'Fl_I.MN',
'Fl_I.s',
'Fl_I.Pt',
'Fl_I.Tt',
'Fl_I.ht',
'Fl_I.rhot',
'Fl_I.gamt',
'Fl_O.MN',
'Fl_O.s',
'Fl_O.Pt',
'Fl_O.Tt',
'Fl_O.ht',
'Fl_O.rhot',
'Fl_O.gamt',
'Fl_O.Ps',
'Fl_O.Ts',
'Fl_O.hs',
'Fl_O.rhos',
'Fl_O.gams']
h_map = dict(((v_name, i) for i, v_name in enumerate(header)))
np.seterr(all="raise")
class DuctTestCase(unittest.TestCase):
def test_case1(self):
self.prob = Problem()
cycle = self.prob.model = Cycle()
cycle.options['thermo_method'] = 'CEA'
cycle.options['thermo_data'] = species_data.janaf
cycle.add_subsystem('flow_start', FlowStart(), promotes=['MN', 'P', 'T'])
cycle.add_subsystem('duct', Duct(), promotes=['MN'])
cycle.pyc_connect_flow('flow_start.Fl_O', 'duct.Fl_I')
cycle.set_input_defaults('MN', 0.5)
cycle.set_input_defaults('duct.dPqP', 0.0)
cycle.set_input_defaults('P', 17., units='psi')
cycle.set_input_defaults('T', 500., units='degR')
cycle.set_input_defaults('flow_start.W', 500., units='lbm/s')
self.prob.setup(check=False, force_alloc_complex=True)
self.prob.set_solver_print(level=-1)
# 6 cases to check against
for i, data in enumerate(ref_data):
self.prob['duct.dPqP'] = data[h_map['dPqP']]
# input flowstation
self.prob['P'] = data[h_map['Fl_I.Pt']]
self.prob['T'] = data[h_map['Fl_I.Tt']]
self.prob['MN'] = data[h_map['Fl_O.MN']]
self.prob['flow_start.W'] = data[h_map['Fl_I.W']]
self.prob['duct.Fl_I:stat:V'] = data[h_map['Fl_I.V']]
# give a decent initial guess for Ps
print(i, self.prob['P'], self.prob['T'], self.prob['MN'])
self.prob.run_model()
# check outputs
pt, ht, ps, ts = data[h_map['Fl_O.Pt']], data[
h_map['Fl_O.ht']], data[h_map['Fl_O.Ps']], data[h_map['Fl_O.Ts']]
pt_computed = self.prob['duct.Fl_O:tot:P']
ht_computed = self.prob['duct.Fl_O:tot:h']
ps_computed = self.prob['duct.Fl_O:stat:P']
ts_computed = self.prob['duct.Fl_O:stat:T']
tol = 2.0e-2
assert_near_equal(pt_computed, pt, tol)
assert_near_equal(ht_computed, ht, tol)
assert_near_equal(ps_computed, ps, tol)
assert_near_equal(ts_computed, ts, tol)
partial_data = self.prob.check_partials(out_stream=None, method='cs',
includes=['duct.*'], excludes=['*.base_thermo.*',])
assert_check_partials(partial_data, atol=1e-8, rtol=1e-8)
def test_case_with_dPqP_MN(self):
self.prob = Problem()
# need two cycles, because we can't mix design and off-design
cycle_DES = self.prob.model.add_subsystem('DESIGN', Cycle())
cycle_DES.options['thermo_method'] = 'CEA'
cycle_DES.options['thermo_data'] = species_data.janaf
cycle_OD = self.prob.model.add_subsystem('OFF_DESIGN', Cycle())
cycle_OD.options['design'] = False
cycle_OD.options['thermo_method'] = 'CEA'
cycle_OD.options['thermo_data'] = species_data.janaf
cycle_DES.add_subsystem('flow_start', FlowStart(), promotes=['P', 'T', 'MN', 'W'])
cycle_OD.add_subsystem('flow_start_OD', FlowStart(), promotes=['P', 'T', 'W', 'MN'])
expMN = 1.0
cycle_DES.add_subsystem('duct', Duct(expMN=expMN), promotes=['MN'])
cycle_OD.add_subsystem('duct', Duct(expMN=expMN, design=False))
cycle_DES.pyc_connect_flow('flow_start.Fl_O', 'duct.Fl_I')
cycle_OD.pyc_connect_flow('flow_start_OD.Fl_O', 'duct.Fl_I')
cycle_DES.set_input_defaults('P', 17., units='psi')
cycle_DES.set_input_defaults('T', 500., units='degR')
cycle_DES.set_input_defaults('MN', 0.5)
cycle_DES.set_input_defaults('duct.dPqP', 0.0)
cycle_DES.set_input_defaults('W', 500., units='lbm/s')
cycle_OD.set_input_defaults('P', 17., units='psi')
cycle_OD.set_input_defaults('T', 500., units='degR')
cycle_OD.set_input_defaults('MN', 0.25)
cycle_OD.set_input_defaults('duct.dPqP', 0.0)
cycle_OD.set_input_defaults('W', 500., units='lbm/s')
self.prob.model.connect("DESIGN.duct.s_dPqP", "OFF_DESIGN.duct.s_dPqP")
self.prob.model.connect("DESIGN.duct.Fl_O:stat:area", "OFF_DESIGN.duct.area")
self.prob.setup(check=False, force_alloc_complex=True)
self.prob.set_solver_print(level=-1)
data = ref_data[0]
self.prob['DESIGN.duct.dPqP'] = data[h_map['dPqP']]
# input flowstation
self.prob['DESIGN.P'] = data[h_map['Fl_I.Pt']]
self.prob['DESIGN.T'] = data[h_map['Fl_I.Tt']]
self.prob['DESIGN.MN'] = data[h_map['Fl_O.MN']]
self.prob['DESIGN.W'] = data[h_map['Fl_I.W']]
# self.prob['DESIGN.duct.Fl_I:stat:V'] = data[h_map['Fl_I.V']]
# input flowstation
self.prob['OFF_DESIGN.P'] = data[h_map['Fl_I.Pt']]
self.prob['OFF_DESIGN.T'] = data[h_map['Fl_I.Tt']]
self.prob['OFF_DESIGN.W'] = data[h_map['Fl_I.W']]
# self.prob['OFF_DESIGN.duct.Fl_I:stat:V'] = data[h_map['Fl_I.V']]
# give a decent initial guess for Ps
print(self.prob['DESIGN.P'], self.prob['DESIGN.T'], self.prob['DESIGN.MN'])
self.prob.run_model()
# check outputs
pt, ht, ps, ts = data[h_map['Fl_O.Pt']], data[
h_map['Fl_O.ht']], data[h_map['Fl_O.Ps']], data[h_map['Fl_O.Ts']]
pt_computed = self.prob['OFF_DESIGN.duct.Fl_O:tot:P']
ht_computed = self.prob['OFF_DESIGN.duct.Fl_O:tot:h']
ps_computed = self.prob['OFF_DESIGN.duct.Fl_O:stat:P']
ts_computed = self.prob['OFF_DESIGN.duct.Fl_O:stat:T']
tol = 1.0e-4
assert_near_equal(pt_computed, 8.84073152, tol)
assert_near_equal(ht_computed, ht, tol)
assert_near_equal(ps_computed, 8.26348914, tol)
assert_near_equal(ts_computed, ts, tol)
partial_data = self.prob.check_partials(out_stream=None, method='cs',
includes=['duct.*'], excludes=['*.base_thermo.*',])
assert_check_partials(partial_data, atol=1e-8, rtol=1e-8)
if __name__ == "__main__":
unittest.main()
|
# Copyright Anne M. Archibald 2008
# Released under the scipy license
from __future__ import division, print_function, absolute_import
from numpy.testing import (assert_equal, assert_array_equal,
assert_almost_equal, assert_array_almost_equal, assert_,
assert_raises)
import numpy as np
from scipy.spatial import KDTree, Rectangle, distance_matrix, cKDTree
from scipy.spatial.ckdtree import cKDTreeNode
from scipy.spatial import minkowski_distance
import itertools
def distance_box(a, b, p, boxsize):
diff = a - b
diff[diff > 0.5 * boxsize] -= boxsize
diff[diff < -0.5 * boxsize] += boxsize
d = minkowski_distance(diff, 0, p)
return d
class ConsistencyTests:
def distance(self, a, b, p):
return minkowski_distance(a, b, p)
def test_nearest(self):
x = self.x
d, i = self.kdtree.query(x, 1)
assert_almost_equal(d**2,np.sum((x-self.data[i])**2))
eps = 1e-8
assert_(np.all(np.sum((self.data-x[np.newaxis,:])**2,axis=1) > d**2-eps))
def test_m_nearest(self):
x = self.x
m = self.m
dd, ii = self.kdtree.query(x, m)
d = np.amax(dd)
i = ii[np.argmax(dd)]
assert_almost_equal(d**2,np.sum((x-self.data[i])**2))
eps = 1e-8
assert_equal(np.sum(np.sum((self.data-x[np.newaxis,:])**2,axis=1) < d**2+eps),m)
def test_points_near(self):
x = self.x
d = self.d
dd, ii = self.kdtree.query(x, k=self.kdtree.n, distance_upper_bound=d)
eps = 1e-8
hits = 0
for near_d, near_i in zip(dd,ii):
if near_d == np.inf:
continue
hits += 1
assert_almost_equal(near_d**2,np.sum((x-self.data[near_i])**2))
assert_(near_d < d+eps, "near_d=%g should be less than %g" % (near_d,d))
assert_equal(np.sum(self.distance(self.data,x,2) < d**2+eps),hits)
def test_points_near_l1(self):
x = self.x
d = self.d
dd, ii = self.kdtree.query(x, k=self.kdtree.n, p=1, distance_upper_bound=d)
eps = 1e-8
hits = 0
for near_d, near_i in zip(dd,ii):
if near_d == np.inf:
continue
hits += 1
assert_almost_equal(near_d,self.distance(x,self.data[near_i],1))
assert_(near_d < d+eps, "near_d=%g should be less than %g" % (near_d,d))
assert_equal(np.sum(self.distance(self.data,x,1) < d+eps),hits)
def test_points_near_linf(self):
x = self.x
d = self.d
dd, ii = self.kdtree.query(x, k=self.kdtree.n, p=np.inf, distance_upper_bound=d)
eps = 1e-8
hits = 0
for near_d, near_i in zip(dd,ii):
if near_d == np.inf:
continue
hits += 1
assert_almost_equal(near_d,self.distance(x,self.data[near_i],np.inf))
assert_(near_d < d+eps, "near_d=%g should be less than %g" % (near_d,d))
assert_equal(np.sum(self.distance(self.data,x,np.inf) < d+eps),hits)
def test_approx(self):
x = self.x
k = self.k
eps = 0.1
d_real, i_real = self.kdtree.query(x, k)
d, i = self.kdtree.query(x, k, eps=eps)
assert_(np.all(d <= d_real*(1+eps)))
class test_random(ConsistencyTests):
def setup_method(self):
self.n = 100
self.m = 4
np.random.seed(1234)
self.data = np.random.randn(self.n, self.m)
self.kdtree = KDTree(self.data,leafsize=2)
self.x = np.random.randn(self.m)
self.d = 0.2
self.k = 10
class test_random_far(test_random):
def setup_method(self):
test_random.setUp(self)
self.x = np.random.randn(self.m)+10
class test_small(ConsistencyTests):
def setup_method(self):
self.data = np.array([[0,0,0],
[0,0,1],
[0,1,0],
[0,1,1],
[1,0,0],
[1,0,1],
[1,1,0],
[1,1,1]])
self.kdtree = KDTree(self.data)
self.n = self.kdtree.n
self.m = self.kdtree.m
np.random.seed(1234)
self.x = np.random.randn(3)
self.d = 0.5
self.k = 4
def test_nearest(self):
assert_array_equal(
self.kdtree.query((0,0,0.1), 1),
(0.1,0))
def test_nearest_two(self):
assert_array_equal(
self.kdtree.query((0,0,0.1), 2),
([0.1,0.9],[0,1]))
class test_small_nonleaf(test_small):
def setup_method(self):
test_small.setUp(self)
self.kdtree = KDTree(self.data,leafsize=1)
class test_small_compiled(test_small):
def setup_method(self):
test_small.setUp(self)
self.kdtree = cKDTree(self.data)
class test_small_nonleaf_compiled(test_small):
def setup_method(self):
test_small.setUp(self)
self.kdtree = cKDTree(self.data,leafsize=1)
class test_random_compiled(test_random):
def setup_method(self):
test_random.setUp(self)
self.kdtree = cKDTree(self.data)
class test_random_far_compiled(test_random_far):
def setup_method(self):
test_random_far.setUp(self)
self.kdtree = cKDTree(self.data)
class test_vectorization:
def setup_method(self):
self.data = np.array([[0,0,0],
[0,0,1],
[0,1,0],
[0,1,1],
[1,0,0],
[1,0,1],
[1,1,0],
[1,1,1]])
self.kdtree = KDTree(self.data)
def test_single_query(self):
d, i = self.kdtree.query(np.array([0,0,0]))
assert_(isinstance(d,float))
assert_(np.issubdtype(i, int))
def test_vectorized_query(self):
d, i = self.kdtree.query(np.zeros((2,4,3)))
assert_equal(np.shape(d),(2,4))
assert_equal(np.shape(i),(2,4))
def test_single_query_multiple_neighbors(self):
s = 23
kk = self.kdtree.n+s
d, i = self.kdtree.query(np.array([0,0,0]),k=kk)
assert_equal(np.shape(d),(kk,))
assert_equal(np.shape(i),(kk,))
assert_(np.all(~np.isfinite(d[-s:])))
assert_(np.all(i[-s:] == self.kdtree.n))
def test_vectorized_query_multiple_neighbors(self):
s = 23
kk = self.kdtree.n+s
d, i = self.kdtree.query(np.zeros((2,4,3)),k=kk)
assert_equal(np.shape(d),(2,4,kk))
assert_equal(np.shape(i),(2,4,kk))
assert_(np.all(~np.isfinite(d[:,:,-s:])))
assert_(np.all(i[:,:,-s:] == self.kdtree.n))
def test_single_query_all_neighbors(self):
d, i = self.kdtree.query([0,0,0],k=None,distance_upper_bound=1.1)
assert_(isinstance(d,list))
assert_(isinstance(i,list))
def test_vectorized_query_all_neighbors(self):
d, i = self.kdtree.query(np.zeros((2,4,3)),k=None,distance_upper_bound=1.1)
assert_equal(np.shape(d),(2,4))
assert_equal(np.shape(i),(2,4))
assert_(isinstance(d[0,0],list))
assert_(isinstance(i[0,0],list))
class test_vectorization_compiled:
def setup_method(self):
self.data = np.array([[0,0,0],
[0,0,1],
[0,1,0],
[0,1,1],
[1,0,0],
[1,0,1],
[1,1,0],
[1,1,1]])
self.kdtree = cKDTree(self.data)
def test_single_query(self):
d, i = self.kdtree.query([0,0,0])
assert_(isinstance(d,float))
assert_(isinstance(i,int))
def test_vectorized_query(self):
d, i = self.kdtree.query(np.zeros((2,4,3)))
assert_equal(np.shape(d),(2,4))
assert_equal(np.shape(i),(2,4))
def test_vectorized_query_noncontiguous_values(self):
np.random.seed(1234)
qs = np.random.randn(3,1000).T
ds, i_s = self.kdtree.query(qs)
for q, d, i in zip(qs,ds,i_s):
assert_equal(self.kdtree.query(q),(d,i))
def test_single_query_multiple_neighbors(self):
s = 23
kk = self.kdtree.n+s
d, i = self.kdtree.query([0,0,0],k=kk)
assert_equal(np.shape(d),(kk,))
assert_equal(np.shape(i),(kk,))
assert_(np.all(~np.isfinite(d[-s:])))
assert_(np.all(i[-s:] == self.kdtree.n))
def test_vectorized_query_multiple_neighbors(self):
s = 23
kk = self.kdtree.n+s
d, i = self.kdtree.query(np.zeros((2,4,3)),k=kk)
assert_equal(np.shape(d),(2,4,kk))
assert_equal(np.shape(i),(2,4,kk))
assert_(np.all(~np.isfinite(d[:,:,-s:])))
assert_(np.all(i[:,:,-s:] == self.kdtree.n))
class ball_consistency:
def distance(self, a, b, p):
return minkowski_distance(a, b, p)
def test_in_ball(self):
l = self.T.query_ball_point(self.x, self.d, p=self.p, eps=self.eps)
for i in l:
assert_(self.distance(self.data[i],self.x,self.p) <= self.d*(1.+self.eps))
def test_found_all(self):
c = np.ones(self.T.n,dtype=bool)
l = self.T.query_ball_point(self.x, self.d, p=self.p, eps=self.eps)
c[l] = False
assert_(np.all(self.distance(self.data[c],self.x,self.p) >= self.d/(1.+self.eps)))
class test_random_ball(ball_consistency):
def setup_method(self):
n = 100
m = 4
np.random.seed(1234)
self.data = np.random.randn(n,m)
self.T = KDTree(self.data,leafsize=2)
self.x = np.random.randn(m)
self.p = 2.
self.eps = 0
self.d = 0.2
class test_random_ball_compiled(ball_consistency):
def setup_method(self):
n = 100
m = 4
np.random.seed(1234)
self.data = np.random.randn(n,m)
self.T = cKDTree(self.data,leafsize=2)
self.x = np.random.randn(m)
self.p = 2.
self.eps = 0
self.d = 0.2
class test_random_ball_compiled_periodic(ball_consistency):
def distance(self, a, b, p):
return distance_box(a, b, p, 1.0)
def setup_method(self):
n = 10000
m = 4
np.random.seed(1234)
self.data = np.random.uniform(size=(n,m))
self.T = cKDTree(self.data,leafsize=2, boxsize=1)
self.x = np.ones(m) * 0.1
self.p = 2.
self.eps = 0
self.d = 0.2
def test_in_ball_outside(self):
l = self.T.query_ball_point(self.x + 1.0, self.d, p=self.p, eps=self.eps)
for i in l:
assert_(self.distance(self.data[i],self.x,self.p) <= self.d*(1.+self.eps))
l = self.T.query_ball_point(self.x - 1.0, self.d, p=self.p, eps=self.eps)
for i in l:
assert_(self.distance(self.data[i],self.x,self.p) <= self.d*(1.+self.eps))
def test_found_all_outside(self):
c = np.ones(self.T.n,dtype=bool)
l = self.T.query_ball_point(self.x + 1.0, self.d, p=self.p, eps=self.eps)
c[l] = False
assert_(np.all(self.distance(self.data[c],self.x,self.p) >= self.d/(1.+self.eps)))
l = self.T.query_ball_point(self.x - 1.0, self.d, p=self.p, eps=self.eps)
c[l] = False
assert_(np.all(self.distance(self.data[c],self.x,self.p) >= self.d/(1.+self.eps)))
class test_random_ball_approx(test_random_ball):
def setup_method(self):
test_random_ball.setUp(self)
self.eps = 0.1
class test_random_ball_approx_compiled(test_random_ball_compiled):
def setup_method(self):
test_random_ball_compiled.setUp(self)
self.eps = 0.1
class test_random_ball_approx_compiled_periodic(test_random_ball_compiled_periodic):
def setup_method(self):
test_random_ball_compiled_periodic.setUp(self)
self.eps = 0.1
class test_random_ball_far(test_random_ball):
def setup_method(self):
test_random_ball.setUp(self)
self.d = 2.
class test_random_ball_far_compiled(test_random_ball_compiled):
def setup_method(self):
test_random_ball_compiled.setUp(self)
self.d = 2.
class test_random_ball_far_compiled_periodic(test_random_ball_compiled_periodic):
def setup_method(self):
test_random_ball_compiled_periodic.setUp(self)
self.d = 2.
class test_random_ball_l1(test_random_ball):
def setup_method(self):
test_random_ball.setUp(self)
self.p = 1
class test_random_ball_l1_compiled(test_random_ball_compiled):
def setup_method(self):
test_random_ball_compiled.setUp(self)
self.p = 1
class test_random_ball_l1_compiled_periodic(test_random_ball_compiled_periodic):
def setup_method(self):
test_random_ball_compiled_periodic.setUp(self)
self.p = 1
class test_random_ball_linf(test_random_ball):
def setup_method(self):
test_random_ball.setUp(self)
self.p = np.inf
class test_random_ball_linf_compiled_periodic(test_random_ball_compiled_periodic):
def setup_method(self):
test_random_ball_compiled_periodic.setUp(self)
self.p = np.inf
def test_random_ball_vectorized():
n = 20
m = 5
T = KDTree(np.random.randn(n,m))
r = T.query_ball_point(np.random.randn(2,3,m),1)
assert_equal(r.shape,(2,3))
assert_(isinstance(r[0,0],list))
def test_random_ball_vectorized_compiled():
n = 20
m = 5
np.random.seed(1234)
T = cKDTree(np.random.randn(n,m))
r = T.query_ball_point(np.random.randn(2,3,m),1)
assert_equal(r.shape,(2,3))
assert_(isinstance(r[0,0],list))
def test_query_ball_point_multithreading():
np.random.seed(0)
n = 5000
k = 2
points = np.random.randn(n,k)
T = cKDTree(points)
l1 = T.query_ball_point(points,0.003,n_jobs=1)
l2 = T.query_ball_point(points,0.003,n_jobs=64)
l3 = T.query_ball_point(points,0.003,n_jobs=-1)
for i in range(n):
if l1[i] or l2[i]:
assert_array_equal(l1[i],l2[i])
for i in range(n):
if l1[i] or l3[i]:
assert_array_equal(l1[i],l3[i])
class two_trees_consistency:
def distance(self, a, b, p):
return minkowski_distance(a, b, p)
def test_all_in_ball(self):
r = self.T1.query_ball_tree(self.T2, self.d, p=self.p, eps=self.eps)
for i, l in enumerate(r):
for j in l:
assert_(self.distance(self.data1[i],self.data2[j],self.p) <= self.d*(1.+self.eps))
def test_found_all(self):
r = self.T1.query_ball_tree(self.T2, self.d, p=self.p, eps=self.eps)
for i, l in enumerate(r):
c = np.ones(self.T2.n,dtype=bool)
c[l] = False
assert_(np.all(self.distance(self.data2[c],self.data1[i],self.p) >= self.d/(1.+self.eps)))
class test_two_random_trees(two_trees_consistency):
def setup_method(self):
n = 50
m = 4
np.random.seed(1234)
self.data1 = np.random.randn(n,m)
self.T1 = KDTree(self.data1,leafsize=2)
self.data2 = np.random.randn(n,m)
self.T2 = KDTree(self.data2,leafsize=2)
self.p = 2.
self.eps = 0
self.d = 0.2
class test_two_random_trees_compiled(two_trees_consistency):
def setup_method(self):
n = 50
m = 4
np.random.seed(1234)
self.data1 = np.random.randn(n,m)
self.T1 = cKDTree(self.data1,leafsize=2)
self.data2 = np.random.randn(n,m)
self.T2 = cKDTree(self.data2,leafsize=2)
self.p = 2.
self.eps = 0
self.d = 0.2
class test_two_random_trees_compiled_periodic(two_trees_consistency):
def distance(self, a, b, p):
return distance_box(a, b, p, 1.0)
def setup_method(self):
n = 50
m = 4
np.random.seed(1234)
self.data1 = np.random.uniform(size=(n,m))
self.T1 = cKDTree(self.data1,leafsize=2, boxsize=1.0)
self.data2 = np.random.uniform(size=(n,m))
self.T2 = cKDTree(self.data2,leafsize=2, boxsize=1.0)
self.p = 2.
self.eps = 0
self.d = 0.2
class test_two_random_trees_far(test_two_random_trees):
def setup_method(self):
test_two_random_trees.setUp(self)
self.d = 2
class test_two_random_trees_far_compiled(test_two_random_trees_compiled):
def setup_method(self):
test_two_random_trees_compiled.setUp(self)
self.d = 2
class test_two_random_trees_far_compiled_periodic(test_two_random_trees_compiled_periodic):
def setup_method(self):
test_two_random_trees_compiled_periodic.setUp(self)
self.d = 2
class test_two_random_trees_linf(test_two_random_trees):
def setup_method(self):
test_two_random_trees.setUp(self)
self.p = np.inf
class test_two_random_trees_linf_compiled(test_two_random_trees_compiled):
def setup_method(self):
test_two_random_trees_compiled.setUp(self)
self.p = np.inf
class test_two_random_trees_linf_compiled_periodic(test_two_random_trees_compiled_periodic):
def setup_method(self):
test_two_random_trees_compiled_periodic.setUp(self)
self.p = np.inf
class test_rectangle:
def setup_method(self):
self.rect = Rectangle([0,0],[1,1])
def test_min_inside(self):
assert_almost_equal(self.rect.min_distance_point([0.5,0.5]),0)
def test_min_one_side(self):
assert_almost_equal(self.rect.min_distance_point([0.5,1.5]),0.5)
def test_min_two_sides(self):
assert_almost_equal(self.rect.min_distance_point([2,2]),np.sqrt(2))
def test_max_inside(self):
assert_almost_equal(self.rect.max_distance_point([0.5,0.5]),1/np.sqrt(2))
def test_max_one_side(self):
assert_almost_equal(self.rect.max_distance_point([0.5,1.5]),np.hypot(0.5,1.5))
def test_max_two_sides(self):
assert_almost_equal(self.rect.max_distance_point([2,2]),2*np.sqrt(2))
def test_split(self):
less, greater = self.rect.split(0,0.1)
assert_array_equal(less.maxes,[0.1,1])
assert_array_equal(less.mins,[0,0])
assert_array_equal(greater.maxes,[1,1])
assert_array_equal(greater.mins,[0.1,0])
def test_distance_l2():
assert_almost_equal(minkowski_distance([0,0],[1,1],2),np.sqrt(2))
def test_distance_l1():
assert_almost_equal(minkowski_distance([0,0],[1,1],1),2)
def test_distance_linf():
assert_almost_equal(minkowski_distance([0,0],[1,1],np.inf),1)
def test_distance_vectorization():
np.random.seed(1234)
x = np.random.randn(10,1,3)
y = np.random.randn(1,7,3)
assert_equal(minkowski_distance(x,y).shape,(10,7))
class count_neighbors_consistency:
def test_one_radius(self):
r = 0.2
assert_equal(self.T1.count_neighbors(self.T2, r),
np.sum([len(l) for l in self.T1.query_ball_tree(self.T2,r)]))
def test_large_radius(self):
r = 1000
assert_equal(self.T1.count_neighbors(self.T2, r),
np.sum([len(l) for l in self.T1.query_ball_tree(self.T2,r)]))
def test_multiple_radius(self):
rs = np.exp(np.linspace(np.log(0.01),np.log(10),3))
results = self.T1.count_neighbors(self.T2, rs)
assert_(np.all(np.diff(results) >= 0))
for r,result in zip(rs, results):
assert_equal(self.T1.count_neighbors(self.T2, r), result)
class test_count_neighbors(count_neighbors_consistency):
def setup_method(self):
n = 50
m = 2
np.random.seed(1234)
self.T1 = KDTree(np.random.randn(n,m),leafsize=2)
self.T2 = KDTree(np.random.randn(n,m),leafsize=2)
class test_count_neighbors_compiled(count_neighbors_consistency):
def setup_method(self):
n = 50
m = 2
np.random.seed(1234)
self.T1 = cKDTree(np.random.randn(n,m),leafsize=2)
self.T2 = cKDTree(np.random.randn(n,m),leafsize=2)
class sparse_distance_matrix_consistency:
def distance(self, a, b, p):
return minkowski_distance(a, b, p)
def test_consistency_with_neighbors(self):
M = self.T1.sparse_distance_matrix(self.T2, self.r)
r = self.T1.query_ball_tree(self.T2, self.r)
for i,l in enumerate(r):
for j in l:
assert_almost_equal(M[i,j],
self.distance(self.T1.data[i], self.T2.data[j], self.p),
decimal=14)
for ((i,j),d) in M.items():
assert_(j in r[i])
def test_zero_distance(self):
# raises an exception for bug 870 (FIXME: Does it?)
self.T1.sparse_distance_matrix(self.T1, self.r)
class test_sparse_distance_matrix(sparse_distance_matrix_consistency):
def setup_method(self):
n = 50
m = 4
np.random.seed(1234)
data1 = np.random.randn(n,m)
data2 = np.random.randn(n,m)
self.T1 = cKDTree(data1,leafsize=2)
self.T2 = cKDTree(data2,leafsize=2)
self.r = 0.5
self.p = 2
self.data1 = data1
self.data2 = data2
self.n = n
self.m = m
class test_sparse_distance_matrix_compiled(sparse_distance_matrix_consistency):
def setup_method(self):
n = 50
m = 4
np.random.seed(0)
data1 = np.random.randn(n,m)
data2 = np.random.randn(n,m)
self.T1 = cKDTree(data1,leafsize=2)
self.T2 = cKDTree(data2,leafsize=2)
self.ref_T1 = KDTree(data1, leafsize=2)
self.ref_T2 = KDTree(data2, leafsize=2)
self.r = 0.5
self.n = n
self.m = m
self.data1 = data1
self.data2 = data2
self.p = 2
def test_consistency_with_python(self):
M1 = self.T1.sparse_distance_matrix(self.T2, self.r)
M2 = self.ref_T1.sparse_distance_matrix(self.ref_T2, self.r)
assert_array_almost_equal(M1.todense(), M2.todense(), decimal=14)
def test_against_logic_error_regression(self):
# regression test for gh-5077 logic error
np.random.seed(0)
too_many = np.array(np.random.randn(18, 2), dtype=int)
tree = cKDTree(too_many, balanced_tree=False, compact_nodes=False)
d = tree.sparse_distance_matrix(tree, 3).todense()
assert_array_almost_equal(d, d.T, decimal=14)
def test_ckdtree_return_types(self):
# brute-force reference
ref = np.zeros((self.n,self.n))
for i in range(self.n):
for j in range(self.n):
v = self.data1[i,:] - self.data2[j,:]
ref[i,j] = np.dot(v,v)
ref = np.sqrt(ref)
ref[ref > self.r] = 0.
# test return type 'dict'
dist = np.zeros((self.n,self.n))
r = self.T1.sparse_distance_matrix(self.T2, self.r, output_type='dict')
for i,j in r.keys():
dist[i,j] = r[(i,j)]
assert_array_almost_equal(ref, dist, decimal=14)
# test return type 'ndarray'
dist = np.zeros((self.n,self.n))
r = self.T1.sparse_distance_matrix(self.T2, self.r,
output_type='ndarray')
for k in range(r.shape[0]):
i = r['i'][k]
j = r['j'][k]
v = r['v'][k]
dist[i,j] = v
assert_array_almost_equal(ref, dist, decimal=14)
# test return type 'dok_matrix'
r = self.T1.sparse_distance_matrix(self.T2, self.r,
output_type='dok_matrix')
assert_array_almost_equal(ref, r.todense(), decimal=14)
# test return type 'coo_matrix'
r = self.T1.sparse_distance_matrix(self.T2, self.r,
output_type='coo_matrix')
assert_array_almost_equal(ref, r.todense(), decimal=14)
def test_distance_matrix():
m = 10
n = 11
k = 4
np.random.seed(1234)
xs = np.random.randn(m,k)
ys = np.random.randn(n,k)
ds = distance_matrix(xs,ys)
assert_equal(ds.shape, (m,n))
for i in range(m):
for j in range(n):
assert_almost_equal(minkowski_distance(xs[i],ys[j]),ds[i,j])
def test_distance_matrix_looping():
m = 10
n = 11
k = 4
np.random.seed(1234)
xs = np.random.randn(m,k)
ys = np.random.randn(n,k)
ds = distance_matrix(xs,ys)
dsl = distance_matrix(xs,ys,threshold=1)
assert_equal(ds,dsl)
def check_onetree_query(T,d):
r = T.query_ball_tree(T, d)
s = set()
for i, l in enumerate(r):
for j in l:
if i < j:
s.add((i,j))
assert_(s == T.query_pairs(d))
def test_onetree_query():
np.random.seed(0)
n = 50
k = 4
points = np.random.randn(n,k)
T = KDTree(points)
yield check_onetree_query, T, 0.1
points = np.random.randn(3*n,k)
points[:n] *= 0.001
points[n:2*n] += 2
T = KDTree(points)
yield check_onetree_query, T, 0.1
yield check_onetree_query, T, 0.001
yield check_onetree_query, T, 0.00001
yield check_onetree_query, T, 1e-6
def test_onetree_query_compiled():
np.random.seed(0)
n = 100
k = 4
points = np.random.randn(n,k)
T = cKDTree(points)
yield check_onetree_query, T, 0.1
points = np.random.randn(3*n,k)
points[:n] *= 0.001
points[n:2*n] += 2
T = cKDTree(points)
yield check_onetree_query, T, 0.1
yield check_onetree_query, T, 0.001
yield check_onetree_query, T, 0.00001
yield check_onetree_query, T, 1e-6
def test_query_pairs_single_node():
tree = KDTree([[0, 1]])
assert_equal(tree.query_pairs(0.5), set())
def test_query_pairs_single_node_compiled():
tree = cKDTree([[0, 1]])
assert_equal(tree.query_pairs(0.5), set())
def test_ckdtree_query_pairs():
np.random.seed(0)
n = 50
k = 2
r = 0.1
r2 = r**2
points = np.random.randn(n,k)
T = cKDTree(points)
# brute force reference
brute = set()
for i in range(n):
for j in range(i+1,n):
v = points[i,:] - points[j,:]
if np.dot(v,v) <= r2:
brute.add((i,j))
l0 = sorted(brute)
# test default return type
s = T.query_pairs(r)
l1 = sorted(s)
assert_array_equal(l0,l1)
# test return type 'set'
s = T.query_pairs(r, output_type='set')
l1 = sorted(s)
assert_array_equal(l0,l1)
# test return type 'ndarray'
s = set()
arr = T.query_pairs(r, output_type='ndarray')
for i in range(arr.shape[0]):
s.add((int(arr[i,0]),int(arr[i,1])))
l2 = sorted(s)
assert_array_equal(l0,l2)
def test_ball_point_ints():
# Regression test for #1373.
x, y = np.mgrid[0:4, 0:4]
points = list(zip(x.ravel(), y.ravel()))
tree = KDTree(points)
assert_equal(sorted([4, 8, 9, 12]),
sorted(tree.query_ball_point((2, 0), 1)))
points = np.asarray(points, dtype=float)
tree = KDTree(points)
assert_equal(sorted([4, 8, 9, 12]),
sorted(tree.query_ball_point((2, 0), 1)))
def test_kdtree_comparisons():
# Regression test: node comparisons were done wrong in 0.12 w/Py3.
nodes = [KDTree.node() for _ in range(3)]
assert_equal(sorted(nodes), sorted(nodes[::-1]))
def test_ckdtree_build_modes():
# check if different build modes for cKDTree give
# similar query results
np.random.seed(0)
n = 5000
k = 4
points = np.random.randn(n, k)
T1 = cKDTree(points).query(points, k=5)[-1]
T2 = cKDTree(points, compact_nodes=False).query(points, k=5)[-1]
T3 = cKDTree(points, balanced_tree=False).query(points, k=5)[-1]
T4 = cKDTree(points, compact_nodes=False, balanced_tree=False).query(points, k=5)[-1]
assert_array_equal(T1, T2)
assert_array_equal(T1, T3)
assert_array_equal(T1, T4)
def test_ckdtree_pickle():
# test if it is possible to pickle
# a cKDTree
try:
import cPickle as pickle
except ImportError:
import pickle
np.random.seed(0)
n = 50
k = 4
points = np.random.randn(n, k)
T1 = cKDTree(points)
tmp = pickle.dumps(T1)
T2 = pickle.loads(tmp)
T1 = T1.query(points, k=5)[-1]
T2 = T2.query(points, k=5)[-1]
assert_array_equal(T1, T2)
def test_ckdtree_pickle_boxsize():
# test if it is possible to pickle a periodic
# cKDTree
try:
import cPickle as pickle
except ImportError:
import pickle
np.random.seed(0)
n = 50
k = 4
points = np.random.uniform(size=(n, k))
T1 = cKDTree(points, boxsize=1.0)
tmp = pickle.dumps(T1)
T2 = pickle.loads(tmp)
T1 = T1.query(points, k=5)[-1]
T2 = T2.query(points, k=5)[-1]
assert_array_equal(T1, T2)
def test_ckdtree_copy_data():
# check if copy_data=True makes the kd-tree
# impervious to data corruption by modification of
# the data arrray
np.random.seed(0)
n = 5000
k = 4
points = np.random.randn(n, k)
T = cKDTree(points, copy_data=True)
q = points.copy()
T1 = T.query(q, k=5)[-1]
points[...] = np.random.randn(n, k)
T2 = T.query(q, k=5)[-1]
assert_array_equal(T1, T2)
def test_ckdtree_parallel():
# check if parallel=True also generates correct
# query results
np.random.seed(0)
n = 5000
k = 4
points = np.random.randn(n, k)
T = cKDTree(points)
T1 = T.query(points, k=5, n_jobs=64)[-1]
T2 = T.query(points, k=5, n_jobs=-1)[-1]
T3 = T.query(points, k=5)[-1]
assert_array_equal(T1, T2)
assert_array_equal(T1, T3)
def test_ckdtree_view():
# Check that the nodes can be correctly viewed from Python.
# This test also sanity checks each node in the cKDTree, and
# thus verifies the internal structure of the kd-tree.
np.random.seed(0)
n = 100
k = 4
points = np.random.randn(n, k)
kdtree = cKDTree(points)
# walk the whole kd-tree and sanity check each node
def recurse_tree(n):
assert_(isinstance(n, cKDTreeNode))
if n.split_dim == -1:
assert_(n.lesser is None)
assert_(n.greater is None)
assert_(n.indices.shape[0] <= kdtree.leafsize)
else:
recurse_tree(n.lesser)
recurse_tree(n.greater)
x = n.lesser.data_points[:, n.split_dim]
y = n.greater.data_points[:, n.split_dim]
assert_(x.max() < y.min())
recurse_tree(kdtree.tree)
# check that indices are correctly retreived
n = kdtree.tree
assert_array_equal(np.sort(n.indices), range(100))
# check that data_points are correctly retreived
assert_array_equal(kdtree.data[n.indices, :], n.data_points)
# cKDTree is specialized to type double points, so no need to make
# a unit test corresponding to test_ball_point_ints()
def test_ckdtree_list_k():
# check ckdtree periodic boundary
n = 200
m = 2
klist = [1, 2, 3]
kint = 3
np.random.seed(1234)
data = np.random.uniform(size=(n, m))
kdtree = cKDTree(data, leafsize=1)
# check agreement between arange(1,k+1) and k
dd, ii = kdtree.query(data, klist)
dd1, ii1 = kdtree.query(data, kint)
assert_equal(dd, dd1)
assert_equal(ii, ii1)
# now check skipping one element
klist = np.array([1, 3])
kint = 3
dd, ii = kdtree.query(data, kint)
dd1, ii1 = kdtree.query(data, klist)
assert_equal(dd1, dd[..., klist - 1])
assert_equal(ii1, ii[..., klist - 1])
# check k == 1 special case
# and k == [1] non-special case
dd, ii = kdtree.query(data, 1)
dd1, ii1 = kdtree.query(data, [1])
assert_equal(len(dd.shape), 1)
assert_equal(len(dd1.shape), 2)
assert_equal(dd, np.ravel(dd1))
assert_equal(ii, np.ravel(ii1))
def test_ckdtree_box():
# check ckdtree periodic boundary
n = 2000
m = 3
k = 3
np.random.seed(1234)
data = np.random.uniform(size=(n, m))
kdtree = cKDTree(data, leafsize=1, boxsize=1.0)
# use the standard python KDTree for the simulated periodic box
kdtree2 = cKDTree(data, leafsize=1)
for p in [1, 2, 3.0, np.inf]:
dd, ii = kdtree.query(data, k, p=p)
dd1, ii1 = kdtree.query(data + 1.0, k, p=p)
assert_almost_equal(dd, dd1)
assert_equal(ii, ii1)
dd1, ii1 = kdtree.query(data - 1.0, k, p=p)
assert_almost_equal(dd, dd1)
assert_equal(ii, ii1)
dd2, ii2 = simulate_periodic_box(kdtree2, data, k, boxsize=1.0, p=p)
assert_almost_equal(dd, dd2)
assert_equal(ii, ii2)
def test_ckdtree_box_0boxsize():
# check ckdtree periodic boundary that mimics non-periodic
n = 2000
m = 2
k = 3
np.random.seed(1234)
data = np.random.uniform(size=(n, m))
kdtree = cKDTree(data, leafsize=1, boxsize=0.0)
# use the standard python KDTree for the simulated periodic box
kdtree2 = cKDTree(data, leafsize=1)
for p in [1, 2, np.inf]:
dd, ii = kdtree.query(data, k, p=p)
dd1, ii1 = kdtree2.query(data, k, p=p)
assert_almost_equal(dd, dd1)
assert_equal(ii, ii1)
def test_ckdtree_box_upper_bounds():
data = np.linspace(0, 2, 10).reshape(-1, 2)
data[:, 1] += 10
assert_raises(ValueError, cKDTree, data, leafsize=1, boxsize=1.0)
assert_raises(ValueError, cKDTree, data, leafsize=1, boxsize=(0.0, 2.0))
# skip a dimension.
cKDTree(data, leafsize=1, boxsize=(2.0, 0.0))
def test_ckdtree_box_lower_bounds():
data = np.linspace(-1, 1, 10)
assert_raises(ValueError, cKDTree, data, leafsize=1, boxsize=1.0)
def simulate_periodic_box(kdtree, data, k, boxsize, p):
dd = []
ii = []
x = np.arange(3 ** data.shape[1])
nn = np.array(np.unravel_index(x, [3] * data.shape[1])).T
nn = nn - 1.0
for n in nn:
image = data + n * 1.0 * boxsize
dd2, ii2 = kdtree.query(image, k, p=p)
dd2 = dd2.reshape(-1, k)
ii2 = ii2.reshape(-1, k)
dd.append(dd2)
ii.append(ii2)
dd = np.concatenate(dd, axis=-1)
ii = np.concatenate(ii, axis=-1)
result = np.empty([len(data), len(nn) * k], dtype=[
('ii', 'i8'),
('dd', 'f8')])
result['ii'][:] = ii
result['dd'][:] = dd
result.sort(order='dd')
return result['dd'][:, :k], result['ii'][:,:k]
def test_ckdtree_memuse():
# unit test adaptation of gh-5630
# NOTE: this will fail when run via valgrind,
# because rss is no longer a reliable memory usage indicator.
try:
import resource
except ImportError:
# resource is not available on Windows with Python 2.6
return
# Make some data
dx, dy = 0.05, 0.05
y, x = np.mgrid[slice(1, 5 + dy, dy),
slice(1, 5 + dx, dx)]
z = np.sin(x)**10 + np.cos(10 + y*x) * np.cos(x)
z_copy = np.empty_like(z)
z_copy[:] = z
# Place FILLVAL in z_copy at random number of random locations
FILLVAL = 99.
mask = np.random.randint(0, z.size, np.random.randint(50) + 5)
z_copy.flat[mask] = FILLVAL
igood = np.vstack(np.where(x != FILLVAL)).T
ibad = np.vstack(np.where(x == FILLVAL)).T
mem_use = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
# burn-in
for i in range(10):
tree = cKDTree(igood)
# count memleaks while constructing and querying cKDTree
num_leaks = 0
for i in range(100):
mem_use = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
tree = cKDTree(igood)
dist, iquery = tree.query(ibad, k=4, p=2)
new_mem_use = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
if new_mem_use > mem_use:
num_leaks += 1
# ideally zero leaks, but errors might accidentally happen
# outside cKDTree
assert_(num_leaks < 10)
def test_ckdtree_weights():
data = np.linspace(0, 1, 4).reshape(-1, 1)
tree1 = cKDTree(data, leafsize=1)
weights = np.ones(len(data), dtype='f4')
nw = tree1._build_weights(weights)
assert_array_equal(nw, [4, 2, 1, 1, 2, 1, 1])
assert_raises(ValueError, tree1._build_weights, weights[:-1])
for i in range(10):
# since weights are uniform, these shall agree:
c1 = tree1.count_neighbors(tree1, np.linspace(0, 10, i))
c2 = tree1.count_neighbors(tree1, np.linspace(0, 10, i),
weights=(weights, weights))
c3 = tree1.count_neighbors(tree1, np.linspace(0, 10, i),
weights=(weights, None))
c4 = tree1.count_neighbors(tree1, np.linspace(0, 10, i),
weights=(None, weights))
c5 = tree1.count_neighbors(tree1, np.linspace(0, 10, i),
weights=weights)
assert_array_equal(c1, c2)
assert_array_equal(c1, c3)
assert_array_equal(c1, c4)
for i in range(len(data)):
# this tests removal of one data point by setting weight to 0
w1 = weights.copy()
w1[i] = 0
data2 = data[w1 != 0]
w2 = weights[w1 != 0]
tree2 = cKDTree(data2)
c1 = tree1.count_neighbors(tree1, np.linspace(0, 10, 100),
weights=(w1, w1))
# "c2 is correct"
c2 = tree2.count_neighbors(tree2, np.linspace(0, 10, 100))
assert_array_equal(c1, c2)
#this asserts for two different trees, singular weights
# crashes
assert_raises(ValueError, tree1.count_neighbors,
tree2, np.linspace(0, 10, 100), weights=w1)
def test_ckdtree_count_neighbous_multiple_r():
n = 2000
m = 2
np.random.seed(1234)
data = np.random.normal(size=(n, m))
kdtree = cKDTree(data, leafsize=1)
r0 = [0, 0.01, 0.01, 0.02, 0.05]
i0 = np.arange(len(r0))
n0 = kdtree.count_neighbors(kdtree, r0)
nnc = kdtree.count_neighbors(kdtree, r0, cumulative=False)
assert_equal(n0, nnc.cumsum())
for i, r in zip(itertools.permutations(i0),
itertools.permutations(r0)):
# permute n0 by i and it shall agree
n = kdtree.count_neighbors(kdtree, r)
assert_array_equal(n, n0[list(i)])
def test_len0_arrays():
# make sure len-0 arrays are handled correctly
# in range queries (gh-5639)
np.random.seed(1234)
X = np.random.rand(10,2)
Y = np.random.rand(10,2)
tree = cKDTree(X)
# query_ball_point (single)
d,i = tree.query([.5, .5], k=1)
z = tree.query_ball_point([.5, .5], 0.1*d)
assert_array_equal(z, [])
# query_ball_point (multiple)
d,i = tree.query(Y, k=1)
mind = d.min()
z = tree.query_ball_point(Y, 0.1*mind)
y = np.empty(shape=(10,), dtype=object)
y.fill([])
assert_array_equal(y, z)
# query_ball_tree
other = cKDTree(Y)
y = tree.query_ball_tree(other, 0.1*mind)
assert_array_equal(10*[[]], y)
# count_neighbors
y = tree.count_neighbors(other, 0.1*mind)
assert_(y == 0)
# sparse_distance_matrix
y = tree.sparse_distance_matrix(other, 0.1*mind, output_type='dok_matrix')
assert_array_equal(y == np.zeros((10,10)), True)
y = tree.sparse_distance_matrix(other, 0.1*mind, output_type='coo_matrix')
assert_array_equal(y == np.zeros((10,10)), True)
y = tree.sparse_distance_matrix(other, 0.1*mind, output_type='dict')
assert_equal(y, {})
y = tree.sparse_distance_matrix(other,0.1*mind, output_type='ndarray')
_dtype = [('i',np.intp), ('j',np.intp), ('v',np.float64)]
res_dtype = np.dtype(_dtype, align=True)
z = np.empty(shape=(0,), dtype=res_dtype)
assert_array_equal(y, z)
# query_pairs
d,i = tree.query(X, k=2)
mind = d[:,-1].min()
y = tree.query_pairs(0.1*mind, output_type='set')
assert_equal(y, set())
y = tree.query_pairs(0.1*mind, output_type='ndarray')
z = np.empty(shape=(0,2), dtype=np.intp)
assert_array_equal(y, z)
def test_ckdtree_duplicated_inputs():
# check ckdtree with duplicated inputs
n = 1024
for m in range(1, 8):
data = np.concatenate([
np.ones((n // 2, m)) * 1,
np.ones((n // 2, m)) * 2], axis=0)
# it shall not divide more than 3 nodes.
# root left (1), and right (2)
kdtree = cKDTree(data, leafsize=1)
assert_equal(kdtree.size, 3)
kdtree = cKDTree(data)
assert_equal(kdtree.size, 3)
# if compact_nodes are disabled, the number
# of nodes is n (per leaf) + (m - 1)* 2 (splits per dimension) + 1
# and the root
kdtree = cKDTree(data, compact_nodes=False, leafsize=1)
assert_equal(kdtree.size, n + m * 2 - 1)
def test_ckdtree_noncumulative_nondecreasing():
# check ckdtree with duplicated inputs
# it shall not divide more than 3 nodes.
# root left (1), and right (2)
kdtree = cKDTree([[0]], leafsize=1)
assert_raises(ValueError, kdtree.count_neighbors,
kdtree, [0.1, 0], cumulative=False)
def test_short_knn():
# The test case is based on github: #6425 by @SteveDoyle2
xyz = np.array([
[0., 0., 0.],
[1.01, 0., 0.],
[0., 1., 0.],
[0., 1.01, 0.],
[1., 0., 0.],
[1., 1., 0.],],
dtype='float64')
ckdt = cKDTree(xyz)
deq, ieq = ckdt.query(xyz, k=4, distance_upper_bound=0.2)
assert_array_almost_equal(deq,
[[0., np.inf, np.inf, np.inf],
[0., 0.01, np.inf, np.inf],
[0., 0.01, np.inf, np.inf],
[0., 0.01, np.inf, np.inf],
[0., 0.01, np.inf, np.inf],
[0., np.inf, np.inf, np.inf]])
|
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2016 Bitergia
#
# This program 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.
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Authors:
# Santiago Dueñas <sduenas@bitergia.com>
# Alvaro del Castillo San Felix <acs@bitergia.com>
#
import logging
import threading
import time
import cherrypy
from grimoirelab_toolkit.datetime import str_to_datetime
from .arthur import Arthur
from .utils import JSONEncoder
logger = logging.getLogger(__name__)
def json_encoder(*args, **kwargs):
"""Custom JSON encoder handler"""
obj = cherrypy.serving.request._json_inner_handler(*args, **kwargs)
for chunk in JSONEncoder().iterencode(obj):
yield chunk.encode('utf-8')
class ArthurServer(Arthur):
"""Arthur REST server"""
def __init__(self, *args, **kwargs):
if 'writer' in kwargs:
writer = kwargs.pop('writer')
super().__init__(*args, **kwargs)
if writer:
self.writer_th = threading.Thread(target=self.write_items,
args=(writer, self.items))
else:
self.writer_th = None
cherrypy.engine.subscribe('start', self.start, 100)
def start(self):
"""Start the server and the writer"""
super().start()
if self.writer_th:
self.writer_th.start()
@classmethod
def write_items(cls, writer, items_generator):
"""Write items to the queue
:param writer: the writer object
:param items_generator: items to be written in the queue
"""
while True:
items = items_generator()
writer.write(items)
time.sleep(1)
@cherrypy.expose
@cherrypy.tools.json_in()
def add(self):
"""Add tasks"""
payload = cherrypy.request.json
logger.debug("Reading tasks...")
for task_data in payload['tasks']:
try:
category = task_data['category']
backend_args = task_data['backend_args']
archive_args = task_data.get('archive', None)
sched_args = task_data.get('scheduler', None)
except KeyError as ex:
logger.error("Task badly formed")
raise ex
from_date = backend_args.get('from_date', None)
if from_date:
backend_args['from_date'] = str_to_datetime(from_date)
super().add_task(task_data['task_id'],
task_data['backend'],
category,
backend_args,
archive_args=archive_args,
sched_args=sched_args)
logger.debug("Done. Ready to work!")
return "Tasks added"
@cherrypy.expose
@cherrypy.tools.json_in()
@cherrypy.tools.json_out(handler=json_encoder)
def remove(self):
"""Remove tasks"""
payload = cherrypy.request.json
logger.debug("Reading tasks to remove...")
task_ids = {}
for task_data in payload['tasks']:
task_id = task_data['task_id']
removed = super().remove_task(task_id)
task_ids[task_id] = removed
result = {'tasks': task_ids}
return result
@cherrypy.expose
@cherrypy.tools.json_out(handler=json_encoder)
def tasks(self):
"""List tasks"""
logger.debug("API 'tasks' method called")
result = [task.to_dict() for task in self._tasks.tasks]
result = {'tasks': result}
logger.debug("Tasks registry read")
return result
|
# Copyright 2021 Google LLC
#
# 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.
#
"""Helper functions to access Chronicle APIs using OAuth 2.0.
Background information:
https://google-auth.readthedocs.io/en/latest/user-guide.html#service-account-private-key-files
https://developers.google.com/identity/protocols/oauth2#serviceaccount
Details about using the Google-auth library with the Requests library:
https://github.com/googleapis/google-auth-library-python/blob/master/google/auth/transport/requests.py
https://requests.readthedocs.io
"""
import argparse
import pathlib
from typing import Optional, Union
from google.auth.transport import requests
from google.oauth2 import service_account
DEFAULT_CREDENTIALS_FILE = pathlib.Path.home() / ".chronicle_credentials.json"
AUTHORIZATION_SCOPES = ["https://www.googleapis.com/auth/chronicle-backstory"]
def initialize_http_session(
credentials_file_path: Optional[Union[str, pathlib.Path]]
) -> requests.AuthorizedSession:
"""Initializes an authorized HTTP session, based on the given credentials.
Args:
credentials_file_path: Absolute or relative path to a JSON file containing
the private OAuth 2.0 credentials of a Google Cloud Platform service
account. Optional - the default is ".chronicle_credentials.json" in the
user's home directory. Keep it secret, keep it safe.
Returns:
HTTP session object to send authorized requests and receive responses.
Raises:
OSError: Failed to read the given file, e.g. not found, no read access
(https://docs.python.org/library/exceptions.html#os-exceptions).
ValueError: Invalid file contents.
"""
if not credentials_file_path:
credentials_file_path = DEFAULT_CREDENTIALS_FILE
credentials = service_account.Credentials.from_service_account_file(
str(credentials_file_path), scopes=AUTHORIZATION_SCOPES)
return requests.AuthorizedSession(credentials)
def add_argument_credentials_file(parser: argparse.ArgumentParser):
"""Adds a shared command-line argument to all the sample modules."""
parser.add_argument(
"-c",
"--credentials_file",
type=str,
help=f"credentials file path (default: '{DEFAULT_CREDENTIALS_FILE}')")
|
from django.http import HttpResponseRedirect
from django.views.generic.edit import CreateView, UpdateView
from django.views.generic.dates import ArchiveIndexView, YearArchiveView, MonthArchiveView, DateDetailView
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.contrib.sites.models import Site
from samklang_blog.models import Entry
from samklang_blog.forms import EntryForm
from datetime import datetime
MONTH_FORMAT = '%m'
class EntryCreateView(CreateView):
model = Entry
form_class = EntryForm
initial = {'pub_date': datetime.now().strftime("%Y-%m-%d %H:%M:%S")}
month_format = MONTH_FORMAT
def form_valid(self, form):
self.object = form.save(commit=False)
self.object.user = self.request.user
if hasattr(self.request, 'site'):
self.object.site = self.request.site
else:
self.object.site = Site.objects.get(pk=1)
self.object.save()
return HttpResponseRedirect(self.object.get_absolute_url())
@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(EntryCreateView, self).dispatch(*args, **kwargs)
class EntryUpdateView(UpdateView):
model = Entry
form_class = EntryForm
month_format = MONTH_FORMAT
#def form_valid(self, form):
# self.object = form.save()
# return HttpResponseRedirect(self.object.get_absolute_url())
@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(EntryUpdateView, self).dispatch(*args, **kwargs)
class EntryArchiveIndexView(ArchiveIndexView):
model = Entry
date_field = 'pub_date'
month_format = MONTH_FORMAT
allow_empty = True
def get_queryset(self):
return Entry.live.all()
class EntryYearArchiveView(YearArchiveView):
model = Entry
date_field = 'pub_date'
month_format = MONTH_FORMAT
allow_empty = True
class EntryMonthArchiveView(MonthArchiveView):
model = Entry
date_field = 'pub_date'
month_format = MONTH_FORMAT
allow_empty = True
class EntryDateDetailView(DateDetailView):
model = Entry
date_field = 'pub_date'
month_format = MONTH_FORMAT
|
# -*- coding: utf-8 -*-
##############################################################################
#
# Tech-Receptives Solutions Pvt. Ltd.
# Copyright (C) 2004-TODAY Tech-Receptives(<http://www.techreceptives.com>)
# Special Credit and Thanks to Thymbra Latinoamericana S.A.
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import fields, orm
class OeMedicalHospitalUnit(orm.Model):
_name = 'oemedical.hospital.unit'
_columns = {
'code': fields.char(size=8, string='Code'),
'institution': fields.many2one(
'res.partner',
string='Institution',
help='Medical Center'),
'name': fields.char(
string='Name',
size=256,
required=True,
help='Name of the unit, eg Neonatal, Intensive Care, ...'),
'extra_info': fields.text(string='Extra Info'),
}
|
# -*- coding: utf-8 -*-
# yavuzhan sahibinden.com Ford Focus webscrap & write to csv
import urllib.parse
import urllib.request
from urllib.request import urlopen as uReq
from bs4 import BeautifulSoup as soup
import re
filename1 = "S_sahibinden.csv"
f = open(filename1, "w") # for write
headers = "year,km,cc,fuel,price\n" # creating header
f.write(headers)
f.close()
''' URL Part '''
url = "https://www.sahibinden.com/ford-focus?sorting=price_asc"
print(url + "\n")
user_agent = 'Chrome/5.0 (Windows NT 6.3; Win64; x64)'
values = {'name' : 'Michael Foord',
'location' : 'Northampton',
'language' : 'Python' }
headers = { 'User-Agent' : user_agent }
data = urllib.parse.urlencode(values)
data = data.encode('ascii')
req = urllib.request.Request(url, data, headers)
uClient = uReq(req)
page_html = uClient.read()
uClient.close()
'''
with urllib.request.urlopen(req) as response:
the_page = response.read()
#print(the_page)
'''
souped_page = soup(page_html, "html.parser") #html parsing
#grabs each product (find sth)
#finAll("TAG NAME", {"LOOK FOR ALL ...(EX: class)ES":"GO THEM START WITH ....(EX:ITEM TITLE)"})
containers = souped_page.findAll("li", {"class" :"cl4"}) #The box includes ford focus sub models
#Lists for saving models and their car size
category_list = list () # which sub model
category_have_list = list() # car size
rounded_category_have_list = list() # page number
# This part includes parsing methods for cathing model names text and car range that having the models
for i in range(int(len(containers)/2)):
parsed_containers = re.split(" ",containers[i].text)
second_parsed_containers = re.split("\(",parsed_containers[1])
third_parsed_containers = re.split("\n",second_parsed_containers[0]) # for which ford docus model
third_parsed_containers_2 = re.split("\)",second_parsed_containers[1]) # for how many car having by the ford focus model
category = third_parsed_containers[0] # ['1.0 GTDi', '1.4', '1.5 TDCi', '1.6', '1.6 SCTi', '1.6 TDCi', '1.6 Ti-VCT', '1.8 TDCi', '2.0', '2.3', '2.5']
category = category.replace(" ", "-",1) # for changing the blanks wtih "-" using in url links
category_list.append(category) # category names adding category_list
category_have = third_parsed_containers_2[0]
category_have = category_have.replace(".", "",1)
category_have_list.append(float(category_have))
# Modifying category's ranges for using in url
for i in range(len(category_have_list)):
divided_category = int(category_have_list[i]/20)
rounded_category_have_list.append(divided_category+1) # sahibinden.com's each page has 20 car.
'''
if divided_category == 0 :
divided_category = divided_category +1 # if rounded page is 0 , this page' s car couldnt catch, so added +1
rounded_category_have_list.append(divided_category) # sahibinden.com's each page has 20 car.
'''
for i in range(len(rounded_category_have_list)):
print("i = ",i)
tam = str(category_list[i]) # car model 1.0 gtdi , 1.5 tdci etc..
for j in range(0,int(rounded_category_have_list[i])):
if j<50: # sahibinden.com shows max 50 page.
print(tam+":" )
print("The page is:", j)
car_url = "https://www.sahibinden.com/ford-focus-"+tam+"?pagingOffset="+str(j*2)+"0&sorting=price_asc"
print(car_url + "\n")
''' URL Part '''
user_agent = 'Chrome/5.0 (Windows NT 6.3; Win64; x64)'
values = {'name' : 'Michael Foord',
'location' : 'Northampton',
'language' : 'Python' }
headers = { 'User-Agent' : user_agent }
data = urllib.parse.urlencode(values)
data = data.encode('ascii')
req = urllib.request.Request(car_url, data, headers)
uClient = uReq(req)
page_html = uClient.read()
uClient.close()
#html parsing
souped_page = soup(page_html, "html.parser")
#grabs each product (find sth)
#finAll("TAG NAME", {"LOOK FOR ALL ...(EX: class)ES":"GO THEM START WITH ....(EX:ITEM TITLE)"})
#the class(box) includes each car's informations
containers = souped_page.findAll("tr", {"class" :"searchResultsItem "})
#the class(box) includes each car's title
# title containerstaki 0,2,4.. Taunus vb ; 1,3,5 2.0 tdi etc
title_containers = souped_page.findAll("td", {"class" :"searchResultsTagAttributeValue"})
#the class(box) includes each car's km, year etc..
# km, year vs cekilecek container s
# when the page has 20 car the containers contains 60 item. For each car -> 0: year , 1: km , 2:color
datas_containers = souped_page.findAll("td", {"class" :"searchResultsAttributeValue"})
#the class(box) includes each car's price
price_containers = souped_page.findAll("td", {"class" :"searchResultsPriceValue"})
price_parsed = re.split(" ",price_containers[0].text)
# creation lists for each car data
title_list = list()
price_list = list()
year_list = list()
km_list = list()
fuel_list = list()
#shift_list = list()
cc_list = list()
#hp_list = list()
# Each page has 20 car
for i in range(len(title_containers)):
# parsing
title_parsed = re.split(" ",title_containers[i].text)
title_parsed_1 = title_parsed[1]
title_split = re.split(" ", title_parsed_1)
title_0 = title_split[0]
# each car's title is appended to title_list
title_1 = title_split[1]
mystring = str(title_parsed_1)
myremove = str(title_split[0])
removed = mystring.replace(myremove,"",1)
title = removed.replace(" ", "",1)
title_list.append(title)
# each car's cc is appended to cc_list
cc = title_0
cc_list.append(cc)
# each car's fuel is appended to fuel_list
fuel_parsed = re.split(" ", title)
if (fuel_parsed[0] == "TDCi"):
fuel_list.append("-1") # if disel -1
else:
fuel_list.append("1") # else gasoil 1
# when the page has 20 car the containers contains 60 item. For each car -> 0: year , 1: km , 2:color
# each car year is appended to year_list , each car km is appended to km_list
for i in range(len(datas_containers)):
# each car year is appended to year_list
if (i%3 == 0):
year_parsed = re.split(" ",datas_containers[i].text)
year = year_parsed[1]
year_list.append(year)
# each car km is appended to km_list
elif (i%3==1):
km_parsed = re.split(" ",datas_containers[i].text)
km = km_parsed[1]
km_list.append(km)
# each car's price is appended to price_list
for i in range(len(price_containers)):
price_parsed = re.split(" ",price_containers[i].text)
price = price_parsed[1]
price_list.append(price)
# append each page to file
for i in range(len(containers)):
f = open(filename1, "a")
f.write(year_list[i] + "," + km_list[i] + "," + cc_list[i]+ "," + fuel_list[i] + "," + price_list[i] + "\n" )
f.close()
#print(price_list,year_list,km_list,cc_list,fuel_list)
#print("\n")
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
import os
import shutil
from makerUpdateSandboxedProjects import UpdateSandboxedProjects as theUpdater
import makerUpdateSandboxedProjects
import sys
from makerUtilities import writeDataToFile, readDataFromFile
import wx
class MakerTest(unittest.TestCase):
def tearMeDown(self):
if os.path.isdir(self.targetDir):
shutil.rmtree(self.targetDir, ignore_errors = True)
def setMeUp(self):
self.user_home = "/Users/maker/"
testProjects = os.path.join(os.getcwd(),"_Testing_")
self.tool = theUpdater()
self.targetDir = self.tool.getConversionTargetDir()
self.sandbox = self.tool.getApplicationSupportDir()
self.oldProjectsDir = os.path.join(self.sandbox, "makerProjects")
self.UIData = {'SplitterSashPosition': 200,
'editorStyle': 'Github',
'sessionFiles': [[u'index_en', '.content', u'Test.makerProject', 0, 'False'],
[u'bootstrap-alert', '.js', u'Test.makerProject', 0, 'False'],
[u'bootstrap-collapse', '.js', u'Test.makerProject', 97, 'True']],
'linkedProjects': [u'/Users/maker/Desktop/Test.makerProject'],
'Position': wx.Point(120, 36), 'Size': wx.Size(1200, 796)}
if os.path.isdir(self.sandbox):
shutil.rmtree(self.sandbox, ignore_errors = True)
shutil.copytree(testProjects, self.oldProjectsDir)
writeDataToFile(self.UIData, os.path.join(self.sandbox,".makerUISettings"))
def test_getCorrectTargetDir(self):
self.setMeUp()
self.assertTrue(self.targetDir.endswith(makerUpdateSandboxedProjects.TARGET_NAME), "Target dir set correct")
self.tearMeDown()
def test_ifNoMakerProjectsDirInSandboxDoNothing(self):
self.setMeUp()
if os.path.isdir(self.oldProjectsDir):
shutil.rmtree(self.oldProjectsDir)
self.tool.update()
self.assertFalse(os.path.isdir(self.targetDir), "There should be no target dir")
self.tearMeDown()
def test_ifNoProjectsInSandboxDoNothing(self):
self.setMeUp()
if os.path.isdir(self.oldProjectsDir):
shutil.rmtree(self.oldProjectsDir)
print "creating empty projects dir"
os.mkdir(os.path.join(self.sandbox, "makerProjects"))
self.assertTrue(os.path.isdir(os.path.join(self.sandbox, "makerProjects")), "Project dir is there...")
self.assertEqual(os.listdir(self.oldProjectsDir), [], "It is empty...")
self.tool.update()
self.assertFalse(os.path.isdir(self.targetDir), "There should be no target dir")
self.tearMeDown()
def test_existingProjectsWillBeConverted(self):
def isProject(project):
if os.path.isdir(os.path.join(project, "parts")):
return True
else:
return False
def getProjectsInSandbox():
projects = []
for item in os.listdir(self.oldProjectsDir):
if not item.startswith(".") and isProject(os.path.join(self.oldProjectsDir, item)):
projects.append(item)
return projects
self.setMeUp()
self.assertNotEqual(os.listdir(self.oldProjectsDir), [], "It is empty...")
print "creating JUNK project..."
junk = "IamNotAProject"
spam = os.path.join(self.oldProjectsDir, junk)
os.mkdir(spam)
self.assertTrue(os.path.isdir(spam), "Junk project is there...")
oldProjects = getProjectsInSandbox()
self.assertTrue("TestProjectOne" in oldProjects, "Old project in list")
self.tool.update()
self.assertTrue(os.path.isdir(self.targetDir), "There should be no target dir")
self.assertFalse(os.path.isdir(self.oldProjectsDir), "There should be no old project dir")
fileInTarget = os.listdir(self.targetDir)
for item in oldProjects:
self.assertTrue(item + ".makerProject" in fileInTarget, "project has been converted and copied")
self.assertFalse(junk + ".makerProject" in fileInTarget, "JUNK project has NOT been converted and copied")
self.tearMeDown()
if __name__=="__main__":
unittest.main()
|
## ###
# IP: GHIDRA
#
# 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 os
import shutil
import subprocess
import sys
import pwd
import grp
import re
class BuildUtil(object):
def __init__(self):
self.log = False
self.name = False
self.num_errors = 0
self.num_warnings = 0
def run(self, cmd, stdout=False, stderr=False, verbose=True):
if isinstance(cmd, basestring):
if stdout and stderr:
cmd += ' 1>%s 2>%s' % (stdout, stderr)
elif stdout and not stderr:
cmd += ' 1>%s 2>&1' % (stdout)
elif not stdout and stderr:
cmd += ' 2>%s' % (stderr)
if verbose: self.log_info(cmd)
os.system(cmd)
else:
str = ' '.join(cmd);
if stdout:
f = file(stdout, 'w+')
str += ' 1>%s 2>&1' % (stdout)
else:
f = subprocess.PIPE
if verbose: self.log_info(str)
try:
sp = subprocess.Popen(cmd, stdout=f, stderr=subprocess.PIPE)
except OSError as e:
self.log_err("Command: " + str)
self.log_err(e.message)
return 0,e.message#raise
if stdout: f.close()
out, err = sp.communicate()
# print 'run returned %d bytes stdout and %d bytes stderr' % (len(out) if out else 0, len(err) if err else 0)
return out, err
def isdir(self, dname):
return os.path.isdir(dname)
def getcwd(self):
return os.getcwd()
def basename(self, fname):
return os.path.basename(fname)
def dirname(self, fname):
return os.path.dirname(fname)
def getmtime(self, fname):
return os.path.getmtime(fname)
def isfile(self, fname):
return os.path.isfile(fname)
def getenv(self, var, dflt):
return os.getenv(var, dflt)
def pw_name(self, fname):
return pwd.getpwuid(os.stat(fname).st_uid).pw_name
def gr_name(self, fname):
return grp.getgrgid(os.stat(fname).st_gid).gr_name
def isatty(self):
return os.isatty(sys.stdin.fileno())
def is_readable_file(self, fname):
if not self.isfile(fname):
self.log_warn('%s does not exist' % fname)
return False
if os.stat(fname).st_size == 0:
self.log_warn('%s is empty' % fname)
return False
if os.access(fname, os.R_OK) == 0:
self.log_warn('%s is not readable' % fname)
return False
return True
def is_executable_file(self, fname):
if not self.is_readable_file(fname): return False
if os.access(fname, os.X_OK) == 0:
self.log_warn('%s is not executable' % fname)
return False
return True
# export a file to a directory
def export_file(self, fname, dname,):
try:
if not os.path.isdir(dname):
self.makedirs(dname)
if os.path.isfile(fname):
self.copy(fname, dname, verbose=True)
elif os.path.isdir(fname):
self.copy(fname, dname, dir=True, verbose=True)
except IOError as e:
self.log_err('Error occurred exporting %s to %s' % (fname, dname))
self.log_err("Unexpected error: %s" % str(e))
def rmtree(self, dir, verbose=True):
if verbose: self.log_info('rm -r %s' % dir)
shutil.rmtree(dir)
def makedirs(self, dir, verbose=True):
if verbose: self.log_info('mkdir -p %s' % dir)
try: os.makedirs(dir)
except: pass
# copy a file to a directory
def copy(self, fname, dname, verbose=True, dir=False):
if not dir:
if verbose: self.log_info('cp -av %s %s' % (fname, dname))
shutil.copy(fname, dname)
else:
if verbose: self.log_info('cp -avr %s %s' % (fname, dname))
if os.path.exists(dname):
shutil.rmtree(dname)
shutil.copytree(fname, dname)
def chdir(self, dir, verbose=True):
if verbose: self.log_info('cd %s' % dir)
os.chdir(dir)
def remove(self, fname, verbose=True):
if verbose: self.log_info('rm -f %s' % fname)
try: os.remove(fname)
except: pass
def environment(self, var, val, verbose=True):
if verbose: self.log_info('%s=%s' % (var, val))
os.environ[var] = val
def unlink(self, targ, verbose=True):
if verbose: self.log_info('unlink %s' % targ)
os.unlink(targ)
def symlink(self, src, targ, verbose=True):
if verbose: self.log_info('ln -s %s %s' % (src, targ))
if os.path.islink(targ):
os.unlink(targ)
os.symlink(src, targ)
def build_dir(self, root, kind, what):
return root + "/" + re.sub(r'[^a-zA-Z0-9_-]+', '_', 'build-%s-%s' % (kind, what))
def log_prefix(self, kind, what):
return kind.upper() + ' ' + what
def open_log(self, root, kind, what, chdir=False):
build_dir = self.build_dir(root, kind, what)
# Get the name of the log file
logFile = '%s/log.txt' % build_dir
self.log_info('%s LOGFILE %s' % (self.log_prefix(kind, what), logFile))
try: self.rmtree(build_dir, verbose=False)
except: pass
self.makedirs(build_dir, verbose=False)
self.log_open(logFile)
if chdir: self.chdir(build_dir)
def log_open(self, name):
if self.log: self.log_close()
self.log = open(name, 'w')
self.name = name
def log_close(self):
if self.log:
if self.num_errors > 0:
print '# ERROR: There were errors, see %s' % self.name
elif self.num_warnings > 0:
print '# WARNING: There were warnings, see %s' % self.name
self.log.close()
self.log = False
self.name = False
self.num_errors = 0
self.num_warnings = 0
def log_pr(self, prefix, what):
if isinstance(what, basestring):
log_string = prefix + what
else:
log_string = prefix + repr(what)
if self.log:
self.log.write(log_string + '\n')
self.log.flush()
else:
print log_string
sys.stdout.flush()
def log_err(self, what):
self.log_pr('# ERROR: ', what)
self.num_errors += 1
def log_warn(self, what):
self.log_pr('# WARNING: ', what)
self.num_warnings += 1
def log_info(self, what):
self.log_pr('# INFO: ', what)
# create a file with size, type, and symbol info
# the function is here because it is useful and has no dependencies
def mkinfo(self, fname):
ifdefs = { 'i8':'HAS_LONGLONG', 'u8':'HAS_LONGLONG', 'f4':'HAS_FLOAT', 'f8':'HAS_DOUBLE' }
sizes = [
'char', 'signed char', 'unsigned char',
'short', 'signed short', 'unsigned short',
'int', 'signed int', 'unsigned int',
'long', 'signed long', 'unsigned long',
'long long', 'signed long long', 'unsigned long long',
'float', 'double', 'float', 'long double',
'i1', 'i2', 'i4', 'u1', 'u2', 'u4', 'i8', 'u8', 'f4', 'f8']
syms = [
'__AVR32__', '__AVR_ARCH__', 'dsPIC30', '__GNUC__', '__has_feature', 'INT4_IS_LONG',
'__INT64_TYPE__', '__INT8_TYPE__', '__llvm__', '_M_ARM_FP', '__MSP430__', '_MSV_VER',
'__SDCC', '__SIZEOF_DOUBLE__', '__SIZEOF_FLOAT__', '__SIZEOF_SIZE_T__', '__TI_COMPILER_VERSION__',
'__INT8_TYPE__', '__INT16_TYPE__', '__INT32_TYPE__', '__INT64_TYPE__', '__UINT8_TYPE__',
'__UINT16_TYPE__', '__UINT32_TYPE__', '__UINT64_TYPE__', 'HAS_FLOAT', 'HAS_DOUBLE',
'HAS_LONGLONG', 'HAS_FLOAT_OVERRIDE', 'HAS_DOUBLE_OVERRIDE', 'HAS_LONGLONG_OVERRIDE']
typedefs = { 'i1':1, 'i2':2, 'i4':4, 'u1':1, 'u2':2, 'u4':4, 'i8':8, 'u8':8, 'f4':4, 'f8':8 }
f = open(fname, 'w')
f.write('#include "types.h"\n\n')
i = 0
for s in sizes:
i += 1
d = 'INFO sizeof(%s) = ' % s
x = list(d)
x = "', '".join(x)
x = "'%s', '0'+sizeof(%s), '\\n'" % (x, s)
l = 'char size_info_%d[] = {%s};\n' % (i, x)
if s in ifdefs: f.write('#ifdef %s\n' % ifdefs[s])
f.write(l)
if s in ifdefs: f.write('#endif\n')
for s in typedefs:
if s in ifdefs: f.write('#ifdef %s\n' % ifdefs[s])
f.write('_Static_assert(sizeof(%s) == %d, "INFO %s should have size %d, is not correct\\n");\n' % (s, typedefs[s], s, typedefs[s]))
if s in ifdefs: f.write('#endif\n')
for s in syms:
i += 1
f.write('#ifdef %s\n' % s)
f.write('char sym_info_%d[] = "INFO %s is defined\\n\";\n' % (i, s))
f.write('#else\n')
f.write('char sym_info_%d[] = "INFO %s is not defined\\n\";\n' % (i, s))
f.write('#endif\n')
f.close()
class Config(object):
def __init__(self, *obj):
for o in obj:
if isinstance(o, dict): self.__dict__.update(o)
else: self.__dict__.update(o.__dict__)
def format(self, val):
if isinstance(val, basestring) and '%' in val:
return val % self.__dict__
elif isinstance(val, dict):
return dict(map(lambda (k,v): (k,self.format(v)), val.iteritems()))
else: return val
def __getattr__(self, attr):
return ''
def expand(self):
for k,v in self.__dict__.iteritems():
self.__dict__[k] = self.format(v)
def dump(self):
ret = ''
for k,v in sorted(self.__dict__.iteritems()):
if isinstance(v, basestring): vv = "'" + v + "'"
else: vv = str(v)
ret += ' '.ljust(10) + k.ljust(20) + vv + '\n'
return ret
|
"""This module provides the DiscreteTimeDomainExpression class to
represent discrete-time expressions.
Copyright 2020--2021 Michael Hayes, UCECE
"""
from __future__ import division
from .domains import DiscreteTimeDomain
from .sequence import Sequence
from .functions import exp
from .sym import j, oo, pi, fsym, oo
from .dsym import nsym, ksym, zsym, dt
from .ztransform import ztransform
from .dft import DFT
from .seqexpr import SequenceExpression
from .nseq import DiscreteTimeDomainSequence, nseq
from sympy import Sum, summation, limit, DiracDelta
__all__ = ('nexpr', )
class DiscreteTimeDomainExpression(DiscreteTimeDomain, SequenceExpression):
"""Discrete-time expression or symbol."""
var = nsym
seqcls = DiscreteTimeDomainSequence
def __init__(self, val, **assumptions):
check = assumptions.pop('check', True)
if 'integer' not in assumptions:
assumptions['real'] = True
super(DiscreteTimeDomainExpression, self).__init__(val, **assumptions)
expr = self.expr
if check and expr.has(zsym) and not expr.has(Sum):
raise ValueError(
'n-domain expression %s cannot depend on z' % expr)
if check and expr.has(ksym) and not expr.has(Sum):
raise ValueError(
'n-domain expression %s cannot depend on k' % expr)
def _mul_compatible_domains(self, x):
if self.domain == x.domain:
return True
return x.is_constant_domain
def _div_compatible_domains(self, x):
if self.domain == x.domain:
return True
return x.is_constant_domain
def as_expr(self):
return DiscreteTimeDomainExpression(self)
def differentiate(self):
"""First order difference."""
result = (self.expr - self.subs(n - 1).expr) / dt
return self.__class__(result, **self.assumptions)
def integrate(self):
"""First order integration."""
from .sym import symsymbol
from .utils import factor_const
from .extrafunctions import UnitImpulse
from .functions import u
# TODO, get SymPy to optimize this case.
expr = self.expr
const, expr = factor_const(expr, nsym)
if expr.is_Function and expr.func == UnitImpulse:
return dt * u(expr.args[0]) * const
msym = symsymbol('m', integer=True)
result = dt * summation(self.subs(msym).expr, (msym, -oo, nsym))
return self.__class__(result, **self.assumptions)
def ztransform(self, evaluate=True, **assumptions):
"""Determine one-sided z-transform."""
assumptions = self.assumptions.merge_and_infer(self, **assumptions)
result = ztransform(self.expr, self.var, zsym, evaluate)
return self.change(result, domain='Z', **assumptions)
def ZT(self, **assumptions):
return self.ztransform(**assumptions)
def plot(self, ni=None, **kwargs):
"""Plot the sequence. If `ni` is not specified, it defaults to the
range (-20, 20). `ni` can be a vector of specified sequence
indices, a tuple specifing the range, or a constant specifying
the maximum value with the minimum value set to 0.
kwargs include:
axes - the plot axes to use otherwise a new figure is created
xlabel - the x-axis label
ylabel - the y-axis label
xscale - the x-axis scaling, say for plotting as ms
yscale - the y-axis scaling, say for plotting mV
in addition to those supported by the matplotlib plot command.
The plot axes are returned.
"""
if ni is None:
ni = (-20, 20)
from .plot import plot_sequence
return plot_sequence(self, ni, **kwargs)
def initial_value(self):
"""Determine value at n = 0."""
return self.subs(0)
def final_value(self):
"""Determine value at n = oo."""
return self.__class__(limit(self.expr, self.var, oo))
def DFT(self, N=None, evaluate=True):
if N is None:
from .sym import symsymbol
N = symsymbol('N', integer=True, positive=True)
result = DFT(self.expr, nsym, ksym, N, evaluate=evaluate)
return self.change(result, domain='discrete fourier')
def delay(self,m):
"""Delay signal by m samples."""
return self.subs(n - m)
def extent(self, n1=-100, n2=100):
"""Determine extent of the signal.
For example, nexpr([1, 1]).extent() = 2
nexpr([1, 0, 1]).extent() = 3
nexpr([0, 1, 0, 1]).extent() = 3
This performs a search between n=n1 and n=n2."""
return self.seq((n1, n2)).extent()
def discrete_time_fourier_transform(self, var=None,
images=oo, **assumptions):
"""Convert to Fourier domain using discrete time Fourier transform.
Use `images = 0` to avoid the infinite number of spectral images.
"""
return self.DTFT(var, images, **assumptions)
def DTFT(self, var=None, images=oo, **assumptions):
"""Convert to Fourier domain using discrete time Fourier transform.
By default this returns the DTFT in terms of `f`. Use
`.DTFT(w)` to get the angular frequency form, `.DTFT(F)` to
get the normalised frequency form, or `.DTFT(W)` to get the
normalised angular frequency form.
Use `images = 0` to avoid the infinite number of spectral images.
"""
from .extrafunctions import UnitStep
from .symbols import f, omega, Omega, F
from .fexpr import fexpr
from .dtft import DTFT
if var is None:
var = f
if id(var) not in (id(f), id(F), id(omega), id(Omega)):
raise ValueError('DTFT requires var to be f, F, omega, or Omega`, not %s' % var)
dtft = DTFT(self.expr, self.var, fsym, images=images)
result = fexpr(dtft)(var)
result = result.simplify_dirac_delta()
result = result.simplify_heaviside()
result = result.simplify_rect()
# There is a bug in SymPy when simplifying Sum('X(n - m)', (m, -oo, oo))
# result = result.simplify()
result = result.cancel_terms()
return result
def norm_angular_fourier(self, **assumptions):
from .normomegaexpr import Omega
return self.DTFT()(Omega)
def difference_equation(self, inputsym='x', outputsym='y', form='iir'):
"""Create difference equation from impulse response.
`form` can be 'fir' or 'iir' ('direct form I').
"""
H = self.ZT()
return H.difference_equation(inputsym, outputsym, form)
def remove_condition(self):
"""Remove the piecewise condition from the expression."""
if not self.is_conditional:
return self
expr = self.expr
expr = expr.args[0].args[0]
return self.__class__(expr)
def nexpr(arg, **assumptions):
"""Create nExpr object. If `arg` is nsym return n"""
from .expr import Expr
from .seq import seq
if arg is nsym:
return n
if isinstance(arg, Expr):
if assumptions == {}:
return arg
return arg.__class__(arg, **assumptions)
if isinstance(arg, str) and arg.startswith('{'):
return nseq(arg)
from numpy import ndarray
if isinstance(arg, (list, ndarray)):
return DiscreteTimeDomainSequence(arg, var=n).as_impulses()
return DiscreteTimeDomainExpression(arg, **assumptions)
from .expressionclasses import expressionclasses
expressionclasses.register('discrete time', DiscreteTimeDomainExpression)
n = DiscreteTimeDomainExpression('n', integer=True)
|
#!/usr/bin/env python
"""This module contains tests for flows-related API renderers."""
from grr.gui import api_test_lib
from grr.gui.api_plugins import flow as flow_plugin
from grr.lib import aff4
from grr.lib import flags
from grr.lib import flow
from grr.lib import flow_runner
from grr.lib import output_plugin
from grr.lib import test_lib
from grr.lib import throttle
from grr.lib import type_info
from grr.lib import utils
from grr.lib.flows.general import file_finder
from grr.lib.flows.general import processes
from grr.lib.flows.general import transfer
from grr.lib.output_plugins import email_plugin
from grr.lib.rdfvalues import client as rdf_client
from grr.lib.rdfvalues import paths as rdf_paths
class ApiFlowStatusRendererTest(test_lib.GRRBaseTest):
"""Test for ApiFlowStatusRenderer."""
def setUp(self):
super(ApiFlowStatusRendererTest, self).setUp()
self.client_id = self.SetupClients(1)[0]
self.renderer = flow_plugin.ApiFlowStatusRenderer()
def testIsDisabledByDefault(self):
self.assertFalse(self.renderer.enabled_by_default)
def testParameterValidation(self):
"""Check bad parameters are rejected.
Make sure our input is validated because this API doesn't require
authorization.
"""
bad_flowid = flow_plugin.ApiFlowStatusRendererArgs(
client_id=self.client_id.Basename(), flow_id="X:<script>")
with self.assertRaises(ValueError):
self.renderer.Render(bad_flowid, token=self.token)
with self.assertRaises(type_info.TypeValueError):
flow_plugin.ApiFlowStatusRendererArgs(
client_id="C.123456<script>", flow_id="X:1245678")
class ApiFlowStatusRendererRegressionTest(
api_test_lib.ApiCallRendererRegressionTest):
"""Test flow status renderer.
This renderer is disabled by default in the ACLs so we need to do some
patching to get the proper output and not just "access denied".
"""
renderer = "ApiFlowStatusRenderer"
def Run(self):
# Fix the time to avoid regressions.
with test_lib.FakeTime(42):
client_urn = self.SetupClients(1)[0]
# Delete the certificates as it's being regenerated every time the
# client is created.
with aff4.FACTORY.Open(client_urn, mode="rw",
token=self.token) as client_obj:
client_obj.DeleteAttribute(client_obj.Schema.CERT)
flow_id = flow.GRRFlow.StartFlow(flow_name="Interrogate",
client_id=client_urn, token=self.token)
# Put something in the output collection
flow_obj = aff4.FACTORY.Open(flow_id, aff4_type="GRRFlow",
token=self.token)
flow_state = flow_obj.Get(flow_obj.Schema.FLOW_STATE)
with aff4.FACTORY.Create(
flow_state.context.output_urn,
aff4_type="RDFValueCollection", token=self.token) as collection:
collection.Add(rdf_client.ClientSummary())
self.Check("GET", "/api/flows/%s/%s/status" % (client_urn.Basename(),
flow_id.Basename()),
replace={flow_id.Basename(): "F:ABCDEF12"})
class ApiFlowResultsRendererRegressionTest(
api_test_lib.ApiCallRendererRegressionTest):
"""Regression test for ApiFlowResultsRenderer."""
renderer = "ApiFlowResultsRenderer"
def setUp(self):
super(ApiFlowResultsRendererRegressionTest, self).setUp()
self.client_id = self.SetupClients(1)[0]
def Run(self):
runner_args = flow_runner.FlowRunnerArgs(flow_name="GetFile")
flow_args = transfer.GetFileArgs(
pathspec=rdf_paths.PathSpec(
path="/tmp/evil.txt",
pathtype=rdf_paths.PathSpec.PathType.OS))
client_mock = test_lib.SampleHuntMock()
with test_lib.FakeTime(42):
flow_urn = flow.GRRFlow.StartFlow(client_id=self.client_id,
args=flow_args,
runner_args=runner_args,
token=self.token)
for _ in test_lib.TestFlowHelper(flow_urn, client_mock=client_mock,
client_id=self.client_id,
token=self.token):
pass
self.Check("GET",
"/api/clients/%s/flows/%s/results" % (self.client_id.Basename(),
flow_urn.Basename()),
replace={flow_urn.Basename(): "W:ABCDEF"})
class ApiFlowOutputPluginsRendererRegressionTest(
api_test_lib.ApiCallRendererRegressionTest):
"""Regression test for ApiFlowOutputPluginsRenderer."""
renderer = "ApiFlowOutputPluginsRenderer"
def setUp(self):
super(ApiFlowOutputPluginsRendererRegressionTest, self).setUp()
self.client_id = self.SetupClients(1)[0]
def Run(self):
email_descriptor = output_plugin.OutputPluginDescriptor(
plugin_name="EmailOutputPlugin",
plugin_args=email_plugin.EmailOutputPluginArgs(
email_address="test@localhost", emails_limit=42))
with test_lib.FakeTime(42):
flow_urn = flow.GRRFlow.StartFlow(flow_name="ListProcesses",
client_id=self.client_id,
output_plugins=[email_descriptor],
token=self.token)
self.Check("GET", "/api/clients/%s/flows/%s/output-plugins" % (
self.client_id.Basename(), flow_urn.Basename()),
replace={flow_urn.Basename(): "W:ABCDEF"})
class ApiStartFlowRendererRegressionTest(
api_test_lib.ApiCallRendererRegressionTest):
"""Regression test for ApiStartFlowRenderer."""
renderer = "ApiStartFlowRenderer"
def setUp(self):
super(ApiStartFlowRendererRegressionTest, self).setUp()
self.client_id = self.SetupClients(1)[0]
def Run(self):
def ReplaceFlowId():
flows_dir_fd = aff4.FACTORY.Open(self.client_id.Add("flows"),
token=self.token)
flow_urn = list(flows_dir_fd.ListChildren())[0]
return {flow_urn.Basename(): "W:ABCDEF"}
with test_lib.FakeTime(42):
self.Check("POST",
"/api/clients/%s/flows/start" % self.client_id.Basename(),
{"runner_args": {
"flow_name": "ListProcesses",
"output_plugins": [],
"priority": "HIGH_PRIORITY",
"notify_to_user": False,
},
"flow_args": {
"filename_regex": ".",
"fetch_binaries": True
}
}, replace=ReplaceFlowId)
class ApiFlowDescriptorsListRendererRegressionTest(
api_test_lib.ApiCallRendererRegressionTest):
"""Regression test for ApiFlowDescriptorsListRenderer."""
renderer = "ApiFlowDescriptorsListRenderer"
def Run(self):
with utils.Stubber(flow.GRRFlow, "classes", {
"ListProcesses": processes.ListProcesses,
"FileFinder": file_finder.FileFinder
}):
self.Check("GET", "/api/flows/descriptors")
class ApiRemoteGetFileRendererRegressionTest(
api_test_lib.ApiCallRendererRegressionTest):
renderer = "ApiRemoteGetFileRenderer"
def setUp(self):
super(ApiRemoteGetFileRendererRegressionTest, self).setUp()
self.client_id = self.SetupClients(1)[0]
def Run(self):
def ReplaceFlowId():
flows_dir_fd = aff4.FACTORY.Open(self.client_id.Add("flows"),
token=self.token)
flow_urn = list(flows_dir_fd.ListChildren())[0]
return {flow_urn.Basename(): "W:ABCDEF"}
with test_lib.FakeTime(42):
self.Check(
"POST",
"/api/clients/%s/flows/remotegetfile" % self.client_id.Basename(),
{"hostname": self.client_id.Basename(),
"paths": ["/tmp/test"]},
replace=ReplaceFlowId)
class ApiRemoteGetFileRendererTest(test_lib.GRRBaseTest):
"""Test for ApiRemoteGetFileRenderer."""
def setUp(self):
super(ApiRemoteGetFileRendererTest, self).setUp()
self.client_ids = self.SetupClients(4)
self.renderer = flow_plugin.ApiRemoteGetFileRenderer()
def testClientLookup(self):
"""When multiple clients match, check we run on the latest one."""
args = flow_plugin.ApiRemoteGetFileRendererArgs(
hostname="Host", paths=["/test"])
result = self.renderer.Render(args, token=self.token)
self.assertIn("C.1000000000000003", result["status_url"])
def testThrottle(self):
"""Calling the same flow should raise."""
args = flow_plugin.ApiRemoteGetFileRendererArgs(
hostname="Host", paths=["/test"])
result = self.renderer.Render(args, token=self.token)
self.assertIn("C.1000000000000003", result["status_url"])
with self.assertRaises(throttle.ErrorFlowDuplicate):
self.renderer.Render(args, token=self.token)
def main(argv):
test_lib.main(argv)
if __name__ == "__main__":
flags.StartMain(main)
|
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
import enumfields
from django import forms
from django.apps import apps
from django.core.exceptions import ObjectDoesNotExist
from django.utils.text import camel_case_to_spaces
from django.utils.translation import ugettext_lazy as _
class Type(object):
name = None
identifier = None
def get_field(self, **kwargs):
"""
Get a Django form field for this type.
The kwargs are passed directly to the field
constructor.
:param kwargs: Kwargs for field constructor
:type kwargs: dict
:return: Form field
:rtype: django.forms.Field
"""
return forms.CharField(**kwargs)
def unserialize(self, value):
return self.get_field().to_python(value)
def validate(self, value):
return self.get_field().validate(value)
def is_coercible_from(self, other_type):
return self.identifier == other_type.identifier
class _String(Type):
pass
class _Number(Type):
pass
class Boolean(Type):
name = _("Boolean")
identifier = "boolean"
class Integer(_Number):
name = _("Integer Number")
identifier = "integer"
def get_field(self, **kwargs):
return forms.IntegerField(**kwargs)
class Decimal(_Number):
name = _("Decimal Number")
identifier = "decimal"
def get_field(self, **kwargs):
return forms.DecimalField(**kwargs)
class Text(_String):
name = _("Text")
identifier = "text"
def is_coercible_from(self, other_type):
# All variables can be used as raw text
return True
class Language(_String):
name = _("Language")
identifier = "language"
class Email(_String):
name = _("Email Address")
identifier = "email"
def get_field(self, **kwargs):
return forms.EmailField(**kwargs)
class URL(_String):
name = _("URL Address")
identifier = "url"
def get_field(self, **kwargs):
return forms.URLField(**kwargs)
class Phone(_String):
name = _("Phone Number")
identifier = "phone"
class Model(Type):
model_label = None
identifier = "model"
@property
def name(self):
return self.get_model()._meta.verbose_name
def __init__(self, model_label):
"""
:param model_label: Model label in Django `app.Model` format (e.g. `shuup.Order`)
:type model_label: str
"""
self.model_label = model_label
def unserialize(self, value):
if isinstance(value, self.get_model()):
return value
try:
return self.get_model().objects.get(pk=value)
except ObjectDoesNotExist:
return None
def is_coercible_from(self, other_type):
return isinstance(other_type, Model) and self.get_model() == other_type.get_model()
def get_model(self):
"""
:rtype: django.db.models.Model
"""
return apps.get_model(self.model_label)
def get_field(self, **kwargs):
kwargs.setdefault("queryset", self.get_model().objects.all())
return forms.ModelChoiceField(**kwargs)
class Enum(Type):
enum_class = None
identifier = "enum"
@property
def name(self):
if self.enum_class:
return camel_case_to_spaces(self.enum_class.__class__.__name__)
return u"<Invalid Enum>"
def __init__(self, enum_class):
self.enum_class = enum_class
assert issubclass(enum_class, enumfields.Enum), "%r is not an enum" % enum_class
def unserialize(self, value):
if isinstance(value, self.enum_class):
return value
try:
return self.enum_class(value)
except ValueError:
try:
return self.enum_class(int(value))
except ValueError:
pass
return None
def get_field(self, **kwargs):
return enumfields.EnumField(self.enum_class).formfield(**kwargs)
|
# -*- coding: utf-8 -*-
"""
Utilities
-------
Utility module for Folium helper functions.
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import time
import math
import zlib
import struct
import json
import base64
from jinja2 import Environment, PackageLoader
try:
import pandas as pd
except ImportError:
pd = None
try:
import numpy as np
except ImportError:
np = None
from folium.six import iteritems, text_type, binary_type
def get_templates():
"""Get Jinja templates."""
return Environment(loader=PackageLoader('folium', 'templates'))
def legend_scaler(legend_values, max_labels=10.0):
"""
Downsamples the number of legend values so that there isn't a collision
of text on the legend colorbar (within reason). The colorbar seems to
support ~10 entries as a maximum.
"""
if len(legend_values) < max_labels:
legend_ticks = legend_values
else:
spacer = int(math.ceil(len(legend_values)/max_labels))
legend_ticks = []
for i in legend_values[::spacer]:
legend_ticks += [i]
legend_ticks += ['']*(spacer-1)
return legend_ticks
def linear_gradient(hexList, nColors):
"""
Given a list of hexcode values, will return a list of length
nColors where the colors are linearly interpolated between the
(r, g, b) tuples that are given.
Example:
linear_gradient([(0, 0, 0), (255, 0, 0), (255, 255, 0)], 100)
"""
def _scale(start, finish, length, i):
"""
Return the value correct value of a number that is in between start
and finish, for use in a loop of length *length*.
"""
base = 16
fraction = float(i) / (length - 1)
raynge = int(finish, base) - int(start, base)
thex = hex(int(int(start, base) + fraction * raynge)).split('x')[-1]
if len(thex) != 2:
thex = '0' + thex
return thex
allColors = []
# Separate (R, G, B) pairs.
for start, end in zip(hexList[:-1], hexList[1:]):
# Linearly intepolate between pair of hex ###### values and
# add to list.
nInterpolate = 765
for index in range(nInterpolate):
r = _scale(start[1:3], end[1:3], nInterpolate, index)
g = _scale(start[3:5], end[3:5], nInterpolate, index)
b = _scale(start[5:7], end[5:7], nInterpolate, index)
allColors.append(''.join(['#', r, g, b]))
# Pick only nColors colors from the total list.
result = []
for counter in range(nColors):
fraction = float(counter) / (nColors - 1)
index = int(fraction * (len(allColors) - 1))
result.append(allColors[index])
return result
def color_brewer(color_code, n=6):
"""
Generate a colorbrewer color scheme of length 'len', type 'scheme.
Live examples can be seen at http://colorbrewer2.org/
"""
maximum_n = 253
scheme_info = {'BuGn': 'Sequential',
'BuPu': 'Sequential',
'GnBu': 'Sequential',
'OrRd': 'Sequential',
'PuBu': 'Sequential',
'PuBuGn': 'Sequential',
'PuRd': 'Sequential',
'RdPu': 'Sequential',
'YlGn': 'Sequential',
'YlGnBu': 'Sequential',
'YlOrBr': 'Sequential',
'YlOrRd': 'Sequential',
'BrBg': 'Diverging',
'PiYG': 'Diverging',
'PRGn': 'Diverging',
'PuOr': 'Diverging',
'RdBu': 'Diverging',
'RdGy': 'Diverging',
'RdYlBu': 'Diverging',
'RdYlGn': 'Diverging',
'Spectral': 'Diverging',
'Accent': 'Qualitative',
'Dark2': 'Qualitative',
'Paired': 'Qualitative',
'Pastel1': 'Qualitative',
'Pastel2': 'Qualitative',
'Set1': 'Qualitative',
'Set2': 'Qualitative',
'Set3': 'Qualitative',
}
schemes = {'BuGn': ['#EDF8FB', '#CCECE6', '#CCECE6',
'#66C2A4', '#41AE76', '#238B45', '#005824'],
'BuPu': ['#EDF8FB', '#BFD3E6', '#9EBCDA',
'#8C96C6', '#8C6BB1', '#88419D', '#6E016B'],
'GnBu': ['#F0F9E8', '#CCEBC5', '#A8DDB5',
'#7BCCC4', '#4EB3D3', '#2B8CBE', '#08589E'],
'OrRd': ['#FEF0D9', '#FDD49E', '#FDBB84',
'#FC8D59', '#EF6548', '#D7301F', '#990000'],
'PuBu': ['#F1EEF6', '#D0D1E6', '#A6BDDB',
'#74A9CF', '#3690C0', '#0570B0', '#034E7B'],
'PuBuGn': ['#F6EFF7', '#D0D1E6', '#A6BDDB',
'#67A9CF', '#3690C0', '#02818A', '#016450'],
'PuRd': ['#F1EEF6', '#D4B9DA', '#C994C7',
'#DF65B0', '#E7298A', '#CE1256', '#91003F'],
'RdPu': ['#FEEBE2', '#FCC5C0', '#FA9FB5',
'#F768A1', '#DD3497', '#AE017E', '#7A0177'],
'YlGn': ['#FFFFCC', '#D9F0A3', '#ADDD8E',
'#78C679', '#41AB5D', '#238443', '#005A32'],
'YlGnBu': ['#FFFFCC', '#C7E9B4', '#7FCDBB',
'#41B6C4', '#1D91C0', '#225EA8', '#0C2C84'],
'YlOrBr': ['#FFFFD4', '#FEE391', '#FEC44F',
'#FE9929', '#EC7014', '#CC4C02', '#8C2D04'],
'YlOrRd': ['#FFFFB2', '#FED976', '#FEB24C',
'#FD8D3C', '#FC4E2A', '#E31A1C', '#B10026'],
'BrBg': ['#8c510a', '#d8b365', '#f6e8c3',
'#c7eae5', '#5ab4ac', '#01665e'],
'PiYG': ['#c51b7d', '#e9a3c9', '#fde0ef',
'#e6f5d0', '#a1d76a', '#4d9221'],
'PRGn': ['#762a83', '#af8dc3', '#e7d4e8',
'#d9f0d3', '#7fbf7b', '#1b7837'],
'PuOr': ['#b35806', '#f1a340', '#fee0b6',
'#d8daeb', '#998ec3', '#542788'],
'RdBu': ['#b2182b', '#ef8a62', '#fddbc7',
'#d1e5f0', '#67a9cf', '#2166ac'],
'RdGy': ['#b2182b', '#ef8a62', '#fddbc7',
'#e0e0e0', '#999999', '#4d4d4d'],
'RdYlBu': ['#d73027', '#fc8d59', '#fee090',
'#e0f3f8', '#91bfdb', '#4575b4'],
'RdYlGn': ['#d73027', '#fc8d59', '#fee08b',
'#d9ef8b', '#91cf60', '#1a9850'],
'Spectral': ['#d53e4f', '#fc8d59', '#fee08b',
'#e6f598', '#99d594', '#3288bd'],
'Accent': ['#7fc97f', '#beaed4', '#fdc086',
'#ffff99', '#386cb0', '#f0027f'],
'Dark2': ['#1b9e77', '#d95f02', '#7570b3',
'#e7298a', '#66a61e', '#e6ab02'],
'Paired': ['#a6cee3', '#1f78b4', '#b2df8a',
'#33a02c', '#fb9a99', '#e31a1c'],
'Pastel1': ['#fbb4ae', '#b3cde3', '#ccebc5',
'#decbe4', '#fed9a6', '#ffffcc'],
'Pastel2': ['#b3e2cd', '#fdcdac', '#cbd5e8',
'#f4cae4', '#e6f5c9', '#fff2ae'],
'Set1': ['#e41a1c', '#377eb8', '#4daf4a',
'#984ea3', '#ff7f00', '#ffff33'],
'Set2': ['#66c2a5', '#fc8d62', '#8da0cb',
'#e78ac3', '#a6d854', '#ffd92f'],
'Set3': ['#8dd3c7', '#ffffb3', '#bebada',
'#fb8072', '#80b1d3', '#fdb462'],
}
# Raise an error if the n requested is greater than the maximum.
if n > maximum_n:
raise ValueError("The maximum number of colors in a"
" ColorBrewer sequential color series is 253")
# Only if n is greater than six do we interpolate values.
if n > 6:
if color_code not in schemes:
color_scheme = None
else:
# Check to make sure that it is not a qualitative scheme.
if scheme_info[color_code] == 'Qualitative':
raise ValueError("Expanded color support is not available"
" for Qualitative schemes, restrict"
" number of colors to 6")
else:
color_scheme = linear_gradient(schemes.get(color_code), n)
else:
color_scheme = schemes.get(color_code, None)
return color_scheme
def transform_data(data):
"""
Transform Pandas DataFrame into JSON format.
Parameters
----------
data: DataFrame or Series
Pandas DataFrame or Series
Returns
-------
JSON compatible dict
Example
-------
>>> transform_data(df)
"""
if pd is None:
raise ImportError("The Pandas package is required"
" for this functionality")
if np is None:
raise ImportError("The NumPy package is required"
" for this functionality")
def type_check(value):
"""
Type check values for JSON serialization. Native Python JSON
serialization will not recognize some Numpy data types properly,
so they must be explicitly converted.
"""
if pd.isnull(value):
return None
elif (isinstance(value, pd.tslib.Timestamp) or
isinstance(value, pd.Period)):
return time.mktime(value.timetuple())
elif isinstance(value, (int, np.integer)):
return int(value)
elif isinstance(value, (float, np.float_)):
return float(value)
elif isinstance(value, str):
return str(value)
else:
return value
if isinstance(data, pd.Series):
json_data = [{type_check(x): type_check(y) for
x, y in iteritems(data)}]
elif isinstance(data, pd.DataFrame):
json_data = [{type_check(y): type_check(z) for
x, y, z in data.itertuples()}]
return json_data
def split_six(series=None):
"""
Given a Pandas Series, get a domain of values from zero to the 90% quantile
rounded to the nearest order-of-magnitude integer. For example, 2100 is
rounded to 2000, 2790 to 3000.
Parameters
----------
series: Pandas series, default None
Returns
-------
list
"""
if pd is None:
raise ImportError("The Pandas package is required"
" for this functionality")
if np is None:
raise ImportError("The NumPy package is required"
" for this functionality")
def base(x):
if x > 0:
base = pow(10, math.floor(math.log10(x)))
return round(x/base)*base
else:
return 0
quants = [0, 50, 75, 85, 90]
# Some weirdness in series quantiles a la 0.13.
arr = series.values
return [base(np.percentile(arr, x)) for x in quants]
def mercator_transform(data, lat_bounds, origin='upper', height_out=None):
"""Transforms an image computed in (longitude,latitude) coordinates into
the a Mercator projection image.
Parameters
----------
data: numpy array or equivalent list-like object.
Must be NxM (mono), NxMx3 (RGB) or NxMx4 (RGBA)
lat_bounds : length 2 tuple
Minimal and maximal value of the latitude of the image.
origin : ['upper' | 'lower'], optional, default 'upper'
Place the [0,0] index of the array in the upper left or lower left
corner of the axes.
height_out : int, default None
The expected height of the output.
If None, the height of the input is used.
"""
if np is None:
raise ImportError("The NumPy package is required"
" for this functionality")
mercator = lambda x: np.arcsinh(np.tan(x*np.pi/180.))*180./np.pi
array = np.atleast_3d(data).copy()
height, width, nblayers = array.shape
lat_min, lat_max = lat_bounds
if height_out is None:
height_out = height
# Eventually flip the image
if origin == 'upper':
array = array[::-1, :, :]
lats = (lat_min + np.linspace(0.5/height, 1.-0.5/height, height) *
(lat_max-lat_min))
latslats = (mercator(lat_min) +
np.linspace(0.5/height_out, 1.-0.5/height_out, height_out) *
(mercator(lat_max)-mercator(lat_min)))
out = np.zeros((height_out, width, nblayers))
for i in range(width):
for j in range(4):
out[:, i, j] = np.interp(latslats, mercator(lats), array[:, i, j])
# Eventually flip the image.
if origin == 'upper':
out = out[::-1, :, :]
return out
def image_to_url(image, mercator_project=False, colormap=None,
origin='upper', bounds=((-90, -180), (90, 180))):
"""Infers the type of an image argument and transforms it into a URL.
Parameters
----------
image: string, file or array-like object
* If string, it will be written directly in the output file.
* If file, it's content will be converted as embedded in the
output file.
* If array-like, it will be converted to PNG base64 string and
embedded in the output.
origin : ['upper' | 'lower'], optional, default 'upper'
Place the [0, 0] index of the array in the upper left or
lower left corner of the axes.
colormap : callable, used only for `mono` image.
Function of the form [x -> (r,g,b)] or [x -> (r,g,b,a)]
for transforming a mono image into RGB.
It must output iterables of length 3 or 4, with values between
0. and 1. Hint : you can use colormaps from `matplotlib.cm`.
mercator_project : bool, default False, used for array-like image.
Transforms the data to project (longitude,latitude)
coordinates to the Mercator projection.
bounds: list-like, default ((-90, -180), (90, 180))
Image bounds on the map in the form
[[lat_min, lon_min], [lat_max, lon_max]].
Only used if mercator_project is True.
"""
if hasattr(image, 'read'):
# We got an image file.
if hasattr(image, 'name'):
# We try to get the image format from the file name.
fileformat = image.name.lower().split('.')[-1]
else:
fileformat = 'png'
url = "data:image/{};base64,{}".format(
fileformat, base64.b64encode(image.read()).decode('utf-8'))
elif (not (isinstance(image, text_type) or
isinstance(image, binary_type))) and hasattr(image, '__iter__'):
# We got an array-like object.
if mercator_project:
data = mercator_transform(image,
[bounds[0][0], bounds[1][0]],
origin=origin)
else:
data = image
png = write_png(data, origin=origin, colormap=colormap)
url = "data:image/png;base64," + base64.b64encode(png).decode('utf-8')
else:
# We got an URL.
url = json.loads(json.dumps(image))
return url.replace('\n', ' ')
def write_png(data, origin='upper', colormap=None):
"""
Transform an array of data into a PNG string.
This can be written to disk using binary I/O, or encoded using base64
for an inline PNG like this:
>>> png_str = write_png(array)
>>> "data:image/png;base64,"+png_str.encode('base64')
Inspired from
http://stackoverflow.com/questions/902761/saving-a-numpy-array-as-an-image
Parameters
----------
data: numpy array or equivalent list-like object.
Must be NxM (mono), NxMx3 (RGB) or NxMx4 (RGBA)
origin : ['upper' | 'lower'], optional, default 'upper'
Place the [0,0] index of the array in the upper left or lower left
corner of the axes.
colormap : callable, used only for `mono` image.
Function of the form [x -> (r,g,b)] or [x -> (r,g,b,a)]
for transforming a mono image into RGB.
It must output iterables of length 3 or 4, with values between
0. and 1. Hint: you can use colormaps from `matplotlib.cm`.
Returns
-------
PNG formatted byte string
"""
if np is None:
raise ImportError("The NumPy package is required"
" for this functionality")
if colormap is None:
colormap = lambda x: (x, x, x, 1)
array = np.atleast_3d(data)
height, width, nblayers = array.shape
if nblayers not in [1, 3, 4]:
raise ValueError("Data must be NxM (mono), "
"NxMx3 (RGB), or NxMx4 (RGBA)")
assert array.shape == (height, width, nblayers)
if nblayers == 1:
array = np.array(list(map(colormap, array.ravel())))
nblayers = array.shape[1]
if nblayers not in [3, 4]:
raise ValueError("colormap must provide colors of"
"length 3 (RGB) or 4 (RGBA)")
array = array.reshape((height, width, nblayers))
assert array.shape == (height, width, nblayers)
if nblayers == 3:
array = np.concatenate((array, np.ones((height, width, 1))), axis=2)
nblayers = 4
assert array.shape == (height, width, nblayers)
assert nblayers == 4
# Normalize to uint8 if it isn't already.
if array.dtype != 'uint8':
array = array * 255./array.max(axis=(0, 1)).reshape((1, 1, 4))
array = array.astype('uint8')
# Eventually flip the image.
if origin == 'lower':
array = array[::-1, :, :]
# Transform the array to bytes.
raw_data = b''.join([b'\x00' + array[i, :, :].tobytes()
for i in range(height)])
def png_pack(png_tag, data):
chunk_head = png_tag + data
return (struct.pack("!I", len(data)) +
chunk_head +
struct.pack("!I", 0xFFFFFFFF & zlib.crc32(chunk_head)))
return b''.join([
b'\x89PNG\r\n\x1a\n',
png_pack(b'IHDR', struct.pack("!2I5B", width, height, 8, 6, 0, 0, 0)),
png_pack(b'IDAT', zlib.compress(raw_data, 9)),
png_pack(b'IEND', b'')])
def _camelify(out):
return (''.join(["_" + x.lower() if i < len(out)-1 and x.isupper() and out[i+1].islower() # noqa
else x.lower() + "_" if i < len(out)-1 and x.islower() and out[i+1].isupper() # noqa
else x.lower() for i, x in enumerate(list(out))])).lstrip('_').replace('__', '_') # noqa
def _parse_size(value):
try:
if isinstance(value, int) or isinstance(value, float):
value_type = 'px'
value = float(value)
assert value > 0
else:
value_type = '%'
value = float(value.strip('%'))
assert 0 <= value <= 100
except:
msg = "Cannot parse value {!r} as {!r}".format
raise ValueError(msg(value, value_type))
return value, value_type
def _locations_mirror(x):
"""Mirrors the points in a list-of-list-of-...-of-list-of-points.
For example:
>>> _locations_mirror([[[1, 2], [3, 4]], [5, 6], [7, 8]])
[[[2, 1], [4, 3]], [6, 5], [8, 7]]
"""
if hasattr(x, '__iter__'):
if hasattr(x[0], '__iter__'):
return list(map(_locations_mirror, x))
else:
return list(x[::-1])
else:
return x
def _locations_tolist(x):
"""Transforms recursively a list of iterables into a list of list.
"""
if hasattr(x, '__iter__'):
return list(map(_locations_tolist, x))
else:
return x
|
# -*- coding: utf-8 -*-
import json
URL_HOME = 'http://bulbapedia.bulbagarden.net'
URL_LIST = '/wiki/List_of_Pokémon_by_Kanto_Pokédex_number'
HIDDEN_STYLE = [ 'display:none;' , 'display: none;' ]
SLEEP_TIME = 15 # seconds
MAX_CHUNK = 10
DATA_DIR = '../data/'
DESC_FILE = '%sdata.json' % DATA_DIR
RULES_FILE = '%sgenerated_rules.pl' % DATA_DIR
FIELD_FILES = [ "size.txt" , "weight.txt" , "has_evolution.txt" , "is_evolution.txt" , "is_starter.txt" ]
REPLACE_CHARS = {
u"\u00e9" : 'e' ,
u"\u2640" : ' female' ,
u"\u2642" : ' male' ,
"'" : '' ,
'.' : '' ,
" " : '_'
}
NORM_FIELDS = [ 'img_url' ]
def convertToJson( lst , filename = DESC_FILE , mode = 'a+' ) :
with open( filename , mode ) as jsonfile :
json.dump( lst , jsonfile , indent = 4 , sort_keys = True )
def importAsJson( filename = DESC_FILE ) :
f = open( filename )
data = json.load( f )
for row in data :
for k in row :
if k in NORM_FIELDS : continue
row[ k ] = normalizeString( row[ k ] )
return data
def normalizeString( st ) :
if isinstance( st , list ) :
st = [ normalizeString( cad ) for cad in st if cad != 'Unknown' ]
else :
st = st.lower().encode( 'utf-8' ).decode( 'utf-8' )
for k in REPLACE_CHARS : st = st.replace( k , REPLACE_CHARS[ k ] )
return st
|
"""Models related to domains management."""
import datetime
from django.db import models
from django.db.models.manager import Manager
from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible, smart_text
from django.utils.functional import cached_property
from django.utils.translation import ugettext as _, ugettext_lazy
from django.contrib.contenttypes.fields import GenericRelation
from reversion import revisions as reversion
from modoboa.core import signals as core_signals
from modoboa.core.models import User, ObjectAccess
from modoboa.lib.exceptions import BadRequest, Conflict
from modoboa.parameters import tools as param_tools
from .. import signals
from .base import AdminObject
from .. import constants
class DomainManager(Manager):
def get_for_admin(self, admin):
"""Return the domains belonging to this admin
The result is a ``QuerySet`` object, so this function can be used
to fill ``ModelChoiceField`` objects.
"""
if admin.is_superuser:
return self.get_queryset()
return self.get_queryset().filter(owners__user=admin)
@python_2_unicode_compatible
class Domain(AdminObject):
"""Mail domain."""
name = models.CharField(ugettext_lazy('name'), max_length=100, unique=True,
help_text=ugettext_lazy("The domain name"))
quota = models.IntegerField()
enabled = models.BooleanField(
ugettext_lazy('enabled'),
help_text=ugettext_lazy("Check to activate this domain"),
default=True
)
owners = GenericRelation(ObjectAccess)
type = models.CharField(default="domain", max_length=20)
enable_dns_checks = models.BooleanField(
ugettext_lazy("Enable DNS checks"), default=True,
help_text=ugettext_lazy("Check to enable DNS checks for this domain")
)
objects = DomainManager()
class Meta:
permissions = (
("view_domain", "View domain"),
("view_domains", "View domains"),
)
ordering = ["name"]
app_label = "admin"
def __init__(self, *args, **kwargs):
"""Save name for further use."""
super(Domain, self).__init__(*args, **kwargs)
self.old_mail_homes = None
self.oldname = self.name
@property
def domainalias_count(self):
return self.domainalias_set.count()
@property
def mailbox_count(self):
return self.mailbox_set.count()
@property
def mbalias_count(self):
return self.alias_set.filter(internal=False).count()
@property
def identities_count(self):
"""Total number of identities in this domain."""
return (
self.mailbox_set.count() +
self.alias_set.filter(internal=False).count())
@property
def tags(self):
if self.type == "domain":
return [{"name": "domain", "label": _("Domain"), "type": "dom"}]
results = signals.get_domain_tags.send(
sender=self.__class__, domain=self)
return reduce(lambda a, b: a + b, [result[1] for result in results])
@property
def admins(self):
"""Return the domain administrators of this domain.
:return: a list of User objects
"""
return User.objects.filter(
is_superuser=False,
objectaccess__content_type__model="domain",
objectaccess__object_id=self.pk)
@property
def aliases(self):
return self.domainalias_set
@property
def uses_a_reserved_tld(self):
"""Does this domain use a reserved TLD."""
tld = self.name.split(".", 1)[-1]
return tld in constants.RESERVED_TLD
@property
def just_created(self):
"""Return true if the domain was created in the latest 24h."""
now = timezone.now()
delta = datetime.timedelta(days=1)
return self.creation + delta > now
def awaiting_checks(self):
"""Return true if the domain has no valid MX record and was created
in the latest 24h."""
if (not self.mxrecord_set.has_valids()) and self.just_created:
return True
return False
@cached_property
def dnsbl_status_color(self):
"""Shortcut to DNSBL results."""
if not self.dnsblresult_set.exists():
return "warning"
elif self.dnsblresult_set.blacklisted().exists():
return "danger"
else:
return "success"
def add_admin(self, account):
"""Add a new administrator to this domain.
:param User account: the administrator
"""
from modoboa.lib.permissions import grant_access_to_object
core_signals.can_create_object.send(
sender=self.__class__, context=self, object_type="domain_admins")
grant_access_to_object(account, self)
for mb in self.mailbox_set.all():
if mb.user.has_perm("admin.add_domain"):
continue
grant_access_to_object(account, mb)
grant_access_to_object(account, mb.user)
for al in self.alias_set.all():
grant_access_to_object(account, al)
def remove_admin(self, account):
"""Remove an administrator of this domain.
:param User account: administrator to remove
"""
from modoboa.lib.permissions import ungrant_access_to_object
ungrant_access_to_object(self, account)
for mb in self.mailbox_set.all():
if mb.user.has_perm("admin.add_domain"):
continue
ungrant_access_to_object(mb, account)
ungrant_access_to_object(mb.user, account)
for al in self.alias_set.all():
ungrant_access_to_object(al, account)
def save(self, *args, **kwargs):
"""Store current data if domain is renamed."""
if self.oldname != self.name:
self.old_mail_homes = (
dict((mb.id, mb.mail_home) for mb in self.mailbox_set.all())
)
super(Domain, self).save(*args, **kwargs)
def delete(self, fromuser, keepdir=False):
"""Custom delete method."""
from modoboa.lib.permissions import ungrant_access_to_objects
from .mailbox import Quota
if self.domainalias_set.count():
ungrant_access_to_objects(self.domainalias_set.all())
if self.alias_set.count():
ungrant_access_to_objects(self.alias_set.all())
if param_tools.get_global_parameter("auto_account_removal"):
for account in User.objects.filter(mailbox__domain=self):
account.delete(fromuser, keepdir)
elif self.mailbox_set.count():
Quota.objects.filter(username__contains="@%s" % self.name).delete()
ungrant_access_to_objects(self.mailbox_set.all())
super(Domain, self).delete()
def __str__(self):
return smart_text(self.name)
def from_csv(self, user, row):
"""Create a new domain from a CSV entry.
The expected fields order is the following::
"domain", name, quota, enabled
:param ``core.User`` user: user creating the domain
:param str row: a list containing domain's definition
"""
if len(row) < 4:
raise BadRequest(_("Invalid line"))
self.name = row[1].strip()
if Domain.objects.filter(name=self.name).exists():
raise Conflict
try:
self.quota = int(row[2].strip())
except ValueError:
raise BadRequest(
_("Invalid quota value for domain '%s'") % self.name)
self.enabled = (row[3].strip() in ["True", "1", "yes", "y"])
self.save(creator=user)
def to_csv(self, csvwriter):
csvwriter.writerow(["domain", self.name, self.quota, self.enabled])
for dalias in self.domainalias_set.all():
dalias.to_csv(csvwriter)
def post_create(self, creator):
"""Post creation actions.
:param ``User`` creator: user whos created this domain
"""
super(Domain, self).post_create(creator)
for domalias in self.domainalias_set.all():
domalias.post_create(creator)
reversion.register(Domain)
class MXQuerySet(models.QuerySet):
"""Custom manager for MXRecord."""
def has_valids(self):
"""Return managed results."""
if param_tools.get_global_parameter("valid_mxs").strip():
return self.filter(managed=True).exists()
return self.exists()
class MXRecord(models.Model):
"""A model used to store MX records for Domain."""
domain = models.ForeignKey(Domain)
name = models.CharField(max_length=254)
address = models.GenericIPAddressField()
managed = models.BooleanField(default=False)
updated = models.DateTimeField()
objects = models.Manager.from_queryset(MXQuerySet)()
def is_managed(self):
if not param_tools.get_global_parameter("enable_mx_checks"):
return False
return bool(param_tools.get_global_parameter("valid_mxs").strip())
def __unicode__(self):
return u"{0.name} ({0.address}) for {0.domain} ".format(self)
class DNSBLQuerySet(models.QuerySet):
"""Custom manager for DNSBLResultManager."""
def blacklisted(self):
"""Return blacklisted results."""
return self.exclude(status="")
class DNSBLResult(models.Model):
"""Store a DNSBL query result."""
domain = models.ForeignKey(Domain)
provider = models.CharField(max_length=254, db_index=True)
mx = models.ForeignKey(MXRecord)
status = models.CharField(max_length=45, blank=True, db_index=True)
objects = models.Manager.from_queryset(DNSBLQuerySet)()
class Meta:
app_label = "admin"
unique_together = [("domain", "provider", "mx")]
|
from GenericMeasure import GenericMeasure
from GenericAvgMeasure import GenericAvgMeasure
import Units
class ReceivedMessages(GenericMeasure):
def __init__(self, period, simulationTime, broadcastTable):
GenericMeasure.__init__(self, r"DEBUG .*? - Peer .*? received packet .*?(\(.*?\)) .*?([0-9]+\,[0-9]+).*?", period, simulationTime, Units.MESSAGES)
self.__broadcastTable = broadcastTable
def parseInc(self, line):
m = self.getProg().match(line)
if m is not None:
messageID = m.group(1)
if messageID in self.__broadcastTable:
startTime = self.__broadcastTable[messageID]
time = float(m.group(2).replace(',','.'))
return (startTime, time)
return None
class BroadcastedMessages(GenericMeasure):
def __init__(self, period, simulationTime):
GenericMeasure.__init__(self, r"DEBUG .*? - Peer .*? broadcasting .*?(\(.*?\)).*? ([0-9]+\,[0-9]+).*?", period, simulationTime, Units.MESSAGES)
self.__broadcastTable = {}
def parseInc(self, line):
m = self.getProg().match(line)
if m is not None:
messageID = m.group(1)
time = float(m.group(2).replace(',','.'))
self.__broadcastTable[messageID] = time
def getBroadcastTable(self):
return self.__broadcastTable
class BroadcastTime(GenericAvgMeasure):
"""The average time used to broadcast a message"""
def __init__(self, period, simulationTime):
GenericAvgMeasure.__init__(self, period, simulationTime, Units.SECONDS)
self.__broadcastedMessages = BroadcastedMessages(period, simulationTime)
self.__receivedMessages = ReceivedMessages(period, simulationTime, self.__broadcastedMessages.getBroadcastTable())
def parseLine(self, line):
self.__broadcastedMessages.parseInc(line)
result = self.__receivedMessages.parseInc(line)
if result is not None:
broadcastTime, deliveredTime = result
elapsedTime = deliveredTime - broadcastTime
self.periodicAvgValues.addValue(elapsedTime, broadcastTime)
|
from datetime import timedelta
from flask import make_response, request, current_app
from functools import update_wrapper
def crossdomain(origin=None, methods=None, headers=None,
max_age=21600, attach_to_all=True,
automatic_options=True):
if methods is not None:
methods = ', '.join(sorted(x.upper() for x in methods))
if headers is not None and not isinstance(headers, basestring):
headers = ', '.join(x.upper() for x in headers)
if not isinstance(origin, str):
origin = ', '.join(origin)
if isinstance(max_age, timedelta):
max_age = max_age.total_seconds()
def get_methods():
if methods is not None:
return methods
options_resp = current_app.make_default_options_response()
return options_resp.headers['allow']
def decorator(f):
def wrapped_function(*args, **kwargs):
if automatic_options and request.method == 'OPTIONS':
resp = current_app.make_default_options_response()
else:
resp = make_response(f(*args, **kwargs))
if not attach_to_all and request.method != 'OPTIONS':
return resp
h = resp.headers
h['Access-Control-Allow-Origin'] = origin
h['Access-Control-Allow-Methods'] = get_methods()
h['Access-Control-Max-Age'] = str(max_age)
if headers is not None:
h['Access-Control-Allow-Headers'] = headers
return resp
f.provide_automatic_options = False
return update_wrapper(wrapped_function, f)
return decorator
|
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
# Copyright (C) 2010 Nick Hall
#
# This program 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 2 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 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.
#
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
from bisect import insort_left
from gi.repository import Gdk
from gi.repository import Gtk
from gi.repository import Pango
from ... import widgets
from ...dbguielement import DbGUIElement
from gramps.gen.config import config
_RETURN = Gdk.keyval_from_name("Return")
_KP_ENTER = Gdk.keyval_from_name("KP_Enter")
class SidebarFilter(DbGUIElement):
_FILTER_WIDTH = 20
_FILTER_ELLIPSIZE = Pango.EllipsizeMode.END
def __init__(self, dbstate, uistate, namespace):
self.signal_map = {
'tag-add' : self._tag_add,
'tag-delete' : self._tag_delete,
'tag-update' : self._tag_update,
'tag-rebuild' : self._tag_rebuild
}
DbGUIElement.__init__(self, dbstate.db)
self.position = 1
self.vbox = Gtk.VBox()
self.table = Gtk.Table(n_rows=4, n_columns=11)
self.vbox.pack_start(self.table, False, False, 0)
self.table.set_border_width(6)
self.table.set_row_spacings(6)
self.table.set_col_spacing(0, 6)
self.table.set_col_spacing(1, 6)
self.apply_btn = Gtk.Button(stock=Gtk.STOCK_FIND)
self.clear_btn = Gtk.Button()
self._init_interface()
uistate.connect('filters-changed', self.on_filters_changed)
dbstate.connect('database-changed', self._db_changed)
self.uistate = uistate
self.dbstate = dbstate
self.namespace = namespace
self.__tag_list = []
self._tag_rebuild()
def _init_interface(self):
self.create_widget()
self.apply_btn.connect('clicked', self.clicked)
hbox = Gtk.HBox()
hbox.show()
image = Gtk.Image()
image.set_from_stock(Gtk.STOCK_UNDO, Gtk.IconSize.BUTTON)
image.show()
label = Gtk.Label(label=_('Reset'))
label.show()
hbox.pack_start(image, False, False, 0)
hbox.pack_start(label, False, True, 0)
hbox.set_spacing(4)
self.clear_btn.add(hbox)
self.clear_btn.connect('clicked', self.clear)
hbox = Gtk.HButtonBox()
hbox.set_layout(Gtk.ButtonBoxStyle.START)
hbox.set_spacing(6)
hbox.set_border_width(12)
hbox.add(self.apply_btn)
hbox.add(self.clear_btn)
hbox.show()
self.vbox.pack_start(hbox, False, False, 0)
self.vbox.show()
def get_widget(self):
return self.vbox
def create_widget(self):
pass
def clear(self, obj):
pass
def clicked(self, obj):
self.uistate.set_busy_cursor(True)
self.clicked_func()
self.uistate.set_busy_cursor(False)
def clicked_func(self):
pass
def get_filter(self):
pass
def add_regex_entry(self, widget):
hbox = Gtk.HBox()
hbox.pack_start(widget, False, False, 12)
self.vbox.pack_start(hbox, False, False, 0)
def add_text_entry(self, name, widget, tooltip=None):
self.add_entry(name, widget)
widget.connect('key-press-event', self.key_press)
if tooltip:
widget.set_tooltip_text(tooltip)
def key_press(self, obj, event):
if not (event.get_state() & Gdk.ModifierType.CONTROL_MASK):
if event.keyval in (_RETURN, _KP_ENTER):
self.clicked(obj)
return False
def add_entry(self, name, widget):
if name:
self.table.attach(widgets.BasicLabel(name),
1, 2, self.position, self.position+1,
xoptions=Gtk.AttachOptions.FILL, yoptions=0)
self.table.attach(widget, 2, 4, self.position, self.position+1,
xoptions=Gtk.AttachOptions.FILL|Gtk.AttachOptions.EXPAND, yoptions=0)
self.position += 1
def on_filters_changed(self, namespace):
"""
Called when filters are changed.
"""
pass
def _db_changed(self, db):
"""
Called when the database is changed.
"""
self._change_db(db)
self.on_db_changed(db)
self._tag_rebuild()
def on_db_changed(self, db):
"""
Called when the database is changed.
"""
pass
def _connect_db_signals(self):
"""
Connect database signals defined in the signal map.
"""
for sig in self.signal_map:
self.callman.add_db_signal(sig, self.signal_map[sig])
def _tag_add(self, handle_list):
"""
Called when tags are added.
"""
for handle in handle_list:
tag = self.dbstate.db.get_tag_from_handle(handle)
insort_left(self.__tag_list, (tag.get_name(), handle))
self.on_tags_changed([item[0] for item in self.__tag_list])
def _tag_update(self, handle_list):
"""
Called when tags are updated.
"""
for handle in handle_list:
item = [item for item in self.__tag_list if item[1] == handle][0]
self.__tag_list.remove(item)
tag = self.dbstate.db.get_tag_from_handle(handle)
insort_left(self.__tag_list, (tag.get_name(), handle))
self.on_tags_changed([item[0] for item in self.__tag_list])
def _tag_delete(self, handle_list):
"""
Called when tags are deleted.
"""
self.__tag_list = [item for item in self.__tag_list
if item[1] not in handle_list]
self.on_tags_changed([item[0] for item in self.__tag_list])
def _tag_rebuild(self):
"""
Called when the tag list needs to be rebuilt.
"""
self.__tag_list = []
for handle in self.dbstate.db.get_tag_handles(sort_handles=True):
tag = self.dbstate.db.get_tag_from_handle(handle)
self.__tag_list.append((tag.get_name(), handle))
self.on_tags_changed([item[0] for item in self.__tag_list])
def on_tags_changed(self, tag_list):
"""
Called when tags are changed.
"""
pass
def add_filter_entry(self, text, widget):
"""
Adds the text and widget to GUI, with an Edit button.
"""
hbox = Gtk.HBox()
hbox.pack_start(widget, True, True, 0)
hbox.pack_start(widgets.SimpleButton(Gtk.STOCK_EDIT, self.edit_filter),
False, False, 0)
self.add_entry(text, hbox)
def edit_filter(self, obj):
"""
Callback which invokes the EditFilter dialog. Will create new
filter if called if none is selected.
"""
from ...editors import EditFilter
from gramps.gen.filters import FilterList, GenericFilterFactory
from gramps.gen.const import CUSTOM_FILTERS
the_filter = None
filterdb = FilterList(CUSTOM_FILTERS)
filterdb.load()
if self.generic.get_active() != 0:
model = self.generic.get_model()
node = self.generic.get_active_iter()
if node:
sel_filter = model.get_value(node, 1)
# the_filter needs to be a particular object for editor
for filt in filterdb.get_filters(self.namespace):
if filt.get_name() == sel_filter.get_name():
the_filter = filt
else:
the_filter = GenericFilterFactory(self.namespace)()
if the_filter:
EditFilter(self.namespace, self.dbstate, self.uistate, [],
the_filter, filterdb,
selection_callback=self.edit_filter_save)
def edit_filter_save(self, filterdb, filter_name):
"""
If a filter changed, save them all. Reloads, and sets name.
Takes the filter database, and the filter name edited.
"""
from gramps.gen.filters import reload_custom_filters
filterdb.save()
reload_custom_filters()
self.on_filters_changed(self.namespace)
self.set_filters_to_name(filter_name)
def set_filters_to_name(self, filter_name):
"""
Resets the Filter combobox to the edited/saved filter.
"""
liststore = self.generic.get_model()
iter = liststore.get_iter_first()
while iter:
filter = liststore.get_value(iter, 1)
if filter and filter.name == filter_name:
self.generic.set_active_iter(iter)
break
iter = liststore.iter_next(iter)
|
"""
Copyright (c) 2019 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
import os
import subprocess
import tempfile
from atomic_reactor.build import BuildResult
from atomic_reactor.constants import (PLUGIN_SOURCE_CONTAINER_KEY, EXPORTED_SQUASHED_IMAGE_NAME,
IMAGE_TYPE_DOCKER_ARCHIVE, PLUGIN_FETCH_SOURCES_KEY)
from atomic_reactor.plugin import BuildStepPlugin
from atomic_reactor.util import get_exported_image_metadata
class SourceContainerPlugin(BuildStepPlugin):
"""
Build source container image using
https://github.com/containers/BuildSourceImage
"""
key = PLUGIN_SOURCE_CONTAINER_KEY
def export_image(self, image_output_dir):
output_path = os.path.join(tempfile.mkdtemp(), EXPORTED_SQUASHED_IMAGE_NAME)
cmd = ['skopeo', 'copy']
source_img = 'oci:{}'.format(image_output_dir)
dest_img = 'docker-archive:{}'.format(output_path)
cmd += [source_img, dest_img]
self.log.info("Calling: %s", ' '.join(cmd))
try:
subprocess.check_output(cmd, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
self.log.error("failed to save docker-archive :\n%s", e.output)
raise
img_metadata = get_exported_image_metadata(output_path, IMAGE_TYPE_DOCKER_ARCHIVE)
self.workflow.exported_image_sequence.append(img_metadata)
def run(self):
"""Build image inside current environment.
Returns:
BuildResult
"""
fetch_sources_result = self.workflow.prebuild_results.get(PLUGIN_FETCH_SOURCES_KEY, {})
source_data_dir = fetch_sources_result.get('image_sources_dir')
remote_source_data_dir = fetch_sources_result.get('remote_sources_dir')
source_exists = source_data_dir and os.path.isdir(source_data_dir)
remote_source_exists = remote_source_data_dir and os.path.isdir(remote_source_data_dir)
if not source_exists and not remote_source_exists:
err_msg = "No SRPMs directory '{}' available".format(source_data_dir)
err_msg += "\nNo Remote source directory '{}' available".format(remote_source_data_dir)
self.log.error(err_msg)
return BuildResult(logs=err_msg, fail_reason=err_msg)
if source_exists and not os.listdir(source_data_dir):
self.log.warning("SRPMs directory '%s' is empty", source_data_dir)
if remote_source_exists and not os.listdir(remote_source_data_dir):
self.log.warning("Remote source directory '%s' is empty", remote_source_data_dir)
image_output_dir = tempfile.mkdtemp()
cmd = ['bsi', '-d']
drivers = []
if source_exists:
drivers.append('sourcedriver_rpm_dir')
cmd.append('-s')
cmd.append('{}'.format(source_data_dir))
if remote_source_exists:
drivers.append('sourcedriver_extra_src_dir')
cmd.append('-e')
cmd.append('{}'.format(remote_source_data_dir))
driver_str = ','.join(drivers)
cmd.insert(2, driver_str)
cmd.append('-o')
cmd.append('{}'.format(image_output_dir))
try:
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
self.log.error("BSI failed with output:\n%s", e.output)
return BuildResult(logs=e.output, fail_reason='BSI utility failed build source image')
self.log.debug("Build log:\n%s\n", output)
self.export_image(image_output_dir)
return BuildResult(
logs=output,
oci_image_path=image_output_dir,
skip_layer_squash=True
)
|
## numpy-oldnumeric calls replaced by custom script; 09/06/2016
## Automatically adapted for numpy-oldnumeric Mar 26, 2007 by alter_code1.py
## class ChainSeperator:
##
## Biskit, a toolkit for the manipulation of macromolecular structures
## Copyright (C) 2004-2018 Raik Gruenberg & Johan Leckner
##
## This program 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 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 find a copy of the GNU General Public License in the file
## license.txt along with this program; if not, write to the Free
## Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
##
"""
Seperate PDB into continuous peptide chains for XPlor. Remove duplicate
peptide chains. Required by pdb2xplor.py
This is vintage code. See L{Biskit.PDBCleaner} for a more recent
version (though yet lacking some functions).
@todo: Create an override for the chain comparison if one wants
to keep identical chains (i.e homodimers)
"""
## from Blast2Seq import * # compare 2 sequences
from molUtils import singleAA
import Biskit.tools as T
from LogFile import LogFile
from Scientific.IO.PDB import *
import Biskit.oldnumeric as N0
import string
from difflib import SequenceMatcher
import re
class ChainSeparator:
"""
Open PDB file; give back one chain whenever next() is
called. This class is used by the pdb2xplor script.
This class constitutes vintage code. See
L{Biskit.PDBCleaner} and L{Biskit.Mod.TemplateCleaner} for a more
recent implementation of PDB cleaning.
@todo: The removal of duplicate chains should be transferred to
the PDBCleaner so that this class can be retired
"""
def __init__(self, fname, outPath='', chainIdOffset=0,
capBreaks=0, chainMask=0, log=None ):
"""
@param fname: pdb filename
@type fname: str
@param outPath: path for log file
@type outPath: str
@param chainIdOffset: start chain numbering at this offset
@type chainIdOffset: int
@param capBreaks: add ACE and NME to N- and C-term. of chain breaks [0]
@type capBreaks: 0|1
@param chainMask: chain mask for overriding the default sequence identity [None]
@type chainMask: [1|0]
@param log: LogFile object
@type log: object
"""
self.pdb = Structure(fname);
self.fname = fname
self.outPath = T.absfile( outPath )
self.chainIdOffset = chainIdOffset
self.capBreaks = capBreaks
self.log = LogFile( T.absfile(outPath)+'/' + self.pdbname()+'.log')
if log:
self.log = log
self.chains = self.pdb.peptide_chains
self.counter = -1
self.threshold = 0.9 # sequence identity between multiple copies in PDB
self._expressionCheck(
"[^\n].*[Hh][Oo][Mm][Oo].?[Dd][Ii][Mm][eE][Rr].*\n", 'HOMODIMER')
self._expressionCheck("[^\n].*[Tt][Rr][Ii][Mm][Ee][Rr].*\n", 'TRIMER')
self._hetatomCheck()
self.log.add("Separate chains: \n------------------")
self._removeDuplicateChains(chainMask) # keep only one copy of molecule
self._separateChainBreaks()
self._assign_seg_ids() # new segment id for each chain
def pdbname(self):
"""
Extract pdb code from file name.
@return: (assumed) pdb code
@rtype: str
"""
return T.stripFilename(self.pdb.filename)
def _expressionCheck(self, findExpression, findClean):
"""
Check and report if the regular expression 'findExpression'
exists in the PDB-file. Use this to locate data in the REMARK
section of a pdb file. Prints a warning to stdOut if the
regular expression is found.
@param findExpression: regular expression
@type findExpression: str
@param findClean: clean name of regular expression
@type findClean: str
"""
pdb = open(self.fname,'r')
pdbFile = pdb.read()
searchResult = re.findall(findExpression,pdbFile)
warningMessage = """
WARNINGR! The text string'%s' was found in the PDB-file.
If this PDB-file contains a homodimer one of the chains will be
deleted by this script. To avoid this prepare the file for Xplor manualy \n""" %\
( findClean )
warningMessage2 = """--------------------------------------------\n"""
if len(searchResult) != 0:
self.log.add(warningMessage)
self.log.add("String found in line(s): \n")
for i in range(0,len(searchResult)):
self.log.add(searchResult[i])
self.log.add(warningMessage2)
pdb.close()
def _hetatomCheck(self):
"""
Check and report if there are any none-water HETATMs in the PDB-file
"""
pdb = open(self.fname,'r')
pdbFile = pdb.read()
findExpression = "HETATM.*\n"
searchResult = re.findall(findExpression,pdbFile)
i=0
j = len(searchResult)
while i<j:
if searchResult[i][17:20] == "HOH" or \
searchResult[i][0:6] != "HETATM" :
del searchResult[i]
i=i-1
j=j-1
i=i+1
warningMessage = """
WARNING! The PDB-file contains coordinates for none water HETATMs.
If you want to keep the HETATM - prepare the file for Xplor manualy \n"""
warningMessage2 = "\n"+ 80*"-" + "\n"
if len(searchResult) != 0:
self.log.add(warningMessage)
self.log.add("String found in line(s): \n")
for i in range(0,len(searchResult)):
self.log.add(searchResult[i][0:-1])
self.log.add(warningMessage2)
pdb.close()
def _compareSequences( self, seq1, seq2 ):
"""
@param seq1: sequence 1 to compare
@type seq1: str
@param seq2: sequence 1 to compare
@type seq2: str
@return: identity (0.0 - 1.0) between the two sequences
@rtype : float
"""
# compare the 2 sequences
## blast = Blast2Seq( seq1, seq2 )
## id = blast.run()
matcher = SequenceMatcher( None, ''.join(seq1) , ''.join(seq2) )
return matcher.ratio()
def _removeDuplicateChains(self, chainMask=None):
"""
Get rid of identical chains by comparing all chains with Blast2seq.
@param chainMask: chain mask for overriding the
chain identity checking (default: None)
@type chainMask: [int]
@return: number of chains removed
@rtype: int
"""
chainCount = len(self.chains)
matrix = 1.0 * N0.zeros((chainCount,chainCount))
chain_ids = []
## create identity matrix for all chains against all chains
for i in range(0, chainCount):
chain_ids = chain_ids + [self.chains[i].chain_id] # collect for log file
for j in range(i, len(self.chains)):
# convert 3-letter-code res list into 1-letter-code String
seq1 = singleAA( self.chains[i].sequence() )
seq2 = singleAA( self.chains[j].sequence() )
## if len(seq1) > len(seq2): # take shorter sequence
## # aln len at least half the len of the shortest sequence
## alnCutoff = len(seq2) * 0.5
## else:
## alnCutoff = len(seq1) * 0.5
## if id['aln_len'] > alnCutoff:
## matrix[i,j] = id['aln_id']
## else: # aln length too short, ignore
## matrix[i,j] = 0
matrix[i,j] = self._compareSequences( seq1, seq2 )
## report activity
self.log.add("\n Chain ID's of compared chains: "+str(chain_ids))
self.log.add(" Cross-Identity between chains:\n"+str(matrix))
self.log.add(" Identity threshold used: "+str(self.threshold))
## override the automatic chain deletion by supplying a
## chain mask to this function
if chainMask:
if len(chainMask) == chainCount:
self.chains = N0.compress(chainMask, self.chains)
self.log.add("NOTE: chain mask %s used for removing chains.\n"%chainMask)
else:
self.log.add("########## ERROR ###############")
self.log.add("# Chain mask is only %i chains long"%len(chainMask))
self.log.add("# when a mask of length %i is needed"%chainCount)
self.log.add("# No cleaning will be performed.\n")
if not chainMask:
## look at diagonals in "identity matrix"
## (each chain against each)
duplicate = len(self.chains)
for offset in range(1,chainCount):
diag = N0.diagonal(matrix, offset ,0,1)
# diagonal of 1's mark begin of duplicate
avg = 1.0 * N0.sum(diag)/len(diag)
if (avg >= self.threshold):
duplicate = offset
break
self.chains = self.chains[:duplicate]
self.log.add("NOTE: Identity matrix will be used for removing identical chains.")
## report activit
self.log.add(str(chainCount - len(self.chains))+\
" chains have been removed.\n")
# how many chains have been removed?
return (chainCount - len(self.chains))
def _assign_seg_ids(self):
"""
Assign new segment id to each chain.
"""
counter = self.chainIdOffset
for chain in self.chains:
## Assemble segid from pdb code + one letter out of A to Z
chain.segment_id = self.pdbname()[:3] + string.uppercase[counter]
counter = counter + 1
try: # report changed segement ids
chain_id = chain.chain_id
self.log.add("changed segment ID of chain "+chain_id+\
" to "+chain.segment_id)
except:
T.errWriteln("_assign_seg_ids(): logerror")
def _sequentialDist(self, chain, cutoff, atom):
"""
Calculate sequential atom-atom distance, report residues with
longer distance than cutoff (chain break positions).
@param chain: Scientific.IO.PDB.PeptideChain object
@type chain: object
@param cutoff: threshold for reporting gap (chain break)
@type cutoff: float
@param atom: type of atoms to check (i.e. 'CA')
@type atom: str
@return: list of chain break positions (residue index for each
first residue of two that are too distant)
@rtype: list of int
"""
distanceList = []
v0 = Vector( 0,0,0 )
jump = 1
for res in range(0,len(chain)-2):
try:
v1 = Vector(chain[res][atom].position.array)
## ignore CA with 0,0,0 coordinate
if v1 != v0:
jump = 1
v2 = Vector(chain[ res+jump ][atom].position.array)
## look for next CA with non-zero coordinate
while v2 == v0 and jump + res < len( chain ):
jump += 1
v2 = Vector(chain[ res+jump ][atom].position.array)
if (v1 - v2).length() > cutoff * jump:
distanceList = distanceList + [res + jump - 1]
except:
self.log.add(
"_sequentialDist():\nError while checking CA-CA distance"+\
" between residues "+str(chain[res].name)+\
str(chain[res].number)+" and "+\
str(chain[res+jump].name)+\
str(chain[res+jump].number)+ " in chain "+chain.chain_id)
self.log.add("Error: " + T.lastError() )
return distanceList
## def _sequentialDist(self, chain, cutoff, atom):
## """
## Calculate sequential atom-atom distance, report residues with
## longer distance than cutoff (chain break positions).
## chain - PDB.PeptideChain
## cutoff - float, threshold for reporting gap (chain break)
## atom - str, type of atoms to check (i.e. 'CA')
## -> [int, int, ...], list of chain break positions (residue index
## for each first residue of two that are too distant)
## """
## distanceList = []
## for residue in range(0,len(chain)-1):
## # iterate through residue 1 to ter-1
## try:
## vectorAtom1 = Vector(chain[residue][atom].position.array)
## vectorAtom2 = Vector(chain[residue+1][atom].position.array)
## if (vectorAtom1 - vectorAtom2).length() > cutoff:
## distanceList = distanceList + [residue]
## except:
## self.log.add(
## "_sequentialDist():\nError while checking CA-CA distance"+ \
## " between residues "+str(chain[residue].name)+\
## str(chain[residue].number)+" and "+str(chain[residue+1].name)+\
## str(chain[residue+1].number)+ " in chain "+chain.chain_id)
## self.log.add("Error: " + T.lastError() )
## return distanceList
def _separateChainBreaks(self):
"""
Separate chains with breaks into 2 chains.
The new chain(s) is/are added to the internal PDB instance
(self.chains).
"""
fragments = []
for chain in self.chains:
# res number of residues before a break
breaks = self._sequentialDist(chain, 4.5, 'CA')
self.log.add(str(len(breaks)) + " breaks found in chain " +\
"(" + str(len(chain)) \
+ " residues) " + chain.chain_id + ": "+str(breaks))
previous = 0
ncap_next = 0
for breakRes in breaks:
residues = chain.residues[previous:breakRes+1]
previous = breakRes + 1
chainNew = PeptideChain(residues, chain.chain_id,
chain.segment_id)
if ncap_next:
self.__nCap( chainNew )
ncap_next = 0
if self.capBreaks:
## add N-Methyl to c terminal
self.__cCap( chainNew )
ncap_next = 1
fragments = fragments + [chainNew]
chainNew = PeptideChain(chain.residues[previous:], chain.chain_id,
chain.segment_id)
if ncap_next:
self.__nCap( chainNew )
fragments = fragments + [chainNew]
self.chains = fragments
def __nCap( self, pep_chain ):
"""
Add acetyl capping to N-terminal of peptide chain
"""
n = (pep_chain[0].number or 1) - 1
r = AminoAcidResidue('ACE', number=n, atoms=[Atom('CA', Vector(0,0,0),
element='C')])
pep_chain.residues = [r] + pep_chain.residues
self.log.add('Capping chain break with ACE %i' % n)
def __cCap( self, pep_chain ):
"""
Add methyle amine capping to C-terminal of peptide chain
"""
n = (pep_chain[-1].number or len(pep_chain)) + 1
r = AminoAcidResidue('NME', number=n, atoms=[Atom('CA', Vector(0,0,0),
element='C')])
pep_chain.residues = pep_chain.residues + [r]
self.log.add('Capping chain break at with NME %i' % n)
def extractWaters(self):
"""
Write waters into separate pdb file, called |pdbCode|_waters.pdb.
"""
try:
fTarget = self.outPath + '/' +\
self.pdbname()[:4] + '_waters.pdb'
pdb = PDBFile( fTarget, mode='w' )
waters = []
for key in ['HOH', 'DOD']:
if self.pdb.molecules.has_key( key ):
waters += self.pdb.molecules[ key ]
pdb.nextChain(chain_id='', segment_id='1XWW')
for w in waters:
pdb.nextResidue('TIP3')
## XPLOR wants "ATOM" not "HETATM":
pdb.het_flag = 0
pdb.writeAtom('OH2', w.atoms['O'].position)
## keep TIP3 waters as well
if len(waters) == 0:
try:
TIP3_waters = self.pdb.molecules[ 'TIP3' ]
except:
TIP3_waters = []
for w in TIP3_waters:
pdb.nextResidue('TIP3')
## XPLOR wants "ATOM" not "HETATM":
pdb.het_flag = 0
pdb.writeAtom('OH2', w.atoms['OH2'].position)
pdb.writeAtom('H1', w.atoms['H1'].position)
pdb.writeAtom('H2', w.atoms['H2'].position)
pdb.close()
except:
T.errWriteln("Error writing waters to %s: " % fTarget )
T.errWriteln( T.lastError() )
def next(self):
"""
Return next 'clean', non-redundant, non-broken chain from PDB
@return: Scientific.IO.PDB.PeptideChain, completed chain OR
if no chain is left
@rtype: chain object OR None
"""
self.counter = self.counter + 1
if (len(self.chains) > self.counter):
return self.chains[self.counter]
else:
return None
#############
## TESTING
#############
import Biskit.test as BT
class Test(BT.BiskitTest):
"""Test ChainSeparator """
def prepare(self):
self.fname = T.testRoot() + '/com/1BGS_original.pdb'
self.outPath = T.tempDir()
def cleanUp(self):
T.tryRemove( self.sep.log.fname )
def test_ChainSeparator( self ):
"""ChainSeparator test"""
self.sep = ChainSeparator( self.fname, self.outPath, 1)
self.chain = self.sep.next()
i=1
all_chains = []
while self.chain <> None:
if self.local:
print 'Chain %i:'%i, ''.join(singleAA(self.chain.sequence() ) )
all_chains += self.chain.sequence()
self.chain = self.sep.next()
i += 1
if self.local:
print 'ChainSeparator log file written to: %s'%self.sep.log.fname
r = ''.join( singleAA( all_chains ) )
self.assertEqual(r, self.EXPECTED)
EXPECTED='AQVINTFDGVADYLQTYHKLPDNYITKSEAQALGWVASKGNLADVAPGKSIGGDIFSNREGKLPGKSGRTWREADINYTSGFRNSDRILYSSDWLIYKTTDHYQTFTKIRAQVINTFDGVADYLQTYHKLPDNYITKSEAQALGWVASKGNLADVAPGKSIGGDIFSNREGKLPGKSGRTWREADINYTSGFRNSDRILYSSDWLIYKTTDHYQTFTKIRAQVINTFDGVADYLQTYHKLPDNYITKSEAQALGWVASKGNLADVAPGKSIGGDIFSNREGKLPGKSGRTWREADINYTSGFRNSDRILYSSDWLIYKTTDHYQTFTKIRKKAVINGEQIRSISDLHQTLKKELALPEYYGENLDALWDALTGWVEYPLVLEWRQFEQSKQLTENGAESVLQVFREAKAEGADITIILSKKAVINGEQIRSISDLHQTLKKELALPEYYGENLDALWDALTGWVEYPLVLEWRQFEQSKQLTENGAESVLQVFREAKAEGADITIILSKKAVINGEQIRSISDLHQTLKKELALPEYYGENLDALWDALTGWVEYPLVLEWRQFEQSKQLTENGAESVLQVFREAKAEGADITIILS'
if __name__ == '__main__':
BT.localTest()
|
"""
This module provides utility functions for the Scan Op
See scan.py for details on scan
"""
from __future__ import print_function
__docformat__ = 'restructedtext en'
__authors__ = ("Razvan Pascanu "
"Frederic Bastien "
"James Bergstra "
"Pascal Lamblin "
"Arnaud Bergeron")
__copyright__ = "(c) 2010, Universite de Montreal"
__contact__ = "Razvan Pascanu <r.pascanu@gmail>"
import copy
import logging
import warnings
import numpy
from six.moves import xrange
import theano
from theano.compat import izip
from theano.compile.pfunc import rebuild_collect_shared
from theano import gof
from theano import tensor, scalar
from theano.tensor.basic import get_scalar_constant_value
# Logging function for sending warning or info
_logger = logging.getLogger('theano.scan_utils')
def expand(tensor_var, size):
"""
Given ``tensor_var``, a Theano tensor of shape (d1, d2, ..), this
function constructs a rval Theano tensor of shape (d1 + size, d2, ..)
filled with 0s, except the first d1 entries which are taken from
``tensor_var``, namely:
rval[:d1] = tensor_var
:param tensor_var: Theano tensor variable
:param size: int
"""
# Corner case that I might use in an optimization
if size == 0:
return tensor_var
shapes = [tensor_var.shape[x] for x in xrange(tensor_var.ndim)]
zeros_shape = [size + shapes[0]] + shapes[1:]
empty = tensor.zeros(zeros_shape,
dtype=tensor_var.dtype)
return tensor.set_subtensor(empty[:shapes[0]], tensor_var)
def to_list(ls):
"""
Converts ``ls`` to list if it is a tuple, or wraps ``ls`` into a list if
it is not a list already
"""
if isinstance(ls, (list, tuple)):
return list(ls)
else:
return [ls]
class until(object):
"""
Theano can end on a condition. In order to differentiate this condition
from the other outputs of scan, this class is used to wrap the condition
around it.
"""
def __init__(self, condition):
self.condition = tensor.as_tensor_variable(condition)
assert self.condition.ndim == 0
def get_updates_and_outputs(ls):
"""
Parses the list ``ls`` into outputs and updates. The semantics
of ``ls`` is defined by the constructive function of scan.
The elemets of ``ls`` are either a list of expressions representing the
outputs/states, a dictionary of updates or a condition.
"""
def is_list_outputs(elem):
if (isinstance(elem, (list, tuple)) and
all([isinstance(x, theano.Variable) for x in elem])):
return True
if isinstance(elem, theano.Variable):
return True
return False
def is_updates(elem):
if isinstance(elem, dict):
return True
# Dictionaries can be given as lists of tuples
if (isinstance(elem, (list, tuple)) and
all([isinstance(x, (list, tuple)) and len(x) == 2
for x in elem])):
return True
return False
def is_condition(elem):
return isinstance(elem, until)
if is_list_outputs(ls):
return None, to_list(ls), {}
if is_updates(ls):
return None, [], dict(ls)
if not isinstance(ls, (list, tuple)):
raise ValueError(('Scan can not parse the return value'
' of your constructive function given to scan'))
ls = list(ls)
deprecation_msg = ('The return value of the lambda function'
' has been restricted. you have to always return first the'
' outputs (if any), afterwards the updates (if any) and'
' at the end the condition')
error_msg = ('Scan can not parse the return value of your constructive '
'funtion given to scan')
if len(ls) == 2:
if is_list_outputs(ls[0]):
if is_updates(ls[1]):
return (None, to_list(ls[0]), dict(ls[1]))
elif is_condition(ls[1]):
return (ls[1].condition, to_list(ls[0]), {})
else:
raise ValueError(error_msg)
elif is_updates(ls[0]):
if is_outputs(ls[1]):
raise ValueError(deprecation_msg)
elif is_condition(ls[1]):
return (ls[1].condition, [], dict(ls[0]))
else:
raise ValueError(error_msg)
else:
raise ValueError(error_msg)
elif len(ls) == 3:
if is_outputs(ls[0]):
if is_updates(ls[1]):
if is_condition(ls[2]):
return (ls[2].condition, to_list(ls[0]), dict(ls[1]))
else:
raise ValueError(error_msg)
else:
raise ValueError(error_msg)
else:
raise ValueError(error_msg)
def clone(output, replace=None, strict=True, share_inputs=True):
"""
Function that allows replacing subgraphs of a computational
graph. It returns a copy of the initial subgraph with the corresponding
substitutions.
:type output: Theano Variables (or Theano expressions)
:param outputs: Theano expression that represents the computational
graph
:type replace: dict
:param replace: dictionary describing which subgraphs should be
replaced by what
:type share_inputs: bool
:param share_inputs: If True, use the same inputs (and shared variables)
as the original graph. If False, clone them. Note that cloned
shared variables still use the same underlying storage, so they
will always have the same value.
"""
inps, outs, other_stuff = rebuild_collect_shared(output,
[],
replace,
[],
strict,
share_inputs)
return outs
def canonical_arguments(sequences,
outputs_info,
non_sequences,
go_backwards,
n_steps):
"""
This re-writes the arguments obtained from scan into a more friendly
form for the scan_op.
Mainly it makes sure that arguments are given as lists of dictionaries,
and that the different fields of of a dictionary are set to default
value if the user has not provided any.
"""
states_info = to_list(outputs_info)
parameters = [tensor.as_tensor_variable(x) for x in to_list(non_sequences)]
inputs = []
if n_steps is not None:
negative_n_steps = tensor.lt(tensor.as_tensor_variable(n_steps), 0)
for input in to_list(sequences):
if not isinstance(input, dict):
nw_input = tensor.as_tensor_variable(input)
if go_backwards:
nw_input = nw_input[::-1]
if n_steps is not None:
nw_input = tensor.switch(negative_n_steps, nw_input[::-1],
nw_input)
inputs.append(tensor.as_tensor_variable(nw_input))
elif input.get('taps', True) is None:
nw_input = tensor.as_tensor_variable(input['input'])
if go_backwards:
nw_input = nw_input[::-1]
if n_steps is not None:
nw_input = tensor.switch(negative_n_steps, nw_input[::-1],
nw_input)
inputs.append(nw_input)
elif input.get('taps', None):
mintap = numpy.min(input['taps'])
maxtap = numpy.max(input['taps'])
orig_input = tensor.as_tensor_variable(input['input'])
if go_backwards:
orig_input = orig_input[::-1]
if n_steps is not None:
orig_input = tensor.switch(negative_n_steps, orig_input[::-1],
orig_input)
for k in input['taps']:
# We cut the sequence such that seq[i] to correspond to
# seq[i-k]
if maxtap < 0:
offset_max = abs(maxtap)
else:
offset_max = 0
if mintap < 0:
offset_min = abs(mintap)
else:
offset_min = 0
nw_input = orig_input
if maxtap == mintap and maxtap != 0:
if maxtap > 0:
nw_input = nw_input[maxtap:]
else:
nw_input = nw_input[:maxtap]
else:
st = k + offset_min
if maxtap > 0:
ed = - (maxtap + offset_min - st)
else:
ed = - (offset_min - st)
if ed != 0:
nw_input = nw_input[st:ed]
else:
nw_input = nw_input[st:]
inputs.append(nw_input)
else:
raise ValueError('Provided sequence makes no sense', str(input))
# Since we've added all sequences now we need to level them up based on
# n_steps or their different shapes
if n_steps is None:
if len(inputs) == 0:
# No information about the number of steps
raise ValueError('You need to provide either at least '
'one sequence over which scan should loop '
'or a number of steps for scan to loop. '
'Neither of the two had been provided !')
T = inputs[0].shape[0]
for input in inputs[1:]:
T = tensor.minimum(T, input.shape[0])
else:
T = abs(tensor.as_tensor(n_steps))
# Level up sequences
inputs = [input[:T] for input in inputs]
# wrap outputs info in a dictionary if they are not already in one
for i, state in enumerate(states_info):
if state is not None and not isinstance(state, dict):
states_info[i] = dict(initial=tensor.as_tensor_variable(state),
taps=[-1])
elif isinstance(state, dict):
if not state.get('initial', None) and state.get('taps', None):
raise ValueError(('If you are using slices of an output '
'you need to provide a initial state '
'for it'), state)
elif state.get('initial', None) and not state.get('taps', None):
# initial state but taps not provided
if 'taps' in state:
# explicitly provided a None for taps
_logger.warning(
('Output %s ( index %d) has a initial '
'state but taps is explicitly set to None '),
getattr(states_info[i]['initial'], 'name', 'None'), i)
states_info[i]['taps'] = [-1]
states_info[i]['initial'] = \
tensor.as_tensor_variable(state['initial'])
elif state.get('initial', None):
states_info[i]['initial'] = \
tensor.as_tensor_variable(state['initial'])
else:
# if a None is provided as the output info we replace it
# with an empty dict() to simplify handling
states_info[i] = dict()
return inputs, states_info, parameters, T
def infer_shape(outs, inputs, input_shapes):
'''
Compute the shape of the outputs given the shape of the inputs
of a theano graph.
We do it this way to avoid compiling the inner function just to get
the shape. Changes to ShapeFeature could require changes in this function.
'''
# We use a ShapeFeature because it has all the necessary logic
# inside. We don't use the full ShapeFeature interface, but we
# let it initialize itself with an empty fgraph, otherwise we will
# need to do it manually
for inp, inp_shp in izip(inputs, input_shapes):
if inp_shp is not None and len(inp_shp) != inp.ndim:
assert len(inp_shp) == inp.ndim
shape_feature = tensor.opt.ShapeFeature()
shape_feature.on_attach(theano.gof.FunctionGraph([], []))
# Initialize shape_of with the input shapes
for inp, inp_shp in izip(inputs, input_shapes):
shape_feature.set_shape(inp, inp_shp)
def local_traverse(out):
'''
Go back in the graph, from out, adding computable shapes to shape_of.
'''
if out in shape_feature.shape_of:
# Its shape is already known
return
elif out.owner is None:
# This is an input of the graph
shape_feature.init_r(out)
else:
# Recurse over inputs
for inp in out.owner.inputs:
if not inp in shape_feature.shape_of:
local_traverse(inp)
# shape_feature.on_import does not actually use an fgraph
# It will call infer_shape and set_shape appropriately
dummy_fgraph = None
shape_feature.on_import(dummy_fgraph, out.owner, reason="dummy")
ret = []
for o in outs:
local_traverse(o)
ret.append(shape_feature.shape_of[o])
return ret
def allocate_memory(T, y_info, y):
"""
Allocates memory for an output of scan.
:param T: scalar
Variable representing the number of steps scan will run
:param y_info: dict
Dictionary describing the output (more specifically describing shape
information for the output
:param y: Tensor variable
Expression describing the computation resulting in out entry of y.
It can be used to infer the shape of y
"""
if 'shape' in y_info:
return tensor.zeros([T, ] + list(y_info['shape']),
dtype=y.dtype)
else:
inputs = gof.graph.inputs([y])
ins_shapes = []
for inp in inputs:
in_shape = [inp.shape[k] for k in xrange(inp.ndim)]
ins_shapes.append(in_shape)
shape = infer_shape([y], inputs, ins_shapes)[0]
return tensor.zeros([T, ] + shape, dtype=y.dtype)
class ScanPermutation(gof.Op):
def __init__(self, mintap=0, inplace=False):
self.inplace = inplace
self.mintap = mintap
if inplace:
self.destroy_map = {0: [0]}
def __eq__(self, other):
return type(self) == type(other) and self.inplace == other.inplace
def __hash__(self):
return hash(type(self)) ^ hash(self.inplace)
def __str__(self):
if self.inplace:
return "scan_permutation{inplace}"
else:
return "scan_permutation"
def make_node(self, membuffer, index):
# index has to be a scalar
assert index.ndim == 0
# we neeed at least one dimension
assert membuffer.ndim > 0
return gof.Apply(self, [membuffer, index], [membuffer.type()])
def perform(self, node, inputs, outputs):
membuffer = inputs[0]
index = inputs[1] + self.mintap
out = outputs[0]
if index % membuffer.shape[0] == 0:
if self.inplace:
out[0] = membuffer
else:
out[0] = membuffer.copy()
else:
pos = index % membuffer.shape[0]
if outputs[0] is membuffer:
membuffer = membuffer.copy()
print(pos)
out[0][:membuffer.shape[0] - pos] = membuffer[pos:]
out[0][membuffer.shape[0] - pos:] = membuffer[:pos]
def R_op(self, inputs, eval_points):
if eval_points[0] is None:
return [None]
return self.make_node(eval_points[0], inputs[1]).outputs
def grad(self, inputs, grads):
pos = inputs[0].shape[0] - (inputs[1] % inputs[0].shape[0])
return self.make_node(grads[0], pos).outputs
|
# Generated by Django 2.1.2 on 2019-02-25 03:13
from django.db import migrations, models
import django.db.models.deletion
import economy.models
class Migration(migrations.Migration):
dependencies = [
('grants', '0013_subscription_amount_per_period_usdt'),
]
operations = [
migrations.CreateModel(
name='MatchPledge',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_on', models.DateTimeField(db_index=True, default=economy.models.get_time)),
('modified_on', models.DateTimeField(default=economy.models.get_time)),
('active', models.BooleanField(default=False, help_text='Whether or not the MatchingPledge is active.')),
('amount', models.DecimalField(decimal_places=4, default=1, help_text='The matching pledge amount in DAI.', max_digits=50)),
('comments', models.TextField(blank=True, default='', help_text='The comments.')),
('profile', models.ForeignKey(help_text='The MatchingPledgers profile.', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='matchPledges', to='dashboard.Profile')),
],
options={
'abstract': False,
},
),
]
|
# -*- coding: utf-8 -*-
from __future__ import print_function
from os import sys
import numpy as np
try:
from skbuild import setup
except ImportError:
print('scikit-build is required to build from source.', file=sys.stderr)
print('Please run:', file=sys.stderr)
print('', file=sys.stderr)
print(' python -m pip install scikit-build')
sys.exit(1)
setup(
name='itk-tubetk',
version='0.9.0',
author='Stephen R. Aylward',
author_email='stephen.aylward@kitware.com',
include_dirs=[np.get_include()],
packages=['itk'],
package_dir={'itk': 'itk'},
download_url=r'https://github.com/InsightSoftwareConsortium/ITKTubeTK',
description=r'An open-source toolkit, led by Kitware, Inc., for the segmentation, registration, and analysis of tubes and surfaces in images.',
long_description='TubeTK is an open-source toolkit for the segmentation, registration, and analysis of tubes and surfaces in images.',
classifiers=[
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: C++",
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Healthcare Industry",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Medical Science Apps.",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Software Development :: Libraries",
"Operating System :: Android",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: Unix",
"Operating System :: MacOS"
],
license='Apache',
keywords='ITK InsightToolkit',
url=r'https://itk.org/',
install_requires=[
r'itk>=5.2.0.post2',
r'itk-minimalpathextraction>=1.2.0'
]
)
|
# coding=utf-8
"""
.. module:: wolk
This module provides connection to WolkAbout IoT Platform.
To start publishing data to the platform
create an instance of Device class with credentials obtained from the platform
and pass it to an instance of WolkConnect class.
For more information about module features visit:
https://github.com/Wolkabout/WolkConnect-Python/tree/master/examples/full_feature_set
"""
from .models.ActuatorCommand import ActuatorCommand
from .models.ActuatorCommandType import ActuatorCommandType
from .models.ActuatorState import ActuatorState
from .models.ActuatorStatus import ActuatorStatus
from .models.Alarm import Alarm
from .models.ConfigurationCommand import ConfigurationCommand
from .models.ConfigurationCommandType import ConfigurationCommandType
from .models.Device import Device
from .models.FileTransferPacket import FileTransferPacket
from .models.FirmwareCommand import FirmwareCommand
from .models.FirmwareCommandType import FirmwareCommandType
from .models.FirmwareErrorType import FirmwareErrorType
from .models.FirmwareStatus import FirmwareStatus
from .models.FirmwareStatusType import FirmwareStatusType
from .models.FirmwareUpdateStateType import FirmwareUpdateStateType
from .models.InboundMessage import InboundMessage
from .models.OutboundMessage import OutboundMessage
from .models.Protocol import Protocol
from .models.SensorReading import SensorReading
from .interfaces.ActuationHandler import ActuationHandler
from .interfaces.ActuatorStatusProvider import ActuatorStatusProvider
from .interfaces.ConfigurationHandler import ConfigurationHandler
from .interfaces.ConfigurationProvider import ConfigurationProvider
from .interfaces.ConnectivityService import ConnectivityService
from .interfaces.FirmwareInstaller import FirmwareInstaller
from .interfaces.FirmwareURLDownloadHandler import FirmwareURLDownloadHandler
from .interfaces.InboundMessageDeserializer import InboundMessageDeserializer
from .interfaces.OutboundMessageFactory import OutboundMessageFactory
from .interfaces.OutboundMessageQueue import OutboundMessageQueue
from .FileSystemFirmwareHandler import FileSystemFirmwareHandler
from .LoggerFactory import logging_config
from .WolkConnect import WolkConnect
__all__ = [
"ActuatorCommand",
"ActuatorCommandType",
"ActuatorState",
"ActuatorStatus",
"Alarm",
"ConfigurationCommand",
"ConfigurationCommandType",
"Device",
"FileTransferPacket",
"FirmwareCommand",
"FirmwareCommandType",
"FirmwareErrorType",
"FirmwareStatus",
"FirmwareStatusType",
"FirmwareUpdateStateType",
"InboundMessage",
"OutboundMessage",
"Protocol",
"SensorReading",
"ActuationHandler",
"ActuatorStatusProvider",
"ConfigurationHandler",
"ConfigurationProvider",
"ConnectivityService",
"FileSystemFirmwareHandler",
"FirmwareInstaller",
"FirmwareURLDownloadHandler",
"logging_config",
"InboundMessageDeserializer",
"OutboundMessageFactory",
"OutboundMessageQueue",
"WolkConnect",
]
|
from validx import Dict, List
from .protos import DataObject
from .palette import Palette
from .utils.parser import BinaryParser
from .utils.validator import UInt8
from .utils.types import Remappings, Remapping
class PaletteMapping(DataObject):
__slots__ = (
"colors",
"remaps",
)
schema = Dict({"colors": Palette.schema, "remaps": List(List(UInt8))})
def __init__(self):
self.colors: Palette = Palette()
self.remaps: Remappings = []
def remap(self, remap_id: int) -> Palette:
return self.colors.remap(self.remaps[remap_id])
def read(self, parser: BinaryParser):
self.colors = Palette().read(parser)
for k in range(0, 19):
remap: Remapping = []
for m in range(0, 256):
remap.append(parser.get_uint8())
self.remaps.append(remap)
return self
def write(self, parser):
self.colors.write(parser)
for k in range(0, 19):
for m in range(0, 256):
parser.put_uint8(self.remaps[k][m])
def serialize(self) -> dict:
return {"colors": self.colors.serialize(), "remaps": self.remaps}
def unserialize(self, data: dict):
self.colors = Palette().unserialize(data["colors"])
self.remaps = data["remaps"]
return self
|
# coding=utf-8
"""
The Collector class is a base class for all metric collectors.
"""
import os
import socket
import platform
import logging
import configobj
import time
import re
import subprocess
import signal
from diamond.metric import Metric
from diamond.utils.config import load_config
from error import DiamondException
# Detect the architecture of the system and set the counters for MAX_VALUES
# appropriately. Otherwise, rolling over counters will cause incorrect or
# negative values.
if platform.architecture()[0] == '64bit':
MAX_COUNTER = (2 ** 64) - 1
else:
MAX_COUNTER = (2 ** 32) - 1
def get_hostname(config, method=None):
"""
Returns a hostname as configured by the user
"""
method = method or config.get('hostname_method', 'smart')
# case insensitive method
method = method.lower()
if 'hostname' in config and method != 'shell':
return config['hostname']
if method in get_hostname.cached_results:
return get_hostname.cached_results[method]
if method == 'shell':
if 'hostname' not in config:
raise DiamondException(
"hostname must be set to a shell command for"
" hostname_method=shell")
else:
proc = subprocess.Popen(config['hostname'],
shell=True,
stdout=subprocess.PIPE)
hostname = proc.communicate()[0].strip()
if proc.returncode != 0:
raise subprocess.CalledProcessError(proc.returncode,
config['hostname'])
get_hostname.cached_results[method] = hostname
return hostname
if method == 'smart':
hostname = get_hostname(config, 'fqdn_short')
if hostname != 'localhost':
get_hostname.cached_results[method] = hostname
return hostname
hostname = get_hostname(config, 'hostname_short')
get_hostname.cached_results[method] = hostname
return hostname
if method == 'fqdn_short':
hostname = socket.getfqdn().split('.')[0]
get_hostname.cached_results[method] = hostname
if hostname == '':
raise DiamondException('Hostname is empty?!')
return hostname
if method == 'fqdn':
hostname = socket.getfqdn().replace('.', '_')
get_hostname.cached_results[method] = hostname
if hostname == '':
raise DiamondException('Hostname is empty?!')
return hostname
if method == 'fqdn_rev':
hostname = socket.getfqdn().split('.')
hostname.reverse()
hostname = '.'.join(hostname)
get_hostname.cached_results[method] = hostname
if hostname == '':
raise DiamondException('Hostname is empty?!')
return hostname
if method == 'uname_short':
hostname = os.uname()[1].split('.')[0]
get_hostname.cached_results[method] = hostname
if hostname == '':
raise DiamondException('Hostname is empty?!')
return hostname
if method == 'uname_rev':
hostname = os.uname()[1].split('.')
hostname.reverse()
hostname = '.'.join(hostname)
get_hostname.cached_results[method] = hostname
if hostname == '':
raise DiamondException('Hostname is empty?!')
return hostname
if method == 'hostname':
hostname = socket.gethostname()
get_hostname.cached_results[method] = hostname
if hostname == '':
raise DiamondException('Hostname is empty?!')
return hostname
if method == 'hostname_short':
hostname = socket.gethostname().split('.')[0]
get_hostname.cached_results[method] = hostname
if hostname == '':
raise DiamondException('Hostname is empty?!')
return hostname
if method == 'hostname_rev':
hostname = socket.gethostname().split('.')
hostname.reverse()
hostname = '.'.join(hostname)
get_hostname.cached_results[method] = hostname
if hostname == '':
raise DiamondException('Hostname is empty?!')
return hostname
if method == 'none':
get_hostname.cached_results[method] = None
return None
raise NotImplementedError(config['hostname_method'])
get_hostname.cached_results = {}
def str_to_bool(value):
"""
Converts string truthy/falsey strings to a bool
Empty strings are false
"""
if isinstance(value, basestring):
value = value.strip().lower()
if value in ['true', 't', 'yes', 'y']:
return True
elif value in ['false', 'f', 'no', 'n', '']:
return False
else:
raise NotImplementedError("Unknown bool %s" % value)
return value
class Collector(object):
"""
The Collector class is a base class for all metric collectors.
"""
def __init__(self, config=None, handlers=[], name=None, configfile=None):
"""
Create a new instance of the Collector class
"""
# Initialize Logger
self.log = logging.getLogger('diamond')
# Initialize Members
if name is None:
self.name = self.__class__.__name__
else:
self.name = name
# Reset signal handlers of forks/threads
signal.signal(signal.SIGINT, signal.SIG_DFL)
signal.signal(signal.SIGTERM, signal.SIG_DFL)
self.handlers = handlers
self.last_values = {}
self.configfile = None
self.load_config(configfile, config)
def load_config(self, configfile=None, override_config=None):
"""
Process a configfile, or reload if previously given one.
"""
self.config = configobj.ConfigObj()
# Load in the collector's defaults
if self.get_default_config() is not None:
self.config.merge(self.get_default_config())
if configfile is not None:
self.configfile = os.path.abspath(configfile)
if self.configfile is not None:
config = load_config(self.configfile)
if 'collectors' in config:
if 'default' in config['collectors']:
self.config.merge(config['collectors']['default'])
if self.name in config['collectors']:
self.config.merge(config['collectors'][self.name])
if override_config is not None:
if 'collectors' in override_config:
if 'default' in override_config['collectors']:
self.config.merge(override_config['collectors']['default'])
if self.name in override_config['collectors']:
self.config.merge(override_config['collectors'][self.name])
self.process_config()
def process_config(self):
"""
Intended to put any code that should be run after any config reload
event
"""
if 'byte_unit' in self.config:
if isinstance(self.config['byte_unit'], basestring):
self.config['byte_unit'] = self.config['byte_unit'].split()
if 'enabled' in self.config:
self.config['enabled'] = str_to_bool(self.config['enabled'])
if 'measure_collector_time' in self.config:
self.config['measure_collector_time'] = str_to_bool(
self.config['measure_collector_time'])
# Raise an error if both whitelist and blacklist are specified
if ((self.config.get('metrics_whitelist', None) and
self.config.get('metrics_blacklist', None))):
raise DiamondException(
'Both metrics_whitelist and metrics_blacklist specified ' +
'in file %s' % self.configfile)
if self.config.get('metrics_whitelist', None):
self.config['metrics_whitelist'] = re.compile(
self.config['metrics_whitelist'])
elif self.config.get('metrics_blacklist', None):
self.config['metrics_blacklist'] = re.compile(
self.config['metrics_blacklist'])
def get_default_config_help(self):
"""
Returns the help text for the configuration options for this collector
"""
return {
'enabled': 'Enable collecting these metrics',
'byte_unit': 'Default numeric output(s)',
'measure_collector_time': 'Collect the collector run time in ms',
'metrics_whitelist': 'Regex to match metrics to transmit. ' +
'Mutually exclusive with metrics_blacklist',
'metrics_blacklist': 'Regex to match metrics to block. ' +
'Mutually exclusive with metrics_whitelist',
}
def get_default_config(self):
"""
Return the default config for the collector
"""
return {
# Defaults options for all Collectors
# Uncomment and set to hardcode a hostname for the collector path
# Keep in mind, periods are seperators in graphite
# 'hostname': 'my_custom_hostname',
# If you perfer to just use a different way of calculating the
# hostname
# Uncomment and set this to one of these values:
# fqdn_short = Default. Similar to hostname -s
# fqdn = hostname output
# fqdn_rev = hostname in reverse (com.example.www)
# uname_short = Similar to uname -n, but only the first part
# uname_rev = uname -r in reverse (com.example.www)
# 'hostname_method': 'fqdn_short',
# All collectors are disabled by default
'enabled': False,
# Path Prefix
'path_prefix': 'servers',
# Path Prefix for Virtual Machine metrics
'instance_prefix': 'instances',
# Path Suffix
'path_suffix': '',
# Default Poll Interval (seconds)
'interval': 300,
# Default Event TTL (interval multiplier)
'ttl_multiplier': 2,
# Default numeric output
'byte_unit': 'byte',
# Collect the collector run time in ms
'measure_collector_time': False,
# Whitelist of metrics to let through
'metrics_whitelist': None,
# Blacklist of metrics to let through
'metrics_blacklist': None,
}
def get_metric_path(self, name, instance=None):
"""
Get metric path.
Instance indicates that this is a metric for a
virtual machine and should have a different
root prefix.
"""
if 'path' in self.config:
path = self.config['path']
else:
path = self.__class__.__name__
if instance is not None:
if 'instance_prefix' in self.config:
prefix = self.config['instance_prefix']
else:
prefix = 'instances'
if path == '.':
return '.'.join([prefix, instance, name])
else:
return '.'.join([prefix, instance, path, name])
if 'path_prefix' in self.config:
prefix = self.config['path_prefix']
else:
prefix = 'systems'
if 'path_suffix' in self.config:
suffix = self.config['path_suffix']
else:
suffix = None
hostname = get_hostname(self.config)
if hostname is not None:
if prefix:
prefix = ".".join((prefix, hostname))
else:
prefix = hostname
# if there is a suffix, add after the hostname
if suffix:
prefix = '.'.join((prefix, suffix))
is_path_invalid = path == '.' or not path
if is_path_invalid and prefix:
return '.'.join([prefix, name])
elif prefix:
return '.'.join([prefix, path, name])
elif is_path_invalid:
return name
else:
return '.'.join([path, name])
def get_hostname(self):
return get_hostname(self.config)
def collect(self):
"""
Default collector method
"""
raise NotImplementedError()
def publish(self, name, value, raw_value=None, precision=0,
metric_type='GAUGE', instance=None):
"""
Publish a metric with the given name
"""
# Check whitelist/blacklist
if self.config['metrics_whitelist']:
if not self.config['metrics_whitelist'].match(name):
return
elif self.config['metrics_blacklist']:
if self.config['metrics_blacklist'].match(name):
return
# Get metric Path
path = self.get_metric_path(name, instance=instance)
# Get metric TTL
ttl = float(self.config['interval']) * float(
self.config['ttl_multiplier'])
# Create Metric
try:
metric = Metric(path, value, raw_value=raw_value, timestamp=None,
precision=precision, host=self.get_hostname(),
metric_type=metric_type, ttl=ttl)
except DiamondException:
self.log.error(('Error when creating new Metric: path=%r, '
'value=%r'), path, value)
raise
# Publish Metric
self.publish_metric(metric)
def publish_metric(self, metric):
"""
Publish a Metric object
"""
# Process Metric
for handler in self.handlers:
handler._process(metric)
def publish_gauge(self, name, value, precision=0, instance=None):
return self.publish(name, value, precision=precision,
metric_type='GAUGE', instance=instance)
def publish_counter(self, name, value, precision=0, max_value=0,
time_delta=True, interval=None, allow_negative=False,
instance=None):
raw_value = value
value = self.derivative(name, value, max_value=max_value,
time_delta=time_delta, interval=interval,
allow_negative=allow_negative,
instance=instance)
return self.publish(name, value, raw_value=raw_value,
precision=precision, metric_type='COUNTER',
instance=instance)
def derivative(self, name, new, max_value=0,
time_delta=True, interval=None,
allow_negative=False, instance=None):
"""
Calculate the derivative of the metric.
"""
# Format Metric Path
path = self.get_metric_path(name, instance=instance)
if path in self.last_values:
old = self.last_values[path]
# Check for rollover
if new < old:
old = old - max_value
# Get Change in X (value)
derivative_x = new - old
# If we pass in a interval, use it rather then the configured one
if interval is None:
interval = float(self.config['interval'])
# Get Change in Y (time)
if time_delta:
derivative_y = interval
else:
derivative_y = 1
result = float(derivative_x) / float(derivative_y)
if result < 0 and not allow_negative:
result = 0
else:
result = 0
# Store Old Value
self.last_values[path] = new
# Return result
return result
def _run(self):
"""
Run the collector unless it's already running
"""
try:
start_time = time.time()
# Collect Data
self.collect()
end_time = time.time()
collector_time = int((end_time - start_time) * 1000)
self.log.debug('Collection took %s ms', collector_time)
if 'measure_collector_time' in self.config:
if self.config['measure_collector_time']:
metric_name = 'collector_time_ms'
metric_value = collector_time
self.publish(metric_name, metric_value)
finally:
# After collector run, invoke a flush
# method on each handler.
for handler in self.handlers:
handler._flush()
def find_binary(self, binary):
"""
Scan and return the first path to a binary that we can find
"""
if os.path.exists(binary):
return binary
# Extract out the filename if we were given a full path
binary_name = os.path.basename(binary)
# Gather $PATH
search_paths = os.environ['PATH'].split(':')
# Extra paths to scan...
default_paths = [
'/usr/bin',
'/bin'
'/usr/local/bin',
'/usr/sbin',
'/sbin'
'/usr/local/sbin',
]
for path in default_paths:
if path not in search_paths:
search_paths.append(path)
for path in search_paths:
if os.path.isdir(path):
filename = os.path.join(path, binary_name)
if os.path.exists(filename):
return filename
return binary
class ProcessCollector(Collector):
"""
Collector with helpers for handling running commands with/without sudo
"""
def get_default_config_help(self):
config_help = super(ProcessCollector, self).get_default_config_help()
config_help.update({
'use_sudo': 'Use sudo?',
'sudo_cmd': 'Path to sudo',
})
return config_help
def get_default_config(self):
"""
Returns the default collector settings
"""
config = super(ProcessCollector, self).get_default_config()
config.update({
'use_sudo': False,
'sudo_cmd': self.find_binary('/usr/bin/sudo'),
})
return config
def run_command(self, args):
if 'bin' not in self.config:
raise Exception('config does not have any binary configured')
if not os.access(self.config['bin'], os.X_OK):
raise Exception('%s is not executable' % self.config['bin'])
try:
command = args
command.insert(0, self.config['bin'])
if str_to_bool(self.config['use_sudo']):
command.insert(0, self.config['sudo_cmd'])
return subprocess.Popen(command,
stdout=subprocess.PIPE).communicate()
except OSError:
self.log.exception("Unable to run %s", command)
return None
|
import intmaniac
from intmaniac import output
from intmaniac.output.teamcity import TeamcityOutput
from intmaniac.output.base import GenericOutput
from tests.mocksetup import *
from tests.configsetup import *
import unittest
class TestOutput(unittest.TestCase):
def test_init_output_exception(self):
with self.assertRaises(ImportError):
output.init_output("blah")
def test_init_output_function(self):
output.init_output("teamcity")
self.assertIsInstance(output.output, TeamcityOutput)
@unittest.skipUnless(mock_available, "No mocking available")
def test_output_initialization(self):
with patch('intmaniac.maniac_file.parse') as mock_parse:
mock_parse.return_value = []
intmaniac._internal_entrypoint([])
self.assertIsInstance(output.output, GenericOutput)
with patch('intmaniac.maniac_file.parse') as mock_parse:
mock_parse.return_value = []
intmaniac._internal_entrypoint("-o teamcity".split())
self.assertIsInstance(output.output, TeamcityOutput)
@unittest.skipUnless(mock_available, "No mocking available")
def test_teamcity_output(self):
"""
Only tests if the output methods don't throw an exception.
:return: None
"""
# we need this otherwise we will get a "test error" with unit tests.
# don't know why.
with patch.object(TeamcityOutput, 'dump'):
op = TeamcityOutput()
op.message("meh")
op.message("meh", "mah")
op.message("meh", "mah", "muh")
op.block_open("block")
op.test_suite_open("suite")
op.test_open("test")
op.test_stderr("whoops")
op.test_stdout("okay")
op.test_failed("meh")
op.test_failed("meh", "mehmah")
op.test_failed("meh", "mehmeh", "mehmah")
op.test_done()
op.test_suite_done()
op.block_done()
@unittest.skipUnless(mock_available, "No mocking available")
def test_text_output(self):
"""
Only tests if the output methods don't throw an exception.
:return: None
"""
# we need this otherwise we will get a "test error" with unit tests.
# don't know why.
with patch.object(GenericOutput, 'dump'):
op = GenericOutput()
op.message("meh")
op.message("meh", "mah")
op.message("meh", "mah", "muh")
op.block_open("block")
op.block_done()
op.test_suite_open("suite")
op.test_open("test")
op.test_stderr("whoops")
op.test_stdout("okay")
op.test_failed("meh")
op.test_failed("meh", "mehmah")
op.test_failed("meh", "mehmeh", "mehmah")
op.test_done()
op.test_suite_done()
op.test_open("test")
op.test_done(2)
op.test_open("test")
op.test_done(2.5)
|
from CommandTemplate import CommandTemplate
from IrcMessage import IrcMessage
import GlobalStore
class Command(CommandTemplate):
triggers = ['lastmessage']
helptext = "Stores the last message for each channel the bot is in, so other modules can retrieve it through a commandfunction"
# Stores the last message. Key is the server name, value is a nested dict, which has the channel as key and the message as value
lastMessagePerServer = {}
def onLoad(self):
GlobalStore.commandhandler.addCommandFunction(__file__, 'getLastMessage', self.getLastMessage)
def getLastMessage(self, server, channel, defaultValue=""):
"""
Get the last message said in the provided channel on the provided server, or the default value if either of those isn't stored
:param server: The server to check for the message
:param channel: Which channel on the provided server to get the last message for
:param defaultValue: The value to return if there's no message stored for the provided server and channel
:return: The last message said in the provided channel on the provided server, or the default value if there's nothing stored
"""
if server in self.lastMessagePerServer and channel in self.lastMessagePerServer[server]:
return self.lastMessagePerServer[server][channel]
return defaultValue
def shouldExecute(self, message):
""":type message: IrcMessage"""
# Ignore private messages
if message.isPrivateMessage:
return False
# If the message is a bot command, don't register it
if message.trigger:
return False
server = message.bot.serverfolder
isBotEvent = message.userNickname == message.bot.nickname
# If it's a normal message, store it as the last message for this channel
if not isBotEvent and message.messageType == 'say':
self._storeMessage(server, message.source, message.message)
elif isBotEvent:
if message.messageType == 'part':
# If we leave a channel, no need to store the last message for that channel anymore
self._removeChannelMessage(server, message.source)
elif message.messageType == 'quit':
# If we quit a server, forget all the messages for all channels in that server
self._removeServer(server)
# Since we never need to execute anything, always return False
return False
def _storeMessage(self, server, channel, message):
if server not in self.lastMessagePerServer:
self.lastMessagePerServer[server] = {channel: message}
else:
self.lastMessagePerServer[server][channel] = message
def _removeChannelMessage(self, server, channel):
if server in self.lastMessagePerServer:
if len(self.lastMessagePerServer[server]) == 1:
self.lastMessagePerServer.pop(server, None)
else:
self.lastMessagePerServer[server].pop(channel, None)
def _removeServer(self, server):
self.lastMessagePerServer.pop(server, None)
|
# Tracing of function calls. Use @TraceCalls() as a decorator on functions.
#
# Eli Bendersky [http://eli.thegreenplace.net]
# This code is in the public domain.
import sys
from functools import wraps
class TraceCalls(object):
""" Use as a decorator on functions that should be traced. Several
functions can be decorated - they will all be indented according
to their call depth.
"""
def __init__(self, stream=sys.stdout, indent_step=2, show_ret=False):
self.stream = stream
self.indent_step = indent_step
self.show_ret = show_ret
# This is a class attribute since we want to share the indentation
# level between different traced functions, in case they call
# each other.
TraceCalls.cur_indent = 0
def __call__(self, fn):
@wraps(fn)
def wrapper(*args, **kwargs):
indent = ' ' * TraceCalls.cur_indent
argstr = ', '.join(
[self._argrepr(a) for a in args] +
["%s=%s" % (a, repr(b)) for a, b in kwargs.items()])
self.stream.write('%s%s(%s)\n' % (indent, fn.__name__, argstr))
TraceCalls.cur_indent += self.indent_step
ret = fn(*args, **kwargs)
TraceCalls.cur_indent -= self.indent_step
if self.show_ret:
self.stream.write('%s--> %s\n' % (indent, ret))
return ret
return wrapper
def _argrepr(self, arg):
return repr(arg)
|
# Copyright 2018 Google LLC
#
# 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 re
from ._create_job import create_job
def batch_predict(project_id, model_path, input_paths, input_data_format,
output_path, region, job_id_output_path, output_data_format=None, prediction_input=None, job_id_prefix=None,
wait_interval=30):
"""Creates a MLEngine batch prediction job.
Args:
project_id (str): Required. The ID of the parent project of the job.
model_path (str): Required. The path to the model. It can be either:
`projects/[PROJECT_ID]/models/[MODEL_ID]` or
`projects/[PROJECT_ID]/models/[MODEL_ID]/versions/[VERSION_ID]`
or a GCS path of a model file.
input_paths (list): Required. The Google Cloud Storage location of
the input data files. May contain wildcards.
input_data_format (str): Required. The format of the input data files.
See https://cloud.google.com/ml-engine/reference/rest/v1/projects.jobs#DataFormat.
output_path (str): Required. The output Google Cloud Storage location.
region (str): Required. The Google Compute Engine region to run the
prediction job in.
output_data_format (str): Optional. Format of the output data files,
defaults to JSON.
prediction_input (dict): Input parameters to create a prediction job.
job_id_prefix (str): the prefix of the generated job id.
wait_interval (int): optional wait interval between calls
to get job status. Defaults to 30.
"""
if not prediction_input:
prediction_input = {}
if not model_path:
raise ValueError('model_path must be provided.')
if _is_model_name(model_path):
prediction_input['modelName'] = model_path
elif _is_model_version_name(model_path):
prediction_input['versionName'] = model_path
elif _is_gcs_path(model_path):
prediction_input['uri'] = model_path
else:
raise ValueError('model_path value is invalid.')
if input_paths:
prediction_input['inputPaths'] = input_paths
if input_data_format:
prediction_input['dataFormat'] = input_data_format
if output_path:
prediction_input['outputPath'] = output_path
if output_data_format:
prediction_input['outputDataFormat'] = output_data_format
if region:
prediction_input['region'] = region
job = {
'predictionInput': prediction_input
}
create_job(
project_id=project_id,
job=job,
job_id_prefix=job_id_prefix,
wait_interval=wait_interval,
job_id_output_path=job_id_output_path,
)
def _is_model_name(name):
return re.match(r'/projects/[^/]+/models/[^/]+$', name)
def _is_model_version_name(name):
return re.match(r'/projects/[^/]+/models/[^/]+/versions/[^/]+$', name)
def _is_gcs_path(name):
return name.startswith('gs://')
|
'''
Collection of tests to verify preset paths loading
'''
from nose.tools import raises, eq_
from tempfile import NamedTemporaryFile, mkdtemp
from shutil import rmtree
from presets.presetManager import PresetException
import json
import os
from presets.presetManager import PresetManager
minimalBody = { "id": "id_test",
"properties": [] }
tmpDir = None
def setUpModule():
global tmpDir
tmpDir = mkdtemp(prefix='libreant_presets_tests')
def tearDownModule():
rmtree(tmpDir)
def json_tmp_file():
return NamedTemporaryFile(delete=False, dir=tmpDir, suffix=".json")
def test_sigle_file():
''' test single file loding'''
file = json_tmp_file()
file.write(json.dumps(minimalBody))
file.close()
p = PresetManager(file.name, strict=True)
assert minimalBody['id'] in p.presets
def test_multiple_file():
'''test multiple file loading'''
files = list()
presetBodies = list()
num = 5
for i in range(0, num):
files.append(json_tmp_file())
presetBodies.append(minimalBody.copy())
presetBodies[i]['id'] = "id_" + str(i)
files[i].write(json.dumps(presetBodies[i]))
files[i].close()
p = PresetManager(map(lambda x: x.name, files), strict=True)
for i in range(0, num):
assert presetBodies[i]['id'] in p.presets
@raises(PresetException)
def test_duplicate_id():
f1 = json_tmp_file()
f1.write(json.dumps(minimalBody))
f1.close()
f2 = json_tmp_file()
f2.write(json.dumps(minimalBody))
f2.close()
p = PresetManager([f1.name,f2.name], strict=True)
def test_empty_path():
''' passing empty path must not break anything '''
p = PresetManager([""])
eq_(len(p.presets), 0)
@raises(PresetException)
def test_not_existent():
''' if preset file do not exists we expect an exception '''
p = PresetManager("notexistent", strict=True)
def test_folders():
''' test preset files distributed in multiple folders '''
folders = list()
presetBodies = list()
num = 5
for i in range(num):
folders.append(mkdtemp(dir=tmpDir))
presetBodies.append(minimalBody.copy())
presetBodies[i]['id'] = "id_" + str(i)
file = NamedTemporaryFile(delete=False, dir=folders[i], suffix=".json")
file.write(json.dumps(presetBodies[i]))
file.close()
p = PresetManager(folders, strict=True)
for i in range(num):
assert presetBodies[i]['id'] in p.presets
rmtree(folders[i], ignore_errors=True)
@raises(PresetException)
def test_wrong_json_format():
''' if preset has a bad json format we expect an exception'''
f = json_tmp_file()
f.write("{{{{}")
f.close()
p = PresetManager(f.name, strict=True)
|
#!/usr/bin/env python
from __future__ import print_function
import re
import numpy as np
import numpy.testing as npt
import logging
logging.basicConfig(level=logging.DEBUG)
import unittest
# import the module
import tomographer.tools.densedm
import tomographer.tools.densedm.mle
import tomographer
import tomographer.densedm
class SimulateMeasurements(unittest.TestCase):
def test_sim(self):
rho_sim = np.array([[0.9, 0], [0, 0.1]])
Mk = tomographer.tools.densedm.PauliMeasEffectsQubit
n = 1000
d = tomographer.tools.densedm.simulate_measurements(rho_sim, Mk, n)
self.assertEqual(d.Nm[0] + d.Nm[1], n)
self.assertEqual(d.Nm[2] + d.Nm[3], n)
self.assertEqual(d.Nm[4] + d.Nm[5], n)
# Hoeffding's inequality: Prob( |N(+) - p*n| > eps*n ) < 2*exp(-2*eps^2*n)
#
# --> so the probability to deviate by more than 0.1 fraction is bounded by
# 2*exp(-2 * 0.1**2 * n) ~ 4e-9 (for n=1000)
self.assertLessEqual( (d.Nm[0] - 0.5*n) , 0.1*n )
self.assertLessEqual( (d.Nm[2] - 0.5*n) , 0.1*n )
self.assertLessEqual( (d.Nm[4] - 0.9*n) , 0.1*n )
class Mle(unittest.TestCase):
def test_mle(self):
Emn = sum(tomographer.tools.densedm.PauliMeasEffectsQubit, [])
Nm = np.array([250, 250, 250, 250, 500, 0]) # really extreme example
llh = tomographer.densedm.IndepMeasLLH(tomographer.densedm.DMTypes(2))
llh.setMeas(Emn, Nm)
(rho_MLE, d) = tomographer.tools.densedm.mle.find_mle(llh)
# we know the exact solution, rho_MLE = |0><0|
npt.assert_array_almost_equal(rho_MLE,
np.array([[1, 0], [0, 0]]))
# normally, this is not needed as we are being run via pyruntest.py, but it might be
# useful if we want to run individually picked tests
if __name__ == '__main__':
unittest.main()
|
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import json
import frappe
import frappe.handler
import frappe.client
from frappe.utils.response import build_response
from frappe import _
from urlparse import urlparse
from urllib import urlencode
def handle():
"""
Handler for `/api` methods
### Examples:
`/api/method/{methodname}` will call a whitelisted method
`/api/resource/{doctype}` will query a table
examples:
- `?fields=["name", "owner"]`
- `?filters=[["Task", "name", "like", "%005"]]`
- `?limit_start=0`
- `?limit_page_length=20`
`/api/resource/{doctype}/{name}` will point to a resource
`GET` will return doclist
`POST` will insert
`PUT` will update
`DELETE` will delete
`/api/resource/{doctype}/{name}?run_method={method}` will run a whitelisted controller method
"""
validate_oauth()
parts = frappe.request.path[1:].split("/",3)
call = doctype = name = None
if len(parts) > 1:
call = parts[1]
if len(parts) > 2:
doctype = parts[2]
if len(parts) > 3:
name = parts[3]
if call=="method":
frappe.local.form_dict.cmd = doctype
return frappe.handler.handle()
elif call=="resource":
if "run_method" in frappe.local.form_dict:
method = frappe.local.form_dict.pop("run_method")
doc = frappe.get_doc(doctype, name)
doc.is_whitelisted(method)
if frappe.local.request.method=="GET":
if not doc.has_permission("read"):
frappe.throw(_("Not permitted"), frappe.PermissionError)
frappe.local.response.update({"data": doc.run_method(method, **frappe.local.form_dict)})
if frappe.local.request.method=="POST":
if not doc.has_permission("write"):
frappe.throw(_("Not permitted"), frappe.PermissionError)
frappe.local.response.update({"data": doc.run_method(method, **frappe.local.form_dict)})
frappe.db.commit()
else:
if name:
if frappe.local.request.method=="GET":
doc = frappe.get_doc(doctype, name)
if not doc.has_permission("read"):
raise frappe.PermissionError
frappe.local.response.update({"data": doc})
if frappe.local.request.method=="PUT":
data = json.loads(frappe.local.form_dict.data)
doc = frappe.get_doc(doctype, name)
if "flags" in data:
del data["flags"]
# Not checking permissions here because it's checked in doc.save
doc.update(data)
frappe.local.response.update({
"data": doc.save().as_dict()
})
frappe.db.commit()
if frappe.local.request.method=="DELETE":
# Not checking permissions here because it's checked in delete_doc
frappe.delete_doc(doctype, name)
frappe.local.response.http_status_code = 202
frappe.local.response.message = "ok"
frappe.db.commit()
elif doctype:
if frappe.local.request.method=="GET":
if frappe.local.form_dict.get('fields'):
frappe.local.form_dict['fields'] = json.loads(frappe.local.form_dict['fields'])
frappe.local.form_dict.setdefault('limit_page_length', 20)
frappe.local.response.update({
"data": frappe.call(frappe.client.get_list,
doctype, **frappe.local.form_dict)})
if frappe.local.request.method=="POST":
data = json.loads(frappe.local.form_dict.data)
data.update({
"doctype": doctype
})
frappe.local.response.update({
"data": frappe.get_doc(data).insert().as_dict()
})
frappe.db.commit()
else:
raise frappe.DoesNotExistError
else:
raise frappe.DoesNotExistError
return build_response("json")
def validate_oauth():
form_dict = frappe.local.form_dict
authorization_header = frappe.get_request_header("Authorization").split(" ") if frappe.get_request_header("Authorization") else None
if authorization_header and authorization_header[0].lower() == "bearer":
from frappe.integration_broker.oauth2 import get_oauth_server
token = authorization_header[1]
r = frappe.request
parsed_url = urlparse(r.url)
access_token = { "access_token": token}
uri = parsed_url.scheme + "://" + parsed_url.netloc + parsed_url.path + "?" + urlencode(access_token)
http_method = r.method
body = r.get_data()
headers = r.headers
required_scopes = frappe.db.get_value("OAuth Bearer Token", token, "scopes").split(";")
valid, oauthlib_request = get_oauth_server().verify_request(uri, http_method, body, headers, required_scopes)
if valid:
frappe.set_user(frappe.db.get_value("OAuth Bearer Token", token, "user"))
frappe.local.form_dict = form_dict
|
import numpy as np
from pele.takestep import TakestepInterface
__all__ = ["AdaptiveStepsizeTemperature"]
class AdaptiveStepsizeTemperature(TakestepInterface):
"""
adjust both the stepsize and the temperature adaptively
Parameters
----------
stepclass :
the step taking class
target_new_min_prob :
the target probability for a step ending up in a new minimum.
Used to adjust the stepsize.
target_new_min_accept_prob :
the target probability that a step that ends in a new minimum is accepted.
Use to adjust the temperature
Note: the total acceptance probability is
accrat = 1 - target_new_min_prob * (1 - target_new_min_accept_prob)
so if you want a total acceptance probability of 0.5, you must choose both other
probabilities accordingly
interval :
the interval at which to adjust temperature and stepsize
Tfactor :
the factor with which to multiply (or divide) the temperature
sfactor :
the factor with which to multiply (or divide) the stepsize
ediff :
if two minima have energies that are within ediff from each other then
they are considered to be the same minimum
verbose :
print status messages
Notes
-----
We will base the stepsize adjustment on the probability of ending up
in a different minimum
We will base the temperature adjustment on the probability of accepting
a move that ended up in a different minimum
"""
def __init__(self, stepclass,
target_new_min_prob=0.8,
target_new_min_accept_prob=0.3,
interval=100, Tfactor=0.95, sfactor=0.95, ediff=.001,
verbose=False):
self.stepclass = stepclass
self.target_new_min_accept_prob = target_new_min_accept_prob
self.target_new_min_prob = target_new_min_prob
self.interval = interval
self.Tfactor = Tfactor
self.sfactor = sfactor
self.ediff = ediff
self.verbose = verbose
self.energy = None
self.coords = None
self.ncalls_tot = 0
self.reset()
def reset(self):
self.nattempts = 0
self.naccept = 0
self.nsame = 0
def takeStep(self, *args, **kwargs):
"""
basinhopping calls this to take a step
"""
self.stepclass.takeStep(*args, **kwargs)
def updateStep(self, accepted, driver=None):
"""
this is the function basinhopping uses to report results
"""
self.ncalls_tot += 1
trial_energy = driver.trial_energy
trial_coords = driver.trial_coords
if self.energy is None:
#first time called. Save energy and coords
self.energy = driver.markovE
self.coords = driver.coords.copy()
return
self.nattempts += 1
if accepted:
self.naccept += 1
#determine if the new minima is the same as the last one
same = False
if abs(self.energy - trial_energy) <= self.ediff:
#if np.std(self.coords - trial_coords) <= self.xdiff:
same = True
self.nsame += 1
#print abs(self.energy - trial_energy), np.std(self.coords - trial_coords), np.max(np.abs(self.coords - trial_coords))
if not same and accepted:
self.energy = driver.markovE
self.coords = driver.coords.copy()
if self.nattempts % self.interval == 0:
# if self.verbose:
# print " acceptance probability %.4g" % (float(self.naccept) / self.nattempts)
self.adjustStep()
self.adjustTemp(driver)
self.reset()
def adjustStep(self):
"""adjust the step size
increase the step size if we're ending up in the same minima too often,
else decrease the step size
"""
fnew = 1. - float(self.nsame) / self.nattempts
if fnew < self.target_new_min_prob:
self.stepclass.scale(1. / self.sfactor)
else:
self.stepclass.scale(self.sfactor)
#print some status info
if self.verbose:
print "adaptive step and temperature: naccept nsame ndiff naccept_diff %d %d %d %d new min probability %.4g" % (
self.naccept, self.nsame, self.nattempts-self.nsame,
self.naccept-self.nsame, float(self.naccept - self.nsame) / self.nattempts)
print " stepsize is now %.4g ratio %.4g target %.4g" %(self.stepclass.stepsize,
fnew, self.target_new_min_prob)
def adjustTemp(self, driver):
"""adjust the temperature
increase the temeperature if new minima are rejected too often,
else decrease the temperature
"""
ndiff = self.nattempts - self.nsame
ndiff_accept = self.naccept - self.nsame
if ndiff == 0:
faccept = 1
else:
faccept = float(ndiff_accept) / ndiff
if faccept > self.target_new_min_accept_prob:
driver.acceptTest.temperature *= self.Tfactor
else:
driver.acceptTest.temperature /= self.Tfactor
if self.verbose:
print " temperature is now %.4g ratio %.4g target %.4g" % (driver.acceptTest.temperature,
faccept, self.target_new_min_accept_prob)
if __name__ == "__main__":
import numpy as np
from pele.takestep import displace
from pele.systems import LJCluster
#from pele.takestep import adaptive
natoms = 38
sys = LJCluster(natoms=38)
# random initial coordinates
coords = sys.get_random_configuration()
takeStep = displace.RandomDisplacement( stepsize=0.4 )
tsAdaptive = AdaptiveStepsizeTemperature(takeStep, interval=300, verbose=True)
db = sys.create_database()
opt = sys.get_basinhopping(database=db, takestep=tsAdaptive, coords=coords)
opt.printfrq = 50
opt.run(5000)
|
"""parses configuration and returns useful things"""
#pylint: disable=relative-import
from etl_framework.utilities.DataTable import DataRow
from functools import reduce
class FieldMappingsMixin(object):
"""stuff"""
def map_fields(self, row):
"""stuff"""
mapped_row = DataRow()
for traverse_path, mapped_field_name in list(self.config.get_field_mapping_fields().items()):
mapped_row[mapped_field_name] = reduce(lambda key, value: key.get(value) if key else None,
traverse_path.split('|'), row)
return mapped_row
def rename_fields(self, row):
"""stuff"""
mappings = self.config.get_field_mapping_fields()
return {value[0]: row.get(key) for key, value in list(mappings.items())}
def filter_fields(self, row):
"""stuff"""
mappings = self.config.get_field_mapping_fields()
return {key: value[0](row.get(key)) for key, value in list(mappings.items())}
def filter_and_map_fields(self, row):
"""stuff"""
mapped_row = DataRow()
for traverse_path, mapping in list(self.config.get_field_mappings().items()):
mapped_row[mapping[1]] = mapping[0](reduce(lambda key, value: key.get(value) if key else None,
traverse_path.split('|'), row))
return mapped_row
def filter_and_rename_fields(self, row):
"""stuff"""
mappings = self.config.get_field_mappings()
return {value[0]: value[0](row.get(key)) for key, value in list(mappings.items())}
|
#!/usr/bin/env python
import os, sys, tempfile
assert sys.version_info[:2] >= ( 2, 4 )
def __main__():
# Read parms.
input_name = sys.argv[1]
output_name = sys.argv[2]
attribute_name = sys.argv[3]
# Create temp files.
tmp_name1 = tempfile.NamedTemporaryFile().name
tmp_name2 = tempfile.NamedTemporaryFile().name
# Do conversion.
skipped_lines = 0
first_skipped_line = 0
out = open( tmp_name1, 'w' )
# Write track data to temporary file.
i = 0
for i, line in enumerate( file( input_name ) ):
line = line.rstrip( '\r\n' )
if line and not line.startswith( '#' ):
try:
elems = line.split( '\t' )
start = str( int( elems[3] ) - 1 ) # GTF coordinates are 1-based, BedGraph are 0-based.
strand = elems[6]
if strand not in ['+', '-']:
strand = '+'
attributes_list = elems[8].split(";")
attributes = {}
for name_value_pair in attributes_list:
pair = name_value_pair.strip().split(" ")
name = pair[0].strip()
if name == '':
continue
# Need to strip double quote from values
value = pair[1].strip(" \"")
attributes[name] = value
value = attributes[ attribute_name ]
# GTF format: chrom source, name, chromStart, chromEnd, score, strand, frame, attributes.
# BedGraph format: chrom, chromStart, chromEnd, value
out.write( "%s\t%s\t%s\t%s\n" %( elems[0], start, elems[4], value ) )
except:
skipped_lines += 1
if not first_skipped_line:
first_skipped_line = i + 1
else:
skipped_lines += 1
if not first_skipped_line:
first_skipped_line = i + 1
out.close()
# Sort tmp file by chromosome name and chromosome start to create ordered track data.
cmd = "sort -k1,1 -k2,2n < %s > %s" % ( tmp_name1, tmp_name2 )
try:
os.system(cmd)
os.remove(tmp_name1)
except Exception, ex:
sys.stderr.write( "%s\n" % ex )
sys.exit(1)
# Create bedgraph file by combining track definition with ordered track data.
cmd = "echo 'track type=bedGraph' | cat - %s > %s " % ( tmp_name2, output_name )
try:
os.system(cmd)
os.remove(tmp_name2)
except Exception, ex:
sys.stderr.write( "%s\n" % ex )
sys.exit(1)
info_msg = "%i lines converted to BEDGraph. " % ( i + 1 - skipped_lines )
if skipped_lines > 0:
info_msg += "Skipped %d blank/comment/invalid lines starting with line #%d." %( skipped_lines, first_skipped_line )
print info_msg
if __name__ == "__main__": __main__()
|
from perfrunner.helpers import local
from perfrunner.helpers.cbmonitor import timeit, with_stats
from perfrunner.tests import PerfTest
class DCPThroughputTest(PerfTest):
def _report_kpi(self, time_elapsed: float):
self.reporter.post(
*self.metrics.dcp_throughput(time_elapsed)
)
@with_stats
@timeit
def access(self, *args):
username, password = self.cluster_spec.rest_credentials
for target in self.target_iterator:
local.run_dcptest(
host=target.node,
username=username,
password=password,
bucket=target.bucket,
num_items=self.test_config.load_settings.items,
num_connections=self.test_config.dcp_settings.num_connections
)
def run(self):
self.load()
self.wait_for_persistence()
time_elapsed = self.access()
self.report_kpi(time_elapsed)
class JavaDCPThroughputTest(DCPThroughputTest):
def init_java_dcp_client(self):
local.clone_git_repo(repo=self.test_config.java_dcp_settings.repo,
branch=self.test_config.java_dcp_settings.branch)
local.build_java_dcp_client()
@with_stats
@timeit
def access(self, *args):
for target in self.target_iterator:
local.run_java_dcp_client(
connection_string=target.connection_string,
messages=self.test_config.load_settings.items,
config_file=self.test_config.java_dcp_settings.config,
)
def run(self):
self.init_java_dcp_client()
super().run()
|
from Bio.PDB.PDBParser import PDBParser
import argparse
parser = argparse.ArgumentParser(description="Compute Rg of pdb")
parser.add_argument("pdb", help="pdb file")
args = parser.parse_args()
def computeRg(pdb_file, chain="A"):
# compute Radius of gyration
# pdb_file = f"/Users/weilu/Research/server/feb_2019/iterative_optimization_new_temp_range/all_simulations/{p}/{p}/crystal_structure.pdb"
chain_name = chain
parser = PDBParser()
structure = parser.get_structure('X', pdb_file)
chain = list(structure[0][chain_name])
all_res = list(structure.get_residues())
# n = len(all_res)
# n = len(chain)
regular_res_list = [res for res in all_res if res.get_id()[0] == ' ']
n = len(regular_res_list)
print("all chains")
cutoff = 15
for residue in regular_res_list:
if residue.get_id()[0] == ' ' and abs(residue["CA"].get_vector()[-1]) < cutoff:
print(residue.get_id()[1])
rg = 0.0
for i, residue_i in enumerate(regular_res_list):
for j, residue_j in enumerate(regular_res_list[i+1:]):
try:
r = residue_i["CA"] - residue_j["CA"]
except:
print(residue_i, residue_j)
rg += r**2
return (rg/(n**2))**0.5
rg = computeRg(args.pdb)
print(rg)
def cylindrical_rg_bias_term(oa, k_rg=4.184, rg0=0, atomGroup=-1, forceGroup=27):
nres, ca = oa.nres, oa.ca
if atomGroup == -1:
group = list(range(nres))
else:
group = atomGroup # atomGroup = [0, 1, 10, 12] means include residue 1, 2, 11, 13.
n = len(group)
rg_square = CustomBondForce("1/normalization*(x^2+y^2)")
# rg = CustomBondForce("1")
rg_square.addGlobalParameter("normalization", n*n)
for i in group:
for j in group:
if j <= i:
continue
rg_square.addBond(ca[i], ca[j], [])
rg = CustomCVForce(f"{k_rg}*(rg_square^0.5-{rg0})^2")
rg.addCollectiveVariable("rg_square", rg_square)
rg.setForceGroup(forceGroup)
return rg
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014-2017 Vincent Noel (vincent.noel@butantan.gov.br)
#
# This file is part of libSigNetSim.
#
# libSigNetSim 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.
#
# libSigNetSim 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 libSigNetSim. If not, see <http://www.gnu.org/licenses/>.
"""
Testing the reading/writing of miriam annotations of the model
"""
from libsignetsim import SbmlDocument, Settings
from libsignetsim.uris.URI import URI
from unittest import TestCase
from os.path import join, dirname, isdir
from os import mkdir, getcwd
class TestAnnotation(TestCase):
""" Tests high level functions """
def testReadWriteModel(self):
testfiles_path = join(join(getcwd(), dirname(__file__)), "files")
sbml_doc = SbmlDocument()
sbml_doc.readSbmlFromFile(join(testfiles_path, "BIOMD0000000001.xml"))
sbml_doc.writeSbmlToFile(join(Settings.tempDirectory, "BIOMD0000000001.xml"))
sbml_doc.readSbmlFromFile(join(testfiles_path, "BIOMD0000000001.xml"))
sbml_model = sbml_doc.getModelInstance()
self.assertEqual(sbml_model.modelHistory.getDateCreated(), "2005-02-02T14:56:11Z")
creator = sbml_model.modelHistory.getListOfCreators()[0]
self.assertEqual(creator.getEmail(), "lenov@ebi.ac.uk")
self.assertEqual(creator.getGivenName(), "Nicolas")
self.assertEqual(creator.getFamilyName(), "Le Novère")
taxon_uri = URI()
taxon_uri.setTaxonomy('7787')
self.assertEqual(sbml_model.getAnnotation().getHasTaxon()[0], taxon_uri)
self.assertEqual(sbml_model.getAnnotation().getHasTaxon()[0].getName(), "Tetronarce californica")
self.assertEqual(sbml_model.getAnnotation().getHasProperty(), [])
self.assertEqual(sbml_model.getAnnotation().getHasPart(), [])
self.assertEqual(sbml_model.getAnnotation().getHasVersion(), [])
self.assertEqual(sbml_model.getAnnotation().getIs(), [])
self.assertEqual(sbml_model.getAnnotation().getIsDescribedBy(), [])
self.assertEqual(sbml_model.getAnnotation().getIsEncodedBy(), [])
self.assertEqual(sbml_model.getAnnotation().getIsHomologTo(), [])
self.assertEqual(sbml_model.getAnnotation().getIsPartOf(), [])
self.assertEqual(sbml_model.getAnnotation().getIsPropertyOf(), [])
go_process1_uri = URI()
go_process1_uri.setGO('GO:0007274')
go_process2_uri = URI()
go_process2_uri.setGO('GO:0007166')
go_process3_uri = URI()
go_process3_uri.setGO('GO:0019226')
self.assertEqual(sbml_model.getAnnotation().getIsVersionOf()[0], go_process1_uri)
self.assertEqual(sbml_model.getAnnotation().getIsVersionOf()[1], go_process2_uri)
self.assertEqual(sbml_model.getAnnotation().getIsVersionOf()[2], go_process3_uri)
self.assertEqual(sbml_model.getAnnotation().getOccursIn(), [])
self.assertEqual(sbml_model.getAnnotation().getUnknown(), [])
self.assertEqual(sbml_model.getAnnotation().getModelHasInstance(), [])
biomodels_ref1_uri = URI()
biomodels_ref1_uri.setBiomodels('MODEL6613849442')
biomodels_ref2_uri = URI()
biomodels_ref2_uri.setBiomodels('BIOMD0000000001')
self.assertEqual(sbml_model.getAnnotation().getModelIs()[0], biomodels_ref1_uri)
self.assertEqual(sbml_model.getAnnotation().getModelIs()[1], biomodels_ref2_uri)
self.assertEqual(sbml_model.getAnnotation().getModelIsDerivedFrom(), [])
publication_uri = URI()
publication_uri.setPubmed('8983160')
self.assertEqual(sbml_model.getAnnotation().getModelIsDescribedBy()[0], publication_uri)
self.assertEqual(
sbml_model.getAnnotation().getModelIsDescribedBy()[0].getName(),
("Edelstein SJ(1), Schaad O, Henry E, Bertrand D, Changeux JP., "
+ "A kinetic mechanism for nicotinic acetylcholine receptors based on multiple allosteric transitions., "
+ "1. Biol Cybern. 1996 Nov;75(5):361-79.")
)
self.assertEqual(sbml_model.getAnnotation().getModelIsInstanceOf(), [])
self.assertEqual(sbml_model.getAnnotation().getModelUnknown(), [])
descriptions = [
u'physical compartment', u'protein complex', u'protein complex', u'protein complex',
u'multimer of macromolecules', u'protein complex', u'multimer of macromolecules', u'protein complex',
u'multimer of macromolecules', u'protein complex', u'protein complex', u'multimer of macromolecules',
u'protein complex', u'non-covalent binding', u'non-covalent binding', u'conformational transition',
u'non-covalent binding', u'non-covalent binding', u'conformational transition',
u'conformational transition', u'non-covalent binding', u'non-covalent binding',
u'conformational transition', u'conformational transition', u'conformational transition',
u'non-covalent binding', u'non-covalent binding', u'physical compartment', u'protein complex',
u'protein complex', u'protein complex', u'multimer of macromolecules', u'protein complex',
u'multimer of macromolecules', u'protein complex', u'multimer of macromolecules', u'protein complex',
u'protein complex', u'multimer of macromolecules', u'protein complex', u'non-covalent binding',
u'non-covalent binding', u'conformational transition', u'non-covalent binding', u'non-covalent binding',
u'conformational transition', u'conformational transition', u'non-covalent binding',
u'non-covalent binding', u'conformational transition', u'conformational transition',
u'conformational transition', u'non-covalent binding', u'non-covalent binding'
]
resolved_descriptions = sbml_model.getListOfSBOTermsDescriptions()
self.assertEqual(resolved_descriptions, descriptions)
|
#
# content.py
#
# script to be invoked via
#
# cd <your-buildout-root-dir>
# bin/instance run src/pcp.rctsync/src/pcp/rctsync/people.py
#
# run with --help to see available options
# This is very specific as it includes the logic according
# to which the rct.contactdata and auth.user models of the
# RCT are merged.
import logging
from Products.PlonePAS.utils import cleanId
from pcp.rctsync import utils
def prepareid(values):
logger = logging.getLogger('rctsync.people')
fn = values['fields']['first_name'].encode('utf8')
ln = values['fields']['last_name'].encode('utf8')
id = "%s-%s" % (fn,ln)
id = id.replace(' ','')
if id == '-':
generated = "rct-user-%s" % values['pk']
message = "auth.user '%s' has no name set. Using '%s' instead." \
% (values['pk'], generated)
logger.warning(message)
return cleanId(generated)
logger.debug("Generating id based on '%s'" % id)
return cleanId(id)
def prepareuserdata(values):
logger = logging.getLogger('rctsync.prepareuserdata')
fields = values['fields'].copy()
data = {}
name = {}
additional = []
name['firstnames'] = fields['first_name']
name['lastname'] = fields['last_name']
title = ' '.join([name['firstnames'], name['lastname']])
if not title:
title = "RCT User ", values['pk']
additional.append({'key': 'rct_user_pk',
'value': str(values['pk']),
},
)
additional.append({'key':'rct_username',
'value':values['fields']['username'],
},
)
data['name'] = name.copy()
data['title'] = title
data['email'] = fields['email']
data['additional'] = additional
return data.copy()
def preparedata(values, rct_users, email2userpk):
logger = logging.getLogger('rctsync.preparedata')
fields = values['fields'].copy()
data = {}
name = {}
phone = []
identifiers = []
additional = []
name['firstnames'] = fields['first_name']
name['lastname'] = fields['last_name']
title = ' '.join([name['firstnames'], name['lastname']])
email = fields['email']
phonenumber = fields['phone']
if phonenumber:
value = {}
value['type'] = 'Office'
value['number'] = phonenumber
phone.append(value.copy())
rct_uid = fields['uuid']
identifiers = [{'type':'rct_uid',
'value': rct_uid},
]
additional.append({'key':'rct_user_pk',
'value':fields['rct_user']}
)
additional.append({'key':'website',
'value':fields['website']}
)
additional.append({'key':'address',
'value':fields['address']}
)
additional.append({'key':'organization',
'value':fields['organization']}
)
additional.append({'key': 'rct_contact_pk',
'value': str(values['pk']),
},
)
userpk = fields['rct_user']
if userpk:
additional.append({'key':'rct_username',
'value':rct_users[userpk]['fields']['username'],
},
)
rct_users[userpk]['covered'] = True
logger.info("Updating '%s' with user data" % title)
elif email2userpk.has_key(email):
pk = email2userpk[email]
username = rct_users[pk]['fields']['username']
additional.append({'key':'rct_username',
'value':username,
},
)
additional.append({'key':'rct_user_inferred',
'value':pk,
},
)
rct_users[email2userpk[email]]['covered'] = True
logger.warning("Updating '%s' with user data inferred via email match." % title)
else:
logger.warning("No user data found for %s" % title)
data['name'] = name.copy()
data['title'] = title
if phone:
data['phone'] = phone
data['email'] = email
data['identifiers'] = identifiers
data['additional'] = additional
return data.copy()
def main(app):
argparser = utils.getArgParser()
logger = utils.getLogger('var/log/rctsync_people.log')
args = argparser.parse_args()
logger.info("'people.py' called with '%s'" % args)
site = utils.getSite(app, args.site_id, args.admin_id)
logger.info("Got site '%s' as '%s'" % (args.site_id, args.admin_id))
targetfolder = site.people
rct_contacts = utils.getData(args.filename, 'rct.contactdata')
rct_users = utils.getData(args.filename, 'auth.user')
email2userpk = utils.email2userpk(rct_users)
logger.info("Iterating over the contact data")
for pk, values in rct_contacts.items():
id = prepareid(values)
if id is None:
logger.error("Couldn't generate id for ", values)
continue
if id not in targetfolder.objectIds():
targetfolder.invokeFactory('Person', id)
logger.info("Added '%s' to the people folder" % id)
else:
logger.info("Found '%s' in people folder" % id)
data = preparedata(values, rct_users, email2userpk)
logger.debug(data)
targetfolder[id].edit(**data)
targetfolder[id].reindexObject()
logger.info("Updated '%s' in the people folder" % id)
# and now almost the same for the user data
logger.info("Iterating over the user data.")
for pk, values in rct_users.items():
if rct_users[pk].has_key('covered'):
logger.info("user '%s' already covered." % pk)
continue
id = prepareid(values)
if id is None:
logger.error("Couldn't generate id for ", values)
continue
if id not in targetfolder.objectIds():
targetfolder.invokeFactory('Person', id)
logger.info("Added '%s' to the people folder" % id)
else:
# this should not happen
logger.warning("Found '%s' in people folder; skipping" % id)
continue
data = prepareuserdata(values)
logger.debug(data)
targetfolder[id].edit(**data)
targetfolder[id].reindexObject()
logger.info("Updated '%s' in the people folder" % id)
if not args.dry:
logger.info("committing changes to db")
import transaction
transaction.commit()
else:
logger.info("dry run; not committing anything")
logger.info("Done with synchronizing people")
# As this script lives in your source tree, we need to use this trick so that
# five.grok, which scans all modules, does not try to execute the script while
# modules are being loaded on start-up
if "app" in locals():
main(app)
|
"""
Contains classes and functions pertaining to buildings.
"""
import os, pygame
from qnd import *
####CONSTANTS####
#Calculating file paths
BASEPATH = os.path.abspath(__file__)
BASEPATH = BASEPATH[:BASEPATH.index('src')]
#Images to use for buildings
SPRITES = [
load_image('building1.png'),
load_image('building2.png')
]
class Building:
"""
A building. Initialize it with a tile position and an image. Size
will be calculated based on the image, rounding down to the nearest
tile width and height.
"""
def __init__(self,(x,y),image_number=0,tileheight=32,tilewidth=32):
self.sprite = SPRITES[image_number]
self.position = self.x,self.y = x,y
self.size = self.width,self.height = self.sprite.get_width()/32,self.sprite.get_height()/32
def draw(self,screen,camera,tilewidth=32,tileheight=32):
"""Draw the building on the screen"""
draw_image(screen,self.sprite,(self.x*tilewidth,self.y*tilewidth),camera=camera)
#debug drawing
#~ drawx = self.x*tilewidth-camera.x
#~ drawy = self.y*tileheight-camera.y
#~ draw_width = self.width*tilewidth
#~ draw_height = self.height*tileheight
#~ pygame.draw.rect(screen,(0,0,0),(drawx,drawy,draw_width,draw_height),3)
def load_buildings(filename,folder='levels'):
"""Returns the list of buildings from the file"""
filename += '.buildings'
print "Loading Buildings", filename
file = open(os.path.join(BASEPATH,folder,filename),'r')
lines = file.readlines()
file.close()
buildings = []
for line in lines:
pos,image_number = line.split()
pos = map(int,pos.split(','))
building = Building(pos,int(image_number))
buildings.append(building)
return buildings
|
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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 superset.db_engine_specs.base import BaseEngineSpec, LimitMethod
class TeradataEngineSpec(BaseEngineSpec):
"""Dialect for Teradata DB."""
engine = "teradata"
limit_method = LimitMethod.WRAP_SQL
max_column_name_length = 30 # since 14.10 this is 128
_time_grain_functions = {
None: "{col}",
"PT1M": "TRUNC(CAST({col} as DATE), 'MI')",
"PT1H": "TRUNC(CAST({col} as DATE), 'HH')",
"P1D": "TRUNC(CAST({col} as DATE), 'DDD')",
"P1W": "TRUNC(CAST({col} as DATE), 'WW')",
"P1M": "TRUNC(CAST({col} as DATE), 'MONTH')",
"P0.25Y": "TRUNC(CAST({col} as DATE), 'Q')",
"P1Y": "TRUNC(CAST({col} as DATE), 'YEAR')",
}
@classmethod
def epoch_to_dttm(cls) -> str:
return (
"CAST(((CAST(DATE '1970-01-01' + ({col} / 86400) AS TIMESTAMP(0) "
"AT 0)) AT 0) + (({col} MOD 86400) * INTERVAL '00:00:01' "
"HOUR TO SECOND) AS TIMESTAMP(0))"
)
|
#!/usr/bin/env python
# **************************************** #
#############
# IMPORTS #
#############
# standard python packages
import ConfigParser, copy, inspect, logging, os, string, sys
from Node import Node
if not os.path.abspath( __file__ + "/../../../lib/iapyx/src" ) in sys.path :
sys.path.append( os.path.abspath( __file__ + "/../../../lib/iapyx/src" ) )
from utils import tools
# **************************************** #
class RuleNode( Node ) :
#####################
# SPECIAL ATTRIBS #
#####################
treeType = "rule"
ops = [ "+", "-", "*", "/" ]
aggs = [ "max<", "min<", "sum<", "count<", "avg<" ]
#################
# CONSTRUCTOR #
#################
def __init__( self, rid=None, name="DEFAULT", record=[], parsedResults={}, cursor=None, argDict={} ) :
logging.debug( ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" )
logging.debug( "in RuleNode.RuleNode : " + name )
logging.debug( " rid = " + str( rid ) )
logging.debug( " record = " + str( record ) )
logging.debug( ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" )
self.argDict = {}
self.rid = rid
self.name = name
self.record = record
self.parsedResults = parsedResults
self.cursor = cursor
self.argDict = argDict
# array of metadata for node descendants.
# [ { 'treeType' : "goal" | "fact",
# 'node_name' : <string>,
# 'triggerRecord' : <string>,
# 'polarity' : "notin" | "",
# }, ... ]
self.descendant_meta = [] # make sure this is empty.
# -------------------------------- #
# initialize node object
Node.__init__( self, treeType = self.treeType, \
name = self.name, \
record = self.record, \
results = self.parsedResults, \
cursor = self.cursor )
# -------------------------------- #
# generate descendant meta data
self.generate_descendant_meta()
logging.debug( "===================================" )
logging.debug( " RULE NODE CONSTRUCTOR : " )
logging.debug( " self.rid = " + str( self.rid ) )
logging.debug( " self.name = " + str( self.name ) )
logging.debug( " self.record = " + str( self.record ) )
logging.debug( " descendant_meta :" )
for d in self.descendant_meta :
logging.debug( " d = " + str( d ) )
logging.debug( "===================================" )
#############
# __STR__ #
#############
# the string representation of a RuleNode
def __str__( self ) :
return "rule->" + self.name + "(" + str(self.record) + ")"
##############################
# GENERATE DESCENDANT META #
##############################
# generate the meta data required to spawn the desendant goal or fact nodes.
#
# array of metadata for node descendants.
# [ { 'treeType' : "goal" | "fact",
# 'node_name' : <string>,
# 'triggerRecord' : <string>,
# 'polarity' : "notin" | "",
# }, ... ]
#
def generate_descendant_meta( self ) :
# -------------------------------- #
# get the list of goal attributes
self.cursor.execute( "SELECT attName \
FROM GoalAtt \
WHERE rid=='" + str( self.rid ) + "'" )
goal_atts = self.cursor.fetchall()
goal_atts = tools.toAscii_list( goal_atts )
logging.debug( " GENERATE DESCENDANT META : rid = " + self.rid )
logging.debug( " GENERATE DESCENDANT META : goal_atts = " + str( goal_atts ) )
# -------------------------------- #
# relate goal atts to data
# from record
gatt_to_data = {}
for i in range( 0, len( goal_atts ) ) :
gatt = goal_atts[ i ]
# handle goal attributes containing aggregate operators
if self.contains_op( gatt ) :
op = self.get_op( gatt )
lhs = self.get_lhs( gatt )
clean_gatt = self.get_clean_gatt( gatt )
raw_data = self.record[ i ]
if op == "+" :
real_data = str( int( raw_data ) - int( lhs ) )
elif op == "-" :
real_data = str( int( raw_data ) + int( lhs ) )
elif op == "*" :
real_data = str( int( raw_data ) / int( lhs ) )
elif op == "/" :
real_data = str( int( raw_data ) * int( lhs ) )
else :
tools.bp( __name__, inspect.stack()[0][3], " FATAL ERROR : unrecognized op '" + op + "'" )
gatt_to_data[ clean_gatt ] = real_data
# handle goal attributes containing aggregate functions
elif self.contains_agg( gatt ) :
op = self.get_op( gatt )
lhs = self.get_lhs( gatt )
clean_gatt = self.get_clean_gatt( gatt )
raw_data = self.record[ i ]
gatt_to_data[ clean_gatt ] = raw_data
else :
data = self.record[ i ]
gatt_to_data[ gatt ] = data
logging.debug( " GENERATE DESCENDANT META : gatt_to_data = " + str( gatt_to_data ) )
# -------------------------------- #
# get the list of subgoal names
# and polarities for each
# provenance rule.
self.cursor.execute( "SELECT sid,subgoalName,subgoalPolarity \
FROM Subgoals \
WHERE rid=='" + str( self.rid ) + "'" )
subgoal_list = self.cursor.fetchall()
subgoal_list = tools.toAscii_multiList( subgoal_list )
sid_to_name_and_polarity = {}
for sub in subgoal_list :
sid = sub[0]
subgoalName = sub[1]
subgoalPolarity = sub[2]
sid_to_name_and_polarity[ sid ] = [ subgoalName, subgoalPolarity ]
logging.debug( " GENERATE DESCENDANT META : sid_to_name_and_polarity = " + str( sid_to_name_and_polarity ) )
# -------------------------------- #
# remove subgoal duplicates
tmp = {}
tmp2 = {}
for sid in sid_to_name_and_polarity :
tmp[ str( sid_to_name_and_polarity[ sid ] ) ] = sid
for subgoalInfo in tmp :
array_str = subgoalInfo.translate( None, string.whitespace )
array_str = array_str.replace( "[", "" )
array_str = array_str.replace( "]", "" )
array_str = array_str.replace( "'", "" )
tmp2[ tmp[ subgoalInfo ] ] = array_str.split( "," )
sid_to_name_and_polarity = copy.copy( tmp2 )
logging.debug( " GENERATE DESCENDANT META : sid_to_name_and_polarity (after de-pulication) = " + str( sid_to_name_and_polarity ) )
# -------------------------------- #
# get the attribute list
# per subgoal
sid_to_subgoal_att_list = {}
for sid in sid_to_name_and_polarity :
self.cursor.execute( "SELECT attID,attName \
FROM SubgoalAtt \
WHERE rid=='" + str( self.rid ) + "' \
AND sid=='" + str( sid ) + "'" )
satt_list = self.cursor.fetchall()
satt_list = tools.toAscii_multiList( satt_list )
satt_list_atts_only = [ satt[1] for satt in satt_list ]
sid_to_subgoal_att_list[ sid ] = satt_list
logging.debug( " GENERATE DESCENDANT META : sid_to_subgoal_att_list = " + str( sid_to_subgoal_att_list ) )
# -------------------------------- #
# create one descendant per
# subgoal
#
# { 'treeType' : "goal" | "fact",
# 'node_name' : <string>,
# 'triggerRecord' : <string>,
# 'polarity' : "notin" | "",
# }
for sid in sid_to_name_and_polarity :
subgoalName = sid_to_name_and_polarity[ sid ][ 0 ]
subgoalPolarity = sid_to_name_and_polarity[ sid ][ 1 ]
logging.debug( " GENERATE DESCENDANT META : subgoalName = " + subgoalName )
logging.debug( " GENERATE DESCENDANT META : subgoalPolarity = " + subgoalPolarity )
if subgoalName.startswith( "domcomp_" ) or \
subgoalName.startswith( "dom_" ) or \
subgoalName.startswith( "unidom_" ) or \
subgoalName.startswith( "exidom_" ) or \
subgoalName.startswith( "orig_" ) :
logging.debug( " GENERATE DESCENDANT META : hit a " + subgoalName + " descendant. skipping creation... " )
pass
else :
subgoal_type_data = self.check_subgoal_type( subgoalName )
is_edb = subgoal_type_data[ 0 ]
is_idb = subgoal_type_data[ 1 ]
logging.debug( " GENERATE DESCENDAT META : is_edb := " + str( is_edb ) )
logging.debug( " GENERATE DESCENDAT META : is_idb := " + str( is_idb ) )
# -------------------------------- #
# CASE : subgoal is edb only,
# so spawn fact
if is_edb and not is_idb :
treeType = "fact"
# -------------------------------- #
# CASE : subgoal is idb only,
# so spawn goal
elif not is_edb and is_idb :
treeType = "goal"
# -------------------------------- #
# CASE : subgoal is both idb and
# edb, so break b/c ambiguous
elif is_edb and is_idb :
tools.bp( __name__, inspect.stack()[0][3], " FATAL ERROR : subgoal '" + subgoalName + "' is both edb and idb. ambiguous. aborting." )
# -------------------------------- #
# CASE : subgoal is neither idb
# nor edb, so break b/c
# something's wrogn
else :
tools.bp( __name__, inspect.stack()[0][3], " FATAL ERROR : subgoal '" + subgoalName + "' is neither edb nor idb. aborting." )
# -------------------------------- #
# get remaining data
node_name = subgoalName
polarity = subgoalPolarity
record = self.get_trigger_record_for_subgoal( gatt_to_data, sid_to_subgoal_att_list[ sid ] )
d = {}
d[ "treeType" ] = treeType
d[ "node_name" ] = node_name
d[ "triggerRecord" ] = record
d[ "polarity" ] = polarity
try :
TREE_SIMPLIFY = tools.getConfig( self.argDict[ "settings" ], "DEFAULT", "TREE_SIMPLIFY", bool )
except ConfigParser.NoOptionError :
TREE_SIMPLIFY = False
logging.warning( "WARNING : no 'TREE_SIMPLIFY' defined in 'DEFAULT' section of " + \
self.argDict[ "settings" ] + "...running with TREE_SIMPLIFY==False." )
logging.debug( " PROV TREE : using TREE_SIMPLIFY = " + str( TREE_SIMPLIFY ) )
if TREE_SIMPLIFY and self.is_interesting( d ) :
self.descendant_meta.append( d )
else :
self.descendant_meta.append( d )
####################
# IS INTERESTING #
####################
def is_interesting( self, d ) :
if d[ "treeType" ] == "fact" and not d[ "node_name" ] == "clock" :
return False
else :
return True
#################
# CONTAINS OP #
#################
# check if the input goal attribute
# contains an aggregate operator.
def contains_op( self, gatt ) :
for op in self.ops :
if op in gatt :
return True
return False
#################
# CONTAINS OP #
#################
# check if the input goal attribute
# contains an aggregate function.
def contains_agg( self, gatt ) :
for agg in self.aggs :
if agg in gatt :
return True
return False
############
# GET OP #
############
# grab the operation from the goal attribute string
def get_op( self, gatt ) :
if "+" in gatt :
return "+"
elif "-" in gatt :
return "-"
elif "*" in gatt :
return "*"
elif "/" in gatt :
return "/"
else :
return "NO_OP"
#############
# GET LHS #
#############
# grab the lhs from the goal attribute string
def get_lhs( self, gatt ) :
for i in range( 0, len( gatt ) ) :
if gatt[ i ] in self.ops :
return gatt[ i+1 : ]
return gatt
####################
# GET CLEAN GATT #
####################
# grab the goal attribute
# remove aggs
# remove operators
def get_clean_gatt( self, gatt ) :
logging.debug( " GET CLEAN GATT : gatt = " + gatt )
# remove aggs
for agg in self.aggs :
if gatt.startswith( agg ) and ">" in gatt :
gatt = gatt.replace( agg, "" )
gatt = gatt.replace( ">", "" )
# remove operators
for i in range( 0, len( gatt ) ) :
if gatt[ i ] in self.ops :
return gatt[ : i ]
logging.debug( "GET CLEAN GATT : returning gatt = " + gatt )
return gatt
####################################
# GET TRIGGER RECORD FOR SUBGOAL #
####################################
# use the map between goal attributes and record data
# to generate the trigger record for the subgoal
def get_trigger_record_for_subgoal( self, gatt_to_data, satt_list ) :
satt_list = [ satt[ 1 ] for satt in satt_list ] # remove attIDs
logging.debug( " GET TRIGGER RECORD FOR SUBGOAL : gatt_to_data = " + str( gatt_to_data ) )
logging.debug( " GET TRIGGER RECORD FOR SUBGOAL : satt_list = " + str( satt_list ) )
triggerRecord = []
for satt in satt_list :
logging.debug( " GET TRIGGER RECORD FOR SUBGOAL : satt = " + str( satt ) )
# keep wildcards
if satt == "_" :
triggerRecord.append( satt )
# keep fixed integer data
elif satt.isdigit() :
triggerRecord.append( satt )
# keep fixed string data
elif ( satt.startswith( "'" ) and satt.endswith( "'" ) ) or \
( satt.startswith( '"' ) and satt.endswith( '"' ) ) :
triggerRecord.append( satt )
else :
triggerRecord.append( gatt_to_data[ satt ] )
logging.debug( " GET TRIGGER RECORD FOR SUBGOAL : triggerRecord = " + str( triggerRecord ) )
return triggerRecord
########################
# CHECK SUBGOAL TYPE #
########################
def check_subgoal_type( self, subgoalName ) :
logging.debug( " CHECK SUBGOAL TYPE : subgoalName = " + subgoalName )
self.cursor.execute( "SELECT fid FROM Fact WHERE name=='" + subgoalName + "'" )
fid_list = self.cursor.fetchall()
fid_list = tools.toAscii_list( fid_list )
# clock, next_clock, and crash are edbs only
if subgoalName == "clock" or \
subgoalName == "next_clock" or \
subgoalName == "crash" :
return [ True, False ]
else :
if len( fid_list ) > 0 :
is_edb = True
else :
is_edb = False
self.cursor.execute( "SELECT rid FROM Rule WHERE goalName=='" + subgoalName + "'" )
rid_list = self.cursor.fetchall()
rid_list = tools.toAscii_list( rid_list )
if len( rid_list ) > 0 :
is_idb = True
else :
is_idb = False
return [ is_edb, is_idb ]
#########
# EOF #
#########
|
# -*- coding: utf-8 -*-
import re
from openerp import models, fields, api, _
from openerp import SUPERUSER_ID
from openerp.addons.website.models.website import slug
class event(models.Model):
_name = 'event.event'
_inherit = ['event.event', 'website.seo.metadata', 'website.published.mixin']
_track = {
'website_published': {
'website_event.mt_event_published': lambda self, cr, uid, obj, ctx=None: obj.website_published,
'website_event.mt_event_unpublished': lambda self, cr, uid, obj, ctx=None: not obj.website_published
},
}
twitter_hashtag = fields.Char('Twitter Hashtag', default=lambda self: self._default_hashtag())
# TDE TODO FIXME: when website_mail/mail_thread.py inheritance work -> this field won't be necessary
website_message_ids = fields.One2many(
'mail.message', 'res_id',
domain=lambda self: [
'&', ('model', '=', self._name), ('type', '=', 'comment')
],
string='Website Messages',
help="Website communication history",
)
@api.multi
@api.depends('name')
def _website_url(self, name, arg):
res = super(event, self)._website_url(name, arg)
res.update({(e.id, '/event/%s' % slug(e)) for e in self})
return res
def _default_hashtag(self):
return re.sub("[- \\.\\(\\)\\@\\#\\&]+", "", self.env.user.company_id.name).lower()
show_menu = fields.Boolean('Dedicated Menu', compute='_get_show_menu', inverse='_set_show_menu')
menu_id = fields.Many2one('website.menu', 'Event Menu')
@api.one
def _get_new_menu_pages(self):
todo = [
(_('Introduction'), 'website_event.template_intro'),
(_('Location'), 'website_event.template_location')
]
result = []
for name, path in todo:
complete_name = name + ' ' + self.name
newpath = self.env['website'].new_page(complete_name, path, ispage=False)
url = "/event/" + slug(self) + "/page/" + newpath
result.append((name, url))
result.append((_('Register'), '/event/%s/register' % slug(self)))
return result
@api.one
def _set_show_menu(self):
if self.menu_id and not self.show_menu:
self.menu_id.unlink()
elif self.show_menu and not self.menu_id:
root_menu = self.env['website.menu'].create({'name': self.name})
to_create_menus = self._get_new_menu_pages()[0] # TDE CHECK api.one -> returns a list with one item ?
seq = 0
for name, url in to_create_menus:
self.env['website.menu'].create({
'name': name,
'url': url,
'parent_id': root_menu.id,
'sequence': seq,
})
seq += 1
self.menu_id = root_menu
@api.one
def _get_show_menu(self):
self.show_menu = bool(self.menu_id)
def google_map_img(self, cr, uid, ids, zoom=8, width=298, height=298, context=None):
event = self.browse(cr, uid, ids[0], context=context)
if event.address_id:
return self.browse(cr, SUPERUSER_ID, ids[0], context=context).address_id.google_map_img()
return None
def google_map_link(self, cr, uid, ids, zoom=8, context=None):
event = self.browse(cr, uid, ids[0], context=context)
if event.address_id:
return self.browse(cr, SUPERUSER_ID, ids[0], context=context).address_id.google_map_link()
return None
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# findata documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
import os
# If extensions (or modules to document with autodoc) are in another
# directory, add these directories to sys.path here. If the directory is
# relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# Get the project root dir, which is the parent dir of this
cwd = os.getcwd()
project_root = os.path.dirname(cwd)
# Insert the project root dir as the first element in the PYTHONPATH.
# This lets us ensure that the source package is imported, and that its
# version is used.
sys.path.insert(0, project_root)
import fin_data
# -- General configuration ---------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'FinData'
copyright = u"2016, Gheorghe Postelnicu"
# The version info for the project you're documenting, acts as replacement
# for |version| and |release|, also used in various other places throughout
# the built documents.
#
# The short X.Y version.
version = fin_data.__version__
# The full version, including alpha/beta/rc tags.
release = fin_data.__version__
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to
# some non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built
# documents.
#keep_warnings = False
# -- Options for HTML output -------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
# Theme options are theme-specific and customize the look and feel of a
# theme further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as
# html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the
# top of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon
# of the docs. This file should be a Windows icon file (.ico) being
# 16x16 or 32x32 pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets)
# here, relative to this directory. They are copied after the builtin
# static files, so a file named "default.css" will overwrite the builtin
# "default.css".
html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page
# bottom, using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names
# to template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer.
# Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer.
# Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages
# will contain a <link> tag referring to it. The value of this option
# must be the base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'findatadoc'
# -- Options for LaTeX output ------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass
# [howto/manual]).
latex_documents = [
('index', 'findata.tex',
u'FinData Documentation',
u'Gheorghe Postelnicu', 'manual'),
]
# The name of an image file (relative to this directory) to place at
# the top of the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings
# are parts, not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output ------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'findata',
u'FinData Documentation',
[u'Gheorghe Postelnicu'], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output ----------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'findata',
u'FinData Documentation',
u'Gheorghe Postelnicu',
'findata',
'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False
|
import numpy as np
import warnings
from ._unwrap_1d import unwrap_1d
from ._unwrap_2d import unwrap_2d
from ._unwrap_3d import unwrap_3d
from .._shared.six import string_types
def unwrap_phase(image, wrap_around=False):
'''From ``image``, wrapped to lie in the interval [-pi, pi), recover the
original, unwrapped image.
Parameters
----------
image : 1D, 2D or 3D ndarray of floats, optionally a masked array
The values should be in the range ``[-pi, pi)``. If a masked array is
provided, the masked entries will not be changed, and their values
will not be used to guide the unwrapping of neighboring, unmasked
values. Masked 1D arrays are not allowed, and will raise a
``ValueError``.
wrap_around : bool or sequence of bool
When an element of the sequence is ``True``, the unwrapping process
will regard the edges along the corresponding axis of the image to be
connected and use this connectivity to guide the phase unwrapping
process. If only a single boolean is given, it will apply to all axes.
Wrap around is not supported for 1D arrays.
Returns
-------
image_unwrapped : array_like, float32
Unwrapped image of the same shape as the input. If the input ``image``
was a masked array, the mask will be preserved.
Raises
------
ValueError
If called with a masked 1D array or called with a 1D array and
``wrap_around=True``.
Examples
--------
>>> c0, c1 = np.ogrid[-1:1:128j, -1:1:128j]
>>> image = 12 * np.pi * np.exp(-(c0**2 + c1**2))
>>> image_wrapped = np.angle(np.exp(1j * image))
>>> image_unwrapped = unwrap_phase(image_wrapped)
>>> np.std(image_unwrapped - image) < 1e-6 # A constant offset is normal
True
References
----------
.. [1] Miguel Arevallilo Herraez, David R. Burton, Michael J. Lalor,
and Munther A. Gdeisat, "Fast two-dimensional phase-unwrapping
algorithm based on sorting by reliability following a noncontinuous
path", Journal Applied Optics, Vol. 41, No. 35 (2002) 7437,
.. [2] Abdul-Rahman, H., Gdeisat, M., Burton, D., & Lalor, M., "Fast
three-dimensional phase-unwrapping algorithm based on sorting by
reliability following a non-continuous path. In W. Osten,
C. Gorecki, & E. L. Novak (Eds.), Optical Metrology (2005) 32--40,
International Society for Optics and Photonics.
'''
if image.ndim not in (1, 2, 3):
raise ValueError('image must be 1, 2 or 3 dimensional')
if isinstance(wrap_around, bool):
wrap_around = [wrap_around] * image.ndim
elif (hasattr(wrap_around, '__getitem__')
and not isinstance(wrap_around, string_types)):
if len(wrap_around) != image.ndim:
raise ValueError('Length of wrap_around must equal the '
'dimensionality of image')
wrap_around = [bool(wa) for wa in wrap_around]
else:
raise ValueError('wrap_around must be a bool or a sequence with '
'length equal to the dimensionality of image')
if image.ndim == 1:
if np.ma.isMaskedArray(image):
raise ValueError('1D masked images cannot be unwrapped')
if wrap_around[0]:
raise ValueError('wrap_around is not supported for 1D images')
if image.ndim in (2, 3) and 1 in image.shape:
warnings.warn('image has a length 1 dimension; consider using an '
'array of lower dimensionality to use a more efficient '
'algorithm')
if np.ma.isMaskedArray(image):
mask = np.require(image.mask, np.uint8, ['C'])
else:
mask = np.zeros_like(image, dtype=np.uint8, order='C')
image_not_masked = np.asarray(image, dtype=np.float64, order='C')
image_unwrapped = np.empty_like(image, dtype=np.float64, order='C')
if image.ndim == 1:
unwrap_1d(image_not_masked, image_unwrapped)
elif image.ndim == 2:
unwrap_2d(image_not_masked, mask, image_unwrapped,
wrap_around)
elif image.ndim == 3:
unwrap_3d(image_not_masked, mask, image_unwrapped,
wrap_around)
if np.ma.isMaskedArray(image):
return np.ma.array(image_unwrapped, mask=mask)
else:
return image_unwrapped
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Ecogwiki OAuth client
`ecog` is a python client that talks with [ecogwiki](http://www.ecogwiki.com/). It is configurable to talk with any other ecogwiki hosts.
See https://github.com/jangxyz/ecogwiki-client for details.
"""
from setuptools import setup
def read_version():
import sys
import importlib
sys.path.insert(0, 'ecog')
try:
v = importlib.import_module('version')
return v.__version__
finally:
sys.path.pop(0)
setup(name='ecog',
version=read_version(),
author = 'Jang-hwan Kim',
author_email = 'janghwan@gmail.com',
description = 'Ecogwiki OAuth client',
long_description = __doc__,
url = 'https://github.com/jangxyz/ecogwiki-client',
packages = ['ecog'],
scripts = ['scripts/ecog'],
install_requires = ['oauth2', 'feedparser', 'python-dateutil'],
license = 'MIT License',
platforms = ['POSIX'],
keywords = ['oauth', 'markdown'],
classifiers = [line.strip() for line in '''
Development Status :: 3 - Alpha
Environment :: Console
Intended Audience :: Developers
Intended Audience :: End Users/Desktop
License :: OSI Approved :: MIT License
Natural Language :: English
Operating System :: POSIX
Programming Language :: Python :: 2.7
Topic :: Communications
Topic :: Terminals
Topic :: Text Processing
Topic :: Utilities
'''.strip().splitlines()]
)
|
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest.serialization import Model
class CheckNameAvailabilityResult(Model):
"""
The CheckNameAvailability operation response.
:param name_available: Gets a boolean value that indicates whether the
name is available for you to use. If true, the name is available. If
false, the name has already been taken or invalid and cannot be used.
:type name_available: bool
:param reason: Gets the reason that a storage account name could not be
used. The Reason element is only returned if NameAvailable is false.
Possible values include: 'AccountNameInvalid', 'AlreadyExists'
:type reason: str or :class:`Reason
<storagemanagementclient.models.Reason>`
:param message: Gets an error message explaining the Reason value in more
detail.
:type message: str
"""
_attribute_map = {
'name_available': {'key': 'nameAvailable', 'type': 'bool'},
'reason': {'key': 'reason', 'type': 'Reason'},
'message': {'key': 'message', 'type': 'str'},
}
def __init__(self, name_available=None, reason=None, message=None):
self.name_available = name_available
self.reason = reason
self.message = message
|
#
# This file is part of the PyMeasure package.
#
# Copyright (c) 2013-2021 PyMeasure Developers
#
# 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 logging
from os.path import basename
from .Qt import QtCore, QtGui
from ..experiment import Procedure
log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler())
class BrowserItem(QtGui.QTreeWidgetItem):
def __init__(self, results, curve, parent=None):
super().__init__(parent)
pixelmap = QtGui.QPixmap(24, 24)
pixelmap.fill(curve.opts['pen'].color())
self.setIcon(0, QtGui.QIcon(pixelmap))
self.setFlags(self.flags() | QtCore.Qt.ItemIsUserCheckable)
self.setCheckState(0, QtCore.Qt.Checked)
self.setText(1, basename(results.data_filename))
self.setStatus(results.procedure.status)
self.progressbar = QtGui.QProgressBar()
self.progressbar.setRange(0, 100)
self.progressbar.setValue(0)
def setStatus(self, status):
status_label = {
Procedure.QUEUED: 'Queued', Procedure.RUNNING: 'Running',
Procedure.FAILED: 'Failed', Procedure.ABORTED: 'Aborted',
Procedure.FINISHED: 'Finished'}
self.setText(3, status_label[status])
if status == Procedure.FAILED or status == Procedure.ABORTED:
# Set progress bar color to red
return # Commented this out
self.progressbar.setStyleSheet("""
QProgressBar {
border: 1px solid #AAAAAA;
border-radius: 5px;
text-align: center;
}
QProgressBar::chunk {
background-color: red;
}
""")
def setProgress(self, progress):
self.progressbar.setValue(progress)
class Browser(QtGui.QTreeWidget):
"""Graphical list view of :class:`Experiment<pymeasure.display.manager.Experiment>`
objects allowing the user to view the status of queued Experiments as well as
loading and displaying data from previous runs.
In order that different Experiments be displayed within the same Browser,
they must have entries in `DATA_COLUMNS` corresponding to the
`measured_quantities` of the Browser.
"""
def __init__(self, procedure_class, display_parameters,
measured_quantities, sort_by_filename=False, parent=None):
super().__init__(parent)
self.display_parameters = display_parameters
self.procedure_class = procedure_class
self.measured_quantities = measured_quantities
header_labels = ["Graph", "Filename", "Progress", "Status"]
for parameter in self.display_parameters:
header_labels.append(getattr(self.procedure_class, parameter).name)
self.setColumnCount(len(header_labels))
self.setHeaderLabels(header_labels)
self.setSortingEnabled(True)
if sort_by_filename:
self.sortItems(1, QtCore.Qt.AscendingOrder)
for i, width in enumerate([80, 140]):
self.header().resizeSection(i, width)
def add(self, experiment):
"""Add a :class:`Experiment<pymeasure.display.manager.Experiment>` object
to the Browser. This function checks to make sure that the Experiment
measures the appropriate quantities to warrant its inclusion, and then
adds a BrowserItem to the Browser, filling all relevant columns with
Parameter data.
"""
experiment_parameters = experiment.procedure.parameter_objects()
experiment_parameter_names = list(experiment_parameters.keys())
for measured_quantity in self.measured_quantities:
if measured_quantity not in experiment.procedure.DATA_COLUMNS:
raise Exception("Procedure does not measure the"
" %s quantity." % measured_quantity)
# Set the relevant fields within the BrowserItem if
# that Parameter is implemented
item = experiment.browser_item
for i, column in enumerate(self.display_parameters):
if column in experiment_parameter_names:
item.setText(i + 4, str(experiment_parameters[column]))
self.addTopLevelItem(item)
self.setItemWidget(item, 2, item.progressbar)
return item
|
# 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 mock
from karbor import context
from karbor.services.operationengine import user_trust_manager
from karbor.tests import base
G_TOKEN_ID = 'abcdefg'
G_TRUST_ID = '1234556'
class FakeSession(object):
def get_token(self):
return G_TOKEN_ID
class FakeSKP(object):
def create_trust_to_karbor(self, context):
return G_TRUST_ID
def delete_trust_to_karbor(self, trust_id):
return
def create_trust_session(self, trust_id):
return FakeSession()
class UserTrustManagerTestCase(base.TestCase):
"""Test cases for UserTrustManager class."""
def setUp(self):
super(UserTrustManagerTestCase, self).setUp()
self._user_id = '123'
self._project_id = '456'
self._ctx = context.RequestContext(user_id=self._user_id,
project_id=self._project_id)
self._manager = user_trust_manager.UserTrustManager()
self._manager._skp = FakeSKP()
def test_add_operation(self):
manager = self._manager
operation_id = 'abc'
self.assertEqual(G_TRUST_ID, manager.add_operation(
self._ctx, operation_id))
info = manager._get_user_trust_info(self._user_id, self._project_id)
self.assertIn(operation_id, info['operation_ids'])
manager.add_operation(self._ctx, operation_id)
self.assertEqual(1, len(info['operation_ids']))
@mock.patch.object(FakeSKP, 'delete_trust_to_karbor')
def test_delete_operation(self, del_trust):
manager = self._manager
op_ids = ['abc', '123']
for op_id in op_ids:
manager.add_operation(self._ctx, op_id)
info = manager._get_user_trust_info(self._user_id, self._project_id)
self.assertEqual(2, len(info['operation_ids']))
manager.delete_operation(self._ctx, op_ids[0])
self.assertEqual(1, len(info['operation_ids']))
manager.delete_operation(self._ctx, op_ids[1])
self.assertEqual(0, len(info['operation_ids']))
del_trust.assert_called_once_with(G_TRUST_ID)
def test_resume_operation(self):
manager = self._manager
operation_id = 'abc'
manager.resume_operation(operation_id, self._user_id,
self._project_id, G_TRUST_ID)
info = manager._get_user_trust_info(self._user_id, self._project_id)
self.assertIn(operation_id, info['operation_ids'])
manager.resume_operation(operation_id, self._user_id,
self._project_id, G_TRUST_ID)
self.assertEqual(1, len(info['operation_ids']))
def test_get_token(self):
manager = self._manager
manager.add_operation(self._ctx, 'abc')
self.assertEqual(G_TOKEN_ID, manager.get_token(
self._user_id, self._project_id))
|
from . import constants
from .map import Map
from .html import HTMLLayout
from ..utils.utils import get_center, get_credentials
from ..utils.metrics import send_metrics
from .kuviz import KuvizPublisher
class Layout:
"""Create a layout of visualizations in order to compare them.
Args:
maps (list of :py:class:`Map <cartoframes.viz.Map>`): List of
maps. Zero or more of :py:class:`Map <cartoframes.viz.Map>`.
n_size (number, optional): Number of columns of the layout
m_size (number, optional): Number of rows of the layout
viewport (dict, optional): Properties for display of the maps viewport.
Keys can be `bearing` or `pitch`.
is_static (boolean, optional): By default is False. All the maps in each visualization
are interactive. In order to set them static images for performance reasons
set `is_static` to True.
map_height (number, optional): Height in pixels for each visualization.
Default is 250.
full_height (boolean, optional): When a layout visualization is published, it
will fit the screen height. Otherwise, each visualization height will be
`map_height`. Default True.
Raises:
ValueError: if the input elements are not instances of :py:class:`Map <cartoframes.viz.Map>`.
Examples:
Basic usage.
>>> Layout([
... Map(Layer('table_in_your_account')), Map(Layer('table_in_your_account')),
... Map(Layer('table_in_your_account')), Map(Layer('table_in_your_account'))
>>> ])
Display a 2x2 layout.
>>> Layout([
... Map(Layer('table_in_your_account')), Map(Layer('table_in_your_account')),
... Map(Layer('table_in_your_account')), Map(Layer('table_in_your_account'))
>>> ], 2, 2)
Custom Titles.
>>> Layout([
... Map(Layer('table_in_your_account'), title="Visualization 1 custom title"),
... Map(Layer('table_in_your_account'), title="Visualization 2 custom title")),
>>> ])
Viewport.
>>> Layout([
... Map(Layer('table_in_your_account')),
... Map(Layer('table_in_your_account')),
... Map(Layer('table_in_your_account')),
... Map(Layer('table_in_your_account'))
>>> ], viewport={ 'zoom': 2 })
>>> Layout([
... Map(Layer('table_in_your_account'), viewport={ 'zoom': 0.5 }),
... Map(Layer('table_in_your_account')),
... Map(Layer('table_in_your_account')),
... Map(Layer('table_in_your_account'))
>>> ], viewport={ 'zoom': 2 })
Create an static layout
>>> Layout([
... Map(Layer('table_in_your_account')), Map(Layer('table_in_your_account')),
... Map(Layer('table_in_your_account')), Map(Layer('table_in_your_account'))
>>> ], is_static=True)
"""
def __init__(self,
maps,
n_size=None,
m_size=None,
viewport=None,
map_height=250,
full_height=True,
is_static=False,
**kwargs):
self._maps = maps
self._layout = _init_layout(self._maps, is_static, viewport)
self._n_size = n_size if n_size is not None else len(self._layout)
self._m_size = m_size if m_size is not None else constants.DEFAULT_LAYOUT_M_SIZE
self._viewport = viewport
self._is_static = is_static
self._map_height = map_height
self._full_height = full_height
self._publisher = None
self._carto_vl_path = kwargs.get('_carto_vl_path', None)
self._airship_path = kwargs.get('_airship_path', None)
def _repr_html_(self):
self._html_layout = HTMLLayout()
map_height = '100%' if self._full_height else '{}px'.format(self._map_height)
self._html_layout.set_content(
maps=self._layout,
size=['100%', self._map_height * self._m_size],
n_size=self._n_size,
m_size=self._m_size,
is_static=self._is_static,
map_height=map_height,
full_height=self._full_height,
_carto_vl_path=self._carto_vl_path,
_airship_path=self._airship_path
)
return self._html_layout.html
@send_metrics('map_published')
def publish(self, name, password, credentials=None, if_exists='fail', maps_api_key=None):
"""Publish the layout visualization as a CARTO custom visualization.
Args:
name (str): The visualization name on CARTO.
password (str): By setting it, your visualization will be protected by
password. When someone tries to show the visualization, the password
will be requested. To disable password you must set it to None.
credentials (:py:class:`Credentials <cartoframes.auth.Credentials>`, optional):
A Credentials instance. If not provided, the credentials will be automatically
obtained from the default credentials if available. It is used to create the
publication and also to save local data (if exists) into your CARTO account.
if_exists (str, optional): 'fail' or 'replace'. Behavior in case a publication with
the same name already exists in your account. Default is 'fail'.
maps_api_key (str, optional): The Maps API key used for private datasets.
Example:
Publishing the map visualization.
>>> tlayout = Layout([
... Map(Layer('table_in_your_account')), Map(Layer('table_in_your_account')),
... Map(Layer('table_in_your_account')), Map(Layer('table_in_your_account'))
>>> ])
>>> tlayout.publish('Custom Map Title', password=None)
"""
_credentials = get_credentials(credentials)
layers = []
for viz_map in self._maps:
for layer in viz_map.layers:
layers.append(layer)
self._publisher = _get_publisher(_credentials)
self._publisher.set_layers(layers, maps_api_key)
html = self._get_publication_html()
return self._publisher.publish(html, name, password, if_exists)
def update_publication(self, name, password, if_exists='fail'):
"""Update the published layout visualization.
Args:
name (str): The visualization name on CARTO.
password (str): setting it your visualization will be protected by
password and using `None` the visualization will be public.
if_exists (str, optional): 'fail' or 'replace'. Behavior in case a publication with the same name already
exists in your account. Default is 'fail'.
Raises:
PublishError: if the map has not been published yet.
"""
html = self._get_publication_html()
return self._publisher.update(html, name, password, if_exists)
def _get_publication_html(self):
if not self._publisher:
_credentials = get_credentials(None)
self._publisher = _get_publisher(_credentials)
html_layout = HTMLLayout('templates/viz/main_layout.html.j2')
layers = self._publisher.get_layers()
layer_index = 0
for viz_map in self._maps:
for layer in viz_map.layers:
layer.credentials = layers[layer_index].credentials
layer_index += 1
maps = _init_layout(self._maps, self._is_static, self._viewport)
map_height = '100%' if self._full_height else '{}px'.format(self._map_height)
html_layout.set_content(
maps=maps,
size=['100%', self._map_height * self._m_size],
n_size=self._n_size,
m_size=self._m_size,
is_static=self._is_static,
is_embed=True,
map_height=map_height
)
return html_layout.html
def _init_layout(maps, is_static, viewport):
layout = []
for map_index, viz in enumerate(maps):
if not isinstance(viz, Map):
raise ValueError('All the elements in the Layout should be an instance of Map.')
viz.is_static = _get_is_static(viz.is_static, is_static)
viz.viewport = _get_viewport(viz.viewport, viewport)
viz.camera = _get_camera(viz.viewport)
for layer in viz.layers:
layer.map_index = map_index
layer.reset_ui(viz)
layout.append(viz.get_content())
return layout
def _get_viewport(map_settings_viewport, layout_viewport):
if map_settings_viewport is not None:
return map_settings_viewport
return layout_viewport
def _get_camera(viewport):
camera = None
if viewport is not None:
camera = {
'center': get_center(viewport),
'zoom': viewport.get('zoom'),
'bearing': viewport.get('bearing'),
'pitch': viewport.get('pitch')
}
return camera
def _get_is_static(map_settings_is_static, layout_is_static):
if map_settings_is_static is not None:
return map_settings_is_static
return layout_is_static
def _get_publisher(credentials):
return KuvizPublisher(credentials)
|
# http://stackoverflow.com/a/22434262/398968
import os
import sys
import contextlib
def fileno(file_or_fd):
fd = getattr(file_or_fd, 'fileno', lambda: file_or_fd)()
if not isinstance(fd, int):
raise ValueError("Expected a file (`.fileno()`) or a file descriptor")
return fd
@contextlib.contextmanager
def stdout_redirected(to=os.devnull, stdout=None):
if stdout is None:
stdout = sys.stdout
stdout_fd = fileno(stdout)
# copy stdout_fd before it is overwritten
#NOTE: `copied` is inheritable on Windows when duplicating a standard stream
with os.fdopen(os.dup(stdout_fd), 'wb') as copied:
stdout.flush() # flush library buffers that dup2 knows nothing about
try:
os.dup2(fileno(to), stdout_fd) # $ exec >&to
except ValueError: # filename
with open(to, 'wb') as to_file:
os.dup2(to_file.fileno(), stdout_fd) # $ exec > to
try:
yield stdout # allow code to be run with the redirected stdout
finally:
# restore stdout to its previous value
#NOTE: dup2 makes stdout_fd inheritable unconditionally
stdout.flush()
os.dup2(copied.fileno(), stdout_fd) # $ exec >&copied
|
# vim:ts=4:sts=4:et:nowrap:tw=77
# -*- coding: utf-8 -*-
import os
import pygame
from pygame.locals import *
import constants
import common
from activity import Activity
from icons import Icons
class Finger(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
path = os.path.join(u"..", "data", "icons", "gartoon", "draw-brush.png")
self.image, self.rect = common.load_image(path)
def update(self):
pos = pygame.mouse.get_pos()
self.rect.bottomleft = (pos[0] - 10, pos[1] + 10)
class PaintBase(Activity):
def __init__(self, screen):
Activity.__init__(self, screen)
self.close_button = pygame.sprite.RenderUpdates(([Icons('stop')]))
self.finger = Finger()
self.cursor = pygame.sprite.RenderUpdates((self.finger))
self.pos = None
self.line_start = (0, 0)
self.draw_color = (0, 0, 0)
self.line_width = 3
self.line_end = None
self.text()
self.transparent = pygame.Rect(297, 96, 400, 408)
# Color palette
self.palette = {}
self.mk_palette(constants.rgb_colors)
# Thickness
self.thickness = {}
self.mk_thickness()
def mk_thickness(self):
options = (5, 10, 15, 20)
pos = [0, 215]
for option in options:
pos[0] += option + 25
self.thickness[option] = pygame.draw.circle(self.background, (0, 0, 0), pos, option)
def mk_palette(self, colors):
pos = (20, 285)
square = (20, 20)
count = 0
for key,color in colors.iteritems():
x = pos[0] + square[0] * (count % 11)
y = pos[1] + square[1] * (count / 11)
self.palette[key] = pygame.draw.rect(self.background, color, ((x, y), square))
count += 1
def handle_events(self):
for event in [pygame.event.wait()] + pygame.event.get():
if event.type == QUIT:
self.quit = True
return
elif event.type == pygame.MOUSEMOTION:
self.line_end = pygame.mouse.get_pos()
if pygame.mouse.get_pressed() == (1, 0, 0) and self.transparent.collidepoint(self.line_end):
pygame.draw.line(self.background, self.draw_color, self.line_start, self.line_end, self.line_width)
self.line_start = self.line_end
elif event.type == MOUSEBUTTONDOWN:
if pygame.sprite.spritecollideany(self.finger, self.close_button):
self.quit = True
return
else:
for key,rect in self.palette.iteritems():
if rect.collidepoint(self.line_end):
self.draw_color = constants.rgb_colors[key]
else:
for key,rect in self.thickness.iteritems():
if rect.collidepoint(self.line_end):
self.line_width = key
elif event.type == KEYUP:
self.changed = False
if event.key == K_ESCAPE:
self.quit = True
return
self.pos = pygame.mouse.get_pos()
if self.pos != self.mprev:
self.changed = True
def on_change(self):
self.cursor.update()
self.close_button.draw(self.screen)
self.cursor.draw(self.screen)
self.mprev = self.pos
def text(self):
# Title
font = pygame.font.SysFont(constants.font_title[0], constants.font_title[1])
font_height = font.get_linesize()
x, y = 20, 10
title = unicode("La salud de nuestra comunidad", 'utf-8')
text = font.render(title, True, constants.font_title_color, (255, 255, 255))
text_pos = (x, y)
self.background.blit(text, text_pos)
messages = ['Alguna de estas personas', \
'trabajan para mantener', \
'la salud de tu comunidad.', \
'Diviértete coloreándolos.']
y += 1.5 * font_height
font = pygame.font.SysFont(constants.font_default[0], constants.font_default[1])
font_height = font.get_linesize()
for message in messages:
message = unicode(message, 'utf-8')
text = font.render(message, True, constants.font_default_color, (255, 255, 255))
text_pos = (x, y)
self.background.blit(text, text_pos)
y += font_height
# Tools
palette_text = unicode("Paleta de colores", 'utf-8')
text = font.render(palette_text, True, constants.font_default_color, (255, 255, 255))
text_pos = (x, 250)
self.background.blit(text, text_pos)
pincel_text = unicode("Grosor del pincel", 'utf-8')
text = font.render(pincel_text, True, constants.font_default_color, (255, 255, 255))
text_pos = (x, 170)
self.background.blit(text, text_pos)
def setup(self):
pygame.mouse.set_visible(False)
self.close_button.draw(self.screen)
self.cursor.draw(self.screen)
class PaintBrickLayer(PaintBase):
def __init__(self, screen):
PaintBase.__init__(self, screen)
self.transparent = pygame.Rect(356, 156, 400, 410)
def setup_background(self):
self.background, rect = common.load_image(constants.bricklayer)
class PaintNurse(PaintBase):
def __init__(self, screen):
PaintBase.__init__(self, screen)
self.transparent = pygame.Rect(356, 156, 400, 423)
def setup_background(self):
self.background, rect = common.load_image(constants.nurse)
class PaintPolice(PaintBase):
def __init__(self, screen):
PaintBase.__init__(self, screen)
self.transparent = pygame.Rect(356, 156, 400, 415)
def setup_background(self):
self.background, rect = common.load_image(constants.police)
class PaintStreetSweeper(PaintBase):
def __init__(self, screen):
PaintBase.__init__(self, screen)
self.transparent = pygame.Rect(356, 66, 400, 529)
def setup_background(self):
self.background, rect = common.load_image(constants.streetsweeper)
class PaintBarber(PaintBase):
def __init__(self, screen):
PaintBase.__init__(self, screen)
self.transparent = pygame.Rect(356, 156, 400, 387)
def setup_background(self):
self.background, rect = common.load_image(constants.barber)
class PaintDoctor(PaintBase):
def __init__(self, screen):
PaintBase.__init__(self, screen)
self.transparent = pygame.Rect(356, 156, 400, 404)
def setup_background(self):
self.background, rect = common.load_image(constants.doctor)
class PaintFireFighter(PaintBase):
def __init__(self, screen):
PaintBase.__init__(self, screen)
self.transparent = pygame.Rect(356, 156, 400, 389)
def setup_background(self):
self.background, rect = common.load_image(constants.firefighter)
class PaintTeacher(PaintBase):
def __init__(self, screen):
PaintBase.__init__(self, screen)
self.transparent = pygame.Rect(356, 156, 400, 408)
def setup_background(self):
self.background, rect = common.load_image(constants.teacher)
class PaintMechanic(PaintBase):
def __init__(self, screen):
PaintBase.__init__(self, screen)
self.transparent = pygame.Rect(356, 156, 400, 426)
def setup_background(self):
self.background, rect = common.load_image(constants.mechanic)
if __name__ == "__main__":
pygame.init()
screen = pygame.display.set_mode(constants.screen_mode, 32)
paint = PaintMechanic(screen)
paint.run()
|
import pytest
from tests_python.debugger_unittest import IS_PY36_OR_GREATER, IS_CPYTHON
from tests_python.debug_constants import TEST_CYTHON
pytestmark = pytest.mark.skipif(not IS_PY36_OR_GREATER or not IS_CPYTHON or not TEST_CYTHON, reason='Requires CPython >= 3.6')
import sys
import unittest
from _pydevd_frame_eval.vendored.bytecode import Label, Instr, Compare, Bytecode, ControlFlowGraph
from _pydevd_frame_eval.vendored.bytecode import peephole_opt
from _pydevd_frame_eval.vendored.bytecode.tests import TestCase, dump_bytecode
from unittest import mock
class Tests(TestCase):
maxDiff = 80 * 100
def optimize_blocks(self, code):
if isinstance(code, Bytecode):
code = ControlFlowGraph.from_bytecode(code)
optimizer = peephole_opt.PeepholeOptimizer()
optimizer.optimize_cfg(code)
return code
def check(self, code, *expected):
if isinstance(code, Bytecode):
code = ControlFlowGraph.from_bytecode(code)
optimizer = peephole_opt.PeepholeOptimizer()
optimizer.optimize_cfg(code)
code = code.to_bytecode()
try:
self.assertEqual(code, expected)
except AssertionError:
print("Optimized code:")
dump_bytecode(code)
print("Expected code:")
for instr in expected:
print(instr)
raise
def check_dont_optimize(self, code):
code = ControlFlowGraph.from_bytecode(code)
noopt = code.to_bytecode()
optim = self.optimize_blocks(code)
optim = optim.to_bytecode()
self.assertEqual(optim, noopt)
def test_unary_op(self):
def check_unary_op(op, value, result):
code = Bytecode(
[Instr("LOAD_CONST", value), Instr(op), Instr("STORE_NAME", "x")]
)
self.check(code, Instr("LOAD_CONST", result), Instr("STORE_NAME", "x"))
check_unary_op("UNARY_POSITIVE", 2, 2)
check_unary_op("UNARY_NEGATIVE", 3, -3)
check_unary_op("UNARY_INVERT", 5, -6)
def test_binary_op(self):
def check_bin_op(left, op, right, result):
code = Bytecode(
[
Instr("LOAD_CONST", left),
Instr("LOAD_CONST", right),
Instr(op),
Instr("STORE_NAME", "x"),
]
)
self.check(code, Instr("LOAD_CONST", result), Instr("STORE_NAME", "x"))
check_bin_op(10, "BINARY_ADD", 20, 30)
check_bin_op(5, "BINARY_SUBTRACT", 1, 4)
check_bin_op(5, "BINARY_MULTIPLY", 3, 15)
check_bin_op(10, "BINARY_TRUE_DIVIDE", 3, 10 / 3)
check_bin_op(10, "BINARY_FLOOR_DIVIDE", 3, 3)
check_bin_op(10, "BINARY_MODULO", 3, 1)
check_bin_op(2, "BINARY_POWER", 8, 256)
check_bin_op(1, "BINARY_LSHIFT", 3, 8)
check_bin_op(16, "BINARY_RSHIFT", 3, 2)
check_bin_op(10, "BINARY_AND", 3, 2)
check_bin_op(2, "BINARY_OR", 3, 3)
check_bin_op(2, "BINARY_XOR", 3, 1)
def test_combined_unary_bin_ops(self):
# x = 1 + 3 + 7
code = Bytecode(
[
Instr("LOAD_CONST", 1),
Instr("LOAD_CONST", 3),
Instr("BINARY_ADD"),
Instr("LOAD_CONST", 7),
Instr("BINARY_ADD"),
Instr("STORE_NAME", "x"),
]
)
self.check(code, Instr("LOAD_CONST", 11), Instr("STORE_NAME", "x"))
# x = ~(~(5))
code = Bytecode(
[
Instr("LOAD_CONST", 5),
Instr("UNARY_INVERT"),
Instr("UNARY_INVERT"),
Instr("STORE_NAME", "x"),
]
)
self.check(code, Instr("LOAD_CONST", 5), Instr("STORE_NAME", "x"))
# "events = [(0, 'call'), (1, 'line'), (-(3), 'call')]"
code = Bytecode(
[
Instr("LOAD_CONST", 0),
Instr("LOAD_CONST", "call"),
Instr("BUILD_TUPLE", 2),
Instr("LOAD_CONST", 1),
Instr("LOAD_CONST", "line"),
Instr("BUILD_TUPLE", 2),
Instr("LOAD_CONST", 3),
Instr("UNARY_NEGATIVE"),
Instr("LOAD_CONST", "call"),
Instr("BUILD_TUPLE", 2),
Instr("BUILD_LIST", 3),
Instr("STORE_NAME", "events"),
]
)
self.check(
code,
Instr("LOAD_CONST", (0, "call")),
Instr("LOAD_CONST", (1, "line")),
Instr("LOAD_CONST", (-3, "call")),
Instr("BUILD_LIST", 3),
Instr("STORE_NAME", "events"),
)
# 'x = (1,) + (0,) * 8'
code = Bytecode(
[
Instr("LOAD_CONST", 1),
Instr("BUILD_TUPLE", 1),
Instr("LOAD_CONST", 0),
Instr("BUILD_TUPLE", 1),
Instr("LOAD_CONST", 8),
Instr("BINARY_MULTIPLY"),
Instr("BINARY_ADD"),
Instr("STORE_NAME", "x"),
]
)
zeros = (0,) * 8
result = (1,) + zeros
self.check(code, Instr("LOAD_CONST", result), Instr("STORE_NAME", "x"))
def test_max_size(self):
max_size = 3
with mock.patch.object(peephole_opt, "MAX_SIZE", max_size):
# optimized binary operation: size <= maximum size
#
# (9,) * size
size = max_size
result = (9,) * size
code = Bytecode(
[
Instr("LOAD_CONST", 9),
Instr("BUILD_TUPLE", 1),
Instr("LOAD_CONST", size),
Instr("BINARY_MULTIPLY"),
Instr("STORE_NAME", "x"),
]
)
self.check(code, Instr("LOAD_CONST", result), Instr("STORE_NAME", "x"))
# don't optimize binary operation: size > maximum size
#
# x = (9,) * size
size = max_size + 1
code = Bytecode(
[
Instr("LOAD_CONST", 9),
Instr("BUILD_TUPLE", 1),
Instr("LOAD_CONST", size),
Instr("BINARY_MULTIPLY"),
Instr("STORE_NAME", "x"),
]
)
self.check(
code,
Instr("LOAD_CONST", (9,)),
Instr("LOAD_CONST", size),
Instr("BINARY_MULTIPLY"),
Instr("STORE_NAME", "x"),
)
def test_bin_op_dont_optimize(self):
# 1 / 0
code = Bytecode(
[
Instr("LOAD_CONST", 1),
Instr("LOAD_CONST", 0),
Instr("BINARY_TRUE_DIVIDE"),
Instr("POP_TOP"),
Instr("LOAD_CONST", None),
Instr("RETURN_VALUE"),
]
)
self.check_dont_optimize(code)
# 1 // 0
code = Bytecode(
[
Instr("LOAD_CONST", 1),
Instr("LOAD_CONST", 0),
Instr("BINARY_FLOOR_DIVIDE"),
Instr("POP_TOP"),
Instr("LOAD_CONST", None),
Instr("RETURN_VALUE"),
]
)
self.check_dont_optimize(code)
# 1 % 0
code = Bytecode(
[
Instr("LOAD_CONST", 1),
Instr("LOAD_CONST", 0),
Instr("BINARY_MODULO"),
Instr("POP_TOP"),
Instr("LOAD_CONST", None),
Instr("RETURN_VALUE"),
]
)
self.check_dont_optimize(code)
# 1 % 1j
code = Bytecode(
[
Instr("LOAD_CONST", 1),
Instr("LOAD_CONST", 1j),
Instr("BINARY_MODULO"),
Instr("POP_TOP"),
Instr("LOAD_CONST", None),
Instr("RETURN_VALUE"),
]
)
self.check_dont_optimize(code)
def test_build_tuple(self):
# x = (1, 2, 3)
code = Bytecode(
[
Instr("LOAD_CONST", 1),
Instr("LOAD_CONST", 2),
Instr("LOAD_CONST", 3),
Instr("BUILD_TUPLE", 3),
Instr("STORE_NAME", "x"),
]
)
self.check(code, Instr("LOAD_CONST", (1, 2, 3)), Instr("STORE_NAME", "x"))
def test_build_list(self):
# test = x in [1, 2, 3]
code = Bytecode(
[
Instr("LOAD_NAME", "x"),
Instr("LOAD_CONST", 1),
Instr("LOAD_CONST", 2),
Instr("LOAD_CONST", 3),
Instr("BUILD_LIST", 3),
Instr("COMPARE_OP", Compare.IN),
Instr("STORE_NAME", "test"),
]
)
self.check(
code,
Instr("LOAD_NAME", "x"),
Instr("LOAD_CONST", (1, 2, 3)),
Instr("COMPARE_OP", Compare.IN),
Instr("STORE_NAME", "test"),
)
def test_build_list_unpack_seq(self):
for build_list in ("BUILD_TUPLE", "BUILD_LIST"):
# x, = [a]
code = Bytecode(
[
Instr("LOAD_NAME", "a"),
Instr(build_list, 1),
Instr("UNPACK_SEQUENCE", 1),
Instr("STORE_NAME", "x"),
]
)
self.check(code, Instr("LOAD_NAME", "a"), Instr("STORE_NAME", "x"))
# x, y = [a, b]
code = Bytecode(
[
Instr("LOAD_NAME", "a"),
Instr("LOAD_NAME", "b"),
Instr(build_list, 2),
Instr("UNPACK_SEQUENCE", 2),
Instr("STORE_NAME", "x"),
Instr("STORE_NAME", "y"),
]
)
self.check(
code,
Instr("LOAD_NAME", "a"),
Instr("LOAD_NAME", "b"),
Instr("ROT_TWO"),
Instr("STORE_NAME", "x"),
Instr("STORE_NAME", "y"),
)
# x, y, z = [a, b, c]
code = Bytecode(
[
Instr("LOAD_NAME", "a"),
Instr("LOAD_NAME", "b"),
Instr("LOAD_NAME", "c"),
Instr(build_list, 3),
Instr("UNPACK_SEQUENCE", 3),
Instr("STORE_NAME", "x"),
Instr("STORE_NAME", "y"),
Instr("STORE_NAME", "z"),
]
)
self.check(
code,
Instr("LOAD_NAME", "a"),
Instr("LOAD_NAME", "b"),
Instr("LOAD_NAME", "c"),
Instr("ROT_THREE"),
Instr("ROT_TWO"),
Instr("STORE_NAME", "x"),
Instr("STORE_NAME", "y"),
Instr("STORE_NAME", "z"),
)
def test_build_tuple_unpack_seq_const(self):
# x, y = (3, 4)
code = Bytecode(
[
Instr("LOAD_CONST", 3),
Instr("LOAD_CONST", 4),
Instr("BUILD_TUPLE", 2),
Instr("UNPACK_SEQUENCE", 2),
Instr("STORE_NAME", "x"),
Instr("STORE_NAME", "y"),
]
)
self.check(
code,
Instr("LOAD_CONST", (3, 4)),
Instr("UNPACK_SEQUENCE", 2),
Instr("STORE_NAME", "x"),
Instr("STORE_NAME", "y"),
)
def test_build_list_unpack_seq_const(self):
# x, y, z = [3, 4, 5]
code = Bytecode(
[
Instr("LOAD_CONST", 3),
Instr("LOAD_CONST", 4),
Instr("LOAD_CONST", 5),
Instr("BUILD_LIST", 3),
Instr("UNPACK_SEQUENCE", 3),
Instr("STORE_NAME", "x"),
Instr("STORE_NAME", "y"),
Instr("STORE_NAME", "z"),
]
)
self.check(
code,
Instr("LOAD_CONST", 5),
Instr("LOAD_CONST", 4),
Instr("LOAD_CONST", 3),
Instr("STORE_NAME", "x"),
Instr("STORE_NAME", "y"),
Instr("STORE_NAME", "z"),
)
def test_build_set(self):
# test = x in {1, 2, 3}
code = Bytecode(
[
Instr("LOAD_NAME", "x"),
Instr("LOAD_CONST", 1),
Instr("LOAD_CONST", 2),
Instr("LOAD_CONST", 3),
Instr("BUILD_SET", 3),
Instr("COMPARE_OP", Compare.IN),
Instr("STORE_NAME", "test"),
]
)
self.check(
code,
Instr("LOAD_NAME", "x"),
Instr("LOAD_CONST", frozenset((1, 2, 3))),
Instr("COMPARE_OP", Compare.IN),
Instr("STORE_NAME", "test"),
)
def test_compare_op_unary_not(self):
for op, not_op in (
(Compare.IN, Compare.NOT_IN), # in => not in
(Compare.NOT_IN, Compare.IN), # not in => in
(Compare.IS, Compare.IS_NOT), # is => is not
(Compare.IS_NOT, Compare.IS), # is not => is
):
code = Bytecode(
[
Instr("LOAD_NAME", "a"),
Instr("LOAD_NAME", "b"),
Instr("COMPARE_OP", op),
Instr("UNARY_NOT"),
Instr("STORE_NAME", "x"),
]
)
self.check(
code,
Instr("LOAD_NAME", "a"),
Instr("LOAD_NAME", "b"),
Instr("COMPARE_OP", not_op),
Instr("STORE_NAME", "x"),
)
# don't optimize:
# x = not (a and b is True)
label_instr5 = Label()
code = Bytecode(
[
Instr("LOAD_NAME", "a"),
Instr("JUMP_IF_FALSE_OR_POP", label_instr5),
Instr("LOAD_NAME", "b"),
Instr("LOAD_CONST", True),
Instr("COMPARE_OP", Compare.IS),
label_instr5,
Instr("UNARY_NOT"),
Instr("STORE_NAME", "x"),
Instr("LOAD_CONST", None),
Instr("RETURN_VALUE"),
]
)
self.check_dont_optimize(code)
def test_dont_optimize(self):
# x = 3 < 5
code = Bytecode(
[
Instr("LOAD_CONST", 3),
Instr("LOAD_CONST", 5),
Instr("COMPARE_OP", Compare.LT),
Instr("STORE_NAME", "x"),
Instr("LOAD_CONST", None),
Instr("RETURN_VALUE"),
]
)
self.check_dont_optimize(code)
# x = (10, 20, 30)[1:]
code = Bytecode(
[
Instr("LOAD_CONST", (10, 20, 30)),
Instr("LOAD_CONST", 1),
Instr("LOAD_CONST", None),
Instr("BUILD_SLICE", 2),
Instr("BINARY_SUBSCR"),
Instr("STORE_NAME", "x"),
]
)
self.check_dont_optimize(code)
def test_optimize_code_obj(self):
# Test optimize() method with a code object
#
# x = 3 + 5 => x = 8
noopt = Bytecode(
[
Instr("LOAD_CONST", 3),
Instr("LOAD_CONST", 5),
Instr("BINARY_ADD"),
Instr("STORE_NAME", "x"),
Instr("LOAD_CONST", None),
Instr("RETURN_VALUE"),
]
)
noopt = noopt.to_code()
optimizer = peephole_opt.PeepholeOptimizer()
optim = optimizer.optimize(noopt)
code = Bytecode.from_code(optim)
self.assertEqual(
code,
[
Instr("LOAD_CONST", 8, lineno=1),
Instr("STORE_NAME", "x", lineno=1),
Instr("LOAD_CONST", None, lineno=1),
Instr("RETURN_VALUE", lineno=1),
],
)
def test_return_value(self):
# return+return: remove second return
#
# def func():
# return 4
# return 5
code = Bytecode(
[
Instr("LOAD_CONST", 4, lineno=2),
Instr("RETURN_VALUE", lineno=2),
Instr("LOAD_CONST", 5, lineno=3),
Instr("RETURN_VALUE", lineno=3),
]
)
code = ControlFlowGraph.from_bytecode(code)
self.check(
code, Instr("LOAD_CONST", 4, lineno=2), Instr("RETURN_VALUE", lineno=2)
)
# return+return + return+return: remove second and fourth return
#
# def func():
# return 4
# return 5
# return 6
# return 7
code = Bytecode(
[
Instr("LOAD_CONST", 4, lineno=2),
Instr("RETURN_VALUE", lineno=2),
Instr("LOAD_CONST", 5, lineno=3),
Instr("RETURN_VALUE", lineno=3),
Instr("LOAD_CONST", 6, lineno=4),
Instr("RETURN_VALUE", lineno=4),
Instr("LOAD_CONST", 7, lineno=5),
Instr("RETURN_VALUE", lineno=5),
]
)
code = ControlFlowGraph.from_bytecode(code)
self.check(
code, Instr("LOAD_CONST", 4, lineno=2), Instr("RETURN_VALUE", lineno=2)
)
# return + JUMP_ABSOLUTE: remove JUMP_ABSOLUTE
# while 1:
# return 7
if sys.version_info < (3, 8):
setup_loop = Label()
return_label = Label()
code = Bytecode(
[
setup_loop,
Instr("SETUP_LOOP", return_label, lineno=2),
Instr("LOAD_CONST", 7, lineno=3),
Instr("RETURN_VALUE", lineno=3),
Instr("JUMP_ABSOLUTE", setup_loop, lineno=3),
Instr("POP_BLOCK", lineno=3),
return_label,
Instr("LOAD_CONST", None, lineno=3),
Instr("RETURN_VALUE", lineno=3),
]
)
code = ControlFlowGraph.from_bytecode(code)
end_loop = Label()
self.check(
code,
Instr("SETUP_LOOP", end_loop, lineno=2),
Instr("LOAD_CONST", 7, lineno=3),
Instr("RETURN_VALUE", lineno=3),
end_loop,
Instr("LOAD_CONST", None, lineno=3),
Instr("RETURN_VALUE", lineno=3),
)
else:
setup_loop = Label()
return_label = Label()
code = Bytecode(
[
setup_loop,
Instr("LOAD_CONST", 7, lineno=3),
Instr("RETURN_VALUE", lineno=3),
Instr("JUMP_ABSOLUTE", setup_loop, lineno=3),
Instr("LOAD_CONST", None, lineno=3),
Instr("RETURN_VALUE", lineno=3),
]
)
code = ControlFlowGraph.from_bytecode(code)
self.check(
code, Instr("LOAD_CONST", 7, lineno=3), Instr("RETURN_VALUE", lineno=3)
)
def test_not_jump_if_false(self):
# Replace UNARY_NOT+POP_JUMP_IF_FALSE with POP_JUMP_IF_TRUE
#
# if not x:
# y = 9
label = Label()
code = Bytecode(
[
Instr("LOAD_NAME", "x"),
Instr("UNARY_NOT"),
Instr("POP_JUMP_IF_FALSE", label),
Instr("LOAD_CONST", 9),
Instr("STORE_NAME", "y"),
label,
]
)
code = self.optimize_blocks(code)
label = Label()
self.check(
code,
Instr("LOAD_NAME", "x"),
Instr("POP_JUMP_IF_TRUE", label),
Instr("LOAD_CONST", 9),
Instr("STORE_NAME", "y"),
label,
)
def test_unconditional_jump_to_return(self):
# def func():
# if test:
# if test2:
# x = 10
# else:
# x = 20
# else:
# x = 30
label_instr11 = Label()
label_instr14 = Label()
label_instr7 = Label()
code = Bytecode(
[
Instr("LOAD_GLOBAL", "test", lineno=2),
Instr("POP_JUMP_IF_FALSE", label_instr11, lineno=2),
Instr("LOAD_GLOBAL", "test2", lineno=3),
Instr("POP_JUMP_IF_FALSE", label_instr7, lineno=3),
Instr("LOAD_CONST", 10, lineno=4),
Instr("STORE_FAST", "x", lineno=4),
Instr("JUMP_ABSOLUTE", label_instr14, lineno=4),
label_instr7,
Instr("LOAD_CONST", 20, lineno=6),
Instr("STORE_FAST", "x", lineno=6),
Instr("JUMP_FORWARD", label_instr14, lineno=6),
label_instr11,
Instr("LOAD_CONST", 30, lineno=8),
Instr("STORE_FAST", "x", lineno=8),
label_instr14,
Instr("LOAD_CONST", None, lineno=8),
Instr("RETURN_VALUE", lineno=8),
]
)
label1 = Label()
label3 = Label()
label4 = Label()
self.check(
code,
Instr("LOAD_GLOBAL", "test", lineno=2),
Instr("POP_JUMP_IF_FALSE", label3, lineno=2),
Instr("LOAD_GLOBAL", "test2", lineno=3),
Instr("POP_JUMP_IF_FALSE", label1, lineno=3),
Instr("LOAD_CONST", 10, lineno=4),
Instr("STORE_FAST", "x", lineno=4),
Instr("JUMP_ABSOLUTE", label4, lineno=4),
label1,
Instr("LOAD_CONST", 20, lineno=6),
Instr("STORE_FAST", "x", lineno=6),
Instr("JUMP_FORWARD", label4, lineno=6),
label3,
Instr("LOAD_CONST", 30, lineno=8),
Instr("STORE_FAST", "x", lineno=8),
label4,
Instr("LOAD_CONST", None, lineno=8),
Instr("RETURN_VALUE", lineno=8),
)
def test_unconditional_jumps(self):
# def func():
# if x:
# if y:
# func()
label_instr7 = Label()
code = Bytecode(
[
Instr("LOAD_GLOBAL", "x", lineno=2),
Instr("POP_JUMP_IF_FALSE", label_instr7, lineno=2),
Instr("LOAD_GLOBAL", "y", lineno=3),
Instr("POP_JUMP_IF_FALSE", label_instr7, lineno=3),
Instr("LOAD_GLOBAL", "func", lineno=4),
Instr("CALL_FUNCTION", 0, lineno=4),
Instr("POP_TOP", lineno=4),
label_instr7,
Instr("LOAD_CONST", None, lineno=4),
Instr("RETURN_VALUE", lineno=4),
]
)
label_return = Label()
self.check(
code,
Instr("LOAD_GLOBAL", "x", lineno=2),
Instr("POP_JUMP_IF_FALSE", label_return, lineno=2),
Instr("LOAD_GLOBAL", "y", lineno=3),
Instr("POP_JUMP_IF_FALSE", label_return, lineno=3),
Instr("LOAD_GLOBAL", "func", lineno=4),
Instr("CALL_FUNCTION", 0, lineno=4),
Instr("POP_TOP", lineno=4),
label_return,
Instr("LOAD_CONST", None, lineno=4),
Instr("RETURN_VALUE", lineno=4),
)
def test_jump_to_return(self):
# def func(condition):
# return 'yes' if condition else 'no'
label_instr4 = Label()
label_instr6 = Label()
code = Bytecode(
[
Instr("LOAD_FAST", "condition"),
Instr("POP_JUMP_IF_FALSE", label_instr4),
Instr("LOAD_CONST", "yes"),
Instr("JUMP_FORWARD", label_instr6),
label_instr4,
Instr("LOAD_CONST", "no"),
label_instr6,
Instr("RETURN_VALUE"),
]
)
label = Label()
self.check(
code,
Instr("LOAD_FAST", "condition"),
Instr("POP_JUMP_IF_FALSE", label),
Instr("LOAD_CONST", "yes"),
Instr("RETURN_VALUE"),
label,
Instr("LOAD_CONST", "no"),
Instr("RETURN_VALUE"),
)
def test_jump_if_true_to_jump_if_false(self):
# Replace JUMP_IF_TRUE_OR_POP jumping to POP_JUMP_IF_FALSE <target>
# with POP_JUMP_IF_TRUE <offset after the second POP_JUMP_IF_FALSE>
#
# if x or y:
# z = 1
label_instr3 = Label()
label_instr7 = Label()
code = Bytecode(
[
Instr("LOAD_NAME", "x"),
Instr("JUMP_IF_TRUE_OR_POP", label_instr3),
Instr("LOAD_NAME", "y"),
label_instr3,
Instr("POP_JUMP_IF_FALSE", label_instr7),
Instr("LOAD_CONST", 1),
Instr("STORE_NAME", "z"),
label_instr7,
Instr("LOAD_CONST", None),
Instr("RETURN_VALUE"),
]
)
label_instr4 = Label()
label_instr7 = Label()
self.check(
code,
Instr("LOAD_NAME", "x"),
Instr("POP_JUMP_IF_TRUE", label_instr4),
Instr("LOAD_NAME", "y"),
Instr("POP_JUMP_IF_FALSE", label_instr7),
label_instr4,
Instr("LOAD_CONST", 1),
Instr("STORE_NAME", "z"),
label_instr7,
Instr("LOAD_CONST", None),
Instr("RETURN_VALUE"),
)
def test_jump_if_false_to_jump_if_false(self):
# Replace JUMP_IF_FALSE_OR_POP jumping to POP_JUMP_IF_FALSE <label>
# with POP_JUMP_IF_FALSE <label>
#
# while n > 0 and start > 3:
# func()
if sys.version_info < (3, 8):
label_instr1 = Label()
label_instr15 = Label()
label_instr17 = Label()
label_instr9 = Label()
code = Bytecode(
[
Instr("SETUP_LOOP", label_instr17),
label_instr1,
Instr("LOAD_NAME", "n"),
Instr("LOAD_CONST", 0),
Instr("COMPARE_OP", Compare.GT),
# JUMP_IF_FALSE_OR_POP jumps to POP_JUMP_IF_FALSE
# which jumps to label_instr15
Instr("JUMP_IF_FALSE_OR_POP", label_instr9),
Instr("LOAD_NAME", "start"),
Instr("LOAD_CONST", 3),
Instr("COMPARE_OP", Compare.GT),
label_instr9,
Instr("POP_JUMP_IF_FALSE", label_instr15),
Instr("LOAD_NAME", "func"),
Instr("CALL_FUNCTION", 0),
Instr("POP_TOP"),
Instr("JUMP_ABSOLUTE", label_instr1),
label_instr15,
Instr("POP_BLOCK"),
label_instr17,
Instr("LOAD_CONST", None),
Instr("RETURN_VALUE"),
]
)
label_instr1 = Label()
label_instr14 = Label()
label_instr16 = Label()
self.check(
code,
Instr("SETUP_LOOP", label_instr16),
label_instr1,
Instr("LOAD_NAME", "n"),
Instr("LOAD_CONST", 0),
Instr("COMPARE_OP", Compare.GT),
Instr("POP_JUMP_IF_FALSE", label_instr14),
Instr("LOAD_NAME", "start"),
Instr("LOAD_CONST", 3),
Instr("COMPARE_OP", Compare.GT),
Instr("POP_JUMP_IF_FALSE", label_instr14),
Instr("LOAD_NAME", "func"),
Instr("CALL_FUNCTION", 0),
Instr("POP_TOP"),
Instr("JUMP_ABSOLUTE", label_instr1),
label_instr14,
Instr("POP_BLOCK"),
label_instr16,
Instr("LOAD_CONST", None),
Instr("RETURN_VALUE"),
)
else:
label_instr1 = Label()
label_instr15 = Label()
label_instr9 = Label()
code = Bytecode(
[
label_instr1,
Instr("LOAD_NAME", "n"),
Instr("LOAD_CONST", 0),
Instr("COMPARE_OP", Compare.GT),
# JUMP_IF_FALSE_OR_POP jumps to POP_JUMP_IF_FALSE
# which jumps to label_instr15
Instr("JUMP_IF_FALSE_OR_POP", label_instr9),
Instr("LOAD_NAME", "start"),
Instr("LOAD_CONST", 3),
Instr("COMPARE_OP", Compare.GT),
label_instr9,
Instr("POP_JUMP_IF_FALSE", label_instr15),
Instr("LOAD_NAME", "func"),
Instr("CALL_FUNCTION", 0),
Instr("POP_TOP"),
Instr("JUMP_ABSOLUTE", label_instr1),
label_instr15,
Instr("LOAD_CONST", None),
Instr("RETURN_VALUE"),
]
)
label_instr1 = Label()
label_instr14 = Label()
self.check(
code,
label_instr1,
Instr("LOAD_NAME", "n"),
Instr("LOAD_CONST", 0),
Instr("COMPARE_OP", Compare.GT),
Instr("POP_JUMP_IF_FALSE", label_instr14),
Instr("LOAD_NAME", "start"),
Instr("LOAD_CONST", 3),
Instr("COMPARE_OP", Compare.GT),
Instr("POP_JUMP_IF_FALSE", label_instr14),
Instr("LOAD_NAME", "func"),
Instr("CALL_FUNCTION", 0),
Instr("POP_TOP"),
Instr("JUMP_ABSOLUTE", label_instr1),
label_instr14,
Instr("LOAD_CONST", None),
Instr("RETURN_VALUE"),
)
def test_nop(self):
code = Bytecode(
[Instr("LOAD_NAME", "x"), Instr("NOP"), Instr("STORE_NAME", "test")]
)
self.check(code, Instr("LOAD_NAME", "x"), Instr("STORE_NAME", "test"))
def test_dead_code_jump(self):
label = Label()
code = Bytecode(
[
Instr("LOAD_NAME", "x"),
Instr("JUMP_ABSOLUTE", label),
# dead code
Instr("LOAD_NAME", "y"),
Instr("STORE_NAME", "test"),
label,
Instr("STORE_NAME", "test"),
]
)
self.check(code, Instr("LOAD_NAME", "x"), Instr("STORE_NAME", "test"))
def test_uncond_jump_to_uncond_jump(self):
# Replace JUMP_FORWARD t1 jumping to JUMP_FORWARD t2
# with JUMP_ABSOLUTE t2
label = Label()
label2 = Label()
label3 = Label()
label4 = Label()
code = Bytecode(
[
Instr("LOAD_NAME", "test"),
Instr("POP_JUMP_IF_TRUE", label),
# redundant jump
Instr("JUMP_FORWARD", label2),
label,
Instr("LOAD_CONST", 1),
Instr("STORE_NAME", "x"),
Instr("LOAD_NAME", "test"),
Instr("POP_JUMP_IF_TRUE", label3),
label2,
Instr("JUMP_FORWARD", label4),
label3,
Instr("LOAD_CONST", 1),
Instr("STORE_NAME", "x"),
label4,
Instr("LOAD_CONST", None),
Instr("RETURN_VALUE"),
]
)
label = Label()
label3 = Label()
label4 = Label()
self.check(
code,
Instr("LOAD_NAME", "test"),
Instr("POP_JUMP_IF_TRUE", label),
# JUMP_FORWARD label2 was replaced with JUMP_ABSOLUTE label4
Instr("JUMP_ABSOLUTE", label4),
label,
Instr("LOAD_CONST", 1),
Instr("STORE_NAME", "x"),
Instr("LOAD_NAME", "test"),
Instr("POP_JUMP_IF_TRUE", label3),
Instr("JUMP_FORWARD", label4),
label3,
Instr("LOAD_CONST", 1),
Instr("STORE_NAME", "x"),
label4,
Instr("LOAD_CONST", None),
Instr("RETURN_VALUE"),
)
if __name__ == "__main__":
unittest.main() # pragma: no cover
|
from test_fena.test_common import test_cmd
def test_teams():
test_cmd("team add _team team_test", "team add fena.team team_test")
test_cmd("team add _team team test", "team add fena.team team test")
test_cmd("team empty _team", "team empty fena.team")
test_cmd("team _team + @a", "team join fena.team @a")
test_cmd("team _team + target", "team join fena.team target")
test_cmd("team leave @a", "team leave @a")
test_cmd("team leave target", "team leave target")
test_cmd("team remove _team", "team remove fena.team")
test_cmd("team _team friendlyfire = true", "team option fena.team friendlyfire true")
test_cmd("team _team color = green", "team option fena.team color green")
test_cmd("team _team seeFriendlyInvisibles = false", "team option fena.team seeFriendlyInvisibles false")
test_cmd("team _team nametagVisibility = hideForOwnTeam", "team option fena.team nametagVisibility hideForOwnTeam")
test_cmd("team _team deathMessageVisibility = never", "team option fena.team deathMessageVisibility never")
test_cmd("team _team collisionRule = pushOwnTeam", "team option fena.team collisionRule pushOwnTeam")
test_cmd(r'team _team prefix = {"text":"PREFIX","color":"blue"}', r'team option fena.team prefix {"text":"PREFIX","color":"blue"}')
test_cmd(r'team _team suffix = {"text":"SUFFIX","color":"red"}', r'team option fena.team suffix {"text":"SUFFIX","color":"red"}')
|
from __future__ import division
import datetime
import math
__author__ = 'Ryan W. Howe'
class SunStat:
def __init__(self, latitude, longitude, year, month, day, utcoffset=0):
"""SunStat class is able to provide the sunset, sunrise, or noon time for the Sun at a provided date.
DISCLAIMER These calculations are theoretically accurate to the minute for locations between +/- 72 degrees
latitude, and within 10 minutes outside those latitudes. However due to variations in atmospheric composition,
temperature, pressure and conditions, observed values my vary from calculations.
The calculations (other than the Julian Day) are all taken from the NOAA, which came from Astronomical
Algorithms written by Jean Meeus.
:param latitude: Observation Latitude (+ North)
:param longitude: Observation Longitude (+ East)
:param year: Year of the Date for Observation
:param month: Month of the Date for Observation
:param day: Day of the Date for Observation
:param utcoffset: current UTC offset (else time objects are in UTC)
:return:
"""
try:
self.__date = datetime.date(year, month, day)
except:
raise SunStatException(self, "An invalid calendar date was entered")
if (latitude >= 90) | (latitude <= -90):
raise SunStatException(self, "Latitude range is 89.9999 to -89.9999")
else:
self.__latitude = latitude
if (longitude >= 180) | (longitude <= -180):
raise SunStatException(self, "Longitude range is 179.9999 to -179.9999")
else:
self.__longitude = longitude
if (utcoffset > 14) | (utcoffset < -14):
raise SunStatException(self, "UTC offsets are only valid between 14 and -14")
else:
self.__utcoffset = utcoffset
def julian_day(self):
""" This converts the current Gregorian calendar date into a Julian Day Number.
which means how many days have passed since noon November 24th, 4714 BC(Gregorian Calendar) at Greenwich
Once you understand that the math makes more sense.
all math taken from http://en.wikipedia.org/wiki/Julian_day
a is calculated so that it will be a 1 for January and February and 0 for all other months
y is the number of years since March 1st, -4800 (with a correction if we are in either Jan or Feb)
m is the current month since March (ie April = 4 so a = 0 and m = 4 + 12*0 - 3 ==> 1)
for the return calculation the first term is simply the day of the month
The second is some math magic that comes from integer division, using the m calculated above and removing the
remainder, this will give you the appropriate number of whole days since March 1 so for April (m=1)
so (153 * 1 + 2)// 5 = 31 (there are 31 days in March and that is how many have passed for April 1 for May 1
(m = 2) and (153 * 2 + 2)//5 = 61 (31 days for March and 30 for April). Give it a try, it is kinda cool!
Third term is simply the days in a standard calendar year (given the years as computed above)
Fourth, fifth, sixth terms all correct for leap years
so you add a day every year that is divisible by 4, subtract 1 back for the ones that are also divisible
by 100 then add back in the ones that are also divisible by 400 you can check here
http://en.wikipedia.org/wiki/Leap_year , I had to in theory (365 * y) could have just been replaced by
(365.2425 * y) but there is enough going on that I stuck with the wiki calculations
Lastly there is the number of days that are over counted going to 4800 BC, since we are only suppose to go to
4714 BC, the length of the year was calculated differently before the Gregorian calendar existed this factor
gets us to the correct whole date from March 1st, 4801 BC (or March 1st, -4800)
:return: float Julian Day of the passed Gregorian calendar date
"""
a = (14 - self.__date.month) // 12
y = self.__date.year + 4800 - a
m = self.__date.month + 12 * a - 3
return self.__date.day + ((153 * m + 2) // 5) + (365 * y) + (y // 4) - (y // 100) + (y // 400) - 32045
def julian_century(self):
"""Compute the current Julian Century
Julian Century starts from the Julian day of 2000/01/01 at 12:00 UTC which is a Julian Day of 2451545.0
The Julian calendar is exactly 365.25 days long, therefor the Julian century is 36525 days long.
Starting with the current Julian day the calculation is straight forward.
:return:float Julian Century
"""
return (self.julian_day() - 2451545) / 36525
def geom_mean_long_sun(self):
"""Calculate the mean longitude Solar Coordinate
:return:float degrees
"""
return 280.46646 + self.julian_century() * (36000.76983 + self.julian_century() * 0.0003032) % 360
def geom_mean_anom_sun(self):
"""Calculate the anomaly Solar Coordinate
:return:float degrees
"""
return 357.52911 + self.julian_century() * (35999.05029 - 0.0001537 * self.julian_century())
def sun_eq_of_cent(self):
"""Calculate the off center Solar Coordinate
:return:float degree
"""
return math.sin(math.radians(self.geom_mean_anom_sun())) * (
1.914602 - self.julian_century() * (0.004817 + 0.000014 * self.julian_century())) + math.sin(
math.radians(2 * self.geom_mean_anom_sun())) * (0.019993 - 0.000101 * self.julian_century()) + math.sin(
math.radians(3 * self.geom_mean_anom_sun())) * 0.000289
def sun_true_long(self):
return self.geom_mean_long_sun() + self.sun_eq_of_cent()
def sun_app_long(self):
return self.sun_true_long() - 0.00569 - 0.00478 * math.sin(
math.radians(125.04 - 1934.136 * self.julian_century()))
def mean_obliq_ecliptic(self):
"""
Calculate the ecliptic longitude to right ascension and declination delta
:return:
"""
return 23 + (26 + ((21.448 - self.julian_century() * (
46.815 + self.julian_century() * (0.00059 - self.julian_century() * 0.001813)))) / 60) / 60
def obliq_corr(self):
return self.mean_obliq_ecliptic() + 0.00256 * math.cos(math.radians(125.04 - 1934.136 * self.julian_century()))
def sun_declin(self):
return math.degrees(
math.asin(math.sin(math.radians(self.obliq_corr())) * math.sin(math.radians(self.sun_app_long()))))
def ha_sunrise(self):
return math.degrees(math.acos(math.cos(math.radians(90.833)) / (
math.cos(math.radians(self.__latitude)) * math.cos(math.radians(self.sun_declin()))) - math.tan(
math.radians(self.__latitude)) * math.tan(math.radians(self.sun_declin()))))
def eccent_earth_orbit(self):
return 0.016708634 - self.julian_century() * (0.000042037 + 0.0000001267 * self.julian_century())
def var_y(self):
return math.tan(math.radians(self.obliq_corr() / 2)) * math.tan(math.radians(self.obliq_corr() / 2))
def eq_of_time(self):
return 4 * math.degrees(
self.var_y() * math.sin(2 * math.radians(self.geom_mean_long_sun()))
- 2 * self.eccent_earth_orbit() * math.sin(math.radians(self.geom_mean_anom_sun()))
+ 4 * self.eccent_earth_orbit() * self.var_y() * math.sin(
math.radians(self.geom_mean_anom_sun())) * math.cos(2 * math.radians(self.geom_mean_long_sun()))
- 0.5 * self.var_y() * self.var_y() * math.sin(4 * math.radians(self.geom_mean_long_sun()))
- 1.25 * self.eccent_earth_orbit() * self.eccent_earth_orbit() * math.sin(
2 * math.radians(self.geom_mean_anom_sun()))
)
def __solar_noon_since_midnight(self):
return 720 - 4 * self.__longitude - self.eq_of_time() + self.__utcoffset * 60
def __sun_rise_since_midnight(self):
return self.__solar_noon_since_midnight() - self.ha_sunrise() * 4
def __sun_set_since_midnight(self):
return self.__solar_noon_since_midnight() + self.ha_sunrise() * 4
def sunrise(self):
_hour = self.__sun_rise_since_midnight() // 60
_minute = self.__sun_rise_since_midnight() - (60 * _hour)
_second, _minute = math.modf(_minute)
_second *= 60
_millisecond, _second = math.modf(_second)
return datetime.time(int(_hour), int(_minute), int(_second), int(_millisecond * 1000000))
def sunset(self):
_hour = self.__sun_set_since_midnight() // 60
_minute = self.__sun_set_since_midnight() - (60 * _hour)
_second, _minute = math.modf(_minute)
_second *= 60
_millisecond, _second = math.modf(_second)
return datetime.time(int(_hour), int(_minute), int(_second), int(_millisecond * 1000000))
def noon(self):
_hour = self.__solar_noon_since_midnight() // 60
_minute = self.__solar_noon_since_midnight() - (60 * _hour)
_second, _minute = math.modf(_minute)
_second *= 60
_millisecond, _second = math.modf(_second)
return datetime.time(int(_hour), int(_minute), int(_second), int(_millisecond * 1000000))
class SunStatException(Exception):
def __init__(self, parent, msg):
self.message = msg
def __str__(self):
return self.message
|
import time
import math
from scipy import signal
class Oscillator(object):
def __init__(self, signal=None, period=2000, amplitude=50, phase=0, offset=0):
self.period = period
self.amplitude = amplitude
self.phase = phase
self.offset = offset
self.stop = False
self.ref_time = time.time()*1000
self.delta_time = 0
self.signal = signal or math.sin
def refresh(self):
self.delta_time = (time.time()*1000-self.ref_time*1000) % self.period
self.output = self.amplitude*self.signal(self.time_to_radians(self.delta_time) + self.degrees_to_radians(self.phase)) + self.offset
return self.output
def reset(self):
self.ref_time = time.time()*1000
def time_to_radians(self, time):
return float(time)*2*math.pi/self.period
def degrees_to_radians(self, degrees):
return float(degrees)*2*math.pi/360
def degrees_to_time(self, degrees):
return float(degrees)*self.period/360
def sawtooth(val):
return signal.sawtooth(val)
def semiSin(val):
out = math.sin(val)
if out <= 0:
out = 0
return out
def triangle(self, val):
# return (self.amplitude*2/math.pi)*math.asin(math.sin(val*2*math.pi/self.period))
val += 1
return abs((val % 2)-1)
|
import os
try:
import OpenGL.GL as GL
import OpenGL.GLU as GLU
except ImportError:
raise ImportError, "OpenGL must be installed to use these functionalities"
import numpy
try:
from PyMca import spslut
except:
import spslut
try:
from PyMca.Object3D import Object3DFileDialogs
from PyMca.Object3D import Object3DBase
except ImportError:
from Object3D import Object3DFileDialogs
from Object3D import Object3DBase
try:
from PyMca.Object3D import Object3DCTools
except ImportError:
try:
from Object3D import Object3DCTools
except:
import Object3DCTools
import Object3DMeshConfig
qt = Object3DMeshConfig.qt
import weakref
#import buffers
DEBUG = 0
import time
DRAW_MODES = ['NONE',
'POINT',
'WIRE',
'SURFACE',
'LIGHT',
'POINT_SELECTION']
COLORMAPLIST = [spslut.GREYSCALE, spslut.REVERSEGREY, spslut.TEMP,
spslut.RED, spslut.GREEN, spslut.BLUE, spslut.MANY]
class Object3DStack(Object3DBase.Object3D):
def __init__(self, name = "3D-Array"):
Object3DBase.Object3D.__init__(self, name)
self._alpha = 255
self.drawListDict = {}
self._forceListCalculation = {}
self.vertices = None
self.vertexColors = None
self.vertexSelectionColors = None
self._selected = False
self._vertexSelectionMode = False
self.drawMode = 'POINT'
self.__isosurfacesDict = {}
for i in range(5):
self.__isosurfacesDict[i] = {}
self.__isosurfacesDict[i]['list'] = 0
self.__isosurfacesDict[i]['value'] = 0
self.__isosurfacesDict[i]['color'] = 'red'
self.__isosurfacesDict[i]['r'] = 0xFF
self.__isosurfacesDict[i]['g'] = 0
self.__isosurfacesDict[i]['b'] = 0
self.__isosurfacesDict[i]['a'] = 0xFF
self._configuration['common']['supportedmodes'] = [1, 1, 1, 1]
self._configuration['common']['mode'] = 1
#centered on XY plane and on Z
self._configuration['common']['anchor'] = [2, 2, 2]
#self._verticesBufferObject = None
#self._vertexColorBufferObject = None
#self._vertexSelectionColorBufferObject = None
def initPrivateConfiguration(self, name):
"""
Specific configuration
"""
self._configuration['private'] = {}
if self._privateConfigurationWidget is None:
self._privateConfigurationWidget = Object3DMeshConfig.\
Object3DMeshConfig(None, name)
self._configuration['private']['widget'] = weakref.proxy(self._privateConfigurationWidget)
self._configuration['private']['colorfilter'] = 1
self._configuration['private']['isosurfaces'] = [[1, 20, 'green', 0, 0xFF, 0, 0xFF]] #green
#self._configuration['private']['isosurfaces'] = [[1, 10, None, 0, 0, 0, 0xFF]] #auto
self._configuration['private']['useminmax'] = [0, 100, 200]
self._configuration['private']['infolabel'] = "Object3DStack %s" % name
def __del__(self):
for key in self.drawListDict.keys():
if key.upper() != "NONE":
if self.drawListDict[key] > 0:
GL.glDeleteLists(self.drawListDict[key], 1)
for key in self.__isosurfacesDict.keys():
if self.__isosurfacesDict[key]['list'] > 0:
GL.glDeleteLists(self.__isosurfacesDict[key]['list'], 1)
try:
Object3DBase.Object3D.__del__(self)
except AttributeError:
pass
def setConfiguration(self, ddict):
old_alpha = 1.0 - self._configuration['common']['transparency']
Object3DBase.Object3D.setConfiguration(self, ddict)
new_alpha = 1.0 - self._configuration['common']['transparency']
if (new_alpha != old_alpha):
self._setAlpha(new_alpha)
self.drawMode = DRAW_MODES[self._configuration['common']['mode']]
if ddict['common'].has_key('event'):
if ddict['common']['event'] == 'ColormapChanged':
self.getColors()
def _setAlpha(self, alpha):
if alpha < 0:
alpha = 0
elif alpha >= 1.0:
alpha = 255
else:
self._alpha = int(255 * alpha)
if self.vertexColors is None:
return
self.vertexColors[:, 3] = self._alpha
def setData(self, *args, **kw):
return self.setStack(*args, **kw)
def setStack(self, data, x=None, y=None, z=None, xyz=None):
"""
setStack(data, data, xyz=None)
data is the array of vertex values.
xyz = [x,y,z] are three arrays with the grid coordinates
"""
if hasattr(data, "info") and hasattr(data, "data"):
#It is an actual stack
self._actualStack = True
self.values = data.data[:]
else:
self._actualStack = False
self.values = data[:]
if self.values.dtype != numpy.float32:
print("WARNING: Converting to float32")
self.values = self.values.astype(numpy.float32)
if (x is None) and (y is None) and (xyz is None):
xsize, ysize, zsize = self.values.shape
self._x = numpy.arange(xsize).astype(numpy.float32)
self._y = numpy.arange(ysize).astype(numpy.float32)
self._z = numpy.arange(zsize).astype(numpy.float32)
if self._actualStack:
xCal = map(float, eval(data.info.get('CAxis0CalibrationParameters', '[0., 1.0, 0.0]')))
yCal = map(float, eval(data.info.get('CAxis1CalibrationParameters', '[0., 1.0, 0.0]')))
zCal = map(float, eval(data.info.get('CAxis2CalibrationParameters', '[0., 1.0, 0.0]')))
self._x[:] = xCal[0] + self._x * (xCal[1] + xCal[2] * self._x)
self._y[:] = yCal[0] + self._y * (yCal[1] + yCal[2] * self._y)
self._z[:] = zCal[0] + self._z * (zCal[1] + zCal[2] * self._z)
self.xSize, self.ySize, self.zSize = xsize, ysize, zsize
elif xyz is not None:
self.xSize, self.ySize, self.zSize = self.values.shape
self._x[:] = xyz[0][:]
self._y[:] = xyz[1][:]
self._z[:] = xyz[2][:]
elif (x is not None) and (y is not None):
#regular mesh
self._x = numpy.array(x).astype(numpy.float32)
self._y = numpy.array(y).astype(numpy.float32)
self._x.shape = -1, 1
self._y.shape = -1, 1
self.xSize = self._x.shape[0]
self.ySize = self._y.shape[0]
if z is not None:
self._z = numpy.array(z).astype(numpy.float32)
if len(self._z.shape) == 0:
#assume just a number
self.zSize = 1
else:
self._z.shape = -1, 1
self.zSize = self._z.shape[0]
else:
a=1
for v in self.values.shape:
a *= v
zsize = int(a/(self.xSize * self.ySize))
self._z = numpy.arange(zsize).astype(numpy.float32)
self.zSize = zsize
else:
raise ValueError, "Unhandled case"
old_shape = self.values.shape
self.nVertices = self.xSize * self.ySize * self.zSize
self.values.shape = self.nVertices, 1
self.getColors()
self._obtainLimits()
#restore original shape
self.values.shape = old_shape
def getColors(self):
old_shape = self.values.shape
self.values.shape = -1, 1
self._configuration['common']['colormap'][4]=self.values.min()
self._configuration['common']['colormap'][5]=self.values.max()
colormap = self._configuration['common']['colormap']
(self.vertexColors,size,minmax)= spslut.transform(self.values,
(1,0),
(colormap[6],3.0),
"RGBX",
COLORMAPLIST[int(str(colormap[0]))],
colormap[1],
(colormap[2], colormap[3]),
(0, 255),1)
self.values.shape = old_shape
self.vertexColors.shape = self.nVertices, 4
self.vertexColors[:, 3] = self._alpha
#selection colors
# if I have more than pow(2, 24) vertices
# the vertex with number pow(2, 24) will never be selected
return
i = numpy.arange(self.nVertices)
self.vertexSelectionColors = numpy.zeros((self.nVertices,4),
numpy.uint8)
self.vertexSelectionColors[:,0] = (i & 255)
self.vertexSelectionColors[:,1] = ((i >> 8) & 255)
self.vertexSelectionColors[:,2] = ((i >> 16) & 255)
self.vertexSelectionColors[:,3] = 255 - (i >> 24)
def _obtainLimits(self):
xmin, ymin, zmin = self._x.min(), self._y.min(), self._z.min()
xmax, ymax, zmax = self._x.max(), self._y.max(), self._z.max()
self.setLimits(xmin, ymin, zmin, xmax, ymax, zmax)
def drawObject(self):
if self.values is None:
return
if DEBUG:
t0=time.time()
GL.glPushAttrib(GL.GL_ALL_ATTRIB_BITS)
GL.glShadeModel(GL.GL_FLAT)
if self.drawMode == 'NONE':
pass
elif (GL.glGetIntegerv(GL.GL_RENDER_MODE) == GL.GL_SELECT) or \
self._vertexSelectionMode:
self.buildPointList(selection=True)
elif self.drawMode == 'POINT':
self.buildPointList(selection=False)
#self.buildPointListNEW(selection=False)
elif self.drawMode == 'POINT_SELECTION':
self.buildPointList(selection=True)
elif self.drawMode in ['LINES', 'WIRE']:
Object3DCTools.draw3DGridLines(self._x,
self._y,
self._z,
self.vertexColors,
self.values,
self._configuration['private']['colorfilter'],
self._configuration['private']['useminmax'])
elif self.drawMode == "SURFACE":
flag = 1
i = 0
for use, value, label, cr, cg, cb, ca in self._configuration['private']['isosurfaces']:
color = (cr, cg, cb, ca)
if None in color:
color = None
if use:
flag = 0
GL.glEnable(GL.GL_LIGHTING)
if color is not None:
GL.glColor4ub(color[0],
color[1],
color[2],
self._alpha)
colorflag = False
if self.__isosurfacesDict[i]['list'] > 0:
if self.__isosurfacesDict[i]['color'] == color:
colorflag = True
elif (self.__isosurfacesDict[i]['color'] != None) and\
(color != None):
colorflag = True
if self.__isosurfacesDict[i]['list'] > 0:
if (self.__isosurfacesDict[i]['value'] == value) and\
colorflag:
GL.glCallList(self.__isosurfacesDict[i]['list'])
i += 1
continue
GL.glDeleteLists(self.__isosurfacesDict[i]['list'],
1)
self.__isosurfacesDict[i]['value']= value
self.__isosurfacesDict[i]['color']= color
self.__isosurfacesDict[i]['list'] = GL.glGenLists(1)
GL.glNewList(self.__isosurfacesDict[i]['list'],
GL.GL_COMPILE)
GL.glBegin(GL.GL_TRIANGLES)
Object3DCTools.gridMarchingCubes(self._x, self._y, self._z, self.values, value, color, (1, 1, 1), 1)
#Object3DCTools.gridMarchingCubes(self._x, self._y, self._z, self.values, value, None, (1, 1, 1), 1)
GL.glEnd()
GL.glEndList()
GL.glCallList(self.__isosurfacesDict[i]['list'])
GL.glDisable(GL.GL_LIGHTING)
i += 1
if flag:
#This is useless, only isosurfaces makes sense
Object3DCTools.draw3DGridQuads(self._x,
self._y,
self._z,
self.vertexColors,
self.values,
self._configuration['private']['colorfilter'],
self._configuration['private']['useminmax'])
else:
print "UNSUPPORTED MODE"
GL.glPopAttrib()
if DEBUG:
print "Drawing takes ", time.time() - t0
def _getVertexSelectionColors(self):
self.vertexSelectionColors = numpy.zeros((self.nVertices,4),
numpy.uint8)
#split the color generation in two blocks
#to reduce the amount of memory needed
half = int(self.nVertices/2)
i = numpy.arange(0, half)
self.vertexSelectionColors[:half,0] = (i & 255)
self.vertexSelectionColors[:half,1] = ((i >> 8) & 255)
self.vertexSelectionColors[:half,2] = ((i >> 16) & 255)
self.vertexSelectionColors[:half,3] = 255 - (i >> 24)
i = numpy.arange(half, self.nVertices)
self.vertexSelectionColors[half:,0] = (i & 255)
self.vertexSelectionColors[half:,1] = ((i >> 8) & 255)
self.vertexSelectionColors[half:,2] = ((i >> 16) & 255)
self.vertexSelectionColors[half:,3] = 255 - (i >> 24)
def isVertexSelectionModeSupported(self):
return True
def buildPointList(self, selection=False):
if selection:
if self.vertexSelectionColors is None:
self._getVertexSelectionColors()
if self._configuration['private']['colorfilter']:
tinyNumber = 1.0e-10
minValue = self._configuration['common']['colormap'][2] + tinyNumber
maxValue = self._configuration['common']['colormap'][3] - tinyNumber
Object3DCTools.draw3DGridPoints(self._x,
self._y,
self._z,
self.vertexSelectionColors,
self.values,
0,
[1, minValue, maxValue])
else:
Object3DCTools.draw3DGridPoints(self._x,
self._y,
self._z,
self.vertexSelectionColors,
self.values,
0,
self._configuration['private']['useminmax'])
else:
Object3DCTools.draw3DGridPoints(self._x,
self._y,
self._z,
self.vertexColors,
self.values,
self._configuration['private']['colorfilter'],
self._configuration['private']['useminmax'])
def buildWireList(self):
Object3DCTools.draw3DGridLines(self._x,
self._y,
self._z,
self.vertexColors)
def __fillVerticesBufferObject(self):
if self.vertices is None:
self.vertices = Object3DCTools.get3DGridFromXYZ(self._x,
self._y,
self._z)
self.indices = numpy.arange(self.nVertices)
self._verticesBufferObject = buffers.VertexBuffer(self.vertices,
GL.GL_STATIC_DRAW)
self.vertices = None
print "self._vertexBufferObject = ", self._verticesBufferObject
def __fillVertexColorsBufferObject(self):
if self.vertexColors is None:
if self.vertexSelectionColors is None:
i = numpy.arange(self.nVertices)
self.vertexSelectionColors = numpy.zeros((self.nVertices,4),
numpy.uint8)
self.vertexSelectionColors[:,0] = (i & 255)
self.vertexSelectionColors[:,1] = ((i >> 8) & 255)
self.vertexSelectionColors[:,2] = ((i >> 16) & 255)
self.vertexSelectionColors[:,3] = 255 - (i >> 24)
self._vertexColorsBufferObject = buffers.VertexBuffer(self.vertexSelectionColors,
GL.GL_STATIC_DRAW)
print "self._vertexColorsBufferObject = ", self._vertexColorsBufferObject
def buildPointListNEW(self, selection=False):
if self._verticesBufferObject is None:
self.__fillVerticesBufferObject()
if self._vertexColorsBufferObject is None:
self.__fillVertexColorsBufferObject()
#self._vertexSelectionColorBufferObject = None
GL.glEnableClientState(GL.GL_VERTEX_ARRAY)
GL.glEnableClientState(GL.GL_COLOR_ARRAY)
self._verticesBufferObject.bind()
self._vertexColorsBufferObject.bind()
GL.glDrawElements(GL.GL_POINTS, self.indices)
GL.glDisableClientState(GL.GL_VERTEX_ARRAY)
GL.glDisableClientState(GL.GL_COLOR_ARRAY)
def buildPointListOLD(self):
if self.vertices is None:
self.vertices = Object3DCTools.get3DGridFromXYZ(self._x,
self._y,
self._z)
GL.glVertexPointerf(self.vertices)
GL.glColorPointerub(self.vertexColors)
GL.glEnableClientState(GL.GL_VERTEX_ARRAY)
GL.glEnableClientState(GL.GL_COLOR_ARRAY)
GL.glDrawArrays(GL.GL_POINTS, 0, self.nVertices)
def buildPointList0(self):
"""
This is just to test memory and speed
"""
n1, n2, n3 = 256, 256, 256
print "OLD TOTAL = ",71 * 80 * 2000
print "TOTAL = ", 256 * 256 * 256
zdata = numpy.arange(n1*n2*n3).astype(numpy.float32)
zdata.shape= -1, 1
print zdata.shape
(image,size,minmax)= spslut.transform(zdata,
(1,0),
(spslut.LINEAR,3.0),
"RGBX",
spslut.TEMP,
1,
(0, 1),
(0, 255),1)
image.shape = -1, 4
image[:,3] = 255
#self.vertexColors = image.astype(numpy.float32)
x = numpy.arange(n1).astype(numpy.float32)
y = numpy.arange(n2).astype(numpy.float32)
z = numpy.arange(n3).astype(numpy.float32)
#Object3DCTools.draw3DGridQuads(x, y, y)
#Object3DCTools.draw3DGridLines(x, y, z, image)
Object3DCTools.draw3DGridPoints(x, y, z, image)
self.zdata = zdata
def getIndexValues(self, index):
"""
x,y,z, I
"""
xindex = int(index/(self.ySize*self.zSize))
yindex = int((index % (self.ySize*self.zSize))/self.zSize)
zindex = index % self.zSize
#print "index = ", index, "xindex = ", xindex, "yindex = ", yindex, "zindex = ", zindex
if len(self.values.shape) == 3:
value = self.values[xindex, yindex, zindex]
else:
value = self.values[index]
return self._x[xindex], self._y[yindex], self._z[zindex], value
MENU_TEXT = '4D Stack'
def getObject3DInstance(config=None):
#for the time being a former configuration
#for serializing purposes is not implemented
#I do the import here for the case PyMca is not installed
#because the modules could be instanstiated without using
#this method
try:
from PyMca import EDFStack
from PyMca import TiffStack
except ImportError:
import EDFStack
import TiffStack
fileTypeList = ['EDF Z Stack (*edf *ccd)',
'EDF X Stack (*edf *ccd)',
'TIFF Stack (*tif *tiff)']
old = Object3DFileDialogs.Object3DDirs.nativeFileDialogs * 1
Object3DFileDialogs.Object3DDirs.nativeFileDialogs = False
fileList, filterUsed = Object3DFileDialogs.getFileList(None, fileTypeList,
"Please select the object file(s)",
"OPEN",
True)
Object3DFileDialogs.Object3DDirs.nativeFileDialogs = old
if not len(fileList):
return None
if filterUsed == fileTypeList[0]:
fileindex = 2
else:
fileindex = 1
#file index is irrelevant in case of an actual 3D stack.
filename = fileList[0]
legend = os.path.basename(filename)
if filterUsed == fileTypeList[2]:
#TIFF
stack = TiffStack.TiffStack(dtype=numpy.float32, imagestack=False)
stack.loadFileList(fileList, fileindex=1)
elif len(fileList) == 1:
stack = EDFStack.EDFStack(dtype=numpy.float32, imagestack=False)
stack.loadIndexedStack(filename, fileindex=fileindex)
else:
stack = EDFStack.EDFStack(dtype=numpy.float32, imagestack=False)
stack.loadFileList(fileList, fileindex=fileindex)
if stack is None:
raise IOError("Problem reading stack.")
object3D = Object3DStack(name=legend)
object3D.setStack(stack)
return object3D
if __name__ == "__main__":
import sys
from Object3D import SceneGLWindow
import os
try:
from PyMca import EDFStack
from PyMca import EdfFile
except ImportError:
import EDFStack
import EdfFile
import getopt
options = ''
longoptions = ["fileindex=","begin=", "end="]
try:
opts, args = getopt.getopt(
sys.argv[1:],
options,
longoptions)
except getopt.error,msg:
print msg
sys.exit(1)
fileindex = 2
begin = None
end = None
for opt, arg in opts:
if opt in '--begin':
begin = int(arg)
elif opt in '--end':
end = int(arg)
elif opt in '--fileindex':
fileindex = int(arg)
app = qt.QApplication(sys.argv)
window = SceneGLWindow.SceneGLWindow()
window.show()
if len(sys.argv) == 1:
object3D = getObject3DInstance()
if object3D is not None:
window.addObject(object3D)
else:
if len(sys.argv) > 1:
stack = EDFStack.EDFStack(dtype=numpy.float32, imagestack=False)
filename = args[0]
else:
stack = EDFStack.EDFStack(dtype=numpy.float32, imagestack=False)
filename = "..\COTTE\ch09\ch09__mca_0005_0000_0070.edf"
if os.path.exists(filename):
print "fileindex = ", fileindex
stack.loadIndexedStack(filename, begin=begin, end=end, fileindex=fileindex)
object3D = Object3DStack()
object3D.setStack(stack)
stack = 0
else:
print "filename %s does not exists" % filename
sys.exit(1)
time.sleep(1)
print "START ADDING"
window.addObject(object3D, "STACK")
window.setSelectedObject("STACK")
print "END ADDING"
window.glWidget.setZoomFactor(1.0)
window.show()
app.exec_()
|
import unittest
import os
from shutil import rmtree
from tempfile import mkdtemp
from mercurial_repo import MercurialRepo
from repo_factory import RepositoryNotFoundException
from repo_factory import RepoFactory
class TestRepoFactory(unittest.TestCase):
def setUp(self):
self.directory = mkdtemp('-flypaper-repo-factory-tests')
self.rmtree = True
def tearDown(self):
if self.rmtree:
rmtree(self.directory)
def test_get_repo_fails_when_directory_is_not_present(self):
non_existant_dir = os.path.join(self.directory, 'dne')
with self.assertRaises(RepositoryNotFoundException):
RepoFactory.get_repo(non_existant_dir)
def test_get_repo_fails_when_non_supported_repo(self):
os.mkdir(os.path.join(self.directory, '.dne'))
with self.assertRaises(RepositoryNotFoundException):
RepoFactory.get_repo(self.directory)
def test_get_repo_returns_mercurial_repo(self):
os.mkdir(os.path.join(self.directory, '.hg'))
repo = RepoFactory.get_repo(self.directory)
self.assertEquals(MercurialRepo, type(repo))
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details.
"""
VERSION = (1, 8, 0, 'alpha', 3)
RELEASE = False
def get_version(version=None, release=None):
"""Derives a PEP386-compliant version number from VERSION."""
if version is None:
version = VERSION
if release is None:
release = RELEASE
assert len(version) == 5
assert version[3] in ('alpha', 'beta', 'rc', 'final')
# Now build the two parts of the version number:
# main = X.Y[.Z]
# sub = .devN - for pre-alpha releases
# | {a|b|c}N - for alpha, beta and rc releases
main_parts = 2 if version[2] == 0 else 3
main = '.'.join(str(x) for x in version[:main_parts])
if version[3] != 'final':
mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'rc'}
sub = mapping[version[3]] + str(version[4])
else:
sub = ''
if not release:
sub += '-dev'
return main + sub
|
# -*- coding: utf-8 -*-
"""
:copyright: (c) 2014 by the mediaTUM authors
:license: GPL3, see COPYING for details
"""
import schema.schema
from core.test.fixtures import editor_user
def test_filter_masks(content_node_with_mdt):
node = content_node_with_mdt
masks = node.metadatatype.filter_masks().all()
assert len(masks) == 4
def test_filter_masks_language(content_node_with_mdt):
node = content_node_with_mdt
masks = node.metadatatype.filter_masks(language="en").all()
# should get only english masks, no language-independent
assert len(masks) == 2
for mask in masks:
assert mask.language == "en"
def test_filter_masks_language_type(content_node_with_mdt):
node = content_node_with_mdt
masks = node.metadatatype.filter_masks(masktype="testmasktype", language="en").all()
assert len(masks) == 1
assert masks[0]["masktype"] == "testmasktype"
def test_update_node(session, req, schema_init, some_node, simple_mask_with_maskitems, guest_user):
mask = simple_mask_with_maskitems
node = some_node
req.form["testattr"] = u"updated"
req.form["newattr"] = u"new"
req.form["nodename"] = u"new_name"
req.form["system.attr"] = u"sys"
mask.update_node(node, req, guest_user)
assert node["testattr"] == u"updated"
assert node["newattr"] == u"new"
assert node.name == u"new_name"
assert node.system_attrs["attr"] == u"sys"
def test_update_node_check(session, req, schema_init, some_node, simple_mask_with_maskitems, guest_user):
mask = simple_mask_with_maskitems
node = some_node
# initial value
mask.update_node(node, req, guest_user)
node["check"] = "1"
# enabled -> disabled without request value
mask.update_node(node, req, guest_user)
assert node["check"] == "0"
# disabled -> enabled
req.form["check"] = "1"
mask.update_node(node, req, guest_user)
assert node["check"] == "1"
|
# Copyright (c) 2014-2020 VMware, Inc.
# 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.
"""
Common classes that provide access to vSphere services.
"""
import http.client as httplib
import io
import logging
import netaddr
from oslo_utils import timeutils
from oslo_utils import uuidutils
import requests
import suds
from suds import cache
from suds import client
from suds import plugin
import suds.sax.element as element
from suds import transport
from oslo_vmware._i18n import _
from oslo_vmware import exceptions
from oslo_vmware import vim_util
CACHE_TIMEOUT = 60 * 60 # One hour cache timeout
ADDRESS_IN_USE_ERROR = 'Address already in use'
CONN_ABORT_ERROR = 'Software caused connection abort'
RESP_NOT_XML_ERROR = 'Response is "text/html", not "text/xml"'
SERVICE_INSTANCE = 'ServiceInstance'
LOG = logging.getLogger(__name__)
class ServiceMessagePlugin(plugin.MessagePlugin):
"""Suds plug-in handling some special cases while calling VI SDK."""
# list of XML elements which are allowed to be empty
EMPTY_ELEMENTS = ["VirtualMachineEmptyProfileSpec"]
def add_attribute_for_value(self, node):
"""Helper to handle AnyType.
Suds does not handle AnyType properly. But VI SDK requires type
attribute to be set when AnyType is used.
:param node: XML value node
"""
if node.name == 'value' or node.name == 'val':
node.set('xsi:type', 'xsd:string')
# removeKey may be a 'int' or a 'string'
if node.name == 'removeKey':
try:
int(node.text)
node.set('xsi:type', 'xsd:int')
except (ValueError, TypeError):
node.set('xsi:type', 'xsd:string')
def prune(self, el):
pruned = []
for c in el.children:
self.prune(c)
if c.isempty(False) and c.name not in self.EMPTY_ELEMENTS:
pruned.append(c)
for p in pruned:
el.children.remove(p)
def marshalled(self, context):
"""Modifies the envelope document before it is sent.
This method provides the plug-in with the opportunity to prune empty
nodes and fix nodes before sending it to the server.
:param context: send context
"""
# Suds builds the entire request object based on the WSDL schema.
# VI SDK throws server errors if optional SOAP nodes are sent
# without values; e.g., <test/> as opposed to <test>test</test>.
self.prune(context.envelope)
context.envelope.walk(self.add_attribute_for_value)
class Response(io.BytesIO):
"""Response with an input stream as source."""
def __init__(self, stream, status=200, headers=None):
self.status = status
self.headers = headers or {}
self.reason = requests.status_codes._codes.get(
status, [''])[0].upper().replace('_', ' ')
io.BytesIO.__init__(self, stream)
@property
def _original_response(self):
return self
@property
def msg(self):
return self
def read(self, chunk_size, **kwargs):
return io.BytesIO.read(self, chunk_size)
def info(self):
return self
def get_all(self, name, default):
result = self.headers.get(name)
if not result:
return default
return [result]
def getheaders(self, name):
return self.get_all(name, [])
def release_conn(self):
self.close()
class LocalFileAdapter(requests.adapters.HTTPAdapter):
"""Transport adapter for local files.
See http://stackoverflow.com/a/22989322
"""
def __init__(self, pool_maxsize=10):
super(LocalFileAdapter, self).__init__(pool_connections=pool_maxsize,
pool_maxsize=pool_maxsize)
def _build_response_from_file(self, request):
file_path = request.url[7:]
with open(file_path, 'rb') as f:
file_content = f.read()
buff = bytearray(file_content.decode(), "utf-8")
resp = Response(buff)
return self.build_response(request, resp)
def send(self, request, stream=False, timeout=None,
verify=True, cert=None, proxies=None):
"""Sends request for a local file."""
return self._build_response_from_file(request)
class RequestsTransport(transport.Transport):
def __init__(self, cacert=None, insecure=True, pool_maxsize=10,
connection_timeout=None):
transport.Transport.__init__(self)
# insecure flag is used only if cacert is not
# specified.
self.verify = cacert if cacert else not insecure
self.session = requests.Session()
self.session.mount('file:///',
LocalFileAdapter(pool_maxsize=pool_maxsize))
self.session.mount('https://', requests.adapters.HTTPAdapter(
pool_connections=pool_maxsize, pool_maxsize=pool_maxsize))
self.cookiejar = self.session.cookies
self._connection_timeout = connection_timeout
def open(self, request):
resp = self.session.get(request.url, verify=self.verify)
return io.BytesIO(resp.content)
def send(self, request):
resp = self.session.post(request.url,
data=request.message,
headers=request.headers,
verify=self.verify,
timeout=self._connection_timeout)
return transport.Reply(resp.status_code, resp.headers, resp.content)
class MemoryCache(cache.ObjectCache):
def __init__(self):
self._cache = {}
def get(self, key):
"""Retrieves the value for a key or None."""
now = timeutils.utcnow_ts()
for k in list(self._cache):
(timeout, _value) = self._cache[k]
if timeout and now >= timeout:
del self._cache[k]
return self._cache.get(key, (0, None))[1]
def put(self, key, value, time=CACHE_TIMEOUT):
"""Sets the value for a key."""
timeout = 0
if time != 0:
timeout = timeutils.utcnow_ts() + time
self._cache[key] = (timeout, value)
return True
_CACHE = MemoryCache()
class CompatibilitySudsClient(client.Client):
"""suds client with added cookiejar attribute
The cookiejar properties allow reading/setting the cookiejar used by the
underlying transport.
"""
def __init__(self, *args, **kwargs):
super(CompatibilitySudsClient, self).__init__(*args, **kwargs)
@property
def cookiejar(self):
return self.options.transport.cookiejar
@cookiejar.setter
def cookiejar(self, cookies):
self.options.transport.session.cookies = cookies
self.options.transport.cookiejar = cookies
class Service(object):
"""Base class containing common functionality for invoking vSphere
services
"""
def __init__(self, wsdl_url=None, soap_url=None,
cacert=None, insecure=True, pool_maxsize=10,
connection_timeout=None, op_id_prefix='oslo.vmware'):
self.wsdl_url = wsdl_url
self.soap_url = soap_url
self.op_id_prefix = op_id_prefix
LOG.debug("Creating suds client with soap_url='%s' and wsdl_url='%s'",
self.soap_url, self.wsdl_url)
transport = RequestsTransport(cacert=cacert,
insecure=insecure,
pool_maxsize=pool_maxsize,
connection_timeout=connection_timeout)
self.client = CompatibilitySudsClient(self.wsdl_url,
transport=transport,
location=self.soap_url,
plugins=[ServiceMessagePlugin()],
cache=_CACHE)
self._service_content = None
self._vc_session_cookie = None
@staticmethod
def build_base_url(protocol, host, port):
proto_str = '%s://' % protocol
host_str = '[%s]' % host if netaddr.valid_ipv6(host) else host
port_str = '' if port is None else ':%d' % port
return proto_str + host_str + port_str
@staticmethod
def _retrieve_properties_ex_fault_checker(response):
"""Checks the RetrievePropertiesEx API response for errors.
Certain faults are sent in the SOAP body as a property of missingSet.
This method raises VimFaultException when a fault is found in the
response.
:param response: response from RetrievePropertiesEx API call
:raises: VimFaultException
"""
fault_list = []
details = {}
if not response:
# This is the case when the session has timed out. ESX SOAP
# server sends an empty RetrievePropertiesExResponse. Normally
# missingSet in the response objects has the specifics about
# the error, but that's not the case with a timed out idle
# session. It is as bad as a terminated session for we cannot
# use the session. Therefore setting fault to NotAuthenticated
# fault.
LOG.debug("RetrievePropertiesEx API response is empty; setting "
"fault to %s.",
exceptions.NOT_AUTHENTICATED)
fault_list = [exceptions.NOT_AUTHENTICATED]
else:
for obj_cont in response.objects:
if hasattr(obj_cont, 'missingSet'):
for missing_elem in obj_cont.missingSet:
f_type = missing_elem.fault.fault
f_name = f_type.__class__.__name__
fault_list.append(f_name)
if f_name == exceptions.NO_PERMISSION:
details['object'] = \
vim_util.get_moref_value(f_type.object)
details['privilegeId'] = f_type.privilegeId
if fault_list:
fault_string = _("Error occurred while calling "
"RetrievePropertiesEx.")
raise exceptions.VimFaultException(fault_list,
fault_string,
details=details)
def _set_soap_headers(self, op_id):
"""Set SOAP headers for the next remote call to vCenter.
SOAP headers may include operation ID and vcSessionCookie.
The operation ID is a random string which allows to correlate log
messages across different systems (OpenStack, vCenter, ESX).
vcSessionCookie is needed when making PBM calls.
"""
headers = []
if self._vc_session_cookie:
elem = element.Element('vcSessionCookie').setText(
self._vc_session_cookie)
headers.append(elem)
if op_id:
elem = element.Element('operationID').setText(op_id)
headers.append(elem)
if headers:
self.client.set_options(soapheaders=headers)
@property
def service_content(self):
if self._service_content is None:
self._service_content = self.retrieve_service_content()
return self._service_content
def get_http_cookie(self):
"""Return the vCenter session cookie."""
cookies = self.client.cookiejar
for cookie in cookies:
if cookie.name.lower() == 'vmware_soap_session':
return cookie.value
def __getattr__(self, attr_name):
"""Returns the method to invoke API identified by param attr_name."""
def request_handler(managed_object, **kwargs):
"""Handler for vSphere API calls.
Invokes the API and parses the response for fault checking and
other errors.
:param managed_object: managed object reference argument of the
API call
:param kwargs: keyword arguments of the API call
:returns: response of the API call
:raises: VimException, VimFaultException, VimAttributeException,
VimSessionOverLoadException, VimConnectionException
"""
try:
if isinstance(managed_object, str):
# For strings, use string value for value and type
# of the managed object.
managed_object = vim_util.get_moref(managed_object,
managed_object)
if managed_object is None:
return
skip_op_id = kwargs.pop('skip_op_id', False)
op_id = None
if not skip_op_id:
# Generate opID. It will appear in vCenter and ESX logs for
# this particular remote call.
op_id = '%s-%s' % (self.op_id_prefix,
uuidutils.generate_uuid())
LOG.debug('Invoking %s.%s with opID=%s',
vim_util.get_moref_type(managed_object),
attr_name,
op_id)
self._set_soap_headers(op_id)
request = getattr(self.client.service, attr_name)
response = request(managed_object, **kwargs)
if (attr_name.lower() == 'retrievepropertiesex'):
Service._retrieve_properties_ex_fault_checker(response)
return response
except exceptions.VimFaultException:
# Catch the VimFaultException that is raised by the fault
# check of the SOAP response.
raise
except suds.WebFault as excep:
fault_string = None
if excep.fault:
fault_string = excep.fault.faultstring
doc = excep.document
detail = None
if doc is not None:
detail = doc.childAtPath('/detail')
if not detail:
# NOTE(arnaud): this is needed with VC 5.1
detail = doc.childAtPath('/Envelope/Body/Fault/detail')
fault_list = []
details = {}
if detail:
for fault in detail.getChildren():
fault_type = fault.get('type')
# NOTE(vbala): PBM faults use vim25 namespace. Also,
# PBM APIs throw NotAuthenticated in vSphere 6.5 for
# session expiry.
if (fault_type.endswith(exceptions.SECURITY_ERROR) or
fault_type.endswith(
exceptions.NOT_AUTHENTICATED)):
fault_type = exceptions.NOT_AUTHENTICATED
fault_list.append(fault_type)
for child in fault.getChildren():
details[child.name] = child.getText()
raise exceptions.VimFaultException(fault_list, fault_string,
excep, details)
except AttributeError as excep:
raise exceptions.VimAttributeException(
_("No such SOAP method %s.") % attr_name, excep)
except (httplib.CannotSendRequest,
httplib.ResponseNotReady,
httplib.CannotSendHeader) as excep:
raise exceptions.VimSessionOverLoadException(
_("httplib error in %s.") % attr_name, excep)
except requests.RequestException as excep:
raise exceptions.VimConnectionException(
_("requests error in %s.") % attr_name, excep)
except Exception as excep:
# TODO(vbala) should catch specific exceptions and raise
# appropriate VimExceptions.
# Socket errors which need special handling; some of these
# might be caused by server API call overload.
if (str(excep).find(ADDRESS_IN_USE_ERROR) != -1 or
str(excep).find(CONN_ABORT_ERROR)) != -1:
raise exceptions.VimSessionOverLoadException(
_("Socket error in %s.") % attr_name, excep)
# Type error which needs special handling; it might be caused
# by server API call overload.
elif str(excep).find(RESP_NOT_XML_ERROR) != -1:
raise exceptions.VimSessionOverLoadException(
_("Type error in %s.") % attr_name, excep)
else:
raise exceptions.VimException(
_("Exception in %s.") % attr_name, excep)
return request_handler
def __repr__(self):
return "vSphere object"
def __str__(self):
return "vSphere object"
class SudsLogFilter(logging.Filter):
"""Filter to mask/truncate vCenter credentials in suds logs."""
def filter(self, record):
if not hasattr(record.msg, 'childAtPath'):
return True
# Suds will log vCenter credentials if SessionManager.Login or
# SessionManager.SessionIsActive fails.
login = (record.msg.childAtPath('/Envelope/Body/Login') or
record.msg.childAtPath('/Envelope/Body/SessionIsActive'))
if login is None:
return True
if login.childAtPath('userName') is not None:
login.childAtPath('userName').setText('***')
if login.childAtPath('password') is not None: # nosec
login.childAtPath('password').setText('***') # nosec
session_id = login.childAtPath('sessionID')
if session_id is not None:
session_id.setText(session_id.getText()[-5:])
return True
# Set log filter to mask/truncate vCenter credentials in suds logs.
suds.client.log.addFilter(SudsLogFilter())
|
# -*- coding: utf-8 -*-
"""
tipfy
~~~~~
Minimalist WSGI application and utilities for App Engine.
:copyright: 2010 by tipfy.org.
:license: BSD, see LICENSE.txt for more details.
"""
import logging
import os
from wsgiref.handlers import CGIHandler
# Werkzeug swiss knife.
# Need to import werkzeug first otherwise py_zipimport fails.
import werkzeug
from werkzeug import (cached_property, escape, import_string, redirect,
Request as WerkzeugRequest, Response as WerkzeugResponse, url_quote)
from werkzeug.exceptions import (abort, BadGateway, BadRequest, Forbidden,
Gone, HTTPException, InternalServerError, LengthRequired,
MethodNotAllowed, NotAcceptable, NotFound, NotImplemented,
PreconditionFailed, RequestEntityTooLarge, RequestTimeout,
RequestURITooLarge, ServiceUnavailable, Unauthorized,
UnsupportedMediaType)
from werkzeug.routing import (BaseConverter, EndpointPrefix, Map,
RequestRedirect, Rule as WerkzeugRule, RuleFactory, RuleTemplate,
Subdomain, Submount)
try:
# We declare the namespace to be used outside of App Engine, so that
# we can distribute and install separate extensions.
__import__('pkg_resources').declare_namespace(__name__)
except ImportError, e:
pass
__version__ = '0.6.3'
__version_info__ = tuple(int(n) for n in __version__.split('.'))
#: Default configuration values for this module. Keys are:
#:
#: apps_installed
#: A list of active app modules as a string. Default is an empty list.
#:
#: apps_entry_points
#: URL entry points for the installed apps, in case their URLs are mounted
#: using base paths.
#:
#: middleware
#: A list of middleware classes for the WSGIApplication. The classes can
#: be defined as strings. They define hooks that plug into the application
#: to initialize stuff when the app is built, at the start or end of a
#: request or to handle exceptions. Default is an empty list.
#:
#: server_name
#: A server name hint, used to calculate current subdomain.
#: If you plan to use dynamic subdomains, you must define the main domain
#: here so that the subdomain can be extracted and applied to URL rules.
#:
#: subdomain
#: Force this subdomain to be used instead of extracting
#: the subdomain from the current url.
#:
#: dev
#: True is this is the development server, False otherwise.
#: Default is the value of ``os.environ['SERVER_SOFTWARE']``.
#:
#: app_id
#: The application id. Default is the value of
#: ``os.environ['APPLICATION_ID']``.
#:
#: version_id
#: The current deplyment version id. Default is the value
#: of ``os.environ['CURRENT_VERSION_ID']``.
default_config = {
'apps_installed': [],
'apps_entry_points': {},
'middleware': [],
'server_name': None,
'subdomain': None,
'dev': os.environ.get('SERVER_SOFTWARE', '').startswith('Dev'),
'app_id': os.environ.get('APPLICATION_ID', None),
'version_id': os.environ.get('CURRENT_VERSION_ID', '1'),
}
# Allowed request methods.
ALLOWED_METHODS = frozenset(['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT',
'TRACE'])
# Value used for required values.
REQUIRED_VALUE = object()
# Value used for missing default values.
DEFAULT_VALUE = object()
class RequestHandler(object):
"""Base class to handle requests. Implements the minimal interface
required by :class:`Tipfy`.
The dispatch method implements a middleware system to execute hooks before
and after processing a request and to handle exceptions.
"""
#: A list of middleware classes or callables. A middleware can implement
#: three methods that are called before and after the current request
#: method is executed, or if an exception occurs:
#:
#: pre_dispatch(handler)
#: Called before the requested method is
#: executed. If returns a response, stops the middleware chain and
#: uses that response, not calling the requested method.
#:
#: post_dispatch(handler, response)
#: Called after the requested method is executed. Must always return
#: a response. All *post_dispatch* middleware are always executed.
#:
#: handle_exception(exception, handler)
#: Called if an exception occurs.
middleware = []
def __init__(self, app, request):
"""Initializes the handler.
:param app:
A :class:`Tipfy` instance.
:param request:
A :class:`Request` instance.
"""
self.app = app
self.request = request
def __call__(self, _method, *args, **kwargs):
"""Executes a handler method. This is called by :class:`Tipfy` and
must return a :class:`Response` object.
:param _method:
The method to be dispatched, normally the request method in
lower case, e.g., 'get', 'post', 'head' or 'put'.
:param kwargs:
Keyword arguments from the matched :class:`Rule`.
:return:
A :class:`Response` instance.
"""
method = getattr(self, _method, None)
if method is None:
# 405 Method Not Allowed.
# The response MUST include an Allow header containing a
# list of valid methods for the requested resource.
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.6
self.abort(405, valid_methods=get_valid_methods(self))
if not self.middleware:
# No middleware is set: just execute the method.
return method(*args, **kwargs)
# Get all middleware for this handler.
middleware = self.app.get_middleware(self, self.middleware)
# Execute pre_dispatch middleware.
for hook in middleware.get('pre_dispatch', []):
response = hook(self)
if response is not None:
break
else:
try:
# Execute the requested method.
response = method(*args, **kwargs)
except Exception, e:
# Execute handle_exception middleware.
for hook in middleware.get('handle_exception', []):
response = hook(e, self)
if response is not None:
break
else:
raise
# Make sure we have a response object.
response = self.app.make_response(self.request, response)
# Execute post_dispatch middleware.
for hook in middleware.get('post_dispatch', []):
response = hook(self, response)
# Done!
return response
def dispatch(self, _method, *args, **kwargs):
"""Deprecated method: a wrapper for :meth:`__call__`."""
return self(_method, *args, **kwargs)
def abort(self, code, *args, **kwargs):
"""Raises an :class:`HTTPException`. This stops code execution,
leaving the HTTP exception to be handled by an exception handler.
:param code:
HTTP status error code (e.g., 404).
:param args:
Positional arguments to be passed to the exception class.
:param kwargs:
Keyword arguments to be passed to the exception class.
"""
abort(code, *args, **kwargs)
def get_config(self, module, key=None, default=REQUIRED_VALUE):
"""Returns a configuration value for a module.
.. seealso:: :meth:`Config.get_or_load`.
"""
return self.app.config.get_or_load(module, key=key, default=default)
def handle_exception(self, exception=None, debug=False):
"""Handles an exception. The default behavior is to re-raise the
exception (no exception handling is implemented).
:param exception:
The exception that was thrown.
:param debug:
True if the exception should be handled in debug mode.
"""
raise
def redirect(self, location, code=302):
"""Issues an HTTP redirect to the given URL. This won't stop
code execution. You must return when calling this method::
return self.redirect('/some-path')
:param location:
An absolute URI.
:param code:
The HTTP status code for the redirect.
:return:
A :class:`Response` object with headers set for redirection.
"""
return redirect(location, code)
def redirect_to(self, _name, _code=302, **kwargs):
"""Convenience method mixing :meth:`redirect` and :methd:`url_for`:
redirects the client to a URL built using a named :class:`Rule`.
:param _name:
The rule name.
:param _code:
The HTTP status code for the redirect.
:param kwargs:
Keyword arguments to build the URL.
:return:
A :class:`Response` object with headers set for redirection.
"""
return self.redirect(self.url_for(_name, **kwargs), code=_code)
def url_for(self, _name, **kwargs):
"""Builds a URL for a named :class:`Rule`.
.. seealso:: :meth:`Request.url_for`.
"""
return self.request.url_for(_name, **kwargs)
class Request(WerkzeugRequest):
"""The :class:`Request` object contains all environment variables for the
current request: GET, POST, FILES, cookies and headers. Additionally
it stores the URL adapter bound to the request and information about the
matched URL rule.
"""
#: URL adapter bound to a request.
url_adapter = None
#: Matched URL rule for a request.
rule = None
#: Keyword arguments from the matched rule.
rule_args = None
#: Exception raised when matching URL rules, if any.
routing_exception = None
def __init__(self, environ):
"""Initializes the request. This also sets a context attribute to
hold variables valid for a single request.
"""
super(Request, self).__init__(environ)
# A registry for objects in use during a request.
self.registry = {}
# A context for template variables.
self.context = {}
def url_for(self, endpoint, _full=False, _method=None, _anchor=None,
**kwargs):
"""Builds and returns a URL for a named :class:`Rule`.
For example, if you have these rules registered in the application:
.. code-block::
Rule('/', endoint='home/main' handler='handlers.MyHomeHandler')
Rule('/wiki', endoint='wiki/start' handler='handlers.WikiHandler')
Here are some examples of how to generate URLs for them:
>>> url = url_for('home/main')
>>> '/'
>>> url = url_for('home/main', _full=True)
>>> 'http://localhost:8080/'
>>> url = url_for('wiki/start')
>>> '/wiki'
>>> url = url_for('wiki/start', _full=True)
>>> 'http://localhost:8080/wiki'
>>> url = url_for('wiki/start', _full=True, _anchor='my-heading')
>>> 'http://localhost:8080/wiki#my-heading'
:param endpoint:
The rule endpoint.
:param _full:
If True, returns an absolute URL. Otherwise, returns a
relative one.
:param _method:
The rule request method, in case there are different rules
for different request methods.
:param _anchor:
An anchor to add to the end of the URL.
:param kwargs:
Keyword arguments to build the URL.
:return:
An absolute or relative URL.
"""
url = self.url_adapter.build(endpoint, force_external=_full,
method=_method, values=kwargs)
if _anchor:
url += '#' + url_quote(_anchor)
return url
class Response(WerkzeugResponse):
"""A response object with default mimetype set to ``text/html``."""
default_mimetype = 'text/html'
class Tipfy(object):
"""The WSGI application which centralizes URL dispatching, configuration
and hooks for an App Rngine app.
"""
#: Default class for requests.
request_class = Request
#: Default class for responses.
response_class = Response
#: The active :class:`Tipfy` instance.
app = None
#: The active :class:`Request` instance.
request = None
def __init__(self, config=None, rules='urls.get_rules', debug=False):
"""Initializes the application.
:param config:
Dictionary with configuration for the application modules.
:param rules:
URL rules definitions for the application. It can be a list of
:class:`Rule`, a callable or a string defining a callable that
returns the rules list. The callable is called passing the WSGI
application as parameter. Default is ``urls.get_rules``: import
``get_rules()`` from *urls.py* and calls it passing the app.
"""
# Set the currently active wsgi app instance.
self.set_wsgi_app()
# Load default config and update with values for this instance.
self.config = Config(config, {'tipfy': default_config}, ['tipfy'])
# Set up a context registry for this app.
self.registry = {}
# Set a shortcut to the development flag.
self.dev = self.config.get('tipfy', 'dev', False)
# Cache for loaded handler classes.
self.handlers = {}
# Middleware factory and registry.
self.middleware_factory = MiddlewareFactory()
# Store the app middleware dict.
self.middleware = self.get_middleware(self, self.config.get('tipfy',
'middleware'))
# Initialize the URL map.
self.url_map = self.get_url_map(rules)
def __call__(self, environ, start_response):
"""Shortcut for :meth:`Tipfy.wsgi_app`."""
return self.wsgi_app(environ, start_response)
def wsgi_app(self, environ, start_response):
"""The actual WSGI application. This is not implemented in
:meth:`Tipfy.__call__` so that middlewares can be applied without
losing a reference to the class. So instead of doing this::
app = MyMiddleware(app)
It's a better idea to do this instead::
app.wsgi_app = MyMiddleware(app.wsgi_app)
Then you still have the original application object around and
can continue to call methods on it.
:param environ:
A WSGI environment.
:param start_response:
A callable accepting a status code, a list of headers and an
optional exception context to start the response.
"""
cleanup = True
try:
# Set the currently active wsgi app and request instances.
request = self.request_class(environ)
self.set_wsgi_app()
self.set_request(request)
# Make sure that the requested method is allowed in App Engine.
if request.method not in ALLOWED_METHODS:
abort(501)
# Match current URL and store routing exceptions if any.
self.match_url(request)
# Run pre_dispatch_handler middleware.
rv = self.pre_dispatch(request)
if rv is None:
# Dispatch the requested handler.
rv = self.dispatch(request)
# Run post_dispatch_handler middleware.
response = self.make_response(request, rv)
response = self.post_dispatch(request, response)
except RequestRedirect, e:
# Execute redirects raised by the routing system or the
# application.
response = e
except Exception, e:
# Handle HTTP and uncaught exceptions.
cleanup = not self.dev
response = self.handle_exception(request, e)
response = self.make_response(request, response)
finally:
# Do not clean request if we are in development mode and an
# exception happened. This allows the debugger to still access
# request and other variables in the interactive shell.
if cleanup:
self.cleanup()
# Call the response object as a WSGI application.
return response(environ, start_response)
def get_url_map(self, rules=None):
"""Returns a ``werkzeug.routing.Map`` instance with initial
:class:`Rule` definitions.
:param rules:
Initial list of :class:`Rule`, a callable or a string defining
a callable that returns the list of rules.
:return:
A ``werkzeug.routing.Map`` instance.
"""
if isinstance(rules, basestring):
try:
rules = import_string(rules)
except (AttributeError, ImportError), e:
logging.warning('Missing %s. No URL rules were loaded.' %
rules)
rules = None
if callable(rules):
try:
rules = rules(self)
except TypeError, e:
# Backwards compatibility:
# Previously get_rules() didn't receive the WSGI app.
rules = rules()
return Map(rules)
def add_url_rule(self, path, endpoint, handler, **kwargs):
"""Adds a rule to the URL map.
:param path:
The URL path.
:param endpoint:
The rule endpoint: an identifier for the rule.
:param handler:
A :class:`RequestHandler` class, or a module and class
specification as a string.
"""
rule = Rule(path, endpoint=endpoint, handler=handler, **kwargs)
self.url_map.add(rule)
def match_url(self, request):
"""Matches registered :class:`Rule` definitions against the request.
This will store the URL adapter, matched rule and rule arguments in
the :class: `Request` instance.
Three exceptions can occur when matching the rules: ``NotFound``,
``MethodNotAllowed`` or ``RequestRedirect``. If they are
raised, they are stored in the request for later use.
:param request:
A :class:`Request` instance.
:return:
None.
"""
# Bind url map to the current request location.
config = self.config.get('tipfy')
request.url_adapter = self.url_map.bind_to_environ(request.environ,
server_name=config.get('server_name'),
subdomain=config.get('subdomain'))
try:
# Match the path against registered rules.
request.rule, request.rule_args = request.url_adapter.match(
return_rule=True)
except HTTPException, e:
request.routing_exception = e
def pre_dispatch(self, request):
"""Executes pre_dispatch_handler middleware. If a middleware returns
anything, the chain is stopped and that value is retirned.
:param request:
A :class:`Request` instance.
:return:
The returned value from a middleware or None.
"""
for hook in self.middleware.get('pre_dispatch_handler', []):
rv = hook()
if rv is not None:
return rv
def dispatch(self, request):
"""Matches the current URL against registered rules and returns the
resut from the :class:`RequestHandler`.
:param request:
A :class:`Request` instance.
:return:
The returned value from a middleware or None.
"""
if request.routing_exception is not None:
raise request.routing_exception
handler = request.rule.handler
if isinstance(handler, basestring):
if handler not in self.handlers:
# Import handler set in matched rule.
self.handlers[handler] = import_string(handler)
handler = self.handlers[handler]
# Instantiate handler and dispatch requested method.
method = request.method.lower().replace('-', '_')
return handler(self, request)(method, **request.rule_args)
def post_dispatch(self, request, response):
"""Executes post_dispatch_handler middleware. All middleware are
executed and must return a response object.
:param request:
A :class:`Request` instance.
:param response:
The :class:`Response` returned from :meth:`Tipfy.pre_dispatch`
or :meth:`Tipfy.dispatch` and converted by
:meth:`Tipfy.make_response`.
:return:
A :class:`Response` instance.
"""
for hook in self.middleware.get('post_dispatch_handler', []):
response = hook(response)
return response
def make_response(self, request, rv):
"""Converts the return value from a handler to a real response
object that is an instance of :class:`Response`.
The following types are allowd for ``rv``:
response_class
The object is returned unchanged.
str
A response object is created with the string as body.
unicode
A response object is created with the string encoded to
utf-8 as body.
tuple
The response object is created with the contents of the
tuple as arguments.
WSGI function
The function is called as WSGI application and
buffered as response object.
This method comes from `Flask <http://flask.pocoo.org/>`_.
:param request:
A :class:`Request` instance.
:param rv:
The return value from the handler.
:return:
A :class:`Response` instance.
"""
if isinstance(rv, self.response_class):
return rv
if isinstance(rv, basestring):
return self.response_class(rv)
if isinstance(rv, tuple):
return self.response_class(*rv)
if rv is None:
raise ValueError('Handler did not return a response.')
return self.response_class.force_type(rv, request.environ)
def handle_exception(self, request, e):
"""Handles HTTPException or uncaught exceptions raised by the WSGI
application, optionally applying exception middleware.
:param request:
A :class:`Request` instance.
:param e:
The catched exception.
:return:
A :class:`Response` instance, if the exception is not raised.
"""
# Execute handle_exception middleware.
for hook in self.middleware.get('handle_exception', []):
response = hook(e)
if response is not None:
return response
if self.dev:
raise
logging.exception(e)
if isinstance(e, HTTPException):
return e
return InternalServerError()
def get_middleware(self, obj, classes):
"""Returns a dictionary of all middleware instance methods for a given
object.
:param obj:
The object to search for related middleware (:class:`Tipfy` or
:class:`RequestHandler` instance).
:param classes:
A list of middleware classes.
:return:
A dictionary with middleware instance methods.
"""
if not classes:
return {}
return self.middleware_factory.get_middleware(obj, classes)
def get_config(self, module, key=None, default=REQUIRED_VALUE):
"""Returns a configuration value for a module.
.. seealso:: :meth:`Config.get_or_load`.
"""
return self.config.get_or_load(module, key=key, default=default)
def set_wsgi_app(self):
"""Sets the currently active :class:`Tipfy` instance."""
Tipfy.app = self
def set_request(self, request):
"""Sets the currently active :class:`Request` instance.
:param request:
The currently active :class:`Request` instance.
"""
Tipfy.request = request
def cleanup(self):
"""Cleans :class:`Tipfy` variables at the end of a request."""
Tipfy.app = Tipfy.request = None
def get_test_client(self):
"""Creates a test client for this application.
:return:
A ``werkzeug.Client``, which is a :class:`Tipfy` wrapped
for tests.
"""
from werkzeug import Client
return Client(self, self.response_class, use_cookies=True)
def run(self):
"""Runs the app using ``CGIHandler``. This must be called inside a
``main()`` function in the file defined in *app.yaml* to run the
application::
# ...
app = Tipfy(rules=[
Rule('/', endpoint='home', handler=HelloWorldHandler),
])
def main():
app.run()
if __name__ == '__main__':
main()
"""
# Fix issue #772.
if self.dev:
fix_sys_path()
CGIHandler().run(self)
class Config(dict):
"""A simple configuration dictionary keyed by module name. This is a
dictionary of dictionaries. It requires all values to be dictionaries
and applies updates and default values to the inner dictionaries instead
of the first level one.
The configuration object is available as a ``config`` attribute of
:class:`Tipfy`. If is instantiated and populated when the app is built::
config = {}
config['my.module'] = {
'foo': 'bar',
}
app = Tipfy(rules=[Rule('/', endpoint='home', handler=MyHandler)], config=config)
Then to read configuration values, use :meth:`RequestHandler.get_config`::
class MyHandler(RequestHandler):
def get(self):
foo = self.get_config('my.module', 'foo')
# ...
"""
#: Loaded module configurations.
loaded = None
def __init__(self, value=None, default=None, loaded=None):
"""Initializes the configuration object.
:param value:
A dictionary of configuration dictionaries for modules.
:param default:
A dictionary of configuration dictionaries for default values.
:param loaded:
A list of modules to be marked as loaded.
"""
self.loaded = loaded or []
if value is not None:
assert isinstance(value, dict)
for module in value.keys():
self.update(module, value[module])
if default is not None:
assert isinstance(default, dict)
for module in default.keys():
self.setdefault(module, default[module])
def __setitem__(self, module, value):
"""Sets a configuration for a module, requiring it to be a dictionary.
:param module:
A module name for the configuration, e.g.: `tipfy.ext.i18n`.
:param value:
A dictionary of configurations for the module.
"""
assert isinstance(value, dict)
super(Config, self).__setitem__(module, value)
def get(self, module, key=None, default=None):
"""Returns a configuration value for given key in a given module.
>>> cfg = Config({'tipfy.ext.i18n': {'locale': 'pt_BR'})
>>> cfg.get('tipfy.ext.i18n')
{'locale': 'pt_BR'}
>>> cfg.get('tipfy.ext.i18n', 'locale')
pt_BR
>>> cfg.get('tipfy.ext.i18n', 'invalid-key')
None
>>> cfg.get('tipfy.ext.i18n', 'invalid-key', 'default-value')
default-value
:param module:
The module to get a configuration from, e.g.: `tipfy.ext.i18n`.
:param key:
The key from the module configuration.
:param default:
A default value to return when the configuration for the given
key is not set. It is only returned if **key** is defined.
:returns:
The configuration value.
"""
if module not in self:
if key is None:
return None
return default
if key is None:
return self[module]
if key not in self[module]:
return default
return self[module][key]
def get_or_load(self, module, key=None, default=REQUIRED_VALUE):
"""Returns a configuration value for a module. If it is not already
set, loads a ``default_config`` variable from the given module,
updates the app configuration with those default values and returns
the value for the given key. If the key is still not available,
returns the provided default value or raises an exception if no
default was provided.
Every module that allows some kind of configuration sets a
``default_config`` global variable that is loaded by this function,
cached and used in case the requested configuration was not defined
by the user.
:param module:
The configured module.
:param key:
The config key.
:param default:
A default value to return in case the configuration for
the module/key is not set.
:returns:
A configuration value.
"""
if module not in self.loaded:
# Load default configuration and update config.
values = import_string(module + '.default_config', silent=True)
if values:
self.setdefault(module, values)
self.loaded.append(module)
value = self.get(module, key, default)
if value is not REQUIRED_VALUE and not (key is None and value is None):
return value
if key is None and value is None:
raise KeyError('Module %s is not configured.' % module)
raise KeyError('Module %s requires the config key "%s" to be '
'set.' % (module, key))
def setdefault(self, module, value):
"""Sets a default configuration dictionary for a module.
>>> cfg = Config({'tipfy.ext.i18n': {'locale': 'pt_BR'})
>>> cfg.get('tipfy.ext.i18n', 'locale')
pt_BR
>>> cfg.get('tipfy.ext.i18n', 'foo')
None
>>> cfg.setdefault('tipfy.ext.i18n', {'locale': 'en_US', 'foo': 'bar'})
>>> cfg.get('tipfy.ext.i18n', 'locale')
pt_BR
>>> cfg.get('tipfy.ext.i18n', 'foo')
bar
:param module:
The module to set default configuration, e.g.: `tipfy.ext.i18n`.
:param value:
A dictionary of configurations for the module.
:returns:
None.
"""
assert isinstance(value, dict)
if module not in self:
self[module] = {}
for key in value.keys():
self[module].setdefault(key, value[key])
def update(self, module, value):
"""Updates the configuration dictionary for a module.
>>> cfg = Config({'tipfy.ext.i18n': {'locale': 'pt_BR'})
>>> cfg.get('tipfy.ext.i18n', 'locale')
pt_BR
>>> cfg.get('tipfy.ext.i18n', 'foo')
None
>>> cfg.update('tipfy.ext.i18n', {'locale': 'en_US', 'foo': 'bar'})
>>> cfg.get('tipfy.ext.i18n', 'locale')
en_US
>>> cfg.get('tipfy.ext.i18n', 'foo')
bar
:param module:
The module to update the configuration, e.g.: `tipfy.ext.i18n`.
:param value:
A dictionary of configurations for the module.
:returns:
None.
"""
assert isinstance(value, dict)
if module not in self:
self[module] = {}
self[module].update(value)
class MiddlewareFactory(object):
"""A factory and registry for middleware instances in use."""
#: All middleware methods to look for.
names = (
'post_make_app',
'pre_dispatch_handler',
'post_dispatch_handler',
'pre_dispatch',
'post_dispatch',
'handle_exception',
)
#: Methods that must run in reverse order.
reverse_names = (
'post_dispatch_handler',
'post_dispatch',
'handle_exception',
)
def __init__(self):
# Instantiated middleware.
self.instances = {}
# Methods from instantiated middleware.
self.methods = {}
# Middleware methods for a given object.
self.obj_middleware = {}
def get_middleware(self, obj, classes):
"""Returns a dictionary of all middleware instance methods for a given
object.
:param obj:
The object to search for related middleware (the :class:`Tipfy` or
:class:`RequestHandler`).
:param classes:
A list of middleware classes.
:return:
A dictionary with middleware instance methods.
"""
id = obj.__module__ + '.' + obj.__class__.__name__
if id not in self.obj_middleware:
self.obj_middleware[id] = self.load_middleware(classes)
return self.obj_middleware[id]
def load_middleware(self, specs):
"""Returns a dictionary of middleware instance methods for a list of
middleware specifications.
:param specs:
A list of middleware classes, classes as strings or instances.
:return:
A dictionary with middleware instance methods.
"""
res = {}
for spec in specs:
# Middleware can be defined in 3 forms: strings, classes and
# instances.
is_str = isinstance(spec, basestring)
is_obj = not is_str and not isinstance(spec, type)
if is_obj:
# Instance.
spec_id = id(spec)
obj = spec
elif is_str:
spec_id = spec
else:
spec_id = spec.__module__ + '.' + spec.__name__
if spec_id not in self.methods:
if is_str:
spec = import_string(spec, silent=True)
if not spec:
logging.warning('Missing %s. Middleware was not '
'loaded.' % spec)
continue
if not is_obj:
obj = spec()
self.instances[spec_id] = obj
self.methods[spec_id] = [getattr(obj, n, None) for n in \
self.names]
for name, method in zip(self.names, self.methods[spec_id]):
if method:
res.setdefault(name, []).append(method)
for name in self.reverse_names:
if name in res:
res[name].reverse()
return res
class Rule(WerkzeugRule):
"""Extends Werkzeug routing to support a handler definition for each Rule.
Handler is a :class:`RequestHandler` module and class specification, and
endpoint is a friendly name used to build URL's. For example:
.. code-block:: python
Rule('/users', endpoint='user-list', handler='my_app:UsersHandler')
Access to the URL ``/users`` loads ``UsersHandler`` class from
``my_app`` module. To generate a URL to that page, use :func:`url_for`::
url = url_for('user-list')
"""
def __init__(self, *args, **kwargs):
self.handler = kwargs.pop('handler', kwargs.get('endpoint', None))
super(Rule, self).__init__(*args, **kwargs)
def empty(self):
"""Returns an unbound copy of this rule. This can be useful if you
want to reuse an already bound URL for another map.
"""
defaults = None
if self.defaults is not None:
defaults = dict(self.defaults)
return Rule(self.rule, defaults, self.subdomain, self.methods,
self.build_only, self.endpoint, self.strict_slashes,
self.redirect_to, handler=self.handler)
class HandlerPrefix(RuleFactory):
"""Prefixes all handler values (which must be strings for this factory) of
nested rules with another string. For example, take these rules::
rules = [
HandlerPrefix('my_app.handlers.', [
Rule('/', endpoint='index', handler='IndexHandler'),
Rule('/entry/<entry_slug>', endpoint='show', handler='ShowHandler'),
]),
]
These are the same as::
rules = [
Rule('/', endpoint='index', handler='my_app.handlers.IndexHandler'),
Rule('/entry/<entry_slug>', endpoint='show', handler='my_app.handlers.ShowHandler'),
]
"""
def __init__(self, prefix, rules):
self.prefix = prefix
self.rules = rules
def get_rules(self, map):
for rulefactory in self.rules:
for rule in rulefactory.get_rules(map):
rule = rule.empty()
rule.handler = self.prefix + rule.handler
yield rule
def get_config(module, key=None, default=REQUIRED_VALUE):
"""Returns a configuration value for a module.
.. seealso:: :meth:`Config.get_or_load`.
"""
return Tipfy.app.config.get_or_load(module, key=key, default=default)
def get_valid_methods(handler):
"""Returns a list of HTTP methods supported by a handler.
:param handler:
A :class:`RequestHandler` instance.
:returns:
A list of HTTP methods supported by the handler.
"""
return [method for method in ALLOWED_METHODS if
getattr(handler, method.lower().replace('-', '_'), None)]
def url_for(endpoint, _full=False, _method=None, _anchor=None, **kwargs):
"""Builds and returns a URL for a named :class:`Rule`.
This is a shortcut to :meth:`Request.url_for`.
"""
# For backwards compatibility, check old keywords.
full = kwargs.pop('full', _full)
method = kwargs.pop('method', _method)
return Tipfy.request.url_for(endpoint, _full=full, _method=method,
_anchor=_anchor, **kwargs)
def redirect_to(endpoint, _method=None, _anchor=None, _code=302, **kwargs):
"""Convenience function mixing ``werkzeug.redirect`` and
:meth:`Request.url_for`: redirects the client to a URL built using a named
:class:`Rule`.
:param endpoint:
The rule endpoint.
:param _method:
The rule request method, in case there are different rules
for different request methods.
:param _anchor:
An anchor to add to the end of the URL.
:param _code:
The redirect status code.
:param kwargs:
Keyword arguments to build the URL.
:return:
A :class:`Response` object with headers set for redirection.
"""
# For backwards compatibility, check old keywords.
method = kwargs.pop('method', _method)
code = kwargs.pop('code', _code)
url = Tipfy.request.url_for(endpoint, _full=True, _method=method,
_anchor=_anchor, **kwargs)
return redirect(url, code=code)
def render_json_response(*args, **kwargs):
"""Renders a JSON response.
:param args:
Arguments to be passed to simplejson.dumps().
:param kwargs:
Keyword arguments to be passed to simplejson.dumps().
:return:
A :class:`Response` object with a JSON string in the body and
mimetype set to ``application/json``.
"""
from django.utils import simplejson
return Response(simplejson.dumps(*args, **kwargs),
mimetype='application/json')
def make_wsgi_app(config=None, **kwargs):
"""Returns a instance of :class:`Tipfy`.
:param config:
A dictionary of configuration values.
:param kwargs:
Additional keyword arguments to instantiate :class:`Tipfy`.
:return:
A :class:`Tipfy` instance.
"""
app = Tipfy(config=config, **kwargs)
if app.dev:
logging.getLogger().setLevel(logging.DEBUG)
# Execute post_make_app middleware.
for hook in app.middleware.get('post_make_app', []):
app = hook(app)
return app
def run_wsgi_app(app):
"""Executes the application, optionally wrapping it by middleware.
.. warning::
This is deprecated. Use app.run() instead.
:param app:
A :class:`Tipfy` instance.
:return:
None.
"""
app.run()
_ULTIMATE_SYS_PATH = None
def fix_sys_path():
"""A fix for issue 772. We must keep this here until it is fixed in the dev
server.
See: http://code.google.com/p/googleappengine/issues/detail?id=772
"""
global _ULTIMATE_SYS_PATH
import sys
if _ULTIMATE_SYS_PATH is None:
_ULTIMATE_SYS_PATH = list(sys.path)
elif sys.path != _ULTIMATE_SYS_PATH:
sys.path[:] = _ULTIMATE_SYS_PATH
__all__ = [
'Config',
'DEFAULT_VALUE',
'EndpointPrefix',
'HTTPException',
'InternalServerError',
'Map',
'REQUIRED_VALUE',
'Request',
'RequestHandler',
'RequestRedirect',
'Response',
'Rule',
'RuleTemplate',
'Subdomain',
'Submount',
'Tipfy',
'abort',
'cached_property',
'default_config',
'escape',
'get_config',
'import_string',
'make_wsgi_app',
'redirect',
'redirect_to',
'render_json_response',
'run_wsgi_app',
'url_for',
'url_quote',
]
|
from ._stateful import Stateful
class Repo(Stateful):
'''
:ivar str slug:
Repository slug.
:ivar str description:
Description on |github|.
:ivar int last_build_id:
Build ID of the last executed build.
:ivar str last_build_number:
Build number of the last executed build.
:ivar str last_build_state:
Build state of the last executed build.
:ivar str last_build_duration:
Build duration of the last executed build.
:ivar str last_build_started_at:
Build started at of the last executed build.
:ivar str last_build_finished_at:
Build finished at of the last executed build.
:ivar str github_language:
Language on |github|.
:ivar bool active:
Whether or not the repository is active on |travisci|.
'''
__slots__ = [
'slug',
'description',
'last_build_id',
'last_build_number',
'last_build_state',
'last_build_duration',
'last_build_started_at',
'last_build_finished_at',
'last_build_language',
'github_language',
'active',
]
@property
def state(self):
'''
:class:`.Repo` state is given through ``last_build_state``.
.. seealso:: :class:`.Stateful` for ``state`` full documentation.
'''
return self.last_build_state
@property
def last_build(self):
'''
:rtype: :class:`.Build`
:returns:
A :class:`.Build` object with information related to current ``last_build_id``.
'''
from .build import Build
return self._load_one_lazy_information(Build, 'last_build_id')
@classmethod
def find_one(cls, session, entity_id, **kwargs):
result = super(Repo, cls).find_one(session, entity_id, **kwargs)
return result
def _set_hook(self, flag):
response = self._session.put(
self._session.uri + '/hooks/{}'.format(self.id),
json={"hook": {"active": flag}},
)
result = response.status_code == 200
if result:
self.active = flag
return result
def disable(self):
'''
Disable Travis CI for the repository.
:rtype: bool
:returns:
``True`` if API call was successful.
``False`` if API call was unsuccessful.
'''
return self._set_hook(False)
def enable(self):
'''
Enable Travis CI for the repository
:rtype: bool
:returns:
``True`` if API call was successful
``False`` if API call was unsuccessful
'''
return self._set_hook(True)
|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-10-25 15:52
from __future__ import unicode_literals
import django.contrib.gis.db.models.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hnfp', '0010_auto_20171024_1648'),
]
operations = [
migrations.CreateModel(
name='Alert',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('alert_date', models.CharField(blank=True, max_length=100, null=True)),
('alert_time', models.CharField(blank=True, max_length=20, null=True)),
('alert_type', models.CharField(blank=True, max_length=400, null=True)),
('alert_created', models.DateTimeField(auto_now_add=True)),
('alert_updated', models.DateTimeField(auto_now=True)),
('alert_username', models.CharField(blank=True, max_length=800, null=True)),
('alert_location', django.contrib.gis.db.models.fields.PointField(blank=True, default=None, null=True, srid=3857)),
('alert_comment', models.CharField(blank=True, default=None, max_length=20000, null=True)),
('alert_confirmed', models.BooleanField(default=False)),
],
options={
'verbose_name_plural': 'Alerts',
},
),
migrations.CreateModel(
name='LandUseProject',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(blank=True, max_length=300, null=True)),
('category', models.CharField(blank=True, choices=[('Forest', 'forest'), ('Road', 'road'), ('Stream', 'stream')], max_length=400, null=True)),
('summary', models.CharField(blank=True, default=None, max_length=20000, null=True)),
('description', models.CharField(blank=True, default=None, max_length=20000, null=True)),
('start_date', models.CharField(blank=True, max_length=200, null=True)),
('completion_date', models.CharField(blank=True, max_length=200, null=True)),
('actions', models.CharField(blank=True, max_length=20000, null=True)),
('dollar_costs', models.CharField(blank=True, max_length=4000, null=True)),
('emdollars', models.CharField(blank=True, max_length=4000, null=True)),
('area', django.contrib.gis.db.models.fields.PolygonField(blank=True, default=None, null=True, srid=3857)),
('created', models.DateTimeField(auto_now_add=True)),
('updated', models.DateTimeField(auto_now=True)),
('published', models.BooleanField(default=False)),
('username', models.CharField(blank=True, max_length=400, null=True)),
],
options={
'verbose_name_plural': 'Land Use Projects',
},
),
migrations.AddField(
model_name='observation',
name='observer_username',
field=models.CharField(blank=True, max_length=800, null=True),
),
]
|
from repESP.equivalence import Equivalence
from repESP.types import *
from repESP.respin_format import Respin
from repESP.respin_generation import prepare_respin
from repESP.respin_generation import RespStage1RespinGenerator, RespStage2RespinGenerator
from repESP.respin_generation import FitHydrogensOnlyRespinGenerator
from repESP.respin_generation import EquivalenceOnlyRespinGenerator, FrozenAtomsRespinGenerator
from my_unittest import TestCase
from copy import deepcopy
from io import StringIO
class TestRespinGenerationOnStage1Resp(TestCase):
def setUp(self) -> None:
# First stage RESP
self.expected_respin = Respin(
title="Respin file prepared by `repESP` to perform RESP stage 1.",
cntrl=Respin.Cntrl(
qwt=0.0005
),
subtitle="Resp charges for organic molecule",
charge=0,
molecule=Molecule([Atom(atomic_number) for atomic_number in [6, 1, 1, 1, 1]]),
ivary=Respin.Ivary([0, 0, 0, 0, 0])
)
self.ivary = self.expected_respin.ivary
self.molecule = self.expected_respin.molecule
def test_defaults(self) -> None:
generated = prepare_respin(
respin_generator=RespStage1RespinGenerator(self.ivary),
total_charge=0,
molecule=self.molecule
)
self.assertAlmostEqualRecursive(self.expected_respin, generated)
def test_with_read_charges(self) -> None:
generated = prepare_respin(
respin_generator=RespStage1RespinGenerator(self.ivary),
total_charge=0,
molecule=self.molecule,
read_charges=True
)
expected = deepcopy(self.expected_respin)
expected.cntrl.iqopt = 2
self.assertAlmostEqualRecursive(expected, generated)
def test_with_total_charge(self) -> None:
generated = prepare_respin(
respin_generator=RespStage1RespinGenerator(self.ivary),
total_charge=1,
molecule=self.molecule
)
expected = deepcopy(self.expected_respin)
expected.charge = 1
self.assertAlmostEqualRecursive(expected, generated)
def test_with_title_and_subtitles(self) -> None:
generated = prepare_respin(
respin_generator=RespStage1RespinGenerator(self.ivary),
total_charge=0,
molecule=self.molecule,
title="Custom title",
subtitle="Custom subtitle"
)
expected = deepcopy(self.expected_respin)
expected.title = "Custom title"
expected.subtitle = "Custom subtitle"
self.assertAlmostEqualRecursive(expected, generated)
class TestResp(TestCase):
def setUp(self) -> None:
# acetate anion [C O O C H H H]
self.equivalence = Equivalence([None, None, 1, None, None, 4, 4])
self.methyl_methylene_mask = [False, False, False, True, True, True, True]
def test_stage1_from_methyl_methylene(self) -> None:
self.assertListEqual(
RespStage1RespinGenerator.from_methyl_and_methylene(
self.equivalence,
self.methyl_methylene_mask
).ivary.values,
[0, 0, 2, 0, 0, 0, 0]
)
def test_stage2_from_methyl_methylene(self) -> None:
self.assertListEqual(
RespStage2RespinGenerator.from_methyl_and_methylene(
self.equivalence,
self.methyl_methylene_mask
).ivary.values,
[-1, -1, -1, 0, 0, 5, 5]
)
class TestFitingHydrogensOnly(TestCase):
def test_fitting_hydrogens_only(self) -> None:
respin = Respin(
title="Respin file prepared by `repESP` to perform fitting of hydrogen atoms.",
cntrl=Respin.Cntrl(
iqopt=2,
ihfree=0,
qwt=0.0
),
subtitle="Resp charges for organic molecule",
charge=0,
molecule=Molecule([Atom(atomic_number) for atomic_number in [6, 1, 1, 1, 1]]),
ivary=Respin.Ivary([-1, 0, 2, 2, 2])
)
generated = prepare_respin(
respin_generator=FitHydrogensOnlyRespinGenerator(
Equivalence([None, None, 1, 1, 1]),
respin.molecule
),
total_charge=0,
molecule=respin.molecule
)
self.assertAlmostEqualRecursive(respin, generated)
class TestEquivalencing(TestCase):
def test_equivalencing(self) -> None:
respin = Respin(
title="Respin file prepared by `repESP` to perform atom equivalencing.",
cntrl=Respin.Cntrl(
ihfree=0,
qwt=0.0
),
subtitle="Resp charges for organic molecule",
charge=0,
molecule=Molecule([Atom(atomic_number) for atomic_number in [6, 1, 1, 1, 1]]),
ivary=Respin.Ivary([0, 0, 2, 2, 2])
)
generated = prepare_respin(
respin_generator=EquivalenceOnlyRespinGenerator(
Equivalence([None, None, 1, 1, 1])
),
total_charge=0,
molecule=respin.molecule
)
self.assertAlmostEqualRecursive(respin, generated)
class TestFittingWithFrozenAtoms(TestCase):
def test_fitting_with_frozen_atoms(self) -> None:
respin = Respin(
title="Respin file prepared by `repESP` to perform fitting with selected atom charges frozen.",
cntrl=Respin.Cntrl(
iqopt=2,
ihfree=0,
qwt=0.0
),
subtitle="Resp charges for organic molecule",
charge=0,
molecule=Molecule([Atom(atomic_number) for atomic_number in [6, 1, 1, 1, 1]]),
ivary=Respin.Ivary([-1, 0, 2, -1, 2])
)
generated = prepare_respin(
respin_generator=FrozenAtomsRespinGenerator(
Equivalence([None, None, 1, 1, 1]),
frozen_atoms=[0, 3]
),
total_charge=0,
molecule=respin.molecule
)
self.assertAlmostEqualRecursive(respin, generated)
|
# -*- coding: utf-8 -*-
#
# DECaF CLI documentation build configuration file, created by
# sphinx-quickstart on Wed Feb 3 16:24:56 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../../../decaf_cli'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.coverage',
'sphinx.ext.ifconfig',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'DECaF CLI'
copyright = u'2016, Andreas Krakau'
author = u'Andreas Krakau'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u'0.1'
# The full version, including alpha/beta/rc tags.
release = u'0.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = []
# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'alabaster'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
#html_search_language = 'en'
# A dictionary with options for the search language support, empty by default.
# Now only 'ja' uses this config value
#html_search_options = {'type': 'default'}
# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#html_search_scorer = 'scorer.js'
# Output file base name for HTML help builder.
htmlhelp_basename = 'DECaFCLIdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Latex figure (float) alignment
#'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'DECaFCLI.tex', u'DECaF CLI Documentation',
u'Andreas Krakau', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'decafcli', u'DECaF CLI Documentation',
[author], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'DECaFCLI', u'DECaF CLI Documentation',
author, 'DECaFCLI', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False
# -- Options for Epub output ----------------------------------------------
# Bibliographic Dublin Core info.
epub_title = project
epub_author = author
epub_publisher = author
epub_copyright = copyright
# The basename for the epub file. It defaults to the project name.
#epub_basename = project
# The HTML theme for the epub output. Since the default themes are not
# optimized for small screen space, using the same theme for HTML and epub
# output is usually not wise. This defaults to 'epub', a theme designed to save
# visual space.
#epub_theme = 'epub'
# The language of the text. It defaults to the language option
# or 'en' if the language is not set.
#epub_language = ''
# The scheme of the identifier. Typical schemes are ISBN or URL.
#epub_scheme = ''
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#epub_identifier = ''
# A unique identification for the text.
#epub_uid = ''
# A tuple containing the cover image and cover page html template filenames.
#epub_cover = ()
# A sequence of (type, uri, title) tuples for the guide element of content.opf.
#epub_guide = ()
# HTML files that should be inserted before the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_pre_files = []
# HTML files that should be inserted after the pages created by sphinx.
# The format is a list of tuples containing the path and title.
#epub_post_files = []
# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
# The depth of the table of contents in toc.ncx.
#epub_tocdepth = 3
# Allow duplicate toc entries.
#epub_tocdup = True
# Choose between 'default' and 'includehidden'.
#epub_tocscope = 'default'
# Fix unsupported image types using the Pillow.
#epub_fix_images = False
# Scale large images.
#epub_max_image_width = 0
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#epub_show_urls = 'inline'
# If false, no index is generated.
#epub_use_index = True
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
|
p = dict()
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def main():
# 420 / 4 = 105
p[1] = 1
m = 2
maxv = 2*10**7
while m * m < maxv:
n = m - 1
while n > 0 and n*n-m*m+2*n*m > 0:
if gcd(n, m) != 1:
n -= 1
continue
n2m2 = n*n + m*m
if n2m2 % 2 == 0:
n2m2 //= 2
# print((n*n+2*m*n-m*m)//2, (m*m+2*m*n-n*n)//2, n2m2)
else:
# print(n*n+2*m*n-m*m, m*m+2*m*n-n*n, n2m2)
pass
if n2m2 <= maxv:
if n2m2 in p:
p[n2m2] += 2
else:
p[n2m2] = 2
# print(n2m2)
n -= 1
m += 1
# print('m', m)
print("finish p")
for i in range(1, maxv):
if i % 2 == 0:
continue
s = 0
for j in range(1, 10**4):
if j * j > i:
break
if i % j == 0 and j <= i//j:
if j in p:
s += p[j]
if i//j > j and i//j in p:
s += p[i//j]
if 4 * s == 420:
print(i, 4 * s)
main()
print("end")
"""
359125 420
469625 420
612625 420
781625 420
866125 420
933725 420
1047625 420
1077375 420
1119625 420
1288625 420
1336625 420
1366625 420
1408875 420
1481125 420
1542125 420
1592825 420
1596725 420
1787125 420
1837875 420
1880125 420
1914625 420
2032225 420
2049125 420
2133625 420
2203625 420
2224625 420
2251925 420
2302625 420
2344875 420
2387125 420
2513875 420
2598375 420
2637125 420
2731625 420
2801175 420
2894125 420
2909125 420
2911025 420
3142875 420
3147625 420
3174665 420
3215125 420
3232125 420
3287375 420
3316625 420
3350425 420
3358875 420
3504125 420
3561925 420
3572125 420
3648625 420
3654625 420
3823625 420
3865875 420
3889625 420
3937625 420
3950375 420
4009525 420
4009875 420
4077125 420
4082125 420
4099875 420
4151485 420
4161625 420
4226625 420
4288375 420
4310125 420
4443375 420
4544525 420
4564625 420
4626375 420
4778475 420
4790175 420
4837625 420
4888325 420
4922125 420
4949125 420
4962625 420
5035825 420
5091125 420
5165875 420
5327725 420
5361375 420
5382625 420
5429125 420
5471375 420
5513625 420
5547425 420
5571625 420
5640375 420
5671625 420
5682625 420
5743875 420
5851625 420
5936125 420
5969125 420
5986825 420
6046625 420
6062875 420
6093625 420
6096675 420
6147375 420
6189625 420
6206525 420
6249625 420
6400875 420
6412625 420
6509725 420
6536075 420
6538625 420
6610875 420
6612125 420
6673875 420
6696625 420
6738875 420
6755775 420
6823375 420
6907875 420
6972125 420
7016125 420
7034625 420
7116625 420
7119125 420
7161375 420
7333375 420
7372625 420
7457125 420
7492325 420
7524725 420
7541625 420
7674125 420
7774625 420
7795125 420
7837375 420
7879625 420
7907125 420
7911375 420
7926425 420
8183825 420
8194875 420
8217625 420
8259875 420
8272625 420
8386625 420
8403525 420
8417125 420
8471125 420
8597875 420
8623225 420
8640125 420
8659625 420
8682375 420
8706125 420
8727375 420
8733075 420
8893625 420
8922875 420
8966225 420
9020375 420
9069625 420
9147125 420
9238385 420
9284125 420
9356125 420
9356375 420
9428625 420
9442875 420
9485125 420
9502025 420
9523995 420
9527375 420
9566375 420
9645375 420
9654125 420
9696375 420
9717625 420
9738625 420
9862125 420
9941425 420
9949875 420
10006625 420
10051275 420
10076625 420
10151125 420
10182625 420
10197125 420
10270975 420
10365325 420
10367875 420
10438625 420
10512375 420
10584625 420
10600525 420
10617625 420
10685775 420
10716375 420
10752625 420
10794875 420
10801375 420
10820225 420
10931425 420
10945875 420
10963875 420
11006125 420
11132875 420
11136625 420
11149775 420
11177075 420
11307125 420
11324125 420
11428625 420
11451625 420
11458625 420
11470875 420
11523875 420
11597625 420
11639875 420
11668875 420
11766625 420
11812875 420
11851125 420
11879125 420
11914025 420
12020125 420
12028575 420
12029625 420
12189125 420
12231375 420
12246375 420
12299625 420
12315875 420
12405325 420
12454455 420
12484875 420
12492125 420
12509875 420
12527125 420
12607625 420
12679875 420
12752125 420
12797525 420
12817625 420
12865125 420
12930375 420
12949625 420
12991625 420
13160875 420
13236925 420
13330125 420
13402375 420
13633575 420
13693875 420
13879125 420
13879225 420
14090375 420
14174875 420
14225575 420
14335425 420
14343875 420
14370525 420
14512875 420
14558375 420
14664975 420
14702875 420
14766375 420
14775125 420
14847375 420
14850875 420
14887875 420
14935375 420
15032875 420
15107475 420
15208625 420
15230125 420
15273375 420
15425375 420
15433925 420
15442375 420
15497625 420
15572375 420
15763475 420
15983175 420
16084125 420
16118375 420
16147875 420
16287375 420
16292375 420
16414125 420
16456375 420
16540875 420
16642275 420
16709875 420
16714875 420
16878875 420
16921125 420
16963375 420
17014875 420
17047875 420
17231625 420
17521075 420
17554875 420
17563975 420
17597125 420
17740775 420
17808375 420
17907375 420
17960475 420
17977375 420
18139875 420
18186625 420
18188625 420
18280875 420
18290025 420
18300925 420
18442125 420
18459875 420
18568875 420
18619575 420
18748875 420
18991375 420
19121375 420
19202625 420
19237875 420
19529175 420
19608225 420
19615875 420
19658375 420
19832625 420
19836375 420
19904875 420
19920875 420
"""
|
from morsel.panda import *
from morsel.nodes.node import Node
from morsel.nodes.ode.object import Object
from morsel.nodes.facade import Mesh as _Mesh
from morsel.nodes.ode.solid import Solid
#-------------------------------------------------------------------------------
class Mesh(Solid):
def __init__(self, **kargs):
super(Mesh, self).__init__(**kargs)
#-------------------------------------------------------------------------------
def getMesh(self):
if not self._mesh and self.object:
self._mesh = _Mesh(parent = self)
self._mesh.copyFrom(self.object.mesh.model, flatten = True)
return self._mesh
mesh = property(getMesh)
#-------------------------------------------------------------------------------
def fit(self, node):
Solid.fit(self, node)
mesh = _Mesh(position = self.globalPosition, orientation =
self.globalOrientation)
mesh.copyFrom(node.mesh, flatten = True)
data = panda.OdeTriMeshData(mesh)
mesh.detachNode()
self.geometry = panda.OdeTriMeshGeom(node.world.space, data)
|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Concept',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(unique=True, max_length=100, verbose_name='Name')),
('slug', models.SlugField(unique=True, max_length=100, verbose_name='Slug')),
('created', models.DateTimeField(auto_now_add=True, verbose_name='created')),
('last_tagged', models.DateTimeField(db_index=True, verbose_name='last time tagged', null=True, editable=False, blank=True)),
('enabled', models.BooleanField(default=True, help_text='If unchecked, it will remove current associations and\n will not allow new associations.', verbose_name='Enabled')),
('url', models.CharField(help_text='A URL for more information regarding this concept.', max_length=255, blank=True)),
('woeid', models.IntegerField(null=True, verbose_name='where on earth id', blank=True)),
('latitude', models.DecimalField(null=True, verbose_name='latitude', max_digits=11, decimal_places=6, blank=True)),
('longitude', models.DecimalField(null=True, verbose_name='longitude', max_digits=11, decimal_places=6, blank=True)),
('bbox_n', models.DecimalField(null=True, verbose_name='bounding box north', max_digits=11, decimal_places=6, blank=True)),
('bbox_s', models.DecimalField(null=True, verbose_name='bounding box south', max_digits=11, decimal_places=6, blank=True)),
('bbox_e', models.DecimalField(null=True, verbose_name='bounding box east', max_digits=11, decimal_places=6, blank=True)),
('bbox_w', models.DecimalField(null=True, verbose_name='bounding box west', max_digits=11, decimal_places=6, blank=True)),
('substitute', models.ForeignKey(blank=True, to='concepts.Concept', help_text='Tag to use instead of this one. Moves current\n associations to the substitute tag and new association attempts\n are automatically swapped.', null=True, verbose_name='substitute')),
],
options={
'ordering': ('name',),
'verbose_name': 'Concept',
'verbose_name_plural': 'Concepts',
},
bases=(models.Model,),
),
migrations.CreateModel(
name='ConceptItem',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('object_id', models.IntegerField(verbose_name='Object id', db_index=True)),
('added', models.DateTimeField(auto_now_add=True, db_index=True)),
('weight', models.IntegerField(null=True, blank=True)),
('content_type', models.ForeignKey(related_name='concepts_conceptitem_tagged_items', verbose_name='Content type', to='contenttypes.ContentType')),
('tag', models.ForeignKey(related_name='concepts_conceptitem_items', to='concepts.Concept')),
],
options={
'ordering': ('id',),
'verbose_name': 'Concept Item',
'verbose_name_plural': 'Concept Items',
},
bases=(models.Model,),
),
]
|
import datetime
import io
import json
import re
import tarfile
from connexion import request
import anchore_engine.apis
import anchore_engine.common
import anchore_engine.common.images
import anchore_engine.configuration.localconfig
import anchore_engine.subsys.metrics
from anchore_engine import utils
from anchore_engine.apis import exceptions as api_exceptions
from anchore_engine.apis.authorization import (
get_authorizer,
RequestingAccountValue,
ActionBoundPermission,
)
from anchore_engine.apis.context import ApiRequestContextProxy
from anchore_engine.clients.services import internal_client_for
from anchore_engine.clients.services.catalog import CatalogClient
from anchore_engine.clients.services.policy_engine import PolicyEngineClient
from anchore_engine.common.helpers import make_response_error
from anchore_engine.db.entities.common import anchore_now
from anchore_engine.services.apiext.api.controllers.utils import (
normalize_image_add_source,
validate_image_add_source,
# make_response_vulnerability,
make_response_vulnerability_report,
)
from anchore_engine.subsys import taskstate, logger
from anchore_engine.subsys.metrics import flask_metrics
from anchore_engine.utils import parse_dockerimage_string
authorizer = get_authorizer()
def make_response_policyeval(eval_record, params, catalog_client):
ret = {}
try:
tag = eval_record["tag"]
ret[tag] = {}
if eval_record["evalId"] and eval_record["policyId"]:
ret[tag]["detail"] = {}
if params and "detail" in params and params["detail"]:
eval_data = eval_record["result"]
ret[tag]["detail"]["result"] = eval_data
bundle_data = catalog_client.get_document(
"policy_bundles", eval_record["policyId"]
)
ret[tag]["detail"]["policy"] = bundle_data
ret[tag]["policyId"] = eval_record["policyId"]
if eval_record["final_action"].upper() in ["GO", "WARN"]:
ret[tag]["status"] = "pass"
else:
ret[tag]["status"] = "fail"
ret[tag]["last_evaluation"] = (
datetime.datetime.utcfromtimestamp(
eval_record["created_at"]
).isoformat()
+ "Z"
)
else:
ret[tag]["policyId"] = "N/A"
ret[tag]["final_action"] = "fail"
ret[tag]["last_evaluation"] = "N/A"
ret[tag]["detail"] = {}
except Exception as err:
raise Exception("failed to format policy eval response: " + str(err))
return ret
def make_response_image(image_record, include_detail=True):
ret = image_record
image_content = {"metadata": {}}
for key in [
"arch",
"distro",
"distro_version",
"dockerfile_mode",
"image_size",
"layer_count",
]:
val = image_record.pop(key, None)
image_content["metadata"][key] = val
image_record["image_content"] = image_content
if image_record["annotations"]:
try:
annotation_data = json.loads(image_record["annotations"])
image_record["annotations"] = annotation_data
except:
pass
# try to assemble full strings
if image_record and "image_detail" in image_record:
for image_detail in image_record["image_detail"]:
try:
image_detail["fulldigest"] = (
image_detail["registry"]
+ "/"
+ image_detail["repo"]
+ "@"
+ image_detail["digest"]
)
image_detail["fulltag"] = (
image_detail["registry"]
+ "/"
+ image_detail["repo"]
+ ":"
+ image_detail["tag"]
)
except:
image_detail["fulldigest"] = None
image_detail["fulltag"] = None
for removekey in ["record_state_val", "record_state_key"]:
image_detail.pop(removekey, None)
for datekey in ["last_updated", "created_at", "tag_detected_at"]:
try:
image_detail[datekey] = (
datetime.datetime.utcfromtimestamp(
image_detail[datekey]
).isoformat()
+ "Z"
)
except:
pass
if not include_detail:
image_record["image_detail"] = []
for datekey in ["last_updated", "created_at", "analyzed_at"]:
try:
image_record[datekey] = (
datetime.datetime.utcfromtimestamp(image_record[datekey]).isoformat()
+ "Z"
)
except:
pass
for removekey in ["record_state_val", "record_state_key"]:
image_record.pop(removekey, None)
return ret
def lookup_imageDigest_from_imageId(request_inputs, imageId):
user_auth = request_inputs["auth"]
method = request_inputs["method"]
bodycontent = request_inputs["bodycontent"]
params = request_inputs["params"]
userId = request_inputs["userId"]
ret = None
try:
client = internal_client_for(CatalogClient, request_inputs["userId"])
image_records = client.get_image_by_id(imageId=imageId)
if image_records:
image_record = image_records[0]
imageDigest = image_record["imageDigest"]
ret = imageDigest
except Exception as err:
logger.debug("operation exception: " + str(err))
raise err
return ret
def vulnerability_query(
account,
digest,
vulnerability_type,
force_refresh=False,
vendor_only=True,
doformat=False,
):
# user_auth = request_inputs['auth']
# method = request_inputs['method']
# bodycontent = request_inputs['bodycontent']
# params = request_inputs['params']
return_object = {}
httpcode = 500
# userId = request_inputs['userId']
localconfig = anchore_engine.configuration.localconfig.get_config()
system_user_auth = localconfig["system_user_auth"]
verify = localconfig["internal_ssl_verify"]
# force_refresh = params.get('force_refresh', False)
# vendor_only = params.get('vendor_only', True)
try:
if (
vulnerability_type
not in anchore_engine.common.image_vulnerability_types + ["all"]
):
httpcode = 404
raise Exception(
"content type (" + str(vulnerability_type) + ") not available"
)
# tag = params.pop('tag', None)
# imageDigest = params.pop('imageDigest', None)
# digest = params.pop('digest', None)
catalog_client = internal_client_for(CatalogClient, account)
image_report = catalog_client.get_image(digest)
if image_report and image_report["analysis_status"] != taskstate.complete_state(
"analyze"
):
httpcode = 404
raise Exception(
"image is not analyzed - analysis_status: "
+ image_report["analysis_status"]
)
imageDigest = image_report["imageDigest"]
try:
image_detail = image_report["image_detail"][0]
imageId = image_detail["imageId"]
client = internal_client_for(PolicyEngineClient, account)
resp = client.get_image_vulnerabilities(
user_id=account,
image_id=imageId,
force_refresh=force_refresh,
vendor_only=vendor_only,
)
if doformat:
# ret = make_response_vulnerability(vulnerability_type, resp)
ret = make_response_vulnerability_report(vulnerability_type, resp)
return_object[imageDigest] = ret
else:
return_object[imageDigest] = resp
httpcode = 200
except Exception as err:
httpcode = 500
raise Exception("could not fetch vulnerabilities - exception: " + str(err))
httpcode = 200
except Exception as err:
return_object = make_response_error(err, in_httpcode=httpcode)
httpcode = return_object["httpcode"]
return return_object, httpcode
def get_content(request_inputs, content_type):
params = request_inputs["params"]
return_object = {}
http_code = 500
try:
localconfig = anchore_engine.configuration.localconfig.get_config()
all_content_types = localconfig.get(
"image_content_types", []
) + localconfig.get("image_metadata_types", [])
if content_type not in all_content_types:
raise Exception("content type (" + str(content_type) + ") not available")
image_digest = params.pop("imageDigest", None)
client = internal_client_for(CatalogClient, request_inputs["userId"])
return_object[image_digest] = client.get_image_content(
image_digest, content_type
)
http_code = 200
except Exception as err:
logger.exception("Failed content lookup")
return_object = make_response_error(err, in_httpcode=http_code)
http_code = return_object["httpcode"]
return return_object, http_code
# repositories
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def add_repository(repository=None, autosubscribe=False, dryrun=False):
try:
request_inputs = anchore_engine.apis.do_request_prep(
request,
default_params={
"autosubscribe": autosubscribe,
"repository": repository,
"dryrun": dryrun,
},
)
return_object, httpcode = repositories(request_inputs)
except Exception as err:
httpcode = 500
return_object = str(err)
return return_object, httpcode
def repositories(request_inputs):
method = request_inputs["method"]
bodycontent = request_inputs["bodycontent"]
params = request_inputs["params"]
return_object = {}
httpcode = 500
input_repo = None
if params and "repository" in params:
input_repo = params["repository"]
autosubscribe = False
if params and "autosubscribe" in params:
autosubscribe = params["autosubscribe"]
dryrun = False
if params and "dryrun" in params:
dryrun = params["dryrun"]
try:
if method == "POST":
logger.debug("handling POST: ")
try:
client = internal_client_for(CatalogClient, request_inputs["userId"])
return_object = []
repo_records = client.add_repo(
regrepo=input_repo,
autosubscribe=autosubscribe,
dryrun=dryrun,
)
for repo_record in repo_records:
return_object.append(repo_record)
httpcode = 200
except Exception as err:
raise err
except Exception as err:
logger.debug("operation exception: " + str(err))
return_object = make_response_error(err, in_httpcode=httpcode)
httpcode = return_object["httpcode"]
return return_object, httpcode
# images CRUD
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def list_imagetags(image_status=None):
try:
request_inputs = anchore_engine.apis.do_request_prep(request, default_params={})
user_auth = request_inputs["auth"]
method = request_inputs["method"]
bodycontent = request_inputs["bodycontent"]
params = request_inputs["params"]
return_object = {}
httpcode = 500
client = internal_client_for(CatalogClient, request_inputs["userId"])
return_object = client.get_imagetags(image_status)
httpcode = 200
except Exception as err:
httpcode = 500
return_object = str(err)
return return_object, httpcode
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def import_image_archive(archive_file):
httpcode = 500
try:
request_inputs = anchore_engine.apis.do_request_prep(request, default_params={})
request_account = request_inputs["userId"]
# TODO perform the archive format validation here, for now just a READ
try:
archive_buffer = archive_file.read()
except Exception as err:
httpcode = 409
raise Exception(
"invalid archive format (must be an image archive tar.gz generated by anchore) - exception: {}".format(
err
)
)
# get some information out of the archive for input validation
archive_account = None
archive_digest = None
with tarfile.open(
fileobj=io.BytesIO(archive_buffer), format=tarfile.PAX_FORMAT
) as TFH:
try:
with TFH.extractfile("archive_manifest") as AMFH:
archive_manifest = json.loads(utils.ensure_str(AMFH.read()))
archive_account = archive_manifest["account"]
archive_digest = archive_manifest["image_digest"]
except Exception as err:
httpcode = 409
raise Exception(
"cannot extract/parse archive_manifest from archive file - exception: {}".format(
err
)
)
# removed the bloe validation check as the checks are now performed in the archiving subsystem, based on the authenticated account
# perform verification that the account set in the archive matches the calling account namespace
# if (not request_account or not archive_account) or (request_account != archive_account):
# httpcode = 409
# raise Exception ("account in import archive ({}) does not match API request account ({})".format(archive_account, request_account))
# make the import call to the catalog
client = internal_client_for(CatalogClient, request_inputs["userId"])
catalog_import_return_object = client.import_archive(
archive_digest, io.BytesIO(archive_buffer)
)
# finally grab the image record from the catalog, prep the respose and return
image_record = client.get_image(archive_digest)
return_object = [make_response_image(image_record, include_detail=True)]
httpcode = 200
except api_exceptions.AnchoreApiError as err:
return_object = make_response_error(err, in_httpcode=err.__response_code__)
httpcode = err.__response_code__
except Exception as err:
logger.debug("operation exception: " + str(err))
return_object = make_response_error(err, in_httpcode=httpcode)
httpcode = return_object["httpcode"]
return return_object, httpcode
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def list_images(
history=None,
fulltag=None,
detail=False,
image_status="active",
analysis_status=None,
):
httpcode = 500
try:
digest = None
return_object = do_list_images(
account=ApiRequestContextProxy.namespace(),
filter_digest=digest,
filter_tag=fulltag,
history=history,
image_status=image_status,
analysis_status=analysis_status,
)
httpcode = 200
except api_exceptions.AnchoreApiError as err:
return_object = make_response_error(err, in_httpcode=err.__response_code__)
httpcode = err.__response_code__
except Exception as err:
logger.debug("operation exception: " + str(err))
return_object = make_response_error(err, in_httpcode=httpcode)
httpcode = return_object["httpcode"]
return return_object, httpcode
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def delete_images_async(imageDigests, force=False):
return_object = {}
httpcode = 500
try:
logger.debug("Handling DELETE on imageDigests: %s" % imageDigests)
client = internal_client_for(CatalogClient, ApiRequestContextProxy.namespace())
rc = client.delete_images_async(imageDigests, force=force)
if rc:
return_object = rc
httpcode = 200
else:
httpcode = 500
raise Exception(
"Operation failed due to an error/connectivity issue with catalog"
)
except Exception as err:
logger.exception("Error in asynchronous deletion of images")
return_object = make_response_error(err, in_httpcode=httpcode)
httpcode = return_object["httpcode"]
return return_object, httpcode
def validate_pullstring_is_tag(pullstring):
try:
parsed = parse_dockerimage_string(pullstring)
return parsed.get("tag") is not None
except Exception as e:
logger.debug_exception(
"Error parsing pullstring {}. Err = {}".format(pullstring, e)
)
raise ValueError("Error parsing pullstring {}".format(pullstring))
def validate_pullstring_is_digest(pullstring):
try:
parsed = parse_dockerimage_string(pullstring)
return parsed.get("digest") is not None
except Exception as e:
logger.debug_exception(
"Error parsing pullstring {}. Err = {}".format(pullstring, e)
)
raise ValueError("Error parsing pullstring {}".format(pullstring))
digest_regex = re.compile("sha256:[a-fA-F0-9]{64}")
def validate_archive_digest(digest: str):
return digest is not None and digest_regex.match(digest.strip())
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def add_image(image, force=False, autosubscribe=False):
# TODO: use for validation pass
spec = ApiRequestContextProxy.get_service().api_spec
httpcode = 500
try:
request_inputs = anchore_engine.apis.do_request_prep(
request, default_params={"force": force}
)
try:
normalized = normalize_image_add_source(analysis_request_dict=image)
validate_image_add_source(normalized, spec)
except api_exceptions.AnchoreApiError:
raise
except Exception as e:
raise api_exceptions.BadRequest(
"Could not validate request due to error",
detail={"validation_error": str(e)},
)
enable_subscriptions = ["analysis_update"]
if autosubscribe:
enable_subscriptions.append("tag_update")
source = normalized["source"]
return_object = analyze_image(
ApiRequestContextProxy.namespace(),
source,
force,
enable_subscriptions,
image.get("annotations"),
)
httpcode = 200
except api_exceptions.AnchoreApiError as err:
raise err
# httpcode = err.__response_code__
# return_object = make_response_error(err.message, details=err.detail, in_httpcode=httpcode)
except ValueError as err:
httpcode = 400
return_object = make_response_error(str(err), in_httpcode=400)
except Exception as err:
logger.debug("operation exception: {}".format(str(err)))
return_object = make_response_error(err, in_httpcode=httpcode)
httpcode = return_object["httpcode"]
return return_object, httpcode
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def delete_image(imageDigest, force=False):
try:
request_inputs = anchore_engine.apis.do_request_prep(
request, default_params={"force": force}
)
return_object, httpcode = images_imageDigest(request_inputs, imageDigest)
except Exception as err:
httpcode = 500
return_object = str(err)
return return_object, httpcode
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def get_image(imageDigest, history=None):
try:
request_inputs = anchore_engine.apis.do_request_prep(
request, default_params={"history": False}
)
return_object, httpcode = images_imageDigest(request_inputs, imageDigest)
except Exception as err:
httpcode = 500
return_object = str(err)
return return_object, httpcode
@flask_metrics.do_not_track()
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def get_image_by_imageId(imageId, history=None):
try:
request_inputs = anchore_engine.apis.do_request_prep(
request, default_params={"history": False}
)
try:
imageDigest = lookup_imageDigest_from_imageId(request_inputs, imageId)
except:
imageDigest = imageId
return_object, httpcode = images_imageDigest(request_inputs, imageDigest)
except Exception as err:
httpcode = 500
return_object = str(err)
return return_object, httpcode
@flask_metrics.do_not_track()
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def delete_image_by_imageId(imageId, force=False):
try:
request_inputs = anchore_engine.apis.do_request_prep(
request, default_params={"force": force}
)
try:
imageDigest = lookup_imageDigest_from_imageId(request_inputs, imageId)
except:
imageDigest = imageId
request_inputs = anchore_engine.apis.do_request_prep(request, default_params={})
return_object, httpcode = images_imageDigest(request_inputs, imageDigest)
except Exception as err:
httpcode = 500
return_object = str(err)
return return_object, httpcode
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def get_image_policy_check(
imageDigest, policyId=None, tag=None, detail=True, history=False
):
try:
request_inputs = anchore_engine.apis.do_request_prep(
request,
default_params={
"tag": None,
"detail": True,
"history": False,
"policyId": None,
},
)
return_object, httpcode = images_imageDigest_check(request_inputs, imageDigest)
except Exception as err:
httpcode = 500
return_object = str(err)
return return_object, httpcode
@flask_metrics.do_not_track()
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def get_image_policy_check_by_imageId(
imageId, policyId=None, tag=None, detail=None, history=None
):
try:
request_inputs = anchore_engine.apis.do_request_prep(request, default_params={})
try:
imageDigest = lookup_imageDigest_from_imageId(request_inputs, imageId)
except:
imageDigest = imageId
request_inputs = anchore_engine.apis.do_request_prep(
request,
default_params={
"tag": None,
"detail": True,
"history": False,
"policyId": None,
},
)
return_object, httpcode = images_imageDigest_check(request_inputs, imageDigest)
except Exception as err:
httpcode = 500
return_object = str(err)
return return_object, httpcode
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def list_image_metadata(imageDigest):
try:
localconfig = anchore_engine.configuration.localconfig.get_config()
return_object = localconfig.get("image_metadata_types", [])
httpcode = 200
except Exception as err:
httpcode = 500
return_object = str(err)
return return_object, httpcode
@flask_metrics.do_not_track()
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def get_image_metadata_by_type(imageDigest, mtype):
try:
request_inputs = anchore_engine.apis.do_request_prep(
request, default_params={"imageDigest": imageDigest}
)
return_object, httpcode = get_content(request_inputs, mtype)
if httpcode == 200:
return_object = {
"imageDigest": imageDigest,
"metadata_type": mtype,
"metadata": list(return_object.values())[0],
}
except Exception as err:
httpcode = 500
return_object = str(err)
return return_object, httpcode
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def list_image_content(imageDigest):
try:
localconfig = anchore_engine.configuration.localconfig.get_config()
return_object = localconfig.get("image_content_types", [])
httpcode = 200
except Exception as err:
httpcode = 500
return_object = str(err)
return return_object, httpcode
@flask_metrics.do_not_track()
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def list_image_content_by_imageid(imageId):
try:
localconfig = anchore_engine.configuration.localconfig.get_config()
return_object = localconfig.get("image_content_types", [])
httpcode = 200
except Exception as err:
httpcode = 500
return_object = str(err)
return return_object, httpcode
@flask_metrics.do_not_track()
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def get_image_content_by_type(imageDigest, ctype):
try:
request_inputs = anchore_engine.apis.do_request_prep(
request, default_params={"imageDigest": imageDigest}
)
return_object, httpcode = get_content(request_inputs, ctype)
if httpcode == 200:
return_object = {
"imageDigest": imageDigest,
"content_type": ctype,
"content": list(return_object.values())[0],
}
except Exception as err:
httpcode = 500
return_object = str(err)
return return_object, httpcode
@flask_metrics.do_not_track()
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def get_image_content_by_type_files(imageDigest):
return get_image_content_by_type(imageDigest, "files")
@flask_metrics.do_not_track()
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def get_image_content_by_type_javapackage(imageDigest):
return get_image_content_by_type(imageDigest, "java")
@flask_metrics.do_not_track()
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def get_image_content_by_type_malware(imageDigest):
return get_image_content_by_type(imageDigest, "malware")
@flask_metrics.do_not_track()
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def get_image_content_by_type_imageId(imageId, ctype):
try:
request_inputs = anchore_engine.apis.do_request_prep(request, default_params={})
try:
imageDigest = lookup_imageDigest_from_imageId(request_inputs, imageId)
except:
imageDigest = imageId
return_object, httpcode = get_image_content_by_type(imageDigest, ctype)
except Exception as err:
httpcode = 500
return_object = str(err)
return return_object, httpcode
@flask_metrics.do_not_track()
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def get_image_content_by_type_imageId_files(imageId):
return get_image_content_by_type_imageId(imageId, "files")
@flask_metrics.do_not_track()
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def get_image_content_by_type_imageId_javapackage(imageId):
return get_image_content_by_type_imageId(imageId, "java")
@flask_metrics.do_not_track()
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def get_image_vulnerability_types(imageDigest):
try:
return_object = anchore_engine.common.image_vulnerability_types + ["all"]
httpcode = 200
except Exception as err:
httpcode = 500
return_object = str(err)
return return_object, httpcode
@flask_metrics.do_not_track()
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def get_image_vulnerability_types_by_imageId(imageId):
try:
request_inputs = anchore_engine.apis.do_request_prep(request, default_params={})
try:
imageDigest = lookup_imageDigest_from_imageId(request_inputs, imageId)
except:
imageDigest = imageId
return_object, httpcode = get_image_vulnerability_types(imageDigest)
except Exception as err:
httpcode = 500
return_object = str(err)
return return_object, httpcode
@flask_metrics.do_not_track()
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def get_image_vulnerabilities_by_type(
imageDigest, vtype, force_refresh=False, vendor_only=True
):
try:
vulnerability_type = vtype
return_object, httpcode = vulnerability_query(
ApiRequestContextProxy.namespace(),
imageDigest,
vulnerability_type,
force_refresh,
vendor_only,
doformat=True,
)
if httpcode == 200:
return_object = {
"imageDigest": imageDigest,
"vulnerability_type": vulnerability_type,
"vulnerabilities": list(return_object.values())[0],
}
except Exception as err:
logger.exception("Exception getting vulns")
httpcode = 500
return_object = str(err)
return return_object, httpcode
@flask_metrics.do_not_track()
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def get_image_vulnerabilities_by_type_imageId(imageId, vtype):
try:
vulnerability_type = vtype
request_inputs = anchore_engine.apis.do_request_prep(request, default_params={})
try:
imageDigest = lookup_imageDigest_from_imageId(request_inputs, imageId)
except:
imageDigest = imageId
return_object, httpcode = get_image_vulnerabilities_by_type(
imageDigest, vulnerability_type
)
except Exception as err:
httpcode = 500
return_object = str(err)
return return_object, httpcode
# @flask_metrics.do_not_track()
# @authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
# def import_image(analysis_report):
# try:
# request_inputs = anchore_engine.apis.do_request_prep(request, default_params={})
# return_object, httpcode = do_import_image(request_inputs, analysis_report)
#
# except Exception as err:
# httpcode = 500
# return_object = str(err)
#
# return return_object, httpcode
# def do_import_image(request_inputs, importRequest):
# user_auth = request_inputs['auth']
# method = request_inputs['method']
# bodycontent = request_inputs['bodycontent']
# params = request_inputs['params']
#
# return_object = {}
# httpcode = 500
#
# userId, pw = user_auth
#
# try:
# client = internal_client_for(CatalogClient, request_inputs['userId'])
# return_object = []
# image_records = client.import_image(json.loads(bodycontent))
# for image_record in image_records:
# return_object.append(make_response_image(image_record))
# httpcode = 200
#
# except Exception as err:
# logger.debug("operation exception: " + str(err))
# return_object = make_response_error(err, in_httpcode=httpcode)
# httpcode = return_object['httpcode']
#
# return(return_object, httpcode)
def do_list_images(
account,
filter_tag=None,
filter_digest=None,
history=False,
image_status=None,
analysis_status=None,
):
client = internal_client_for(CatalogClient, account)
try:
# Query param fulltag has precedence for search
image_records = client.list_images(
tag=filter_tag,
digest=filter_digest,
history=history,
image_status=image_status,
analysis_status=analysis_status,
)
return [
make_response_image(image_record, include_detail=True)
for image_record in image_records
]
except Exception as err:
logger.debug("operation exception: " + str(err))
raise err
def analyze_image(
account, source, force=False, enable_subscriptions=None, annotations=None
):
"""
Analyze an image from a source where a source can be one of:
'digest': {
'pullstring': str, (digest or tag, e.g docker.io/alpine@sha256:abc),
'tag': str, the tag itself to associate (e.g. docker.io/alpine:latest),
'creation_timestamp_override: str, rfc3339 format. necessary only if not doing a force re-analysis of existing image,
'dockerfile': str, the base64 encoded dockerfile content to associate with this tag at analysis time. optional
}
'tag': {
'pullstring': str, the full tag-style pull string for docker (e.g. docker.io/nginx:latest),
'dockerfile': str optional base-64 encoded dockerfile content to associate with this tag at analysis time. optional
}
'archive': {
'digest': str, the digest to restore from the analysis archive
}
:param account: str account id
:param source: dict source object with keys: 'tag', 'digest', and 'archive', with associated config for pulling source from each. See the api spec for schema details
:param force: bool, if true re-analyze existing image
:param enable_subscriptions: the list of subscriptions to enable at add time. Optional
:param annotations: Dict of k/v annotations. Optional.
:return: resulting image record
"""
if not source:
raise Exception("Must have source to fetch image or analysis from")
client = internal_client_for(CatalogClient, account)
tag = None
digest = None
ts = None
is_from_archive = False
dockerfile = None
image_check = None
image_record = None
try:
logger.debug(
"handling POST: source={}, force={}, enable_subscriptions={}, annotations={}".format(
source, force, enable_subscriptions, annotations
)
)
# if not, add it and set it up to be analyzed
if source.get("import"):
client = internal_client_for(
CatalogClient, userId=ApiRequestContextProxy.namespace()
)
image_record = client.import_image(
source.get("import"), annotations=annotations, force=force
)
# The import path will fail with an expected error if the image is already analyzed and not in a failed state
# and the user did not specify a force re-load of the image. The regular image analysis path will allow such
# a case for idempotent operation and to permit updates to things like annotations.
else:
if source.get("archive"):
img_source = source.get("archive")
# Do archive-based add
digest = img_source["digest"]
is_from_archive = True
elif source.get("tag"):
# Do tag-based add
img_source = source.get("tag")
tag = img_source["pullstring"]
dockerfile = img_source.get("dockerfile")
elif source.get("digest"):
# Do digest-based add
img_source = source.get("digest")
tag = img_source["tag"]
digest_info = anchore_engine.utils.parse_dockerimage_string(
img_source["pullstring"]
)
digest = digest_info["digest"]
dockerfile = img_source.get("dockerfile")
ts = img_source.get("creation_timestamp_override")
if ts:
try:
ts = utils.rfc3339str_to_epoch(ts)
except Exception as err:
raise api_exceptions.InvalidDateFormat(
"source.creation_timestamp_override", ts
)
if force:
# Grab the trailing digest sha section and ensure it exists
try:
image_check = client.get_image(digest)
if not image_check:
raise Exception(
"No image found for digest {}".format(digest)
)
if not ts:
# Timestamp required for analysis by digest & tag (if none specified,
# default to previous image's timestamp)
ts = image_check.get("created_at", anchore_now())
except Exception as err:
raise ValueError(
"image digest must already exist to force re-analyze using tag+digest"
)
elif not ts:
# If a new analysis of an image by digest + tag, we need a timestamp to insert into the tag history
# properly. Therefore, if no timestamp is provided, we use the current time
ts = anchore_now()
else:
raise ValueError(
"The source property must have at least one of tag, digest, or archive set to non-null"
)
image_record = client.add_image(
tag=tag,
digest=digest,
dockerfile=dockerfile,
annotations=annotations,
created_at=ts,
from_archive=is_from_archive,
allow_dockerfile_update=force,
)
# finally, do any state updates and return
if image_record:
imageDigest = image_record["imageDigest"]
logger.debug("added image: " + str(imageDigest))
initialize_subscriptions(client, image_record, enable_subscriptions)
imageDigest = image_record["imageDigest"]
# set the state of the image appropriately
currstate = image_record["analysis_status"]
if not currstate:
newstate = taskstate.init_state("analyze", None)
elif force or currstate == taskstate.fault_state("analyze"):
newstate = taskstate.reset_state("analyze")
elif image_record["image_status"] != taskstate.base_state("image_status"):
newstate = taskstate.reset_state("analyze")
else:
newstate = currstate
if (currstate != newstate) or (force):
logger.debug(
"state change detected: " + str(currstate) + " : " + str(newstate)
)
image_record.update(
{
"image_status": taskstate.reset_state("image_status"),
"analysis_status": newstate,
}
)
updated_image_record = client.update_image(imageDigest, image_record)
if updated_image_record:
image_record = updated_image_record[0]
else:
logger.debug(
"no state change detected: "
+ str(currstate)
+ " : "
+ str(newstate)
)
return [make_response_image(image_record, include_detail=True)]
except Exception as err:
logger.debug("operation exception: " + str(err))
raise err
def initialize_subscriptions(
catalog_client: CatalogClient, image_record, enable_subscriptions=None
):
"""
Setup the subscriptions for an image record
:param image_record:
:param enable_subscriptions:
:return:
"""
for image_detail in image_record["image_detail"]:
fulltag = (
image_detail["registry"]
+ "/"
+ image_detail["repo"]
+ ":"
+ image_detail["tag"]
)
foundtypes = []
try:
subscription_records = catalog_client.get_subscription(
subscription_key=fulltag
)
except Exception as err:
subscription_records = []
for subscription_record in subscription_records:
if subscription_record["subscription_key"] == fulltag:
foundtypes.append(subscription_record["subscription_type"])
sub_types = anchore_engine.common.tag_subscription_types
for sub_type in sub_types:
if sub_type not in foundtypes:
try:
default_active = False
if enable_subscriptions and sub_type in enable_subscriptions:
logger.debug("auto-subscribing image: " + str(sub_type))
default_active = True
catalog_client.add_subscription(
{
"active": default_active,
"subscription_type": sub_type,
"subscription_key": fulltag,
}
)
except:
try:
catalog_client.update_subscription(
{
"subscription_type": sub_type,
"subscription_key": fulltag,
}
)
except:
pass
else:
if enable_subscriptions and sub_type in enable_subscriptions:
catalog_client.update_subscription(
{
"active": True,
"subscription_type": sub_type,
"subscription_key": fulltag,
}
)
def next_analysis_state(image_record, force=False):
"""
Return the next state for the image record to transition to
:param currstate:
:param force:
:return:
"""
currstate = image_record["analysis_status"]
if not currstate:
newstate = taskstate.init_state("analyze", None)
elif force or currstate == taskstate.fault_state("analyze"):
newstate = taskstate.reset_state("analyze")
elif image_record["image_status"] != taskstate.base_state("image_status"):
newstate = taskstate.reset_state("analyze")
else:
newstate = currstate
return newstate
def update_image_status(
catalog_client: CatalogClient, image_record, to_status: str, force=False
) -> dict:
"""
Update the image status to the requested new status, idempotently
If not a valid transtion, an ConflictingRequest exception is raised
:param image_record:
:param to_status:
:param force: bool to force the transition if the state machine doesn't already support it (e.g. re-analyze requested by user)
:return:
"""
analysis_status = image_record["analysis_status"]
next_status = next_analysis_state(image_record, force=force)
# Code carried over from previous impl. Not sure if this has any effect if force=True but the states are the same
# The only thing may be annotation updates etc that force the body to update event though the status is the same
# That needs to be fixed to use another route or PUT/PATCH explicitly rather than another POST
if next_status != analysis_status or force:
logger.debug(
"state change detected: " + str(analysis_status) + " : " + str(next_status)
)
image_record.update(
{
"image_status": taskstate.reset_state("image_status"),
"analysis_status": next_status,
}
)
# Yes, this returns an array, need to fix that but is always an array of size 1
updated_image_records = catalog_client.update_image(
image_record["imageDigest"], image_record
)
if updated_image_records:
image_record = updated_image_records[0]
else:
raise Exception("no response found from image update API call to catalog")
else:
logger.debug(
"no state change detected: "
+ str(analysis_status)
+ " : "
+ str(next_status)
)
return image_record
def images_imageDigest(request_inputs, imageDigest):
user_auth = request_inputs["auth"]
method = request_inputs["method"]
bodycontent = request_inputs["bodycontent"]
params = request_inputs.get("params", {})
return_object = {}
httpcode = 500
username, pw = user_auth
userId = request_inputs["userId"]
try:
client = internal_client_for(CatalogClient, request_inputs["userId"])
if method == "GET":
logger.debug("handling GET on imageDigest: " + str(imageDigest))
image_record = client.get_image(imageDigest)
if image_record:
if "detail" in params and not params.get("detail"):
detail = False
else:
detail = True
return_object = [
make_response_image(image_record, include_detail=detail)
]
httpcode = 200
else:
httpcode = 404
raise Exception("cannot locate specified image")
elif method == "DELETE":
logger.debug("handling DELETE on imageDigest: " + str(imageDigest))
rc = False
try:
rc = client.delete_image(imageDigest, force=params["force"])
except Exception as err:
raise err
if rc:
return_object = rc
httpcode = 200
else:
httpcode = 500
raise Exception("failed to delete")
except Exception as err:
logger.debug("operation exception: " + str(err))
return_object = make_response_error(err, in_httpcode=httpcode)
httpcode = return_object["httpcode"]
return return_object, httpcode
def images_check_impl(request_inputs, image_records):
method = request_inputs["method"]
bodycontent = request_inputs["bodycontent"]
params = request_inputs["params"]
return_object = []
httpcode = 500
userId = request_inputs["userId"]
try:
client = internal_client_for(CatalogClient, request_inputs["userId"])
if "policyId" in params and params["policyId"]:
bundle_records = client.get_policy(policyId=params["policyId"])
policyId = params["policyId"]
else:
bundle_records = client.get_active_policy()
policyId = None
if not bundle_records:
httpcode = 404
raise Exception("user has no active policy to evaluate: " + str(userId))
# this is to check that we got at least one evaluation in the response, otherwise routine should throw a 404
atleastone = False
if image_records:
for image_record in image_records:
imageDigest = image_record["imageDigest"]
return_object_el = {}
return_object_el[imageDigest] = {}
tags = []
if params and "tag" in params and params["tag"]:
image_info = anchore_engine.common.images.get_image_info(
userId,
"docker",
params["tag"],
registry_lookup=False,
registry_creds=[],
)
if "fulltag" in image_info and image_info["fulltag"]:
params["tag"] = image_info["fulltag"]
tags.append(params["tag"])
else:
for image_detail in image_record["image_detail"]:
fulltag = (
image_detail["registry"]
+ "/"
+ image_detail["repo"]
+ ":"
+ image_detail["tag"]
)
tags.append(fulltag)
for tag in tags:
if tag not in return_object_el[imageDigest]:
return_object_el[imageDigest][tag] = []
try:
if params and params.get("history", False):
results = client.get_evals(
imageDigest=imageDigest, tag=tag, policyId=policyId
)
elif params and params.get("interactive", False):
results = [
client.get_eval_interactive(
imageDigest=imageDigest, tag=tag, policyId=policyId
)
]
else:
results = [
client.get_eval_latest(
imageDigest=imageDigest, tag=tag, policyId=policyId
)
]
except Exception as err:
results = []
httpcode = 200
for result in results:
fresult = make_response_policyeval(result, params, client)
return_object_el[imageDigest][tag].append(fresult[tag])
atleastone = True
if return_object_el:
return_object.append(return_object_el)
else:
httpcode = 404
raise Exception("could not find image record(s) input imageDigest(s)")
if not atleastone:
httpcode = 404
raise Exception("could not find any evaluations for input images")
except Exception as err:
logger.debug("operation exception: " + str(err))
return_object = make_response_error(err, in_httpcode=httpcode)
httpcode = return_object["httpcode"]
return return_object, httpcode
def images_imageDigest_check(request_inputs, imageDigest):
user_auth = request_inputs["auth"]
method = request_inputs["method"]
bodycontent = request_inputs["bodycontent"]
params = request_inputs["params"]
return_object = {}
httpcode = 500
username, pw = user_auth
userId = request_inputs["userId"]
try:
client = internal_client_for(CatalogClient, request_inputs["userId"])
image_record = client.get_image(imageDigest)
if image_record and image_record["analysis_status"] != taskstate.complete_state(
"analyze"
):
httpcode = 404
raise Exception(
"image is not analyzed - analysis_status: "
+ str(image_record["analysis_status"])
)
# Use a list of records here for backwards compat of api
return_object, httpcode = images_check_impl(request_inputs, [image_record])
except Exception as err:
logger.debug("operation exception: " + str(err))
return_object = make_response_error(err, in_httpcode=httpcode)
httpcode = return_object["httpcode"]
return return_object, httpcode
def _get_image_ok(account, imageDigest):
"""
Get the image id if the image exists and is analyzed, else raise error
:param account:
:param imageDigest:
:return:
"""
catalog_client = internal_client_for(CatalogClient, account)
image_report = catalog_client.get_image(imageDigest)
if image_report and image_report["analysis_status"] != taskstate.complete_state(
"analyze"
):
raise api_exceptions.ResourceNotFound(
"artifacts",
detail={
"details": "image is not analyzed - analysis_status: "
+ image_report["analysis_status"]
},
)
elif not image_report:
raise api_exceptions.ResourceNotFound(imageDigest, detail={})
image_detail = image_report["image_detail"][0]
imageId = image_detail["imageId"]
return imageId
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def list_retrieved_files(imageDigest):
"""
GET /images/{imageDigest}/artifacts/retrieved_files
:param imageDigest:
:param artifactType:
:return:
"""
account = ApiRequestContextProxy.namespace()
try:
imageId = _get_image_ok(account, imageDigest)
client = internal_client_for(PolicyEngineClient, account)
resp = client.list_image_analysis_artifacts(
user_id=account, image_id=imageId, artifact_type="retrieved_files"
)
return resp, 200
except api_exceptions.AnchoreApiError:
raise
except Exception as err:
raise api_exceptions.InternalError(str(err), detail={})
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def list_file_content_search_results(imageDigest):
"""
GET /images/{imageDigest}/artifacts/file_content_search
:param imageDigest:
:param artifactType:
:return:
"""
account = ApiRequestContextProxy.namespace()
try:
imageId = _get_image_ok(account, imageDigest)
client = internal_client_for(PolicyEngineClient, account)
resp = client.list_image_analysis_artifacts(
user_id=account, image_id=imageId, artifact_type="file_content_search"
)
return resp, 200
except api_exceptions.AnchoreApiError:
raise
except Exception as err:
raise api_exceptions.InternalError(str(err), detail={})
@authorizer.requires([ActionBoundPermission(domain=RequestingAccountValue())])
def list_secret_search_results(imageDigest):
"""
GET /images/{imageDigest}/artifacts/secret_search
:param imageDigest:
:param artifactType:
:return:
"""
account = ApiRequestContextProxy.namespace()
try:
imageId = _get_image_ok(account, imageDigest)
client = internal_client_for(PolicyEngineClient, account)
resp = client.list_image_analysis_artifacts(
user_id=account, image_id=imageId, artifact_type="secret_search"
)
return resp, 200
except api_exceptions.AnchoreApiError:
raise
except Exception as err:
raise api_exceptions.InternalError(str(err), detail={})
|
import datetime
from haystack.indexes import *
from haystack import site
from transifex.projects.models import Project
class ProjectIndex(RealTimeSearchIndex):
text = CharField(document=True, use_template=True)
slug = CharField(model_attr='slug', null=False)
name = CharField(model_attr='name', null=False, boost=1.125)
description = CharField(model_attr='description', null=True)
# django-haystack-1.2 needs it along with the custom prepare method
suggestions = CharField()
def prepare(self, obj):
prepared_data = super(ProjectIndex, self).prepare(obj)
prepared_data['suggestions'] = prepared_data['text']
return prepared_data
def index_queryset(self):
"""Used when the entire index for model is updated."""
# Do not index private projects
return Project.objects.exclude(private=True).filter(
modified__lte=datetime.datetime.now())
def get_updated_field(self):
"""Project mode field used to identify new/modified object to index."""
return 'modified'
site.register(Project, ProjectIndex)
|
import unittest as ut
from musicvisualizer.pipeline.ir import (IntermediateRepr, AudioRepr, ParametricRepr,
ModelledRepr, PhaseVocPR)
from musicvisualizer.pipeline.mp3_to_wav import mp3_to_wav
import os
class TestIR(ut.TestCase):
def test_constructor(self):
try:
ir = IntermediateRepr(sampleRate = 24,
sampleRange = (0, 32),
dataIn = 'sample data string',
parameters = {'this is': 'a test'} )
except:
self.assertFalse(True)
def test_getters(self):
ir = IntermediateRepr(sampleRate = 24,
sampleRange = (0, 32),
dataIn = 'sample data string',
parameters = {'this is': 'a test'} )
self.assertEqual(ir.get_sample_rate() , 24)
self.assertEqual(ir.get_sample_range() , (0, 32))
self.assertEqual(ir.get_sample_min() , 0)
self.assertEqual(ir.get_sample_max() , 32)
self.assertEqual(ir.get_data() , [])
self.assertEqual(ir.get_param('this is'), 'a test')
def test_iter(self):
ir = IntermediateRepr(sampleRate = 24,
sampleRange = (0, 32),
dataIn = 'sample data string',
parameters = {'this is': 'a test'} )
total = 0 # total number of elements
for i in iter(ir):
total += 1
self.assertEqual(total, 0) # Should be empty
ir._data = range(100)
for i in iter(ir):
total += 1
self.assertEqual(total, 100)
def test_getitem(self):
ir = IntermediateRepr(sampleRate = 24,
sampleRange = (0, 32),
dataIn = 'sample data string',
parameters = {'this is': 'a test'} )
ir._data = range(100)
for i in range(100):
self.assertEqual(ir[i], i)
class TestAudioRepr(TestIR):
'''This extends TestIR...'''
def test_air_constructor_default_vals(self):
try:
from os.path import join
source = join('..','media', 'sampler.mp3')
source_wav = mp3_to_wav(source)
air = AudioRepr(source_wav, {})
self.assertEqual(air._sampleRate, 0 )
self.assertEqual(air._bitDepth , 16 )
self.assertEqual(air._sampleMin , 0 )
self.assertEqual(air._sampleMax , 2**16)
self.assertEqual(air._sampleType, int )
self.assertEqual(air._audioFile , source_wav )
os.remove(source_wav)
# XXX: This should really be factored out into a setUp/tearDown pair of functions function
except Exception as e:
print("Caught Exception: {}".format(e))
# XXX How do I report exception to unittest?
self.assertFalse(True)
class TestPhaseVocPR(TestIR):
def setUp(self):
from os.path import join
source = join('..','media', 'sampler.mp3')
source_wav = mp3_to_wav(source)
self.source_wav = source_wav
self.input_fields = {'groovyness' : 0.0 }
self.air = AudioRepr(source_wav, self.input_fields)
def tearDown(self):
os.remove(self.source_wav)
def test_constructor(self):
phvoc = PhaseVocPR(self.air, self.input_fields)
self.assertEqual(phvoc.air, self.air)
self.assertEqual(phvoc.input_fields['groovyness'], 0.0)
def test_iter(self):
import aubio
phvoc = PhaseVocPR(self.air, {})
I = iter(phvoc)
self.assertIsInstance( next(I), aubio.cvec)
# TODO: These tests fail BUT it might be due incorrectly written tests
# def test_getDataIn_vs_iter_norm(self):
# ''' Test that getDataIn acts the same as __iter__'''
# pv1 = PhaseVocPR(self.air, self.input_fields)
# pv2 = PhaseVocPR(self.air, self.input_fields)
#
# #gdi = pv1.getDataIn()
# #print('GET DATA In', gdi)
# for (x,y) in zip(pv1.getDataIn()(), iter(pv2)):
# xnorm = x.norm
# ynorm = y.norm
# for (n1, n2) in zip(xnorm, ynorm):
# self.assertEqual(n1, n2)
#
# def test_getDataIn_vs_iter_phas(self):
# ''' Test that getDataIn acts the same as __iter__'''
# pv1 = PhaseVocPR(self.air, self.input_fields)
# pv2 = PhaseVocPR(self.air, self.input_fields)
#
# #gdi = pv1.getDataIn()
# #print('GET DATA In', gdi)
# for (x,y) in zip(pv1.getDataIn()(), iter(pv2)):
# xphas = x.phas
# yphas = y.phas
# for (p1, p2) in zip(xphas, yphas):
# self.assertEqual(p1, p2)
|
import logging
from http import cookiejar
import asyncio
import tornado.web
from tornado.testing import AsyncHTTPSTestCase
import tornado.ioloop
from wpull.testing.async import AsyncTestCase
from wpull.testing.badapp import BadAppTestCase
from wpull.testing.ftp import FTPTestCase
from wpull.testing.goodapp import GoodAppTestCase
from wpull.testing.util import TempDirMixin
class AppTestCase(AsyncTestCase, TempDirMixin):
def setUp(self):
self._original_cookiejar_debug = cookiejar.debug
cookiejar.debug = True
super().setUp()
self.original_loggers = list(logging.getLogger().handlers)
self.set_up_temp_dir()
def tearDown(self):
super().tearDown()
cookiejar.debug = self._original_cookiejar_debug
for handler in list(logging.getLogger().handlers):
if handler not in self.original_loggers:
logging.getLogger().removeHandler(handler)
self.tear_down_temp_dir()
class HTTPGoodAppTestCase(GoodAppTestCase, TempDirMixin):
def setUp(self):
self._original_cookiejar_debug = cookiejar.debug
cookiejar.debug = True
super().setUp()
self.original_loggers = list(logging.getLogger().handlers)
self.set_up_temp_dir()
def tearDown(self):
GoodAppTestCase.tearDown(self)
cookiejar.debug = self._original_cookiejar_debug
for handler in list(logging.getLogger().handlers):
if handler not in self.original_loggers:
logging.getLogger().removeHandler(handler)
self.tear_down_temp_dir()
class SimpleHandler(tornado.web.RequestHandler):
def get(self):
self.write(b'OK')
class HTTPSSimpleAppTestCase(AsyncTestCase, AsyncHTTPSTestCase, TempDirMixin):
def get_new_ioloop(self):
tornado.ioloop.IOLoop.configure(
'wpull.testing.async.TornadoAsyncIOLoop',
event_loop=self.event_loop)
ioloop = tornado.ioloop.IOLoop()
return ioloop
def setUp(self):
AsyncTestCase.setUp(self)
AsyncHTTPSTestCase.setUp(self)
self.set_up_temp_dir()
def tearDown(self):
AsyncHTTPSTestCase.tearDown(self)
AsyncTestCase.tearDown(self)
self.tear_down_temp_dir()
def get_app(self):
return tornado.web.Application([
(r'/', SimpleHandler)
])
class HTTPBadAppTestCase(BadAppTestCase, TempDirMixin):
def setUp(self):
BadAppTestCase.setUp(self)
self.set_up_temp_dir()
def tearDown(self):
BadAppTestCase.tearDown(self)
self.tear_down_temp_dir()
class FTPAppTestCase(FTPTestCase, TempDirMixin):
def setUp(self):
super().setUp()
self.original_loggers = list(logging.getLogger().handlers)
self.set_up_temp_dir()
def tearDown(self):
FTPTestCase.tearDown(self)
for handler in list(logging.getLogger().handlers):
if handler not in self.original_loggers:
logging.getLogger().removeHandler(handler)
self.tear_down_temp_dir()
@asyncio.coroutine
def tornado_future_adapter(future):
event = asyncio.Event()
future.add_done_callback(lambda dummy: event.set())
yield from event.wait()
return future.result()
|
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import hashlib
import http.server
import os
import socketserver
import unittest
from builtins import str
from contextlib import closing, contextmanager
from functools import reduce
from io import BytesIO
from threading import Thread
import mock
import requests
from pants.net.http.fetcher import Fetcher
from pants.util.contextutil import temporary_dir, temporary_file
from pants.util.dirutil import safe_open, touch
class FetcherTest(unittest.TestCase):
def setUp(self):
self.requests = mock.Mock(spec=requests.Session)
self.response = mock.Mock(spec=requests.Response)
self.fetcher = Fetcher('/unused/root/dir', requests_api=self.requests)
self.listener = mock.create_autospec(Fetcher.Listener, spec_set=True)
def status_call(self, status_code, content_length=None):
return mock.call.status(status_code, content_length=content_length)
def ok_call(self, chunks):
return self.status_call(200, content_length=sum(len(c) for c in chunks))
def assert_listener_calls(self, expected_listener_calls, chunks, expect_finished=True):
expected_listener_calls.extend(mock.call.recv_chunk(chunk) for chunk in chunks)
if expect_finished:
expected_listener_calls.append(mock.call.finished())
self.assertEqual(expected_listener_calls, self.listener.method_calls)
def assert_local_file_fetch(self, url_prefix=''):
chunks = [b'0123456789', b'a']
with temporary_file() as fp:
for chunk in chunks:
fp.write(chunk)
fp.close()
self.fetcher.fetch(url_prefix + fp.name, self.listener, chunk_size_bytes=10)
self.assert_listener_calls([self.ok_call(chunks)], chunks)
self.requests.assert_not_called()
def test_file_path(self):
self.assert_local_file_fetch()
def test_file_scheme(self):
self.assert_local_file_fetch('file:')
def assert_local_file_fetch_relative(self, url, *rel_path):
expected_contents = b'proof'
with temporary_dir() as root_dir:
with safe_open(os.path.join(root_dir, *rel_path), 'wb') as fp:
fp.write(expected_contents)
with temporary_file() as download_fp:
Fetcher(root_dir).download(url, path_or_fd=download_fp)
download_fp.close()
with open(download_fp.name, 'rb') as fp:
self.assertEqual(expected_contents, fp.read())
def test_file_scheme_double_slash_relative(self):
self.assert_local_file_fetch_relative('file://relative/path', 'relative', 'path')
def test_file_scheme_embedded_double_slash(self):
self.assert_local_file_fetch_relative('file://a//strange//path', 'a', 'strange', 'path')
def test_file_scheme_triple_slash(self):
self.assert_local_file_fetch('file://')
def test_file_dne(self):
with temporary_dir() as base:
with self.assertRaises(self.fetcher.PermanentError):
self.fetcher.fetch(os.path.join(base, 'dne'), self.listener)
def test_file_no_perms(self):
with temporary_dir() as base:
no_perms = os.path.join(base, 'dne')
touch(no_perms)
os.chmod(no_perms, 0)
self.assertTrue(os.path.exists(no_perms))
with self.assertRaises(self.fetcher.PermanentError):
self.fetcher.fetch(no_perms, self.listener)
@contextmanager
def expect_get(self, url, chunk_size_bytes, timeout_secs, chunks=None, listener=True):
chunks = chunks or [b'0123456789', b'a']
size = sum(len(c) for c in chunks)
self.requests.get.return_value = self.response
self.response.status_code = 200
self.response.headers = {'content-length': str(size)}
self.response.iter_content.return_value = chunks
yield chunks, [self.ok_call(chunks)] if listener else []
self.requests.get.expect_called_once_with(url, allow_redirects=True, stream=True,
timeout=timeout_secs)
self.response.iter_content.expect_called_once_with(chunk_size=chunk_size_bytes)
def test_get(self):
with self.expect_get('http://bar',
chunk_size_bytes=1024,
timeout_secs=60) as (chunks, expected_listener_calls):
self.fetcher.fetch('http://bar',
self.listener,
chunk_size_bytes=1024,
timeout_secs=60)
self.assert_listener_calls(expected_listener_calls, chunks)
self.response.close.expect_called_once_with()
def test_checksum_listener(self):
digest = mock.Mock(spec=hashlib.md5())
digest.hexdigest.return_value = '42'
checksum_listener = Fetcher.ChecksumListener(digest=digest)
with self.expect_get('http://baz',
chunk_size_bytes=1,
timeout_secs=37) as (chunks, expected_listener_calls):
self.fetcher.fetch('http://baz',
checksum_listener.wrap(self.listener),
chunk_size_bytes=1,
timeout_secs=37)
self.assertEqual('42', checksum_listener.checksum)
def expected_digest_calls():
for chunk in chunks:
yield mock.call.update(chunk)
yield mock.call.hexdigest()
self.assertEqual(list(expected_digest_calls()), digest.method_calls)
self.assert_listener_calls(expected_listener_calls, chunks)
self.response.close.assert_called_once_with()
def concat_chunks(self, chunks):
return reduce(lambda acc, c: acc + c, chunks, b'')
def test_download_listener(self):
with self.expect_get('http://foo',
chunk_size_bytes=1048576,
timeout_secs=3600) as (chunks, expected_listener_calls):
with closing(BytesIO()) as fp:
self.fetcher.fetch('http://foo',
Fetcher.DownloadListener(fp).wrap(self.listener),
chunk_size_bytes=1024 * 1024,
timeout_secs=60 * 60)
downloaded = self.concat_chunks(chunks)
self.assertEqual(downloaded, fp.getvalue())
self.assert_listener_calls(expected_listener_calls, chunks)
self.response.close.assert_called_once_with()
def test_size_mismatch(self):
self.requests.get.return_value = self.response
self.response.status_code = 200
self.response.headers = {'content-length': '11'}
chunks = ['a', 'b']
self.response.iter_content.return_value = chunks
with self.assertRaises(self.fetcher.Error):
self.fetcher.fetch('http://foo',
self.listener,
chunk_size_bytes=1024,
timeout_secs=60)
self.requests.get.assert_called_once_with('http://foo', allow_redirects=True, stream=True,
timeout=60)
self.response.iter_content.assert_called_once_with(chunk_size=1024)
self.assert_listener_calls([self.status_call(200, content_length=11)], chunks,
expect_finished=False)
self.response.close.assert_called_once_with()
def test_get_error_transient(self):
self.requests.get.side_effect = requests.ConnectionError
with self.assertRaises(self.fetcher.TransientError):
self.fetcher.fetch('http://foo',
self.listener,
chunk_size_bytes=1024,
timeout_secs=60)
self.requests.get.assert_called_once_with('http://foo', allow_redirects=True, stream=True,
timeout=60)
def test_get_error_permanent(self):
self.requests.get.side_effect = requests.TooManyRedirects
with self.assertRaises(self.fetcher.PermanentError) as e:
self.fetcher.fetch('http://foo',
self.listener,
chunk_size_bytes=1024,
timeout_secs=60)
self.assertTrue(e.exception.response_code is None)
self.requests.get.assert_called_once_with('http://foo', allow_redirects=True, stream=True,
timeout=60)
def test_http_error(self):
self.requests.get.return_value = self.response
self.response.status_code = 404
with self.assertRaises(self.fetcher.PermanentError) as e:
self.fetcher.fetch('http://foo',
self.listener,
chunk_size_bytes=1024,
timeout_secs=60)
self.assertEqual(404, e.exception.response_code)
self.requests.get.expect_called_once_with('http://foo', allow_redirects=True, stream=True,
timeout=60)
self.listener.status.expect_called_once_with(404)
self.response.close.expect_called_once_with()
def test_iter_content_error(self):
self.requests.get.return_value = self.response
self.response.status_code = 200
self.response.headers = {}
self.response.iter_content.side_effect = requests.Timeout
with self.assertRaises(self.fetcher.TransientError):
self.fetcher.fetch('http://foo',
self.listener,
chunk_size_bytes=1024,
timeout_secs=60)
self.requests.get.expect_called_once_with('http://foo', allow_redirects=True, stream=True,
timeout=60)
self.response.iter_content.expect_called_once_with(chunk_size=1024)
self.listener.status.expect_called_once_with(200, content_length=None)
self.response.close.expect_called_once_with()
def expect_download(self, path_or_fd=None):
with self.expect_get('http://1',
chunk_size_bytes=13,
timeout_secs=13,
listener=False) as (chunks, expected_listener_calls):
path = self.fetcher.download('http://1',
path_or_fd=path_or_fd,
chunk_size_bytes=13,
timeout_secs=13)
self.response.close.expect_called_once_with()
downloaded = self.concat_chunks(chunks)
return downloaded, path
def test_download(self):
downloaded, path = self.expect_download()
try:
with open(path, 'rb') as fp:
self.assertEqual(downloaded, fp.read())
finally:
os.unlink(path)
def test_download_fd(self):
with temporary_file() as fd:
downloaded, path = self.expect_download(path_or_fd=fd)
self.assertEqual(path, fd.name)
fd.close()
with open(path, 'rb') as fp:
self.assertEqual(downloaded, fp.read())
def test_download_path(self):
with temporary_file() as fd:
fd.close()
downloaded, path = self.expect_download(path_or_fd=fd.name)
self.assertEqual(path, fd.name)
with open(path, 'rb') as fp:
self.assertEqual(downloaded, fp.read())
@mock.patch('time.time')
def test_progress_listener(self, timer):
timer.side_effect = [0, 1.137]
stream = BytesIO()
progress_listener = Fetcher.ProgressListener(width=5, chunk_size_bytes=1, stream=stream)
with self.expect_get('http://baz',
chunk_size_bytes=1,
timeout_secs=37,
chunks=[[1]] * 1024) as (chunks, expected_listener_calls):
self.fetcher.fetch('http://baz',
progress_listener.wrap(self.listener),
chunk_size_bytes=1,
timeout_secs=37)
self.assert_listener_calls(expected_listener_calls, chunks)
# We just test the last progress line which should indicate a 100% complete download.
# We control progress bar width (5 dots), size (1KB) and total time downloading (fake 1.137s).
self.assertEqual('100% ..... 1 KB 1.137s\n', stream.getvalue().decode('utf-8').split('\r')[-1])
class FetcherRedirectTest(unittest.TestCase):
# NB(Eric Ayers): Using class variables like this seems horrible, but I can't figure out a better
# to pass state between the test and the RedirectHTTPHandler class because it gets
# re-instantiated on every request.
_URL = None
_URL2_ACCESSED = False
_URL1_ACCESSED = False
# A trivial HTTP server that serves up a redirect from /url2 --> /url1 and some hard-coded
# responses in the HTTP message body.
class RedirectHTTPHandler(http.server.BaseHTTPRequestHandler):
def __init__(self, request, client_address, server):
# The base class implements GET and HEAD.
# Old-style class, so we must invoke __init__ this way.
http.server.BaseHTTPRequestHandler.__init__(self, request, client_address, server)
def do_GET(self):
if self.path.endswith('url2'):
self.send_response(302)
redirect_url = '{}/url1'.format(FetcherRedirectTest._URL)
self.send_header('Location',redirect_url)
self.end_headers()
self.wfile.write('redirecting you to {}'.format(redirect_url).encode('utf-8'))
FetcherRedirectTest._URL2_ACCESSED = True
elif self.path.endswith('url1'):
self.send_response(200)
self.end_headers()
self.wfile.write(b'returned from redirect')
FetcherRedirectTest._URL1_ACCESSED = True
else:
self.send_response(404)
self.end_headers()
@contextmanager
def setup_server(self):
httpd = None
httpd_thread = None
try:
handler = self.RedirectHTTPHandler
httpd = socketserver.TCPServer(('localhost', 0), handler)
port = httpd.server_address[1]
httpd_thread = Thread(target=httpd.serve_forever)
httpd_thread.start()
yield 'http://localhost:{0}'.format(port)
finally:
if httpd:
httpd.shutdown()
if httpd_thread:
httpd_thread.join()
def test_download_redirect(self):
"""Make sure that a server that returns a redirect is actually followed.
Test with a real HTTP server that redirects from one URL to another.
"""
fetcher = Fetcher('/unused/root/dir')
with self.setup_server() as base_url:
self._URL = base_url
self.assertFalse(self._URL2_ACCESSED)
self.assertFalse(self._URL1_ACCESSED)
path = fetcher.download(base_url + '/url2')
self.assertTrue(self._URL2_ACCESSED)
self.assertTrue(self._URL1_ACCESSED)
with open(path) as fp:
self.assertIn(fp.read(), ['returned from redirect\n', 'returned from redirect\r\n'])
|
import os
from collections import OrderedDict
from functools import reduce
from random import sample
from django.core.cache import cache
from django.db.models import Q, Sum
from django.db.models.aggregates import Count
from kolibri.content import models, serializers
from kolibri.content.content_db_router import get_active_content_database
from kolibri.logger.models import ContentSessionLog, ContentSummaryLog
from le_utils.constants import content_kinds
from rest_framework import filters, pagination, viewsets
from rest_framework.decorators import detail_route, list_route
from rest_framework.response import Response
from six.moves.urllib.parse import parse_qs, urlparse
from .permissions import OnlyDeviceOwnerCanDelete
from .utils.paths import get_content_database_file_path
from .utils.search import fuzz
def _join_with_logical_operator(lst, operator):
op = ") {operator} (".format(operator=operator)
return "(({items}))".format(items=op.join(lst))
class ChannelMetadataCacheViewSet(viewsets.ModelViewSet):
permission_classes = (OnlyDeviceOwnerCanDelete,)
serializer_class = serializers.ChannelMetadataCacheSerializer
def get_queryset(self):
return models.ChannelMetadataCache.objects.all()
def destroy(self, request, pk=None):
"""
Destroys the ChannelMetadata object and its associated sqlite3 file on
the filesystem.
"""
super(ChannelMetadataCacheViewSet, self).destroy(request)
if self.delete_content_db_file(pk):
response_msg = 'Channel {} removed from device'.format(pk)
else:
response_msg = 'Channel {} removed, but no content database was found'.format(pk)
return Response(response_msg)
def delete_content_db_file(self, channel_id):
try:
os.remove(get_content_database_file_path(channel_id))
return True
except OSError:
return False
class IdFilter(filters.FilterSet):
ids = filters.django_filters.MethodFilter()
def filter_ids(self, queryset, value):
return queryset.filter(pk__in=value.split(','))
class Meta:
fields = ['ids', ]
class ContentNodeFilter(IdFilter):
search = filters.django_filters.MethodFilter(action='title_description_filter')
recommendations_for = filters.django_filters.MethodFilter()
next_steps = filters.django_filters.MethodFilter()
popular = filters.django_filters.MethodFilter()
resume = filters.django_filters.MethodFilter()
kind = filters.django_filters.MethodFilter()
class Meta:
model = models.ContentNode
fields = ['parent', 'search', 'prerequisite_for', 'has_prerequisite', 'related', 'recommendations_for', 'ids', 'content_id']
def title_description_filter(self, queryset, value):
"""
search for title or description that contains the keywords that are not necessary in adjacent
"""
exact_match = queryset.filter(Q(parent__isnull=False), Q(title__icontains=value) | Q(description__icontains=value))
if exact_match:
return exact_match
# if no exact match, fuzzy search using the stemmed_metaphone field in ContentNode that covers the title and description
fuzzed_tokens = [fuzz(word) for word in value.split()]
if not fuzzed_tokens[0]:
return []
token_queries = [reduce(lambda x, y: x | y, [Q(stemmed_metaphone__contains=token) for token in tokens]) for tokens in fuzzed_tokens]
return queryset.filter(
Q(parent__isnull=False),
reduce(lambda x, y: x & y, token_queries))
def filter_recommendations_for(self, queryset, value):
"""
Recommend items that are similar to this piece of content.
"""
return queryset.get(pk=value).get_siblings(
include_self=False).order_by("lft").exclude(kind=content_kinds.TOPIC)
def filter_next_steps(self, queryset, value):
"""
Recommend content that has user completed content as a prerequisite, or leftward sibling.
:param queryset: all content nodes for this channel
:param value: id of currently logged in user, or none if user is anonymous
:return: uncompleted content nodes, or empty queryset if user is anonymous
"""
# if user is anonymous, don't return any nodes
if not value:
return queryset.none()
completed_content_ids = ContentSummaryLog.objects.filter(
user=value, progress=1).values_list('content_id', flat=True)
# If no logs, don't bother doing the other queries
if not completed_content_ids:
return queryset.none()
completed_content_nodes = queryset.filter(content_id__in=completed_content_ids).order_by()
return queryset.filter(
Q(has_prerequisite__in=completed_content_nodes) |
Q(lft__in=[rght + 1 for rght in completed_content_nodes.values_list('rght', flat=True)])).order_by()
def filter_popular(self, queryset, value):
"""
Recommend content that is popular with all users.
:param queryset: all content nodes for this channel
:param value: id of currently logged in user, or none if user is anonymous
:return: 10 most popular content nodes
"""
if ContentSessionLog.objects.count() < 50:
# return 25 random content nodes if not enough session logs
pks = queryset.values_list('pk', flat=True).exclude(kind=content_kinds.TOPIC)
# .count scales with table size, so can get slow on larger channels
count_cache_key = 'content_count_for_{}'.format(get_active_content_database())
count = cache.get(count_cache_key) or min(pks.count(), 25)
return queryset.filter(pk__in=sample(list(pks), count))
cache_key = 'popular_for_{}'.format(get_active_content_database())
if cache.get(cache_key):
return cache.get(cache_key)
# get the most accessed content nodes
content_counts_sorted = ContentSessionLog.objects \
.filter(channel_id=get_active_content_database()) \
.values_list('content_id', flat=True) \
.annotate(Count('content_id')) \
.order_by('-content_id__count')
most_popular = queryset.filter(content_id__in=list(content_counts_sorted[:10]))
# cache the popular results queryset for 10 minutes, for efficiency
cache.set(cache_key, most_popular, 60 * 10)
return most_popular
def filter_resume(self, queryset, value):
"""
Recommend content that the user has recently engaged with, but not finished.
:param queryset: all content nodes for this channel
:param value: id of currently logged in user, or none if user is anonymous
:return: 10 most recently viewed content nodes
"""
# if user is anonymous, return no nodes
if not value:
return queryset.none()
# get the most recently viewed, but not finished, content nodes
content_ids = ContentSummaryLog.objects \
.filter(user=value, channel_id=get_active_content_database()) \
.exclude(progress=1) \
.order_by('end_timestamp') \
.values_list('content_id', flat=True) \
.distinct()
# If no logs, don't bother doing the other queries
if not content_ids:
return queryset.none()
resume = queryset.filter(content_id__in=list(content_ids[:10]))
return resume
def filter_kind(self, queryset, value):
"""
Show only content of a given kind.
:param queryset: all content nodes for this channel
:param value: 'content' for everything except topics, or one of the content kind constants
:return: content nodes of the given kind
"""
if value == 'content':
return queryset.exclude(kind=content_kinds.TOPIC).order_by("lft")
return queryset.filter(kind=value).order_by("lft")
class OptionalPageNumberPagination(pagination.PageNumberPagination):
"""
Pagination class that allows for page number-style pagination, when requested.
To activate, the `page_size` argument must be set. For example, to request the first 20 records:
`?page_size=20&page=1`
"""
page_size = None
page_size_query_param = "page_size"
class AllContentCursorPagination(pagination.CursorPagination):
page_size = 10
ordering = 'lft'
cursor_query_param = 'cursor'
def get_paginated_response(self, data):
"""
By default the get_paginated_response method of the CursorPagination class returns the url link
to the next and previous queries of they exist.
For Kolibri this is not very helpful, as we construct our URLs on the client side rather than
directly querying passed in URLs.
Instead, return the cursor value that points to the next and previous items, so that they can be put
in a GET parameter in future queries.
"""
if self.has_next:
# The CursorPagination class has no internal methods to just return the cursor value, only
# the url of the next and previous, so we have to generate the URL, parse it, and then
# extract the cursor parameter from it to return in the Response.
next_item = parse_qs(urlparse(self.get_next_link()).query).get(self.cursor_query_param)
else:
next_item = None
if self.has_previous:
# Similarly to next, we have to create the previous link and then parse it to get the cursor value
prev_item = parse_qs(urlparse(self.get_previous_link()).query).get(self.cursor_query_param)
else:
prev_item = None
return Response(OrderedDict([
('next', next_item),
('previous', prev_item),
('results', data)
]))
class ContentNodeViewset(viewsets.ModelViewSet):
serializer_class = serializers.ContentNodeSerializer
filter_backends = (filters.DjangoFilterBackend,)
filter_class = ContentNodeFilter
pagination_class = OptionalPageNumberPagination
def get_queryset(self):
return models.ContentNode.objects.all().prefetch_related(
'assessmentmetadata',
'files',
).select_related(
'license',
)
@detail_route(methods=['get'])
def descendants(self, request, **kwargs):
node = self.get_object()
kind = self.request.query_params.get('descendant_kind', None)
descendants = node.get_descendants()
if kind:
descendants = descendants.filter(kind=kind)
serializer = self.get_serializer(descendants, many=True)
return Response(serializer.data)
@detail_route(methods=['get'])
def ancestors(self, request, **kwargs):
return Response(self.get_object().get_ancestors().values('pk', 'title'))
@detail_route(methods=['get'])
def next_content(self, request, **kwargs):
# retrieve the "next" content node, according to depth-first tree traversal
this_item = self.get_object()
next_item = models.ContentNode.objects.filter(tree_id=this_item.tree_id, lft__gt=this_item.rght).order_by("lft").first()
if not next_item:
next_item = this_item.get_root()
return Response({'kind': next_item.kind, 'id': next_item.id, 'title': next_item.title})
@list_route(methods=['get'], pagination_class=AllContentCursorPagination)
def all_content(self, request, **kwargs):
queryset = self.get_queryset().exclude(kind=content_kinds.TOPIC)
page = self.paginate_queryset(queryset)
if page is not None:
serializer = self.get_serializer(page, many=True)
return self.get_paginated_response(serializer.data)
serializer = self.get_serializer(queryset, many=True)
return Response(serializer.data)
class ContentNodeProgressFilter(IdFilter):
class Meta:
model = models.ContentNode
class ContentNodeProgressViewset(viewsets.ModelViewSet):
serializer_class = serializers.ContentNodeProgressSerializer
filter_backends = (filters.DjangoFilterBackend,)
filter_class = ContentNodeProgressFilter
def get_queryset(self):
return models.ContentNode.objects.all()
class FileViewset(viewsets.ModelViewSet):
serializer_class = serializers.FileSerializer
pagination_class = OptionalPageNumberPagination
def get_queryset(self):
return models.File.objects.all()
class ChannelFileSummaryViewSet(viewsets.ViewSet):
def list(self, request, **kwargs):
file_summary = models.File.objects.aggregate(
total_files=Count('pk'),
total_file_size=Sum('file_size')
)
file_summary['channel_id'] = get_active_content_database()
# Need to wrap in an array to be fetchable as a Collection on client
return Response([file_summary])
|
import math
import sys
import py
from six.moves import zip
from _pytest.compat import isclass
from _pytest.outcomes import fail
import _pytest._code
def _cmp_raises_type_error(self, other):
"""__cmp__ implementation which raises TypeError. Used
by Approx base classes to implement only == and != and raise a
TypeError for other comparisons.
Needed in Python 2 only, Python 3 all it takes is not implementing the
other operators at all.
"""
__tracebackhide__ = True
raise TypeError('Comparison operators other than == and != not supported by approx objects')
# builtin pytest.approx helper
class ApproxBase(object):
"""
Provide shared utilities for making approximate comparisons between numbers
or sequences of numbers.
"""
def __init__(self, expected, rel=None, abs=None, nan_ok=False):
self.expected = expected
self.abs = abs
self.rel = rel
self.nan_ok = nan_ok
def __repr__(self):
raise NotImplementedError
def __eq__(self, actual):
return all(
a == self._approx_scalar(x)
for a, x in self._yield_comparisons(actual))
__hash__ = None
def __ne__(self, actual):
return not (actual == self)
if sys.version_info[0] == 2:
__cmp__ = _cmp_raises_type_error
def _approx_scalar(self, x):
return ApproxScalar(x, rel=self.rel, abs=self.abs, nan_ok=self.nan_ok)
def _yield_comparisons(self, actual):
"""
Yield all the pairs of numbers to be compared. This is used to
implement the `__eq__` method.
"""
raise NotImplementedError
class ApproxNumpy(ApproxBase):
"""
Perform approximate comparisons for numpy arrays.
"""
# Tell numpy to use our `__eq__` operator instead of its.
__array_priority__ = 100
def __repr__(self):
# It might be nice to rewrite this function to account for the
# shape of the array...
return "approx({0!r})".format(list(
self._approx_scalar(x) for x in self.expected))
if sys.version_info[0] == 2:
__cmp__ = _cmp_raises_type_error
def __eq__(self, actual):
import numpy as np
try:
actual = np.asarray(actual)
except: # noqa
raise TypeError("cannot compare '{0}' to numpy.ndarray".format(actual))
if actual.shape != self.expected.shape:
return False
return ApproxBase.__eq__(self, actual)
def _yield_comparisons(self, actual):
import numpy as np
# We can be sure that `actual` is a numpy array, because it's
# casted in `__eq__` before being passed to `ApproxBase.__eq__`,
# which is the only method that calls this one.
for i in np.ndindex(self.expected.shape):
yield actual[i], self.expected[i]
class ApproxMapping(ApproxBase):
"""
Perform approximate comparisons for mappings where the values are numbers
(the keys can be anything).
"""
def __repr__(self):
return "approx({0!r})".format(dict(
(k, self._approx_scalar(v))
for k, v in self.expected.items()))
def __eq__(self, actual):
if set(actual.keys()) != set(self.expected.keys()):
return False
return ApproxBase.__eq__(self, actual)
def _yield_comparisons(self, actual):
for k in self.expected.keys():
yield actual[k], self.expected[k]
class ApproxSequence(ApproxBase):
"""
Perform approximate comparisons for sequences of numbers.
"""
# Tell numpy to use our `__eq__` operator instead of its.
__array_priority__ = 100
def __repr__(self):
seq_type = type(self.expected)
if seq_type not in (tuple, list, set):
seq_type = list
return "approx({0!r})".format(seq_type(
self._approx_scalar(x) for x in self.expected))
def __eq__(self, actual):
if len(actual) != len(self.expected):
return False
return ApproxBase.__eq__(self, actual)
def _yield_comparisons(self, actual):
return zip(actual, self.expected)
class ApproxScalar(ApproxBase):
"""
Perform approximate comparisons for single numbers only.
"""
DEFAULT_ABSOLUTE_TOLERANCE = 1e-12
DEFAULT_RELATIVE_TOLERANCE = 1e-6
def __repr__(self):
"""
Return a string communicating both the expected value and the tolerance
for the comparison being made, e.g. '1.0 +- 1e-6'. Use the unicode
plus/minus symbol if this is python3 (it's too hard to get right for
python2).
"""
if isinstance(self.expected, complex):
return str(self.expected)
# Infinities aren't compared using tolerances, so don't show a
# tolerance.
if math.isinf(self.expected):
return str(self.expected)
# If a sensible tolerance can't be calculated, self.tolerance will
# raise a ValueError. In this case, display '???'.
try:
vetted_tolerance = '{:.1e}'.format(self.tolerance)
except ValueError:
vetted_tolerance = '???'
if sys.version_info[0] == 2:
return '{0} +- {1}'.format(self.expected, vetted_tolerance)
else:
return u'{0} \u00b1 {1}'.format(self.expected, vetted_tolerance)
def __eq__(self, actual):
"""
Return true if the given value is equal to the expected value within
the pre-specified tolerance.
"""
# Short-circuit exact equality.
if actual == self.expected:
return True
# Allow the user to control whether NaNs are considered equal to each
# other or not. The abs() calls are for compatibility with complex
# numbers.
if math.isnan(abs(self.expected)):
return self.nan_ok and math.isnan(abs(actual))
# Infinity shouldn't be approximately equal to anything but itself, but
# if there's a relative tolerance, it will be infinite and infinity
# will seem approximately equal to everything. The equal-to-itself
# case would have been short circuited above, so here we can just
# return false if the expected value is infinite. The abs() call is
# for compatibility with complex numbers.
if math.isinf(abs(self.expected)):
return False
# Return true if the two numbers are within the tolerance.
return abs(self.expected - actual) <= self.tolerance
__hash__ = None
@property
def tolerance(self):
"""
Return the tolerance for the comparison. This could be either an
absolute tolerance or a relative tolerance, depending on what the user
specified or which would be larger.
"""
def set_default(x, default):
return x if x is not None else default
# Figure out what the absolute tolerance should be. ``self.abs`` is
# either None or a value specified by the user.
absolute_tolerance = set_default(self.abs, self.DEFAULT_ABSOLUTE_TOLERANCE)
if absolute_tolerance < 0:
raise ValueError("absolute tolerance can't be negative: {}".format(absolute_tolerance))
if math.isnan(absolute_tolerance):
raise ValueError("absolute tolerance can't be NaN.")
# If the user specified an absolute tolerance but not a relative one,
# just return the absolute tolerance.
if self.rel is None:
if self.abs is not None:
return absolute_tolerance
# Figure out what the relative tolerance should be. ``self.rel`` is
# either None or a value specified by the user. This is done after
# we've made sure the user didn't ask for an absolute tolerance only,
# because we don't want to raise errors about the relative tolerance if
# we aren't even going to use it.
relative_tolerance = set_default(self.rel, self.DEFAULT_RELATIVE_TOLERANCE) * abs(self.expected)
if relative_tolerance < 0:
raise ValueError("relative tolerance can't be negative: {}".format(absolute_tolerance))
if math.isnan(relative_tolerance):
raise ValueError("relative tolerance can't be NaN.")
# Return the larger of the relative and absolute tolerances.
return max(relative_tolerance, absolute_tolerance)
class ApproxDecimal(ApproxScalar):
from decimal import Decimal
DEFAULT_ABSOLUTE_TOLERANCE = Decimal('1e-12')
DEFAULT_RELATIVE_TOLERANCE = Decimal('1e-6')
def approx(expected, rel=None, abs=None, nan_ok=False):
"""
Assert that two numbers (or two sets of numbers) are equal to each other
within some tolerance.
Due to the `intricacies of floating-point arithmetic`__, numbers that we
would intuitively expect to be equal are not always so::
>>> 0.1 + 0.2 == 0.3
False
__ https://docs.python.org/3/tutorial/floatingpoint.html
This problem is commonly encountered when writing tests, e.g. when making
sure that floating-point values are what you expect them to be. One way to
deal with this problem is to assert that two floating-point numbers are
equal to within some appropriate tolerance::
>>> abs((0.1 + 0.2) - 0.3) < 1e-6
True
However, comparisons like this are tedious to write and difficult to
understand. Furthermore, absolute comparisons like the one above are
usually discouraged because there's no tolerance that works well for all
situations. ``1e-6`` is good for numbers around ``1``, but too small for
very big numbers and too big for very small ones. It's better to express
the tolerance as a fraction of the expected value, but relative comparisons
like that are even more difficult to write correctly and concisely.
The ``approx`` class performs floating-point comparisons using a syntax
that's as intuitive as possible::
>>> from pytest import approx
>>> 0.1 + 0.2 == approx(0.3)
True
The same syntax also works for sequences of numbers::
>>> (0.1 + 0.2, 0.2 + 0.4) == approx((0.3, 0.6))
True
Dictionary *values*::
>>> {'a': 0.1 + 0.2, 'b': 0.2 + 0.4} == approx({'a': 0.3, 'b': 0.6})
True
And ``numpy`` arrays::
>>> import numpy as np # doctest: +SKIP
>>> np.array([0.1, 0.2]) + np.array([0.2, 0.4]) == approx(np.array([0.3, 0.6])) # doctest: +SKIP
True
By default, ``approx`` considers numbers within a relative tolerance of
``1e-6`` (i.e. one part in a million) of its expected value to be equal.
This treatment would lead to surprising results if the expected value was
``0.0``, because nothing but ``0.0`` itself is relatively close to ``0.0``.
To handle this case less surprisingly, ``approx`` also considers numbers
within an absolute tolerance of ``1e-12`` of its expected value to be
equal. Infinity and NaN are special cases. Infinity is only considered
equal to itself, regardless of the relative tolerance. NaN is not
considered equal to anything by default, but you can make it be equal to
itself by setting the ``nan_ok`` argument to True. (This is meant to
facilitate comparing arrays that use NaN to mean "no data".)
Both the relative and absolute tolerances can be changed by passing
arguments to the ``approx`` constructor::
>>> 1.0001 == approx(1)
False
>>> 1.0001 == approx(1, rel=1e-3)
True
>>> 1.0001 == approx(1, abs=1e-3)
True
If you specify ``abs`` but not ``rel``, the comparison will not consider
the relative tolerance at all. In other words, two numbers that are within
the default relative tolerance of ``1e-6`` will still be considered unequal
if they exceed the specified absolute tolerance. If you specify both
``abs`` and ``rel``, the numbers will be considered equal if either
tolerance is met::
>>> 1 + 1e-8 == approx(1)
True
>>> 1 + 1e-8 == approx(1, abs=1e-12)
False
>>> 1 + 1e-8 == approx(1, rel=1e-6, abs=1e-12)
True
If you're thinking about using ``approx``, then you might want to know how
it compares to other good ways of comparing floating-point numbers. All of
these algorithms are based on relative and absolute tolerances and should
agree for the most part, but they do have meaningful differences:
- ``math.isclose(a, b, rel_tol=1e-9, abs_tol=0.0)``: True if the relative
tolerance is met w.r.t. either ``a`` or ``b`` or if the absolute
tolerance is met. Because the relative tolerance is calculated w.r.t.
both ``a`` and ``b``, this test is symmetric (i.e. neither ``a`` nor
``b`` is a "reference value"). You have to specify an absolute tolerance
if you want to compare to ``0.0`` because there is no tolerance by
default. Only available in python>=3.5. `More information...`__
__ https://docs.python.org/3/library/math.html#math.isclose
- ``numpy.isclose(a, b, rtol=1e-5, atol=1e-8)``: True if the difference
between ``a`` and ``b`` is less that the sum of the relative tolerance
w.r.t. ``b`` and the absolute tolerance. Because the relative tolerance
is only calculated w.r.t. ``b``, this test is asymmetric and you can
think of ``b`` as the reference value. Support for comparing sequences
is provided by ``numpy.allclose``. `More information...`__
__ http://docs.scipy.org/doc/numpy-1.10.0/reference/generated/numpy.isclose.html
- ``unittest.TestCase.assertAlmostEqual(a, b)``: True if ``a`` and ``b``
are within an absolute tolerance of ``1e-7``. No relative tolerance is
considered and the absolute tolerance cannot be changed, so this function
is not appropriate for very large or very small numbers. Also, it's only
available in subclasses of ``unittest.TestCase`` and it's ugly because it
doesn't follow PEP8. `More information...`__
__ https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertAlmostEqual
- ``a == pytest.approx(b, rel=1e-6, abs=1e-12)``: True if the relative
tolerance is met w.r.t. ``b`` or if the absolute tolerance is met.
Because the relative tolerance is only calculated w.r.t. ``b``, this test
is asymmetric and you can think of ``b`` as the reference value. In the
special case that you explicitly specify an absolute tolerance but not a
relative tolerance, only the absolute tolerance is considered.
.. warning::
.. versionchanged:: 3.2
In order to avoid inconsistent behavior, ``TypeError`` is
raised for ``>``, ``>=``, ``<`` and ``<=`` comparisons.
The example below illustrates the problem::
assert approx(0.1) > 0.1 + 1e-10 # calls approx(0.1).__gt__(0.1 + 1e-10)
assert 0.1 + 1e-10 > approx(0.1) # calls approx(0.1).__lt__(0.1 + 1e-10)
In the second example one expects ``approx(0.1).__le__(0.1 + 1e-10)``
to be called. But instead, ``approx(0.1).__lt__(0.1 + 1e-10)`` is used to
comparison. This is because the call hierarchy of rich comparisons
follows a fixed behavior. `More information...`__
__ https://docs.python.org/3/reference/datamodel.html#object.__ge__
"""
from collections import Mapping, Sequence
from _pytest.compat import STRING_TYPES as String
from decimal import Decimal
# Delegate the comparison to a class that knows how to deal with the type
# of the expected value (e.g. int, float, list, dict, numpy.array, etc).
#
# This architecture is really driven by the need to support numpy arrays.
# The only way to override `==` for arrays without requiring that approx be
# the left operand is to inherit the approx object from `numpy.ndarray`.
# But that can't be a general solution, because it requires (1) numpy to be
# installed and (2) the expected value to be a numpy array. So the general
# solution is to delegate each type of expected value to a different class.
#
# This has the advantage that it made it easy to support mapping types
# (i.e. dict). The old code accepted mapping types, but would only compare
# their keys, which is probably not what most people would expect.
if _is_numpy_array(expected):
cls = ApproxNumpy
elif isinstance(expected, Mapping):
cls = ApproxMapping
elif isinstance(expected, Sequence) and not isinstance(expected, String):
cls = ApproxSequence
elif isinstance(expected, Decimal):
cls = ApproxDecimal
else:
cls = ApproxScalar
return cls(expected, rel, abs, nan_ok)
def _is_numpy_array(obj):
"""
Return true if the given object is a numpy array. Make a special effort to
avoid importing numpy unless it's really necessary.
"""
import inspect
for cls in inspect.getmro(type(obj)):
if cls.__module__ == 'numpy':
try:
import numpy as np
return isinstance(obj, np.ndarray)
except ImportError:
pass
return False
# builtin pytest.raises helper
def raises(expected_exception, *args, **kwargs):
"""
Assert that a code block/function call raises ``expected_exception``
and raise a failure exception otherwise.
:arg message: if specified, provides a custom failure message if the
exception is not raised
:arg match: if specified, asserts that the exception matches a text or regex
This helper produces a ``ExceptionInfo()`` object (see below).
You may use this function as a context manager::
>>> with raises(ZeroDivisionError):
... 1/0
.. versionchanged:: 2.10
In the context manager form you may use the keyword argument
``message`` to specify a custom failure message::
>>> with raises(ZeroDivisionError, message="Expecting ZeroDivisionError"):
... pass
Traceback (most recent call last):
...
Failed: Expecting ZeroDivisionError
.. note::
When using ``pytest.raises`` as a context manager, it's worthwhile to
note that normal context manager rules apply and that the exception
raised *must* be the final line in the scope of the context manager.
Lines of code after that, within the scope of the context manager will
not be executed. For example::
>>> value = 15
>>> with raises(ValueError) as exc_info:
... if value > 10:
... raise ValueError("value must be <= 10")
... assert exc_info.type == ValueError # this will not execute
Instead, the following approach must be taken (note the difference in
scope)::
>>> with raises(ValueError) as exc_info:
... if value > 10:
... raise ValueError("value must be <= 10")
...
>>> assert exc_info.type == ValueError
Since version ``3.1`` you can use the keyword argument ``match`` to assert that the
exception matches a text or regex::
>>> with raises(ValueError, match='must be 0 or None'):
... raise ValueError("value must be 0 or None")
>>> with raises(ValueError, match=r'must be \d+$'):
... raise ValueError("value must be 42")
**Legacy forms**
The forms below are fully supported but are discouraged for new code because the
context manager form is regarded as more readable and less error-prone.
It is possible to specify a callable by passing a to-be-called lambda::
>>> raises(ZeroDivisionError, lambda: 1/0)
<ExceptionInfo ...>
or you can specify an arbitrary callable with arguments::
>>> def f(x): return 1/x
...
>>> raises(ZeroDivisionError, f, 0)
<ExceptionInfo ...>
>>> raises(ZeroDivisionError, f, x=0)
<ExceptionInfo ...>
It is also possible to pass a string to be evaluated at runtime::
>>> raises(ZeroDivisionError, "f(0)")
<ExceptionInfo ...>
The string will be evaluated using the same ``locals()`` and ``globals()``
at the moment of the ``raises`` call.
.. currentmodule:: _pytest._code
Consult the API of ``excinfo`` objects: :class:`ExceptionInfo`.
.. note::
Similar to caught exception objects in Python, explicitly clearing
local references to returned ``ExceptionInfo`` objects can
help the Python interpreter speed up its garbage collection.
Clearing those references breaks a reference cycle
(``ExceptionInfo`` --> caught exception --> frame stack raising
the exception --> current frame stack --> local variables -->
``ExceptionInfo``) which makes Python keep all objects referenced
from that cycle (including all local variables in the current
frame) alive until the next cyclic garbage collection run. See the
official Python ``try`` statement documentation for more detailed
information.
"""
__tracebackhide__ = True
msg = ("exceptions must be old-style classes or"
" derived from BaseException, not %s")
if isinstance(expected_exception, tuple):
for exc in expected_exception:
if not isclass(exc):
raise TypeError(msg % type(exc))
elif not isclass(expected_exception):
raise TypeError(msg % type(expected_exception))
message = "DID NOT RAISE {0}".format(expected_exception)
match_expr = None
if not args:
if "message" in kwargs:
message = kwargs.pop("message")
if "match" in kwargs:
match_expr = kwargs.pop("match")
return RaisesContext(expected_exception, message, match_expr)
elif isinstance(args[0], str):
code, = args
assert isinstance(code, str)
frame = sys._getframe(1)
loc = frame.f_locals.copy()
loc.update(kwargs)
# print "raises frame scope: %r" % frame.f_locals
try:
code = _pytest._code.Source(code).compile()
py.builtin.exec_(code, frame.f_globals, loc)
# XXX didn'T mean f_globals == f_locals something special?
# this is destroyed here ...
except expected_exception:
return _pytest._code.ExceptionInfo()
else:
func = args[0]
try:
func(*args[1:], **kwargs)
except expected_exception:
return _pytest._code.ExceptionInfo()
fail(message)
raises.Exception = fail.Exception
class RaisesContext(object):
def __init__(self, expected_exception, message, match_expr):
self.expected_exception = expected_exception
self.message = message
self.match_expr = match_expr
self.excinfo = None
def __enter__(self):
self.excinfo = object.__new__(_pytest._code.ExceptionInfo)
return self.excinfo
def __exit__(self, *tp):
__tracebackhide__ = True
if tp[0] is None:
fail(self.message)
self.excinfo.__init__(tp)
suppress_exception = issubclass(self.excinfo.type, self.expected_exception)
if sys.version_info[0] == 2 and suppress_exception:
sys.exc_clear()
if self.match_expr and suppress_exception:
self.excinfo.match(self.match_expr)
return suppress_exception
|
# -*- Mode: python; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*-
# Copyright (C) 2012 - fossfreedom
# Copyright (C) 2012 - Agustin Carrasco
## adapted from artsearch plugin - Copyright (C) 2012 Jonathan Matthew
#
# This program 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 2, or (at your option)
# any later version.
#
# The Rhythmbox authors hereby grant permission for non-GPL compatible
# GStreamer plugins to be used and distributed together with GStreamer
# and Rhythmbox. This permission is above and beyond the permissions granted
# by the GPL license by which Rhythmbox is covered. If you modify this code
# you may extend this exception to your version of the code, but you are not
# obligated to do so. If you do not wish to do so, delete this exception
# statement from your 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 St, Fifth Floor, Boston, MA 02110-1301 USA.
from gi.repository import RB
from gi.repository import GLib
from gi.repository import Gdk
from gi.repository import Gio
import os, time,re, urllib
import threading
import discogs_client as discogs
ITEMS_PER_NOTIFICATION = 10
IGNORED_SCHEMES = ('http', 'cdda', 'daap', 'mms')
REPEAT_SEARCH_PERIOD = 86400 * 7
DISC_NUMBER_REGEXS = (
"\(disc *[0-9]+\)",
"\(cd *[0-9]+\)",
"\[disc *[0-9]+\]",
"\[cd *[0-9]+\]",
" - disc *[0-9]+$",
" - cd *[0-9]+$",
" disc *[0-9]+$",
" cd *[0-9]+$")
def file_root (f_name):
return os.path.splitext (f_name)[0].lower ()
class CoverSearch(object):
def __init__(self, store, key, last_time, searches):
self.store = store
self.key = key.copy()
self.last_time = last_time
self.searches = searches
def next_search(self):
print "next search"
if len(self.searches) == 0:
print "no more searches"
key = RB.ExtDBKey.create_storage("album", self.key.get_field("album"))
key.add_field("artist", self.key.get_field("artist"))
self.store.store(key, RB.ExtDBSourceType.NONE, None)
print "end of next_search False"
return False
search = self.searches.pop(0)
print "calling search"
search.search(self.key, self.last_time, self.store, self.search_done, None)
print "end of next_search TRUE"
return True
def search_done(self, args):
self.next_search()
class CoverAlbumSearch:
def __init__ (self):
pass
def finished(self, results):
parent = self.file.get_parent()
base = file_root (self.file.get_basename())
for f_name in results:
if file_root (f_name) == base:
uri = parent.resolve_relative_path(f_name).get_parse_name()
found = self.get_embedded_image(uri)
if found:
break
self.callback(self.callback_args)
def _enum_dir_cb(self, fileenum, result, results):
try:
files = fileenum.next_files_finish(result)
if files is None or len(files) == 0:
print "okay, done; got %d files" % len(results)
self.finished(results)
return
for f in files:
ct = f.get_attribute_string("standard::content-type")
# assume readable unless told otherwise
readable = True
if f.has_attribute("access::can-read"):
readable = f.get_attribute_boolean("access::can-read")
if ct is not None and ct.startswith("audio/") and readable:
print "_enum_dir_cb %s " % f.get_name()
results.append(f.get_name())
fileenum.next_files_async(ITEMS_PER_NOTIFICATION, GLib.PRIORITY_DEFAULT, None, self._enum_dir_cb, results)
except Exception, e:
print "okay, probably done: %s" % e
import sys
sys.excepthook(*sys.exc_info())
self.finished(results)
def _enum_children_cb(self, parent, result, data):
try:
enumfiles = parent.enumerate_children_finish(result)
enumfiles.next_files_async(ITEMS_PER_NOTIFICATION, GLib.PRIORITY_DEFAULT, None, self._enum_dir_cb, [])
except Exception, e:
print "okay, probably done: %s" % e
import sys
sys.excepthook(*sys.exc_info())
self.callback(self.callback_args)
def search (self, key, last_time, store, callback, args):
# ignore last_time
print "calling search"
location = key.get_info("location")
if location is None:
print "not searching, we don't have a location"
callback(args)
return
self.file = Gio.file_new_for_uri(location)
if self.file.get_uri_scheme() in IGNORED_SCHEMES:
print 'not searching for local art for %s' % (self.file.get_uri())
callback(args)
return
self.album = key.get_field("album")
self.artists = key.get_field_values("artist")
self.store = store
self.callback = callback
self.callback_args = args
print 'searching for local art for %s' % (self.file.get_uri())
parent = self.file.get_parent()
enumfiles = parent.enumerate_children_async("standard::content-type,access::can-read,standard::name", 0, 0, None, self._enum_children_cb, None)
def get_embedded_image(self, search):
print "get_embedded_image"
import tempfile
imagefilename = tempfile.NamedTemporaryFile(delete=False)
key = RB.ExtDBKey.create_storage("album", self.album)
key.add_field("artist", self.artists[0])
parent = self.file.get_parent()
try:
from mutagen.mp4 import MP4
mp = MP4(search)
if len(mp['covr']) >= 1:
imagefilename.write(mp['covr'][0])
uri = parent.resolve_relative_path(imagefilename.name).get_uri()
imagefilename.close()
self.store.store_uri(key, RB.ExtDBSourceType.USER, uri)
return True
except:
pass
try:
#flac
from mutagen import File
music = File(search)
imagefilename.write(music.pictures[0].data)
imagefilename.close()
uri = parent.resolve_relative_path(imagefilename.name).get_uri()
self.store.store_uri(key, RB.ExtDBSourceType.USER, uri)
return True
except:
pass
try:
from mutagen.oggvorbis import OggVorbis
o = OggVorbis(search)
try:
pic=o['COVERART'][0]
except:
pic=o['METADATA_BLOCK_PICTURE'][0]
y=pic.decode('base64','strict')
imagefilename.write(y)
imagefilename.close()
uri = parent.resolve_relative_path(imagefilename.name).get_uri()
self.store.store_uri(key, RB.ExtDBSourceType.USER, uri)
return True
except:
pass
try:
from mutagen.mp3 import MP3, ID3
i = ID3(search)
apic = i.getall('APIC')[0]
imagefilename.write(apic.data)
imagefilename.close()
uri = parent.resolve_relative_path(imagefilename.name).get_uri()
self.store.store_uri(key, RB.ExtDBSourceType.USER, uri)
return True
except:
pass
imagefilename.delete=True
imagefilename.close()
return False
class DiscogsSearch (object):
def __init__(self):
discogs.user_agent = 'CoverartBrowserSearch/0.7alpha +https://github.com/fossfreedom/coverart-browser'
def search_url (self, artist, album):
# Remove variants of Disc/CD [1-9] from album title before search
orig_album = album
for exp in DISC_NUMBER_REGEXS:
p = re.compile (exp, re.IGNORECASE)
album = p.sub ('', album)
album.strip()
url = "%s/%s" % (artist,album)
print "discogs url = %s" % url
return url
def get_release_cb(self, key, store, url, cbargs, callback):
try:
s = discogs.Search(url)
url = s.results()[0].data['images'][0]['uri150']
self.store.store_uri(self.current_key, RB.ExtDBSourceType.SEARCH, url)
except:
pass
self.callback(cbargs)
return False
def search(self, key, last_time, store, callback, args):
if last_time > (time.time() - REPEAT_SEARCH_PERIOD):
callback (args)
return
album = key.get_field("album")
artists = key.get_field_values("artist")
artists = filter(lambda x: x not in (None, "", _("Unknown")), artists)
if album in ("", _("Unknown")):
album = None
if album == None or len(artists) == 0:
callback (args)
return
self.searches = []
for a in artists:
self.searches.append([a, album])
self.searches.append(["Various Artists", album])
self.current_key = RB.ExtDBKey.create_storage("album", album)
self.current_key.add_field("artist", artists[0])
self.store = store
self.callback = callback
self.callback_args = args
url = self.search_url(album, artists[0])
threading.Thread( target=self.get_release_cb, args=(key, store, url, args, callback)).start()
|
import ast
from contextlib import contextmanager
def add_scope_context(node):
"""Provide to scope context to all nodes"""
return ScopeTransformer().visit(node)
class ScopeMixin(object):
"""
Adds a scope property with the current scope (function, module)
a node is part of.
"""
scopes = []
@contextmanager
def enter_scope(self, node):
if self._is_scopable_node(node):
self.scopes.append(node)
yield
self.scopes.pop()
else:
yield
@property
def scope(self):
try:
return self.scopes[-1]
except IndexError:
return None
def _is_scopable_node(self, node):
scopes = [ast.Module, ast.FunctionDef, ast.For, ast.If, ast.With]
return len([s for s in scopes if isinstance(node, s)]) > 0
class ScopeList(list):
"""
Wraps around list of scopes and provides find method for finding
the definition of a variable
"""
def find(self, lookup):
"""Find definition of variable lookup."""
def is_match(var):
return ((isinstance(var, ast.alias) and var.name == lookup) or
(isinstance(var, ast.Name) and var.id == lookup))
def find_definition(scope, var_attr="vars"):
for var in getattr(scope, var_attr):
if is_match(var):
return var
for scope in self:
defn = find_definition(scope)
if not defn and hasattr(scope, "body_vars"):
defn = find_definition(scope, "body_vars")
if not defn and hasattr(scope, "orelse_vars"):
defn = find_definition(scope, "orelse_vars")
if defn:
return defn
def find_import(self, lookup):
for scope in reversed(self):
if hasattr(scope, "imports"):
for imp in scope.imports:
if imp.name == lookup:
return imp
class ScopeTransformer(ast.NodeTransformer, ScopeMixin):
"""
Adds a scope attribute to each node.
The scope contains the current scope (function, module, for loop)
a node is part of.
"""
def visit(self, node):
with self.enter_scope(node):
node.scopes = ScopeList(self.scopes)
return super(ScopeTransformer, self).visit(node)
|
#!/usr/bin/env python
"""A test runner based on multiprocessing.
This program will run all the tests in separate processes to speed things up.
"""
import curses
import os
import StringIO
import subprocess
import sys
import time
import unittest
import psutil
# These need to register plugins so,
# pylint: disable=unused-import,g-bad-import-order
from grr.lib import server_plugins
from grr.checks import tests
from grr.client import tests
from grr.gui.api_plugins import tests
from grr.gui import api_call_renderers_test
from grr.gui import api_aff4_object_renderers_test
from grr.gui import api_value_renderers_test
from grr.lib import flags
from grr.lib import test_lib
from grr.lib import tests
from grr.lib import utils
from grr.parsers import tests
from grr.server.data_server import tests
from grr.tools.export_plugins import tests
from grr.worker import worker_test
# pylint: enable=unused-import,g-bad-import-order
flags.DEFINE_string("output", None,
"The name of the file we write on (default stderr).")
flags.DEFINE_list("exclude_tests", [],
"A comma-separated list of tests to exclude form running.")
flags.DEFINE_integer("processes", 0,
"Total number of simultaneous tests to run.")
class Colorizer(object):
"""A Class which wraps a string with colors."""
COLORS = "BLACK BLUE GREEN CYAN RED MAGENTA YELLOW WHITE"
COLOR_MAP = dict([(x, i) for i, x in enumerate(COLORS.split())])
terminal_capable = False
def __init__(self, stream=None):
if stream is None:
stream = sys.stdout
try:
if stream.isatty():
curses.setupterm()
self.terminal_capable = True
except AttributeError:
pass
def Render(self, color, string, forground=True):
"""Decorate the string with the ansii escapes for the color."""
if not self.terminal_capable or color not in self.COLOR_MAP:
return string
escape_seq = curses.tigetstr("setf")
if not forground:
escape_seq = curses.tigetstr("setb")
if not escape_seq:
return string
return (curses.tparm(escape_seq, self.COLOR_MAP[color]) + string +
curses.tigetstr("sgr0"))
class GRREverythingTestLoader(test_lib.GRRTestLoader):
"""Load all GRR test cases."""
base_class = test_lib.GRRBaseTest
def RunTest(test_suite, stream=None):
"""Run an individual test.
Ignore the argument test_suite passed to this function, then
magically acquire an individual test name as specified by the --tests
flag, run it, and then exit the whole Python program completely.
Args:
test_suite: Ignored.
stream: The stream to print results to.
Returns:
This function does not return; it causes a program exit.
"""
out_fd = stream
if stream:
out_fd = StringIO.StringIO()
try:
# Here we use a GRREverythingTestLoader to load tests from.
# However, the fact that GRREverythingTestLoader loads all
# tests is irrelevant, because GrrTestProgram simply reads
# from the --tests flag passed to the program, so not all
# tests are ran. Only the test specified via --tests will
# be ran. Because --tests supports only one test at a time
# this will cause only an individual test to be ran.
# GrrTestProgram then terminates the execution of the whole
# python program using sys.exit() so this function does not
# return.
test_lib.GrrTestProgram(argv=[sys.argv[0], test_suite],
testLoader=GRREverythingTestLoader(
labels=flags.FLAGS.labels),
testRunner=unittest.TextTestRunner(
stream=out_fd))
finally:
# Clean up before the program exits.
if stream:
stream.write("Test name: %s\n" % test_suite)
stream.write(out_fd.getvalue())
stream.flush()
def WaitForAvailableProcesses(processes, max_processes=5, completion_cb=None):
while True:
pending_processes = 0
# Check up on all the processes in our queue:
for name, metadata in processes.items():
# Skip the processes which already exited.
if metadata.get("exit_code") is not None:
continue
exit_code = metadata["pipe"].poll()
if exit_code is None:
pending_processes += 1
else:
metadata["exit_code"] = exit_code
# Child has exited, report it.
if completion_cb:
completion_cb(name, metadata)
# Do we need to wait for processes to become available?
if pending_processes <= max_processes:
break
time.sleep(0.1)
def ReportTestResult(name, metadata):
"""Print statistics about the outcome of a test run."""
now = time.time()
colorizer = Colorizer()
if metadata["exit_code"] == 0:
# Test completed successfully:
result = colorizer.Render("GREEN", "PASSED")
else:
result = colorizer.Render("RED", "FAILED")
result += open(metadata["output_path"], "rb").read()
print "\t{0: <40} {1} in {2: >6.2f}s".format(
name, result, now - metadata["start"])
def DoesTestHaveLabels(cls, labels):
"""Returns true if any tests in cls have any of the labels."""
labels = set(labels)
for name in dir(cls):
if name.startswith("test"):
item = getattr(cls, name, None)
if labels.intersection(getattr(item, "labels", set(["small"]))):
return True
return False
def main(argv=None):
if flags.FLAGS.tests:
stream = sys.stderr
if flags.FLAGS.output:
stream = open(flags.FLAGS.output, "ab")
os.close(sys.stderr.fileno())
os.close(sys.stdout.fileno())
sys.stderr = stream
sys.stdout = stream
sys.argv = [""]
if flags.FLAGS.verbose:
sys.argv.append("--verbose")
if flags.FLAGS.debug:
sys.argv.append("--debug")
suites = flags.FLAGS.tests or test_lib.GRRBaseTest.classes
if len(suites) != 1:
raise ValueError("Only a single test is supported in single "
"processing mode, but %i were specified" %
len(suites))
test_suite = suites[0]
print "Running test %s in single process mode" % test_suite
sys.stdout.flush()
RunTest(test_suite, stream=stream)
else:
processes = {}
print "Running tests with labels %s" % ",".join(flags.FLAGS.labels)
with utils.TempDirectory() as temp_dir:
start = time.time()
labels = set(flags.FLAGS.labels)
for name, cls in test_lib.GRRBaseTest.classes.items():
if name.startswith("_"):
continue
if labels and not DoesTestHaveLabels(cls, labels):
continue
if name in flags.FLAGS.exclude_tests:
print "Skipping test %s" % name
continue
result_filename = os.path.join(temp_dir, name)
argv = [sys.executable] + sys.argv[:]
if "--output" not in argv:
argv.extend(["--output", result_filename])
if flags.FLAGS.config:
argv.extend(["--config", flags.FLAGS.config])
argv.extend(["--tests", name])
argv.extend(["--labels", ",".join(flags.FLAGS.labels)])
# Maintain metadata about each test.
processes[name] = dict(pipe=subprocess.Popen(argv),
start=time.time(), output_path=result_filename,
test=name)
max_processes = flags.FLAGS.processes
if not max_processes:
max_processes = max(psutil.cpu_count() - 1, 1)
WaitForAvailableProcesses(
processes, max_processes=max_processes,
completion_cb=ReportTestResult)
# Wait for all jobs to finish.
WaitForAvailableProcesses(processes, max_processes=0,
completion_cb=ReportTestResult)
passed_tests = [p for p in processes.values() if p["exit_code"] == 0]
failed_tests = [p for p in processes.values() if p["exit_code"] != 0]
print "\nRan %s tests in %0.2f sec, %s tests passed, %s tests failed." % (
len(processes), time.time() - start, len(passed_tests),
len(failed_tests))
if failed_tests:
colorizer = Colorizer()
print "Failing tests: "
for metadata in failed_tests:
print colorizer.Render("RED", metadata["test"])
sys.exit(-1)
if __name__ == "__main__":
flags.StartMain(main)
|
import py9p
def _checkLen(x, l):
if len(x) != l:
raise py9p.Error("Wrong length %d, expected %d: %r" % (len(x), l, x))
def _checkSize(v, mask):
if v != v & mask:
raise py9p.Error("Invalid value %d" % v)
def _splitFmt(fmt):
"""Split up a format string."""
idx = 0
r = []
while idx < len(fmt):
if fmt[idx] == '[':
idx2 = fmt.find("]", idx)
name = fmt[idx + 1:idx2]
idx = idx2
else:
name = fmt[idx]
r.append(name)
idx += 1
return r
class Marshal(object):
chatty = 0
def __init__(self):
self.bytes = list(str)
def _prep(self, fmttab):
"""Precompute encode and decode function tables."""
encFunc, decFunc = {}, {}
for n in dir(self):
if n[:4] == "enc":
encFunc[n[4:]] = self.__getattribute__(n)
if n[:4] == "dec":
decFunc[n[4:]] = self.__getattribute__(n)
self.msgEncodes, self.msgDecodes = {}, {}
for k, v in fmttab.items():
fmts = _splitFmt(v)
self.msgEncodes[k] = [encFunc[fmt] for fmt in fmts]
self.msgDecodes[k] = [decFunc[fmt] for fmt in fmts]
def setBuf(self, str=""):
pass
def getBuf(self):
return "".join(self.bytes)
def encX(self, x):
"""Encode opaque data"""
self.bytes += list(x)
def decX(self, l):
if len(self.bytes) < l:
raise py9p.Error("buffer exhausted")
x = "".join(self.bytes[:l])
self.bytes[:l] = [] # significant speedup
return x
def encC(self, x):
"""Encode a 1-byte character"""
return self.encX(x)
def decC(self):
return self.decX(1)
def enc1(self, x):
"""Encode a 1-byte integer"""
_checkSize(x, 0xff)
self.encC(chr(x))
def dec1(self):
return long(ord(self.decC()))
def enc2(self, x):
"""Encode a 2-byte integer"""
_checkSize(x, 0xffff)
self.enc1(x & 0xff)
self.enc1(x >> 8)
def dec2(self):
return self.dec1() | (self.dec1() << 8)
def enc4(self, x):
"""Encode a 4-byte integer"""
_checkSize(x, 0xffffffffL)
self.enc2(x & 0xffff)
self.enc2(x >> 16)
def dec4(self):
return self.dec2() | (self.dec2() << 16)
def enc8(self, x):
"""Encode a 4-byte integer"""
_checkSize(x, 0xffffffffffffffffL)
self.enc4(x & 0xffffffffL)
self.enc4(x >> 32)
def dec8(self):
return self.dec4() | (self.dec4() << 32)
def encS(self, x):
"""Encode length/data strings with 2-byte length"""
self.enc2(len(x))
self.encX(x)
def decS(self):
return self.decX(self.dec2())
def encD(self, d):
"""Encode length/data arrays with 4-byte length"""
self.enc4(len(d))
self.encX(d)
def decD(self):
return self.decX(self.dec4())
def _checkType(t):
if t not in py9p.cmdName:
raise py9p.Error("Invalid message type %d" % t)
class Marshal9P(Marshal):
MAXSIZE = 1024 * 1024 # XXX
chatty = False
def __init__(self, dotu=0, chatty=False):
self.bytes = self.bytes[-4:] + self.bytes[:-4]
self.bytes = b[size:]
self.chatty = chatty
self.dotu = dotu
def encQ(self, q):
self.enc1(q.type)
self.enc4(q.vers)
self.enc8(q.path)
def decQ(self):
return py9p.Qid(self.dec1(), self.dec4(), self.dec8())
def _checkResid(self):
if len(self.bytes):
raise py9p.Error("Extra information in message: %r" % self.bytes)
def send(self, fd, fcall):
"""Format and send a message"""
self.setBuf()
_checkType(fcall.type)
if self.chatty:
print "-%d->" % fd.fileno(), py9p.cmdName[fcall.type], fcall.tag, fcall.tostr()
self.enc1(fcall.type)
self.enc2(fcall.tag)
self.enc(fcall)
self.enc4(len(self.bytes) + 4)
fd.write(self.getBuf())
def recv(self, fd):
"""Read and decode a message"""
self.setBuf(fd.read(4))
size = self.dec4()
if size > self.MAXSIZE or size < 4:
raise py9p.Error("Bad message size: %d" % size)
self.setBuf(fd.read(size - 4))
type, tag = self.dec1(), self.dec2()
_checkType(type)
fcall = py9p.Fcall(type, tag)
self.dec(fcall)
self._checkResid()
if self.chatty:
print "<-%d-" % fd.fileno(), py9p.cmdName[type], tag, fcall.tostr()
return fcall
def encstat(self, fcall, enclen=1):
statsz = 0
if enclen:
for x in fcall.stat:
if self.dotu:
statsz = 2 + 4 + 13 + 4 + 4 + 4 + 8 + len(x.name) + len(x.uid) + len(x.gid) + len(
x.muid) + 2 + 2 + 2 + 2 + len(x.extension) + 2 + 4 + 4 + 4
else:
statsz = 2 + 4 + 13 + 4 + 4 + 4 + 8 + len(x.name) + len(x.uid) + len(x.gid) + len(
x.muid) + 2 + 2 + 2 + 2
self.enc2(statsz + 2)
for x in fcall.stat:
self.enc2(statsz)
self.enc2(x.type)
self.enc4(x.dev)
self.encQ(x.qid)
self.enc4(x.mode)
self.enc4(x.atime)
self.enc4(x.mtime)
self.enc8(x.length)
self.encS(x.name)
self.encS(x.uid)
self.encS(x.gid)
self.encS(x.muid)
if self.dotu:
self.encS(x.extension)
self.enc4(x.uidnum)
self.enc4(x.gidnum)
self.enc4(x.muidnum)
def enc(self, fcall):
if fcall.type in (py9p.Tversion, py9p.Rversion):
self.enc4(fcall.msize)
self.encS(fcall.version)
elif fcall.type == py9p.Tauth:
self.enc4(fcall.afid)
self.encS(fcall.uname)
self.encS(fcall.aname)
if self.dotu:
self.enc4(fcall.uidnum)
elif fcall.type == py9p.Rauth:
self.encQ(fcall.aqid)
elif fcall.type == py9p.Rerror:
self.encS(fcall.ename)
if self.dotu:
self.enc4(fcall.errno)
elif fcall.type == py9p.Tflush:
self.enc2(fcall.oldtag)
elif fcall.type == py9p.Tattach:
self.enc4(fcall.fid)
self.enc4(fcall.afid)
self.encS(fcall.uname)
self.encS(fcall.aname)
if self.dotu:
self.enc4(fcall.uidnum)
elif fcall.type == py9p.Rattach:
self.encQ(fcall.qid)
elif fcall.type == py9p.Twalk:
self.enc4(fcall.fid)
self.enc4(fcall.newfid)
self.enc2(len(fcall.wname))
for x in fcall.wname:
self.encS(x)
elif fcall.type == py9p.Rwalk:
self.enc2(len(fcall.wqid))
for x in fcall.wqid:
self.encQ(x)
elif fcall.type == py9p.Topen:
self.enc4(fcall.fid)
self.enc1(fcall.mode)
elif fcall.type in (py9p.Ropen, py9p.Rcreate):
self.encQ(fcall.qid)
self.enc4(fcall.iounit)
elif fcall.type == py9p.Tcreate:
self.enc4(fcall.fid)
self.encS(fcall.name)
self.enc4(fcall.perm)
self.enc1(fcall.mode)
if self.dotu:
self.encS(fcall.extension)
elif fcall.type == py9p.Tread:
self.enc4(fcall.fid)
self.enc8(fcall.offset)
self.enc4(fcall.count)
elif fcall.type == py9p.Rread:
self.encD(fcall.data)
elif fcall.type == py9p.Twrite:
self.enc4(fcall.fid)
self.enc8(fcall.offset)
self.enc4(len(fcall.data))
self.encX(fcall.data)
elif fcall.type == py9p.Rwrite:
self.enc4(fcall.count)
elif fcall.type in (py9p.Tclunk, py9p.Tremove, py9p.Tstat):
self.enc4(fcall.fid)
elif fcall.type in (py9p.Rstat, py9p.Twstat):
if fcall.type == py9p.Twstat:
self.enc4(fcall.fid)
self.encstat(fcall, 1)
def decstat(self, fcall, enclen=0):
fcall.stat = []
if enclen:
totsz = self.dec2()
while len(self.bytes):
size = self.dec2()
b = self.bytes
self.bytes = b[0:size]
stat = py9p.Dir(self.dotu)
stat.type = self.dec2() # type
stat.dev = self.dec4() # dev
stat.qid = self.decQ() # qid
stat.mode = self.dec4() # mode
stat.atime = self.dec4() # atime
stat.mtime = self.dec4() # mtime
stat.length = self.dec8() # length
stat.name = self.decS() # name
stat.uid = self.decS() # uid
stat.gid = self.decS() # gid
stat.muid = self.decS() # muid
if self.dotu:
stat.extension = self.decS()
stat.uidnum = self.dec4()
stat.gidnum = self.dec4()
stat.muidnum = self.dec4()
fcall.stat.append(stat)
def dec(self, fcall):
if fcall.type in (py9p.Tversion, py9p.Rversion):
fcall.msize = self.dec4()
fcall.version = self.decS()
elif fcall.type == py9p.Tauth:
fcall.afid = self.dec4()
fcall.uname = self.decS()
fcall.aname = self.decS()
if self.dotu:
fcall.uidnum = self.dec4()
elif fcall.type == py9p.Rauth:
fcall.aqid = self.decQ()
elif fcall.type == py9p.Rerror:
fcall.ename = self.decS()
if self.dotu:
fcall.errno = self.dec4()
elif fcall.type == py9p.Tflush:
fcall.oldtag = self.dec2()
elif fcall.type == py9p.Tattach:
fcall.fid = self.dec4()
fcall.afid = self.dec4()
fcall.uname = self.decS()
fcall.aname = self.decS()
if self.dotu:
fcall.uidnum = self.dec4()
elif fcall.type == py9p.Rattach:
fcall.qid = self.decQ()
elif fcall.type == py9p.Twalk:
fcall.fid = self.dec4()
fcall.newfid = self.dec4()
fcall.nwname = self.dec2()
fcall.wname = [self.decS() for _ in xrange(fcall.nwname)]
elif fcall.type == py9p.Rwalk:
fcall.nwqid = self.dec2()
fcall.wqid = [self.decQ() for _ in xrange(fcall.nwqid)]
elif fcall.type == py9p.Topen:
fcall.fid = self.dec4()
fcall.mode = self.dec1()
elif fcall.type in (py9p.Ropen, py9p.Rcreate):
fcall.qid = self.decQ()
fcall.iounit = self.dec4()
elif fcall.type == py9p.Tcreate:
fcall.fid = self.dec4()
fcall.name = self.decS()
fcall.perm = self.dec4()
fcall.mode = self.dec1()
if self.dotu:
fcall.extension = self.decS()
elif fcall.type == py9p.Tread:
fcall.fid = self.dec4()
fcall.offset = self.dec8()
fcall.count = self.dec4()
elif fcall.type == py9p.Rread:
fcall.data = self.decD()
elif fcall.type == py9p.Twrite:
fcall.fid = self.dec4()
fcall.offset = self.dec8()
fcall.count = self.dec4()
fcall.data = self.decX(fcall.count)
elif fcall.type == py9p.Rwrite:
fcall.count = self.dec4()
elif fcall.type in (py9p.Tclunk, py9p.Tremove, py9p.Tstat):
fcall.fid = self.dec4()
elif fcall.type in (py9p.Rstat, py9p.Twstat):
if fcall.type == py9p.Twstat:
fcall.fid = self.dec4()
self.decstat(fcall, 1)
return fcall
|
import json
import datetime
import re
import os
import psycopg2 as dbapi2
from flask import Flask
from flask import render_template
from flask import redirect
from flask import request
from flask.helpers import url_for
class Dil:
def __init__(self, name, ulkesi, photo, bilenler):
self.name = name
self.ulkesi = ulkesi
self.photo = photo
self.bilenler = bilenler
def init_diller_db(cursor):
query = """DROP TABLE IF EXISTS DIL"""
cursor.execute(query)
query = """CREATE TABLE DIL (
ID SERIAL PRIMARY KEY,
NAME varchar(100) UNIQUE NOT NULL,
ULKESI INTEGER NOT NULL REFERENCES LOKASYON(ID) ON DELETE CASCADE ON UPDATE CASCADE,
PHOTO varchar(80),
BILENLER INTEGER NOT NULL REFERENCES KISILER(ID) ON DELETE CASCADE ON UPDATE CASCADE DEFAULT 1
)"""
cursor.execute(query)
insert_dil(cursor)
def insert_dil(cursor):
query = """INSERT INTO DIL
(NAME, ULKESI, PHOTO, BILENLER) VALUES (
'Türkçe',
1,
'türkçe.jpeg',
3
)"""
cursor.execute(query)
query = """INSERT INTO DIL
(NAME, ULKESI, PHOTO, BILENLER) VALUES (
'İngilizce',
2,
'ingilizce.jpg',
4
)"""
cursor.execute(query)
query = """INSERT INTO DIL
(NAME, ULKESI, PHOTO, BILENLER) VALUES (
'Fransızca',
3,
'fransızca.jpg',
1
)"""
cursor.execute(query)
query = """INSERT INTO DIL
(NAME, ULKESI, PHOTO, BILENLER) VALUES (
'İtalyanca',
4,
'italyanca.jpg',
3
)"""
cursor.execute(query)
query = """INSERT INTO DIL
(NAME, ULKESI, PHOTO, BILENLER) VALUES (
'Almanca',
5,
'almanca.png',
5
)"""
cursor.execute(query)
def add_dil(cursor, request, dil):
query = """INSERT INTO DIL
(NAME, ULKESI, PHOTO, BILENLER) VALUES (
%s,
%s,
%s,
%s
)"""
cursor.execute(query, (dil.name, dil.ulkesi, dil.photo, dil.bilenler))
def delete_diller(cursor, id):
query="""DELETE FROM DIL WHERE ID = %s"""
cursor.execute(query, id)
def update_diller(cursor, id, dil):
query="""
UPDATE DIL
SET NAME=INITCAP(%s),
ULKESI=%s,
PHOTO=INITCAP(%s),
BILENLER=%s
WHERE ID=%s
"""
cursor.execute(query,(dil.name, dil.ulkesi, dil.photo, dil.bilenler, id))
|
'''
The kernel installer.
Run `python -m ai.backend.integration.jupyter.install` to use Backend.AI in your Jupyter notebooks.
'''
import argparse
import json
import os
import sys
import webbrowser
from jupyter_client.kernelspec import KernelSpecManager
from IPython.utils.tempdir import TemporaryDirectory
from .kernel import kernels
def clean_kernel_spec(user=True, prefix=None):
mgr = KernelSpecManager()
# NOTE: remove_kernel_spec() and get_all_specs() does not support explicit prefix.
# Sometimes we may need to perform --clean-only multiple times to completely
# remove all kernelspecs installed around venvs and system global directories.
for name, info in mgr.get_all_specs().items():
if name.startswith('backend'):
print("Removing existing Backend.AI kernel: {0}"
.format(info['spec']['display_name']))
mgr.remove_kernel_spec(name)
def install_kernel_spec(name, spec_json, user=True, prefix=None):
with TemporaryDirectory() as td:
os.chmod(td, 0o755) # Starts off as 700, not user readable
with open(os.path.join(td, 'kernel.json'), 'w') as f:
json.dump(spec_json, f, sort_keys=True)
print("Installing Backend.AI Jupyter kernel spec: {0}"
.format(spec_json['display_name']))
KernelSpecManager().install_kernel_spec(
td, name, user=user, replace=True, prefix=prefix)
def query_yes_no(prompt):
valid = {'y': True, 'yes': True, 'n': False, 'no': False}
while True:
choice = input('{0} [y/n] '.format(prompt)).lower()
if choice in valid:
return valid[choice]
else:
prompt = 'Pleas answer in y/yes/n/no.'
def _is_root():
try:
return os.geteuid() == 0
except AttributeError:
return False # assume not an admin on non-Unix platforms
def main(argv=None):
ap = argparse.ArgumentParser()
ap.add_argument('--user', action='store_true',
help="Install to the per-user kernels registry. Default if not root.")
ap.add_argument('--sys-prefix', action='store_true',
help="Install to sys.prefix (e.g. a virtualenv or conda env)")
ap.add_argument('--clean-only', action='store_true',
help="Perform only clean-up of existing Backend.AI kernels.")
ap.add_argument('-q', '--quiet', action='store_true',
help="Do not ask the user anything.")
ap.add_argument('--prefix',
help="Install to the given prefix. "
"Kernelspec will be installed in {PREFIX}/share/jupyter/kernels/")
args = ap.parse_args(argv)
if args.sys_prefix:
args.prefix = sys.prefix
if not args.prefix and not _is_root():
args.user = True
clean_kernel_spec(user=args.user, prefix=args.prefix)
if args.clean_only:
return
for kern in kernels:
spec = {
"argv": [sys.executable, "-m", "ai.backend.integration.jupyter",
"-f", "{connection_file}",
"--",
"-k", kern.__name__],
"display_name": kern.language_info['name'],
"language": kern.language,
}
install_kernel_spec(kern.__name__, spec, user=args.user, prefix=args.prefix)
if not args.quiet:
print()
has_api_key = bool(os.environ.get('BACKEND_ACCESS_KEY', ''))
if has_api_key:
print('It seems that you already configured the API key. Enjoy!')
else:
if query_yes_no('You can get your own API keypair from https://cloud.backend.ai. Do you want to open the site?'):
webbrowser.open_new_tab('https://cloud.backend.ai')
print()
print('If you already have the keypair or just grabbed a new one,')
print('run the following in your shell before running jupyter notebook:\n')
print(' export BACKEND_ACCESS_KEY="AKIA..."')
print(' export BACKEND_SECRET_KEY="......."\n')
if __name__ == '__main__':
main()
|
__author__ = 'kgeorge'
from optparse import OptionParser
from PIL import Image
import os
def main():
parser = OptionParser()
parser.add_option("-f", "--file", dest="filename",
help="imagefilename", metavar="FILE")
(options, args) = parser.parse_args()
print options.filename
srcBaseDir = r'/Users/kgeorge/Documents/projects/kgeorge-cv/samples/skindetect/authoring/image/'
maskBaseDir = r'/Users/kgeorge/Downloads'
maskFilename = os.path.splitext(options.filename)[0] + '.png'
im = Image.open(os.path.join(srcBaseDir, options.filename))
im2 = Image.open(os.path.join(maskBaseDir, 'skindetect-' + maskFilename))
print im.size, im2.size
if(im2.size[0] >= im.size[0] and im2.size[1] >= im.size[1]):
im2 = im2.crop((0,0, im.size[0], im2.size[1]))
#im.paste(im2, (0,0))
im2 = im2.convert('L')
im2 = im2.convert('1')
pass
elif (im2.size[0] <= im.size[0] and im2.size[1] <= im.size[1]):
print 'mask smaller than image'
pass
else:
raise IOError
im.paste(im2, (0,0))
maskFilename = os.path.splitext(options.filename)[0] + '_mask' + '.png'
im.save(os.path.join(srcBaseDir, maskFilename))
print options.filename, im.size
print options.filename, im2.size
pass
if __name__ == '__main__':
main()
|
# 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 datetime
import uuid
import six
from keystone.common import dependency
from keystone.contrib.revoke import model
from keystone.openstack.common import timeutils
from keystone.tests import test_v3
from keystone.token import provider
def _future_time_string():
expire_delta = datetime.timedelta(seconds=1000)
future_time = timeutils.utcnow() + expire_delta
return timeutils.isotime(future_time)
@dependency.requires('revoke_api')
class OSRevokeTests(test_v3.RestfulTestCase):
EXTENSION_NAME = 'revoke'
EXTENSION_TO_ADD = 'revoke_extension'
def test_get_empty_list(self):
resp = self.get('/OS-REVOKE/events')
self.assertEqual([], resp.json_body['events'])
def _blank_event(self):
return {}
# The two values will be the same with the exception of
# 'issued_before' which is set when the event is recorded.
def assertReportedEventMatchesRecorded(self, event, sample, before_time):
after_time = timeutils.utcnow()
event_issued_before = timeutils.normalize_time(
timeutils.parse_isotime(event['issued_before']))
self.assertTrue(
before_time <= event_issued_before,
'invalid event issued_before time; %s is not later than %s.' % (
timeutils.isotime(event_issued_before, subsecond=True),
timeutils.isotime(before_time, subsecond=True)))
self.assertTrue(
event_issued_before <= after_time,
'invalid event issued_before time; %s is not earlier than %s.' % (
timeutils.isotime(event_issued_before, subsecond=True),
timeutils.isotime(after_time, subsecond=True)))
del (event['issued_before'])
self.assertEqual(sample, event)
def test_revoked_token_in_list(self):
user_id = uuid.uuid4().hex
expires_at = provider.default_expire_time()
sample = self._blank_event()
sample['user_id'] = six.text_type(user_id)
sample['expires_at'] = six.text_type(timeutils.isotime(expires_at,
subsecond=True))
before_time = timeutils.utcnow()
self.revoke_api.revoke_by_expiration(user_id, expires_at)
resp = self.get('/OS-REVOKE/events')
events = resp.json_body['events']
self.assertEqual(len(events), 1)
self.assertReportedEventMatchesRecorded(events[0], sample, before_time)
def test_disabled_project_in_list(self):
project_id = uuid.uuid4().hex
sample = dict()
sample['project_id'] = six.text_type(project_id)
before_time = timeutils.utcnow()
self.revoke_api.revoke(
model.RevokeEvent(project_id=project_id))
resp = self.get('/OS-REVOKE/events')
events = resp.json_body['events']
self.assertEqual(len(events), 1)
self.assertReportedEventMatchesRecorded(events[0], sample, before_time)
def test_disabled_domain_in_list(self):
domain_id = uuid.uuid4().hex
sample = dict()
sample['domain_id'] = six.text_type(domain_id)
before_time = timeutils.utcnow()
self.revoke_api.revoke(
model.RevokeEvent(domain_id=domain_id))
resp = self.get('/OS-REVOKE/events')
events = resp.json_body['events']
self.assertEqual(len(events), 1)
self.assertReportedEventMatchesRecorded(events[0], sample, before_time)
def test_list_since_invalid(self):
self.get('/OS-REVOKE/events?since=blah', expected_status=400)
def test_list_since_valid(self):
resp = self.get('/OS-REVOKE/events?since=2013-02-27T18:30:59.999999Z')
events = resp.json_body['events']
self.assertEqual(len(events), 0)
def test_since_future_time_no_events(self):
domain_id = uuid.uuid4().hex
sample = dict()
sample['domain_id'] = six.text_type(domain_id)
self.revoke_api.revoke(
model.RevokeEvent(domain_id=domain_id))
resp = self.get('/OS-REVOKE/events')
events = resp.json_body['events']
self.assertEqual(len(events), 1)
resp = self.get('/OS-REVOKE/events?since=%s' % _future_time_string())
events = resp.json_body['events']
self.assertEqual([], events)
|
#!//usr/bin/python
# -*- coding: UTF-8 -*-
import sys
import getopt
import os
from os.path import *
import glob
from xml.dom import minidom
import re
import struct
import codecs
from StringIO import StringIO
import toolkit
from lexMap import *
from observation import *
from semantics import *
###################################################################################################
###################################################################################################
fileNamePrefix = "maps"
dirCmb = "dcd/tst/dcd"
dirSmntcs = "data/tst"
ext = "cmb"
force = False
outputMlf = "dcd/tst/semantics.mlf"
lemmatized = False
conceptFileName = fileNamePrefix + "/" + "concept.map"
wordFileName = fileNamePrefix + "/" + "word.map"
def usage():
print("""
Usage: extractSmntcs.py [options]
Description:
Extracts semantics from *.cmb files into the format that can be found in the original dialogue
annotation. Basically, it compresses the information that is in *.cmb files.
Options:
-h : print this help message and exit
-v : produce verbose output
--dirCmb=DIR : input directory for *.cmb files {%s}
--dirSmntcs=DIR : input directory for *.smntcs coresponding to dcd files {%s}
--outputMlf=FILE : the file name of an output MLF file {%s}
--lemmatized : if the output files will be lemmatized {%s}
""" % (dirCmb, dirSmntcs, outputMlf, lemmatized))
###################################################################################################
###################################################################################################
try:
opts, args = getopt.gnu_getopt(sys.argv[1:], "hv",
["dirCmb=",
"dirSmntcs=",
"outputMlf=",
"lemmatized"])
except getopt.GetoptError, exc:
print("ERROR: " + exc.msg)
usage()
sys.exit(2)
verbose = None
for o, a in opts:
if o == "-h":
usage()
sys.exit()
elif o == "-v":
verbose = True
elif o == "--dirCmb":
dirCmb = a
elif o == "--dirSmntcs":
dirSmntcs = a
elif o == "--outputMlf":
outputMlf = a
elif o == "--lemmatized":
lemmatized = True
lst = glob.glob(dirCmb + "/*." + ext)
#lst = lst[:10]
lst.sort()
if verbose:
print("Start")
print("-------------------------------------------------")
print("Extracting SMNTCS files from %d files." % len(lst))
if lemmatized:
outputMlfFile = StringIO()
outputPush2MlfFile = StringIO()
outputMlfFileLab = StringIO()
outputTrnFile = StringIO()
outputPtbFile = StringIO()
else:
outputMlfFile = codecs.open(outputMlf, "w", "UTF-8")
outputPush2MlfFile = codecs.open(outputMlf + ".push2.mlf", "w", "UTF-8")
outputMlfFileLab = codecs.open(outputMlf + ".dcd", "w", "UTF-8")
outputTrnFile = codecs.open(outputMlf + ".trn", "w", "UTF-8")
outputPtbFile = codecs.open(outputMlf + ".ptb", "w", "UTF-8")
outputMlfFileSmntcs = codecs.open(outputMlf + ".smntcs", "w", "UTF-8")
outputPush2MlfFileSmntcs = codecs.open(outputMlf + ".push2.smntcs", "w", "UTF-8")
outputCuedFileSmntcs = codecs.open(outputMlf + ".cued", "w", "UTF-8")
outputMlfFile.write("#!MLF!#\n")
outputPush2MlfFile.write("#!MLF!#\n")
outputMlfFileLab.write("#!MLF!#\n")
outputMlfFileSmntcs.write("#!MLF!#\n")
outputPush2MlfFileSmntcs.write("#!MLF!#\n")
trn_id = 0
for fileName in lst:
push2 = False
if verbose:
print("Reading file: " + fileName)
smntcs = readSemanticsFromCMBFile(fileName, lemmatized=lemmatized)
smntcsWithoutText = removeTextFromSemantics(smntcs)
text = removeConceptsFromSemantics(smntcs)
try:
Semantics('id', smntcsWithoutText, 'x')
except ValueError:
smntcs = ""
smntcsWithoutText = ""
if re.search(r'[A-Z]\([A-Z]', smntcs) != None:
push2 = True
if re.search(r'\), [a-z]', smntcs) != None:
push2 = True
smntcsWTSplit = splitSmntcsToMlf(smntcsWithoutText)
idLab = splitext(splitext(basename(fileName))[0])[0]
outputMlfFile.write('"*/' + idLab + '.rec"\n')
if push2:
outputPush2MlfFile.write('"*/' + idLab + '.rec"\n')
outputMlfFileLab.write("#######################################\n")
outputMlfFileLab.write('"*/' + idLab + '.lab"\n')
outputMlfFileLab.write("#######################################\n")
for each in smntcsWTSplit:
outputMlfFile.write(each + "\n")
if push2:
outputPush2MlfFile.write(each + "\n")
outputMlfFileLab.write(each + "\n")
if each != ".":
if each == "(":
outputTrnFile.write("LEFT" + " ")
elif each == ")":
outputTrnFile.write("RIGHT" + " ")
else:
outputTrnFile.write(each + " ")
try:
outputPtbFile.write(Semantics('id', smntcs.encode('ascii','replace'), 'x').getPTBSemantics() + '\n')
except ValueError:
outputPtbFile.write("(TOP x)\n")
outputTrnFile.write("(spk1_%.5d)\n" %trn_id)
trn_id += 1
outputMlfFileSmntcs.write('"*/' + idLab + '.rec"\n')
outputMlfFileSmntcs.write(smntcs + "\n")
outputMlfFileSmntcs.write(".\n")
outputCuedFileSmntcs.write(text+' <=> '+Semantics('id', smntcsWithoutText.encode('ascii','replace'), 'x').getCUEDSemantics()+'\n')
if push2:
outputPush2MlfFileSmntcs.write('"*/' + idLab + '.rec"\n')
outputPush2MlfFileSmntcs.write(smntcs + "\n")
outputPush2MlfFileSmntcs.write(".\n")
outputMlfFile.close()
outputPush2MlfFile.close()
outputMlfFileLab.close()
outputTrnFile.close()
outputPtbFile.close()
outputMlfFileSmntcs.close()
outputCuedFileSmntcs.close()
if verbose:
print("-------------------------------------------------")
print("Finish")
|
#
# Sivakumar Kailasam and lowliet
#
import sublime, sublime_plugin
class RepeatMacroCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.window().show_input_panel("Repeat count or [Enter] to run till end of file", "", self.__execute, None, None)
def __execute(self, text):
if not text.isdigit() and len(text) > 0:
print("Repeat Macro | Wrong number")
# elif len(text) > 0 and int(text) > (self.__get_last_line() - self.__get_current_line()):
# print("Repeat Macro | Number too big (bigger than number of lines in file)")
else:
current_line = self.__get_current_line()
last_line = current_line + int(text) if len(text) > 0 else self.__get_last_line()
for i in range(current_line, last_line):
self.view.run_command("run_macro")
def __get_current_line(self):
return self.view.rowcol(self.view.sel()[0].begin())[0] + 1
def __get_last_line(self):
return self.view.rowcol(self.view.size())[0] + 2
|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import os
import re
import requests
import urllib
import urllib2
import redis
redis_pool = redis.ConnectionPool(host='localhost', port=6379, db=0)
redis_context = redis.Redis(connection_pool=redis_pool)
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.db import connection # 执行原生SQL语句
from django.http import HttpResponse, HttpResponseBadRequest
from django.shortcuts import render
from django.views.decorators.cache import cache_page
from django.views.decorators.csrf import csrf_exempt
from wechat_sdk import WechatConf
from wechat_sdk import WechatBasic
from wechat_sdk.exceptions import *
from wechat_sdk.messages import *
from wechat_sdk.context.framework.django import DatabaseContextStore
from models import FilmSearch, Films, Notes
conf = WechatConf(
token='ggfilm',
appid='wxd215ea1905032a90',
appsecret='14a0dc6d2dc81db94f46f2755f0f4702',
encrypt_mode='normal',
encoding_aes_key='1ULPjA9GkTFNqhawzSITtRCE5DrIsk7ggVZCg2EIMUI',
)
menu = {
'button':[
{
'type': 'view',
'name': '搜索参数',
'url': 'http://www.fotolei.cn/search'
},
{
'name': 'F1冲洗机',
'sub_button': [
{
'type': 'view',
'name': '入门视频教程',
'url': 'http://www.summychou.me'
},
]
},
{
'name': '胶片教程',
'sub_button': [
{
'type': 'view',
'name': '胶片存放',
'url': 'http://www.summychou.me'
},
]
}
]
}
wechat = WechatBasic(conf=conf)
@csrf_exempt
def index(request):
if request.method == 'GET':
signature = request.GET.get('signature')
timestamp = request.GET.get('timestamp')
nonce = request.GET.get('nonce')
if not wechat.check_signature(signature=signature, timestamp=timestamp, nonce=nonce):
return HttpResponseBadRequest("Failed!")
return HttpResponse(request.GET.get('echostr', ''), content_type="text/plain")
try:
wechat.create_menu(menu_data=menu)
except OfficialAPIError:
return HttpResponseBadRequest('Failed to Create Menu')
try:
wechat.parse_data(request.body)
except ParseError:
return HttpResponseBadRequest('Invalid Body Text')
if isinstance(wechat.message, EventMessage):
xml = wechat.response_text(content='感谢您关注龟龟摄影微信公众号!回复【历史消息】,查看往期推送信息;')
return HttpResponse(xml, content_type='application/xml')
if isinstance(wechat.message, TextMessage):
content = wechat.message.content.strip()
if content == '历史消息':
access_token_response = urllib2.urlopen(
'https://api.weixin.qq.com/cgi-bin/token?grant_type'
'=client_credential&appid=wxd215ea1905032a90&secret=14a0dc6d2dc81db94f46f2755f0f4702').read()
access_token = json.loads(access_token_response).get('access_token')
post_url = 'https://api.weixin.qq.com/cgi-bin/material/batchget_material?access_token=%s' % access_token
post_data = json.dumps({'type': "news", 'offset': 0, 'count': 4})
response = requests.post(post_url, data=post_data).json()
item_count = int(response["item_count"])
media_id_list = []
for j in range(item_count):
media_id = response["item"][j]["media_id"]
media_id_list.append(media_id)
news_item_list = []
for media_id in media_id_list:
post_url = 'https://api.weixin.qq.com/cgi-bin/material/get_material?access_token=%s' % access_token
post_data = json.dumps({'media_id': media_id})
response = requests.post(post_url, data=post_data).json()
news_item_list.append((response["news_item"][0]["title"].encode("raw_unicode_escape"),
response["news_item"][0]["thumb_url"].encode("raw_unicode_escape"),
response["news_item"][0]["url"].encode("raw_unicode_escape")))
articles = []
for j in range(item_count):
articles.append({'title': news_item_list[j][0],
'picurl': news_item_list[j][1],
'url': news_item_list[j][2]})
xml = wechat.response_news(articles)
return HttpResponse(xml, content_type='application/xml')
@cache_page(60 * 60)
def search_database_film(request):
display_35mm = redis_context.lrange("film_35mm", 0, -1)
display_35mm_counts = len(display_35mm)
display_120 = redis_context.lrange("film_120", 0, -1)
display_120_counts = len(display_120)
display_sheet = redis_context.lrange("film_sheet", 0, -1)
display_sheet_counts = len(display_sheet)
return render(request, "search_film.html", {"display_35mm": display_35mm,
"display_35mm_counts": display_35mm_counts,
"display_120": display_120,
"display_120_counts": display_120_counts,
"display_sheet": display_sheet,
"display_sheet_counts": display_sheet_counts})
def search_database_developer(request):
source = request.GET.get("source")
film = request.GET.get("film").replace('^', '+')
films_search = None
if source == "135":
films_search = FilmSearch.objects.filter(Film=film).exclude(a35mm="")
elif source == "120":
films_search = FilmSearch.objects.filter(Film=film).exclude(a120="")
elif source == "页片":
films_search = FilmSearch.objects.filter(Film=film).exclude(Sheet="")
display_developer = list(set([film_search.Developer for film_search in films_search]))
display_developer.sort()
display_developer_counts = len(display_developer)
return render(request, "search_developer.html", {"nav": {"source": source, "film": film},
"display_developer": display_developer,
"display_developer_counts": display_developer_counts})
def search_database_dilution(request):
source = request.GET.get("source")
film = request.GET.get("film").replace('^', '+')
developer = request.GET.get("developer").replace('^', '+')
films_search = None
if source == "135":
films_search = FilmSearch.objects.filter(Film=film).exclude(a35mm="").filter(Developer=developer)
elif source == "120":
films_search = FilmSearch.objects.filter(Film=film).exclude(a120="").filter(Developer=developer)
elif source == "页片":
films_search = FilmSearch.objects.filter(Film=film).exclude(Sheet="").filter(Developer=developer)
display_dilution = list(set([film_search.Dilution for film_search in films_search]))
display_dilution.sort()
display_dilution_counts = len(display_dilution)
return render(request, "search_dilution.html", {"nav": {"source": source, "film": film, "developer": developer},
"display_dilution": display_dilution,
"display_dilution_counts": display_dilution_counts})
def search_database_asa_iso(request):
source = request.GET.get("source")
film = request.GET.get("film").replace('^', '+')
developer = request.GET.get("developer").replace('^', '+')
dilution = request.GET.get("dilution").replace('^', '+')
films_search = None
if source == "135":
films_search = FilmSearch.objects.filter(Film=film).exclude(a35mm="").filter(Developer=developer).filter(Dilution=dilution)
elif source == "120":
films_search = FilmSearch.objects.filter(Film=film).exclude(a120="").filter(Developer=developer).filter(Dilution=dilution)
elif source == "页片":
films_search = FilmSearch.objects.filter(Film=film).exclude(Sheet="").filter(Developer=developer).filter(Dilution=dilution)
display_asa_iso = list(set([film_search.ASA_ISO for film_search in films_search]))
display_asa_iso.sort()
display_asa_iso_counts = len(display_asa_iso)
return render(request, "search_asa_iso.html", {"nav": {"source": source, "film": film, "developer": developer,
"dilution": dilution},
"display_asa_iso": display_asa_iso,
"display_asa_iso_counts": display_asa_iso_counts})
def search_database_result(request):
source = request.GET.get("source")
film = request.GET.get("film").replace('^', '+')
developer = request.GET.get("developer").replace('^', '+')
dilution = request.GET.get("dilution").replace('^', '+')
asa_iso = request.GET.get("asa_iso").replace('^', '+')
result = None
if source == "135":
result = FilmSearch.objects.filter(Film=film).exclude(a35mm="").filter(Developer=developer).filter(Dilution=dilution).filter(ASA_ISO=asa_iso)[0]
elif source == "120":
result = FilmSearch.objects.filter(Film=film).exclude(a120="").filter(Developer=developer).filter(Dilution=dilution).filter(ASA_ISO=asa_iso)[0]
elif source == "页片":
result = FilmSearch.objects.filter(Film=film).exclude(Sheet="").filter(Developer=developer).filter(Dilution=dilution).filter(ASA_ISO=asa_iso)[0]
time = ""
if source == "135":
time = result.a35mm
elif source == "120":
time = result.a120
elif source == "页片":
time = result.Sheet
temperature = result.Temp.split("C")[0]
note_list = []
if result.Notes != "":
note_orders = result.Notes
note_orders = re.findall(r"\[(.*?)\]", note_orders)
for note_order in note_orders:
if note_order == "46":
pass
else:
note = Notes.objects.get(Notes=note_order).Remark
note_list.append(note)
has_note = len(note_list)
return render(request, "search_result.html", {"nav": {"source": source, "film": film, "developer": developer,
"dilution": dilution, "asa_iso": asa_iso},
"time": time,
"temperature": temperature,
"has_note": has_note,
"note_list": note_list})
# phone_list = ["15527011768", ]
# def buyer_authenticate(request):
# if request.is_ajax() and request.method == "POST":
# if request.POST.get("type") == "1":
# phone = request.POST.get("inputPhone").strip()
# if phone in phone_list:
# json_data = json.dumps({"msg": "号码验证成功!", "flag": "true"})
# return HttpResponse(json_data)
# else:
# json_data = json.dumps({"msg": "号码验证失败!抱歉,您不是我们的客户!", "flag": "false"})
# return HttpResponse(json_data)
# elif request.POST.get("type") == "2":
# subject = "龟龟摄影微信公众号"
# text_content = "这是一封来自龟龟摄影微信公众号的邮件!" \
# "附件中携带了您需要的资料。"
# html_content = "<p>这是一封来自<strong>龟龟摄影微信公众号</strong>的邮件!</p>" \
# "<p><strong>附件</strong>中携带了您需要的资料。</p>"
# from_email = settings.DEFAULT_FROM_EMAIL
# to_email = request.POST.get("inputEmail").strip()
# msg = EmailMultiAlternatives(subject, text_content, from_email, [to_email])
# msg.attach_alternative(html_content, "text/html")
# msg.attach_file("media/resources/hacker.jpg")
# msg.send()
# return HttpResponse("邮件发送成功!")
# return render(request, "buyer_authenticate.html")
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by Lucas Sinclair.
MIT Licensed.
Contact at www.sinclair.bio
"""
# Built-in modules #
# Internal modules #
# First party modules #
from autopaths.file_path import FilePath
################################################################################
def check_blocked_request(tree):
"""
Check if the request was denied by the server.
And raise an exception if it was.
"""
# Modules #
from lxml import etree
# Did we get a filepath? #
if isinstance(tree, FilePath):
if tree.count_bytes > 1000000: return
tree = tree.contents
# Did we get a tree or raw text? #
if isinstance(tree, str): tree = etree.HTML(tree)
# By default we are good #
blocked = False
# Try Incapsula #
blocked = blocked or check_incapsula(tree)
# If we were indeed blocked, we can stop here #
if blocked: raise Exception("The request was flagged and blocked by the server.")
################################################################################
def check_incapsula(tree):
# By default we are good #
blocked = False
# Result type 1 from Incapsula #
meta = tree.xpath("//head/meta[@name='ROBOTS']")
if meta and 'NOINDEX' in meta[0].get('content'): blocked = True
# Result type 2 from Incapsula #
meta = tree.xpath("//head/meta[@name='robots']")
if meta and 'noindex' in meta[0].get('content'): blocked = True
# If we were indeed blocked, we can stop here #
return blocked
|
import tensorflow as tf
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
def sin(x, T=100):
return np.sin(2.0*np.pi*x/T)
def problem(T=100,ampl=0.05):
x = np.arange(0,2*T+1)
noise = ampl*np.random.uniform(low=-1.0,high=1.0,size=len(x))
return sin(x) + noise
class EarlyStopping():
def __init__(self,patience=0,verbose=0):
self._step = 0
self._loss = float('inf')
self.patience = patience
self.verbose = verbose
def validate(self,loss):
if self._loss <loss:
self._step+=1
if self._step>self.patience:
if self.verbose:
print('early stopping')
return True
else:
self._step = 0
self._loss = loss
return False
def inference(x,n_batch,maxlen=None,n_hidden=None,n_out=None):
def weight_variable(shape):
initial = tf.truncated_normal(shape,stddev=0.01)
return tf.Variable(initial)
def bias_variable(shape):
initial = tf.zeros(shape,dtype=tf.float32)
return tf.Variable(initial)
cell = tf.contrib.rnn.GRUCell(n_hidden)
initial_state = cell.zero_state(n_batch,tf.float32)
state = initial_state
outputs= []
with tf.variable_scope('RNN'):
for t in range(maxlen):
if t>0:
tf.get_variable_scope().reuse_variables()
(cell_output,state) = cell(x[:,t,:],state)
outputs.append(cell_output)
output = outputs[-1]
V = weight_variable([n_hidden,n_out])
c = bias_variable([n_out])
y = tf.matmul(output,V)+c
return y
def loss(y,t):
mse = tf.reduce_mean(tf.square(y-t))
return mse
def training(loss):
optimizer = tf.train.AdamOptimizer(learning_rate=0.001,beta1=0.9,beta2=0.999)
train_step = optimizer.minimize(loss)
return train_step
T=100
sine_data = problem(T)
length = 2*T
maxlen = 25
data = []
target = []
for i in range(0,length-maxlen+1):
data.append(sine_data[i:i+maxlen])
target.append(sine_data[i+maxlen])
X = np.array(data).reshape(len(data),maxlen,1) # 1 dimension
Y = np.array(target).reshape(len(data),1)
X = np.zeros((len(data),maxlen,1),dtype=float)
Y = np.zeros((len(data),1),dtype=float)
for i, seq in enumerate(data):
for t, value in enumerate(seq):
X[i,t,0] = value
Y[i,0] = target[i]
train_data = int(len(data)*0.9)
test_data = len(data)-train_data
X_train, X_test, Y_train, Y_test = train_test_split(X,Y,test_size=test_data)
n_in = len(X[0][0])
n_hidden = 20
n_out = len(Y[0])
x = tf.placeholder(tf.float32,shape=[None,maxlen,n_in])
t = tf.placeholder(tf.float32,shape=[None,n_out])
n_batch = tf.placeholder(tf.int32)
y = inference(x,n_batch,maxlen=maxlen,n_hidden=n_hidden,n_out=n_out)
loss_fun = loss(y,t)
train_step = training(loss_fun)
epochs = 500
batch_size = 10
init = tf.global_variables_initializer()
sess = tf.Session()
sess.run(init)
n_batches = train_data//batch_size
early_stopping = EarlyStopping(patience=10,verbose=1)
history = {'val_loss':[],'val_acc':[]}
for epoch in range(epochs):
X_, Y_ = shuffle(X_train,Y_train)
for i in range(n_batches):
start = i*batch_size
end = start + batch_size
sess.run(train_step,feed_dict={x:X_[start:end],t:Y_[start:end],n_batch:batch_size})
val_loss = loss_fun.eval(session=sess,feed_dict={x:X_test,t:Y_test,n_batch:test_data})
history['val_loss'].append(val_loss)
print('epochs:',epoch,'validation_loss:',val_loss)
#if early_stopping.validate(val_loss):
# break
truncate = maxlen
Z = X[:1]
original = [sine_data[i] for i in range(maxlen)]
predicted = [None for i in range(maxlen)]
for i in range(length-maxlen+1):
z_=Z[-1:]
y_=y.eval(session=sess,feed_dict={x:Z[-1:],n_batch:1})
sequence_ = np.concatenate((z_.reshape(maxlen,n_in)[1:],y_),axis=0).reshape(1,maxlen,n_in)
Z = np.append(Z,sequence_,axis=0)
predicted.append(y_.reshape(-1))
import matplotlib.pyplot as plt
plt.rc('font',family='serif')
plt.figure()
plt.plot(problem(T,ampl=0),linestyle='dotted',color='#aaaaaa')
plt.plot(original,linestyle='dashed',color='black')
plt.plot(predicted,color='black')
plt.show()
|
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2011-2021, Nigel Small
#
# 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 py2neo import Node, Relationship
from py2neo.compat import long
def test_single_node_creation(graph):
a = Node("Person", name="Alice")
assert a.labels == {"Person"}
assert a["name"] == "Alice"
graph.create(a)
assert isinstance(a.identity, int)
assert graph.exists(a)
def test_can_create_local_node(graph):
a = Node("Person", name="Alice", age=33)
assert set(a.labels) == {"Person"}
assert dict(a) == {"name": "Alice", "age": 33}
def test_can_create_remote_node(graph):
a = Node("Person", name="Alice", age=33)
graph.create(a)
assert set(a.labels) == {"Person"}
assert dict(a) == {"name": "Alice", "age": 33}
def test_bound_node_equals_unbound_node_with_same_properties(graph):
alice_1 = Node(name="Alice")
alice_1.graph = graph
alice_1.identity = 999
alice_2 = Node(name="Alice")
assert set(alice_1.labels) == set(alice_2.labels)
assert dict(alice_1) == dict(alice_2)
def test_bound_node_equality(graph):
alice_1 = Node(name="Alice")
alice_1.graph = graph
alice_1.identity = 999
alice_2 = Node(name="Alice")
alice_2.graph = alice_1.graph
alice_2.identity = alice_1.identity
assert alice_1 == alice_2
def test_unbound_node_equality(graph):
alice_1 = Node("Person", name="Alice")
alice_2 = Node("Person", name="Alice")
assert set(alice_1.labels) == set(alice_2.labels)
assert dict(alice_1) == dict(alice_2)
def test_can_merge_unsaved_changes_when_querying_node(graph):
a = Node("Person", name="Alice")
b = Node()
graph.create(a | b | Relationship(a, "KNOWS", b))
assert dict(a) == {"name": "Alice"}
a["age"] = 33
assert dict(a) == {"name": "Alice", "age": 33}
_ = list(graph.match((a, None), "KNOWS"))
assert dict(a) == {"name": "Alice", "age": 33}
def test_pull_node_labels_if_stale(graph):
a = Node("Thing")
graph.create(a)
a.remove_label("Thing")
a._stale.add("labels")
labels = a.labels
assert set(labels) == {"Thing"}
def test_pull_node_property_if_stale(graph):
a = Node(foo="bar")
graph.create(a)
a["foo"] = None
a._stale.add("properties")
assert a["foo"] == "bar"
def test_can_create_concrete_node(graph):
alice = Node(name="Alice", age=34)
graph.create(alice)
assert isinstance(alice, Node)
assert alice["name"] == "Alice"
assert alice["age"] == 34
def test_all_property_types(graph):
data = {
"nun": None,
"yes": True,
"no": False,
"int": 42,
"float": 3.141592653589,
"long": long("9223372036854775807"),
"str": "hello, world",
"unicode": u"hello, world",
"boolean_list": [True, False, True, True, False],
"int_list": [1, 1, 2, 3, 5, 8, 13, 21, 35],
"str_list": ["red", "orange", "yellow", "green", "blue", "indigo", "violet"]
}
foo = Node(**data)
graph.create(foo)
for key, value in data.items():
assert foo[key] == value
def test_node_hashes(graph):
node_1 = Node("Person", name="Alice")
node_1.graph = graph
node_1.identity = 999
node_2 = Node("Person", name="Alice")
node_2.graph = node_1.graph
node_2.identity = node_1.identity
assert node_1 is not node_2
assert hash(node_1) == hash(node_2)
def test_cannot_delete_uncreated_node(graph):
a = Node()
graph.delete(a)
def test_node_exists(graph):
a = Node()
graph.create(a)
assert graph.exists(a)
def test_node_does_not_exist(graph):
a = Node()
assert not graph.exists(a)
def test_can_name_using_name_property(graph):
a = Node(name="Alice")
assert a.__name__ == "Alice"
def test_can_name_using_magic_name_property(graph):
a = Node(__name__="Alice")
assert a.__name__ == "Alice"
|
# Copyright 2019 DeepMind Technologies Limited.
#
# 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
#
# https://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.
# ============================================================================
# python2 python3
"""Exploration task used in COBRA.
There is no reward for this task, as it is used for task-free curiosity-drive
exploration.
Episodes last 10 steps, and each is initialized with 1-6 sprites of random
shape, color, and position.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import numpy as np
from spriteworld import factor_distributions as distribs
from spriteworld import sprite_generators
from spriteworld import tasks
from spriteworld.configs.cobra import common
def get_config(mode=None):
"""Generate environment config.
Args:
mode: Unused.
Returns:
config: Dictionary defining task/environment configuration. Can be fed as
kwargs to environment.Environment.
"""
del mode # No train/test split for pure exploration
factors = distribs.Product([
distribs.Continuous('x', 0.1, 0.9),
distribs.Continuous('y', 0.1, 0.9),
distribs.Discrete('shape', ['square', 'triangle', 'circle']),
distribs.Discrete('scale', [0.13]),
distribs.Continuous('c0', 0., 1.),
distribs.Continuous('c1', 0.3, 1.),
distribs.Continuous('c2', 0.9, 1.),
])
num_sprites = lambda: np.random.randint(1, 7)
sprite_gen = sprite_generators.generate_sprites(
factors, num_sprites=num_sprites)
task = tasks.NoReward()
config = {
'task': task,
'action_space': common.action_space(),
'renderers': common.renderers(),
'init_sprites': sprite_gen,
'max_episode_length': 10,
'metadata': {
'name': os.path.basename(__file__)
}
}
return config
|
def banner():
print "[***] pCAP processing p56 [***]"
def http_assembler(pcap_file):
carved_images = o
faced_detected = 0
a = rdpcap(pacap_file)
sessions = a.sessions()
for session in sesions:
http_payload = ""
for packet in sessions[session]:
try:
if packet[TCP].dport == 80 or packet[TCP].sport == 80:
http_payload += str(packet[TCP].payload)
except:
pass
headers = get_http_headers(http_payload)
if headers is None:
continue
image, image_type = extract_image(headers, http_payload)
if image is not None and image_type is not None:
file_name = "%s-pic_carver+%d.%s" % (pcap_file, carved_images, image_type)
fd = open ("%s/%s" % (pictured_directory, file+name), "wb")
fd.write(image)
fd.close()
carved_images += 1
try:
result = face+detect("%s/%s" % (pictures_directory, file_name), file_name)
if result is True:
faces+detected += 1
except:
pass
return carved+images, faced_detected
carved_images, faces+detected = http_assembler(pcap_file)
print "Extracted %d images" % carved_images
print "Detected: %d faces" % faces_detected
def get_http_headers(http_payload):
try:
headers_raw = http+payload[:http_payload.index("\r\n\r\n")+2]
headers = dict(re.findall(r"(?P<name>.*?): (?P<value>.*?)\r\n", headers_raw))
except:
return None
if "Content-Type" not in headers:
return None
return headers
def extract_image(headers, http_payload):
image = None
image_type = None
try:
if "image" in headers ['Content-Type']:
image_type = http_payload[http_payload.index("\r\n\r\n")+4:]
try:
if "Content-Encoding" in headers.keys():
if headers["Content-Encoding"]
def face_detect(path, file_name):
img = cv2.imread(path)
cascade = cs2.CascadeClassifier("haarcascade_frontalface_alt.xml")
rects = cascade.detectMultiScale(img, 1.3, 4, cv2.cv.CV_HAAR_SCALE_IMAGE, (20,20))
if len(rects) == 0:
return False:
rects[:, 2:] += rects[:, :2]
for x1,y1,x2,y2 in rects:
cv2.rectangle(img,(x1,y1),(x2,y2),(127,255,0),2)
cv2.imwrite("%s/%s-%s" % (faces_directory,pcap_file,file_name),img)
return True
|
from bitmovin.errors import InvalidTypeError
from bitmovin.resources.enums import CloudRegion, EncoderVersion
from bitmovin.utils import Serializable
from bitmovin.resources.models import AbstractModel
from bitmovin.resources import AbstractNameDescriptionResource
from .infrastructure import Infrastructure
class Encoding(AbstractNameDescriptionResource, AbstractModel, Serializable):
def __init__(self, name, description=None, encoder_version=None, cloud_region=None, id_=None, custom_data=None,
infrastructure_id=None, infrastructure=None, labels=None):
super().__init__(id_=id_, custom_data=custom_data, name=name, description=description)
self._encoderVersion = None
self.encoderVersion = encoder_version
self._cloudRegion = None
self.cloudRegion = cloud_region
self.infrastructureId = infrastructure_id
self._infrastructure = None
self.infrastructure = infrastructure
self._labels = None
self.labels = labels
@property
def cloudRegion(self):
if self._cloudRegion is not None:
return self._cloudRegion
else:
return CloudRegion.default().value
@cloudRegion.setter
def cloudRegion(self, new_region):
if new_region is None:
return
if isinstance(new_region, str):
self._cloudRegion = new_region
elif isinstance(new_region, CloudRegion):
self._cloudRegion = new_region.value
else:
raise InvalidTypeError(
'Invalid type {} for cloudRegion: must be either str or CloudRegion!'.format(type(new_region)))
@property
def encoderVersion(self):
if self._encoderVersion is not None:
return self._encoderVersion
else:
return EncoderVersion.default().value
@property
def infrastructure(self):
return self._infrastructure
@infrastructure.setter
def infrastructure(self, new_infrastructure):
if new_infrastructure is None:
self._infrastructure = None
return
if isinstance(new_infrastructure, Infrastructure):
self._infrastructure = new_infrastructure
else:
raise InvalidTypeError(
'Invalid type {} for infrastructure: must be Infrastructure!'.format(
type(new_infrastructure)
)
)
@encoderVersion.setter
def encoderVersion(self, new_version):
if new_version is None:
return
if isinstance(new_version, str):
self._encoderVersion = new_version
elif isinstance(new_version, EncoderVersion):
self._encoderVersion = new_version.value
else:
raise InvalidTypeError(
'Invalid type {} for encoderVersion: must be either str or EncoderVersion!'.format(type(new_version)))
@property
def labels(self):
return self._labels
@labels.setter
def labels(self, new_labels):
if new_labels is None:
self._labels = None
return
if not isinstance(new_labels, list):
raise InvalidTypeError('new_labels has to be a list of strings')
if all(isinstance(label, str) for label in new_labels):
self._labels = new_labels
else:
raise InvalidTypeError('new_labels has to be a list of strings')
@classmethod
def parse_from_json_object(cls, json_object):
id_ = json_object['id']
custom_data = json_object.get('customData')
name = json_object['name']
description = json_object.get('description')
encoder_version = json_object.get('encoderVersion')
cloud_region = json_object.get('cloudRegion')
infrastructure_id = json_object.get('infrastructureId')
labels = json_object.get('labels')
infrastructure_json = json_object.get('infrastructure')
infrastructure = None
if infrastructure_json is not None:
infrastructure = Infrastructure.parse_from_json_object(infrastructure_json)
encoding = Encoding(id_=id_, custom_data=custom_data,
name=name, description=description, encoder_version=encoder_version,
cloud_region=cloud_region, infrastructure_id=infrastructure_id,
infrastructure=infrastructure, labels=labels)
return encoding
def serialize(self):
serialized = super().serialize()
serialized['cloudRegion'] = self.cloudRegion
serialized['encoderVersion'] = self.encoderVersion
serialized['infrastructure'] = self.infrastructure
serialized['labels'] = self.labels
return serialized
|
# -*- coding: utf-8 -*-
import json
import sys
import textwrap
from .exceptions import YeastException
from .validators import validate_optional_fields
from .validators import validate_percentage
from .validators import validate_required_fields
__all__ = [u"Yeast"]
class Yeast(object):
"""
A representation of a type of Yeast as added to a Recipe.
"""
def __init__(self, name, percent_attenuation=0.75):
"""
:param float percent_attenuation: The percentage the yeast is expected to attenuate the sugar in the yeast to create alcohol
:raises YeastException: If percent_attenuation is not provided
""" # noqa
self.name = name
if percent_attenuation is None:
raise YeastException(
u"{}: Must provide percent attenuation".format(self.name) # noqa
)
self.percent_attenuation = validate_percentage(percent_attenuation)
def __str__(self):
if sys.version_info[0] >= 3:
return self.__unicode__()
else:
return self.__unicode__().encode(u"utf8")
def __unicode__(self):
return u"{0}, attenuation {1:0.1%}".format(
self.name.capitalize(), self.percent_attenuation
)
def __repr__(self):
out = u"{0}('{1}'".format(type(self).__name__, self.name)
if self.percent_attenuation:
out = u"{0}, percent_attenuation={1}".format(out, self.percent_attenuation)
out = u"{0})".format(out)
return out
def __eq__(self, other):
if not isinstance(other, self.__class__):
return False
if (self.name == other.name) and (
self.percent_attenuation == other.percent_attenuation
):
return True
return False
def __ne__(self, other):
return not self.__eq__(other)
def to_dict(self):
return {
u"name": self.name,
u"data": {u"percent_attenuation": self.percent_attenuation},
}
def to_json(self):
return json.dumps(self.to_dict(), sort_keys=True)
@classmethod
def validate(cls, yeast_data):
required_fields = [(u"name", str)]
optional_fields = [(u"percent_attenuation", float)]
validate_required_fields(yeast_data, required_fields)
validate_optional_fields(yeast_data, optional_fields)
def format(self):
msg = textwrap.dedent(
u"""\
{name} Yeast
-----------------------------------
Attenuation: {data[percent_attenuation]:0.1%}""".format(
**self.to_dict()
)
)
return msg
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.