max_stars_count
int64
301
224k
text
stringlengths
6
1.05M
token_count
int64
3
727k
3,269
<reponame>Akhil-Kashyap/LeetCode-Solutions // Time: O(n) // Space: O(h) /** * Definition for a Node. * struct Node { * int val; * Node *left; * Node *right; * Node *random; * Node() : val(0), left(nullptr), right(nullptr), random(nullptr) {} * Node(int x) : val(x), left(nullptr), right(nullptr), random(nullptr) {} * Node(int x, Node *left, Node *right, Node *random) : val(x), left(left), right(right), random(random) {} * }; */ class Solution { public: NodeCopy* copyRandomBinaryTree(Node* root) { const auto& merge = [](Node *node) { auto copy = new NodeCopy(node->val); tie(node->left, copy->left) = pair(reinterpret_cast<Node*>(copy), reinterpret_cast<NodeCopy*>(node->left)); return pair{reinterpret_cast<Node*>(copy->left), copy}; }; const auto& clone = [](Node *node) { auto copy = reinterpret_cast<NodeCopy*>(node->left); node->left->random = node->random ? node->random->left : nullptr; node->left->right = node->right ? node->right->left : nullptr; return pair{reinterpret_cast<Node*>(copy->left), copy}; }; const auto& split = [](Node *node) { auto copy = reinterpret_cast<NodeCopy*>(node->left); tie(node->left, copy->left) = pair(copy->left ? reinterpret_cast<Node*>(copy->left) : nullptr, copy->left ? copy->left->left : nullptr); return pair{reinterpret_cast<Node*>(node->left), copy}; }; iter_dfs(root, merge); iter_dfs(root, clone); return iter_dfs(root, split); } private: NodeCopy *iter_dfs(Node *root, const function<pair<Node*, NodeCopy*>(Node*)>& callback) { NodeCopy *result = nullptr; vector<Node *> stk = {root}; while (!stk.empty()) { auto node = stk.back(); stk.pop_back(); if (!node) { continue; } const auto& [left_node, copy] = callback(node); if (!result) { result = copy; } stk.emplace_back(node->right); stk.emplace_back(left_node); } return result; } }; // Time: O(n) // Space: O(h) class Solution_Recu { public: NodeCopy* copyRandomBinaryTree(Node* root) { const auto& merge = [](Node *node) { auto copy = new NodeCopy(node->val); tie(node->left, copy->left) = pair(reinterpret_cast<Node*>(copy), reinterpret_cast<NodeCopy*>(node->left)); return pair{reinterpret_cast<Node*>(copy->left), copy}; }; const auto& clone = [](Node *node) { auto copy = reinterpret_cast<NodeCopy*>(node->left); node->left->random = node->random ? node->random->left : nullptr; node->left->right = node->right ? node->right->left : nullptr; return pair{reinterpret_cast<Node*>(copy->left), copy}; }; const auto& split = [](Node *node) { auto copy = reinterpret_cast<NodeCopy*>(node->left); tie(node->left, copy->left) = pair(copy->left ? reinterpret_cast<Node*>(copy->left) : nullptr, copy->left ? copy->left->left : nullptr); return pair{reinterpret_cast<Node*>(node->left), copy}; }; dfs(root, merge); dfs(root, clone); return dfs(root, split); } private: NodeCopy *dfs(Node *node, const function<pair<Node*, NodeCopy*>(Node*)>& callback) { if (!node) { return nullptr; } const auto& [left_node, copy] = callback(node); dfs(left_node, callback); dfs(node->right, callback); return copy; } }; // Time: O(n) // Space: O(n) class Solution2 { public: NodeCopy* copyRandomBinaryTree(Node* root) { unordered_map<Node*, NodeCopy*> lookup; lookup[nullptr] = nullptr; vector<Node *> stk = {root}; while (!stk.empty()) { auto node = stk.back(); stk.pop_back(); if (!node) { continue; } if (!lookup.count(node)) { lookup[node] = new NodeCopy(); } if (!lookup.count(node->left)) { lookup[node->left] = new NodeCopy(); } if (!lookup.count(node->right)) { lookup[node->right] = new NodeCopy(); } if (!lookup.count(node->random)) { lookup[node->random] = new NodeCopy(); } lookup[node]->val = node->val; lookup[node]->left = lookup[node->left]; lookup[node]->right = lookup[node->right]; lookup[node]->random = lookup[node->random]; stk.emplace_back(node->right); stk.emplace_back(node->left); } return lookup[root]; } }; // Time: O(n) // Space: O(n) class Solution2_Recu { public: NodeCopy* copyRandomBinaryTree(Node* root) { unordered_map<Node*, NodeCopy*> lookup; lookup[nullptr] = nullptr; dfs(root, &lookup); return lookup[root]; } private: void dfs(Node *node, unordered_map<Node*, NodeCopy*> *lookup) { if (!node) { return; } if (!lookup->count(node)) { (*lookup)[node] = new NodeCopy(); } if (!lookup->count(node->left)) { (*lookup)[node->left] = new NodeCopy(); } if (!lookup->count(node->right)) { (*lookup)[node->right] = new NodeCopy(); } if (!lookup->count(node->random)) { (*lookup)[node->random] = new NodeCopy(); } (*lookup)[node]->val = node->val; (*lookup)[node]->left = (*lookup)[node->left]; (*lookup)[node]->right = (*lookup)[node->right]; (*lookup)[node]->random = (*lookup)[node->random]; dfs(node->left, lookup); dfs(node->right, lookup); } };
3,048
1,861
<gh_stars>1000+ /* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ package com.facebook.spectrum.logging; import com.facebook.spectrum.SpectrumResult; import com.facebook.spectrum.options.Options; import javax.annotation.Nullable; /** * The interface to be implemented by the global logger for Spectrum events which are emitted for * all requests. The implementation needs to be thread-safe as Spectrum might execute multiple * operations in parallel. */ public interface SpectrumLogger { /** * Called before the operation is started. * * @param options The given {@link Options} for the operation * @param callerContext An integration specific object that provides information about the calling * site * @return A logging context that will be returned to this class when the {@link #onFinish} and * {@link #onError} methods are called. This can be used to differentiate operations. Can be * null. */ @Nullable Object onStart(final Options options, final Object callerContext); /** * Called for any exception that occurs during the operation. * * @param loggingContext The logging context that was returned initially by the {@link #onStart} * method (if any). * @param exception The exception that was thrown */ void onError(@Nullable final Object loggingContext, final Exception exception); /** * Called when the operation finishes. This method is guaranteed to be called exactly once and no * other callback is called afterwards for a given operation. * * @param loggingContext The logging context that was returned initially by the {@link #onStart} * method (if any). * @param result The {@link SpectrumResult} returned by the operation */ void onFinish(@Nullable final Object loggingContext, @Nullable final SpectrumResult result); }
530
654
package qz.communication; import org.hid4java.HidDevice; import javax.usb.util.UsbUtil; public class H4J_HidIO implements DeviceIO { private HidDevice device; private boolean streaming; public H4J_HidIO(DeviceOptions dOpts) throws DeviceException { this(H4J_HidUtilities.findDevice(dOpts)); } public H4J_HidIO(HidDevice device) throws DeviceException { if (device == null) { throw new DeviceException("HID device could not be found"); } this.device = device; } public void open() { if (!isOpen()) { device.open(); } } public boolean isOpen() { return device.isOpen(); } public void setStreaming(boolean active) { streaming = active; } public boolean isStreaming() { return streaming; } public String getVendorId() { return UsbUtil.toHexString(device.getVendorId()); } public String getProductId() { return UsbUtil.toHexString(device.getProductId()); } public byte[] readData(int responseSize, Byte unused) throws DeviceException { byte[] response = new byte[responseSize]; int read = device.read(response); if (read == -1) { throw new DeviceException("Failed to read from device"); } return response; } public void sendData(byte[] data, Byte reportId) throws DeviceException { if (reportId == null) { reportId = (byte)0x00; } int wrote = device.write(data, data.length, reportId); if (wrote == -1) { throw new DeviceException("Failed to write to device"); } } public byte[] getFeatureReport(int responseSize, Byte reportId) throws DeviceException { if (reportId == null) { reportId = (byte)0x00; } byte[] response = new byte[responseSize]; int read = device.getFeatureReport(response, reportId); if (read == -1) { throw new DeviceException("Failed to read from device"); } return response; } public void sendFeatureReport(byte[] data, Byte reportId) throws DeviceException { if (reportId == null) { reportId = (byte)0x00; } int wrote = device.sendFeatureReport(data, reportId); if (wrote == -1) { throw new DeviceException("Failed to write to device"); } } public void close() { if (isOpen()) { device.close(); } streaming = false; } }
1,034
1,144
/* * #%L * de-metas-common-rest_api * %% * Copyright (C) 2021 metas GmbH * %% * 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, see * <http://www.gnu.org/licenses/gpl-2.0.html>. * #L% */ package de.metas.common.rest_api.v2; import de.pentabyte.springfox.ApiEnum; public enum JsonInvoiceRule { @ApiEnum("Specifies that only *delivered* quantities will be invoiced") AfterDelivery, @ApiEnum("Like `AfterDelivery`, but the invoicing date is also set according to the respective bill partner's invoicing schedule (e.g. once per month)") CustomerScheduleAfterDelivery, @ApiEnum("Specifies that no invoicing should take place until all quantities belonging to the same invoice have been shipped.\nNote: what belongs to one invoice is determined by the respective business partner's aggregation rule.") OrderCompletelyDelivered, @ApiEnum("Any ordered quantities - delivered or not - can be invoiced right away") Immediate; }
425
450
/* * Copyright (C) 2017 The Android Open Source Project * * 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. */ package org.chromium.latency.walt; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.View; import android.widget.RelativeLayout; import com.github.mikephil.charting.charts.BarChart; import com.github.mikephil.charting.components.AxisBase; import com.github.mikephil.charting.components.Description; import com.github.mikephil.charting.components.XAxis; import com.github.mikephil.charting.data.BarData; import com.github.mikephil.charting.data.BarDataSet; import com.github.mikephil.charting.data.BarEntry; import com.github.mikephil.charting.formatter.IAxisValueFormatter; import com.github.mikephil.charting.interfaces.datasets.IBarDataSet; import com.github.mikephil.charting.utils.ColorTemplate; import java.text.DecimalFormat; import java.util.ArrayList; public class HistogramChart extends RelativeLayout implements View.OnClickListener { static final float GROUP_SPACE = 0.1f; private HistogramData histogramData; private BarChart barChart; public HistogramChart(Context context, AttributeSet attrs) { super(context, attrs); inflate(getContext(), R.layout.histogram, this); barChart = (BarChart) findViewById(R.id.bar_chart); findViewById(R.id.button_close_bar_chart).setOnClickListener(this); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.HistogramChart); final String descString; final int numDataSets; final float binWidth; try { descString = a.getString(R.styleable.HistogramChart_description); numDataSets = a.getInteger(R.styleable.HistogramChart_numDataSets, 1); binWidth = a.getFloat(R.styleable.HistogramChart_binWidth, 5f); } finally { a.recycle(); } ArrayList<IBarDataSet> dataSets = new ArrayList<>(numDataSets); for (int i = 0; i < numDataSets; i++) { final BarDataSet dataSet = new BarDataSet(new ArrayList<BarEntry>(), ""); dataSet.setColor(ColorTemplate.MATERIAL_COLORS[i]); dataSets.add(dataSet); } BarData barData = new BarData(dataSets); barData.setBarWidth((1f - GROUP_SPACE)/numDataSets); barChart.setData(barData); histogramData = new HistogramData(numDataSets, binWidth); groupBars(barData); final Description desc = new Description(); desc.setText(descString); desc.setTextSize(12f); barChart.setDescription(desc); XAxis xAxis = barChart.getXAxis(); xAxis.setGranularityEnabled(true); xAxis.setGranularity(1); xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); xAxis.setValueFormatter(new IAxisValueFormatter() { DecimalFormat df = new DecimalFormat("#.##"); @Override public String getFormattedValue(float value, AxisBase axis) { return df.format(histogramData.getDisplayValue(value)); } }); barChart.setFitBars(true); barChart.invalidate(); } BarChart getBarChart() { return barChart; } /** * Re-implementation of BarData.groupBars(), but allows grouping with only 1 BarDataSet * This adjusts the x-coordinates of entries, which centers the bars between axis labels */ static void groupBars(final BarData barData) { IBarDataSet max = barData.getMaxEntryCountSet(); int maxEntryCount = max.getEntryCount(); float groupSpaceWidthHalf = GROUP_SPACE / 2f; float barWidthHalf = barData.getBarWidth() / 2f; float interval = barData.getGroupWidth(GROUP_SPACE, 0); float fromX = 0; for (int i = 0; i < maxEntryCount; i++) { float start = fromX; fromX += groupSpaceWidthHalf; for (IBarDataSet set : barData.getDataSets()) { fromX += barWidthHalf; if (i < set.getEntryCount()) { BarEntry entry = set.getEntryForIndex(i); if (entry != null) { entry.setX(fromX); } } fromX += barWidthHalf; } fromX += groupSpaceWidthHalf; float end = fromX; float innerInterval = end - start; float diff = interval - innerInterval; // correct rounding errors if (diff > 0 || diff < 0) { fromX += diff; } } barData.notifyDataChanged(); } public void clearData() { histogramData.clear(); for (IBarDataSet dataSet : barChart.getBarData().getDataSets()) { dataSet.clear(); } barChart.getBarData().notifyDataChanged(); barChart.invalidate(); } public void addEntry(int dataSetIndex, double value) { histogramData.addEntry(barChart.getBarData(), dataSetIndex, value); recalculateXAxis(); } public void addEntry(double value) { addEntry(0, value); } private void recalculateXAxis() { final XAxis xAxis = barChart.getXAxis(); xAxis.setAxisMinimum(0); xAxis.setAxisMaximum(histogramData.getNumBins()); barChart.notifyDataSetChanged(); barChart.invalidate(); } public void setLabel(int dataSetIndex, String label) { barChart.getBarData().getDataSetByIndex(dataSetIndex).setLabel(label); barChart.getLegendRenderer().computeLegend(barChart.getBarData()); barChart.invalidate(); } public void setLabel(String label) { setLabel(0, label); } public void setDescription(String description) { getBarChart().getDescription().setText(description); } public void setLegendEnabled(boolean enabled) { barChart.getLegend().setEnabled(enabled); barChart.notifyDataSetChanged(); barChart.invalidate(); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.button_close_bar_chart: this.setVisibility(GONE); } } static class HistogramData { private float binWidth; private final ArrayList<ArrayList<Double>> rawData; private double minBin = 0; private double maxBin = 100; private double min = 0; private double max = 100; HistogramData(int numDataSets, float binWidth) { this.binWidth = binWidth; rawData = new ArrayList<>(numDataSets); for (int i = 0; i < numDataSets; i++) { rawData.add(new ArrayList<Double>()); } } float getBinWidth() { return binWidth; } double getMinBin() { return minBin; } void clear() { for (int i = 0; i < rawData.size(); i++) { rawData.get(i).clear(); } } private boolean isEmpty() { for (ArrayList<Double> data : rawData) { if (!data.isEmpty()) return false; } return true; } void addEntry(BarData barData, int dataSetIndex, double value) { if (isEmpty()) { min = value; max = value; } else { if (value < min) min = value; if (value > max) max = value; } rawData.get(dataSetIndex).add(value); recalculateDataSet(barData); } void recalculateDataSet(final BarData barData) { minBin = Math.floor(min / binWidth) * binWidth; maxBin = Math.floor(max / binWidth) * binWidth; int[][] bins = new int[rawData.size()][getNumBins()]; for (int setNum = 0; setNum < rawData.size(); setNum++) { for (Double d : rawData.get(setNum)) { ++bins[setNum][(int) (Math.floor((d - minBin) / binWidth))]; } } for (int setNum = 0; setNum < barData.getDataSetCount(); setNum++) { final IBarDataSet dataSet = barData.getDataSetByIndex(setNum); dataSet.clear(); for (int i = 0; i < bins[setNum].length; i++) { dataSet.addEntry(new BarEntry(i, bins[setNum][i])); } } groupBars(barData); barData.notifyDataChanged(); } int getNumBins() { return (int) (((maxBin - minBin) / binWidth) + 1); } double getDisplayValue(float value) { return value * getBinWidth() + getMinBin(); } } }
4,182
3,705
#include "chainerx/routines/type_util.h" #include <vector> #include <gtest/gtest.h> #include "chainerx/array.h" #include "chainerx/dtype.h" #include "chainerx/error.h" #include "chainerx/routines/creation.h" #include "chainerx/shape.h" #include "chainerx/testing/context_session.h" namespace chainerx { namespace { TEST(DtypeTest, GetDefaultDtype) { EXPECT_EQ(Dtype::kBool, internal::GetDefaultDtype(DtypeKind::kBool)); EXPECT_EQ(Dtype::kInt32, internal::GetDefaultDtype(DtypeKind::kInt)); EXPECT_EQ(Dtype::kFloat32, internal::GetDefaultDtype(DtypeKind::kFloat)); } // Declares necessary variables and runs a set of checks. #define CHECK_RESULT_TYPE_IMPL(check_body) \ { \ testing::ContextSession context_session; \ Array Ab = Empty({2, 3}, Dtype::kBool); \ Array Au8 = Empty({2, 3}, Dtype::kUInt8); \ Array Ai8 = Empty({2, 3}, Dtype::kInt8); \ Array Ai16 = Empty({2, 3}, Dtype::kInt16); \ Array Ai32 = Empty({2, 3}, Dtype::kInt32); \ Array Ai64 = Empty({2, 3}, Dtype::kInt64); \ Array Af16 = Empty({2, 3}, Dtype::kFloat16); \ Array Af32 = Empty({2, 3}, Dtype::kFloat32); \ Array Af64 = Empty({2, 3}, Dtype::kFloat64); \ Scalar Sb{bool{1}}; \ Scalar Si{int64_t{1}}; \ Scalar Sf{double{1}}; \ check_body; \ } // Checks ResultType: static-length 1-arg call // args are Ai8, Sf32, etc. #define CHECK_RESULT_TYPE1(arg1) CHECK_RESULT_TYPE_IMPL({ EXPECT_EQ((arg1).dtype(), chainerx::ResultType(arg1)); }) // Checks ResultType: static-length 2-arg call // args are Ai8, Sf32, etc. #define CHECK_RESULT_TYPE2(expected_dtype, arg1, arg2) \ CHECK_RESULT_TYPE_IMPL({ \ EXPECT_EQ(Dtype::k##expected_dtype, chainerx::ResultType(arg1, arg2)); \ EXPECT_EQ(Dtype::k##expected_dtype, chainerx::ResultType(arg2, arg1)); \ }) // Checks ResultType: static-length 3-arg call // args are Ai8, Sf32, etc. #define CHECK_RESULT_TYPE3(expected_dtype, arg1, arg2, arg3) \ CHECK_RESULT_TYPE_IMPL({ \ EXPECT_EQ(Dtype::k##expected_dtype, chainerx::ResultType(arg1, arg2, arg3)); \ EXPECT_EQ(Dtype::k##expected_dtype, chainerx::ResultType(arg1, arg3, arg2)); \ EXPECT_EQ(Dtype::k##expected_dtype, chainerx::ResultType(arg2, arg1, arg3)); \ EXPECT_EQ(Dtype::k##expected_dtype, chainerx::ResultType(arg2, arg3, arg1)); \ EXPECT_EQ(Dtype::k##expected_dtype, chainerx::ResultType(arg3, arg1, arg2)); \ EXPECT_EQ(Dtype::k##expected_dtype, chainerx::ResultType(arg3, arg2, arg1)); \ }) TEST(ResultTypeTest, NoArgs) { EXPECT_THROW({ chainerx::ResultType(std::vector<Array>{}); }, ChainerxError); } TEST(ResultTypeTest, One) { CHECK_RESULT_TYPE1(Ab); CHECK_RESULT_TYPE1(Af16); CHECK_RESULT_TYPE1(Af32); CHECK_RESULT_TYPE1(Af64); CHECK_RESULT_TYPE1(Ai8); CHECK_RESULT_TYPE1(Ai16); CHECK_RESULT_TYPE1(Ai32); CHECK_RESULT_TYPE1(Ai64); CHECK_RESULT_TYPE1(Au8); } TEST(ResultTypeTest, TwoBool) { CHECK_RESULT_TYPE2(Bool, Ab, Ab); } TEST(ResultTypeTest, TwoFloat) { CHECK_RESULT_TYPE2(Float16, Af16, Af16); CHECK_RESULT_TYPE2(Float32, Af32, Af32); CHECK_RESULT_TYPE2(Float64, Af64, Af64); CHECK_RESULT_TYPE2(Float32, Af16, Af32); CHECK_RESULT_TYPE2(Float64, Af16, Af64); CHECK_RESULT_TYPE2(Float64, Af32, Af64); } TEST(ResultTypeTest, TwoSignedInt) { CHECK_RESULT_TYPE2(Int8, Ai8, Ai8); CHECK_RESULT_TYPE2(Int16, Ai8, Ai16); CHECK_RESULT_TYPE2(Int32, Ai8, Ai32); CHECK_RESULT_TYPE2(Int64, Ai8, Ai64); CHECK_RESULT_TYPE2(Int16, Ai16, Ai16); CHECK_RESULT_TYPE2(Int32, Ai32, Ai32); CHECK_RESULT_TYPE2(Int64, Ai64, Ai64); CHECK_RESULT_TYPE2(Int32, Ai16, Ai32); CHECK_RESULT_TYPE2(Int64, Ai16, Ai64); CHECK_RESULT_TYPE2(Int64, Ai32, Ai64); } TEST(ResultTypeTest, TwoUnsignedInt) { CHECK_RESULT_TYPE2(UInt8, Au8, Au8); } TEST(ResultTypeTest, TwoSignedIntAndUnsignedInt) { CHECK_RESULT_TYPE2(Int16, Au8, Ai8); CHECK_RESULT_TYPE2(Int16, Au8, Ai16); CHECK_RESULT_TYPE2(Int32, Au8, Ai32); } TEST(ResultTypeTest, TwoIntAndFloat) { CHECK_RESULT_TYPE2(Float16, Ai8, Af16); CHECK_RESULT_TYPE2(Float16, Au8, Af16); CHECK_RESULT_TYPE2(Float32, Ai16, Af32); CHECK_RESULT_TYPE2(Float32, Ai32, Af32); CHECK_RESULT_TYPE2(Float32, Ai64, Af32); } TEST(ResultTypeTest, TwoBoolAndOther) { CHECK_RESULT_TYPE2(UInt8, Ab, Au8); CHECK_RESULT_TYPE2(Int8, Ab, Ai8); CHECK_RESULT_TYPE2(Int16, Ab, Ai16); CHECK_RESULT_TYPE2(Float16, Ab, Af16); CHECK_RESULT_TYPE2(Float64, Ab, Af64); } TEST(ResultTypeTest, Three) { // signed ints CHECK_RESULT_TYPE3(Int32, Ai32, Ai32, Ai32); CHECK_RESULT_TYPE3(Int32, Ai8, Ai8, Ai32); CHECK_RESULT_TYPE3(Int32, Ai8, Ai16, Ai32); CHECK_RESULT_TYPE3(Int32, Ai8, Ai32, Ai32); // unsigned ints CHECK_RESULT_TYPE3(UInt8, Au8, Au8, Au8); CHECK_RESULT_TYPE3(Int16, Au8, Au8, Ai8); CHECK_RESULT_TYPE3(Int16, Au8, Ai8, Ai8); CHECK_RESULT_TYPE3(Int16, Au8, Ai8, Ai16); CHECK_RESULT_TYPE3(Int16, Au8, Au8, Ai16); // float and signed int CHECK_RESULT_TYPE3(Float16, Af16, Ai8, Ai8); CHECK_RESULT_TYPE3(Float16, Af16, Ai32, Ai64); CHECK_RESULT_TYPE3(Float32, Af16, Af32, Ai64); // float and unsigned int CHECK_RESULT_TYPE3(Float16, Af16, Ai8, Au8); CHECK_RESULT_TYPE3(Float16, Af16, Ai16, Au8); CHECK_RESULT_TYPE3(Float32, Af16, Af32, Au8); // bool and other CHECK_RESULT_TYPE3(UInt8, Ab, Au8, Au8); CHECK_RESULT_TYPE3(UInt8, Ab, Ab, Au8); CHECK_RESULT_TYPE3(Int16, Ab, Ai8, Au8); CHECK_RESULT_TYPE3(Int32, Ab, Ab, Ai32); CHECK_RESULT_TYPE3(Float32, Ab, Af16, Af32); CHECK_RESULT_TYPE3(Float64, Ab, Ab, Af64); } TEST(ResultTypeTest, ArraysAndScalars) { // Arrays take precedence unless Scalar is a wider floating kind. // ints CHECK_RESULT_TYPE2(Int8, Ai8, Si); CHECK_RESULT_TYPE2(Int16, Ai16, Si); // float vs int CHECK_RESULT_TYPE2(Float32, Af32, Si); CHECK_RESULT_TYPE2(Float32, Ai32, Sf); // 3 arguments CHECK_RESULT_TYPE3(Int8, Ai8, Si, Si); CHECK_RESULT_TYPE3(Int16, Ai8, Ai16, Si); CHECK_RESULT_TYPE3(Float32, Ai8, Si, Sf); // unsigned CHECK_RESULT_TYPE3(UInt8, Au8, Si, Si); CHECK_RESULT_TYPE3(Int8, Ai8, Si, Si); CHECK_RESULT_TYPE3(Int16, Au8, Ai8, Si); CHECK_RESULT_TYPE3(Float32, Au8, Ai8, Sf); CHECK_RESULT_TYPE3(Float16, Au8, Af16, Si); // bool CHECK_RESULT_TYPE3(Bool, Ab, Sb, Sb); CHECK_RESULT_TYPE3(Bool, Ab, Si, Si); CHECK_RESULT_TYPE3(Bool, Ab, Sb, Si); CHECK_RESULT_TYPE3(Int8, Ai8, Sb, Si); CHECK_RESULT_TYPE3(Float32, Af32, Sb, Si); CHECK_RESULT_TYPE3(Float32, Af32, Ab, Si); CHECK_RESULT_TYPE3(Float32, Ab, Ab, Sf); CHECK_RESULT_TYPE3(Float16, Ab, Af16, Sf); } } // namespace } // namespace chainerx
3,608
764
// 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. ////////////////////////////////////////////////////// // half output interface ////////////////////////////////////////////////////// #if defined(ENABLE_FUSE) #define OUTPUT_1x1_BY_INT1() \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) dCv2[dCv1_idx[0] + concat_v1_off0] = outData[0]; \ } #define OUTPUT_1x2_BY_INT1() \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) dCv2[dCv1_idx[0] + concat_v1_off0] = outData[0]; \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) dCv2[dCv1_idx[1] + concat_v1_off0] = outData[1]; \ } #define OUTPUT_1x4_BY_INT1() \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) dCv2[dCv1_idx[0] + concat_v1_off0] = outData[0]; \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) dCv2[dCv1_idx[1] + concat_v1_off0] = outData[1]; \ if(dCv1_y_valid[0] && dCv1_x_valid[2]) dCv2[dCv1_idx[2] + concat_v1_off0] = outData[2]; \ if(dCv1_y_valid[0] && dCv1_x_valid[3]) dCv2[dCv1_idx[3] + concat_v1_off0] = outData[3]; \ } #else #define OUTPUT_1x1_BY_INT1() \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) dCv2[dCv1_idy[0] * num_flt_v2 + dCv1_idx[0]] = outData[0]; \ } #define OUTPUT_1x2_BY_INT1() \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) dCv2[dCv1_idy[0] * num_flt_v2 + dCv1_idx[0]] = outData[0]; \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) dCv2[dCv1_idy[0] * num_flt_v2 + dCv1_idx[1]] = outData[1]; \ } #define OUTPUT_1x4_BY_INT1() \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) dCv2[dCv1_idy[0] * num_flt_v2 + dCv1_idx[0]] = outData[0]; \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) dCv2[dCv1_idy[0] * num_flt_v2 + dCv1_idx[1]] = outData[1]; \ if(dCv1_y_valid[0] && dCv1_x_valid[2]) dCv2[dCv1_idy[0] * num_flt_v2 + dCv1_idx[2]] = outData[2]; \ if(dCv1_y_valid[0] && dCv1_x_valid[3]) dCv2[dCv1_idy[0] * num_flt_v2 + dCv1_idx[3]] = outData[3]; \ } #endif ////////////////////////////////////////////////////// // bias macros ////////////////////////////////////////////////////// #define ADD_BIAS_1x1_V1(_has_bias, _bias, _step) \ { \ if(_has_bias) \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]){ \ float2 f2Bias = ((float2*)_bias)[dCv1_idx[0]]; \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x + f2Bias.x; \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y + f2Bias.y; \ } \ } \ } #define ADD_BIAS_1x2_V1(_has_bias, _bias, _step) \ { \ if(_has_bias) \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]){ \ float2 f2Bias = ((float2*)_bias)[dCv1_idx[0]]; \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x + f2Bias.x; \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y + f2Bias.y; \ } \ if(dCv1_y_valid[0] && dCv1_x_valid[1]){ \ float2 f2Bias = ((float2*)_bias)[dCv1_idx[1]]; \ fCv2[Cv1_off + 1].x = fCv2[Cv1_off + 1].x + f2Bias.x; \ fCv2[Cv1_off + 1].y = fCv2[Cv1_off + 1].y + f2Bias.y; \ } \ } \ } #define ADD_BIAS_1x4_V1(_has_bias, _bias, _step) \ { \ if(_has_bias) \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]){ \ float2 f2Bias = ((float2*)_bias)[dCv1_idx[0]]; \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x + f2Bias.x; \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y + f2Bias.y; \ } \ if(dCv1_y_valid[0] && dCv1_x_valid[1]){ \ float2 f2Bias = ((float2*)_bias)[dCv1_idx[1]]; \ fCv2[Cv1_off + 1].x = fCv2[Cv1_off + 1].x + f2Bias.x; \ fCv2[Cv1_off + 1].y = fCv2[Cv1_off + 1].y + f2Bias.y; \ } \ if(dCv1_y_valid[0] && dCv1_x_valid[2]){ \ float2 f2Bias = ((float2*)_bias)[dCv1_idx[2]]; \ fCv2[Cv1_off + 2].x = fCv2[Cv1_off + 2].x + f2Bias.x; \ fCv2[Cv1_off + 2].y = fCv2[Cv1_off + 2].y + f2Bias.y; \ } \ if(dCv1_y_valid[0] && dCv1_x_valid[3]){ \ float2 f2Bias = ((float2*)_bias)[dCv1_idx[3]]; \ fCv2[Cv1_off + 3].x = fCv2[Cv1_off + 3].x + f2Bias.x; \ fCv2[Cv1_off + 3].y = fCv2[Cv1_off + 3].y + f2Bias.y; \ } \ } \ } ////////////////////////////////////////////////////// // relu macros ////////////////////////////////////////////////////// #define FUSE_RELU_1x1_V1(_has_relu) \ { \ if(_has_relu == 1) \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]){ \ fCv2[Cv1_off + 0].x = Max(fCv2[Cv1_off + 0].x, 0); \ fCv2[Cv1_off + 0].y = Max(fCv2[Cv1_off + 0].y, 0); \ } \ } \ else if(_has_relu == 2) \ { \ float ONE = 1.f; \ \ if(dCv1_y_valid[0] && dCv1_x_valid[0]){ \ fCv2[Cv1_off + 0].x = __expf(fCv2[Cv1_off + 0].x) / (ONE + __expf(fCv2[Cv1_off + 0].x)); \ fCv2[Cv1_off + 0].y = __expf(fCv2[Cv1_off + 0].y) / (ONE + __expf(fCv2[Cv1_off + 0].y)); \ } \ } \ } #define FUSE_RELU_1x2_V1(_has_relu) \ { \ if(_has_relu == 1) \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]){ \ fCv2[Cv1_off + 0].x = Max(fCv2[Cv1_off + 0].x, 0); \ fCv2[Cv1_off + 0].y = Max(fCv2[Cv1_off + 0].y, 0); \ } \ if(dCv1_y_valid[0] && dCv1_x_valid[1]){ \ fCv2[Cv1_off + 1].x = Max(fCv2[Cv1_off + 1].x, 0); \ fCv2[Cv1_off + 1].y = Max(fCv2[Cv1_off + 1].y, 0); \ } \ } \ else if(_has_relu == 2) \ { \ float ONE = 1.f; \ \ if(dCv1_y_valid[0] && dCv1_x_valid[0]){ \ fCv2[Cv1_off + 0].x = __expf(fCv2[Cv1_off + 0].x) / (ONE + __expf(fCv2[Cv1_off + 0].x)); \ fCv2[Cv1_off + 0].y = __expf(fCv2[Cv1_off + 0].y) / (ONE + __expf(fCv2[Cv1_off + 0].y)); \ } \ \ if(dCv1_y_valid[0] && dCv1_x_valid[1]){ \ fCv2[Cv1_off + 1].x = __expf(fCv2[Cv1_off + 1].x) / (ONE + __expf(fCv2[Cv1_off + 1].x)); \ fCv2[Cv1_off + 1].y = __expf(fCv2[Cv1_off + 1].y) / (ONE + __expf(fCv2[Cv1_off + 1].y)); \ } \ } \ } #define FUSE_RELU_1x4_V1(_has_relu) \ { \ if(_has_relu == 1) \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]){ \ fCv2[Cv1_off + 0].x = Max(fCv2[Cv1_off + 0].x, 0); \ fCv2[Cv1_off + 0].y = Max(fCv2[Cv1_off + 0].y, 0); \ } \ if(dCv1_y_valid[0] && dCv1_x_valid[1]){ \ fCv2[Cv1_off + 1].x = Max(fCv2[Cv1_off + 1].x, 0); \ fCv2[Cv1_off + 1].y = Max(fCv2[Cv1_off + 1].y, 0); \ } \ if(dCv1_y_valid[0] && dCv1_x_valid[2]){ \ fCv2[Cv1_off + 2].x = Max(fCv2[Cv1_off + 2].x, 0); \ fCv2[Cv1_off + 2].y = Max(fCv2[Cv1_off + 2].y, 0); \ } \ if(dCv1_y_valid[0] && dCv1_x_valid[3]){ \ fCv2[Cv1_off + 3].x = Max(fCv2[Cv1_off + 3].x, 0); \ fCv2[Cv1_off + 3].y = Max(fCv2[Cv1_off + 3].y, 0); \ } \ } \ else if(_has_relu == 2) \ { \ float ONE = 1.f; \ \ if(dCv1_y_valid[0] && dCv1_x_valid[0]){ \ fCv2[Cv1_off + 0].x = __expf(fCv2[Cv1_off + 0].x) / (ONE + __expf(fCv2[Cv1_off + 0].x)); \ fCv2[Cv1_off + 0].y = __expf(fCv2[Cv1_off + 0].y) / (ONE + __expf(fCv2[Cv1_off + 0].y)); \ } \ \ if(dCv1_y_valid[0] && dCv1_x_valid[1]){ \ fCv2[Cv1_off + 1].x = __expf(fCv2[Cv1_off + 1].x) / (ONE + __expf(fCv2[Cv1_off + 1].x)); \ fCv2[Cv1_off + 1].y = __expf(fCv2[Cv1_off + 1].y) / (ONE + __expf(fCv2[Cv1_off + 1].y)); \ } \ \ if(dCv1_y_valid[0] && dCv1_x_valid[2]){ \ fCv2[Cv1_off + 2].x = __expf(fCv2[Cv1_off + 2].x) / (ONE + __expf(fCv2[Cv1_off + 2].x)); \ fCv2[Cv1_off + 2].y = __expf(fCv2[Cv1_off + 2].y) / (ONE + __expf(fCv2[Cv1_off + 2].y)); \ } \ \ if(dCv1_y_valid[0] && dCv1_x_valid[3]){ \ fCv2[Cv1_off + 3].x = __expf(fCv2[Cv1_off + 3].x) / (ONE + __expf(fCv2[Cv1_off + 3].x)); \ fCv2[Cv1_off + 3].y = __expf(fCv2[Cv1_off + 3].y) / (ONE + __expf(fCv2[Cv1_off + 3].y)); \ } \ } \ } ////////////////////////////////////////////////////// // clip macros ////////////////////////////////////////////////////// #define FUSE_CLIP_1x1_V1(_has_clip, _clip_max, _clip_min) \ { \ if(_has_clip) \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].x = Min(fCv2[Cv1_off + 0].x, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].y = Min(fCv2[Cv1_off + 0].y, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].x = Max(fCv2[Cv1_off + 0].x, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].y = Max(fCv2[Cv1_off + 0].y, _clip_min); \ } \ } #define FUSE_CLIP_1x2_V1(_has_clip, _clip_max, _clip_min) \ { \ if(_has_clip) \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].x = Min(fCv2[Cv1_off + 0].x, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].y = Min(fCv2[Cv1_off + 0].y, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].x = Max(fCv2[Cv1_off + 0].x, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].y = Max(fCv2[Cv1_off + 0].y, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) fCv2[Cv1_off + 1].x = Min(fCv2[Cv1_off + 1].x, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) fCv2[Cv1_off + 1].y = Min(fCv2[Cv1_off + 1].y, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) fCv2[Cv1_off + 1].x = Max(fCv2[Cv1_off + 1].x, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) fCv2[Cv1_off + 1].y = Max(fCv2[Cv1_off + 1].y, _clip_min); \ } \ } #define FUSE_CLIP_1x4_V1(_has_clip, _clip_max, _clip_min) \ { \ if(_has_clip) \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].x = Min(fCv2[Cv1_off + 0].x, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].y = Min(fCv2[Cv1_off + 0].y, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].x = Max(fCv2[Cv1_off + 0].x, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].y = Max(fCv2[Cv1_off + 0].y, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) fCv2[Cv1_off + 1].x = Min(fCv2[Cv1_off + 1].x, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) fCv2[Cv1_off + 1].y = Min(fCv2[Cv1_off + 1].y, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) fCv2[Cv1_off + 1].x = Max(fCv2[Cv1_off + 1].x, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) fCv2[Cv1_off + 1].y = Max(fCv2[Cv1_off + 1].y, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[2]) fCv2[Cv1_off + 2].x = Min(fCv2[Cv1_off + 2].x, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[2]) fCv2[Cv1_off + 2].y = Min(fCv2[Cv1_off + 2].y, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[2]) fCv2[Cv1_off + 2].x = Max(fCv2[Cv1_off + 2].x, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[2]) fCv2[Cv1_off + 2].y = Max(fCv2[Cv1_off + 2].y, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[3]) fCv2[Cv1_off + 3].x = Min(fCv2[Cv1_off + 3].x, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[3]) fCv2[Cv1_off + 3].y = Min(fCv2[Cv1_off + 3].y, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[3]) fCv2[Cv1_off + 3].x = Max(fCv2[Cv1_off + 3].x, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[3]) fCv2[Cv1_off + 3].y = Max(fCv2[Cv1_off + 3].y, _clip_min); \ } \ } ////////////////////////////////////////////////////// // prelu macros ////////////////////////////////////////////////////// #define FUSE_PRELU_1x1_V1(_has_prelu, _prelu, _leaky) \ { \ if(_has_prelu == 1 && dCv1_x_valid[0]) \ { \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y * _leaky; \ } \ \ if(_has_prelu == 2 && dCv1_x_valid[0]) \ { \ int _scale0_v1 = ((int *) _prelu) [dCv1_idx[0]]; \ float* _hscale0 = (float *) &_scale0_v1; \ \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x * _hscale0[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y * _hscale0[1]; \ } \ \ if(_has_prelu == 3 && dCv1_x_valid[0]) \ { \ int _scale0_v1 = dCv1_y_valid[0] ? ((int *) _prelu) [dCv1_idy[0] * num_flt_v2 + dCv1_idx[0]] : 0; \ float *_hscale0 = (float *) &_scale0_v1; \ \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x * _hscale0[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y * _hscale0[1]; \ } \ } #define FUSE_PRELU_1x2_V1(_has_prelu, _prelu, _leaky) \ { \ if(_has_prelu == 1) \ { \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 1].x * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 1].y * _leaky; \ } \ \ if(_has_prelu == 2) \ { \ int _scale0_v1 = dCv1_x_valid[0] ? ((int *) _prelu) [dCv1_idx[0]] : 0; \ int _scale1_v1 = dCv1_x_valid[1] ? ((int *) _prelu) [dCv1_idx[1]] : 0; \ float * _hscale0 = (float *) &_scale0_v1; \ float * _hscale1 = (float *) &_scale1_v1; \ \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x * _hscale0[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y * _hscale0[1]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 1].x * _hscale1[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 1].y * _hscale1[1]; \ } \ \ if(_has_prelu == 3) \ { \ int _scale00_v1 = (dCv1_y_valid[0] && dCv1_x_valid[0]) ? ((int *) _prelu) [dCv1_idy[0] * num_flt_v2 + dCv1_idx[0]] : 0; \ int _scale01_v1 = (dCv1_y_valid[0] && dCv1_x_valid[1]) ? ((int *) _prelu) [dCv1_idy[0] * num_flt_v2 + dCv1_idx[1]] : 0; \ \ float * _hscale0 = (float *) &_scale00_v1; \ float * _hscale1 = (float *) &_scale01_v1; \ \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x * _hscale0[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y * _hscale0[1]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 1].x * _hscale1[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 1].y * _hscale1[1]; \ } \ } #define FUSE_PRELU_1x4_V1(_has_prelu, _prelu, _leaky) \ { \ if(_has_prelu == 1) \ { \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 1].x * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 1].y * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 2].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 2].x * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 2].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 2].y * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 3].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 3].x * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 3].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 3].y * _leaky; \ } \ \ if(_has_prelu == 2) \ { \ int _scale0_v1 = dCv1_x_valid[0] ? ((int *) _prelu) [dCv1_idx[0]] : 0; \ int _scale1_v1 = dCv1_x_valid[1] ? ((int *) _prelu) [dCv1_idx[1]] : 0; \ int _scale2_v1 = dCv1_x_valid[2] ? ((int *) _prelu) [dCv1_idx[2]] : 0; \ int _scale3_v1 = dCv1_x_valid[3] ? ((int *) _prelu) [dCv1_idx[3]] : 0; \ float * _hscale0 = (float *) &_scale0_v1; \ float * _hscale1 = (float *) &_scale1_v1; \ float * _hscale2 = (float *) &_scale2_v1; \ float * _hscale3 = (float *) &_scale3_v1; \ \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x * _hscale0[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y * _hscale0[1]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 1].x * _hscale1[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 1].y * _hscale1[1]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 2].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 2].x * _hscale2[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 2].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 2].y * _hscale2[1]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 3].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 3].x * _hscale3[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 3].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 3].y * _hscale3[1]; \ } \ \ if(_has_prelu == 3) \ { \ int _scale00_v1 = (dCv1_y_valid[0] && dCv1_x_valid[0]) ? ((int *) _prelu) [dCv1_idy[0] * num_flt_v2 + dCv1_idx[0]] : 0; \ int _scale01_v1 = (dCv1_y_valid[0] && dCv1_x_valid[1]) ? ((int *) _prelu) [dCv1_idy[0] * num_flt_v2 + dCv1_idx[1]] : 0; \ int _scale02_v1 = (dCv1_y_valid[0] && dCv1_x_valid[2]) ? ((int *) _prelu) [dCv1_idy[0] * num_flt_v2 + dCv1_idx[2]] : 0; \ int _scale03_v1 = (dCv1_y_valid[0] && dCv1_x_valid[3]) ? ((int *) _prelu) [dCv1_idy[0] * num_flt_v2 + dCv1_idx[3]] : 0; \ \ float * _hscale0 = (float *) &_scale00_v1; \ float * _hscale1 = (float *) &_scale01_v1; \ float * _hscale2 = (float *) &_scale02_v1; \ float * _hscale3 = (float *) &_scale03_v1; \ \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x * _hscale0[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y * _hscale0[1]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 1].x * _hscale1[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 1].y * _hscale1[1]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 2].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 2].x * _hscale2[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 2].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 2].y * _hscale2[1]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 3].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 3].x * _hscale3[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 3].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 3].y * _hscale3[1]; \ } \ } ////////////////////////////////////////////////////// // eltwise macros ////////////////////////////////////////////////////// #define FUSE_ELT_1x1_V1(_has_elt, _pre_data) \ { \ if(_has_elt) \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) { \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[0])*_INT16_TO_INT8_ + 0] * pre_scale; \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[0])*_INT16_TO_INT8_ + 1] * pre_scale; \ } \ } \ } #define FUSE_ELT_1x2_V1(_has_elt, _pre_data) \ { \ if(_has_elt) \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) { \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[0])*_INT16_TO_INT8_ + 0] * pre_scale; \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[0])*_INT16_TO_INT8_ + 1] * pre_scale; \ } \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) { \ fCv2[Cv1_off + 1].x = fCv2[Cv1_off + 1].x + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[1])*_INT16_TO_INT8_ + 0] * pre_scale; \ fCv2[Cv1_off + 1].y = fCv2[Cv1_off + 1].y + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[1])*_INT16_TO_INT8_ + 1] * pre_scale; \ } \ } \ } #define FUSE_ELT_1x4_V1(_has_elt, _pre_data) \ { \ if(_has_elt) \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) { \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[0])*_INT16_TO_INT8_ + 0] * pre_scale; \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[0])*_INT16_TO_INT8_ + 1] * pre_scale; \ } \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) { \ fCv2[Cv1_off + 1].x = fCv2[Cv1_off + 1].x + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[1])*_INT16_TO_INT8_ + 0] * pre_scale; \ fCv2[Cv1_off + 1].y = fCv2[Cv1_off + 1].y + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[1])*_INT16_TO_INT8_ + 1] * pre_scale; \ } \ if(dCv1_y_valid[0] && dCv1_x_valid[2]) { \ fCv2[Cv1_off + 2].x = fCv2[Cv1_off + 2].x + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[2])*_INT16_TO_INT8_ + 0] * pre_scale; \ fCv2[Cv1_off + 2].y = fCv2[Cv1_off + 2].y + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[2])*_INT16_TO_INT8_ + 1] * pre_scale; \ } \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) { \ fCv2[Cv1_off + 3].x = fCv2[Cv1_off + 3].x + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[3])*_INT16_TO_INT8_ + 0] * pre_scale; \ fCv2[Cv1_off + 3].y = fCv2[Cv1_off + 3].y + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[3])*_INT16_TO_INT8_ + 1] * pre_scale; \ } \ } \ } ////////////////////////////////////////////////////// // concat macros ////////////////////////////////////////////////////// //FIXME _INT4_TO_4HALF2_ #define SET_CONCAT_OFF_V1(_has_concat, _concat_v1_off0) \ { \ _concat_v1_off0 = dCv1_idy[0] * num_flt_v2; \ if(_has_concat) \ { \ if(dCv1_y_valid[0]) _concat_v1_off0 = concat_offset_v16 * _INT4_TO_8HALF_ + dCv1_idy[0] * concat_stride_v16 * _INT4_TO_8HALF_; \ } \ } ////////////////////////////////////////////////////// // relu macros ////////////////////////////////////////////////////// #define JIT_FUSE_RELU_1x1_V1() \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]){ \ fCv2[Cv1_off + 0].x = Max(fCv2[Cv1_off + 0].x, 0); \ fCv2[Cv1_off + 0].y = Max(fCv2[Cv1_off + 0].y, 0); \ } \ } #define JIT_FUSE_SIGMOID_1x1_V1() \ { \ float ONE = 1.f; \ \ if(dCv1_y_valid[0] && dCv1_x_valid[0]){ \ fCv2[Cv1_off + 0].x = __expf(fCv2[Cv1_off + 0].x) / (ONE + __expf(fCv2[Cv1_off + 0].x)); \ fCv2[Cv1_off + 0].y = __expf(fCv2[Cv1_off + 0].y) / (ONE + __expf(fCv2[Cv1_off + 0].y)); \ } \ } #define JIT_FUSE_RELU_1x2_V1() \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]){ \ fCv2[Cv1_off + 0].x = Max(fCv2[Cv1_off + 0].x, 0); \ fCv2[Cv1_off + 0].y = Max(fCv2[Cv1_off + 0].y, 0); \ } \ if(dCv1_y_valid[0] && dCv1_x_valid[1]){ \ fCv2[Cv1_off + 1].x = Max(fCv2[Cv1_off + 1].x, 0); \ fCv2[Cv1_off + 1].y = Max(fCv2[Cv1_off + 1].y, 0); \ } \ } #define JIT_FUSE_SIGMOID_1x2_V1() \ { \ float ONE = 1.f; \ \ if(dCv1_y_valid[0] && dCv1_x_valid[0]){ \ fCv2[Cv1_off + 0].x = __expf(fCv2[Cv1_off + 0].x) / (ONE + __expf(fCv2[Cv1_off + 0].x)); \ fCv2[Cv1_off + 0].y = __expf(fCv2[Cv1_off + 0].y) / (ONE + __expf(fCv2[Cv1_off + 0].y)); \ } \ if(dCv1_y_valid[0] && dCv1_x_valid[1]){ \ fCv2[Cv1_off + 1].x = __expf(fCv2[Cv1_off + 1].x) / (ONE + __expf(fCv2[Cv1_off + 1].x)); \ fCv2[Cv1_off + 1].y = __expf(fCv2[Cv1_off + 1].y) / (ONE + __expf(fCv2[Cv1_off + 1].y)); \ } \ } #define JIT_FUSE_RELU_1x4_V1() \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]){ \ fCv2[Cv1_off + 0].x = Max(fCv2[Cv1_off + 0].x, 0); \ fCv2[Cv1_off + 0].y = Max(fCv2[Cv1_off + 0].y, 0); \ } \ if(dCv1_y_valid[0] && dCv1_x_valid[1]){ \ fCv2[Cv1_off + 1].x = Max(fCv2[Cv1_off + 1].x, 0); \ fCv2[Cv1_off + 1].y = Max(fCv2[Cv1_off + 1].y, 0); \ } \ if(dCv1_y_valid[0] && dCv1_x_valid[2]){ \ fCv2[Cv1_off + 2].x = Max(fCv2[Cv1_off + 2].x, 0); \ fCv2[Cv1_off + 2].y = Max(fCv2[Cv1_off + 2].y, 0); \ } \ if(dCv1_y_valid[0] && dCv1_x_valid[3]){ \ fCv2[Cv1_off + 3].x = Max(fCv2[Cv1_off + 3].x, 0); \ fCv2[Cv1_off + 3].y = Max(fCv2[Cv1_off + 3].y, 0); \ } \ } #define JIT_FUSE_SIGMOID_1x4_V1() \ { \ float ONE = 1.f; \ \ if(dCv1_y_valid[0] && dCv1_x_valid[0]){ \ fCv2[Cv1_off + 0].x = __expf(fCv2[Cv1_off + 0].x) / (ONE + __expf(fCv2[Cv1_off + 0].x)); \ fCv2[Cv1_off + 0].y = __expf(fCv2[Cv1_off + 0].y) / (ONE + __expf(fCv2[Cv1_off + 0].y)); \ } \ \ if(dCv1_y_valid[0] && dCv1_x_valid[1]){ \ fCv2[Cv1_off + 1].x = __expf(fCv2[Cv1_off + 1].x) / (ONE + __expf(fCv2[Cv1_off + 1].x)); \ fCv2[Cv1_off + 1].y = __expf(fCv2[Cv1_off + 1].y) / (ONE + __expf(fCv2[Cv1_off + 1].y)); \ } \ \ if(dCv1_y_valid[0] && dCv1_x_valid[2]){ \ fCv2[Cv1_off + 2].x = __expf(fCv2[Cv1_off + 2].x) / (ONE + __expf(fCv2[Cv1_off + 2].x)); \ fCv2[Cv1_off + 2].y = __expf(fCv2[Cv1_off + 2].y) / (ONE + __expf(fCv2[Cv1_off + 2].y)); \ } \ \ if(dCv1_y_valid[0] && dCv1_x_valid[3]){ \ fCv2[Cv1_off + 3].x = __expf(fCv2[Cv1_off + 3].x) / (ONE + __expf(fCv2[Cv1_off + 3].x)); \ fCv2[Cv1_off + 3].y = __expf(fCv2[Cv1_off + 3].y) / (ONE + __expf(fCv2[Cv1_off + 3].y)); \ } \ } ////////////////////////////////////////////////////// // clip macros ////////////////////////////////////////////////////// #define JIT_FUSE_CLIP_1x1_V1(_clip_max, _clip_min) \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].x = Min(fCv2[Cv1_off + 0].x, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].y = Min(fCv2[Cv1_off + 0].y, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].x = Max(fCv2[Cv1_off + 0].x, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].y = Max(fCv2[Cv1_off + 0].y, _clip_min); \ } #define JIT_FUSE_CLIP_1x2_V1(_clip_max, _clip_min) \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].x = Min(fCv2[Cv1_off + 0].x, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].y = Min(fCv2[Cv1_off + 0].y, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].x = Max(fCv2[Cv1_off + 0].x, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].y = Max(fCv2[Cv1_off + 0].y, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) fCv2[Cv1_off + 1].x = Min(fCv2[Cv1_off + 1].x, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) fCv2[Cv1_off + 1].y = Min(fCv2[Cv1_off + 1].y, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) fCv2[Cv1_off + 1].x = Max(fCv2[Cv1_off + 1].x, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) fCv2[Cv1_off + 1].y = Max(fCv2[Cv1_off + 1].y, _clip_min); \ } #define JIT_FUSE_CLIP_1x4_V1(_clip_max, _clip_min) \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].x = Min(fCv2[Cv1_off + 0].x, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].y = Min(fCv2[Cv1_off + 0].y, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].x = Max(fCv2[Cv1_off + 0].x, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) fCv2[Cv1_off + 0].y = Max(fCv2[Cv1_off + 0].y, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) fCv2[Cv1_off + 1].x = Min(fCv2[Cv1_off + 1].x, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) fCv2[Cv1_off + 1].y = Min(fCv2[Cv1_off + 1].y, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) fCv2[Cv1_off + 1].x = Max(fCv2[Cv1_off + 1].x, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) fCv2[Cv1_off + 1].y = Max(fCv2[Cv1_off + 1].y, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[2]) fCv2[Cv1_off + 2].x = Min(fCv2[Cv1_off + 2].x, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[2]) fCv2[Cv1_off + 2].y = Min(fCv2[Cv1_off + 2].y, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[2]) fCv2[Cv1_off + 2].x = Max(fCv2[Cv1_off + 2].x, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[2]) fCv2[Cv1_off + 2].y = Max(fCv2[Cv1_off + 2].y, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[3]) fCv2[Cv1_off + 3].x = Min(fCv2[Cv1_off + 3].x, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[3]) fCv2[Cv1_off + 3].y = Min(fCv2[Cv1_off + 3].y, _clip_max); \ if(dCv1_y_valid[0] && dCv1_x_valid[3]) fCv2[Cv1_off + 3].x = Max(fCv2[Cv1_off + 3].x, _clip_min); \ if(dCv1_y_valid[0] && dCv1_x_valid[3]) fCv2[Cv1_off + 3].y = Max(fCv2[Cv1_off + 3].y, _clip_min); \ } ////////////////////////////////////////////////////// // prelu macros ////////////////////////////////////////////////////// #define JIT_FUSE_LEAKY_1x1_V1(_leaky) \ { \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y * _leaky; \ } #define JIT_FUSE_PRELU_1x1_V1(_has_prelu, _prelu) \ { \ if(_has_prelu == 2 && dCv1_x_valid[0]) \ { \ int _scale0_v1 = ((int *) _prelu) [dCv1_idx[0]]; \ float* _hscale0 = (float *) &_scale0_v1; \ \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x * _hscale0[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y * _hscale0[1]; \ } \ \ if(_has_prelu == 3 && dCv1_x_valid[0]) \ { \ int _scale0_v1 = dCv1_y_valid[0] ? ((int *) _prelu) [dCv1_idy[0] * num_flt_v2 + dCv1_idx[0]] : 0; \ float *_hscale0 = (float *) &_scale0_v1; \ \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x * _hscale0[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y * _hscale0[1]; \ } \ } #define JIT_FUSE_LEAKY_1x2_V1(_leaky) \ { \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 1].x * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 1].y * _leaky; \ } #define JIT_FUSE_PRELU_1x2_V1(_has_prelu, _prelu) \ { \ if(_has_prelu == 2) \ { \ int _scale0_v1 = dCv1_x_valid[0] ? ((int *) _prelu) [dCv1_idx[0]] : 0; \ int _scale1_v1 = dCv1_x_valid[1] ? ((int *) _prelu) [dCv1_idx[1]] : 0; \ float * _hscale0 = (float *) &_scale0_v1; \ float * _hscale1 = (float *) &_scale1_v1; \ \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x * _hscale0[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y * _hscale0[1]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 1].x * _hscale1[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 1].y * _hscale1[1]; \ } \ \ if(_has_prelu == 3) \ { \ int _scale00_v1 = (dCv1_y_valid[0] && dCv1_x_valid[0]) ? ((int *) _prelu) [dCv1_idy[0] * num_flt_v2 + dCv1_idx[0]] : 0; \ int _scale01_v1 = (dCv1_y_valid[0] && dCv1_x_valid[1]) ? ((int *) _prelu) [dCv1_idy[0] * num_flt_v2 + dCv1_idx[1]] : 0; \ \ float * _hscale0 = (float *) &_scale00_v1; \ float * _hscale1 = (float *) &_scale01_v1; \ \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x * _hscale0[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y * _hscale0[1]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 1].x * _hscale1[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 1].y * _hscale1[1]; \ } \ } #define JIT_FUSE_LEAKY_1x4_V1(_leaky) \ { \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 1].x * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 1].y * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 2].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 2].x * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 2].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 2].y * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 3].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 3].x * _leaky; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 3].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 3].y * _leaky; \ } #define JIT_FUSE_PRELU_1x4_V1(_has_prelu, _prelu) \ {\ if(_has_prelu == 2) \ { \ int _scale0_v1 = dCv1_x_valid[0] ? ((int *) _prelu) [dCv1_idx[0]] : 0; \ int _scale1_v1 = dCv1_x_valid[1] ? ((int *) _prelu) [dCv1_idx[1]] : 0; \ int _scale2_v1 = dCv1_x_valid[2] ? ((int *) _prelu) [dCv1_idx[2]] : 0; \ int _scale3_v1 = dCv1_x_valid[3] ? ((int *) _prelu) [dCv1_idx[3]] : 0; \ float * _hscale0 = (float *) &_scale0_v1; \ float * _hscale1 = (float *) &_scale1_v1; \ float * _hscale2 = (float *) &_scale2_v1; \ float * _hscale3 = (float *) &_scale3_v1; \ \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x * _hscale0[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y * _hscale0[1]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 1].x * _hscale1[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 1].y * _hscale1[1]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 2].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 2].x * _hscale2[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 2].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 2].y * _hscale2[1]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 3].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 3].x * _hscale3[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 3].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 3].y * _hscale3[1]; \ } \ \ if(_has_prelu == 3) \ { \ int _scale00_v1 = (dCv1_y_valid[0] && dCv1_x_valid[0]) ? ((int *) _prelu) [dCv1_idy[0] * num_flt_v2 + dCv1_idx[0]] : 0; \ int _scale01_v1 = (dCv1_y_valid[0] && dCv1_x_valid[1]) ? ((int *) _prelu) [dCv1_idy[0] * num_flt_v2 + dCv1_idx[1]] : 0; \ int _scale02_v1 = (dCv1_y_valid[0] && dCv1_x_valid[2]) ? ((int *) _prelu) [dCv1_idy[0] * num_flt_v2 + dCv1_idx[2]] : 0; \ int _scale03_v1 = (dCv1_y_valid[0] && dCv1_x_valid[3]) ? ((int *) _prelu) [dCv1_idy[0] * num_flt_v2 + dCv1_idx[3]] : 0; \ \ float * _hscale0 = (float *) &_scale00_v1; \ float * _hscale1 = (float *) &_scale01_v1; \ float * _hscale2 = (float *) &_scale02_v1; \ float * _hscale3 = (float *) &_scale03_v1; \ \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x * _hscale0[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 0].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y * _hscale0[1]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 1].x * _hscale1[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 1].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 1].y * _hscale1[1]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 2].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 2].x * _hscale2[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 2].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 2].y * _hscale2[1]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 3].x < 0) \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 3].x * _hscale3[0]; \ if(dCv1_y_valid[0] && fCv2[Cv1_off + 3].y < 0) \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 3].y * _hscale3[1]; \ } \ } ////////////////////////////////////////////////////// // eltwise macros ////////////////////////////////////////////////////// #define JIT_FUSE_ELT_1x1_V1( _pre_data) \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) { \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[0])*_INT16_TO_INT8_ + 0] * pre_scale; \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[0])*_INT16_TO_INT8_ + 1] * pre_scale; \ } \ } #define JIT_FUSE_ELT_1x2_V1(_pre_data) \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) { \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[0])*_INT16_TO_INT8_ + 0] * pre_scale; \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[0])*_INT16_TO_INT8_ + 1] * pre_scale; \ } \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) { \ fCv2[Cv1_off + 1].x = fCv2[Cv1_off + 1].x + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[1])*_INT16_TO_INT8_ + 0] * pre_scale; \ fCv2[Cv1_off + 1].y = fCv2[Cv1_off + 1].y + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[1])*_INT16_TO_INT8_ + 1] * pre_scale; \ } \ } #define JIT_FUSE_ELT_1x4_V1(_pre_data) \ { \ if(dCv1_y_valid[0] && dCv1_x_valid[0]) { \ fCv2[Cv1_off + 0].x = fCv2[Cv1_off + 0].x + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[0])*_INT16_TO_INT8_ + 0] * pre_scale; \ fCv2[Cv1_off + 0].y = fCv2[Cv1_off + 0].y + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[0])*_INT16_TO_INT8_ + 1] * pre_scale; \ } \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) { \ fCv2[Cv1_off + 1].x = fCv2[Cv1_off + 1].x + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[1])*_INT16_TO_INT8_ + 0] * pre_scale; \ fCv2[Cv1_off + 1].y = fCv2[Cv1_off + 1].y + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[1])*_INT16_TO_INT8_ + 1] * pre_scale; \ } \ if(dCv1_y_valid[0] && dCv1_x_valid[2]) { \ fCv2[Cv1_off + 2].x = fCv2[Cv1_off + 2].x + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[2])*_INT16_TO_INT8_ + 0] * pre_scale; \ fCv2[Cv1_off + 2].y = fCv2[Cv1_off + 2].y + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[2])*_INT16_TO_INT8_ + 1] * pre_scale; \ } \ if(dCv1_y_valid[0] && dCv1_x_valid[1]) { \ fCv2[Cv1_off + 3].x = fCv2[Cv1_off + 3].x + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[3])*_INT16_TO_INT8_ + 0] * pre_scale; \ fCv2[Cv1_off + 3].y = fCv2[Cv1_off + 3].y + (int)((int8_t*) _pre_data) [(dCv1_idy[0] * num_flt_v2 + dCv1_idx[3])*_INT16_TO_INT8_ + 1] * pre_scale; \ } \ } ////////////////////////////////////////////////////// // concat macros ////////////////////////////////////////////////////// //FIXME _INT4_TO_4HALF2_ #define JIT_SET_CONCAT_OFF_V1(_concat_v1_off0) \ { \ if(dCv1_y_valid[0]) _concat_v1_off0 = concat_offset_v16 * _INT4_TO_8HALF_ + dCv1_idy[0] * concat_stride_v16 * _INT4_TO_8HALF_; \ }
31,345
1,338
<filename>src/apps/icon-o-matic/import_export/svg/DocumentBuilder.cpp /* * Copyright 2006, Haiku. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * <NAME> <<EMAIL>> */ #define NANOSVG_IMPLEMENTATION #include "DocumentBuilder.h" #include <new> #include <stdio.h> #include <Bitmap.h> #include "AutoDeleter.h" #include "GradientTransformable.h" #include "Icon.h" #include "PathContainer.h" #include "Shape.h" #include "ShapeContainer.h" #include "StrokeTransformer.h" #include "Style.h" #include "StyleContainer.h" #include "SVGImporter.h" #include "VectorPath.h" #include <agg_math_stroke.h> #include <agg_trans_affine.h> using std::nothrow; // constructor DocumentBuilder::DocumentBuilder(NSVGimage* source) : fWidth(0), fHeight(0), fViewBox(0.0, 0.0, -1.0, -1.0), fTitle(""), fSource(source) { } // SetTitle void DocumentBuilder::SetTitle(const char* title) { fTitle = title; } // SetDimensions void DocumentBuilder::SetDimensions(uint32 width, uint32 height, BRect viewBox) { fWidth = width; fHeight = height; fViewBox = viewBox; } // #pragma mark - // GetIcon status_t DocumentBuilder::GetIcon(Icon* icon, SVGImporter* importer, const char* fallbackName) { double xMin = 0; double yMin = 0; double xMax = ceil(fSource->width); double yMax = ceil(fSource->height); BRect bounds; if (fViewBox.IsValid()) { bounds = fViewBox; printf("view box: "); bounds.PrintToStream(); } else { bounds.Set(0.0, 0.0, (int32)fWidth - 1, (int32)fHeight - 1); printf("width/height: "); bounds.PrintToStream(); } BRect boundingBox(xMin, yMin, xMax, yMax); if (!bounds.IsValid() || !boundingBox.Intersects(bounds)) { bounds = boundingBox; printf("using bounding box: "); bounds.PrintToStream(); } float size = max_c(bounds.Width(), bounds.Height()); double scale = 64.0 / size; printf("scale: %f\n", scale); Transformable transform; transform.TranslateBy(BPoint(-bounds.left, -bounds.top)); transform.ScaleBy(B_ORIGIN, scale, scale); // if (fTitle.CountChars() > 0) // icon->SetName(fTitle.String()); // else // icon->SetName(fallbackName); for (NSVGshape* shape = fSource->shapes; shape != NULL; shape = shape->next) { if (shape->fill.type != NSVG_PAINT_NONE) _AddShape(shape, false, transform, icon); if (shape->stroke.type != NSVG_PAINT_NONE) _AddShape(shape, true, transform, icon); } // clean up styles and paths (remove duplicates) int32 count = icon->Shapes()->CountShapes(); for (int32 i = 1; i < count; i++) { Shape* shape = icon->Shapes()->ShapeAtFast(i); Style* style = shape->Style(); if (!style) continue; int32 styleIndex = icon->Styles()->IndexOf(style); for (int32 j = 0; j < styleIndex; j++) { Style* earlierStyle = icon->Styles()->StyleAtFast(j); if (*style == *earlierStyle) { shape->SetStyle(earlierStyle); icon->Styles()->RemoveStyle(style); style->ReleaseReference(); break; } } } return B_OK; } // AddVertexSource status_t AddPathsFromVertexSource(Icon* icon, Shape* shape, NSVGshape* svgShape) { //printf("AddPathsFromVertexSource(pathID = %ld)\n", index); for (NSVGpath* svgPath = svgShape->paths; svgPath != NULL; svgPath = svgPath->next) { VectorPath* path = new (nothrow) VectorPath(); if (!path || !icon->Paths()->AddPath(path)) { delete path; return B_NO_MEMORY; } if (!shape->Paths()->AddPath(path)) return B_NO_MEMORY; path->SetClosed(svgPath->closed); int pointCount = svgPath->npts; float* points = svgPath->pts; // First entry in the points list is always a "move" to the path // starting point if (!path->AddPoint(BPoint(points[0], points[1]))) return B_NO_MEMORY; path->SetInOutConnected(path->CountPoints() - 1, false); pointCount--; points += 2; while (pointCount > 0) { BPoint vector1(points[0], points[1]); BPoint vector2(points[2], points[3]); BPoint endPoint(points[4], points[5]); if (!path->AddPoint(endPoint)) return B_NO_MEMORY; int32 start = path->CountPoints() - 2; int32 end = path->CountPoints() - 1; path->SetInOutConnected(end, false); path->SetPointOut(start, vector1); path->SetPointIn(end, vector2); pointCount -= 3; points += 6; } } // FIXME handle closed vs open paths return B_OK; } // _AddShape status_t DocumentBuilder::_AddShape(NSVGshape* svgShape, bool outline, const Transformable& transform, Icon* icon) { Shape* shape = new (nothrow) Shape(NULL); if (!shape || !icon->Shapes()->AddShape(shape)) { delete shape; return B_NO_MEMORY; } if (AddPathsFromVertexSource(icon, shape, svgShape) < B_OK) printf("failed to convert from vertex source\n"); shape->SetName(svgShape->id); shape->Multiply(transform); StrokeTransformer* stroke = NULL; NSVGpaint* paint = NULL; if (outline) { stroke = new (nothrow) StrokeTransformer(shape->VertexSource()); paint = &svgShape->stroke; if (stroke) { stroke->width(svgShape->strokeWidth); switch(svgShape->strokeLineCap) { case NSVG_CAP_BUTT: stroke->line_cap(agg::butt_cap); break; case NSVG_CAP_ROUND: stroke->line_cap(agg::round_cap); break; case NSVG_CAP_SQUARE: stroke->line_cap(agg::square_cap); break; } switch(svgShape->strokeLineJoin) { case NSVG_JOIN_MITER: stroke->line_join(agg::miter_join); break; case NSVG_JOIN_ROUND: stroke->line_join(agg::round_join); break; case NSVG_JOIN_BEVEL: stroke->line_join(agg::bevel_join); break; } } if (!shape->AddTransformer(stroke)) { delete stroke; stroke = NULL; } } else { paint = &svgShape->fill; #if 0 // FIXME filling rule are missing from Shape class if (svgShape->fillRule == NSVG_FILLRULE_EVENODD) shape->SetFillingRule(FILL_MODE_EVEN_ODD); else shape->SetFillingRule(FILL_MODE_NON_ZERO); #endif } Gradient gradient(true); rgb_color color; switch(paint->type) { case NSVG_PAINT_COLOR: color.red = paint->color & 0xFF; color.green = (paint->color >> 8) & 0xFF; color.blue = (paint->color >> 16) & 0xFF; color.alpha = (paint->color >> 24) & 0xFF; break; case NSVG_PAINT_LINEAR_GRADIENT: { gradient.SetType(GRADIENT_LINEAR); // The base gradient axis in Icon-O-Matic is a horizontal line from // (-64, 0) to (64, 0). The base gradient axis used by nanosvg is // a vertical line from (0, 0) to (0, 1). This initial transform // converts from one space to the other. agg::trans_affine baseTransform(0, 1.0/128.0, -1.0/128.0, 0, -0.5, 0.5); gradient.multiply(baseTransform); break; } case NSVG_PAINT_RADIAL_GRADIENT: { gradient.SetType(GRADIENT_CIRCULAR); agg::trans_affine baseTransform(0, 1.0/64.0, -1.0/64.0, 0, 0, 0); gradient.multiply(baseTransform); break; } } if (paint->type != NSVG_PAINT_COLOR) { gradient.SetInterpolation(INTERPOLATION_LINEAR); agg::trans_affine gradientTransform( paint->gradient->xform[0], paint->gradient->xform[1], paint->gradient->xform[2], paint->gradient->xform[3], paint->gradient->xform[4], paint->gradient->xform[5] ); // The transform from nanosvg converts a screen space coordinate into // a gradient offset. It is the inverse of what we need at this stage, // so we just invert it and multiply our base transform with it. gradient.multiply_inv(gradientTransform); // Finally, scale the gradient according to the global scaling to fit // the 64x64 box we work in. gradient.Multiply(*shape); for (int i = 0; i < paint->gradient->nstops; i++) { rgb_color stopColor; stopColor.red = paint->gradient->stops[i].color & 0xFF; stopColor.green = (paint->gradient->stops[i].color >> 8) & 0xFF; stopColor.blue = (paint->gradient->stops[i].color >> 16) & 0xFF; stopColor.alpha = (paint->gradient->stops[i].color >> 24) & 0xFF; gradient.AddColor(stopColor, paint->gradient->stops[i].offset); } BGradient::ColorStop* step = gradient.ColorAt(0); if (step) { color.red = step->color.red; color.green = step->color.green; color.blue = step->color.blue; color.alpha = step->color.alpha; } } color.alpha = (uint8)(color.alpha * svgShape->opacity); Style* style = new (nothrow) Style(color); if (!style || !icon->Styles()->AddStyle(style)) { delete style; return B_NO_MEMORY; } // NOTE: quick hack to freeze all transformations (only works because // paths and styles are not used by multiple shapes!!) int32 pathCount = shape->Paths()->CountPaths(); for (int32 i = 0; i < pathCount; i++) { VectorPath* path = shape->Paths()->PathAtFast(i); path->ApplyTransform(*shape); } if (stroke) stroke->width(stroke->width() * shape->scale()); if (paint->type != NSVG_PAINT_COLOR) style->SetGradient(&gradient); shape->Reset(); shape->SetStyle(style); return B_OK; }
3,560
2,757
/***********************************************************************/ /* Implements the string (as opposed to unicode) version of the built-in formatters for string, int, float. That is, the versions of int.__format__, etc., that take and return string objects */ #include "Python.h" #include "../Objects/stringlib/stringdefs.h" #define FORMAT_STRING _PyBytes_FormatAdvanced #define FORMAT_LONG _PyLong_FormatAdvanced #define FORMAT_INT _PyInt_FormatAdvanced #define FORMAT_FLOAT _PyFloat_FormatAdvanced #ifndef WITHOUT_COMPLEX #define FORMAT_COMPLEX _PyComplex_FormatAdvanced #endif #include "../Objects/stringlib/formatter.h"
218
988
/* * 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. */ package org.netbeans.modules.java.lsp.server; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; import org.eclipse.lsp4j.ApplyWorkspaceEditParams; import org.eclipse.lsp4j.ApplyWorkspaceEditResponse; import org.eclipse.lsp4j.ConfigurationParams; import org.eclipse.lsp4j.MessageActionItem; import org.eclipse.lsp4j.MessageParams; import org.eclipse.lsp4j.ProgressParams; import org.eclipse.lsp4j.PublishDiagnosticsParams; import org.eclipse.lsp4j.ShowMessageRequestParams; import org.eclipse.lsp4j.WorkDoneProgressCreateParams; import org.eclipse.lsp4j.jsonrpc.messages.Either; import org.netbeans.modules.java.lsp.server.explorer.api.NodeChangedParams; import org.netbeans.modules.java.lsp.server.protocol.DecorationRenderOptions; import org.netbeans.modules.java.lsp.server.protocol.HtmlPageParams; import org.netbeans.modules.java.lsp.server.protocol.NbCodeClientCapabilities; import org.netbeans.modules.java.lsp.server.protocol.NbCodeLanguageClient; import org.netbeans.modules.java.lsp.server.input.QuickPickItem; import org.netbeans.modules.java.lsp.server.protocol.SetTextEditorDecorationParams; import org.netbeans.modules.java.lsp.server.input.ShowInputBoxParams; import org.netbeans.modules.java.lsp.server.input.ShowMutliStepInputParams; import org.netbeans.modules.java.lsp.server.input.ShowQuickPickParams; import org.netbeans.modules.java.lsp.server.protocol.ShowStatusMessageParams; import org.netbeans.modules.java.lsp.server.protocol.TestProgressParams; import org.netbeans.modules.java.lsp.server.protocol.UpdateConfigParams; public abstract class TestCodeLanguageClient implements NbCodeLanguageClient { @Override public CompletableFuture<Void> createProgress(WorkDoneProgressCreateParams params) { return CompletableFuture.completedFuture(null); } @Override public void notifyProgress(ProgressParams params) { } @Override public CompletableFuture<ApplyWorkspaceEditResponse> applyEdit(ApplyWorkspaceEditParams params) { throw new UnsupportedOperationException(); } @Override public CompletableFuture<List<Object>> configuration(ConfigurationParams params) { return CompletableFuture.completedFuture(Collections.emptyList()); } @Override public void showStatusBarMessage(ShowStatusMessageParams params) { throw new UnsupportedOperationException(); } @Override public CompletableFuture<String> showHtmlPage(HtmlPageParams params) { throw new UnsupportedOperationException(); } @Override public CompletableFuture<List<QuickPickItem>> showQuickPick(ShowQuickPickParams params) { return CompletableFuture.completedFuture(params.getItems().stream().filter(item -> item.isPicked()).collect(Collectors.toList())); } @Override public CompletableFuture<String> showInputBox(ShowInputBoxParams params) { throw new UnsupportedOperationException(); } @Override public CompletableFuture<Map<String, Either<List<QuickPickItem>, String>>> showMultiStepInput(ShowMutliStepInputParams params) { throw new UnsupportedOperationException(); } @Override public void notifyTestProgress(TestProgressParams params) { throw new UnsupportedOperationException(); } @Override public CompletableFuture<String> createTextEditorDecoration(DecorationRenderOptions params) { throw new UnsupportedOperationException(); } @Override public void setTextEditorDecoration(SetTextEditorDecorationParams params) { throw new UnsupportedOperationException(); } @Override public void disposeTextEditorDecoration(String params) { throw new UnsupportedOperationException(); } @Override public NbCodeClientCapabilities getNbCodeCapabilities() { throw new UnsupportedOperationException(); } @Override public void telemetryEvent(Object params) { throw new UnsupportedOperationException(); } @Override public void publishDiagnostics(PublishDiagnosticsParams params) { } @Override public void showMessage(MessageParams params) { } @Override public CompletableFuture<MessageActionItem> showMessageRequest(ShowMessageRequestParams params) { throw new UnsupportedOperationException(); } @Override public void logMessage(MessageParams params) { throw new UnsupportedOperationException(); } @Override public void notifyNodeChange(NodeChangedParams params) { throw new UnsupportedOperationException(); } @Override public CompletableFuture<Void> configurationUpdate(UpdateConfigParams params) { throw new UnsupportedOperationException(); } }
1,787
348
{"nom":"Vennecy","circ":"5ème circonscription","dpt":"Loiret","inscrits":1239,"abs":708,"votants":531,"blancs":39,"nuls":11,"exp":481,"res":[{"nuance":"REM","nom":"<NAME>","voix":293},{"nuance":"LR","nom":"Mme <NAME>","voix":188}]}
93
1,909
package org.knowm.xchange.coinbase.v2.dto.account.transactions; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; @Getter public class CoinbaseBuySellResourceField { protected String id; protected String resource; protected String resourcePath; public CoinbaseBuySellResourceField( @JsonProperty("id") String id, @JsonProperty("resource") String resource, @JsonProperty("resource_path") String resourcePath) { this.id = id; this.resource = resource; this.resourcePath = resourcePath; } @Override public String toString() { return "{" + "\"id\":" + '\"' + id + '\"' + ",\"resource\":" + '\"' + resource + '\"' + ",\"resourcePath\":" + '\"' + resourcePath + '\"' + '}'; } }
365
683
/* * Copyright The OpenTelemetry Authors * SPDX-License-Identifier: Apache-2.0 */ package io.opentelemetry.javaagent.tooling.field; import static io.opentelemetry.javaagent.tooling.field.GeneratedVirtualFieldNames.getRealFieldName; import static io.opentelemetry.javaagent.tooling.field.GeneratedVirtualFieldNames.getRealGetterName; import static io.opentelemetry.javaagent.tooling.field.GeneratedVirtualFieldNames.getRealSetterName; import io.opentelemetry.javaagent.bootstrap.VirtualFieldInstalledMarker; import io.opentelemetry.javaagent.tooling.Utils; import java.util.Arrays; import java.util.LinkedHashSet; import java.util.Set; import net.bytebuddy.asm.AsmVisitorWrapper; import net.bytebuddy.description.field.FieldDescription; import net.bytebuddy.description.field.FieldList; import net.bytebuddy.description.method.MethodList; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.implementation.Implementation; import net.bytebuddy.jar.asm.ClassVisitor; import net.bytebuddy.jar.asm.ClassWriter; import net.bytebuddy.jar.asm.FieldVisitor; import net.bytebuddy.jar.asm.MethodVisitor; import net.bytebuddy.jar.asm.Opcodes; import net.bytebuddy.pool.TypePool; final class RealFieldInjector implements AsmVisitorWrapper { private static final String INSTALLED_FIELDS_MARKER_CLASS_NAME = Utils.getInternalName(VirtualFieldInstalledMarker.class); private final FieldAccessorInterfaces fieldAccessorInterfaces; private final String typeName; private final String fieldTypeName; RealFieldInjector( FieldAccessorInterfaces fieldAccessorInterfaces, String typeName, String fieldTypeName) { this.fieldAccessorInterfaces = fieldAccessorInterfaces; this.typeName = typeName; this.fieldTypeName = fieldTypeName; } @Override public int mergeWriter(int flags) { return flags | ClassWriter.COMPUTE_MAXS; } @Override public int mergeReader(int flags) { return flags; } @Override public ClassVisitor wrap( TypeDescription instrumentedType, ClassVisitor classVisitor, Implementation.Context implementationContext, TypePool typePool, FieldList<FieldDescription.InDefinedShape> fields, MethodList<?> methods, int writerFlags, int readerFlags) { return new ClassVisitor(Opcodes.ASM7, classVisitor) { // We are using Object class name instead of fieldTypeName here because this gets // injected onto Bootstrap classloader where context class may be unavailable private final TypeDescription fieldType = TypeDescription.OBJECT; private final String fieldName = getRealFieldName(typeName, fieldTypeName); private final String getterMethodName = getRealGetterName(typeName, fieldTypeName); private final String setterMethodName = getRealSetterName(typeName, fieldTypeName); private final TypeDescription interfaceType = fieldAccessorInterfaces.find(typeName, fieldTypeName); private boolean foundField = false; private boolean foundGetter = false; private boolean foundSetter = false; @Override public void visit( int version, int access, String name, String signature, String superName, String[] interfaces) { if (interfaces == null) { interfaces = new String[] {}; } Set<String> set = new LinkedHashSet<>(Arrays.asList(interfaces)); set.add(INSTALLED_FIELDS_MARKER_CLASS_NAME); set.add(interfaceType.getInternalName()); super.visit(version, access, name, signature, superName, set.toArray(new String[] {})); } @Override public FieldVisitor visitField( int access, String name, String descriptor, String signature, Object value) { if (name.equals(fieldName)) { foundField = true; } return super.visitField(access, name, descriptor, signature, value); } @Override public MethodVisitor visitMethod( int access, String name, String descriptor, String signature, String[] exceptions) { if (name.equals(getterMethodName)) { foundGetter = true; } if (name.equals(setterMethodName)) { foundSetter = true; } return super.visitMethod(access, name, descriptor, signature, exceptions); } @Override public void visitEnd() { // Checking only for field existence is not enough as libraries like CGLIB only copy // public/protected methods and not fields (neither public nor private ones) when // they enhance a class. // For this reason we check separately for the field and for the two accessors. if (!foundField) { cv.visitField( // Field should be transient to avoid being serialized with the object. Opcodes.ACC_PRIVATE | Opcodes.ACC_VOLATILE | Opcodes.ACC_TRANSIENT | Opcodes.ACC_SYNTHETIC, fieldName, fieldType.getDescriptor(), null, null); } if (!foundGetter) { addGetter(); } if (!foundSetter) { addSetter(); } super.visitEnd(); } // just 'standard' getter implementation private void addGetter() { MethodVisitor mv = getAccessorMethodVisitor(getterMethodName); mv.visitCode(); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitFieldInsn( Opcodes.GETFIELD, instrumentedType.getInternalName(), fieldName, fieldType.getDescriptor()); mv.visitInsn(Opcodes.ARETURN); mv.visitMaxs(0, 0); mv.visitEnd(); } // just 'standard' setter implementation private void addSetter() { MethodVisitor mv = getAccessorMethodVisitor(setterMethodName); mv.visitCode(); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitVarInsn(Opcodes.ALOAD, 1); mv.visitFieldInsn( Opcodes.PUTFIELD, instrumentedType.getInternalName(), fieldName, fieldType.getDescriptor()); mv.visitInsn(Opcodes.RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); } private MethodVisitor getAccessorMethodVisitor(String methodName) { return cv.visitMethod( Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC, methodName, Utils.getMethodDefinition(interfaceType, methodName).getDescriptor(), null, null); } }; } }
2,663
335
<filename>A/Appeasement_noun.json { "word": "Appeasement", "definitions": [ "The action or process of appeasing." ], "parts-of-speech": "Noun" }
75
2,659
/* * Copyright 2021 4Paradigm * * 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. */ package com._4paradigm.openmldb.jmh.performance; import com._4paradigm.openmldb.jmh.BenchmarkConfig; import com._4paradigm.openmldb.sdk.SdkOption; import com._4paradigm.openmldb.sdk.SqlExecutor; import com._4paradigm.openmldb.sdk.impl.SqlClusterExecutor; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.runner.RunnerException; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Timestamp; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; @BenchmarkMode(Mode.Throughput) @OutputTimeUnit(TimeUnit.SECONDS) @State(Scope.Benchmark) @Threads(1) @Fork(value = 1, jvmArgs = {"-Xms4G", "-Xmx4G"}) @Warmup(iterations = 1) public class FESQLRedisWorkloadBenchmark { private AtomicLong counter = new AtomicLong(0l); private SqlExecutor executor; private SdkOption option; private String db = "db_insert_benchmark" + System.currentTimeMillis(); private int recordSize = 10000; private String ddl100; private String ddl100Insert; private String ddl200; private String ddl200Insert; private String ddl500; private String ddl500Insert; private String query100 = "select * from ddl100 where col98='100_key';"; private String query200 = "select * from ddl200 where col198='200_key';"; private String query500 = "select * from ddl500 where col498='500_key';"; public FESQLRedisWorkloadBenchmark() { SdkOption sdkOption = new SdkOption(); sdkOption.setSessionTimeout(30000); sdkOption.setZkCluster(BenchmarkConfig.ZK_CLUSTER); sdkOption.setZkPath(BenchmarkConfig.ZK_PATH); this.option = sdkOption; try { executor = new SqlClusterExecutor(option); } catch (Exception e) { e.printStackTrace(); } } @Setup public void setup() throws SQLException { boolean setupOk = executor.createDB(db); if (!setupOk) { return; } StringBuilder ddl100Builder = new StringBuilder(); StringBuilder ddl100InsertBuilder = new StringBuilder(); ddl100InsertBuilder.append("insert into ddl100 values("); ddl100Builder.append("create table ddl100("); for (int i = 0; i < 99; i++) { if (i > 0) { ddl100Builder.append(","); ddl100InsertBuilder.append(","); } ddl100Builder.append("col" + String.valueOf(i) + " string"); ddl100InsertBuilder.append("?"); } ddl100Builder.append(", col99 timestamp, index(key=col98, ts=col99)) partitionnum=8;"); ddl100InsertBuilder.append(", ?);"); ddl100 = ddl100Builder.toString(); ddl100Insert = ddl100InsertBuilder.toString(); setupOk = executor.executeDDL(db, ddl100); if (!setupOk) { return; } { StringBuilder ddl200Builder = new StringBuilder(); StringBuilder ddl200InsertBuilder = new StringBuilder(); ddl200InsertBuilder.append("insert into ddl200 values("); ddl200Builder.append("create table ddl200("); for (int i = 0; i < 199; i++) { if (i > 0) { ddl200Builder.append(","); ddl200InsertBuilder.append(","); } ddl200Builder.append("col" + String.valueOf(i) + " string"); ddl200InsertBuilder.append("?"); } ddl200Builder.append(", col199 timestamp, index(key=col198, ts=col199));"); ddl200InsertBuilder.append(", ?);"); ddl200 = ddl200Builder.toString(); ddl200Insert = ddl200InsertBuilder.toString(); setupOk = executor.executeDDL(db, ddl200); if (!setupOk) { return; } } { StringBuilder ddl500Builder = new StringBuilder(); StringBuilder ddl500InsertBuilder = new StringBuilder(); ddl500InsertBuilder.append("insert into ddl500 values("); ddl500Builder.append("create table ddl500("); for (int i = 0; i < 499; i++) { if (i > 0) { ddl500Builder.append(","); ddl500InsertBuilder.append(","); } ddl500Builder.append("col" + String.valueOf(i) + " string"); ddl500InsertBuilder.append("?"); } ddl500Builder.append(", col499 timestamp, index(key=col498, ts=col499));"); ddl500InsertBuilder.append(", ?);"); ddl500 = ddl500Builder.toString(); ddl500Insert = ddl500InsertBuilder.toString(); setupOk = executor.executeDDL(db, ddl500); if (!setupOk) { return; } } { String key = "100_key"; PreparedStatement impl = executor.getInsertPreparedStmt(db, ddl100Insert); try { for (int i = 0; i < 98; i++) { impl.setString(i+1, "value10000000000"); } impl.setString(99, key); impl.setTimestamp(100, new Timestamp(System.currentTimeMillis())); impl.execute(); } catch (Exception e) { e.printStackTrace(); } } { String key = "200_key"; PreparedStatement impl = executor.getInsertPreparedStmt(db, ddl200Insert); try { for (int i = 0; i < 198; i++) { impl.setString(i+1, "value10000000000"); } impl.setString(199, key); impl.setTimestamp(200, new Timestamp(System.currentTimeMillis())); impl.execute(); } catch (Exception e) { e.printStackTrace(); } } { String key = "500_key"; PreparedStatement impl = executor.getInsertPreparedStmt(db, ddl500Insert); try { for (int i = 0; i < 498; i++) { impl.setString(i+1, "value10000000000"); } impl.setString(499, key); impl.setTimestamp(500, new Timestamp(System.currentTimeMillis())); impl.execute(); } catch (Exception e) { e.printStackTrace(); } } try { Thread.sleep(2000); } catch (Exception e) { } } @Benchmark public void read100bm() { executor.executeSQL(db, query100); } @Benchmark public void read200bm() { executor.executeSQL(db, query200); } @Benchmark public void read500bm() { executor.executeSQL(db, query500); } @Benchmark public void insert100Bm() { String key = "100_"+ String.valueOf(counter.incrementAndGet()); try { PreparedStatement impl = executor.getInsertPreparedStmt(db, ddl100Insert); for (int i = 0; i < 98; i++) { impl.setString(i+1, "value10000000000"); } impl.setString(99, key); impl.setTimestamp(100, new Timestamp(System.currentTimeMillis())); impl.execute(); } catch (Exception e) { e.printStackTrace(); } } @Benchmark public void insert500Bm() { String key = "500_"+ String.valueOf(counter.incrementAndGet()); try { PreparedStatement impl = executor.getInsertPreparedStmt(db, ddl500Insert); for (int i = 0; i < 498; i++) { impl.setString(i+1, "value10000000000"); } impl.setString(499, key); impl.setTimestamp(500, new Timestamp(System.currentTimeMillis())); impl.execute(); } catch (Exception e) { e.printStackTrace(); } } @Benchmark public void insert200Bm() { String key = "200_"+ String.valueOf(counter.incrementAndGet()); try { PreparedStatement impl = executor.getInsertPreparedStmt(db, ddl200Insert); for (int i = 0; i < 198; i++) { impl.setString(i+1, "value10000000000"); } impl.setString(199, key); impl.setTimestamp(200, new Timestamp(System.currentTimeMillis())); impl.execute(); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) throws RunnerException { /*Options opt = new OptionsBuilder() .include(FESQLRedisWorkloadBenchmark.class.getSimpleName()) .forks(1) .build(); new Runner(opt).run();*/ FESQLRedisWorkloadBenchmark ben = new FESQLRedisWorkloadBenchmark(); try { ben.setup(); ben.read100bm(); } catch (Exception e) { e.printStackTrace(); } } }
4,560
709
<gh_stars>100-1000 package com.olacabs.jackhammer.models; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @AllArgsConstructor @NoArgsConstructor @Getter @Setter public class FindingTag { long findingId; long tagId; }
108
2,118
// Copyright (c) 2006-2018 <NAME> // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef CDSUNIT_MAP_TYPE_MICHAEL_LIST_H #define CDSUNIT_MAP_TYPE_MICHAEL_LIST_H #include "map_type.h" #include <cds/container/michael_kvlist_hp.h> #include <cds/container/michael_kvlist_dhp.h> #include <cds/container/michael_kvlist_rcu.h> #include <cds/container/michael_kvlist_nogc.h> #include <cds_test/stat_michael_list_out.h> namespace map { template <typename Key, typename Value> struct michael_list_type { typedef typename map_type_base<Key, Value>::key_compare compare; typedef typename map_type_base<Key, Value>::key_less less; struct traits_MichaelList_cmp : public cc::michael_list::make_traits< co::compare< compare > >::type {}; typedef cc::MichaelKVList< cds::gc::HP, Key, Value, traits_MichaelList_cmp > MichaelList_HP_cmp; typedef cc::MichaelKVList< cds::gc::DHP, Key, Value, traits_MichaelList_cmp > MichaelList_DHP_cmp; typedef cc::MichaelKVList< cds::gc::nogc, Key, Value, traits_MichaelList_cmp > MichaelList_NOGC_cmp; typedef cc::MichaelKVList< rcu_gpi, Key, Value, traits_MichaelList_cmp > MichaelList_RCU_GPI_cmp; typedef cc::MichaelKVList< rcu_gpb, Key, Value, traits_MichaelList_cmp > MichaelList_RCU_GPB_cmp; typedef cc::MichaelKVList< rcu_gpt, Key, Value, traits_MichaelList_cmp > MichaelList_RCU_GPT_cmp; #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED typedef cc::MichaelKVList< rcu_shb, Key, Value, traits_MichaelList_cmp > MichaelList_RCU_SHB_cmp; #endif struct traits_MichaelList_cmp_stat : public traits_MichaelList_cmp { typedef cc::michael_list::stat<> stat; }; typedef cc::MichaelKVList< cds::gc::HP, Key, Value, traits_MichaelList_cmp_stat > MichaelList_HP_cmp_stat; typedef cc::MichaelKVList< cds::gc::DHP, Key, Value, traits_MichaelList_cmp_stat > MichaelList_DHP_cmp_stat; typedef cc::MichaelKVList< cds::gc::nogc, Key, Value, traits_MichaelList_cmp_stat > MichaelList_NOGC_cmp_stat; typedef cc::MichaelKVList< rcu_gpi, Key, Value, traits_MichaelList_cmp_stat > MichaelList_RCU_GPI_cmp_stat; typedef cc::MichaelKVList< rcu_gpb, Key, Value, traits_MichaelList_cmp_stat > MichaelList_RCU_GPB_cmp_stat; typedef cc::MichaelKVList< rcu_gpt, Key, Value, traits_MichaelList_cmp_stat > MichaelList_RCU_GPT_cmp_stat; #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED typedef cc::MichaelKVList< rcu_shb, Key, Value, traits_MichaelList_cmp_stat > MichaelList_RCU_SHB_cmp_stat; #endif struct traits_MichaelList_cmp_seqcst : public cc::michael_list::make_traits< co::compare< compare > ,co::memory_model< co::v::sequential_consistent > >::type {}; typedef cc::MichaelKVList< cds::gc::HP, Key, Value, traits_MichaelList_cmp_seqcst > MichaelList_HP_cmp_seqcst; typedef cc::MichaelKVList< cds::gc::DHP, Key, Value, traits_MichaelList_cmp_seqcst > MichaelList_DHP_cmp_seqcst; typedef cc::MichaelKVList< cds::gc::nogc, Key, Value, traits_MichaelList_cmp_seqcst > MichaelList_NOGC_cmp_seqcst; typedef cc::MichaelKVList< rcu_gpi, Key, Value, traits_MichaelList_cmp_seqcst > MichaelList_RCU_GPI_cmp_seqcst; typedef cc::MichaelKVList< rcu_gpb, Key, Value, traits_MichaelList_cmp_seqcst > MichaelList_RCU_GPB_cmp_seqcst; typedef cc::MichaelKVList< rcu_gpt, Key, Value, traits_MichaelList_cmp_seqcst > MichaelList_RCU_GPT_cmp_seqcst; #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED typedef cc::MichaelKVList< rcu_shb, Key, Value, traits_MichaelList_cmp_seqcst > MichaelList_RCU_SHB_cmp_seqcst; #endif struct traits_MichaelList_less : public cc::michael_list::make_traits< co::less< less > >::type {}; typedef cc::MichaelKVList< cds::gc::HP, Key, Value, traits_MichaelList_less > MichaelList_HP_less; typedef cc::MichaelKVList< cds::gc::DHP, Key, Value, traits_MichaelList_less > MichaelList_DHP_less; typedef cc::MichaelKVList< cds::gc::nogc, Key, Value, traits_MichaelList_less > MichaelList_NOGC_less; typedef cc::MichaelKVList< rcu_gpi, Key, Value, traits_MichaelList_less > MichaelList_RCU_GPI_less; typedef cc::MichaelKVList< rcu_gpb, Key, Value, traits_MichaelList_less > MichaelList_RCU_GPB_less; typedef cc::MichaelKVList< rcu_gpt, Key, Value, traits_MichaelList_less > MichaelList_RCU_GPT_less; #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED typedef cc::MichaelKVList< rcu_shb, Key, Value, traits_MichaelList_less > MichaelList_RCU_SHB_less; #endif struct traits_MichaelList_less_stat: public traits_MichaelList_less { typedef cc::michael_list::stat<> stat; }; typedef cc::MichaelKVList< cds::gc::HP, Key, Value, traits_MichaelList_less_stat > MichaelList_HP_less_stat; typedef cc::MichaelKVList< cds::gc::DHP, Key, Value, traits_MichaelList_less_stat > MichaelList_DHP_less_stat; typedef cc::MichaelKVList< cds::gc::nogc, Key, Value, traits_MichaelList_less_stat > MichaelList_NOGC_less_stat; typedef cc::MichaelKVList< rcu_gpi, Key, Value, traits_MichaelList_less_stat > MichaelList_RCU_GPI_less_stat; typedef cc::MichaelKVList< rcu_gpb, Key, Value, traits_MichaelList_less_stat > MichaelList_RCU_GPB_less_stat; typedef cc::MichaelKVList< rcu_gpt, Key, Value, traits_MichaelList_less_stat > MichaelList_RCU_GPT_less_stat; #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED typedef cc::MichaelKVList< rcu_shb, Key, Value, traits_MichaelList_less_stat > MichaelList_RCU_SHB_less_stat; #endif struct traits_MichaelList_less_seqcst : public cc::michael_list::make_traits< co::less< less > ,co::memory_model< co::v::sequential_consistent > >::type {}; typedef cc::MichaelKVList< cds::gc::HP, Key, Value, traits_MichaelList_less_seqcst > MichaelList_HP_less_seqcst; typedef cc::MichaelKVList< cds::gc::DHP, Key, Value, traits_MichaelList_less_seqcst > MichaelList_DHP_less_seqcst; typedef cc::MichaelKVList< cds::gc::nogc, Key, Value, traits_MichaelList_less_seqcst > MichaelList_NOGC_less_seqcst; typedef cc::MichaelKVList< rcu_gpi, Key, Value, traits_MichaelList_less_seqcst > MichaelList_RCU_GPI_less_seqcst; typedef cc::MichaelKVList< rcu_gpb, Key, Value, traits_MichaelList_less_seqcst > MichaelList_RCU_GPB_less_seqcst; typedef cc::MichaelKVList< rcu_gpt, Key, Value, traits_MichaelList_less_seqcst > MichaelList_RCU_GPT_less_seqcst; #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED typedef cc::MichaelKVList< rcu_shb, Key, Value, traits_MichaelList_less_seqcst > MichaelList_RCU_SHB_less_seqcst; #endif }; } // namespace map #endif // ifndef CDSUNIT_MAP_TYPE_MICHAEL_LIST_H
3,100
2,959
""" StackBuilder implementation for nested stack """ from typing import cast from samcli.lib.bootstrap.stack_builder import AbstractStackBuilder from samcli.lib.providers.provider import Function from samcli.lib.utils.hash import str_checksum from samcli.lib.utils.resources import AWS_SERVERLESS_LAYERVERSION, AWS_CLOUDFORMATION_STACK CREATED_BY_METADATA_KEY = "CreatedBy" CREATED_BY_METADATA_VALUE = "AWS SAM CLI sync command" class NestedStackBuilder(AbstractStackBuilder): """ CFN/SAM Template creator for nested stack """ def __init__(self): super().__init__("AWS SAM CLI Nested Stack for Auto Dependency Layer Creation") self.add_metadata(CREATED_BY_METADATA_KEY, CREATED_BY_METADATA_VALUE) def is_any_function_added(self) -> bool: return bool(self._template_dict.get("Resources", {})) def add_function( self, stack_name: str, layer_contents_folder: str, function: Function, ) -> str: layer_logical_id = self.get_layer_logical_id(function.full_path) layer_name = self.get_layer_name(stack_name, function.full_path) self.add_resource( layer_logical_id, self._get_layer_dict(function.full_path, layer_name, layer_contents_folder, cast(str, function.runtime)), ) self.add_output(layer_logical_id, {"Ref": layer_logical_id}) return layer_logical_id @staticmethod def get_layer_logical_id(function_logical_id: str) -> str: function_logical_id_hash = str_checksum(function_logical_id) return f"{function_logical_id[:48]}{function_logical_id_hash[:8]}DepLayer" @staticmethod def get_layer_name(stack_name: str, function_logical_id: str) -> str: function_logical_id_hash = str_checksum(function_logical_id) stack_name_hash = str_checksum(stack_name) return ( f"{stack_name[:16]}{stack_name_hash[:8]}-{function_logical_id[:22]}{function_logical_id_hash[:8]}" f"-DepLayer" ) @staticmethod def _get_layer_dict(function_logical_id: str, layer_name: str, layer_contents_folder: str, function_runtime: str): return { "Type": AWS_SERVERLESS_LAYERVERSION, "Properties": { "LayerName": layer_name, "Description": f"Auto created layer for dependencies of function {function_logical_id}", "ContentUri": layer_contents_folder, "RetentionPolicy": "Delete", "CompatibleRuntimes": [function_runtime], }, "Metadata": {CREATED_BY_METADATA_KEY: CREATED_BY_METADATA_VALUE}, } @staticmethod def get_nested_stack_reference_resource(nested_template_location): return { "Type": AWS_CLOUDFORMATION_STACK, "DeletionPolicy": "Delete", "Properties": {"TemplateURL": nested_template_location}, "Metadata": {CREATED_BY_METADATA_KEY: CREATED_BY_METADATA_VALUE}, }
1,297
834
<reponame>Karybdis/mmdetection-mini<gh_stars>100-1000 # -*- coding:utf-8 -*- from collections import OrderedDict import torch.nn as nn import torch from .base_yolo_head import BaseYOLOHead from ..utils import brick as vn_layer from ..builder import HEADS @HEADS.register_module() class RRTinyYolov4Head(BaseYOLOHead): def _init_layers(self): head = [ OrderedDict([ ('10_max', nn.MaxPool2d(2, 2)), ('11_conv', vn_layer.Conv2dBatchLeaky(self.in_channels[0], self.in_channels[0], 3, 1)), ('12_conv', vn_layer.Conv2dBatchLeaky(self.in_channels[0], self.out_channels[0], 1, 1)), ]), OrderedDict([ ('13_conv', vn_layer.Conv2dBatchLeaky(self.in_channels[1], self.in_channels[0], 3, 1)), ('14_conv', nn.Conv2d(self.in_channels[0], self.num_anchors * self.num_attrib, 1)), ]), OrderedDict([ ('15_convbatch', vn_layer.Conv2dBatchLeaky(self.in_channels[1], self.out_channels[1], 1, 1)), ('16_upsample', nn.Upsample(scale_factor=2)), ]), OrderedDict([ ('17_convbatch', vn_layer.Conv2dBatchLeaky(self.out_channels[0]+self.out_channels[1], 256, 3, 1)), ('18_conv', nn.Conv2d(256, self.num_anchors * self.num_attrib, 1)), ]), ] self.layers = nn.ModuleList([nn.Sequential(layer_dict) for layer_dict in head]) def forward(self, feats): stem, extra_x = feats stage0 = self.layers[0](stem) head0 = self.layers[1](stage0) stage1 = self.layers[2](stage0) stage2 = torch.cat((stage1, extra_x), dim=1) head1 = self.layers[3](stage2) head = [head0, head1] # 小特征图在前 return tuple(head),
941
695
<reponame>r3m0t/debugpy<filename>src/debugpy/_vendored/pydevd/tests_python/resources/_debugger_case_method_single_line.py def call(b): return b # Break here will hit once at creation time and then at each call. call(1) call(2) print('TEST SUCEEDED')
93
880
/** * Copyright 2019 <NAME> * * 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. */ package ch.qos.logback.classic.net; import ch.qos.logback.classic.ClassicTestConstants; import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.classic.PatternLayout; import ch.qos.logback.classic.html.HTMLLayout; import ch.qos.logback.classic.html.XHTMLEntityResolver; import ch.qos.logback.classic.joran.JoranConfigurator; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.Layout; import ch.qos.logback.core.joran.spi.JoranException; import ch.qos.logback.core.testUtil.EnvUtilForTests; import ch.qos.logback.core.testUtil.RandomUtil; import com.icegreen.greenmail.util.GreenMail; import com.icegreen.greenmail.util.GreenMailUtil; import com.icegreen.greenmail.util.ServerSetup; import org.dom4j.DocumentException; import org.dom4j.io.SAXReader; import org.junit.After; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; import org.slf4j.MDC; import javax.mail.MessagingException; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.concurrent.TimeUnit; import static org.junit.Assert.*; /** * Tests {@link SMTPAppender} with GreenMail * * http://www.icegreen.com/greenmail/ */ @Ignore @RunWith(RobolectricTestRunner.class) public class SMTPAppender_GreenTest { static final String HEADER = "HEADER\n"; static final String FOOTER = "FOOTER\n"; static final String DEFAULT_PATTERN = "%-4relative %mdc [%thread] %-5level %class - %msg%n"; static final boolean SYNCHRONOUS = false; static final boolean ASYNCHRONOUS = true; int port = RandomUtil.getRandomServerPort(); // GreenMail cannot be static. As a shared server induces race conditions GreenMail greenMailServer; SMTPAppender smtpAppender; LoggerContext loggerContext = new LoggerContext(); Logger logger = loggerContext.getLogger(this.getClass()); @Before public void setUp() throws Exception { MDC.clear(); ServerSetup serverSetup = new ServerSetup(port, "localhost", ServerSetup.PROTOCOL_SMTP); greenMailServer = new GreenMail(serverSetup); greenMailServer.start(); // give the server a head start if (EnvUtilForTests.isRunningOnSlowJenkins()) { Thread.sleep(2000); } else { Thread.sleep(50); } } @After public void tearDown() throws Exception { greenMailServer.stop(); } private void buildSMTPAppender(String subject, boolean synchronicity) throws Exception { smtpAppender = new SMTPAppender(); smtpAppender.setContext(loggerContext); smtpAppender.setName("smtp"); smtpAppender.setFrom("<EMAIL>"); smtpAppender.setSMTPHost("localhost"); smtpAppender.setSMTPPort(port); smtpAppender.setSubject(subject); smtpAppender.addTo("<EMAIL>"); smtpAppender.setAsynchronousSending(synchronicity); } private Layout<ILoggingEvent> buildPatternLayout(String pattern) { PatternLayout layout = new PatternLayout(); layout.setContext(loggerContext); layout.setFileHeader(HEADER); layout.setOutputPatternAsHeader(false); layout.setPattern(pattern); layout.setFileFooter(FOOTER); layout.start(); return layout; } private Layout<ILoggingEvent> buildHTMLLayout() { HTMLLayout layout = new HTMLLayout(); layout.setContext(loggerContext); layout.setPattern("%level%class%msg"); layout.start(); return layout; } private void waitForServerToReceiveEmails(int emailCount) throws InterruptedException { assertTrue("no emails received", greenMailServer.waitForIncomingEmail(5000, emailCount)); } private MimeMultipart verifyAndExtractMimeMultipart(String subject) throws MessagingException, IOException, InterruptedException { int oldCount = 0; int expectedEmailCount = 1; // wait for the server to receive the messages waitForServerToReceiveEmails(expectedEmailCount); MimeMessage[] mma = greenMailServer.getReceivedMessages(); assertNotNull(mma); assertEquals(expectedEmailCount, mma.length); MimeMessage mm = mma[oldCount]; // http://jira.qos.ch/browse/LBCLASSIC-67 assertEquals(subject, mm.getSubject()); return (MimeMultipart) mm.getContent(); } private void waitUntilEmailIsSent() throws InterruptedException { loggerContext.getExecutorService().shutdown(); assertTrue("no emails sent", loggerContext.getExecutorService().awaitTermination(1000, TimeUnit.MILLISECONDS)); } @Test public void synchronousSmoke() throws Exception { String subject = "synchronousSmoke"; buildSMTPAppender(subject, SYNCHRONOUS); smtpAppender.setLayout(buildPatternLayout(DEFAULT_PATTERN)); smtpAppender.start(); logger.addAppender(smtpAppender); logger.debug("hello"); logger.error("an error", new Exception("an exception")); MimeMultipart mp = verifyAndExtractMimeMultipart(subject); String body = GreenMailUtil.getBody(mp.getBodyPart(0)); assertTrue(body.startsWith(HEADER.trim())); assertTrue(body.endsWith(FOOTER.trim())); } @Test public void asynchronousSmoke() throws Exception { String subject = "asynchronousSmoke"; buildSMTPAppender(subject, ASYNCHRONOUS); smtpAppender.setLayout(buildPatternLayout(DEFAULT_PATTERN)); smtpAppender.start(); logger.addAppender(smtpAppender); logger.debug("hello"); logger.error("an error", new Exception("an exception")); waitUntilEmailIsSent(); MimeMultipart mp = verifyAndExtractMimeMultipart(subject); String body = GreenMailUtil.getBody(mp.getBodyPart(0)); assertTrue(body.startsWith(HEADER.trim())); assertTrue(body.endsWith(FOOTER.trim())); } // See also http://jira.qos.ch/browse/LOGBACK-734 @Test public void callerDataShouldBeCorrectlySetWithAsynchronousSending() throws Exception { String subject = "LOGBACK-734"; buildSMTPAppender("LOGBACK-734", ASYNCHRONOUS); smtpAppender.setLayout(buildPatternLayout(DEFAULT_PATTERN)); smtpAppender.setIncludeCallerData(true); smtpAppender.start(); logger.addAppender(smtpAppender); logger.debug("LOGBACK-734"); logger.error("callerData", new Exception("ShouldBeCorrectlySetWithAsynchronousSending")); waitUntilEmailIsSent(); MimeMultipart mp = verifyAndExtractMimeMultipart(subject); String body = GreenMailUtil.getBody(mp.getBodyPart(0)); assertTrue("actual [" + body + "]", body.contains("DEBUG " + this.getClass().getName() + " - LOGBACK-734")); } // lost MDC @Test public void LBCLASSIC_104() throws Exception { String subject = "LBCLASSIC_104"; buildSMTPAppender(subject, SYNCHRONOUS); smtpAppender.setAsynchronousSending(false); smtpAppender.setLayout(buildPatternLayout(DEFAULT_PATTERN)); smtpAppender.start(); logger.addAppender(smtpAppender); MDC.put("key", "val"); logger.debug("hello"); MDC.clear(); logger.error("en error", new Exception("test")); MimeMultipart mp = verifyAndExtractMimeMultipart(subject); String body = GreenMailUtil.getBody(mp.getBodyPart(0)); assertTrue("missing HEADER in body", body.startsWith(HEADER.trim())); assertTrue("missing MDC in body", body.contains("key=val")); assertTrue("missing FOOTER in body", body.endsWith(FOOTER.trim())); } @Test public void html() throws Exception { String subject = "html"; buildSMTPAppender(subject, SYNCHRONOUS); smtpAppender.setAsynchronousSending(false); smtpAppender.setLayout(buildHTMLLayout()); smtpAppender.start(); logger.addAppender(smtpAppender); logger.debug("hello"); logger.error("an error", new Exception("an exception")); MimeMultipart mp = verifyAndExtractMimeMultipart(subject); // verifyAndExtractMimeMultipart strict adherence to xhtml1-strict.dtd SAXReader reader = new SAXReader(); reader.setValidation(true); reader.setEntityResolver(new XHTMLEntityResolver()); byte[] messageBytes = getAsByteArray(mp.getBodyPart(0).getInputStream()); ByteArrayInputStream bais = new ByteArrayInputStream(messageBytes); try { reader.read(bais); } catch (DocumentException de) { System.out.println("incoming message:"); System.out.println(new String(messageBytes)); throw de; } } private byte[] getAsByteArray(InputStream inputStream) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int n = -1; while ((n = inputStream.read(buffer)) != -1) { baos.write(buffer, 0, n); } return baos.toByteArray(); } private void configure(int port, String file) throws JoranException { JoranConfigurator jc = new JoranConfigurator(); jc.setContext(loggerContext); loggerContext.putProperty("port", "" + port); jc.doConfigure(file); } @Test public void testCustomEvaluator() throws Exception { configure(greenMailServer.getSmtp().getPort(), ClassicTestConstants.JORAN_INPUT_PREFIX + "smtp/customEvaluator.xml"); logger.debug("test"); String msg2 = "CustomEvaluator"; logger.debug(msg2); logger.debug("invisible"); waitUntilEmailIsSent(); MimeMultipart mp = verifyAndExtractMimeMultipart("testCustomEvaluator " + this.getClass().getName() + " - " + msg2); String body = GreenMailUtil.getBody(mp.getBodyPart(0)); assertEquals("testCustomEvaluator", body); } @Test public void testCustomBufferSize() throws Exception { configure(greenMailServer.getSmtp().getPort(), ClassicTestConstants.JORAN_INPUT_PREFIX + "smtp/customBufferSize.xml"); logger.debug("invisible1"); logger.debug("invisible2"); String msg = "hello"; logger.error(msg); waitUntilEmailIsSent(); MimeMultipart mp = verifyAndExtractMimeMultipart("testCustomBufferSize " + this.getClass().getName() + " - " + msg); String body = GreenMailUtil.getBody(mp.getBodyPart(0)); assertEquals(msg, body); } // this test fails intermittently on Jenkins. @Test public void testMultipleTo() throws Exception { buildSMTPAppender("testMultipleTo", SYNCHRONOUS); smtpAppender.setLayout(buildPatternLayout(DEFAULT_PATTERN)); // buildSMTPAppender() already added one destination address smtpAppender.addTo("Test <<EMAIL>>, <EMAIL>"); smtpAppender.start(); logger.addAppender(smtpAppender); logger.debug("testMultipleTo hello"); logger.error("testMultipleTo en error", new Exception("an exception")); Thread.yield(); int expectedEmailCount = 3; waitForServerToReceiveEmails(expectedEmailCount); MimeMessage[] mma = greenMailServer.getReceivedMessages(); assertNotNull(mma); assertEquals(expectedEmailCount, mma.length); } // http://jira.qos.ch/browse/LBCLASSIC-221 @Test public void bufferShouldBeResetBetweenMessages() throws Exception { buildSMTPAppender("bufferShouldBeResetBetweenMessages", SYNCHRONOUS); smtpAppender.setLayout(buildPatternLayout(DEFAULT_PATTERN)); smtpAppender.start(); logger.addAppender(smtpAppender); String msg0 = "hello zero"; logger.debug(msg0); logger.error("error zero"); String msg1 = "hello one"; logger.debug(msg1); logger.error("error one"); Thread.yield(); int oldCount = 0; int expectedEmailCount = oldCount + 2; waitForServerToReceiveEmails(expectedEmailCount); MimeMessage[] mma = greenMailServer.getReceivedMessages(); assertNotNull(mma); assertEquals(expectedEmailCount, mma.length); MimeMessage mm0 = mma[0]; MimeMultipart content0 = (MimeMultipart) mm0.getContent(); String body0 = GreenMailUtil.getBody(content0.getBodyPart(0)); assertTrue(body0.contains(msg0)); MimeMessage mm1 = mma[oldCount + 1]; MimeMultipart content1 = (MimeMultipart) mm1.getContent(); String body1 = GreenMailUtil.getBody(content1.getBodyPart(0)); // second body should not contain content from first message assertFalse(body1.contains(msg0)); } @Test public void multiLineSubjectTruncatedAtFirstNewLine() throws Exception { String line1 = "line 1 of subject"; String subject = line1 + "\nline 2 of subject\n"; buildSMTPAppender(subject, ASYNCHRONOUS); smtpAppender.setLayout(buildPatternLayout(DEFAULT_PATTERN)); smtpAppender.start(); logger.addAppender(smtpAppender); logger.debug("hello"); logger.error("en error", new Exception("an exception")); Thread.yield(); waitUntilEmailIsSent(); waitForServerToReceiveEmails(1); MimeMessage[] mma = greenMailServer.getReceivedMessages(); assertEquals(1, mma.length); assertEquals(line1, mma[0].getSubject()); } }
4,797
575
<gh_stars>100-1000 // Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_IMPL_PROCESS_HEAP_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_IMPL_PROCESS_HEAP_H_ #include <atomic> #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/threading_primitives.h" namespace blink { class CrossThreadPersistentRegion; class PLATFORM_EXPORT ProcessHeap { STATIC_ONLY(ProcessHeap); public: static void Init(); static CrossThreadPersistentRegion& GetCrossThreadPersistentRegion(); static CrossThreadPersistentRegion& GetCrossThreadWeakPersistentRegion(); // Access to the CrossThreadPersistentRegion from multiple threads has to be // prevented as allocation, freeing, and iteration of nodes may otherwise // cause data races. // // Examples include: // - Iteration of strong cross-thread Persistents. // - Iteration and processing of weak cross-thread Persistents. The lock // needs to span both operations as iteration of weak persistents only // registers memory regions that are then processed afterwards. // - Marking phase in garbage collection: The whole phase requires locking // as CrossThreadWeakPersistents may be converted to CrossThreadPersistent // which must observe GC as an atomic operation. static Mutex& CrossThreadPersistentMutex(); static void IncreaseTotalAllocatedObjectSize(size_t delta) { total_allocated_object_size_.fetch_add(delta, std::memory_order_relaxed); } static void DecreaseTotalAllocatedObjectSize(size_t delta) { total_allocated_object_size_.fetch_sub(delta, std::memory_order_relaxed); } static size_t TotalAllocatedObjectSize() { return total_allocated_object_size_.load(std::memory_order_relaxed); } static void IncreaseTotalAllocatedSpace(size_t delta) { total_allocated_space_.fetch_add(delta, std::memory_order_relaxed); } static void DecreaseTotalAllocatedSpace(size_t delta) { total_allocated_space_.fetch_sub(delta, std::memory_order_relaxed); } static size_t TotalAllocatedSpace() { return total_allocated_space_.load(std::memory_order_relaxed); } static void ResetHeapCounters(); private: static std::atomic_size_t total_allocated_space_; static std::atomic_size_t total_allocated_object_size_; friend class ThreadState; }; } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_IMPL_PROCESS_HEAP_H_
853
831
<reponame>Ret-Mode/android /* * Copyright (C) 2018 The Android Open Source Project * * 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. */ package com.android.tools.idea.run.tasks; import com.android.ddmlib.IDevice; import com.android.sdklib.AndroidVersion; import com.android.tools.deployer.Deployer; import com.android.tools.deployer.DeployerException; import com.android.tools.deployer.InstallOptions; import com.android.tools.idea.flags.StudioFlags; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Computable; import java.io.File; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import org.jetbrains.annotations.NotNull; public class DeployTask extends AbstractDeployTask { private static final Logger LOG = Logger.getInstance(DeployTask.class); private static final String ID = "DEPLOY"; private final String[] userInstallOptions; private final boolean installOnAllUsers; /** * Creates a task to deploy a list of apks. * * @param project the project that this task is running within. * @param packages a map of application ids to apks representing the packages this task will deploy. */ public DeployTask(@NotNull Project project, @NotNull Map<String, List<File>> packages, String userInstallOptions, boolean installOnAllUsers, Computable<String> installPathProvider) { super(project, packages, false, installPathProvider); if (userInstallOptions != null && !userInstallOptions.isEmpty()) { userInstallOptions = userInstallOptions.trim(); this.userInstallOptions = userInstallOptions.split("\\s"); } else { this.userInstallOptions = new String[0]; } this.installOnAllUsers = installOnAllUsers; } @NotNull @Override public String getId() { return ID; } @Override protected Deployer.Result perform(IDevice device, Deployer deployer, String applicationId, List<File> files) throws DeployerException { // All installations default to allow debuggable APKs InstallOptions.Builder options = InstallOptions.builder().setAllowDebuggable(); // We default to install only on the current user because we run only apps installed on the // current user. Installing on "all" users causes the device to only update on users that the app // is already installed, failing to run if it's not installed on the current user. if (!installOnAllUsers && device.getVersion().isGreaterOrEqualThan(24)) { options.setInstallOnCurrentUser(); } // Embedded devices (Android Things) have all runtime permissions granted since there's no requirement for user // interaction/display. However, regular installation will not grant some permissions until the next device reboot. // Installing with "-g" guarantees that the permissions are properly granted at install time. if (device.supportsFeature(IDevice.HardwareFeature.EMBEDDED)) { options.setGrantAllPermissions(); } // API 28 changes how the instant property is set on app install. // We can add --full to pmInstallOptions to restore the previous behavior, // where an app's instant flag is reset on install, and avoid errors installing // a non-instant app over its instant version with the device still treating // the app as instant. if (device.getVersion().isGreaterOrEqualThan(28)) { options.setInstallFullApk(); } // After installing and after returning from the install request, the package manager issues a force-stop to the // app it has just finished installing. This force-stop will compete with the "am start" issued from Studio to // occasionally prevent the app from starting (if the force-stop from pm is issued after our "am start"). // // Since the app has already been stopped from Studio, requesting "--dont-kill" prevent the package manager from // issuing a "force-stop", but still yield the expecting behavior that app is restarted after install. Note that // this functionality is only valid for Android Nougat or above. if (device.getVersion().isGreaterOrEqualThan(AndroidVersion.VersionCodes.N)) { options.setDontKill(); } // We can just append this, since all these options get string-joined in the end anyways. if (userInstallOptions != null) { options.setUserInstallOptions(userInstallOptions); } // Skip verification if possible. options.setSkipVerification(device, applicationId); LOG.info("Installing application: " + applicationId); Deployer.InstallMode installMode = Deployer.InstallMode.DELTA; if (!StudioFlags.DELTA_INSTALL.get()) { installMode = Deployer.InstallMode.FULL; } return deployer.install(applicationId, getPathsToInstall(files), options.build(), installMode); } @NotNull @Override public String getDescription() { return "Install"; } @NotNull @Override public String getFailureTitle() { return "Installation did not succeed."; } @NotNull @Override protected String createSkippedApkInstallMessage(List<String> skippedApkList, boolean all) { if (all) { return "App restart successful without requiring a re-install."; } else { return "App restart successful without re-installing the following APK(s): " + skippedApkList.stream().collect(Collectors.joining(", ")); } } }
1,813
1,538
// 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. #pragma once #include <cstdint> #include <list> #include <memory> #include <string> #include <vector> #include "kudu/clock/time_service.h" #include "kudu/gutil/macros.h" #include "kudu/gutil/ref_counted.h" #include "kudu/util/locks.h" #include "kudu/util/metrics.h" #include "kudu/util/mutex.h" #include "kudu/util/net/socket.h" #include "kudu/util/random.h" #include "kudu/util/status.h" namespace kudu { class HostPort; class Sockaddr; class Thread; namespace clock { namespace internal { struct RecordedResponse; } // namespace internal // The starndard NTP port number. constexpr const int kStandardNtpPort = 123; // This time service is based on a simplified NTP client implementation. // It's not RFC-compliant yet (RFC 5905). The most important missing pieces are: // * support of iburst/burst operation modes (see KUDU-2937) // * handling of KoD packets (see KUDU-2938) // * strict clock selection algorithm (see KUDU-2939) // * measuring and applying local clock skew (see KUDU-2940) // * support crypto authn for NTP packets (see KUDU-2941) // // The built-in NTP client keeps track of the true time information it receives // from configured NTP servers and maintains walltime with error estimation. // The client neither drives the node's wallclock nor relies on it in any way, // it only uses raw monotonic clock to estimate the true time based on // responses from NTP servers. With built-in client properly configured, // there is no need to synchronize the system clock of nodes where Kudu // masters and tablet servers are running with NTP servers. // // See http://www.ntp.org/ntpfaq/NTP-s-algo.htm on introduction to basic NTP // concepts. class BuiltInNtp : public TimeService { public: // Create an instance using the servers specified in --builtin_ntp_servers // as NTP sources. The 'metric_entity' is used to register metrics specific to // the built-in NTP client. explicit BuiltInNtp(const scoped_refptr<MetricEntity>& metric_entity); ~BuiltInNtp() override; Status Init() override; Status WalltimeWithError(uint64_t* now_usec, uint64_t* error_usec) override; int64_t skew_ppm() const override { return kSkewPpm; } void DumpDiagnostics(std::vector<std::string>* log) const override; private: class ServerState; struct NtpPacket; struct PendingRequest; // Information on the computed walltime. struct WalltimeSnapshot { WalltimeSnapshot() : mono(0), wall(0), error(0), is_synchronized(false) { } int64_t mono; int64_t wall; int64_t error; bool is_synchronized; }; // Upper estimate for a clock skew. static constexpr int kSkewPpm = 500; // Implementation of Init(). Status InitImpl(); // Populate run-time structures with the specified information on NTP servers. Status PopulateServers(std::vector<HostPort> servers); bool is_shutdown() const; void Shutdown(); // Read data from client NTP socket and parse the contents, adding the result // into the set of responses per server if the data validation passes. This // method returns 'false' if there was a low-level error while reading data // from the socket, and 'true' otherwise (regardless the validity of the data). bool TryReceivePacket(); // Iterate over all pending requests and remove all requests which have // already timed out. void TimeOutRequests(); // Iterate over all scheduled NTP requests and send ones which are at or past // their scheduled time. Status SendRequests(); // Send a request to the specified server. Status SendPoll(ServerState* s); // The IO loop thread: sending and receiving NTP packets to the configured // servers. void PollThread(); // Find and return information on the corresponding request for the specified // response received from server with given address. This function returns // a smart pointer to non-null PendingRequest structure if a request is found, // and nullptr smartpointer wrapper otherwise (a response might be expired and // removed from the queue prior to call). std::unique_ptr<PendingRequest> RemovePending(const Sockaddr& addr, const NtpPacket& response); // Record and process response received from NTP server. void RecordResponse(ServerState* from_server, const internal::RecordedResponse& rr); // Among all available responses, select the best ones to use in the clock // selection algorithm. Status FilterResponses(std::vector<internal::RecordedResponse>* filtered); // Create NTP packet to send to a server. NtpPacket CreateClientPacket(); // Compute walltime and its estimated error from the true time // based on responses received so far from configured NTP servers. Status CombineClocks(); // Register all metrics tracked by the built-in NTP client. void RegisterMetrics(const scoped_refptr<MetricEntity>& entity); // Get difference between the local clock and the tracked true time, // in milliseconds. int64_t LocalClockDeltaForMetrics(); // Get the latest computed true time, in microseconds. int64_t WalltimeForMetrics(); // Get the latest computed maximum error from true time, in microseconds. int64_t MaxErrorForMetrics(); Random rng_; Socket socket_; // Protects 'last_computed_'. mutable rw_spinlock last_computed_lock_; WalltimeSnapshot last_computed_; // Protects 'state_'. mutable Mutex state_lock_; enum State { kUninitialized, kStarting, kStarted, kShutdown }; State state_ = kUninitialized; std::vector<std::unique_ptr<ServerState>> servers_; std::list<std::unique_ptr<PendingRequest>> pending_; // The polling thread. Responsible for sending/receiving NTP packets and // updating the maintained walltime based on the NTP responses received. scoped_refptr<Thread> thread_; // Stats on the maximum error is sampled every when wall-clock time // is calculated upon receiving NTP server responses. scoped_refptr<Histogram> max_errors_histogram_; // Clock metrics are set to detach to their last value. This means // that, during our destructor, we'll need to access other class members // declared above this. Hence, this member must be declared last. FunctionGaugeDetacher metric_detacher_; DISALLOW_COPY_AND_ASSIGN(BuiltInNtp); }; } // namespace clock } // namespace kudu
2,168
4,065
package com.zzhoujay.richtext.ext; import android.util.Log; import com.zzhoujay.richtext.RichText; /** * Created by zhou on 2017/4/4. * Debug Utils */ public class Debug { public static final String PREF = " --> "; private static final String TAG = "RichText"; public static void e(Throwable e) { if (RichText.debugMode) { e.printStackTrace(); } } public static void log(String tag, String message) { if (RichText.debugMode) { Log.i(TAG, tag + PREF + message); } } public static void log(String tag, String message, Throwable e) { if (RichText.debugMode) { Log.i(TAG, tag + PREF + message, e); } } public static void loge(String tag, String message, Throwable e) { Log.e(TAG, tag + PREF + message, e); } public static void loge(String tag, String message) { Log.e(TAG, tag + PREF + message); } }
403
777
<reponame>google-ar/chromium // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "ui/base/ime/chromeos/ime_keyboard_ozone.h" #include "ui/ozone/public/input_controller.h" #include "ui/ozone/public/ozone_platform.h" namespace chromeos { namespace input_method { ImeKeyboardOzone::ImeKeyboardOzone(ui::InputController* input_controller) : input_controller_(input_controller) { } ImeKeyboardOzone::~ImeKeyboardOzone() { } bool ImeKeyboardOzone::SetCurrentKeyboardLayoutByName( const std::string& layout_name) { last_layout_ = layout_name; input_controller_->SetCurrentLayoutByName(layout_name); return true; } bool ImeKeyboardOzone::ReapplyCurrentKeyboardLayout() { return SetCurrentKeyboardLayoutByName(last_layout_); } void ImeKeyboardOzone::SetCapsLockEnabled(bool enable_caps_lock) { // Inform ImeKeyboard of caps lock state. ImeKeyboard::SetCapsLockEnabled(enable_caps_lock); // Inform Ozone InputController input of caps lock state. input_controller_->SetCapsLockEnabled(enable_caps_lock); } bool ImeKeyboardOzone::CapsLockIsEnabled() { return input_controller_->IsCapsLockEnabled(); } void ImeKeyboardOzone::ReapplyCurrentModifierLockStatus() { } void ImeKeyboardOzone::DisableNumLock() { input_controller_->SetNumLockEnabled(false); } bool ImeKeyboardOzone::SetAutoRepeatRate(const AutoRepeatRate& rate) { input_controller_->SetAutoRepeatRate( base::TimeDelta::FromMilliseconds(rate.initial_delay_in_ms), base::TimeDelta::FromMilliseconds(rate.repeat_interval_in_ms)); return true; } bool ImeKeyboardOzone::SetAutoRepeatEnabled(bool enabled) { input_controller_->SetAutoRepeatEnabled(enabled); return true; } bool ImeKeyboardOzone::GetAutoRepeatEnabled() { return input_controller_->IsAutoRepeatEnabled(); } // static ImeKeyboard* ImeKeyboard::Create() { return new ImeKeyboardOzone( ui::OzonePlatform::GetInstance()->GetInputController()); } } // namespace input_method } // namespace chromeos
701
1,248
<filename>src/pretix/base/migrations/0028_auto_20160816_1242.py<gh_stars>1000+ # -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-08-16 12:42 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('pretixbase', '0027_auto_20160815_1254'), ] operations = [ migrations.RemoveField( model_name='cartposition', name='base_price', ), migrations.RemoveField( model_name='cartposition', name='voucher_discount', ), migrations.RemoveField( model_name='orderposition', name='base_price', ), migrations.RemoveField( model_name='orderposition', name='voucher_discount', ), ]
398
335
{ "word": "Trendy", "definitions": [ "Very fashionable or up to date." ], "parts-of-speech": "Adjective" }
60
350
<filename>package.json { "name": "stopwords-json", "version": "1.2.0", "description": "Stopwords for various languages in JSON format.", "main": "stopwords-all.json", "author": { "name": "<NAME>", "url": "https://github.com/6" }, "repository": { "type": "git", "url": "http://github.com/6/stopwords-json.git" }, "bugs": { "url": "http://github.com/6/stopwords-json/issues" }, "scripts": { "lint": "jsonlint stopwords-all.json --quiet && jsonlint dist/*.json --quiet", "test": "npm run lint && tape test/*.js" }, "keywords": [ "languages", "stemmer", "stop words", "stopwords" ], "license": "Apache-2.0", "devDependencies": { "glob": "3.2.x", "grunt": "0.4.x", "grunt-readme": "0.4.5", "jsonlint": "github:ginman86/jsonlint#c95cda5", "languages": "0.1.3", "tape": "^4.6.0", "underscore": "1.5.2" } }
421
3,489
''' create_geonames_tsv.py ---------------------- This script formats the open GeoNames database (as well as its accompanying postal codes data set) into a schema'd tab-separated value file. It generates a C header which uses an enum for the field names. This way if new fields are added or there's a typo, etc. the error will show up at compile-time. The relevant C modules which operate on this data are: geodb_builder.c geonames.c As well as the generated headers: geonames_fields.h postal_fields.h ''' import argparse import csv import logging import operator import os import re import sqlite3 import subprocess import sys import pycountry import unicodedata import urllib import urlparse from collections import defaultdict, OrderedDict from lxml import etree this_dir = os.path.realpath(os.path.dirname(__file__)) sys.path.append(os.path.realpath(os.path.join(os.pardir, os.pardir))) from geodata.csv_utils import * from geodata.file_utils import * from geodata.countries.country_names import * from geodata.encoding import safe_encode, safe_decode from geodata.geonames.paths import DEFAULT_GEONAMES_DB_PATH from geodata.i18n.languages import * from geodata.i18n.unicode_paths import CLDR_DIR from geodata.log import log_to_file multispace_regex = re.compile('[\s]+') def encode_field(value): return multispace_regex.sub(' ', safe_encode((value if value is not None else ''))) log_to_file(sys.stderr) DEFAULT_DATA_DIR = os.path.join(this_dir, os.path.pardir, os.path.pardir, os.path.pardir, 'data', 'geonames') COUNTRY_FEATURE_CODES = ('PCL', 'PCLI', 'PCLIX', 'PCLD', 'PCLF', 'PCLS') CONTINENT_FEATURE_CODES = ('CONT',) ADMIN_1_FEATURE_CODES = ('ADM1',) ADMIN_2_FEATURE_CODES = ('ADM2',) ADMIN_3_FEATURE_CODES = ('ADM3',) ADMIN_4_FEATURE_CODES = ('ADM4',) OTHER_ADMIN_FEATURE_CODES = ('ADM5',) ADMIN_OTHER_FEATURE_CODES = ('ADMD', ) POPULATED_PLACE_FEATURE_CODES = ('PPL', 'PPLA', 'PPLA2', 'PPLA3', 'PPLA4', 'PPLC', 'PPLCH', 'PPLF', 'PPLG', 'PPLL', 'PPLR', 'PPLS', 'STLMT') NEIGHBORHOOD_FEATURE_CODES = ('PPLX', ) class boundary_types: COUNTRY = 0 ADMIN1 = 1 ADMIN2 = 2 ADMIN3 = 3 ADMIN4 = 4 ADMIN_OTHER = 5 LOCALITY = 6 NEIGHBORHOOD = 7 geonames_admin_dictionaries = OrderedDict([ (boundary_types.COUNTRY, COUNTRY_FEATURE_CODES), (boundary_types.ADMIN1, ADMIN_1_FEATURE_CODES), (boundary_types.ADMIN2, ADMIN_2_FEATURE_CODES), (boundary_types.ADMIN3, ADMIN_3_FEATURE_CODES), (boundary_types.ADMIN4, ADMIN_4_FEATURE_CODES), (boundary_types.ADMIN_OTHER, ADMIN_OTHER_FEATURE_CODES), (boundary_types.LOCALITY, POPULATED_PLACE_FEATURE_CODES), (boundary_types.NEIGHBORHOOD, NEIGHBORHOOD_FEATURE_CODES), ]) # Inserted post-query DUMMY_BOUNDARY_TYPE = '-1 as type' DUMMY_HAS_WIKIPEDIA_ENTRY = '0 as has_wikipedia_entry' DUMMY_LANGUAGE_PRIORITY = '0 as language_priority' class GeonamesField(object): def __init__(self, name, c_constant, default=None, is_dummy=False): self.name = name self.c_constant = c_constant self.default = default self.is_dummy = is_dummy geonames_fields = [ # Field if alternate_names present, default field name if not, C header constant GeonamesField('alternate_name', 'GEONAMES_NAME', default='gn.name'), GeonamesField('gn.geonames_id as geonames_id', 'GEONAMES_ID'), GeonamesField('gn.name as canonical', 'GEONAMES_CANONICAL'), GeonamesField(DUMMY_BOUNDARY_TYPE, 'GEONAMES_BOUNDARY_TYPE', is_dummy=True), GeonamesField(DUMMY_HAS_WIKIPEDIA_ENTRY, 'GEONAMES_HAS_WIKIPEDIA_ENTRY', is_dummy=True), GeonamesField('iso_language', 'GEONAMES_ISO_LANGUAGE', default="''"), GeonamesField(DUMMY_LANGUAGE_PRIORITY, 'GEONAMES_LANGUAGE_PRIORITY', is_dummy=True), GeonamesField('is_preferred_name', 'GEONAMES_IS_PREFERRED_NAME', default='0'), GeonamesField('is_short_name', 'GEONAMES_IS_SHORT_NAME', default='0'), GeonamesField('is_colloquial', 'GEONAMES_IS_COLLOQUIAL', default='0'), GeonamesField('is_historic', 'GEONAMES_IS_HISTORICAL', default='0'), GeonamesField('gn.population', 'GEONAMES_POPULATION'), GeonamesField('gn.latitude', 'GEONAMES_LATITUDE'), GeonamesField('gn.longitude', 'GEONAMES_LONGITUDE'), GeonamesField('gn.feature_code', 'GEONAMES_FEATURE_CODE'), GeonamesField('gn.country_code as country_code', 'GEONAMES_COUNTRY_CODE'), GeonamesField('c.geonames_id as country_gn_id', 'GEONAMES_COUNTRY_ID'), GeonamesField('gn.admin1_code as admin1_code', 'GEONAMES_ADMIN1_CODE'), GeonamesField('a1.geonames_id as a1_gn_id', 'GEONAMES_ADMIN1_ID'), GeonamesField('gn.admin2_code as admin2_code', 'GEONAMES_ADMIN2_CODE'), GeonamesField('a2.geonames_id as a2_gn_id', 'GEONAMES_ADMIN2_ID'), GeonamesField('gn.admin3_code as admin3_code', 'GEONAMES_ADMIN3_CODE'), GeonamesField('a3.geonames_id as a3_gn_id', 'GEONAMES_ADMIN3_ID'), GeonamesField('gn.admin4_code as admin4_code', 'GEONAMES_ADMIN4_CODE'), GeonamesField('a4.geonames_id as a4_gn_id', 'GEONAMES_ADMIN4_ID'), ] def geonames_field_index(s): for i, f in enumerate(geonames_fields): if f.c_constant == s: return i return None DUMMY_BOUNDARY_TYPE_INDEX = geonames_field_index('GEONAMES_BOUNDARY_TYPE') DUMMY_HAS_WIKIPEDIA_ENTRY_INDEX = geonames_field_index('GEONAMES_HAS_WIKIPEDIA_ENTRY') GEONAMES_ID_INDEX = geonames_field_index('GEONAMES_ID') LANGUAGE_INDEX = geonames_field_index('GEONAMES_ISO_LANGUAGE') DUMMY_LANGUAGE_PRIORITY_INDEX = geonames_field_index('GEONAMES_LANGUAGE_PRIORITY') CANONICAL_NAME_INDEX = geonames_field_index('GEONAMES_CANONICAL') NAME_INDEX = geonames_field_index('GEONAMES_NAME') COUNTRY_CODE_INDEX = geonames_field_index('GEONAMES_COUNTRY_CODE') POPULATION_INDEX = geonames_field_index('GEONAMES_POPULATION') PREFERRED_INDEX = geonames_field_index('GEONAMES_IS_PREFERRED_NAME') HISTORICAL_INDEX = geonames_field_index('GEONAMES_IS_HISTORICAL') geonames_admin_joins = ''' left join admin1_codes a1 on a1.code = gn.admin1_code and a1.country_code = gn.country_code left join admin2_codes a2 on a2.code = gn.admin2_code and a2.admin1_code = gn.admin1_code and a2.country_code = gn.country_code left join admin3_codes a3 on a3.code = gn.admin3_code and a3.admin1_code = gn.admin1_code and a3.admin2_code = gn.admin2_code and a3.country_code = gn.country_code left join admin4_codes a4 on a4.code = gn.admin4_code and a4.admin1_code = gn.admin1_code and a4.admin2_code = gn.admin2_code and a4.admin3_code = gn.admin3_code and a4.country_code = gn.country_code ''' # Canonical names are stored in the geonames table with alternates # stored in a separate table. UNION ALL query will capture them all. base_geonames_query = ''' select {geonames_fields} from geonames gn join countries c on gn.country_code = c.country_code {admin_joins} {{predicate}} union all select {alt_name_fields} from geonames gn join countries c on gn.country_code = c.country_code join alternate_names an on an.geonames_id = gn.geonames_id and iso_language not in ('doi','faac','iata', 'icao','link','post','tcid') and an.alternate_name != gn.name {admin_joins} {{predicate}} '''.format( geonames_fields=', '.join((f.name if f.default is None else '{} as {}'.format(f.default, f.name) for f in geonames_fields)), alt_name_fields=', '.join((f.name for f in geonames_fields)), admin_joins=geonames_admin_joins ) IGNORE_COUNTRY_POSTAL_CODES = set([ 'AR', # GeoNames has pre-1999 postal codes ]) postal_code_fields = [ GeonamesField('postal_code', 'GN_POSTAL_CODE'), GeonamesField('p.country_code as country_code', 'GN_POSTAL_COUNTRY_CODE'), GeonamesField('c.geonames_id as country_geonames_id', 'GN_POSTAL_COUNTRY_GEONAMES_ID'), GeonamesField('c.population as country_population', 'GN_POSTAL_COUNTRY_POPULATION'), GeonamesField('n.geonames_id as containing_geoname_id', 'GN_POSTAL_CONTAINING_GEONAME_ID'), GeonamesField('group_concat(distinct a1.geonames_id) admin1_ids', 'GN_POSTAL_ADMIN1_IDS'), GeonamesField('group_concat(distinct a2.geonames_id) admin2_ids', 'GN_POSTAL_ADMIN2_IDS'), GeonamesField('group_concat(distinct a3.geonames_id) admin3_ids', 'GN_POSTAL_ADMIN3_IDS'), ] def postal_code_field_index(s): for i, f in enumerate(postal_code_fields): if f.c_constant == s: return i return None POSTAL_CODE_INDEX = postal_code_field_index('GN_POSTAL_CODE') POSTAL_CODE_POP_INDEX = postal_code_field_index('GN_POSTAL_COUNTRY_POPULATION') postal_codes_query = ''' select {fields} from postal_codes p join countries c on p.country_code = c.country_code left join ( select gn.geonames_id, alternate_name, country_code, gn.name from alternate_names an join geonames gn on an.geonames_id = gn.geonames_id where iso_language = 'post' ) as n on p.postal_code = n.alternate_name and p.country_code = n.country_code left join admin1_codes a1 on a1.code = p.admin1_code and p.country_code = a1.country_code left join admin2_codes a2 on a2.code = p.admin2_code and a2.admin1_code = p.admin1_code and a2.country_code = p.country_code left join admin3_codes a3 on a3.code = p.admin3_code and a3.admin1_code = p.admin1_code and a3.admin2_code = p.admin2_code and a3.country_code = p.country_code where p.country_code not in ({exclude_country_codes}) group by postal_code, p.country_code '''.format( fields=','.join([f.name for f in postal_code_fields]), exclude_country_codes=','.join("'{}'".format(code) for code in IGNORE_COUNTRY_POSTAL_CODES)) wikipedia_query = ''' select alternate_name, geonames_id, is_preferred_name from alternate_names where iso_language = 'link' and alternate_name like '%%en.wikipedia%%' order by alternate_name, is_preferred_name ''' BATCH_SIZE = 2000 wiki_paren_regex = re.compile('(.*)[\s]*\(.*?\)[\s]*') def normalize_wikipedia_title(title): return safe_decode(title).replace(u'_', u' ') def normalize_wikipedia_url(url): url = urllib.unquote_plus(url) parsed = urlparse.urlsplit(url) if parsed.query: params = urlparse.parse_qs(parsed.query) if 'title' in params: return normalize_wikipedia_title(params['title'][0]) title = parsed.path.rsplit('/', 1)[-1] if title not in ('index.php', 'index.html'): return normalize_wikipedia_title(title) return None def normalize_name(name): name = name.replace('&', 'and') name = name.replace('-', ' ') name = name.replace(', ', ' ') name = name.replace(',', ' ') return name saint_replacements = [ ('st.', 'saint'), ('st.', 'st'), ('st', 'saint') ] abbreviated_saint_regex = re.compile(r'\bSt(\.|\b)') def normalize_display_name(name): return abbreviated_saint_regex.sub('Saint', name).replace('&', 'and') def utf8_normalize(s, form='NFD'): return unicodedata.normalize(form, s) def get_wikipedia_titles(db): d = defaultdict(dict) cursor = db.execute(wikipedia_query) while True: batch = cursor.fetchmany(BATCH_SIZE) if not batch: break for (url, geonames_id, is_preferred) in batch: title = normalize_wikipedia_url(safe_encode(url)) if title is not None and title.strip(): title = utf8_normalize(normalize_name(title)) d[title.lower()][geonames_id] = int(is_preferred or 0) return d def create_geonames_tsv(db, out_dir=DEFAULT_DATA_DIR): ''' Writes geonames.tsv using the specified db to the specified data directory ''' filename = os.path.join(out_dir, 'geonames.tsv') temp_filename = filename + '.tmp' f = open(temp_filename, 'w') writer = csv.writer(f, 'tsv_no_quote') init_languages() init_country_names() wiki_titles = get_wikipedia_titles(db) logging.info('Fetched Wikipedia titles') # Iterate over GeoNames boundary types from largest (country) to smallest (neighborhood) for boundary_type, codes in geonames_admin_dictionaries.iteritems(): if boundary_type != boundary_types.COUNTRY: predicate = 'where gn.feature_code in ({codes})'.format( codes=','.join(['"{}"'.format(c) for c in codes]) ) else: # The query for countries in GeoNames is somewhat non-trivial predicate = 'where gn.geonames_id in (select geonames_id from countries)' query = base_geonames_query.format( predicate=predicate ) cursor = db.execute(query) i = 1 while True: # Fetch rows in batches to save memory batch = cursor.fetchmany(BATCH_SIZE) if not batch: break rows = [] for row in batch: row = list(row) row[DUMMY_BOUNDARY_TYPE_INDEX] = boundary_type language = row[LANGUAGE_INDEX] country_code = row[COUNTRY_CODE_INDEX] is_preferred = int(row[PREFERRED_INDEX] or 0) is_historical = int(row[HISTORICAL_INDEX] or 0) lang_spoken = get_country_languages(country_code.lower(), official=False).get(language, None) lang_official = get_country_languages(country_code.lower()).get(language, None) == 1 null_language = not language.strip() is_canonical = row[NAME_INDEX] == row[CANONICAL_NAME_INDEX] alpha2_code = None is_orig_name = False if boundary_type == boundary_types.COUNTRY: alpha2_code = row[COUNTRY_CODE_INDEX] is_orig_name = row[NAME_INDEX] == row[CANONICAL_NAME_INDEX] and row[LANGUAGE_INDEX] == '' # Set the canonical for countries to the local name, see country_official_name in country_names.py country_canonical = country_localized_display_name(alpha2_code.lower()) if not country_canonical or not country_canonical.strip(): raise ValueError('Could not get local canonical name for country code={}'.format(alpha2_code)) row[CANONICAL_NAME_INDEX] = country_canonical geonames_id = row[GEONAMES_ID_INDEX] name = utf8_normalize(safe_decode(row[NAME_INDEX])) # For non-postal codes, don't count if name.isdigit(): continue wikipedia_entries = wiki_titles.get(name.lower(), wiki_titles.get(normalize_name(name.lower()), {})) row[NAME_INDEX] = name if boundary_type == boundary_types.COUNTRY: norm_name = normalize_name(name.lower()) for s, repl in saint_replacements: if not wikipedia_entries: wikipedia_entries = wiki_titles.get(norm_name.replace(s, repl), {}) wiki_row = [] have_wikipedia = geonames_id in wikipedia_entries wiki_preferred = wikipedia_entries.get(geonames_id, 0) ''' The following set of heuristics assigns a numerical value to a given name alternative, such that in the case of ambiguous names, this value can be used as part of the ranking function (as indeed it will be during sort). The higher the value, the more likely the given entity resolution. ''' if is_historical: # Historical names, unlikely to be used language_priority = 0 elif not null_language and language != 'abbr' and lang_spoken is None: # Name of a place in language not widely spoken e.g. Japanese name for a US toponym language_priority = 1 elif null_language and not is_preferred and not is_canonical: # Null-language alternate names not marked as preferred, dubious language_priority = 2 elif language == 'abbr' and not is_preferred: # Abbreviation, not preferred language_priority = 3 elif language == 'abbr' and is_preferred: # Abbreviation, preferred e.g. NYC, UAE language_priority = 4 elif lang_spoken and not lang_official and not is_preferred: # Non-preferred name but in a spoken (non-official) language language_priority = 5 elif lang_official == 1 and not is_preferred: # Name in an official language, not preferred language_priority = 6 elif null_language and not is_preferred and is_canonical: # Canonical name, may be overly official e.g. Islamic Republic of Pakistan language_priority = 7 elif is_preferred and not lang_official: # Preferred names, not an official language language_priority = 8 elif is_preferred and lang_official: # Official language preferred language_priority = 9 row[DUMMY_LANGUAGE_PRIORITY_INDEX] = language_priority if have_wikipedia: wiki_row = row[:] wiki_row[DUMMY_HAS_WIKIPEDIA_ENTRY_INDEX] = wiki_preferred + 1 rows.append(map(encode_field, wiki_row)) canonical = utf8_normalize(safe_decode(row[CANONICAL_NAME_INDEX])) row[POPULATION_INDEX] = int(row[POPULATION_INDEX] or 0) have_normalized = False if is_orig_name: canonical_row = wiki_row[:] if have_wikipedia else row[:] canonical_row_name = normalize_display_name(name) if canonical_row_name != name: canonical_row[NAME_INDEX] = safe_encode(canonical_row_name) have_normalized = True rows.append(map(encode_field, canonical_row)) if not have_wikipedia: rows.append(map(encode_field, row)) # Country names have more specialized logic if boundary_type == boundary_types.COUNTRY: wikipedia_entries = wiki_titles.get(canonical.lower(), {}) canonical_row_name = normalize_display_name(canonical) canonical_row = row[:] if is_orig_name: canonical = safe_decode(canonical) canonical_row[NAME_INDEX] = safe_encode(canonical) norm_name = normalize_name(canonical.lower()) for s, repl in saint_replacements: if not wikipedia_entries: wikipedia_entries = wiki_titles.get(norm_name.replace(s, repl), {}) if not wikipedia_entries: norm_name = normalize_name(canonical_row_name.lower()) for s, repl in saint_replacements: if not wikipedia_entries: wikipedia_entries = wiki_titles.get(norm_name.replace(s, repl), {}) have_wikipedia = geonames_id in wikipedia_entries wiki_preferred = wikipedia_entries.get(geonames_id, 0) if have_wikipedia: canonical_row[DUMMY_HAS_WIKIPEDIA_ENTRY_INDEX] = wiki_preferred + 1 if (name != canonical): rows.append(map(encode_field, canonical_row)) if canonical_row_name != canonical and canonical_row_name != name: canonical_row[NAME_INDEX] = safe_encode(canonical_row_name) rows.append(map(encode_field, canonical_row)) if alpha2_code and is_orig_name: alpha2_row = row[:] alpha2_row[NAME_INDEX] = alpha2_code alpha2_row[DUMMY_LANGUAGE_PRIORITY_INDEX] = 10 rows.append(map(encode_field, alpha2_row)) if alpha2_code.lower() in country_alpha3_map and is_orig_name: alpha3_row = row[:] alpha3_row[NAME_INDEX] = country_code_alpha3_map[alpha2_code.lower()] alpha3_row[DUMMY_LANGUAGE_PRIORITY_INDEX] = 10 rows.append(map(encode_field, alpha3_row)) writer.writerows(rows) logging.info('Did {} batches'.format(i)) i += 1 cursor.close() f.flush() f.close() logging.info('Sorting...') env = os.environ.copy() env['LC_ALL'] = 'C' command = ['sort', '-t\t', '-u', '--ignore-case', '-k{0},{0}'.format(NAME_INDEX + 1), # If there's a Wikipedia link to this name for the given id, sort first '-k{0},{0}nr'.format(DUMMY_HAS_WIKIPEDIA_ENTRY_INDEX + 1), # Language priority rules as above '-k{0},{0}nr'.format(DUMMY_LANGUAGE_PRIORITY_INDEX + 1), # Sort descending by population (basic proxy for relevance) '-k{0},{0}nr'.format(POPULATION_INDEX + 1), # group rows for the same geonames ID together '-k{0},{0}'.format(GEONAMES_ID_INDEX + 1), # preferred names come first within that grouping '-k{0},{0}nr'.format(PREFERRED_INDEX + 1), # since uniquing is done on the sort key, add language '-k{0},{0}'.format(LANGUAGE_INDEX + 1), '-o', filename, temp_filename] p = subprocess.Popen(command, env=env) return_code = p.wait() if return_code != 0: raise subprocess.CalledProcessError(return_code, command) os.unlink(temp_filename) def create_postal_codes_tsv(db, out_dir=DEFAULT_DATA_DIR): filename = os.path.join(out_dir, 'postal_codes.tsv') temp_filename = filename + '.tmp' f = open(temp_filename, 'w') writer = csv.writer(f, 'tsv_no_quote') cursor = db.execute(postal_codes_query) i = 1 while True: batch = cursor.fetchmany(BATCH_SIZE) if not batch: break rows = [ map(encode_field, row) for row in batch ] writer.writerows(rows) logging.info('Did {} batches'.format(i)) i += 1 cursor.close() f.close() logging.info('Sorting...') subprocess.check_call([ 'sort', '-t\t', '--ignore-case', '-k{0},{0}'.format(POSTAL_CODE_INDEX + 1), '-k{0},{0}nr'.format(POSTAL_CODE_POP_INDEX + 1), '-o', filename, temp_filename ]) os.unlink(temp_filename) # Generates a C header telling us the order of the fields as written GEONAMES_FIELDS_HEADER = os.path.join(this_dir, os.pardir, os.pardir, os.pardir, 'src', 'geonames_fields.h') GEONAMES_FIELDS_HEADER_FILE = '''enum geonames_fields {{ {fields}, NUM_GEONAMES_FIELDS }}; '''.format(fields=''', '''.join(['{}={}'.format(f.c_constant, i) for i, f in enumerate(geonames_fields)])) def write_geonames_fields_header(filename=GEONAMES_FIELDS_HEADER): with open(filename, 'w') as f: f.write(GEONAMES_FIELDS_HEADER_FILE) POSTAL_FIELDS_HEADER = os.path.join(this_dir, os.pardir, os.pardir, os.pardir, 'src', 'postal_fields.h') POSTAL_FIELDS_HEADER_FILE = '''enum gn_postal_fields {{ {fields}, NUM_POSTAL_FIELDS }}; '''.format(fields=''', '''.join(['{}={}'.format(f.c_constant, i) for i, f in enumerate(postal_code_fields)])) def write_postal_fields_header(filename=POSTAL_FIELDS_HEADER): with open(filename, 'w') as f: f.write(POSTAL_FIELDS_HEADER_FILE) if __name__ == '__main__': # Handle argument parsing here parser = argparse.ArgumentParser() parser.add_argument('-d', '--db', default=DEFAULT_GEONAMES_DB_PATH, help='SQLite db file') parser.add_argument('-o', '--out', default=DEFAULT_DATA_DIR, help='output directory') args = parser.parse_args() db = sqlite3.connect(args.db) create_geonames_tsv(db, args.out) create_postal_codes_tsv(db, args.out) write_geonames_fields_header() write_postal_fields_header() db.close()
11,734
2,151
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CC_BASE_DEVTOOLS_INSTRUMENTATION_H_ #define CC_BASE_DEVTOOLS_INSTRUMENTATION_H_ #include <stdint.h> #include <memory> #include "base/macros.h" #include "base/metrics/histogram_macros.h" #include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event_argument.h" #include "cc/base/base_export.h" namespace cc { namespace devtools_instrumentation { namespace internal { CC_BASE_EXPORT extern const char kCategory[]; CC_BASE_EXPORT extern const char kCategoryFrame[]; CC_BASE_EXPORT extern const char kData[]; CC_BASE_EXPORT extern const char kFrameId[]; CC_BASE_EXPORT extern const char kLayerId[]; CC_BASE_EXPORT extern const char kLayerTreeId[]; CC_BASE_EXPORT extern const char kPixelRefId[]; CC_BASE_EXPORT extern const char kImageDecodeTask[]; CC_BASE_EXPORT extern const char kBeginFrame[]; CC_BASE_EXPORT extern const char kNeedsBeginFrameChanged[]; CC_BASE_EXPORT extern const char kActivateLayerTree[]; CC_BASE_EXPORT extern const char kRequestMainThreadFrame[]; CC_BASE_EXPORT extern const char kBeginMainThreadFrame[]; CC_BASE_EXPORT extern const char kDrawFrame[]; CC_BASE_EXPORT extern const char kCompositeLayers[]; } // namespace internal extern const char kPaintSetup[]; CC_BASE_EXPORT extern const char kUpdateLayer[]; class CC_BASE_EXPORT ScopedLayerTask { public: ScopedLayerTask(const char* event_name, int layer_id) : event_name_(event_name) { TRACE_EVENT_BEGIN1(internal::kCategory, event_name_, internal::kLayerId, layer_id); } ~ScopedLayerTask() { TRACE_EVENT_END0(internal::kCategory, event_name_); } private: const char* event_name_; DISALLOW_COPY_AND_ASSIGN(ScopedLayerTask); }; class CC_BASE_EXPORT ScopedImageDecodeTask { public: enum DecodeType { kSoftware, kGpu }; enum TaskType { kInRaster, kOutOfRaster }; ScopedImageDecodeTask(const void* image_ptr, DecodeType decode_type, TaskType task_type); ~ScopedImageDecodeTask(); private: const DecodeType decode_type_; const TaskType task_type_; const base::TimeTicks start_time_; DISALLOW_COPY_AND_ASSIGN(ScopedImageDecodeTask); }; class CC_BASE_EXPORT ScopedLayerTreeTask { public: ScopedLayerTreeTask(const char* event_name, int layer_id, int layer_tree_host_id) : event_name_(event_name) { TRACE_EVENT_BEGIN2(internal::kCategory, event_name_, internal::kLayerId, layer_id, internal::kLayerTreeId, layer_tree_host_id); } ~ScopedLayerTreeTask() { TRACE_EVENT_END0(internal::kCategory, event_name_); } private: const char* event_name_; DISALLOW_COPY_AND_ASSIGN(ScopedLayerTreeTask); }; struct CC_BASE_EXPORT ScopedCommitTrace { public: explicit ScopedCommitTrace(int layer_tree_host_id) { TRACE_EVENT_BEGIN1(internal::kCategory, internal::kCompositeLayers, internal::kLayerTreeId, layer_tree_host_id); } ~ScopedCommitTrace() { TRACE_EVENT_END0(internal::kCategory, internal::kCompositeLayers); } private: DISALLOW_COPY_AND_ASSIGN(ScopedCommitTrace); }; struct CC_BASE_EXPORT ScopedLayerObjectTracker : public base::trace_event::TraceScopedTrackableObject<int> { explicit ScopedLayerObjectTracker(int layer_id) : base::trace_event::TraceScopedTrackableObject<int>(internal::kCategory, internal::kLayerId, layer_id) {} private: DISALLOW_COPY_AND_ASSIGN(ScopedLayerObjectTracker); }; inline void CC_BASE_EXPORT DidActivateLayerTree(int layer_tree_host_id, int frame_id) { TRACE_EVENT_INSTANT2(internal::kCategoryFrame, internal::kActivateLayerTree, TRACE_EVENT_SCOPE_THREAD, internal::kLayerTreeId, layer_tree_host_id, internal::kFrameId, frame_id); } inline void CC_BASE_EXPORT DidBeginFrame(int layer_tree_host_id) { TRACE_EVENT_INSTANT1(internal::kCategoryFrame, internal::kBeginFrame, TRACE_EVENT_SCOPE_THREAD, internal::kLayerTreeId, layer_tree_host_id); } inline void CC_BASE_EXPORT DidDrawFrame(int layer_tree_host_id) { TRACE_EVENT_INSTANT1(internal::kCategoryFrame, internal::kDrawFrame, TRACE_EVENT_SCOPE_THREAD, internal::kLayerTreeId, layer_tree_host_id); } inline void CC_BASE_EXPORT DidRequestMainThreadFrame(int layer_tree_host_id) { TRACE_EVENT_INSTANT1( internal::kCategoryFrame, internal::kRequestMainThreadFrame, TRACE_EVENT_SCOPE_THREAD, internal::kLayerTreeId, layer_tree_host_id); } inline std::unique_ptr<base::trace_event::ConvertableToTraceFormat> BeginMainThreadFrameData(int frame_id) { std::unique_ptr<base::trace_event::TracedValue> value( new base::trace_event::TracedValue()); value->SetInteger("frameId", frame_id); return std::move(value); } inline void CC_BASE_EXPORT WillBeginMainThreadFrame(int layer_tree_host_id, int frame_id) { TRACE_EVENT_INSTANT2( internal::kCategoryFrame, internal::kBeginMainThreadFrame, TRACE_EVENT_SCOPE_THREAD, internal::kLayerTreeId, layer_tree_host_id, internal::kData, BeginMainThreadFrameData(frame_id)); } inline std::unique_ptr<base::trace_event::ConvertableToTraceFormat> NeedsBeginFrameData(bool needs_begin_frame) { std::unique_ptr<base::trace_event::TracedValue> value( new base::trace_event::TracedValue()); value->SetInteger("needsBeginFrame", needs_begin_frame); return std::move(value); } inline void CC_BASE_EXPORT NeedsBeginFrameChanged(int layer_tree_host_id, bool new_value) { TRACE_EVENT_INSTANT2( internal::kCategoryFrame, internal::kNeedsBeginFrameChanged, TRACE_EVENT_SCOPE_THREAD, internal::kLayerTreeId, layer_tree_host_id, internal::kData, NeedsBeginFrameData(new_value)); } } // namespace devtools_instrumentation } // namespace cc #endif // CC_BASE_DEVTOOLS_INSTRUMENTATION_H_
2,661
483
<filename>YCRefreshViewLib/src/main/java/org/yczbj/ycrefreshviewlib/span/GridSpanSizeLookup.java /* Copyright 2017 yangchong211(github.com/yangchong211) 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. */ package org.yczbj.ycrefreshviewlib.span; import android.support.v7.widget.GridLayoutManager; import org.yczbj.ycrefreshviewlib.inter.InterItemView; import java.util.ArrayList; import java.util.List; /** * <pre> * @author 杨充 * blog : https://github.com/yangchong211 * time : 2017/5/2 * desc : 自定义SpanSizeLookup * revise: * </pre> */ public class GridSpanSizeLookup extends GridLayoutManager.SpanSizeLookup{ private int mMaxCount; private ArrayList<InterItemView> headers; private ArrayList<InterItemView> footers; private List<Object> mObjects; public GridSpanSizeLookup(int maxCount, ArrayList<InterItemView> headers, ArrayList<InterItemView> footers, List<Object> objects){ this.mMaxCount = maxCount; this.headers = headers; this.footers = footers; this.mObjects = objects; } /** * 该方法的返回值就是指定position所占的列数 * @param position 指定索引 * @return 列数 */ @Override public int getSpanSize(int position) { //如果有headerView,则 if (headers.size()!=0){ if (position<headers.size()) { return mMaxCount; } } //如果有footerView,则 if (footers.size()!=0) { int i = position - headers.size() - mObjects.size(); if (i >= 0) { return mMaxCount; } } return 1; } }
978
1,602
#include <stdio.h> #include "lib/requireStmt.h" // Test of calling an exported function involving require statements int main(int argc, char* argv[]) { // Initialize the Chapel runtime and standard modules chpl_library_init(argc, argv); chpl__init_requireStmt(0, 0); callsFoo(); chpl_library_finalize(); return 0; }
113
1,475
/* * 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. */ package org.apache.geode.management.internal.cli.shell; import static java.lang.System.lineSeparator; import static java.nio.charset.Charset.defaultCharset; import static java.nio.file.Files.createDirectory; import static java.nio.file.Files.createFile; import static org.apache.commons.io.FileUtils.writeStringToFile; import static org.apache.geode.management.internal.cli.shell.GfshConfig.DEFAULT_INIT_FILE_NAME; import static org.assertj.core.api.Assertions.assertThat; import java.nio.file.Path; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; public class GfshConfigTest { private Path gfshHistoryFilePath; private Path gfshLogDirPath; @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); @Before public void setUp() throws Exception { gfshHistoryFilePath = temporaryFolder.getRoot().toPath().resolve("history").toAbsolutePath(); gfshLogDirPath = temporaryFolder.getRoot().toPath().resolve("logs").toAbsolutePath(); createFile(gfshHistoryFilePath); createDirectory(gfshLogDirPath); } @Test public void getInitFileNameReturnsNullIfNotProvided() { GfshConfig gfshConfig = new GfshConfig(gfshHistoryFilePath.toString(), "", 0, gfshLogDirPath.toString(), null, null, null, null); assertThat(gfshConfig.getInitFileName()) .as("gfsh init file name") .isNull(); } @Test public void getInitFileNameReturnsNameIfProvidedButDoesNotExist() { // Construct the file name but not the file Path initFilePath = temporaryFolder.getRoot().toPath().resolve(DEFAULT_INIT_FILE_NAME).toAbsolutePath(); GfshConfig gfshConfig = new GfshConfig(gfshHistoryFilePath.toString(), "", 0, gfshLogDirPath.toString(), null, null, null, initFilePath.toString()); assertThat(gfshConfig.getInitFileName()) .as("gfsh init file name") .isNotNull(); } @Test public void getInitFileNameReturnsNameIfProvidedButEmpty() throws Exception { Path initFilePath = temporaryFolder.getRoot().toPath().resolve(DEFAULT_INIT_FILE_NAME).toAbsolutePath(); createFile(initFilePath); GfshConfig gfshConfig = new GfshConfig(gfshHistoryFilePath.toString(), "", 0, gfshLogDirPath.toString(), null, null, null, initFilePath.toString()); assertThat(gfshConfig.getInitFileName()) .as("gfsh init file name") .isNotNull(); } @Test public void getInitFileNameReturnsNameIfProvidedWithGoodCommand() throws Exception { Path initFilePath = temporaryFolder.getRoot().toPath().resolve(DEFAULT_INIT_FILE_NAME).toAbsolutePath(); writeStringToFile(initFilePath.toFile(), "echo --string=hello" + lineSeparator(), defaultCharset()); GfshConfig gfshConfig = new GfshConfig(gfshHistoryFilePath.toString(), "", 0, gfshLogDirPath.toString(), null, null, null, initFilePath.toString()); assertThat(gfshConfig.getInitFileName()) .as("gfsh init file name") .isNotNull(); } @Test public void getInitFileNameReturnsNameIfProvidedWithGoodCommands() throws Exception { Path initFilePath = temporaryFolder.getRoot().toPath().resolve(DEFAULT_INIT_FILE_NAME).toAbsolutePath(); writeStringToFile(initFilePath.toFile(), "echo --string=hello" + lineSeparator(), defaultCharset()); writeStringToFile(initFilePath.toFile(), "echo --string=goodbye" + lineSeparator(), defaultCharset(), true); GfshConfig gfshConfig = new GfshConfig(gfshHistoryFilePath.toString(), "", 0, gfshLogDirPath.toString(), null, null, null, initFilePath.toString()); assertThat(gfshConfig.getInitFileName()) .as("gfsh init file name") .isNotNull(); } @Test public void getInitFileNameReturnsNameIfProvidedWithBadCommand() throws Exception { Path initFilePath = temporaryFolder.getRoot().toPath().resolve(DEFAULT_INIT_FILE_NAME).toAbsolutePath(); writeStringToFile(initFilePath.toFile(), "fail" + lineSeparator(), defaultCharset()); GfshConfig gfshConfig = new GfshConfig(gfshHistoryFilePath.toString(), "", 0, gfshLogDirPath.toString(), null, null, null, initFilePath.toString()); assertThat(gfshConfig.getInitFileName()) .as("gfsh init file name") .isNotNull(); } @Test public void getInitFileNameReturnsNameIfProvidedWithBadCommands() throws Exception { Path initFilePath = temporaryFolder.getRoot().toPath().resolve(DEFAULT_INIT_FILE_NAME).toAbsolutePath(); writeStringToFile(initFilePath.toFile(), "fail" + lineSeparator(), defaultCharset()); writeStringToFile(initFilePath.toFile(), "fail" + lineSeparator(), defaultCharset(), true); GfshConfig gfshConfig = new GfshConfig(gfshHistoryFilePath.toString(), "", 0, gfshLogDirPath.toString(), null, null, null, initFilePath.toString()); assertThat(gfshConfig.getInitFileName()) .as("gfsh init file name") .isNotNull(); } @Test public void getInitFileNameReturnsNameIfProvidedWithGoodAndBadCommands() throws Exception { Path initFilePath = temporaryFolder.getRoot().toPath().resolve(DEFAULT_INIT_FILE_NAME).toAbsolutePath(); writeStringToFile(initFilePath.toFile(), "fail" + lineSeparator(), defaultCharset()); writeStringToFile(initFilePath.toFile(), "echo --string=goodbye" + lineSeparator(), defaultCharset(), true); GfshConfig gfshConfig = new GfshConfig(gfshHistoryFilePath.toString(), "", 0, gfshLogDirPath.toString(), null, null, null, initFilePath.toString()); assertThat(gfshConfig.getInitFileName()) .as("gfsh init file name") .isNotNull(); } }
2,285
3,287
<filename>src/azure-cli/azure/cli/command_modules/eventgrid/delivery_attribute_mapping.py # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- import argparse from knack.util import CLIError from azure.mgmt.eventgrid.models import ( StaticDeliveryAttributeMapping, DynamicDeliveryAttributeMapping ) STATIC = "static" DYNAMIC = "dynamic" # pylint: disable=protected-access # pylint: disable=too-few-public-methods class AddDeliveryAttributeMapping(argparse._AppendAction): def __call__(self, parser, namespace, values, option_string=None): valuesLen = len(values) if valuesLen < 2: raise CLIError('usage error: --delivery-attribute-mapping NAME TYPE [SOURCEFIELD] [VALUE] [ISSECRET]') name = values[0] delivery_attribute_type = values[1] if delivery_attribute_type.lower() == STATIC: if valuesLen < 3 or valuesLen > 4: raise CLIError('usage error: --delivery-attribute-mapping <name> static <value> [<true/false>]') value = values[2] isSecret = False if valuesLen == 4: isSecret = bool(values[3]) delivery_attribute_mapping = StaticDeliveryAttributeMapping( name=name, type=delivery_attribute_type, value=value, is_secret=isSecret) elif delivery_attribute_type.lower() == DYNAMIC: if valuesLen != 3: raise CLIError('usage error: --delivery-attribute-mapping <name> dynamic <value>') sourceField = values[2] delivery_attribute_mapping = DynamicDeliveryAttributeMapping( name=name, type=delivery_attribute_type, source_field=sourceField) else: raise CLIError('usage error: --delivery-attribute-mapping NAME TYPE [SOURCEFIELD] [VALUE] [ISSECRET]') if namespace.delivery_attribute_mapping is None: namespace.delivery_attribute_mapping = [] namespace.delivery_attribute_mapping.append(delivery_attribute_mapping)
906
1,338
<reponame>Kirishikesan/haiku<filename>src/preferences/media/IconHandles.h /* * Copyright 2010, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. */ enum { devices_icon = 1, mixer_icon = 2, tv_icon = 3, cam_icon = 4, mic_icon = 5, speaker_icon = 6 };
115
72,551
<filename>test/Index/Store/Inputs/ClangModuleB.h #import "ClangModuleA.h" void funcB(void);
37
2,059
<reponame>krishnaavadhani/testkc1 package com.squareup.spoon; import com.squareup.spoon.html.HtmlRenderer; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.lang.reflect.Field; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; import java.nio.charset.Charset; import java.nio.charset.CharsetDecoder; import java.nio.charset.MalformedInputException; import java.nio.charset.StandardCharsets; import java.util.Iterator; import org.apache.commons.io.FileUtils; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; public final class SpoonHtmlRendererTest { private static final String SPOON_IN_RUSSIAN = "\u041B\u043E\u0436\u043A\u0430"; private static final String[] FILE_EXTENSIONS_TO_CHECK = {"html", "css", "json", "js"}; @Rule public TemporaryFolder testFolder = new TemporaryFolder(); @Test public void correctRenderingOfNonLatinCharacters() throws IOException { SpoonSummary summary = prepareNonLatinSummary(); File folder = testFolder.getRoot(); CharsetDecoder utf8Decoder = StandardCharsets.UTF_8.newDecoder(); HtmlRenderer htmlRenderer = new HtmlRenderer(summary, SpoonUtils.GSON, folder); htmlRenderer.render(); setDefaultCharset(StandardCharsets.US_ASCII); Iterator<File> it = FileUtils.iterateFiles(folder, FILE_EXTENSIONS_TO_CHECK, true); File nextFile = null; try { while (it.hasNext()) { nextFile = it.next(); decode(nextFile, utf8Decoder); } } catch (MalformedInputException ex) { throw new IllegalStateException(String.format("Found wrong file [%s]", nextFile.getName())); } finally { setDefaultCharset(null); } } private SpoonSummary prepareNonLatinSummary() { DeviceTest device = new DeviceTest("foo", "bar"); return new SpoonSummary.Builder() // .setTitle(SPOON_IN_RUSSIAN) // .start() // .addResult(SPOON_IN_RUSSIAN, new DeviceResult.Builder().startTests() // .addTestResultBuilder(device, new DeviceTestResult.Builder() // .startTest() // .markTestAsFailed(SPOON_IN_RUSSIAN).endTest()) // .addException(new RuntimeException(SPOON_IN_RUSSIAN)) // .build()) // .end() // .build(); } private void setDefaultCharset(Charset value) { Field charset; try { charset = Charset.class.getDeclaredField("defaultCharset"); charset.setAccessible(true); charset.set(null, value); } catch (NoSuchFieldException | IllegalAccessException ignored) { } } private void decode(File file, CharsetDecoder charsetDecoder) throws IOException { try (FileInputStream fis = new FileInputStream(file)) { FileChannel fileChannel = fis.getChannel(); ByteBuffer buffer = ByteBuffer.allocate((int) fileChannel.size()); fileChannel.read(buffer); buffer.rewind(); charsetDecoder.decode(buffer); } } }
1,153
984
<reponame>forksnd/win32metadata<filename>generation/WinSDK/RecompiledIdlHeaders/um/mbnapi.h /* this ALWAYS GENERATED file contains the definitions for the interfaces */ /* File created by MIDL compiler version 8.01.0626 */ /* @@MIDL_FILE_HEADING( ) */ /* verify that the <rpcndr.h> version is high enough to compile this file*/ #ifndef __REQUIRED_RPCNDR_H_VERSION__ #define __REQUIRED_RPCNDR_H_VERSION__ 500 #endif /* verify that the <rpcsal.h> version is high enough to compile this file*/ #ifndef __REQUIRED_RPCSAL_H_VERSION__ #define __REQUIRED_RPCSAL_H_VERSION__ 100 #endif #include "rpc.h" #include "rpcndr.h" #ifndef __RPCNDR_H_VERSION__ #error this stub requires an updated version of <rpcndr.h> #endif /* __RPCNDR_H_VERSION__ */ #ifndef COM_NO_WINDOWS_H #include "windows.h" #include "ole2.h" #endif /*COM_NO_WINDOWS_H*/ #ifndef __mbnapi_h__ #define __mbnapi_h__ #if defined(_MSC_VER) && (_MSC_VER >= 1020) #pragma once #endif #ifndef DECLSPEC_XFGVIRT #if _CONTROL_FLOW_GUARD_XFG #define DECLSPEC_XFGVIRT(base, func) __declspec(xfg_virtual(base, func)) #else #define DECLSPEC_XFGVIRT(base, func) #endif #endif /* Forward Declarations */ #ifndef __IDummyMBNUCMExt_FWD_DEFINED__ #define __IDummyMBNUCMExt_FWD_DEFINED__ typedef interface IDummyMBNUCMExt IDummyMBNUCMExt; #endif /* __IDummyMBNUCMExt_FWD_DEFINED__ */ #ifndef __IMbnConnection_FWD_DEFINED__ #define __IMbnConnection_FWD_DEFINED__ typedef interface IMbnConnection IMbnConnection; #endif /* __IMbnConnection_FWD_DEFINED__ */ #ifndef __IMbnConnectionEvents_FWD_DEFINED__ #define __IMbnConnectionEvents_FWD_DEFINED__ typedef interface IMbnConnectionEvents IMbnConnectionEvents; #endif /* __IMbnConnectionEvents_FWD_DEFINED__ */ #ifndef __IMbnInterface_FWD_DEFINED__ #define __IMbnInterface_FWD_DEFINED__ typedef interface IMbnInterface IMbnInterface; #endif /* __IMbnInterface_FWD_DEFINED__ */ #ifndef __IMbnInterfaceEvents_FWD_DEFINED__ #define __IMbnInterfaceEvents_FWD_DEFINED__ typedef interface IMbnInterfaceEvents IMbnInterfaceEvents; #endif /* __IMbnInterfaceEvents_FWD_DEFINED__ */ #ifndef __IMbnInterfaceManager_FWD_DEFINED__ #define __IMbnInterfaceManager_FWD_DEFINED__ typedef interface IMbnInterfaceManager IMbnInterfaceManager; #endif /* __IMbnInterfaceManager_FWD_DEFINED__ */ #ifndef __IMbnInterfaceManagerEvents_FWD_DEFINED__ #define __IMbnInterfaceManagerEvents_FWD_DEFINED__ typedef interface IMbnInterfaceManagerEvents IMbnInterfaceManagerEvents; #endif /* __IMbnInterfaceManagerEvents_FWD_DEFINED__ */ #ifndef __IMbnRegistration_FWD_DEFINED__ #define __IMbnRegistration_FWD_DEFINED__ typedef interface IMbnRegistration IMbnRegistration; #endif /* __IMbnRegistration_FWD_DEFINED__ */ #ifndef __IMbnRegistrationEvents_FWD_DEFINED__ #define __IMbnRegistrationEvents_FWD_DEFINED__ typedef interface IMbnRegistrationEvents IMbnRegistrationEvents; #endif /* __IMbnRegistrationEvents_FWD_DEFINED__ */ #ifndef __IMbnConnectionManager_FWD_DEFINED__ #define __IMbnConnectionManager_FWD_DEFINED__ typedef interface IMbnConnectionManager IMbnConnectionManager; #endif /* __IMbnConnectionManager_FWD_DEFINED__ */ #ifndef __IMbnConnectionManagerEvents_FWD_DEFINED__ #define __IMbnConnectionManagerEvents_FWD_DEFINED__ typedef interface IMbnConnectionManagerEvents IMbnConnectionManagerEvents; #endif /* __IMbnConnectionManagerEvents_FWD_DEFINED__ */ #ifndef __IMbnPinManager_FWD_DEFINED__ #define __IMbnPinManager_FWD_DEFINED__ typedef interface IMbnPinManager IMbnPinManager; #endif /* __IMbnPinManager_FWD_DEFINED__ */ #ifndef __IMbnPinManagerEvents_FWD_DEFINED__ #define __IMbnPinManagerEvents_FWD_DEFINED__ typedef interface IMbnPinManagerEvents IMbnPinManagerEvents; #endif /* __IMbnPinManagerEvents_FWD_DEFINED__ */ #ifndef __IMbnPinEvents_FWD_DEFINED__ #define __IMbnPinEvents_FWD_DEFINED__ typedef interface IMbnPinEvents IMbnPinEvents; #endif /* __IMbnPinEvents_FWD_DEFINED__ */ #ifndef __IMbnSubscriberInformation_FWD_DEFINED__ #define __IMbnSubscriberInformation_FWD_DEFINED__ typedef interface IMbnSubscriberInformation IMbnSubscriberInformation; #endif /* __IMbnSubscriberInformation_FWD_DEFINED__ */ #ifndef __IMbnSignal_FWD_DEFINED__ #define __IMbnSignal_FWD_DEFINED__ typedef interface IMbnSignal IMbnSignal; #endif /* __IMbnSignal_FWD_DEFINED__ */ #ifndef __IMbnSignalEvents_FWD_DEFINED__ #define __IMbnSignalEvents_FWD_DEFINED__ typedef interface IMbnSignalEvents IMbnSignalEvents; #endif /* __IMbnSignalEvents_FWD_DEFINED__ */ #ifndef __IMbnConnectionContext_FWD_DEFINED__ #define __IMbnConnectionContext_FWD_DEFINED__ typedef interface IMbnConnectionContext IMbnConnectionContext; #endif /* __IMbnConnectionContext_FWD_DEFINED__ */ #ifndef __IMbnConnectionContextEvents_FWD_DEFINED__ #define __IMbnConnectionContextEvents_FWD_DEFINED__ typedef interface IMbnConnectionContextEvents IMbnConnectionContextEvents; #endif /* __IMbnConnectionContextEvents_FWD_DEFINED__ */ #ifndef __IMbnConnectionProfileManager_FWD_DEFINED__ #define __IMbnConnectionProfileManager_FWD_DEFINED__ typedef interface IMbnConnectionProfileManager IMbnConnectionProfileManager; #endif /* __IMbnConnectionProfileManager_FWD_DEFINED__ */ #ifndef __IMbnConnectionProfile_FWD_DEFINED__ #define __IMbnConnectionProfile_FWD_DEFINED__ typedef interface IMbnConnectionProfile IMbnConnectionProfile; #endif /* __IMbnConnectionProfile_FWD_DEFINED__ */ #ifndef __IMbnConnectionProfileEvents_FWD_DEFINED__ #define __IMbnConnectionProfileEvents_FWD_DEFINED__ typedef interface IMbnConnectionProfileEvents IMbnConnectionProfileEvents; #endif /* __IMbnConnectionProfileEvents_FWD_DEFINED__ */ #ifndef __IMbnSmsConfiguration_FWD_DEFINED__ #define __IMbnSmsConfiguration_FWD_DEFINED__ typedef interface IMbnSmsConfiguration IMbnSmsConfiguration; #endif /* __IMbnSmsConfiguration_FWD_DEFINED__ */ #ifndef __IMbnSmsReadMsgPdu_FWD_DEFINED__ #define __IMbnSmsReadMsgPdu_FWD_DEFINED__ typedef interface IMbnSmsReadMsgPdu IMbnSmsReadMsgPdu; #endif /* __IMbnSmsReadMsgPdu_FWD_DEFINED__ */ #ifndef __IMbnSmsReadMsgTextCdma_FWD_DEFINED__ #define __IMbnSmsReadMsgTextCdma_FWD_DEFINED__ typedef interface IMbnSmsReadMsgTextCdma IMbnSmsReadMsgTextCdma; #endif /* __IMbnSmsReadMsgTextCdma_FWD_DEFINED__ */ #ifndef __IMbnSms_FWD_DEFINED__ #define __IMbnSms_FWD_DEFINED__ typedef interface IMbnSms IMbnSms; #endif /* __IMbnSms_FWD_DEFINED__ */ #ifndef __IMbnSmsEvents_FWD_DEFINED__ #define __IMbnSmsEvents_FWD_DEFINED__ typedef interface IMbnSmsEvents IMbnSmsEvents; #endif /* __IMbnSmsEvents_FWD_DEFINED__ */ #ifndef __IMbnServiceActivation_FWD_DEFINED__ #define __IMbnServiceActivation_FWD_DEFINED__ typedef interface IMbnServiceActivation IMbnServiceActivation; #endif /* __IMbnServiceActivation_FWD_DEFINED__ */ #ifndef __IMbnServiceActivationEvents_FWD_DEFINED__ #define __IMbnServiceActivationEvents_FWD_DEFINED__ typedef interface IMbnServiceActivationEvents IMbnServiceActivationEvents; #endif /* __IMbnServiceActivationEvents_FWD_DEFINED__ */ #ifndef __IMbnVendorSpecificOperation_FWD_DEFINED__ #define __IMbnVendorSpecificOperation_FWD_DEFINED__ typedef interface IMbnVendorSpecificOperation IMbnVendorSpecificOperation; #endif /* __IMbnVendorSpecificOperation_FWD_DEFINED__ */ #ifndef __IMbnVendorSpecificEvents_FWD_DEFINED__ #define __IMbnVendorSpecificEvents_FWD_DEFINED__ typedef interface IMbnVendorSpecificEvents IMbnVendorSpecificEvents; #endif /* __IMbnVendorSpecificEvents_FWD_DEFINED__ */ #ifndef __IMbnConnectionProfileManagerEvents_FWD_DEFINED__ #define __IMbnConnectionProfileManagerEvents_FWD_DEFINED__ typedef interface IMbnConnectionProfileManagerEvents IMbnConnectionProfileManagerEvents; #endif /* __IMbnConnectionProfileManagerEvents_FWD_DEFINED__ */ #ifndef __IMbnRadio_FWD_DEFINED__ #define __IMbnRadio_FWD_DEFINED__ typedef interface IMbnRadio IMbnRadio; #endif /* __IMbnRadio_FWD_DEFINED__ */ #ifndef __IMbnRadioEvents_FWD_DEFINED__ #define __IMbnRadioEvents_FWD_DEFINED__ typedef interface IMbnRadioEvents IMbnRadioEvents; #endif /* __IMbnRadioEvents_FWD_DEFINED__ */ #ifndef __IMbnMultiCarrier_FWD_DEFINED__ #define __IMbnMultiCarrier_FWD_DEFINED__ typedef interface IMbnMultiCarrier IMbnMultiCarrier; #endif /* __IMbnMultiCarrier_FWD_DEFINED__ */ #ifndef __IMbnMultiCarrierEvents_FWD_DEFINED__ #define __IMbnMultiCarrierEvents_FWD_DEFINED__ typedef interface IMbnMultiCarrierEvents IMbnMultiCarrierEvents; #endif /* __IMbnMultiCarrierEvents_FWD_DEFINED__ */ #ifndef __IMbnDeviceServiceStateEvents_FWD_DEFINED__ #define __IMbnDeviceServiceStateEvents_FWD_DEFINED__ typedef interface IMbnDeviceServiceStateEvents IMbnDeviceServiceStateEvents; #endif /* __IMbnDeviceServiceStateEvents_FWD_DEFINED__ */ #ifndef __IMbnDeviceServicesManager_FWD_DEFINED__ #define __IMbnDeviceServicesManager_FWD_DEFINED__ typedef interface IMbnDeviceServicesManager IMbnDeviceServicesManager; #endif /* __IMbnDeviceServicesManager_FWD_DEFINED__ */ #ifndef __IMbnDeviceServicesContext_FWD_DEFINED__ #define __IMbnDeviceServicesContext_FWD_DEFINED__ typedef interface IMbnDeviceServicesContext IMbnDeviceServicesContext; #endif /* __IMbnDeviceServicesContext_FWD_DEFINED__ */ #ifndef __IMbnDeviceServicesEvents_FWD_DEFINED__ #define __IMbnDeviceServicesEvents_FWD_DEFINED__ typedef interface IMbnDeviceServicesEvents IMbnDeviceServicesEvents; #endif /* __IMbnDeviceServicesEvents_FWD_DEFINED__ */ #ifndef __IMbnDeviceService_FWD_DEFINED__ #define __IMbnDeviceService_FWD_DEFINED__ typedef interface IMbnDeviceService IMbnDeviceService; #endif /* __IMbnDeviceService_FWD_DEFINED__ */ #ifndef __IMbnInterface_FWD_DEFINED__ #define __IMbnInterface_FWD_DEFINED__ typedef interface IMbnInterface IMbnInterface; #endif /* __IMbnInterface_FWD_DEFINED__ */ #ifndef __IMbnSubscriberInformation_FWD_DEFINED__ #define __IMbnSubscriberInformation_FWD_DEFINED__ typedef interface IMbnSubscriberInformation IMbnSubscriberInformation; #endif /* __IMbnSubscriberInformation_FWD_DEFINED__ */ #ifndef __IMbnConnection_FWD_DEFINED__ #define __IMbnConnection_FWD_DEFINED__ typedef interface IMbnConnection IMbnConnection; #endif /* __IMbnConnection_FWD_DEFINED__ */ #ifndef __IMbnInterfaceEvents_FWD_DEFINED__ #define __IMbnInterfaceEvents_FWD_DEFINED__ typedef interface IMbnInterfaceEvents IMbnInterfaceEvents; #endif /* __IMbnInterfaceEvents_FWD_DEFINED__ */ #ifndef __IMbnSignal_FWD_DEFINED__ #define __IMbnSignal_FWD_DEFINED__ typedef interface IMbnSignal IMbnSignal; #endif /* __IMbnSignal_FWD_DEFINED__ */ #ifndef __IMbnSignalEvents_FWD_DEFINED__ #define __IMbnSignalEvents_FWD_DEFINED__ typedef interface IMbnSignalEvents IMbnSignalEvents; #endif /* __IMbnSignalEvents_FWD_DEFINED__ */ #ifndef __IMbnPinManager_FWD_DEFINED__ #define __IMbnPinManager_FWD_DEFINED__ typedef interface IMbnPinManager IMbnPinManager; #endif /* __IMbnPinManager_FWD_DEFINED__ */ #ifndef __IMbnPinManagerEvents_FWD_DEFINED__ #define __IMbnPinManagerEvents_FWD_DEFINED__ typedef interface IMbnPinManagerEvents IMbnPinManagerEvents; #endif /* __IMbnPinManagerEvents_FWD_DEFINED__ */ #ifndef __IMbnPinEvents_FWD_DEFINED__ #define __IMbnPinEvents_FWD_DEFINED__ typedef interface IMbnPinEvents IMbnPinEvents; #endif /* __IMbnPinEvents_FWD_DEFINED__ */ #ifndef __IMbnRegistration_FWD_DEFINED__ #define __IMbnRegistration_FWD_DEFINED__ typedef interface IMbnRegistration IMbnRegistration; #endif /* __IMbnRegistration_FWD_DEFINED__ */ #ifndef __IMbnRegistrationEvents_FWD_DEFINED__ #define __IMbnRegistrationEvents_FWD_DEFINED__ typedef interface IMbnRegistrationEvents IMbnRegistrationEvents; #endif /* __IMbnRegistrationEvents_FWD_DEFINED__ */ #ifndef __IMbnConnectionContext_FWD_DEFINED__ #define __IMbnConnectionContext_FWD_DEFINED__ typedef interface IMbnConnectionContext IMbnConnectionContext; #endif /* __IMbnConnectionContext_FWD_DEFINED__ */ #ifndef __IMbnConnectionContextEvents_FWD_DEFINED__ #define __IMbnConnectionContextEvents_FWD_DEFINED__ typedef interface IMbnConnectionContextEvents IMbnConnectionContextEvents; #endif /* __IMbnConnectionContextEvents_FWD_DEFINED__ */ #ifndef __IMbnConnectionEvents_FWD_DEFINED__ #define __IMbnConnectionEvents_FWD_DEFINED__ typedef interface IMbnConnectionEvents IMbnConnectionEvents; #endif /* __IMbnConnectionEvents_FWD_DEFINED__ */ #ifndef __IMbnConnectionProfileManager_FWD_DEFINED__ #define __IMbnConnectionProfileManager_FWD_DEFINED__ typedef interface IMbnConnectionProfileManager IMbnConnectionProfileManager; #endif /* __IMbnConnectionProfileManager_FWD_DEFINED__ */ #ifndef __IMbnConnectionProfile_FWD_DEFINED__ #define __IMbnConnectionProfile_FWD_DEFINED__ typedef interface IMbnConnectionProfile IMbnConnectionProfile; #endif /* __IMbnConnectionProfile_FWD_DEFINED__ */ #ifndef __IMbnConnectionProfileEvents_FWD_DEFINED__ #define __IMbnConnectionProfileEvents_FWD_DEFINED__ typedef interface IMbnConnectionProfileEvents IMbnConnectionProfileEvents; #endif /* __IMbnConnectionProfileEvents_FWD_DEFINED__ */ #ifndef __IMbnSmsConfiguration_FWD_DEFINED__ #define __IMbnSmsConfiguration_FWD_DEFINED__ typedef interface IMbnSmsConfiguration IMbnSmsConfiguration; #endif /* __IMbnSmsConfiguration_FWD_DEFINED__ */ #ifndef __IMbnSmsReadMsgPdu_FWD_DEFINED__ #define __IMbnSmsReadMsgPdu_FWD_DEFINED__ typedef interface IMbnSmsReadMsgPdu IMbnSmsReadMsgPdu; #endif /* __IMbnSmsReadMsgPdu_FWD_DEFINED__ */ #ifndef __IMbnSmsReadMsgTextCdma_FWD_DEFINED__ #define __IMbnSmsReadMsgTextCdma_FWD_DEFINED__ typedef interface IMbnSmsReadMsgTextCdma IMbnSmsReadMsgTextCdma; #endif /* __IMbnSmsReadMsgTextCdma_FWD_DEFINED__ */ #ifndef __IMbnSms_FWD_DEFINED__ #define __IMbnSms_FWD_DEFINED__ typedef interface IMbnSms IMbnSms; #endif /* __IMbnSms_FWD_DEFINED__ */ #ifndef __IMbnSmsEvents_FWD_DEFINED__ #define __IMbnSmsEvents_FWD_DEFINED__ typedef interface IMbnSmsEvents IMbnSmsEvents; #endif /* __IMbnSmsEvents_FWD_DEFINED__ */ #ifndef __IMbnServiceActivation_FWD_DEFINED__ #define __IMbnServiceActivation_FWD_DEFINED__ typedef interface IMbnServiceActivation IMbnServiceActivation; #endif /* __IMbnServiceActivation_FWD_DEFINED__ */ #ifndef __IMbnServiceActivationEvents_FWD_DEFINED__ #define __IMbnServiceActivationEvents_FWD_DEFINED__ typedef interface IMbnServiceActivationEvents IMbnServiceActivationEvents; #endif /* __IMbnServiceActivationEvents_FWD_DEFINED__ */ #ifndef __IMbnVendorSpecificOperation_FWD_DEFINED__ #define __IMbnVendorSpecificOperation_FWD_DEFINED__ typedef interface IMbnVendorSpecificOperation IMbnVendorSpecificOperation; #endif /* __IMbnVendorSpecificOperation_FWD_DEFINED__ */ #ifndef __IMbnVendorSpecificEvents_FWD_DEFINED__ #define __IMbnVendorSpecificEvents_FWD_DEFINED__ typedef interface IMbnVendorSpecificEvents IMbnVendorSpecificEvents; #endif /* __IMbnVendorSpecificEvents_FWD_DEFINED__ */ #ifndef __IMbnInterfaceManager_FWD_DEFINED__ #define __IMbnInterfaceManager_FWD_DEFINED__ typedef interface IMbnInterfaceManager IMbnInterfaceManager; #endif /* __IMbnInterfaceManager_FWD_DEFINED__ */ #ifndef __IMbnInterfaceManagerEvents_FWD_DEFINED__ #define __IMbnInterfaceManagerEvents_FWD_DEFINED__ typedef interface IMbnInterfaceManagerEvents IMbnInterfaceManagerEvents; #endif /* __IMbnInterfaceManagerEvents_FWD_DEFINED__ */ #ifndef __IMbnConnectionManager_FWD_DEFINED__ #define __IMbnConnectionManager_FWD_DEFINED__ typedef interface IMbnConnectionManager IMbnConnectionManager; #endif /* __IMbnConnectionManager_FWD_DEFINED__ */ #ifndef __IMbnConnectionManagerEvents_FWD_DEFINED__ #define __IMbnConnectionManagerEvents_FWD_DEFINED__ typedef interface IMbnConnectionManagerEvents IMbnConnectionManagerEvents; #endif /* __IMbnConnectionManagerEvents_FWD_DEFINED__ */ #ifndef __IMbnConnectionProfileManagerEvents_FWD_DEFINED__ #define __IMbnConnectionProfileManagerEvents_FWD_DEFINED__ typedef interface IMbnConnectionProfileManagerEvents IMbnConnectionProfileManagerEvents; #endif /* __IMbnConnectionProfileManagerEvents_FWD_DEFINED__ */ #ifndef __IMbnRadio_FWD_DEFINED__ #define __IMbnRadio_FWD_DEFINED__ typedef interface IMbnRadio IMbnRadio; #endif /* __IMbnRadio_FWD_DEFINED__ */ #ifndef __IMbnRadioEvents_FWD_DEFINED__ #define __IMbnRadioEvents_FWD_DEFINED__ typedef interface IMbnRadioEvents IMbnRadioEvents; #endif /* __IMbnRadioEvents_FWD_DEFINED__ */ #ifndef __IMbnMultiCarrier_FWD_DEFINED__ #define __IMbnMultiCarrier_FWD_DEFINED__ typedef interface IMbnMultiCarrier IMbnMultiCarrier; #endif /* __IMbnMultiCarrier_FWD_DEFINED__ */ #ifndef __IMbnMultiCarrierEvents_FWD_DEFINED__ #define __IMbnMultiCarrierEvents_FWD_DEFINED__ typedef interface IMbnMultiCarrierEvents IMbnMultiCarrierEvents; #endif /* __IMbnMultiCarrierEvents_FWD_DEFINED__ */ #ifndef __IMbnDeviceServiceStateEvents_FWD_DEFINED__ #define __IMbnDeviceServiceStateEvents_FWD_DEFINED__ typedef interface IMbnDeviceServiceStateEvents IMbnDeviceServiceStateEvents; #endif /* __IMbnDeviceServiceStateEvents_FWD_DEFINED__ */ #ifndef __IMbnPin_FWD_DEFINED__ #define __IMbnPin_FWD_DEFINED__ typedef interface IMbnPin IMbnPin; #endif /* __IMbnPin_FWD_DEFINED__ */ #ifndef __IMbnDeviceService_FWD_DEFINED__ #define __IMbnDeviceService_FWD_DEFINED__ typedef interface IMbnDeviceService IMbnDeviceService; #endif /* __IMbnDeviceService_FWD_DEFINED__ */ #ifndef __IMbnDeviceServicesContext_FWD_DEFINED__ #define __IMbnDeviceServicesContext_FWD_DEFINED__ typedef interface IMbnDeviceServicesContext IMbnDeviceServicesContext; #endif /* __IMbnDeviceServicesContext_FWD_DEFINED__ */ #ifndef __IMbnDeviceServicesManager_FWD_DEFINED__ #define __IMbnDeviceServicesManager_FWD_DEFINED__ typedef interface IMbnDeviceServicesManager IMbnDeviceServicesManager; #endif /* __IMbnDeviceServicesManager_FWD_DEFINED__ */ #ifndef __IMbnDeviceServicesEvents_FWD_DEFINED__ #define __IMbnDeviceServicesEvents_FWD_DEFINED__ typedef interface IMbnDeviceServicesEvents IMbnDeviceServicesEvents; #endif /* __IMbnDeviceServicesEvents_FWD_DEFINED__ */ #ifndef __MbnConnectionProfileManager_FWD_DEFINED__ #define __MbnConnectionProfileManager_FWD_DEFINED__ #ifdef __cplusplus typedef class MbnConnectionProfileManager MbnConnectionProfileManager; #else typedef struct MbnConnectionProfileManager MbnConnectionProfileManager; #endif /* __cplusplus */ #endif /* __MbnConnectionProfileManager_FWD_DEFINED__ */ #ifndef __MbnInterfaceManager_FWD_DEFINED__ #define __MbnInterfaceManager_FWD_DEFINED__ #ifdef __cplusplus typedef class MbnInterfaceManager MbnInterfaceManager; #else typedef struct MbnInterfaceManager MbnInterfaceManager; #endif /* __cplusplus */ #endif /* __MbnInterfaceManager_FWD_DEFINED__ */ #ifndef __MbnConnectionManager_FWD_DEFINED__ #define __MbnConnectionManager_FWD_DEFINED__ #ifdef __cplusplus typedef class MbnConnectionManager MbnConnectionManager; #else typedef struct MbnConnectionManager MbnConnectionManager; #endif /* __cplusplus */ #endif /* __MbnConnectionManager_FWD_DEFINED__ */ #ifndef __MbnDeviceServicesManager_FWD_DEFINED__ #define __MbnDeviceServicesManager_FWD_DEFINED__ #ifdef __cplusplus typedef class MbnDeviceServicesManager MbnDeviceServicesManager; #else typedef struct MbnDeviceServicesManager MbnDeviceServicesManager; #endif /* __cplusplus */ #endif /* __MbnDeviceServicesManager_FWD_DEFINED__ */ /* header files for imported files */ #include "oaidl.h" #include "ocidl.h" #ifdef __cplusplus extern "C"{ #endif /* interface __MIDL_itf_mbnapi_0000_0000 */ /* [local] */ #include <winapifamily.h> #pragma region Desktop Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) extern RPC_IF_HANDLE __MIDL_itf_mbnapi_0000_0000_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_mbnapi_0000_0000_v0_0_s_ifspec; #ifndef __IDummyMBNUCMExt_INTERFACE_DEFINED__ #define __IDummyMBNUCMExt_INTERFACE_DEFINED__ /* interface IDummyMBNUCMExt */ /* [object][uuid] */ EXTERN_C const IID IID_IDummyMBNUCMExt; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-FFFF-4BBB-AAEE-338E368AF6FA") IDummyMBNUCMExt : public IDispatch { public: }; #else /* C style interface */ typedef struct IDummyMBNUCMExtVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IDummyMBNUCMExt * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IDummyMBNUCMExt * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IDummyMBNUCMExt * This); DECLSPEC_XFGVIRT(IDispatch, GetTypeInfoCount) HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( __RPC__in IDummyMBNUCMExt * This, /* [annotation][out] */ _Out_ UINT *pctinfo); DECLSPEC_XFGVIRT(IDispatch, GetTypeInfo) HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( __RPC__in IDummyMBNUCMExt * This, /* [annotation][in] */ _In_ UINT iTInfo, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][out] */ _Out_ ITypeInfo **ppTInfo); DECLSPEC_XFGVIRT(IDispatch, GetIDsOfNames) HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( __RPC__in IDummyMBNUCMExt * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][size_is][in] */ _In_reads_(cNames) LPOLESTR *rgszNames, /* [range][in] */ __RPC__in_range(0,16384) UINT cNames, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][size_is][out] */ _Out_writes_(cNames) DISPID *rgDispId); DECLSPEC_XFGVIRT(IDispatch, Invoke) /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( IDummyMBNUCMExt * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); END_INTERFACE } IDummyMBNUCMExtVtbl; interface IDummyMBNUCMExt { CONST_VTBL struct IDummyMBNUCMExtVtbl *lpVtbl; }; #ifdef COBJMACROS #define IDummyMBNUCMExt_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IDummyMBNUCMExt_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IDummyMBNUCMExt_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IDummyMBNUCMExt_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define IDummyMBNUCMExt_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define IDummyMBNUCMExt_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define IDummyMBNUCMExt_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IDummyMBNUCMExt_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_mbnapi_0000_0001 */ /* [local] */ typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("42FAAC0B-BDCC-11DC-A8A8-001321F1405F") enum MBN_SIGNAL_CONSTANTS { MBN_RSSI_DEFAULT = 0xffffffff, MBN_RSSI_DISABLE = 0, MBN_RSSI_UNKNOWN = 99, MBN_ERROR_RATE_UNKNOWN = 99 } MBN_SIGNAL_CONSTANTS; #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ #pragma endregion #pragma region Application Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("DCBBBAB6-6002-4BBB-AAEE-338E368AF6FA") enum MBN_CELLULAR_CLASS { MBN_CELLULAR_CLASS_NONE = 0, MBN_CELLULAR_CLASS_GSM = 0x1, MBN_CELLULAR_CLASS_CDMA = 0x2 } MBN_CELLULAR_CLASS; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("DCBBBAB6-6012-4BBB-AAEE-338E368AF6FA") enum MBN_VOICE_CLASS { MBN_VOICE_CLASS_NONE = 0, MBN_VOICE_CLASS_NO_VOICE = 0x1, MBN_VOICE_CLASS_SEPARATE_VOICE_DATA = 0x2, MBN_VOICE_CLASS_SIMULTANEOUS_VOICE_DATA = 0x3 } MBN_VOICE_CLASS; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("6E1348BB-BDCB-11DC-A8A8-001321F1405F") enum MBN_PROVIDER_STATE { MBN_PROVIDER_STATE_NONE = 0, MBN_PROVIDER_STATE_HOME = 0x1, MBN_PROVIDER_STATE_FORBIDDEN = 0x2, MBN_PROVIDER_STATE_PREFERRED = 0x4, MBN_PROVIDER_STATE_VISIBLE = 0x8, MBN_PROVIDER_STATE_REGISTERED = 0x10, MBN_PROVIDER_STATE_PREFERRED_MULTICARRIER = 0x20 } MBN_PROVIDER_STATE; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("934092FD-BDCB-11DC-A8A8-001321F1405F") enum MBN_PROVIDER_CONSTANTS { MBN_PROVIDERNAME_LEN = 20, MBN_PROVIDERID_LEN = 6 } MBN_PROVIDER_CONSTANTS; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("59C235E7-BDC9-11DC-A8A8-001321F1405F") enum MBN_INTERFACE_CAPS_CONSTANTS { MBN_DEVICEID_LEN = 18, MBN_MANUFACTURER_LEN = 32, MBN_MODEL_LEN = 32, MBN_FIRMWARE_LEN = 32 } MBN_INTERFACE_CAPS_CONSTANTS; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("83A34F4C-BDC4-11DC-A8A8-001321F1405F") enum MBN_DATA_CLASS { MBN_DATA_CLASS_NONE = 0, MBN_DATA_CLASS_GPRS = 0x1, MBN_DATA_CLASS_EDGE = 0x2, MBN_DATA_CLASS_UMTS = 0x4, MBN_DATA_CLASS_HSDPA = 0x8, MBN_DATA_CLASS_HSUPA = 0x10, MBN_DATA_CLASS_LTE = 0x20, MBN_DATA_CLASS_5G_NSA = 0x40, MBN_DATA_CLASS_5G_SA = 0x80, MBN_DATA_CLASS_1XRTT = 0x10000, MBN_DATA_CLASS_1XEVDO = 0x20000, MBN_DATA_CLASS_1XEVDO_REVA = 0x40000, MBN_DATA_CLASS_1XEVDV = 0x80000, MBN_DATA_CLASS_3XRTT = 0x100000, MBN_DATA_CLASS_1XEVDO_REVB = 0x200000, MBN_DATA_CLASS_UMB = 0x400000, MBN_DATA_CLASS_CUSTOM = 0x80000000 } MBN_DATA_CLASS; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("2308C1F7-BDC8-11DC-A8A8-001321F1405F") enum MBN_CTRL_CAPS { MBN_CTRL_CAPS_NONE = 0, MBN_CTRL_CAPS_REG_MANUAL = 0x1, MBN_CTRL_CAPS_HW_RADIO_SWITCH = 0x2, MBN_CTRL_CAPS_CDMA_MOBILE_IP = 0x4, MBN_CTRL_CAPS_CDMA_SIMPLE_IP = 0x8, MBN_CTRL_CAPS_PROTECT_UNIQUEID = 0x10, MBN_CTRL_CAPS_MODEL_MULTI_CARRIER = 0x20, MBN_CTRL_CAPS_USSD = 0x40, MBN_CTRL_CAPS_MULTI_MODE = 0x80 } MBN_CTRL_CAPS; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("E4096459-BDC8-11DC-A8A8-001321F1405F") enum MBN_SMS_CAPS { MBN_SMS_CAPS_NONE = 0, MBN_SMS_CAPS_PDU_RECEIVE = 0x1, MBN_SMS_CAPS_PDU_SEND = 0x2, MBN_SMS_CAPS_TEXT_RECEIVE = 0x4, MBN_SMS_CAPS_TEXT_SEND = 0x8 } MBN_SMS_CAPS; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("5DB6A98B-BDC5-11DC-A8A8-001321F1405F") enum MBN_BAND_CLASS { MBN_BAND_CLASS_NONE = 0, MBN_BAND_CLASS_0 = 0x1, MBN_BAND_CLASS_I = 0x2, MBN_BAND_CLASS_II = 0x4, MBN_BAND_CLASS_III = 0x8, MBN_BAND_CLASS_IV = 0x10, MBN_BAND_CLASS_V = 0x20, MBN_BAND_CLASS_VI = 0x40, MBN_BAND_CLASS_VII = 0x80, MBN_BAND_CLASS_VIII = 0x100, MBN_BAND_CLASS_IX = 0x200, MBN_BAND_CLASS_X = 0x400, MBN_BAND_CLASS_XI = 0x800, MBN_BAND_CLASS_XII = 0x1000, MBN_BAND_CLASS_XIII = 0x2000, MBN_BAND_CLASS_XIV = 0x4000, MBN_BAND_CLASS_XV = 0x8000, MBN_BAND_CLASS_XVI = 0x10000, MBN_BAND_CLASS_XVII = 0x20000, MBN_BAND_CLASS_CUSTOM = 0x80000000 } MBN_BAND_CLASS; typedef /* [uuid] */ DECLSPEC_UUID("CD1A4B17-BDC9-11DC-A8A8-001321F1405F") struct MBN_INTERFACE_CAPS { MBN_CELLULAR_CLASS cellularClass; MBN_VOICE_CLASS voiceClass; ULONG dataClass; BSTR customDataClass; ULONG gsmBandClass; ULONG cdmaBandClass; BSTR customBandClass; ULONG smsCaps; ULONG controlCaps; BSTR deviceID; BSTR manufacturer; BSTR model; BSTR firmwareInfo; } MBN_INTERFACE_CAPS; typedef /* [uuid] */ DECLSPEC_UUID("DCBBBAB6-9005-4BBB-AAEE-338E368AF6FA") struct MBN_PROVIDER { BSTR providerID; ULONG providerState; BSTR providerName; ULONG dataClass; } MBN_PROVIDER; typedef /* [uuid] */ DECLSPEC_UUID("9AA005AE-540B-46F1-9244-8826D188F821") struct MBN_PROVIDER2 { MBN_PROVIDER provider; MBN_CELLULAR_CLASS cellularClass; ULONG signalStrength; ULONG signalError; } MBN_PROVIDER2; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("DCBBBAB6-6003-4BBB-AAEE-338E368AF6FA") enum MBN_READY_STATE { MBN_READY_STATE_OFF = 0, MBN_READY_STATE_INITIALIZED = ( MBN_READY_STATE_OFF + 1 ) , MBN_READY_STATE_SIM_NOT_INSERTED = ( MBN_READY_STATE_INITIALIZED + 1 ) , MBN_READY_STATE_BAD_SIM = ( MBN_READY_STATE_SIM_NOT_INSERTED + 1 ) , MBN_READY_STATE_FAILURE = ( MBN_READY_STATE_BAD_SIM + 1 ) , MBN_READY_STATE_NOT_ACTIVATED = ( MBN_READY_STATE_FAILURE + 1 ) , MBN_READY_STATE_DEVICE_LOCKED = ( MBN_READY_STATE_NOT_ACTIVATED + 1 ) , MBN_READY_STATE_DEVICE_BLOCKED = ( MBN_READY_STATE_DEVICE_LOCKED + 1 ) , MBN_READY_STATE_NO_ESIM_PROFILE = ( MBN_READY_STATE_DEVICE_BLOCKED + 1 ) } MBN_READY_STATE; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("EFB7C00D-BDCD-11DC-A8A8-001321F1405F") enum MBN_ACTIVATION_STATE { MBN_ACTIVATION_STATE_NONE = 0, MBN_ACTIVATION_STATE_ACTIVATED = ( MBN_ACTIVATION_STATE_NONE + 1 ) , MBN_ACTIVATION_STATE_ACTIVATING = ( MBN_ACTIVATION_STATE_ACTIVATED + 1 ) , MBN_ACTIVATION_STATE_DEACTIVATED = ( MBN_ACTIVATION_STATE_ACTIVATING + 1 ) , MBN_ACTIVATION_STATE_DEACTIVATING = ( MBN_ACTIVATION_STATE_DEACTIVATED + 1 ) } MBN_ACTIVATION_STATE; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("F601E1EB-BDCD-11DC-A8A8-001321F1405F") enum MBN_CONNECTION_MODE { MBN_CONNECTION_MODE_PROFILE = 0, MBN_CONNECTION_MODE_TMP_PROFILE = ( MBN_CONNECTION_MODE_PROFILE + 1 ) } MBN_CONNECTION_MODE; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("6D8846E5-BDD1-11DC-A8A8-001321F1405F") enum MBN_VOICE_CALL_STATE { MBN_VOICE_CALL_STATE_NONE = 0, MBN_VOICE_CALL_STATE_IN_PROGRESS = ( MBN_VOICE_CALL_STATE_NONE + 1 ) , MBN_VOICE_CALL_STATE_HANGUP = ( MBN_VOICE_CALL_STATE_IN_PROGRESS + 1 ) } MBN_VOICE_CALL_STATE; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("D5F1726B-BDCE-11DC-A8A8-001321F1405F") enum MBN_REGISTRATION_CONSTANTS { MBN_ROAMTEXT_LEN = 64, MBN_CDMA_DEFAULT_PROVIDER_ID = 0 } MBN_REGISTRATION_CONSTANTS; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("DCBBBAB6-6009-4BBB-AAEE-338E368AF6FA") enum MBN_REGISTER_STATE { MBN_REGISTER_STATE_NONE = 0, MBN_REGISTER_STATE_DEREGISTERED = ( MBN_REGISTER_STATE_NONE + 1 ) , MBN_REGISTER_STATE_SEARCHING = ( MBN_REGISTER_STATE_DEREGISTERED + 1 ) , MBN_REGISTER_STATE_HOME = ( MBN_REGISTER_STATE_SEARCHING + 1 ) , MBN_REGISTER_STATE_ROAMING = ( MBN_REGISTER_STATE_HOME + 1 ) , MBN_REGISTER_STATE_PARTNER = ( MBN_REGISTER_STATE_ROAMING + 1 ) , MBN_REGISTER_STATE_DENIED = ( MBN_REGISTER_STATE_PARTNER + 1 ) } MBN_REGISTER_STATE; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("D7F73F35-BDCD-11DC-A8A8-001321F1405F") enum MBN_REGISTER_MODE { MBN_REGISTER_MODE_NONE = 0, MBN_REGISTER_MODE_AUTOMATIC = ( MBN_REGISTER_MODE_NONE + 1 ) , MBN_REGISTER_MODE_MANUAL = ( MBN_REGISTER_MODE_AUTOMATIC + 1 ) } MBN_REGISTER_MODE; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("C75E76F5-BDCD-11DC-A8A8-001321F1405F") enum MBN_PIN_CONSTANTS { MBN_ATTEMPTS_REMAINING_UNKNOWN = 0xffffffff, MBN_PIN_LENGTH_UNKNOWN = 0xffffffff } MBN_PIN_CONSTANTS; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("D11BD29D-BDCD-11DC-A8A8-001321F1405F") enum MBN_PIN_STATE { MBN_PIN_STATE_NONE = 0, MBN_PIN_STATE_ENTER = ( MBN_PIN_STATE_NONE + 1 ) , MBN_PIN_STATE_UNBLOCK = ( MBN_PIN_STATE_ENTER + 1 ) } MBN_PIN_STATE; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("DCBBBAB6-6005-4BBB-AAEE-338E368AF6FA") enum MBN_PIN_TYPE { MBN_PIN_TYPE_NONE = 0, MBN_PIN_TYPE_CUSTOM = ( MBN_PIN_TYPE_NONE + 1 ) , MBN_PIN_TYPE_PIN1 = ( MBN_PIN_TYPE_CUSTOM + 1 ) , MBN_PIN_TYPE_PIN2 = ( MBN_PIN_TYPE_PIN1 + 1 ) , MBN_PIN_TYPE_DEVICE_SIM_PIN = ( MBN_PIN_TYPE_PIN2 + 1 ) , MBN_PIN_TYPE_DEVICE_FIRST_SIM_PIN = ( MBN_PIN_TYPE_DEVICE_SIM_PIN + 1 ) , MBN_PIN_TYPE_NETWORK_PIN = ( MBN_PIN_TYPE_DEVICE_FIRST_SIM_PIN + 1 ) , MBN_PIN_TYPE_NETWORK_SUBSET_PIN = ( MBN_PIN_TYPE_NETWORK_PIN + 1 ) , MBN_PIN_TYPE_SVC_PROVIDER_PIN = ( MBN_PIN_TYPE_NETWORK_SUBSET_PIN + 1 ) , MBN_PIN_TYPE_CORPORATE_PIN = ( MBN_PIN_TYPE_SVC_PROVIDER_PIN + 1 ) , MBN_PIN_TYPE_SUBSIDY_LOCK = ( MBN_PIN_TYPE_CORPORATE_PIN + 1 ) } MBN_PIN_TYPE; typedef /* [uuid] */ DECLSPEC_UUID("DCBBBAB6-9006-4BBB-AAEE-338E368AF6FA") struct MBN_PIN_INFO { MBN_PIN_STATE pinState; MBN_PIN_TYPE pinType; ULONG attemptsRemaining; } MBN_PIN_INFO; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("BD8A2871-BDCD-11DC-A8A8-001321F1405F") enum MBN_PIN_MODE { MBN_PIN_MODE_ENABLED = 1, MBN_PIN_MODE_DISABLED = ( MBN_PIN_MODE_ENABLED + 1 ) } MBN_PIN_MODE; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("C2A93665-BDCD-11DC-A8A8-001321F1405F") enum MBN_PIN_FORMAT { MBN_PIN_FORMAT_NONE = 0, MBN_PIN_FORMAT_NUMERIC = ( MBN_PIN_FORMAT_NONE + 1 ) , MBN_PIN_FORMAT_ALPHANUMERIC = ( MBN_PIN_FORMAT_NUMERIC + 1 ) } MBN_PIN_FORMAT; #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */ #pragma endregion #pragma region Desktop Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("0E62803F-BDD0-11DC-A8A8-001321F1405F") enum MBN_CONTEXT_CONSTANTS { MBN_ACCESSSTRING_LEN = 100, MBN_USERNAME_LEN = 255, MBN_PASSWORD_LEN = 255, MBN_CONTEXT_ID_APPEND = 0xffffffff } MBN_CONTEXT_CONSTANTS; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("E24B42EF-BDCD-11DC-A8A8-001321F1405F") enum MBN_AUTH_PROTOCOL { MBN_AUTH_PROTOCOL_NONE = 0, MBN_AUTH_PROTOCOL_PAP = ( MBN_AUTH_PROTOCOL_NONE + 1 ) , MBN_AUTH_PROTOCOL_CHAP = ( MBN_AUTH_PROTOCOL_PAP + 1 ) , MBN_AUTH_PROTOCOL_MSCHAPV2 = ( MBN_AUTH_PROTOCOL_CHAP + 1 ) } MBN_AUTH_PROTOCOL; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("E6A360B9-BDCD-11DC-A8A8-001321F1405F") enum MBN_COMPRESSION { MBN_COMPRESSION_NONE = 0, MBN_COMPRESSION_ENABLE = ( MBN_COMPRESSION_NONE + 1 ) } MBN_COMPRESSION; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("EB4731EB-BDCD-11DC-A8A8-001321F1405F") enum MBN_CONTEXT_TYPE { MBN_CONTEXT_TYPE_NONE = 0, MBN_CONTEXT_TYPE_INTERNET = ( MBN_CONTEXT_TYPE_NONE + 1 ) , MBN_CONTEXT_TYPE_VPN = ( MBN_CONTEXT_TYPE_INTERNET + 1 ) , MBN_CONTEXT_TYPE_VOICE = ( MBN_CONTEXT_TYPE_VPN + 1 ) , MBN_CONTEXT_TYPE_VIDEO_SHARE = ( MBN_CONTEXT_TYPE_VOICE + 1 ) , MBN_CONTEXT_TYPE_CUSTOM = ( MBN_CONTEXT_TYPE_VIDEO_SHARE + 1 ) , MBN_CONTEXT_TYPE_PURCHASE = ( MBN_CONTEXT_TYPE_CUSTOM + 1 ) } MBN_CONTEXT_TYPE; typedef /* [uuid] */ DECLSPEC_UUID("FE1F7B6F-BDCD-11DC-A8A8-001321F1405F") struct MBN_CONTEXT { ULONG contextID; MBN_CONTEXT_TYPE contextType; BSTR accessString; BSTR userName; BSTR password; MBN_COMPRESSION compression; MBN_AUTH_PROTOCOL authType; } MBN_CONTEXT; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("130C65D3-BDD3-11DC-A8A8-001321F1405F") enum MBN_SMS_CONSTANTS { MBN_MESSAGE_INDEX_NONE = 0, MBN_CDMA_SHORT_MSG_SIZE_UNKNOWN = 0, MBN_CDMA_SHORT_MSG_SIZE_MAX = 160 } WWAEXT_SMS_CONSTANTS; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("FC208FC1-BDE5-11DC-A8A8-001321F1405F") enum MBN_MSG_STATUS { MBN_MSG_STATUS_NEW = 0, MBN_MSG_STATUS_OLD = ( MBN_MSG_STATUS_NEW + 1 ) , MBN_MSG_STATUS_DRAFT = ( MBN_MSG_STATUS_OLD + 1 ) , MBN_MSG_STATUS_SENT = ( MBN_MSG_STATUS_DRAFT + 1 ) } MBN_MSG_STATUS; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("29912B29-BDD4-11DC-A8A8-001321F1405F") enum MBN_SMS_CDMA_LANG { MBN_SMS_CDMA_LANG_NONE = 0, MBN_SMS_CDMA_LANG_ENGLISH = ( MBN_SMS_CDMA_LANG_NONE + 1 ) , MBN_SMS_CDMA_LANG_FRENCH = ( MBN_SMS_CDMA_LANG_ENGLISH + 1 ) , MBN_SMS_CDMA_LANG_SPANISH = ( MBN_SMS_CDMA_LANG_FRENCH + 1 ) , MBN_SMS_CDMA_LANG_JAPANESE = ( MBN_SMS_CDMA_LANG_SPANISH + 1 ) , MBN_SMS_CDMA_LANG_KOREAN = ( MBN_SMS_CDMA_LANG_JAPANESE + 1 ) , MBN_SMS_CDMA_LANG_CHINESE = ( MBN_SMS_CDMA_LANG_KOREAN + 1 ) , MBN_SMS_CDMA_LANG_HEBREW = ( MBN_SMS_CDMA_LANG_CHINESE + 1 ) } MBN_SMS_CDMA_LANG; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("7F8E74CB-BDD4-11DC-A8A8-001321F1405F") enum MBN_SMS_CDMA_ENCODING { MBN_SMS_CDMA_ENCODING_OCTET = 0, MBN_SMS_CDMA_ENCODING_EPM = ( MBN_SMS_CDMA_ENCODING_OCTET + 1 ) , MBN_SMS_CDMA_ENCODING_7BIT_ASCII = ( MBN_SMS_CDMA_ENCODING_EPM + 1 ) , MBN_SMS_CDMA_ENCODING_IA5 = ( MBN_SMS_CDMA_ENCODING_7BIT_ASCII + 1 ) , MBN_SMS_CDMA_ENCODING_UNICODE = ( MBN_SMS_CDMA_ENCODING_IA5 + 1 ) , MBN_SMS_CDMA_ENCODING_SHIFT_JIS = ( MBN_SMS_CDMA_ENCODING_UNICODE + 1 ) , MBN_SMS_CDMA_ENCODING_KOREAN = ( MBN_SMS_CDMA_ENCODING_SHIFT_JIS + 1 ) , MBN_SMS_CDMA_ENCODING_LATIN_HEBREW = ( MBN_SMS_CDMA_ENCODING_KOREAN + 1 ) , MBN_SMS_CDMA_ENCODING_LATIN = ( MBN_SMS_CDMA_ENCODING_LATIN_HEBREW + 1 ) , MBN_SMS_CDMA_ENCODING_GSM_7BIT = ( MBN_SMS_CDMA_ENCODING_LATIN + 1 ) } MBN_SMS_CDMA_ENCODING; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("0D42B514-BDDC-11DC-A8A8-001321F1405F") enum MBN_SMS_FLAG { MBN_SMS_FLAG_ALL = 0, MBN_SMS_FLAG_INDEX = ( MBN_SMS_FLAG_ALL + 1 ) , MBN_SMS_FLAG_NEW = ( MBN_SMS_FLAG_INDEX + 1 ) , MBN_SMS_FLAG_OLD = ( MBN_SMS_FLAG_NEW + 1 ) , MBN_SMS_FLAG_SENT = ( MBN_SMS_FLAG_OLD + 1 ) , MBN_SMS_FLAG_DRAFT = ( MBN_SMS_FLAG_SENT + 1 ) } MBN_SMS_FLAG; typedef /* [uuid] */ DECLSPEC_UUID("406BFD60-BDDC-11DC-A8A8-001321F1405F") struct MBN_SMS_FILTER { MBN_SMS_FLAG flag; ULONG messageIndex; } MBN_SMS_FILTER; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("8098009D-BDDC-11DC-A8A8-001321F1405F") enum MBN_SMS_STATUS_FLAG { MBN_SMS_FLAG_NONE = 0, MBN_SMS_FLAG_MESSAGE_STORE_FULL = 0x1, MBN_SMS_FLAG_NEW_MESSAGE = 0x2 } MBN_SMS_STATUS_FLAG; typedef /* [uuid] */ DECLSPEC_UUID("1F6E9CA3-BDE6-11DC-A8A8-001321F1405F") struct MBN_SMS_STATUS_INFO { ULONG flag; ULONG messageIndex; } MBN_SMS_STATUS_INFO; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("4B0FE227-3709-41e2-8A78-E98C0CD0CB09") enum MBN_SMS_FORMAT { MBN_SMS_FORMAT_NONE = 0, MBN_SMS_FORMAT_PDU = 0x1, MBN_SMS_FORMAT_TEXT = 0x2 } MBN_SMS_FORMAT; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("532A3FE4-BDE6-11DC-A8A8-001321F1405F") enum MBN_RADIO { MBN_RADIO_OFF = 0, MBN_RADIO_ON = ( MBN_RADIO_OFF + 1 ) } MBN_RADIO; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("0D17D0A2-B2AA-4B34-8655-C2F7F9217473") enum MBN_DEVICE_SERVICE_SESSIONS_STATE { MBN_DEVICE_SERVICE_SESSIONS_RESTORED = 0 } MBN_DEVICE_SERVICE_SESSIONS_STATE; #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ #pragma endregion #pragma region Application Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) typedef /* [uuid] */ DECLSPEC_UUID("60436154-3466-48A4-82E2-9A461527A8C5") struct MBN_DEVICE_SERVICE { BSTR deviceServiceID; VARIANT_BOOL dataWriteSupported; VARIANT_BOOL dataReadSupported; } MBN_DEVICE_SERVICE; typedef /* [helpstring][v1_enum][version][uuid] */ DECLSPEC_UUID("386077A0-275B-45B6-9B32-C343A6749E86") enum MBN_DEVICE_SERVICES_INTERFACE_STATE { MBN_DEVICE_SERVICES_CAPABLE_INTERFACE_ARRIVAL = 0, MBN_DEVICE_SERVICES_CAPABLE_INTERFACE_REMOVAL = ( MBN_DEVICE_SERVICES_CAPABLE_INTERFACE_ARRIVAL + 1 ) } MBN_DEVICE_SERVICES_INTERFACE_STATE; extern RPC_IF_HANDLE __MIDL_itf_mbnapi_0000_0001_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_mbnapi_0000_0001_v0_0_s_ifspec; #ifndef __IMbnConnection_INTERFACE_DEFINED__ #define __IMbnConnection_INTERFACE_DEFINED__ /* interface IMbnConnection */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnConnection; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-200D-4BBB-AAEE-338E368AF6FA") IMbnConnection : public IUnknown { public: virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ConnectionID( /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *ConnectionID) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_InterfaceID( /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *InterfaceID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Connect( /* [annotation][in] */ _In_ MBN_CONNECTION_MODE connectionMode, /* [annotation][string][in] */ _In_ LPCWSTR strProfile, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Disconnect( /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetConnectionState( /* [ref][out] */ __RPC__out MBN_ACTIVATION_STATE *ConnectionState, /* [ref][out] */ __RPC__deref_out_opt BSTR *ProfileName) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetVoiceCallState( /* [retval][ref][out] */ __RPC__out MBN_VOICE_CALL_STATE *voiceCallState) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetActivationNetworkError( /* [retval][ref][out] */ __RPC__out ULONG *networkError) = 0; }; #else /* C style interface */ typedef struct IMbnConnectionVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnConnection * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnConnection * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnConnection * This); DECLSPEC_XFGVIRT(IMbnConnection, get_ConnectionID) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ConnectionID )( __RPC__in IMbnConnection * This, /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *ConnectionID); DECLSPEC_XFGVIRT(IMbnConnection, get_InterfaceID) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_InterfaceID )( __RPC__in IMbnConnection * This, /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *InterfaceID); DECLSPEC_XFGVIRT(IMbnConnection, Connect) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Connect )( __RPC__in IMbnConnection * This, /* [annotation][in] */ _In_ MBN_CONNECTION_MODE connectionMode, /* [annotation][string][in] */ _In_ LPCWSTR strProfile, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnConnection, Disconnect) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Disconnect )( __RPC__in IMbnConnection * This, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnConnection, GetConnectionState) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetConnectionState )( __RPC__in IMbnConnection * This, /* [ref][out] */ __RPC__out MBN_ACTIVATION_STATE *ConnectionState, /* [ref][out] */ __RPC__deref_out_opt BSTR *ProfileName); DECLSPEC_XFGVIRT(IMbnConnection, GetVoiceCallState) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetVoiceCallState )( __RPC__in IMbnConnection * This, /* [retval][ref][out] */ __RPC__out MBN_VOICE_CALL_STATE *voiceCallState); DECLSPEC_XFGVIRT(IMbnConnection, GetActivationNetworkError) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetActivationNetworkError )( __RPC__in IMbnConnection * This, /* [retval][ref][out] */ __RPC__out ULONG *networkError); END_INTERFACE } IMbnConnectionVtbl; interface IMbnConnection { CONST_VTBL struct IMbnConnectionVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnConnection_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnConnection_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnConnection_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnConnection_get_ConnectionID(This,ConnectionID) \ ( (This)->lpVtbl -> get_ConnectionID(This,ConnectionID) ) #define IMbnConnection_get_InterfaceID(This,InterfaceID) \ ( (This)->lpVtbl -> get_InterfaceID(This,InterfaceID) ) #define IMbnConnection_Connect(This,connectionMode,strProfile,requestID) \ ( (This)->lpVtbl -> Connect(This,connectionMode,strProfile,requestID) ) #define IMbnConnection_Disconnect(This,requestID) \ ( (This)->lpVtbl -> Disconnect(This,requestID) ) #define IMbnConnection_GetConnectionState(This,ConnectionState,ProfileName) \ ( (This)->lpVtbl -> GetConnectionState(This,ConnectionState,ProfileName) ) #define IMbnConnection_GetVoiceCallState(This,voiceCallState) \ ( (This)->lpVtbl -> GetVoiceCallState(This,voiceCallState) ) #define IMbnConnection_GetActivationNetworkError(This,networkError) \ ( (This)->lpVtbl -> GetActivationNetworkError(This,networkError) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnConnection_INTERFACE_DEFINED__ */ #ifndef __IMbnConnectionEvents_INTERFACE_DEFINED__ #define __IMbnConnectionEvents_INTERFACE_DEFINED__ /* interface IMbnConnectionEvents */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnConnectionEvents; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-200E-4BBB-AAEE-338E368AF6FA") IMbnConnectionEvents : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnConnectComplete( /* [annotation][in] */ _In_ IMbnConnection *newConnection, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnDisconnectComplete( /* [annotation][in] */ _In_ IMbnConnection *newConnection, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnConnectStateChange( /* [annotation][in] */ _In_ IMbnConnection *newConnection) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnVoiceCallStateChange( /* [annotation][in] */ _In_ IMbnConnection *newConnection) = 0; }; #else /* C style interface */ typedef struct IMbnConnectionEventsVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnConnectionEvents * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnConnectionEvents * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnConnectionEvents * This); DECLSPEC_XFGVIRT(IMbnConnectionEvents, OnConnectComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnConnectComplete )( __RPC__in IMbnConnectionEvents * This, /* [annotation][in] */ _In_ IMbnConnection *newConnection, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status); DECLSPEC_XFGVIRT(IMbnConnectionEvents, OnDisconnectComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnDisconnectComplete )( __RPC__in IMbnConnectionEvents * This, /* [annotation][in] */ _In_ IMbnConnection *newConnection, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status); DECLSPEC_XFGVIRT(IMbnConnectionEvents, OnConnectStateChange) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnConnectStateChange )( __RPC__in IMbnConnectionEvents * This, /* [annotation][in] */ _In_ IMbnConnection *newConnection); DECLSPEC_XFGVIRT(IMbnConnectionEvents, OnVoiceCallStateChange) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnVoiceCallStateChange )( __RPC__in IMbnConnectionEvents * This, /* [annotation][in] */ _In_ IMbnConnection *newConnection); END_INTERFACE } IMbnConnectionEventsVtbl; interface IMbnConnectionEvents { CONST_VTBL struct IMbnConnectionEventsVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnConnectionEvents_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnConnectionEvents_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnConnectionEvents_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnConnectionEvents_OnConnectComplete(This,newConnection,requestID,status) \ ( (This)->lpVtbl -> OnConnectComplete(This,newConnection,requestID,status) ) #define IMbnConnectionEvents_OnDisconnectComplete(This,newConnection,requestID,status) \ ( (This)->lpVtbl -> OnDisconnectComplete(This,newConnection,requestID,status) ) #define IMbnConnectionEvents_OnConnectStateChange(This,newConnection) \ ( (This)->lpVtbl -> OnConnectStateChange(This,newConnection) ) #define IMbnConnectionEvents_OnVoiceCallStateChange(This,newConnection) \ ( (This)->lpVtbl -> OnVoiceCallStateChange(This,newConnection) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnConnectionEvents_INTERFACE_DEFINED__ */ #ifndef __IMbnInterface_INTERFACE_DEFINED__ #define __IMbnInterface_INTERFACE_DEFINED__ /* interface IMbnInterface */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnInterface; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-2001-4BBB-AAEE-338E368AF6FA") IMbnInterface : public IUnknown { public: virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_InterfaceID( /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *InterfaceID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetInterfaceCapability( /* [retval][ref][out] */ __RPC__out MBN_INTERFACE_CAPS *interfaceCaps) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetSubscriberInformation( /* [annotation][retval][out] */ _Out_retval_ IMbnSubscriberInformation **subscriberInformation) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetReadyState( /* [retval][ref][out] */ __RPC__out MBN_READY_STATE *readyState) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE InEmergencyMode( /* [retval][ref][out] */ __RPC__out VARIANT_BOOL *emergencyMode) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetHomeProvider( /* [retval][ref][out] */ __RPC__out MBN_PROVIDER *homeProvider) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetPreferredProviders( /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *preferredProviders) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetPreferredProviders( /* [annotation][in] */ _In_ SAFEARRAY * preferredProviders, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetVisibleProviders( /* [annotation][out] */ _Out_ ULONG *age, /* [annotation][retval][out] */ _Out_retval_ SAFEARRAY * *visibleProviders) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ScanNetwork( /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetConnection( /* [annotation][retval][out] */ _Out_retval_ IMbnConnection **mbnConnection) = 0; }; #else /* C style interface */ typedef struct IMbnInterfaceVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnInterface * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnInterface * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnInterface * This); DECLSPEC_XFGVIRT(IMbnInterface, get_InterfaceID) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_InterfaceID )( __RPC__in IMbnInterface * This, /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *InterfaceID); DECLSPEC_XFGVIRT(IMbnInterface, GetInterfaceCapability) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetInterfaceCapability )( __RPC__in IMbnInterface * This, /* [retval][ref][out] */ __RPC__out MBN_INTERFACE_CAPS *interfaceCaps); DECLSPEC_XFGVIRT(IMbnInterface, GetSubscriberInformation) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetSubscriberInformation )( __RPC__in IMbnInterface * This, /* [annotation][retval][out] */ _Out_retval_ IMbnSubscriberInformation **subscriberInformation); DECLSPEC_XFGVIRT(IMbnInterface, GetReadyState) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetReadyState )( __RPC__in IMbnInterface * This, /* [retval][ref][out] */ __RPC__out MBN_READY_STATE *readyState); DECLSPEC_XFGVIRT(IMbnInterface, InEmergencyMode) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *InEmergencyMode )( __RPC__in IMbnInterface * This, /* [retval][ref][out] */ __RPC__out VARIANT_BOOL *emergencyMode); DECLSPEC_XFGVIRT(IMbnInterface, GetHomeProvider) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetHomeProvider )( __RPC__in IMbnInterface * This, /* [retval][ref][out] */ __RPC__out MBN_PROVIDER *homeProvider); DECLSPEC_XFGVIRT(IMbnInterface, GetPreferredProviders) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetPreferredProviders )( __RPC__in IMbnInterface * This, /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *preferredProviders); DECLSPEC_XFGVIRT(IMbnInterface, SetPreferredProviders) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetPreferredProviders )( __RPC__in IMbnInterface * This, /* [annotation][in] */ _In_ SAFEARRAY * preferredProviders, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnInterface, GetVisibleProviders) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetVisibleProviders )( __RPC__in IMbnInterface * This, /* [annotation][out] */ _Out_ ULONG *age, /* [annotation][retval][out] */ _Out_retval_ SAFEARRAY * *visibleProviders); DECLSPEC_XFGVIRT(IMbnInterface, ScanNetwork) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *ScanNetwork )( __RPC__in IMbnInterface * This, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnInterface, GetConnection) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetConnection )( __RPC__in IMbnInterface * This, /* [annotation][retval][out] */ _Out_retval_ IMbnConnection **mbnConnection); END_INTERFACE } IMbnInterfaceVtbl; interface IMbnInterface { CONST_VTBL struct IMbnInterfaceVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnInterface_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnInterface_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnInterface_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnInterface_get_InterfaceID(This,InterfaceID) \ ( (This)->lpVtbl -> get_InterfaceID(This,InterfaceID) ) #define IMbnInterface_GetInterfaceCapability(This,interfaceCaps) \ ( (This)->lpVtbl -> GetInterfaceCapability(This,interfaceCaps) ) #define IMbnInterface_GetSubscriberInformation(This,subscriberInformation) \ ( (This)->lpVtbl -> GetSubscriberInformation(This,subscriberInformation) ) #define IMbnInterface_GetReadyState(This,readyState) \ ( (This)->lpVtbl -> GetReadyState(This,readyState) ) #define IMbnInterface_InEmergencyMode(This,emergencyMode) \ ( (This)->lpVtbl -> InEmergencyMode(This,emergencyMode) ) #define IMbnInterface_GetHomeProvider(This,homeProvider) \ ( (This)->lpVtbl -> GetHomeProvider(This,homeProvider) ) #define IMbnInterface_GetPreferredProviders(This,preferredProviders) \ ( (This)->lpVtbl -> GetPreferredProviders(This,preferredProviders) ) #define IMbnInterface_SetPreferredProviders(This,preferredProviders,requestID) \ ( (This)->lpVtbl -> SetPreferredProviders(This,preferredProviders,requestID) ) #define IMbnInterface_GetVisibleProviders(This,age,visibleProviders) \ ( (This)->lpVtbl -> GetVisibleProviders(This,age,visibleProviders) ) #define IMbnInterface_ScanNetwork(This,requestID) \ ( (This)->lpVtbl -> ScanNetwork(This,requestID) ) #define IMbnInterface_GetConnection(This,mbnConnection) \ ( (This)->lpVtbl -> GetConnection(This,mbnConnection) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnInterface_INTERFACE_DEFINED__ */ #ifndef __IMbnInterfaceEvents_INTERFACE_DEFINED__ #define __IMbnInterfaceEvents_INTERFACE_DEFINED__ /* interface IMbnInterfaceEvents */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnInterfaceEvents; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-2002-4BBB-AAEE-338E368AF6FA") IMbnInterfaceEvents : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnInterfaceCapabilityAvailable( /* [annotation][in] */ _In_ IMbnInterface *newInterface) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnSubscriberInformationChange( /* [annotation][in] */ _In_ IMbnInterface *newInterface) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnReadyStateChange( /* [annotation][in] */ _In_ IMbnInterface *newInterface) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnEmergencyModeChange( /* [annotation][in] */ _In_ IMbnInterface *newInterface) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnHomeProviderAvailable( /* [annotation][in] */ _In_ IMbnInterface *newInterface) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnPreferredProvidersChange( /* [annotation][in] */ _In_ IMbnInterface *newInterface) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnSetPreferredProvidersComplete( /* [annotation][in] */ _In_ IMbnInterface *newInterface, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnScanNetworkComplete( /* [annotation][in] */ _In_ IMbnInterface *newInterface, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status) = 0; }; #else /* C style interface */ typedef struct IMbnInterfaceEventsVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnInterfaceEvents * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnInterfaceEvents * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnInterfaceEvents * This); DECLSPEC_XFGVIRT(IMbnInterfaceEvents, OnInterfaceCapabilityAvailable) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnInterfaceCapabilityAvailable )( __RPC__in IMbnInterfaceEvents * This, /* [annotation][in] */ _In_ IMbnInterface *newInterface); DECLSPEC_XFGVIRT(IMbnInterfaceEvents, OnSubscriberInformationChange) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnSubscriberInformationChange )( __RPC__in IMbnInterfaceEvents * This, /* [annotation][in] */ _In_ IMbnInterface *newInterface); DECLSPEC_XFGVIRT(IMbnInterfaceEvents, OnReadyStateChange) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnReadyStateChange )( __RPC__in IMbnInterfaceEvents * This, /* [annotation][in] */ _In_ IMbnInterface *newInterface); DECLSPEC_XFGVIRT(IMbnInterfaceEvents, OnEmergencyModeChange) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnEmergencyModeChange )( __RPC__in IMbnInterfaceEvents * This, /* [annotation][in] */ _In_ IMbnInterface *newInterface); DECLSPEC_XFGVIRT(IMbnInterfaceEvents, OnHomeProviderAvailable) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnHomeProviderAvailable )( __RPC__in IMbnInterfaceEvents * This, /* [annotation][in] */ _In_ IMbnInterface *newInterface); DECLSPEC_XFGVIRT(IMbnInterfaceEvents, OnPreferredProvidersChange) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnPreferredProvidersChange )( __RPC__in IMbnInterfaceEvents * This, /* [annotation][in] */ _In_ IMbnInterface *newInterface); DECLSPEC_XFGVIRT(IMbnInterfaceEvents, OnSetPreferredProvidersComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnSetPreferredProvidersComplete )( __RPC__in IMbnInterfaceEvents * This, /* [annotation][in] */ _In_ IMbnInterface *newInterface, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status); DECLSPEC_XFGVIRT(IMbnInterfaceEvents, OnScanNetworkComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnScanNetworkComplete )( __RPC__in IMbnInterfaceEvents * This, /* [annotation][in] */ _In_ IMbnInterface *newInterface, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status); END_INTERFACE } IMbnInterfaceEventsVtbl; interface IMbnInterfaceEvents { CONST_VTBL struct IMbnInterfaceEventsVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnInterfaceEvents_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnInterfaceEvents_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnInterfaceEvents_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnInterfaceEvents_OnInterfaceCapabilityAvailable(This,newInterface) \ ( (This)->lpVtbl -> OnInterfaceCapabilityAvailable(This,newInterface) ) #define IMbnInterfaceEvents_OnSubscriberInformationChange(This,newInterface) \ ( (This)->lpVtbl -> OnSubscriberInformationChange(This,newInterface) ) #define IMbnInterfaceEvents_OnReadyStateChange(This,newInterface) \ ( (This)->lpVtbl -> OnReadyStateChange(This,newInterface) ) #define IMbnInterfaceEvents_OnEmergencyModeChange(This,newInterface) \ ( (This)->lpVtbl -> OnEmergencyModeChange(This,newInterface) ) #define IMbnInterfaceEvents_OnHomeProviderAvailable(This,newInterface) \ ( (This)->lpVtbl -> OnHomeProviderAvailable(This,newInterface) ) #define IMbnInterfaceEvents_OnPreferredProvidersChange(This,newInterface) \ ( (This)->lpVtbl -> OnPreferredProvidersChange(This,newInterface) ) #define IMbnInterfaceEvents_OnSetPreferredProvidersComplete(This,newInterface,requestID,status) \ ( (This)->lpVtbl -> OnSetPreferredProvidersComplete(This,newInterface,requestID,status) ) #define IMbnInterfaceEvents_OnScanNetworkComplete(This,newInterface,requestID,status) \ ( (This)->lpVtbl -> OnScanNetworkComplete(This,newInterface,requestID,status) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnInterfaceEvents_INTERFACE_DEFINED__ */ #ifndef __IMbnInterfaceManager_INTERFACE_DEFINED__ #define __IMbnInterfaceManager_INTERFACE_DEFINED__ /* interface IMbnInterfaceManager */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnInterfaceManager; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-201B-4BBB-AAEE-338E368AF6FA") IMbnInterfaceManager : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetInterface( /* [annotation][in] */ _In_ LPCWSTR interfaceID, /* [retval][ref][out] */ __RPC__deref_out_opt IMbnInterface **mbnInterface) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetInterfaces( /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *mbnInterfaces) = 0; }; #else /* C style interface */ typedef struct IMbnInterfaceManagerVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnInterfaceManager * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnInterfaceManager * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnInterfaceManager * This); DECLSPEC_XFGVIRT(IMbnInterfaceManager, GetInterface) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetInterface )( __RPC__in IMbnInterfaceManager * This, /* [annotation][in] */ _In_ LPCWSTR interfaceID, /* [retval][ref][out] */ __RPC__deref_out_opt IMbnInterface **mbnInterface); DECLSPEC_XFGVIRT(IMbnInterfaceManager, GetInterfaces) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetInterfaces )( __RPC__in IMbnInterfaceManager * This, /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *mbnInterfaces); END_INTERFACE } IMbnInterfaceManagerVtbl; interface IMbnInterfaceManager { CONST_VTBL struct IMbnInterfaceManagerVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnInterfaceManager_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnInterfaceManager_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnInterfaceManager_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnInterfaceManager_GetInterface(This,interfaceID,mbnInterface) \ ( (This)->lpVtbl -> GetInterface(This,interfaceID,mbnInterface) ) #define IMbnInterfaceManager_GetInterfaces(This,mbnInterfaces) \ ( (This)->lpVtbl -> GetInterfaces(This,mbnInterfaces) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnInterfaceManager_INTERFACE_DEFINED__ */ #ifndef __IMbnInterfaceManagerEvents_INTERFACE_DEFINED__ #define __IMbnInterfaceManagerEvents_INTERFACE_DEFINED__ /* interface IMbnInterfaceManagerEvents */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnInterfaceManagerEvents; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-201C-4BBB-AAEE-338E368AF6FA") IMbnInterfaceManagerEvents : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnInterfaceArrival( /* [annotation][in] */ _In_ IMbnInterface *newInterface) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnInterfaceRemoval( /* [annotation][in] */ _In_ IMbnInterface *oldInterface) = 0; }; #else /* C style interface */ typedef struct IMbnInterfaceManagerEventsVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnInterfaceManagerEvents * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnInterfaceManagerEvents * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnInterfaceManagerEvents * This); DECLSPEC_XFGVIRT(IMbnInterfaceManagerEvents, OnInterfaceArrival) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnInterfaceArrival )( __RPC__in IMbnInterfaceManagerEvents * This, /* [annotation][in] */ _In_ IMbnInterface *newInterface); DECLSPEC_XFGVIRT(IMbnInterfaceManagerEvents, OnInterfaceRemoval) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnInterfaceRemoval )( __RPC__in IMbnInterfaceManagerEvents * This, /* [annotation][in] */ _In_ IMbnInterface *oldInterface); END_INTERFACE } IMbnInterfaceManagerEventsVtbl; interface IMbnInterfaceManagerEvents { CONST_VTBL struct IMbnInterfaceManagerEventsVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnInterfaceManagerEvents_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnInterfaceManagerEvents_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnInterfaceManagerEvents_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnInterfaceManagerEvents_OnInterfaceArrival(This,newInterface) \ ( (This)->lpVtbl -> OnInterfaceArrival(This,newInterface) ) #define IMbnInterfaceManagerEvents_OnInterfaceRemoval(This,oldInterface) \ ( (This)->lpVtbl -> OnInterfaceRemoval(This,oldInterface) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnInterfaceManagerEvents_INTERFACE_DEFINED__ */ #ifndef __IMbnRegistration_INTERFACE_DEFINED__ #define __IMbnRegistration_INTERFACE_DEFINED__ /* interface IMbnRegistration */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnRegistration; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-2009-4BBB-AAEE-338E368AF6FA") IMbnRegistration : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetRegisterState( /* [retval][ref][out] */ __RPC__out MBN_REGISTER_STATE *registerState) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetRegisterMode( /* [retval][ref][out] */ __RPC__out MBN_REGISTER_MODE *registerMode) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetProviderID( /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *providerID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetProviderName( /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *providerName) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetRoamingText( /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *roamingText) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetAvailableDataClasses( /* [retval][ref][out] */ __RPC__out ULONG *availableDataClasses) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCurrentDataClass( /* [retval][ref][out] */ __RPC__out ULONG *currentDataClass) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetRegistrationNetworkError( /* [retval][ref][out] */ __RPC__out ULONG *registrationNetworkError) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetPacketAttachNetworkError( /* [retval][ref][out] */ __RPC__out ULONG *packetAttachNetworkError) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetRegisterMode( /* [annotation][in] */ _In_ MBN_REGISTER_MODE registerMode, /* [annotation][string][in] */ _In_ LPCWSTR providerID, /* [annotation][in] */ _In_ ULONG dataClass, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; }; #else /* C style interface */ typedef struct IMbnRegistrationVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnRegistration * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnRegistration * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnRegistration * This); DECLSPEC_XFGVIRT(IMbnRegistration, GetRegisterState) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetRegisterState )( __RPC__in IMbnRegistration * This, /* [retval][ref][out] */ __RPC__out MBN_REGISTER_STATE *registerState); DECLSPEC_XFGVIRT(IMbnRegistration, GetRegisterMode) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetRegisterMode )( __RPC__in IMbnRegistration * This, /* [retval][ref][out] */ __RPC__out MBN_REGISTER_MODE *registerMode); DECLSPEC_XFGVIRT(IMbnRegistration, GetProviderID) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetProviderID )( __RPC__in IMbnRegistration * This, /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *providerID); DECLSPEC_XFGVIRT(IMbnRegistration, GetProviderName) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetProviderName )( __RPC__in IMbnRegistration * This, /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *providerName); DECLSPEC_XFGVIRT(IMbnRegistration, GetRoamingText) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetRoamingText )( __RPC__in IMbnRegistration * This, /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *roamingText); DECLSPEC_XFGVIRT(IMbnRegistration, GetAvailableDataClasses) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetAvailableDataClasses )( __RPC__in IMbnRegistration * This, /* [retval][ref][out] */ __RPC__out ULONG *availableDataClasses); DECLSPEC_XFGVIRT(IMbnRegistration, GetCurrentDataClass) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetCurrentDataClass )( __RPC__in IMbnRegistration * This, /* [retval][ref][out] */ __RPC__out ULONG *currentDataClass); DECLSPEC_XFGVIRT(IMbnRegistration, GetRegistrationNetworkError) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetRegistrationNetworkError )( __RPC__in IMbnRegistration * This, /* [retval][ref][out] */ __RPC__out ULONG *registrationNetworkError); DECLSPEC_XFGVIRT(IMbnRegistration, GetPacketAttachNetworkError) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetPacketAttachNetworkError )( __RPC__in IMbnRegistration * This, /* [retval][ref][out] */ __RPC__out ULONG *packetAttachNetworkError); DECLSPEC_XFGVIRT(IMbnRegistration, SetRegisterMode) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetRegisterMode )( __RPC__in IMbnRegistration * This, /* [annotation][in] */ _In_ MBN_REGISTER_MODE registerMode, /* [annotation][string][in] */ _In_ LPCWSTR providerID, /* [annotation][in] */ _In_ ULONG dataClass, /* [annotation][out] */ _Out_ ULONG *requestID); END_INTERFACE } IMbnRegistrationVtbl; interface IMbnRegistration { CONST_VTBL struct IMbnRegistrationVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnRegistration_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnRegistration_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnRegistration_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnRegistration_GetRegisterState(This,registerState) \ ( (This)->lpVtbl -> GetRegisterState(This,registerState) ) #define IMbnRegistration_GetRegisterMode(This,registerMode) \ ( (This)->lpVtbl -> GetRegisterMode(This,registerMode) ) #define IMbnRegistration_GetProviderID(This,providerID) \ ( (This)->lpVtbl -> GetProviderID(This,providerID) ) #define IMbnRegistration_GetProviderName(This,providerName) \ ( (This)->lpVtbl -> GetProviderName(This,providerName) ) #define IMbnRegistration_GetRoamingText(This,roamingText) \ ( (This)->lpVtbl -> GetRoamingText(This,roamingText) ) #define IMbnRegistration_GetAvailableDataClasses(This,availableDataClasses) \ ( (This)->lpVtbl -> GetAvailableDataClasses(This,availableDataClasses) ) #define IMbnRegistration_GetCurrentDataClass(This,currentDataClass) \ ( (This)->lpVtbl -> GetCurrentDataClass(This,currentDataClass) ) #define IMbnRegistration_GetRegistrationNetworkError(This,registrationNetworkError) \ ( (This)->lpVtbl -> GetRegistrationNetworkError(This,registrationNetworkError) ) #define IMbnRegistration_GetPacketAttachNetworkError(This,packetAttachNetworkError) \ ( (This)->lpVtbl -> GetPacketAttachNetworkError(This,packetAttachNetworkError) ) #define IMbnRegistration_SetRegisterMode(This,registerMode,providerID,dataClass,requestID) \ ( (This)->lpVtbl -> SetRegisterMode(This,registerMode,providerID,dataClass,requestID) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnRegistration_INTERFACE_DEFINED__ */ #ifndef __IMbnRegistrationEvents_INTERFACE_DEFINED__ #define __IMbnRegistrationEvents_INTERFACE_DEFINED__ /* interface IMbnRegistrationEvents */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnRegistrationEvents; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-200A-4BBB-AAEE-338E368AF6FA") IMbnRegistrationEvents : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnRegisterModeAvailable( /* [annotation][in] */ _In_ IMbnRegistration *newInterface) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnRegisterStateChange( /* [annotation][in] */ _In_ IMbnRegistration *newInterface) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnPacketServiceStateChange( /* [annotation][in] */ _In_ IMbnRegistration *newInterface) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnSetRegisterModeComplete( /* [annotation][in] */ _In_ IMbnRegistration *newInterface, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status) = 0; }; #else /* C style interface */ typedef struct IMbnRegistrationEventsVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnRegistrationEvents * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnRegistrationEvents * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnRegistrationEvents * This); DECLSPEC_XFGVIRT(IMbnRegistrationEvents, OnRegisterModeAvailable) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnRegisterModeAvailable )( __RPC__in IMbnRegistrationEvents * This, /* [annotation][in] */ _In_ IMbnRegistration *newInterface); DECLSPEC_XFGVIRT(IMbnRegistrationEvents, OnRegisterStateChange) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnRegisterStateChange )( __RPC__in IMbnRegistrationEvents * This, /* [annotation][in] */ _In_ IMbnRegistration *newInterface); DECLSPEC_XFGVIRT(IMbnRegistrationEvents, OnPacketServiceStateChange) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnPacketServiceStateChange )( __RPC__in IMbnRegistrationEvents * This, /* [annotation][in] */ _In_ IMbnRegistration *newInterface); DECLSPEC_XFGVIRT(IMbnRegistrationEvents, OnSetRegisterModeComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnSetRegisterModeComplete )( __RPC__in IMbnRegistrationEvents * This, /* [annotation][in] */ _In_ IMbnRegistration *newInterface, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status); END_INTERFACE } IMbnRegistrationEventsVtbl; interface IMbnRegistrationEvents { CONST_VTBL struct IMbnRegistrationEventsVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnRegistrationEvents_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnRegistrationEvents_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnRegistrationEvents_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnRegistrationEvents_OnRegisterModeAvailable(This,newInterface) \ ( (This)->lpVtbl -> OnRegisterModeAvailable(This,newInterface) ) #define IMbnRegistrationEvents_OnRegisterStateChange(This,newInterface) \ ( (This)->lpVtbl -> OnRegisterStateChange(This,newInterface) ) #define IMbnRegistrationEvents_OnPacketServiceStateChange(This,newInterface) \ ( (This)->lpVtbl -> OnPacketServiceStateChange(This,newInterface) ) #define IMbnRegistrationEvents_OnSetRegisterModeComplete(This,newInterface,requestID,status) \ ( (This)->lpVtbl -> OnSetRegisterModeComplete(This,newInterface,requestID,status) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnRegistrationEvents_INTERFACE_DEFINED__ */ #ifndef __IMbnConnectionManager_INTERFACE_DEFINED__ #define __IMbnConnectionManager_INTERFACE_DEFINED__ /* interface IMbnConnectionManager */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnConnectionManager; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-201D-4BBB-AAEE-338E368AF6FA") IMbnConnectionManager : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetConnection( /* [annotation][in] */ _In_ LPCWSTR connectionID, /* [retval][ref][out] */ __RPC__deref_out_opt IMbnConnection **mbnConnection) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetConnections( /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *mbnConnections) = 0; }; #else /* C style interface */ typedef struct IMbnConnectionManagerVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnConnectionManager * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnConnectionManager * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnConnectionManager * This); DECLSPEC_XFGVIRT(IMbnConnectionManager, GetConnection) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetConnection )( __RPC__in IMbnConnectionManager * This, /* [annotation][in] */ _In_ LPCWSTR connectionID, /* [retval][ref][out] */ __RPC__deref_out_opt IMbnConnection **mbnConnection); DECLSPEC_XFGVIRT(IMbnConnectionManager, GetConnections) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetConnections )( __RPC__in IMbnConnectionManager * This, /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *mbnConnections); END_INTERFACE } IMbnConnectionManagerVtbl; interface IMbnConnectionManager { CONST_VTBL struct IMbnConnectionManagerVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnConnectionManager_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnConnectionManager_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnConnectionManager_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnConnectionManager_GetConnection(This,connectionID,mbnConnection) \ ( (This)->lpVtbl -> GetConnection(This,connectionID,mbnConnection) ) #define IMbnConnectionManager_GetConnections(This,mbnConnections) \ ( (This)->lpVtbl -> GetConnections(This,mbnConnections) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnConnectionManager_INTERFACE_DEFINED__ */ #ifndef __IMbnConnectionManagerEvents_INTERFACE_DEFINED__ #define __IMbnConnectionManagerEvents_INTERFACE_DEFINED__ /* interface IMbnConnectionManagerEvents */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnConnectionManagerEvents; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-201E-4BBB-AAEE-338E368AF6FA") IMbnConnectionManagerEvents : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnConnectionArrival( /* [annotation][in] */ _In_ IMbnConnection *newConnection) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnConnectionRemoval( /* [annotation][in] */ _In_ IMbnConnection *oldConnection) = 0; }; #else /* C style interface */ typedef struct IMbnConnectionManagerEventsVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnConnectionManagerEvents * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnConnectionManagerEvents * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnConnectionManagerEvents * This); DECLSPEC_XFGVIRT(IMbnConnectionManagerEvents, OnConnectionArrival) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnConnectionArrival )( __RPC__in IMbnConnectionManagerEvents * This, /* [annotation][in] */ _In_ IMbnConnection *newConnection); DECLSPEC_XFGVIRT(IMbnConnectionManagerEvents, OnConnectionRemoval) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnConnectionRemoval )( __RPC__in IMbnConnectionManagerEvents * This, /* [annotation][in] */ _In_ IMbnConnection *oldConnection); END_INTERFACE } IMbnConnectionManagerEventsVtbl; interface IMbnConnectionManagerEvents { CONST_VTBL struct IMbnConnectionManagerEventsVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnConnectionManagerEvents_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnConnectionManagerEvents_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnConnectionManagerEvents_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnConnectionManagerEvents_OnConnectionArrival(This,newConnection) \ ( (This)->lpVtbl -> OnConnectionArrival(This,newConnection) ) #define IMbnConnectionManagerEvents_OnConnectionRemoval(This,oldConnection) \ ( (This)->lpVtbl -> OnConnectionRemoval(This,oldConnection) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnConnectionManagerEvents_INTERFACE_DEFINED__ */ #ifndef __IMbnPinManager_INTERFACE_DEFINED__ #define __IMbnPinManager_INTERFACE_DEFINED__ /* interface IMbnPinManager */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnPinManager; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-2005-4BBB-AAEE-338E368AF6FA") IMbnPinManager : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetPinList( /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *pinList) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetPin( /* [annotation][in] */ _In_ MBN_PIN_TYPE pinType, /* [retval][ref][out] */ __RPC__deref_out_opt IMbnPin **pin) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetPinState( /* [annotation][out] */ _Out_ ULONG *requestID) = 0; }; #else /* C style interface */ typedef struct IMbnPinManagerVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnPinManager * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnPinManager * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnPinManager * This); DECLSPEC_XFGVIRT(IMbnPinManager, GetPinList) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetPinList )( __RPC__in IMbnPinManager * This, /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *pinList); DECLSPEC_XFGVIRT(IMbnPinManager, GetPin) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetPin )( __RPC__in IMbnPinManager * This, /* [annotation][in] */ _In_ MBN_PIN_TYPE pinType, /* [retval][ref][out] */ __RPC__deref_out_opt IMbnPin **pin); DECLSPEC_XFGVIRT(IMbnPinManager, GetPinState) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetPinState )( __RPC__in IMbnPinManager * This, /* [annotation][out] */ _Out_ ULONG *requestID); END_INTERFACE } IMbnPinManagerVtbl; interface IMbnPinManager { CONST_VTBL struct IMbnPinManagerVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnPinManager_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnPinManager_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnPinManager_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnPinManager_GetPinList(This,pinList) \ ( (This)->lpVtbl -> GetPinList(This,pinList) ) #define IMbnPinManager_GetPin(This,pinType,pin) \ ( (This)->lpVtbl -> GetPin(This,pinType,pin) ) #define IMbnPinManager_GetPinState(This,requestID) \ ( (This)->lpVtbl -> GetPinState(This,requestID) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnPinManager_INTERFACE_DEFINED__ */ #ifndef __IMbnPinManagerEvents_INTERFACE_DEFINED__ #define __IMbnPinManagerEvents_INTERFACE_DEFINED__ /* interface IMbnPinManagerEvents */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnPinManagerEvents; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-2006-4BBB-AAEE-338E368AF6FA") IMbnPinManagerEvents : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnPinListAvailable( /* [annotation][in] */ _In_ IMbnPinManager *pinManager) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnGetPinStateComplete( /* [annotation][in] */ _In_ IMbnPinManager *pinManager, /* [annotation][in] */ _In_ MBN_PIN_INFO pinInfo, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status) = 0; }; #else /* C style interface */ typedef struct IMbnPinManagerEventsVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnPinManagerEvents * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnPinManagerEvents * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnPinManagerEvents * This); DECLSPEC_XFGVIRT(IMbnPinManagerEvents, OnPinListAvailable) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnPinListAvailable )( __RPC__in IMbnPinManagerEvents * This, /* [annotation][in] */ _In_ IMbnPinManager *pinManager); DECLSPEC_XFGVIRT(IMbnPinManagerEvents, OnGetPinStateComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnGetPinStateComplete )( __RPC__in IMbnPinManagerEvents * This, /* [annotation][in] */ _In_ IMbnPinManager *pinManager, /* [annotation][in] */ _In_ MBN_PIN_INFO pinInfo, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status); END_INTERFACE } IMbnPinManagerEventsVtbl; interface IMbnPinManagerEvents { CONST_VTBL struct IMbnPinManagerEventsVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnPinManagerEvents_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnPinManagerEvents_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnPinManagerEvents_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnPinManagerEvents_OnPinListAvailable(This,pinManager) \ ( (This)->lpVtbl -> OnPinListAvailable(This,pinManager) ) #define IMbnPinManagerEvents_OnGetPinStateComplete(This,pinManager,pinInfo,requestID,status) \ ( (This)->lpVtbl -> OnGetPinStateComplete(This,pinManager,pinInfo,requestID,status) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnPinManagerEvents_INTERFACE_DEFINED__ */ #ifndef __IMbnPinEvents_INTERFACE_DEFINED__ #define __IMbnPinEvents_INTERFACE_DEFINED__ /* interface IMbnPinEvents */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnPinEvents; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-2008-4BBB-AAEE-338E368AF6FA") IMbnPinEvents : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnEnableComplete( /* [annotation][in] */ _In_ IMbnPin *pin, /* [ref][in] */ __RPC__in MBN_PIN_INFO *pinInfo, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnDisableComplete( /* [annotation][in] */ _In_ IMbnPin *pin, /* [ref][in] */ __RPC__in MBN_PIN_INFO *pinInfo, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnEnterComplete( /* [annotation][in] */ _In_ IMbnPin *Pin, /* [ref][in] */ __RPC__in MBN_PIN_INFO *pinInfo, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnChangeComplete( /* [annotation][in] */ _In_ IMbnPin *Pin, /* [ref][in] */ __RPC__in MBN_PIN_INFO *pinInfo, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnUnblockComplete( /* [annotation][in] */ _In_ IMbnPin *Pin, /* [ref][in] */ __RPC__in MBN_PIN_INFO *pinInfo, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status) = 0; }; #else /* C style interface */ typedef struct IMbnPinEventsVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnPinEvents * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnPinEvents * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnPinEvents * This); DECLSPEC_XFGVIRT(IMbnPinEvents, OnEnableComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnEnableComplete )( __RPC__in IMbnPinEvents * This, /* [annotation][in] */ _In_ IMbnPin *pin, /* [ref][in] */ __RPC__in MBN_PIN_INFO *pinInfo, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status); DECLSPEC_XFGVIRT(IMbnPinEvents, OnDisableComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnDisableComplete )( __RPC__in IMbnPinEvents * This, /* [annotation][in] */ _In_ IMbnPin *pin, /* [ref][in] */ __RPC__in MBN_PIN_INFO *pinInfo, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status); DECLSPEC_XFGVIRT(IMbnPinEvents, OnEnterComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnEnterComplete )( __RPC__in IMbnPinEvents * This, /* [annotation][in] */ _In_ IMbnPin *Pin, /* [ref][in] */ __RPC__in MBN_PIN_INFO *pinInfo, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status); DECLSPEC_XFGVIRT(IMbnPinEvents, OnChangeComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnChangeComplete )( __RPC__in IMbnPinEvents * This, /* [annotation][in] */ _In_ IMbnPin *Pin, /* [ref][in] */ __RPC__in MBN_PIN_INFO *pinInfo, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status); DECLSPEC_XFGVIRT(IMbnPinEvents, OnUnblockComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnUnblockComplete )( __RPC__in IMbnPinEvents * This, /* [annotation][in] */ _In_ IMbnPin *Pin, /* [ref][in] */ __RPC__in MBN_PIN_INFO *pinInfo, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status); END_INTERFACE } IMbnPinEventsVtbl; interface IMbnPinEvents { CONST_VTBL struct IMbnPinEventsVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnPinEvents_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnPinEvents_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnPinEvents_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnPinEvents_OnEnableComplete(This,pin,pinInfo,requestID,status) \ ( (This)->lpVtbl -> OnEnableComplete(This,pin,pinInfo,requestID,status) ) #define IMbnPinEvents_OnDisableComplete(This,pin,pinInfo,requestID,status) \ ( (This)->lpVtbl -> OnDisableComplete(This,pin,pinInfo,requestID,status) ) #define IMbnPinEvents_OnEnterComplete(This,Pin,pinInfo,requestID,status) \ ( (This)->lpVtbl -> OnEnterComplete(This,Pin,pinInfo,requestID,status) ) #define IMbnPinEvents_OnChangeComplete(This,Pin,pinInfo,requestID,status) \ ( (This)->lpVtbl -> OnChangeComplete(This,Pin,pinInfo,requestID,status) ) #define IMbnPinEvents_OnUnblockComplete(This,Pin,pinInfo,requestID,status) \ ( (This)->lpVtbl -> OnUnblockComplete(This,Pin,pinInfo,requestID,status) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnPinEvents_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_mbnapi_0000_0014 */ /* [local] */ #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */ #pragma endregion #pragma region Desktop Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) extern RPC_IF_HANDLE __MIDL_itf_mbnapi_0000_0014_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_mbnapi_0000_0014_v0_0_s_ifspec; #ifndef __IMbnSubscriberInformation_INTERFACE_DEFINED__ #define __IMbnSubscriberInformation_INTERFACE_DEFINED__ /* interface IMbnSubscriberInformation */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnSubscriberInformation; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("459ECC43-BCF5-11DC-A8A8-001321F1405F") IMbnSubscriberInformation : public IUnknown { public: virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SubscriberID( /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *SubscriberID) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SimIccID( /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *SimIccID) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_TelephoneNumbers( /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *TelephoneNumbers) = 0; }; #else /* C style interface */ typedef struct IMbnSubscriberInformationVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnSubscriberInformation * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnSubscriberInformation * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnSubscriberInformation * This); DECLSPEC_XFGVIRT(IMbnSubscriberInformation, get_SubscriberID) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_SubscriberID )( __RPC__in IMbnSubscriberInformation * This, /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *SubscriberID); DECLSPEC_XFGVIRT(IMbnSubscriberInformation, get_SimIccID) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_SimIccID )( __RPC__in IMbnSubscriberInformation * This, /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *SimIccID); DECLSPEC_XFGVIRT(IMbnSubscriberInformation, get_TelephoneNumbers) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_TelephoneNumbers )( __RPC__in IMbnSubscriberInformation * This, /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *TelephoneNumbers); END_INTERFACE } IMbnSubscriberInformationVtbl; interface IMbnSubscriberInformation { CONST_VTBL struct IMbnSubscriberInformationVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnSubscriberInformation_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnSubscriberInformation_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnSubscriberInformation_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnSubscriberInformation_get_SubscriberID(This,SubscriberID) \ ( (This)->lpVtbl -> get_SubscriberID(This,SubscriberID) ) #define IMbnSubscriberInformation_get_SimIccID(This,SimIccID) \ ( (This)->lpVtbl -> get_SimIccID(This,SimIccID) ) #define IMbnSubscriberInformation_get_TelephoneNumbers(This,TelephoneNumbers) \ ( (This)->lpVtbl -> get_TelephoneNumbers(This,TelephoneNumbers) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnSubscriberInformation_INTERFACE_DEFINED__ */ #ifndef __IMbnSignal_INTERFACE_DEFINED__ #define __IMbnSignal_INTERFACE_DEFINED__ /* interface IMbnSignal */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnSignal; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-2003-4BBB-AAEE-338E368AF6FA") IMbnSignal : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetSignalStrength( /* [retval][ref][out] */ __RPC__out ULONG *signalStrength) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetSignalError( /* [retval][ref][out] */ __RPC__out ULONG *signalError) = 0; }; #else /* C style interface */ typedef struct IMbnSignalVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnSignal * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnSignal * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnSignal * This); DECLSPEC_XFGVIRT(IMbnSignal, GetSignalStrength) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetSignalStrength )( __RPC__in IMbnSignal * This, /* [retval][ref][out] */ __RPC__out ULONG *signalStrength); DECLSPEC_XFGVIRT(IMbnSignal, GetSignalError) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetSignalError )( __RPC__in IMbnSignal * This, /* [retval][ref][out] */ __RPC__out ULONG *signalError); END_INTERFACE } IMbnSignalVtbl; interface IMbnSignal { CONST_VTBL struct IMbnSignalVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnSignal_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnSignal_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnSignal_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnSignal_GetSignalStrength(This,signalStrength) \ ( (This)->lpVtbl -> GetSignalStrength(This,signalStrength) ) #define IMbnSignal_GetSignalError(This,signalError) \ ( (This)->lpVtbl -> GetSignalError(This,signalError) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnSignal_INTERFACE_DEFINED__ */ #ifndef __IMbnSignalEvents_INTERFACE_DEFINED__ #define __IMbnSignalEvents_INTERFACE_DEFINED__ /* interface IMbnSignalEvents */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnSignalEvents; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-2004-4BBB-AAEE-338E368AF6FA") IMbnSignalEvents : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnSignalStateChange( /* [annotation][in] */ _In_ IMbnSignal *newInterface) = 0; }; #else /* C style interface */ typedef struct IMbnSignalEventsVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnSignalEvents * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnSignalEvents * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnSignalEvents * This); DECLSPEC_XFGVIRT(IMbnSignalEvents, OnSignalStateChange) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnSignalStateChange )( __RPC__in IMbnSignalEvents * This, /* [annotation][in] */ _In_ IMbnSignal *newInterface); END_INTERFACE } IMbnSignalEventsVtbl; interface IMbnSignalEvents { CONST_VTBL struct IMbnSignalEventsVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnSignalEvents_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnSignalEvents_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnSignalEvents_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnSignalEvents_OnSignalStateChange(This,newInterface) \ ( (This)->lpVtbl -> OnSignalStateChange(This,newInterface) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnSignalEvents_INTERFACE_DEFINED__ */ #ifndef __IMbnConnectionContext_INTERFACE_DEFINED__ #define __IMbnConnectionContext_INTERFACE_DEFINED__ /* interface IMbnConnectionContext */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnConnectionContext; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-200B-4BBB-AAEE-338E368AF6FA") IMbnConnectionContext : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetProvisionedContexts( /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *provisionedContexts) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetProvisionedContext( /* [annotation][in] */ _In_ MBN_CONTEXT provisionedContexts, /* [annotation][in] */ _In_ LPCWSTR providerID, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; }; #else /* C style interface */ typedef struct IMbnConnectionContextVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnConnectionContext * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnConnectionContext * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnConnectionContext * This); DECLSPEC_XFGVIRT(IMbnConnectionContext, GetProvisionedContexts) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetProvisionedContexts )( __RPC__in IMbnConnectionContext * This, /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *provisionedContexts); DECLSPEC_XFGVIRT(IMbnConnectionContext, SetProvisionedContext) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetProvisionedContext )( __RPC__in IMbnConnectionContext * This, /* [annotation][in] */ _In_ MBN_CONTEXT provisionedContexts, /* [annotation][in] */ _In_ LPCWSTR providerID, /* [annotation][out] */ _Out_ ULONG *requestID); END_INTERFACE } IMbnConnectionContextVtbl; interface IMbnConnectionContext { CONST_VTBL struct IMbnConnectionContextVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnConnectionContext_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnConnectionContext_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnConnectionContext_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnConnectionContext_GetProvisionedContexts(This,provisionedContexts) \ ( (This)->lpVtbl -> GetProvisionedContexts(This,provisionedContexts) ) #define IMbnConnectionContext_SetProvisionedContext(This,provisionedContexts,providerID,requestID) \ ( (This)->lpVtbl -> SetProvisionedContext(This,provisionedContexts,providerID,requestID) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnConnectionContext_INTERFACE_DEFINED__ */ #ifndef __IMbnConnectionContextEvents_INTERFACE_DEFINED__ #define __IMbnConnectionContextEvents_INTERFACE_DEFINED__ /* interface IMbnConnectionContextEvents */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnConnectionContextEvents; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-200C-4BBB-AAEE-338E368AF6FA") IMbnConnectionContextEvents : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnProvisionedContextListChange( /* [annotation][in] */ _In_ IMbnConnectionContext *newInterface) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnSetProvisionedContextComplete( /* [annotation][in] */ _In_ IMbnConnectionContext *newInterface, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status) = 0; }; #else /* C style interface */ typedef struct IMbnConnectionContextEventsVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnConnectionContextEvents * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnConnectionContextEvents * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnConnectionContextEvents * This); DECLSPEC_XFGVIRT(IMbnConnectionContextEvents, OnProvisionedContextListChange) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnProvisionedContextListChange )( __RPC__in IMbnConnectionContextEvents * This, /* [annotation][in] */ _In_ IMbnConnectionContext *newInterface); DECLSPEC_XFGVIRT(IMbnConnectionContextEvents, OnSetProvisionedContextComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnSetProvisionedContextComplete )( __RPC__in IMbnConnectionContextEvents * This, /* [annotation][in] */ _In_ IMbnConnectionContext *newInterface, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status); END_INTERFACE } IMbnConnectionContextEventsVtbl; interface IMbnConnectionContextEvents { CONST_VTBL struct IMbnConnectionContextEventsVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnConnectionContextEvents_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnConnectionContextEvents_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnConnectionContextEvents_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnConnectionContextEvents_OnProvisionedContextListChange(This,newInterface) \ ( (This)->lpVtbl -> OnProvisionedContextListChange(This,newInterface) ) #define IMbnConnectionContextEvents_OnSetProvisionedContextComplete(This,newInterface,requestID,status) \ ( (This)->lpVtbl -> OnSetProvisionedContextComplete(This,newInterface,requestID,status) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnConnectionContextEvents_INTERFACE_DEFINED__ */ #ifndef __IMbnConnectionProfileManager_INTERFACE_DEFINED__ #define __IMbnConnectionProfileManager_INTERFACE_DEFINED__ /* interface IMbnConnectionProfileManager */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnConnectionProfileManager; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-200F-4BBB-AAEE-338E368AF6FA") IMbnConnectionProfileManager : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetConnectionProfiles( /* [annotation][in] */ _In_ IMbnInterface *mbnInterface, /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *connectionProfiles) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetConnectionProfile( /* [annotation][in] */ _In_ IMbnInterface *mbnInterface, /* [annotation][string][in] */ _In_ LPCWSTR profileName, /* [retval][ref][out] */ __RPC__deref_out_opt IMbnConnectionProfile **connectionProfile) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE CreateConnectionProfile( /* [annotation][string][in] */ _In_ LPCWSTR xmlProfile) = 0; }; #else /* C style interface */ typedef struct IMbnConnectionProfileManagerVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnConnectionProfileManager * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnConnectionProfileManager * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnConnectionProfileManager * This); DECLSPEC_XFGVIRT(IMbnConnectionProfileManager, GetConnectionProfiles) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetConnectionProfiles )( __RPC__in IMbnConnectionProfileManager * This, /* [annotation][in] */ _In_ IMbnInterface *mbnInterface, /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *connectionProfiles); DECLSPEC_XFGVIRT(IMbnConnectionProfileManager, GetConnectionProfile) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetConnectionProfile )( __RPC__in IMbnConnectionProfileManager * This, /* [annotation][in] */ _In_ IMbnInterface *mbnInterface, /* [annotation][string][in] */ _In_ LPCWSTR profileName, /* [retval][ref][out] */ __RPC__deref_out_opt IMbnConnectionProfile **connectionProfile); DECLSPEC_XFGVIRT(IMbnConnectionProfileManager, CreateConnectionProfile) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *CreateConnectionProfile )( __RPC__in IMbnConnectionProfileManager * This, /* [annotation][string][in] */ _In_ LPCWSTR xmlProfile); END_INTERFACE } IMbnConnectionProfileManagerVtbl; interface IMbnConnectionProfileManager { CONST_VTBL struct IMbnConnectionProfileManagerVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnConnectionProfileManager_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnConnectionProfileManager_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnConnectionProfileManager_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnConnectionProfileManager_GetConnectionProfiles(This,mbnInterface,connectionProfiles) \ ( (This)->lpVtbl -> GetConnectionProfiles(This,mbnInterface,connectionProfiles) ) #define IMbnConnectionProfileManager_GetConnectionProfile(This,mbnInterface,profileName,connectionProfile) \ ( (This)->lpVtbl -> GetConnectionProfile(This,mbnInterface,profileName,connectionProfile) ) #define IMbnConnectionProfileManager_CreateConnectionProfile(This,xmlProfile) \ ( (This)->lpVtbl -> CreateConnectionProfile(This,xmlProfile) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnConnectionProfileManager_INTERFACE_DEFINED__ */ #ifndef __IMbnConnectionProfile_INTERFACE_DEFINED__ #define __IMbnConnectionProfile_INTERFACE_DEFINED__ /* interface IMbnConnectionProfile */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnConnectionProfile; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-2010-4BBB-AAEE-338E368AF6FA") IMbnConnectionProfile : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetProfileXmlData( /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *profileData) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE UpdateProfile( /* [annotation][string][in] */ _In_ LPCWSTR strProfile) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Delete( void) = 0; }; #else /* C style interface */ typedef struct IMbnConnectionProfileVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnConnectionProfile * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnConnectionProfile * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnConnectionProfile * This); DECLSPEC_XFGVIRT(IMbnConnectionProfile, GetProfileXmlData) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetProfileXmlData )( __RPC__in IMbnConnectionProfile * This, /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *profileData); DECLSPEC_XFGVIRT(IMbnConnectionProfile, UpdateProfile) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *UpdateProfile )( __RPC__in IMbnConnectionProfile * This, /* [annotation][string][in] */ _In_ LPCWSTR strProfile); DECLSPEC_XFGVIRT(IMbnConnectionProfile, Delete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Delete )( __RPC__in IMbnConnectionProfile * This); END_INTERFACE } IMbnConnectionProfileVtbl; interface IMbnConnectionProfile { CONST_VTBL struct IMbnConnectionProfileVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnConnectionProfile_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnConnectionProfile_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnConnectionProfile_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnConnectionProfile_GetProfileXmlData(This,profileData) \ ( (This)->lpVtbl -> GetProfileXmlData(This,profileData) ) #define IMbnConnectionProfile_UpdateProfile(This,strProfile) \ ( (This)->lpVtbl -> UpdateProfile(This,strProfile) ) #define IMbnConnectionProfile_Delete(This) \ ( (This)->lpVtbl -> Delete(This) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnConnectionProfile_INTERFACE_DEFINED__ */ #ifndef __IMbnConnectionProfileEvents_INTERFACE_DEFINED__ #define __IMbnConnectionProfileEvents_INTERFACE_DEFINED__ /* interface IMbnConnectionProfileEvents */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnConnectionProfileEvents; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-2011-4BBB-AAEE-338E368AF6FA") IMbnConnectionProfileEvents : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnProfileUpdate( /* [annotation][in] */ _In_ IMbnConnectionProfile *newProfile) = 0; }; #else /* C style interface */ typedef struct IMbnConnectionProfileEventsVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnConnectionProfileEvents * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnConnectionProfileEvents * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnConnectionProfileEvents * This); DECLSPEC_XFGVIRT(IMbnConnectionProfileEvents, OnProfileUpdate) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnProfileUpdate )( __RPC__in IMbnConnectionProfileEvents * This, /* [annotation][in] */ _In_ IMbnConnectionProfile *newProfile); END_INTERFACE } IMbnConnectionProfileEventsVtbl; interface IMbnConnectionProfileEvents { CONST_VTBL struct IMbnConnectionProfileEventsVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnConnectionProfileEvents_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnConnectionProfileEvents_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnConnectionProfileEvents_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnConnectionProfileEvents_OnProfileUpdate(This,newProfile) \ ( (This)->lpVtbl -> OnProfileUpdate(This,newProfile) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnConnectionProfileEvents_INTERFACE_DEFINED__ */ #ifndef __IMbnSmsConfiguration_INTERFACE_DEFINED__ #define __IMbnSmsConfiguration_INTERFACE_DEFINED__ /* interface IMbnSmsConfiguration */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnSmsConfiguration; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-2012-4BBB-AAEE-338E368AF6FA") IMbnSmsConfiguration : public IUnknown { public: virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ServiceCenterAddress( /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *scAddress) = 0; virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ServiceCenterAddress( /* [annotation][in] */ _In_ LPCWSTR scAddress) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_MaxMessageIndex( /* [retval][ref][out] */ __RPC__out ULONG *index) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CdmaShortMsgSize( /* [retval][ref][out] */ __RPC__out ULONG *shortMsgSize) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SmsFormat( /* [retval][ref][out] */ __RPC__out MBN_SMS_FORMAT *smsFormat) = 0; virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SmsFormat( /* [annotation][in] */ _In_ MBN_SMS_FORMAT smsFormat) = 0; }; #else /* C style interface */ typedef struct IMbnSmsConfigurationVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnSmsConfiguration * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnSmsConfiguration * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnSmsConfiguration * This); DECLSPEC_XFGVIRT(IMbnSmsConfiguration, get_ServiceCenterAddress) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_ServiceCenterAddress )( __RPC__in IMbnSmsConfiguration * This, /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *scAddress); DECLSPEC_XFGVIRT(IMbnSmsConfiguration, put_ServiceCenterAddress) /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_ServiceCenterAddress )( __RPC__in IMbnSmsConfiguration * This, /* [annotation][in] */ _In_ LPCWSTR scAddress); DECLSPEC_XFGVIRT(IMbnSmsConfiguration, get_MaxMessageIndex) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_MaxMessageIndex )( __RPC__in IMbnSmsConfiguration * This, /* [retval][ref][out] */ __RPC__out ULONG *index); DECLSPEC_XFGVIRT(IMbnSmsConfiguration, get_CdmaShortMsgSize) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_CdmaShortMsgSize )( __RPC__in IMbnSmsConfiguration * This, /* [retval][ref][out] */ __RPC__out ULONG *shortMsgSize); DECLSPEC_XFGVIRT(IMbnSmsConfiguration, get_SmsFormat) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_SmsFormat )( __RPC__in IMbnSmsConfiguration * This, /* [retval][ref][out] */ __RPC__out MBN_SMS_FORMAT *smsFormat); DECLSPEC_XFGVIRT(IMbnSmsConfiguration, put_SmsFormat) /* [helpstring][id][propput] */ HRESULT ( STDMETHODCALLTYPE *put_SmsFormat )( __RPC__in IMbnSmsConfiguration * This, /* [annotation][in] */ _In_ MBN_SMS_FORMAT smsFormat); END_INTERFACE } IMbnSmsConfigurationVtbl; interface IMbnSmsConfiguration { CONST_VTBL struct IMbnSmsConfigurationVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnSmsConfiguration_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnSmsConfiguration_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnSmsConfiguration_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnSmsConfiguration_get_ServiceCenterAddress(This,scAddress) \ ( (This)->lpVtbl -> get_ServiceCenterAddress(This,scAddress) ) #define IMbnSmsConfiguration_put_ServiceCenterAddress(This,scAddress) \ ( (This)->lpVtbl -> put_ServiceCenterAddress(This,scAddress) ) #define IMbnSmsConfiguration_get_MaxMessageIndex(This,index) \ ( (This)->lpVtbl -> get_MaxMessageIndex(This,index) ) #define IMbnSmsConfiguration_get_CdmaShortMsgSize(This,shortMsgSize) \ ( (This)->lpVtbl -> get_CdmaShortMsgSize(This,shortMsgSize) ) #define IMbnSmsConfiguration_get_SmsFormat(This,smsFormat) \ ( (This)->lpVtbl -> get_SmsFormat(This,smsFormat) ) #define IMbnSmsConfiguration_put_SmsFormat(This,smsFormat) \ ( (This)->lpVtbl -> put_SmsFormat(This,smsFormat) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnSmsConfiguration_INTERFACE_DEFINED__ */ #ifndef __IMbnSmsReadMsgPdu_INTERFACE_DEFINED__ #define __IMbnSmsReadMsgPdu_INTERFACE_DEFINED__ /* interface IMbnSmsReadMsgPdu */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnSmsReadMsgPdu; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-2013-4BBB-AAEE-338E368AF6FA") IMbnSmsReadMsgPdu : public IUnknown { public: virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Index( /* [retval][ref][out] */ __RPC__out ULONG *Index) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Status( /* [retval][ref][out] */ __RPC__out MBN_MSG_STATUS *Status) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_PduData( /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *PduData) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Message( /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *Message) = 0; }; #else /* C style interface */ typedef struct IMbnSmsReadMsgPduVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnSmsReadMsgPdu * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnSmsReadMsgPdu * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnSmsReadMsgPdu * This); DECLSPEC_XFGVIRT(IMbnSmsReadMsgPdu, get_Index) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Index )( __RPC__in IMbnSmsReadMsgPdu * This, /* [retval][ref][out] */ __RPC__out ULONG *Index); DECLSPEC_XFGVIRT(IMbnSmsReadMsgPdu, get_Status) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Status )( __RPC__in IMbnSmsReadMsgPdu * This, /* [retval][ref][out] */ __RPC__out MBN_MSG_STATUS *Status); DECLSPEC_XFGVIRT(IMbnSmsReadMsgPdu, get_PduData) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_PduData )( __RPC__in IMbnSmsReadMsgPdu * This, /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *PduData); DECLSPEC_XFGVIRT(IMbnSmsReadMsgPdu, get_Message) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Message )( __RPC__in IMbnSmsReadMsgPdu * This, /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *Message); END_INTERFACE } IMbnSmsReadMsgPduVtbl; interface IMbnSmsReadMsgPdu { CONST_VTBL struct IMbnSmsReadMsgPduVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnSmsReadMsgPdu_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnSmsReadMsgPdu_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnSmsReadMsgPdu_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnSmsReadMsgPdu_get_Index(This,Index) \ ( (This)->lpVtbl -> get_Index(This,Index) ) #define IMbnSmsReadMsgPdu_get_Status(This,Status) \ ( (This)->lpVtbl -> get_Status(This,Status) ) #define IMbnSmsReadMsgPdu_get_PduData(This,PduData) \ ( (This)->lpVtbl -> get_PduData(This,PduData) ) #define IMbnSmsReadMsgPdu_get_Message(This,Message) \ ( (This)->lpVtbl -> get_Message(This,Message) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnSmsReadMsgPdu_INTERFACE_DEFINED__ */ #ifndef __IMbnSmsReadMsgTextCdma_INTERFACE_DEFINED__ #define __IMbnSmsReadMsgTextCdma_INTERFACE_DEFINED__ /* interface IMbnSmsReadMsgTextCdma */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnSmsReadMsgTextCdma; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-2014-4BBB-AAEE-338E368AF6FA") IMbnSmsReadMsgTextCdma : public IUnknown { public: virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Index( /* [retval][ref][out] */ __RPC__out ULONG *Index) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Status( /* [retval][ref][out] */ __RPC__out MBN_MSG_STATUS *Status) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Address( /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *Address) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Timestamp( /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *Timestamp) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_EncodingID( /* [retval][ref][out] */ __RPC__out MBN_SMS_CDMA_ENCODING *EncodingID) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_LanguageID( /* [retval][ref][out] */ __RPC__out MBN_SMS_CDMA_LANG *LanguageID) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SizeInCharacters( /* [retval][ref][out] */ __RPC__out ULONG *SizeInCharacters) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Message( /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *Message) = 0; }; #else /* C style interface */ typedef struct IMbnSmsReadMsgTextCdmaVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnSmsReadMsgTextCdma * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnSmsReadMsgTextCdma * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnSmsReadMsgTextCdma * This); DECLSPEC_XFGVIRT(IMbnSmsReadMsgTextCdma, get_Index) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Index )( __RPC__in IMbnSmsReadMsgTextCdma * This, /* [retval][ref][out] */ __RPC__out ULONG *Index); DECLSPEC_XFGVIRT(IMbnSmsReadMsgTextCdma, get_Status) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Status )( __RPC__in IMbnSmsReadMsgTextCdma * This, /* [retval][ref][out] */ __RPC__out MBN_MSG_STATUS *Status); DECLSPEC_XFGVIRT(IMbnSmsReadMsgTextCdma, get_Address) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Address )( __RPC__in IMbnSmsReadMsgTextCdma * This, /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *Address); DECLSPEC_XFGVIRT(IMbnSmsReadMsgTextCdma, get_Timestamp) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Timestamp )( __RPC__in IMbnSmsReadMsgTextCdma * This, /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *Timestamp); DECLSPEC_XFGVIRT(IMbnSmsReadMsgTextCdma, get_EncodingID) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_EncodingID )( __RPC__in IMbnSmsReadMsgTextCdma * This, /* [retval][ref][out] */ __RPC__out MBN_SMS_CDMA_ENCODING *EncodingID); DECLSPEC_XFGVIRT(IMbnSmsReadMsgTextCdma, get_LanguageID) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_LanguageID )( __RPC__in IMbnSmsReadMsgTextCdma * This, /* [retval][ref][out] */ __RPC__out MBN_SMS_CDMA_LANG *LanguageID); DECLSPEC_XFGVIRT(IMbnSmsReadMsgTextCdma, get_SizeInCharacters) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_SizeInCharacters )( __RPC__in IMbnSmsReadMsgTextCdma * This, /* [retval][ref][out] */ __RPC__out ULONG *SizeInCharacters); DECLSPEC_XFGVIRT(IMbnSmsReadMsgTextCdma, get_Message) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_Message )( __RPC__in IMbnSmsReadMsgTextCdma * This, /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *Message); END_INTERFACE } IMbnSmsReadMsgTextCdmaVtbl; interface IMbnSmsReadMsgTextCdma { CONST_VTBL struct IMbnSmsReadMsgTextCdmaVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnSmsReadMsgTextCdma_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnSmsReadMsgTextCdma_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnSmsReadMsgTextCdma_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnSmsReadMsgTextCdma_get_Index(This,Index) \ ( (This)->lpVtbl -> get_Index(This,Index) ) #define IMbnSmsReadMsgTextCdma_get_Status(This,Status) \ ( (This)->lpVtbl -> get_Status(This,Status) ) #define IMbnSmsReadMsgTextCdma_get_Address(This,Address) \ ( (This)->lpVtbl -> get_Address(This,Address) ) #define IMbnSmsReadMsgTextCdma_get_Timestamp(This,Timestamp) \ ( (This)->lpVtbl -> get_Timestamp(This,Timestamp) ) #define IMbnSmsReadMsgTextCdma_get_EncodingID(This,EncodingID) \ ( (This)->lpVtbl -> get_EncodingID(This,EncodingID) ) #define IMbnSmsReadMsgTextCdma_get_LanguageID(This,LanguageID) \ ( (This)->lpVtbl -> get_LanguageID(This,LanguageID) ) #define IMbnSmsReadMsgTextCdma_get_SizeInCharacters(This,SizeInCharacters) \ ( (This)->lpVtbl -> get_SizeInCharacters(This,SizeInCharacters) ) #define IMbnSmsReadMsgTextCdma_get_Message(This,Message) \ ( (This)->lpVtbl -> get_Message(This,Message) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnSmsReadMsgTextCdma_INTERFACE_DEFINED__ */ #ifndef __IMbnSms_INTERFACE_DEFINED__ #define __IMbnSms_INTERFACE_DEFINED__ /* interface IMbnSms */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnSms; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-2015-4BBB-AAEE-338E368AF6FA") IMbnSms : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetSmsConfiguration( /* [retval][ref][out] */ __RPC__deref_out_opt IMbnSmsConfiguration **smsConfiguration) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetSmsConfiguration( /* [annotation][in] */ _In_ IMbnSmsConfiguration *smsConfiguration, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SmsSendPdu( /* [annotation][in] */ _In_ LPCWSTR pduData, /* [annotation][in] */ _In_ BYTE size, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SmsSendCdma( /* [annotation][in] */ _In_ LPCWSTR address, /* [annotation][in] */ _In_ MBN_SMS_CDMA_ENCODING encoding, /* [annotation][in] */ _In_ MBN_SMS_CDMA_LANG language, /* [annotation][in] */ _In_ ULONG sizeInCharacters, /* [annotation][in] */ _In_ SAFEARRAY * message, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SmsSendCdmaPdu( /* [annotation][in] */ _In_ SAFEARRAY * message, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SmsRead( /* [ref][in] */ __RPC__in MBN_SMS_FILTER *smsFilter, /* [annotation][in] */ _In_ MBN_SMS_FORMAT smsFormat, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SmsDelete( /* [ref][in] */ __RPC__in MBN_SMS_FILTER *smsFilter, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetSmsStatus( /* [ref][out] */ __RPC__out MBN_SMS_STATUS_INFO *smsStatusInfo) = 0; }; #else /* C style interface */ typedef struct IMbnSmsVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnSms * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnSms * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnSms * This); DECLSPEC_XFGVIRT(IMbnSms, GetSmsConfiguration) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetSmsConfiguration )( __RPC__in IMbnSms * This, /* [retval][ref][out] */ __RPC__deref_out_opt IMbnSmsConfiguration **smsConfiguration); DECLSPEC_XFGVIRT(IMbnSms, SetSmsConfiguration) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetSmsConfiguration )( __RPC__in IMbnSms * This, /* [annotation][in] */ _In_ IMbnSmsConfiguration *smsConfiguration, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnSms, SmsSendPdu) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SmsSendPdu )( __RPC__in IMbnSms * This, /* [annotation][in] */ _In_ LPCWSTR pduData, /* [annotation][in] */ _In_ BYTE size, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnSms, SmsSendCdma) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SmsSendCdma )( __RPC__in IMbnSms * This, /* [annotation][in] */ _In_ LPCWSTR address, /* [annotation][in] */ _In_ MBN_SMS_CDMA_ENCODING encoding, /* [annotation][in] */ _In_ MBN_SMS_CDMA_LANG language, /* [annotation][in] */ _In_ ULONG sizeInCharacters, /* [annotation][in] */ _In_ SAFEARRAY * message, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnSms, SmsSendCdmaPdu) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SmsSendCdmaPdu )( __RPC__in IMbnSms * This, /* [annotation][in] */ _In_ SAFEARRAY * message, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnSms, SmsRead) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SmsRead )( __RPC__in IMbnSms * This, /* [ref][in] */ __RPC__in MBN_SMS_FILTER *smsFilter, /* [annotation][in] */ _In_ MBN_SMS_FORMAT smsFormat, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnSms, SmsDelete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SmsDelete )( __RPC__in IMbnSms * This, /* [ref][in] */ __RPC__in MBN_SMS_FILTER *smsFilter, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnSms, GetSmsStatus) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetSmsStatus )( __RPC__in IMbnSms * This, /* [ref][out] */ __RPC__out MBN_SMS_STATUS_INFO *smsStatusInfo); END_INTERFACE } IMbnSmsVtbl; interface IMbnSms { CONST_VTBL struct IMbnSmsVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnSms_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnSms_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnSms_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnSms_GetSmsConfiguration(This,smsConfiguration) \ ( (This)->lpVtbl -> GetSmsConfiguration(This,smsConfiguration) ) #define IMbnSms_SetSmsConfiguration(This,smsConfiguration,requestID) \ ( (This)->lpVtbl -> SetSmsConfiguration(This,smsConfiguration,requestID) ) #define IMbnSms_SmsSendPdu(This,pduData,size,requestID) \ ( (This)->lpVtbl -> SmsSendPdu(This,pduData,size,requestID) ) #define IMbnSms_SmsSendCdma(This,address,encoding,language,sizeInCharacters,message,requestID) \ ( (This)->lpVtbl -> SmsSendCdma(This,address,encoding,language,sizeInCharacters,message,requestID) ) #define IMbnSms_SmsSendCdmaPdu(This,message,requestID) \ ( (This)->lpVtbl -> SmsSendCdmaPdu(This,message,requestID) ) #define IMbnSms_SmsRead(This,smsFilter,smsFormat,requestID) \ ( (This)->lpVtbl -> SmsRead(This,smsFilter,smsFormat,requestID) ) #define IMbnSms_SmsDelete(This,smsFilter,requestID) \ ( (This)->lpVtbl -> SmsDelete(This,smsFilter,requestID) ) #define IMbnSms_GetSmsStatus(This,smsStatusInfo) \ ( (This)->lpVtbl -> GetSmsStatus(This,smsStatusInfo) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnSms_INTERFACE_DEFINED__ */ #ifndef __IMbnSmsEvents_INTERFACE_DEFINED__ #define __IMbnSmsEvents_INTERFACE_DEFINED__ /* interface IMbnSmsEvents */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnSmsEvents; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-2016-4BBB-AAEE-338E368AF6FA") IMbnSmsEvents : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnSmsConfigurationChange( /* [annotation][in] */ _In_ IMbnSms *sms) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnSetSmsConfigurationComplete( /* [annotation][in] */ _In_ IMbnSms *sms, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnSmsSendComplete( /* [annotation][in] */ _In_ IMbnSms *sms, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnSmsReadComplete( /* [annotation][in] */ _In_ IMbnSms *sms, /* [annotation][in] */ _In_ MBN_SMS_FORMAT smsFormat, /* [annotation][in] */ _In_ SAFEARRAY * readMsgs, /* [annotation][in] */ _In_ VARIANT_BOOL moreMsgs, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnSmsNewClass0Message( /* [annotation][in] */ _In_ IMbnSms *sms, /* [annotation][in] */ _In_ MBN_SMS_FORMAT smsFormat, /* [annotation][in] */ _In_ SAFEARRAY * readMsgs) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnSmsDeleteComplete( /* [annotation][in] */ _In_ IMbnSms *sms, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnSmsStatusChange( /* [annotation][in] */ _In_ IMbnSms *sms) = 0; }; #else /* C style interface */ typedef struct IMbnSmsEventsVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnSmsEvents * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnSmsEvents * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnSmsEvents * This); DECLSPEC_XFGVIRT(IMbnSmsEvents, OnSmsConfigurationChange) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnSmsConfigurationChange )( __RPC__in IMbnSmsEvents * This, /* [annotation][in] */ _In_ IMbnSms *sms); DECLSPEC_XFGVIRT(IMbnSmsEvents, OnSetSmsConfigurationComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnSetSmsConfigurationComplete )( __RPC__in IMbnSmsEvents * This, /* [annotation][in] */ _In_ IMbnSms *sms, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status); DECLSPEC_XFGVIRT(IMbnSmsEvents, OnSmsSendComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnSmsSendComplete )( __RPC__in IMbnSmsEvents * This, /* [annotation][in] */ _In_ IMbnSms *sms, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status); DECLSPEC_XFGVIRT(IMbnSmsEvents, OnSmsReadComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnSmsReadComplete )( __RPC__in IMbnSmsEvents * This, /* [annotation][in] */ _In_ IMbnSms *sms, /* [annotation][in] */ _In_ MBN_SMS_FORMAT smsFormat, /* [annotation][in] */ _In_ SAFEARRAY * readMsgs, /* [annotation][in] */ _In_ VARIANT_BOOL moreMsgs, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status); DECLSPEC_XFGVIRT(IMbnSmsEvents, OnSmsNewClass0Message) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnSmsNewClass0Message )( __RPC__in IMbnSmsEvents * This, /* [annotation][in] */ _In_ IMbnSms *sms, /* [annotation][in] */ _In_ MBN_SMS_FORMAT smsFormat, /* [annotation][in] */ _In_ SAFEARRAY * readMsgs); DECLSPEC_XFGVIRT(IMbnSmsEvents, OnSmsDeleteComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnSmsDeleteComplete )( __RPC__in IMbnSmsEvents * This, /* [annotation][in] */ _In_ IMbnSms *sms, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status); DECLSPEC_XFGVIRT(IMbnSmsEvents, OnSmsStatusChange) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnSmsStatusChange )( __RPC__in IMbnSmsEvents * This, /* [annotation][in] */ _In_ IMbnSms *sms); END_INTERFACE } IMbnSmsEventsVtbl; interface IMbnSmsEvents { CONST_VTBL struct IMbnSmsEventsVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnSmsEvents_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnSmsEvents_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnSmsEvents_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnSmsEvents_OnSmsConfigurationChange(This,sms) \ ( (This)->lpVtbl -> OnSmsConfigurationChange(This,sms) ) #define IMbnSmsEvents_OnSetSmsConfigurationComplete(This,sms,requestID,status) \ ( (This)->lpVtbl -> OnSetSmsConfigurationComplete(This,sms,requestID,status) ) #define IMbnSmsEvents_OnSmsSendComplete(This,sms,requestID,status) \ ( (This)->lpVtbl -> OnSmsSendComplete(This,sms,requestID,status) ) #define IMbnSmsEvents_OnSmsReadComplete(This,sms,smsFormat,readMsgs,moreMsgs,requestID,status) \ ( (This)->lpVtbl -> OnSmsReadComplete(This,sms,smsFormat,readMsgs,moreMsgs,requestID,status) ) #define IMbnSmsEvents_OnSmsNewClass0Message(This,sms,smsFormat,readMsgs) \ ( (This)->lpVtbl -> OnSmsNewClass0Message(This,sms,smsFormat,readMsgs) ) #define IMbnSmsEvents_OnSmsDeleteComplete(This,sms,requestID,status) \ ( (This)->lpVtbl -> OnSmsDeleteComplete(This,sms,requestID,status) ) #define IMbnSmsEvents_OnSmsStatusChange(This,sms) \ ( (This)->lpVtbl -> OnSmsStatusChange(This,sms) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnSmsEvents_INTERFACE_DEFINED__ */ #ifndef __IMbnServiceActivation_INTERFACE_DEFINED__ #define __IMbnServiceActivation_INTERFACE_DEFINED__ /* interface IMbnServiceActivation */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnServiceActivation; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-2017-4BBB-AAEE-338E368AF6FA") IMbnServiceActivation : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Activate( /* [annotation][in] */ _In_ SAFEARRAY * vendorSpecificData, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; }; #else /* C style interface */ typedef struct IMbnServiceActivationVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnServiceActivation * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnServiceActivation * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnServiceActivation * This); DECLSPEC_XFGVIRT(IMbnServiceActivation, Activate) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Activate )( __RPC__in IMbnServiceActivation * This, /* [annotation][in] */ _In_ SAFEARRAY * vendorSpecificData, /* [annotation][out] */ _Out_ ULONG *requestID); END_INTERFACE } IMbnServiceActivationVtbl; interface IMbnServiceActivation { CONST_VTBL struct IMbnServiceActivationVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnServiceActivation_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnServiceActivation_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnServiceActivation_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnServiceActivation_Activate(This,vendorSpecificData,requestID) \ ( (This)->lpVtbl -> Activate(This,vendorSpecificData,requestID) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnServiceActivation_INTERFACE_DEFINED__ */ #ifndef __IMbnServiceActivationEvents_INTERFACE_DEFINED__ #define __IMbnServiceActivationEvents_INTERFACE_DEFINED__ /* interface IMbnServiceActivationEvents */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnServiceActivationEvents; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-2018-4BBB-AAEE-338E368AF6FA") IMbnServiceActivationEvents : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnActivationComplete( /* [annotation][in] */ _In_ IMbnServiceActivation *serviceActivation, /* [annotation][in] */ _In_ SAFEARRAY * vendorSpecificData, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status, /* [annotation][in] */ _In_ ULONG networkError) = 0; }; #else /* C style interface */ typedef struct IMbnServiceActivationEventsVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnServiceActivationEvents * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnServiceActivationEvents * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnServiceActivationEvents * This); DECLSPEC_XFGVIRT(IMbnServiceActivationEvents, OnActivationComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnActivationComplete )( __RPC__in IMbnServiceActivationEvents * This, /* [annotation][in] */ _In_ IMbnServiceActivation *serviceActivation, /* [annotation][in] */ _In_ SAFEARRAY * vendorSpecificData, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status, /* [annotation][in] */ _In_ ULONG networkError); END_INTERFACE } IMbnServiceActivationEventsVtbl; interface IMbnServiceActivationEvents { CONST_VTBL struct IMbnServiceActivationEventsVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnServiceActivationEvents_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnServiceActivationEvents_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnServiceActivationEvents_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnServiceActivationEvents_OnActivationComplete(This,serviceActivation,vendorSpecificData,requestID,status,networkError) \ ( (This)->lpVtbl -> OnActivationComplete(This,serviceActivation,vendorSpecificData,requestID,status,networkError) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnServiceActivationEvents_INTERFACE_DEFINED__ */ #ifndef __IMbnVendorSpecificOperation_INTERFACE_DEFINED__ #define __IMbnVendorSpecificOperation_INTERFACE_DEFINED__ /* interface IMbnVendorSpecificOperation */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnVendorSpecificOperation; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-2019-4BBB-AAEE-338E368AF6FA") IMbnVendorSpecificOperation : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetVendorSpecific( /* [ref][in] */ __RPC__in SAFEARRAY * vendorSpecificData, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; }; #else /* C style interface */ typedef struct IMbnVendorSpecificOperationVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnVendorSpecificOperation * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnVendorSpecificOperation * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnVendorSpecificOperation * This); DECLSPEC_XFGVIRT(IMbnVendorSpecificOperation, SetVendorSpecific) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetVendorSpecific )( __RPC__in IMbnVendorSpecificOperation * This, /* [ref][in] */ __RPC__in SAFEARRAY * vendorSpecificData, /* [annotation][out] */ _Out_ ULONG *requestID); END_INTERFACE } IMbnVendorSpecificOperationVtbl; interface IMbnVendorSpecificOperation { CONST_VTBL struct IMbnVendorSpecificOperationVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnVendorSpecificOperation_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnVendorSpecificOperation_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnVendorSpecificOperation_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnVendorSpecificOperation_SetVendorSpecific(This,vendorSpecificData,requestID) \ ( (This)->lpVtbl -> SetVendorSpecific(This,vendorSpecificData,requestID) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnVendorSpecificOperation_INTERFACE_DEFINED__ */ #ifndef __IMbnVendorSpecificEvents_INTERFACE_DEFINED__ #define __IMbnVendorSpecificEvents_INTERFACE_DEFINED__ /* interface IMbnVendorSpecificEvents */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnVendorSpecificEvents; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-201A-4BBB-AAEE-338E368AF6FA") IMbnVendorSpecificEvents : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnEventNotification( /* [annotation][in] */ _In_ IMbnVendorSpecificOperation *vendorOperation, /* [annotation][in] */ _In_ SAFEARRAY * vendorSpecificData) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnSetVendorSpecificComplete( /* [annotation][in] */ _In_ IMbnVendorSpecificOperation *vendorOperation, /* [annotation][in] */ _In_ SAFEARRAY * vendorSpecificData, /* [annotation][in] */ _In_ ULONG requestID) = 0; }; #else /* C style interface */ typedef struct IMbnVendorSpecificEventsVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnVendorSpecificEvents * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnVendorSpecificEvents * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnVendorSpecificEvents * This); DECLSPEC_XFGVIRT(IMbnVendorSpecificEvents, OnEventNotification) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnEventNotification )( __RPC__in IMbnVendorSpecificEvents * This, /* [annotation][in] */ _In_ IMbnVendorSpecificOperation *vendorOperation, /* [annotation][in] */ _In_ SAFEARRAY * vendorSpecificData); DECLSPEC_XFGVIRT(IMbnVendorSpecificEvents, OnSetVendorSpecificComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnSetVendorSpecificComplete )( __RPC__in IMbnVendorSpecificEvents * This, /* [annotation][in] */ _In_ IMbnVendorSpecificOperation *vendorOperation, /* [annotation][in] */ _In_ SAFEARRAY * vendorSpecificData, /* [annotation][in] */ _In_ ULONG requestID); END_INTERFACE } IMbnVendorSpecificEventsVtbl; interface IMbnVendorSpecificEvents { CONST_VTBL struct IMbnVendorSpecificEventsVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnVendorSpecificEvents_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnVendorSpecificEvents_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnVendorSpecificEvents_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnVendorSpecificEvents_OnEventNotification(This,vendorOperation,vendorSpecificData) \ ( (This)->lpVtbl -> OnEventNotification(This,vendorOperation,vendorSpecificData) ) #define IMbnVendorSpecificEvents_OnSetVendorSpecificComplete(This,vendorOperation,vendorSpecificData,requestID) \ ( (This)->lpVtbl -> OnSetVendorSpecificComplete(This,vendorOperation,vendorSpecificData,requestID) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnVendorSpecificEvents_INTERFACE_DEFINED__ */ #ifndef __IMbnConnectionProfileManagerEvents_INTERFACE_DEFINED__ #define __IMbnConnectionProfileManagerEvents_INTERFACE_DEFINED__ /* interface IMbnConnectionProfileManagerEvents */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnConnectionProfileManagerEvents; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-201F-4BBB-AAEE-338E368AF6FA") IMbnConnectionProfileManagerEvents : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnConnectionProfileArrival( /* [annotation][in] */ _In_ IMbnConnectionProfile *newConnectionProfile) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnConnectionProfileRemoval( /* [annotation][in] */ _In_ IMbnConnectionProfile *oldConnectionProfile) = 0; }; #else /* C style interface */ typedef struct IMbnConnectionProfileManagerEventsVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnConnectionProfileManagerEvents * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnConnectionProfileManagerEvents * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnConnectionProfileManagerEvents * This); DECLSPEC_XFGVIRT(IMbnConnectionProfileManagerEvents, OnConnectionProfileArrival) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnConnectionProfileArrival )( __RPC__in IMbnConnectionProfileManagerEvents * This, /* [annotation][in] */ _In_ IMbnConnectionProfile *newConnectionProfile); DECLSPEC_XFGVIRT(IMbnConnectionProfileManagerEvents, OnConnectionProfileRemoval) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnConnectionProfileRemoval )( __RPC__in IMbnConnectionProfileManagerEvents * This, /* [annotation][in] */ _In_ IMbnConnectionProfile *oldConnectionProfile); END_INTERFACE } IMbnConnectionProfileManagerEventsVtbl; interface IMbnConnectionProfileManagerEvents { CONST_VTBL struct IMbnConnectionProfileManagerEventsVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnConnectionProfileManagerEvents_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnConnectionProfileManagerEvents_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnConnectionProfileManagerEvents_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnConnectionProfileManagerEvents_OnConnectionProfileArrival(This,newConnectionProfile) \ ( (This)->lpVtbl -> OnConnectionProfileArrival(This,newConnectionProfile) ) #define IMbnConnectionProfileManagerEvents_OnConnectionProfileRemoval(This,oldConnectionProfile) \ ( (This)->lpVtbl -> OnConnectionProfileRemoval(This,oldConnectionProfile) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnConnectionProfileManagerEvents_INTERFACE_DEFINED__ */ #ifndef __IMbnRadio_INTERFACE_DEFINED__ #define __IMbnRadio_INTERFACE_DEFINED__ /* interface IMbnRadio */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnRadio; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCCCCAB6-201F-4BBB-AAEE-338E368AF6FA") IMbnRadio : public IUnknown { public: virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SoftwareRadioState( /* [retval][ref][out] */ __RPC__out MBN_RADIO *SoftwareRadioState) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_HardwareRadioState( /* [retval][ref][out] */ __RPC__out MBN_RADIO *HardwareRadioState) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetSoftwareRadioState( /* [annotation][in] */ _In_ MBN_RADIO radioState, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; }; #else /* C style interface */ typedef struct IMbnRadioVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnRadio * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnRadio * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnRadio * This); DECLSPEC_XFGVIRT(IMbnRadio, get_SoftwareRadioState) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_SoftwareRadioState )( __RPC__in IMbnRadio * This, /* [retval][ref][out] */ __RPC__out MBN_RADIO *SoftwareRadioState); DECLSPEC_XFGVIRT(IMbnRadio, get_HardwareRadioState) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_HardwareRadioState )( __RPC__in IMbnRadio * This, /* [retval][ref][out] */ __RPC__out MBN_RADIO *HardwareRadioState); DECLSPEC_XFGVIRT(IMbnRadio, SetSoftwareRadioState) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetSoftwareRadioState )( __RPC__in IMbnRadio * This, /* [annotation][in] */ _In_ MBN_RADIO radioState, /* [annotation][out] */ _Out_ ULONG *requestID); END_INTERFACE } IMbnRadioVtbl; interface IMbnRadio { CONST_VTBL struct IMbnRadioVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnRadio_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnRadio_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnRadio_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnRadio_get_SoftwareRadioState(This,SoftwareRadioState) \ ( (This)->lpVtbl -> get_SoftwareRadioState(This,SoftwareRadioState) ) #define IMbnRadio_get_HardwareRadioState(This,HardwareRadioState) \ ( (This)->lpVtbl -> get_HardwareRadioState(This,HardwareRadioState) ) #define IMbnRadio_SetSoftwareRadioState(This,radioState,requestID) \ ( (This)->lpVtbl -> SetSoftwareRadioState(This,radioState,requestID) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnRadio_INTERFACE_DEFINED__ */ #ifndef __IMbnRadioEvents_INTERFACE_DEFINED__ #define __IMbnRadioEvents_INTERFACE_DEFINED__ /* interface IMbnRadioEvents */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnRadioEvents; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCDDDAB6-201F-4BBB-AAEE-338E368AF6FA") IMbnRadioEvents : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnRadioStateChange( /* [annotation][in] */ _In_ IMbnRadio *newInterface) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnSetSoftwareRadioStateComplete( /* [annotation][in] */ _In_ IMbnRadio *newInterface, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status) = 0; }; #else /* C style interface */ typedef struct IMbnRadioEventsVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnRadioEvents * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnRadioEvents * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnRadioEvents * This); DECLSPEC_XFGVIRT(IMbnRadioEvents, OnRadioStateChange) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnRadioStateChange )( __RPC__in IMbnRadioEvents * This, /* [annotation][in] */ _In_ IMbnRadio *newInterface); DECLSPEC_XFGVIRT(IMbnRadioEvents, OnSetSoftwareRadioStateComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnSetSoftwareRadioStateComplete )( __RPC__in IMbnRadioEvents * This, /* [annotation][in] */ _In_ IMbnRadio *newInterface, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status); END_INTERFACE } IMbnRadioEventsVtbl; interface IMbnRadioEvents { CONST_VTBL struct IMbnRadioEventsVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnRadioEvents_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnRadioEvents_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnRadioEvents_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnRadioEvents_OnRadioStateChange(This,newInterface) \ ( (This)->lpVtbl -> OnRadioStateChange(This,newInterface) ) #define IMbnRadioEvents_OnSetSoftwareRadioStateComplete(This,newInterface,requestID,status) \ ( (This)->lpVtbl -> OnSetSoftwareRadioStateComplete(This,newInterface,requestID,status) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnRadioEvents_INTERFACE_DEFINED__ */ #ifndef __IMbnMultiCarrier_INTERFACE_DEFINED__ #define __IMbnMultiCarrier_INTERFACE_DEFINED__ /* interface IMbnMultiCarrier */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnMultiCarrier; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-2020-4BBB-AAEE-338E368AF6FA") IMbnMultiCarrier : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetHomeProvider( /* [annotation][in] */ _In_ MBN_PROVIDER2 *homeProvider, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetPreferredProviders( /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *preferredMulticarrierProviders) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetVisibleProviders( /* [annotation][out] */ _Out_ ULONG *age, /* [annotation][retval][out] */ _Out_retval_ SAFEARRAY * *visibleProviders) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetSupportedCellularClasses( /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *cellularClasses) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCurrentCellularClass( /* [retval][ref][out] */ __RPC__out MBN_CELLULAR_CLASS *currentCellularClass) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ScanNetwork( /* [annotation][out] */ _Out_ ULONG *requestID) = 0; }; #else /* C style interface */ typedef struct IMbnMultiCarrierVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnMultiCarrier * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnMultiCarrier * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnMultiCarrier * This); DECLSPEC_XFGVIRT(IMbnMultiCarrier, SetHomeProvider) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetHomeProvider )( __RPC__in IMbnMultiCarrier * This, /* [annotation][in] */ _In_ MBN_PROVIDER2 *homeProvider, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnMultiCarrier, GetPreferredProviders) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetPreferredProviders )( __RPC__in IMbnMultiCarrier * This, /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *preferredMulticarrierProviders); DECLSPEC_XFGVIRT(IMbnMultiCarrier, GetVisibleProviders) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetVisibleProviders )( __RPC__in IMbnMultiCarrier * This, /* [annotation][out] */ _Out_ ULONG *age, /* [annotation][retval][out] */ _Out_retval_ SAFEARRAY * *visibleProviders); DECLSPEC_XFGVIRT(IMbnMultiCarrier, GetSupportedCellularClasses) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetSupportedCellularClasses )( __RPC__in IMbnMultiCarrier * This, /* [retval][ref][out] */ __RPC__deref_out_opt SAFEARRAY * *cellularClasses); DECLSPEC_XFGVIRT(IMbnMultiCarrier, GetCurrentCellularClass) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetCurrentCellularClass )( __RPC__in IMbnMultiCarrier * This, /* [retval][ref][out] */ __RPC__out MBN_CELLULAR_CLASS *currentCellularClass); DECLSPEC_XFGVIRT(IMbnMultiCarrier, ScanNetwork) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *ScanNetwork )( __RPC__in IMbnMultiCarrier * This, /* [annotation][out] */ _Out_ ULONG *requestID); END_INTERFACE } IMbnMultiCarrierVtbl; interface IMbnMultiCarrier { CONST_VTBL struct IMbnMultiCarrierVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnMultiCarrier_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnMultiCarrier_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnMultiCarrier_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnMultiCarrier_SetHomeProvider(This,homeProvider,requestID) \ ( (This)->lpVtbl -> SetHomeProvider(This,homeProvider,requestID) ) #define IMbnMultiCarrier_GetPreferredProviders(This,preferredMulticarrierProviders) \ ( (This)->lpVtbl -> GetPreferredProviders(This,preferredMulticarrierProviders) ) #define IMbnMultiCarrier_GetVisibleProviders(This,age,visibleProviders) \ ( (This)->lpVtbl -> GetVisibleProviders(This,age,visibleProviders) ) #define IMbnMultiCarrier_GetSupportedCellularClasses(This,cellularClasses) \ ( (This)->lpVtbl -> GetSupportedCellularClasses(This,cellularClasses) ) #define IMbnMultiCarrier_GetCurrentCellularClass(This,currentCellularClass) \ ( (This)->lpVtbl -> GetCurrentCellularClass(This,currentCellularClass) ) #define IMbnMultiCarrier_ScanNetwork(This,requestID) \ ( (This)->lpVtbl -> ScanNetwork(This,requestID) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnMultiCarrier_INTERFACE_DEFINED__ */ #ifndef __IMbnMultiCarrierEvents_INTERFACE_DEFINED__ #define __IMbnMultiCarrierEvents_INTERFACE_DEFINED__ /* interface IMbnMultiCarrierEvents */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnMultiCarrierEvents; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCDDDAB6-2021-4BBB-AAEE-338E368AF6FA") IMbnMultiCarrierEvents : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnSetHomeProviderComplete( /* [annotation][in] */ _In_ IMbnMultiCarrier *mbnInterface, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnCurrentCellularClassChange( /* [annotation][in] */ _In_ IMbnMultiCarrier *mbnInterface) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnPreferredProvidersChange( /* [annotation][in] */ _In_ IMbnMultiCarrier *mbnInterface) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnScanNetworkComplete( /* [annotation][in] */ _In_ IMbnMultiCarrier *mbnInterface, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnInterfaceCapabilityChange( /* [annotation][in] */ _In_ IMbnMultiCarrier *mbnInterface) = 0; }; #else /* C style interface */ typedef struct IMbnMultiCarrierEventsVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnMultiCarrierEvents * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnMultiCarrierEvents * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnMultiCarrierEvents * This); DECLSPEC_XFGVIRT(IMbnMultiCarrierEvents, OnSetHomeProviderComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnSetHomeProviderComplete )( __RPC__in IMbnMultiCarrierEvents * This, /* [annotation][in] */ _In_ IMbnMultiCarrier *mbnInterface, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status); DECLSPEC_XFGVIRT(IMbnMultiCarrierEvents, OnCurrentCellularClassChange) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnCurrentCellularClassChange )( __RPC__in IMbnMultiCarrierEvents * This, /* [annotation][in] */ _In_ IMbnMultiCarrier *mbnInterface); DECLSPEC_XFGVIRT(IMbnMultiCarrierEvents, OnPreferredProvidersChange) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnPreferredProvidersChange )( __RPC__in IMbnMultiCarrierEvents * This, /* [annotation][in] */ _In_ IMbnMultiCarrier *mbnInterface); DECLSPEC_XFGVIRT(IMbnMultiCarrierEvents, OnScanNetworkComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnScanNetworkComplete )( __RPC__in IMbnMultiCarrierEvents * This, /* [annotation][in] */ _In_ IMbnMultiCarrier *mbnInterface, /* [annotation][in] */ _In_ ULONG requestID, /* [annotation][in] */ _In_ HRESULT status); DECLSPEC_XFGVIRT(IMbnMultiCarrierEvents, OnInterfaceCapabilityChange) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnInterfaceCapabilityChange )( __RPC__in IMbnMultiCarrierEvents * This, /* [annotation][in] */ _In_ IMbnMultiCarrier *mbnInterface); END_INTERFACE } IMbnMultiCarrierEventsVtbl; interface IMbnMultiCarrierEvents { CONST_VTBL struct IMbnMultiCarrierEventsVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnMultiCarrierEvents_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnMultiCarrierEvents_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnMultiCarrierEvents_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnMultiCarrierEvents_OnSetHomeProviderComplete(This,mbnInterface,requestID,status) \ ( (This)->lpVtbl -> OnSetHomeProviderComplete(This,mbnInterface,requestID,status) ) #define IMbnMultiCarrierEvents_OnCurrentCellularClassChange(This,mbnInterface) \ ( (This)->lpVtbl -> OnCurrentCellularClassChange(This,mbnInterface) ) #define IMbnMultiCarrierEvents_OnPreferredProvidersChange(This,mbnInterface) \ ( (This)->lpVtbl -> OnPreferredProvidersChange(This,mbnInterface) ) #define IMbnMultiCarrierEvents_OnScanNetworkComplete(This,mbnInterface,requestID,status) \ ( (This)->lpVtbl -> OnScanNetworkComplete(This,mbnInterface,requestID,status) ) #define IMbnMultiCarrierEvents_OnInterfaceCapabilityChange(This,mbnInterface) \ ( (This)->lpVtbl -> OnInterfaceCapabilityChange(This,mbnInterface) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnMultiCarrierEvents_INTERFACE_DEFINED__ */ #ifndef __IMbnDeviceServiceStateEvents_INTERFACE_DEFINED__ #define __IMbnDeviceServiceStateEvents_INTERFACE_DEFINED__ /* interface IMbnDeviceServiceStateEvents */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnDeviceServiceStateEvents; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("5D3FF196-89EE-49D8-8B60-33FFDDFFC58D") IMbnDeviceServiceStateEvents : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnSessionsStateChange( /* [annotation][in] */ _In_ BSTR interfaceID, /* [annotation][in] */ _In_ MBN_DEVICE_SERVICE_SESSIONS_STATE stateChange) = 0; }; #else /* C style interface */ typedef struct IMbnDeviceServiceStateEventsVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnDeviceServiceStateEvents * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnDeviceServiceStateEvents * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnDeviceServiceStateEvents * This); DECLSPEC_XFGVIRT(IMbnDeviceServiceStateEvents, OnSessionsStateChange) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnSessionsStateChange )( __RPC__in IMbnDeviceServiceStateEvents * This, /* [annotation][in] */ _In_ BSTR interfaceID, /* [annotation][in] */ _In_ MBN_DEVICE_SERVICE_SESSIONS_STATE stateChange); END_INTERFACE } IMbnDeviceServiceStateEventsVtbl; interface IMbnDeviceServiceStateEvents { CONST_VTBL struct IMbnDeviceServiceStateEventsVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnDeviceServiceStateEvents_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnDeviceServiceStateEvents_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnDeviceServiceStateEvents_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnDeviceServiceStateEvents_OnSessionsStateChange(This,interfaceID,stateChange) \ ( (This)->lpVtbl -> OnSessionsStateChange(This,interfaceID,stateChange) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnDeviceServiceStateEvents_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_mbnapi_0000_0037 */ /* [local] */ #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ #pragma endregion #pragma region Application Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) extern RPC_IF_HANDLE __MIDL_itf_mbnapi_0000_0037_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_mbnapi_0000_0037_v0_0_s_ifspec; #ifndef __IMbnDeviceServicesManager_INTERFACE_DEFINED__ #define __IMbnDeviceServicesManager_INTERFACE_DEFINED__ /* interface IMbnDeviceServicesManager */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnDeviceServicesManager; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("20A26258-6811-4478-AC1D-13324E45E41C") IMbnDeviceServicesManager : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetDeviceServicesContext( /* [annotation][in] */ _In_ BSTR networkInterfaceID, /* [retval][ref][out] */ __RPC__deref_out_opt IMbnDeviceServicesContext **mbnDevicesContext) = 0; }; #else /* C style interface */ typedef struct IMbnDeviceServicesManagerVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnDeviceServicesManager * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnDeviceServicesManager * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnDeviceServicesManager * This); DECLSPEC_XFGVIRT(IMbnDeviceServicesManager, GetDeviceServicesContext) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetDeviceServicesContext )( __RPC__in IMbnDeviceServicesManager * This, /* [annotation][in] */ _In_ BSTR networkInterfaceID, /* [retval][ref][out] */ __RPC__deref_out_opt IMbnDeviceServicesContext **mbnDevicesContext); END_INTERFACE } IMbnDeviceServicesManagerVtbl; interface IMbnDeviceServicesManager { CONST_VTBL struct IMbnDeviceServicesManagerVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnDeviceServicesManager_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnDeviceServicesManager_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnDeviceServicesManager_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnDeviceServicesManager_GetDeviceServicesContext(This,networkInterfaceID,mbnDevicesContext) \ ( (This)->lpVtbl -> GetDeviceServicesContext(This,networkInterfaceID,mbnDevicesContext) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnDeviceServicesManager_INTERFACE_DEFINED__ */ #ifndef __IMbnDeviceServicesContext_INTERFACE_DEFINED__ #define __IMbnDeviceServicesContext_INTERFACE_DEFINED__ /* interface IMbnDeviceServicesContext */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnDeviceServicesContext; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("FC5AC347-1592-4068-80BB-6A57580150D8") IMbnDeviceServicesContext : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE EnumerateDeviceServices( /* [annotation][retval][out] */ _Out_retval_ SAFEARRAY * *deviceServices) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetDeviceService( /* [annotation][in] */ _In_ BSTR deviceServiceID, /* [retval][ref][out] */ __RPC__deref_out_opt IMbnDeviceService **mbnDeviceService) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_MaxCommandSize( /* [retval][ref][out] */ __RPC__out ULONG *maxCommandSize) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_MaxDataSize( /* [retval][ref][out] */ __RPC__out ULONG *maxDataSize) = 0; }; #else /* C style interface */ typedef struct IMbnDeviceServicesContextVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnDeviceServicesContext * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnDeviceServicesContext * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnDeviceServicesContext * This); DECLSPEC_XFGVIRT(IMbnDeviceServicesContext, EnumerateDeviceServices) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *EnumerateDeviceServices )( __RPC__in IMbnDeviceServicesContext * This, /* [annotation][retval][out] */ _Out_retval_ SAFEARRAY * *deviceServices); DECLSPEC_XFGVIRT(IMbnDeviceServicesContext, GetDeviceService) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetDeviceService )( __RPC__in IMbnDeviceServicesContext * This, /* [annotation][in] */ _In_ BSTR deviceServiceID, /* [retval][ref][out] */ __RPC__deref_out_opt IMbnDeviceService **mbnDeviceService); DECLSPEC_XFGVIRT(IMbnDeviceServicesContext, get_MaxCommandSize) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_MaxCommandSize )( __RPC__in IMbnDeviceServicesContext * This, /* [retval][ref][out] */ __RPC__out ULONG *maxCommandSize); DECLSPEC_XFGVIRT(IMbnDeviceServicesContext, get_MaxDataSize) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_MaxDataSize )( __RPC__in IMbnDeviceServicesContext * This, /* [retval][ref][out] */ __RPC__out ULONG *maxDataSize); END_INTERFACE } IMbnDeviceServicesContextVtbl; interface IMbnDeviceServicesContext { CONST_VTBL struct IMbnDeviceServicesContextVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnDeviceServicesContext_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnDeviceServicesContext_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnDeviceServicesContext_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnDeviceServicesContext_EnumerateDeviceServices(This,deviceServices) \ ( (This)->lpVtbl -> EnumerateDeviceServices(This,deviceServices) ) #define IMbnDeviceServicesContext_GetDeviceService(This,deviceServiceID,mbnDeviceService) \ ( (This)->lpVtbl -> GetDeviceService(This,deviceServiceID,mbnDeviceService) ) #define IMbnDeviceServicesContext_get_MaxCommandSize(This,maxCommandSize) \ ( (This)->lpVtbl -> get_MaxCommandSize(This,maxCommandSize) ) #define IMbnDeviceServicesContext_get_MaxDataSize(This,maxDataSize) \ ( (This)->lpVtbl -> get_MaxDataSize(This,maxDataSize) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnDeviceServicesContext_INTERFACE_DEFINED__ */ #ifndef __IMbnDeviceServicesEvents_INTERFACE_DEFINED__ #define __IMbnDeviceServicesEvents_INTERFACE_DEFINED__ /* interface IMbnDeviceServicesEvents */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnDeviceServicesEvents; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("0A900C19-6824-4E97-B76E-CF239D0CA642") IMbnDeviceServicesEvents : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnQuerySupportedCommandsComplete( /* [annotation][in] */ _In_ IMbnDeviceService *deviceService, /* [annotation][in] */ _In_ SAFEARRAY * commandIDList, /* [annotation][in] */ _In_ HRESULT status, /* [annotation][in] */ _In_ ULONG requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnOpenCommandSessionComplete( /* [annotation][in] */ _In_ IMbnDeviceService *deviceService, /* [annotation][in] */ _In_ HRESULT status, /* [annotation][in] */ _In_ ULONG requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnCloseCommandSessionComplete( /* [annotation][in] */ _In_ IMbnDeviceService *deviceService, /* [annotation][in] */ _In_ HRESULT status, /* [annotation][in] */ _In_ ULONG requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnSetCommandComplete( /* [annotation][in] */ _In_ IMbnDeviceService *deviceService, /* [annotation][in] */ _In_ ULONG responseID, /* [annotation][in] */ _In_ SAFEARRAY * deviceServiceData, /* [annotation][in] */ _In_ HRESULT status, /* [annotation][in] */ _In_ ULONG requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnQueryCommandComplete( /* [annotation][in] */ _In_ IMbnDeviceService *deviceService, /* [annotation][in] */ _In_ ULONG responseID, /* [annotation][in] */ _In_ SAFEARRAY * deviceServiceData, /* [annotation][in] */ _In_ HRESULT status, /* [annotation][in] */ _In_ ULONG requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnEventNotification( /* [annotation][in] */ _In_ IMbnDeviceService *deviceService, /* [annotation][in] */ _In_ ULONG eventID, /* [annotation][in] */ _In_ SAFEARRAY * deviceServiceData) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnOpenDataSessionComplete( /* [annotation][in] */ _In_ IMbnDeviceService *deviceService, /* [annotation][in] */ _In_ HRESULT status, /* [annotation][in] */ _In_ ULONG requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnCloseDataSessionComplete( /* [annotation][in] */ _In_ IMbnDeviceService *deviceService, /* [annotation][in] */ _In_ HRESULT status, /* [annotation][in] */ _In_ ULONG requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnWriteDataComplete( /* [annotation][in] */ _In_ IMbnDeviceService *deviceService, /* [annotation][in] */ _In_ HRESULT status, /* [annotation][in] */ _In_ ULONG requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnReadData( /* [annotation][in] */ _In_ IMbnDeviceService *deviceService, /* [annotation][in] */ _In_ SAFEARRAY * deviceServiceData) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnInterfaceStateChange( /* [annotation][in] */ _In_ BSTR interfaceID, /* [annotation][in] */ _In_ MBN_DEVICE_SERVICES_INTERFACE_STATE stateChange) = 0; }; #else /* C style interface */ typedef struct IMbnDeviceServicesEventsVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnDeviceServicesEvents * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnDeviceServicesEvents * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnDeviceServicesEvents * This); DECLSPEC_XFGVIRT(IMbnDeviceServicesEvents, OnQuerySupportedCommandsComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnQuerySupportedCommandsComplete )( __RPC__in IMbnDeviceServicesEvents * This, /* [annotation][in] */ _In_ IMbnDeviceService *deviceService, /* [annotation][in] */ _In_ SAFEARRAY * commandIDList, /* [annotation][in] */ _In_ HRESULT status, /* [annotation][in] */ _In_ ULONG requestID); DECLSPEC_XFGVIRT(IMbnDeviceServicesEvents, OnOpenCommandSessionComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnOpenCommandSessionComplete )( __RPC__in IMbnDeviceServicesEvents * This, /* [annotation][in] */ _In_ IMbnDeviceService *deviceService, /* [annotation][in] */ _In_ HRESULT status, /* [annotation][in] */ _In_ ULONG requestID); DECLSPEC_XFGVIRT(IMbnDeviceServicesEvents, OnCloseCommandSessionComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnCloseCommandSessionComplete )( __RPC__in IMbnDeviceServicesEvents * This, /* [annotation][in] */ _In_ IMbnDeviceService *deviceService, /* [annotation][in] */ _In_ HRESULT status, /* [annotation][in] */ _In_ ULONG requestID); DECLSPEC_XFGVIRT(IMbnDeviceServicesEvents, OnSetCommandComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnSetCommandComplete )( __RPC__in IMbnDeviceServicesEvents * This, /* [annotation][in] */ _In_ IMbnDeviceService *deviceService, /* [annotation][in] */ _In_ ULONG responseID, /* [annotation][in] */ _In_ SAFEARRAY * deviceServiceData, /* [annotation][in] */ _In_ HRESULT status, /* [annotation][in] */ _In_ ULONG requestID); DECLSPEC_XFGVIRT(IMbnDeviceServicesEvents, OnQueryCommandComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnQueryCommandComplete )( __RPC__in IMbnDeviceServicesEvents * This, /* [annotation][in] */ _In_ IMbnDeviceService *deviceService, /* [annotation][in] */ _In_ ULONG responseID, /* [annotation][in] */ _In_ SAFEARRAY * deviceServiceData, /* [annotation][in] */ _In_ HRESULT status, /* [annotation][in] */ _In_ ULONG requestID); DECLSPEC_XFGVIRT(IMbnDeviceServicesEvents, OnEventNotification) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnEventNotification )( __RPC__in IMbnDeviceServicesEvents * This, /* [annotation][in] */ _In_ IMbnDeviceService *deviceService, /* [annotation][in] */ _In_ ULONG eventID, /* [annotation][in] */ _In_ SAFEARRAY * deviceServiceData); DECLSPEC_XFGVIRT(IMbnDeviceServicesEvents, OnOpenDataSessionComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnOpenDataSessionComplete )( __RPC__in IMbnDeviceServicesEvents * This, /* [annotation][in] */ _In_ IMbnDeviceService *deviceService, /* [annotation][in] */ _In_ HRESULT status, /* [annotation][in] */ _In_ ULONG requestID); DECLSPEC_XFGVIRT(IMbnDeviceServicesEvents, OnCloseDataSessionComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnCloseDataSessionComplete )( __RPC__in IMbnDeviceServicesEvents * This, /* [annotation][in] */ _In_ IMbnDeviceService *deviceService, /* [annotation][in] */ _In_ HRESULT status, /* [annotation][in] */ _In_ ULONG requestID); DECLSPEC_XFGVIRT(IMbnDeviceServicesEvents, OnWriteDataComplete) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnWriteDataComplete )( __RPC__in IMbnDeviceServicesEvents * This, /* [annotation][in] */ _In_ IMbnDeviceService *deviceService, /* [annotation][in] */ _In_ HRESULT status, /* [annotation][in] */ _In_ ULONG requestID); DECLSPEC_XFGVIRT(IMbnDeviceServicesEvents, OnReadData) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnReadData )( __RPC__in IMbnDeviceServicesEvents * This, /* [annotation][in] */ _In_ IMbnDeviceService *deviceService, /* [annotation][in] */ _In_ SAFEARRAY * deviceServiceData); DECLSPEC_XFGVIRT(IMbnDeviceServicesEvents, OnInterfaceStateChange) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OnInterfaceStateChange )( __RPC__in IMbnDeviceServicesEvents * This, /* [annotation][in] */ _In_ BSTR interfaceID, /* [annotation][in] */ _In_ MBN_DEVICE_SERVICES_INTERFACE_STATE stateChange); END_INTERFACE } IMbnDeviceServicesEventsVtbl; interface IMbnDeviceServicesEvents { CONST_VTBL struct IMbnDeviceServicesEventsVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnDeviceServicesEvents_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnDeviceServicesEvents_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnDeviceServicesEvents_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnDeviceServicesEvents_OnQuerySupportedCommandsComplete(This,deviceService,commandIDList,status,requestID) \ ( (This)->lpVtbl -> OnQuerySupportedCommandsComplete(This,deviceService,commandIDList,status,requestID) ) #define IMbnDeviceServicesEvents_OnOpenCommandSessionComplete(This,deviceService,status,requestID) \ ( (This)->lpVtbl -> OnOpenCommandSessionComplete(This,deviceService,status,requestID) ) #define IMbnDeviceServicesEvents_OnCloseCommandSessionComplete(This,deviceService,status,requestID) \ ( (This)->lpVtbl -> OnCloseCommandSessionComplete(This,deviceService,status,requestID) ) #define IMbnDeviceServicesEvents_OnSetCommandComplete(This,deviceService,responseID,deviceServiceData,status,requestID) \ ( (This)->lpVtbl -> OnSetCommandComplete(This,deviceService,responseID,deviceServiceData,status,requestID) ) #define IMbnDeviceServicesEvents_OnQueryCommandComplete(This,deviceService,responseID,deviceServiceData,status,requestID) \ ( (This)->lpVtbl -> OnQueryCommandComplete(This,deviceService,responseID,deviceServiceData,status,requestID) ) #define IMbnDeviceServicesEvents_OnEventNotification(This,deviceService,eventID,deviceServiceData) \ ( (This)->lpVtbl -> OnEventNotification(This,deviceService,eventID,deviceServiceData) ) #define IMbnDeviceServicesEvents_OnOpenDataSessionComplete(This,deviceService,status,requestID) \ ( (This)->lpVtbl -> OnOpenDataSessionComplete(This,deviceService,status,requestID) ) #define IMbnDeviceServicesEvents_OnCloseDataSessionComplete(This,deviceService,status,requestID) \ ( (This)->lpVtbl -> OnCloseDataSessionComplete(This,deviceService,status,requestID) ) #define IMbnDeviceServicesEvents_OnWriteDataComplete(This,deviceService,status,requestID) \ ( (This)->lpVtbl -> OnWriteDataComplete(This,deviceService,status,requestID) ) #define IMbnDeviceServicesEvents_OnReadData(This,deviceService,deviceServiceData) \ ( (This)->lpVtbl -> OnReadData(This,deviceService,deviceServiceData) ) #define IMbnDeviceServicesEvents_OnInterfaceStateChange(This,interfaceID,stateChange) \ ( (This)->lpVtbl -> OnInterfaceStateChange(This,interfaceID,stateChange) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnDeviceServicesEvents_INTERFACE_DEFINED__ */ #ifndef __IMbnDeviceService_INTERFACE_DEFINED__ #define __IMbnDeviceService_INTERFACE_DEFINED__ /* interface IMbnDeviceService */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnDeviceService; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("B3BB9A71-DC70-4BE9-A4DA-7886AE8B191B") IMbnDeviceService : public IUnknown { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE QuerySupportedCommands( /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OpenCommandSession( /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE CloseCommandSession( /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetCommand( /* [annotation][in] */ _In_ ULONG commandID, /* [ref][in] */ __RPC__in SAFEARRAY * deviceServiceData, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE QueryCommand( /* [annotation][in] */ _In_ ULONG commandID, /* [ref][in] */ __RPC__in SAFEARRAY * deviceServiceData, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OpenDataSession( /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE CloseDataSession( /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE WriteData( /* [annotation][in] */ _In_ SAFEARRAY * deviceServiceData, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_InterfaceID( /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *InterfaceID) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_DeviceServiceID( /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *DeviceServiceID) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_IsCommandSessionOpen( /* [retval][ref][out] */ __RPC__out BOOL *value) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_IsDataSessionOpen( /* [retval][ref][out] */ __RPC__out BOOL *value) = 0; }; #else /* C style interface */ typedef struct IMbnDeviceServiceVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnDeviceService * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnDeviceService * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnDeviceService * This); DECLSPEC_XFGVIRT(IMbnDeviceService, QuerySupportedCommands) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *QuerySupportedCommands )( __RPC__in IMbnDeviceService * This, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnDeviceService, OpenCommandSession) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OpenCommandSession )( __RPC__in IMbnDeviceService * This, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnDeviceService, CloseCommandSession) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *CloseCommandSession )( __RPC__in IMbnDeviceService * This, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnDeviceService, SetCommand) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *SetCommand )( __RPC__in IMbnDeviceService * This, /* [annotation][in] */ _In_ ULONG commandID, /* [ref][in] */ __RPC__in SAFEARRAY * deviceServiceData, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnDeviceService, QueryCommand) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *QueryCommand )( __RPC__in IMbnDeviceService * This, /* [annotation][in] */ _In_ ULONG commandID, /* [ref][in] */ __RPC__in SAFEARRAY * deviceServiceData, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnDeviceService, OpenDataSession) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *OpenDataSession )( __RPC__in IMbnDeviceService * This, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnDeviceService, CloseDataSession) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *CloseDataSession )( __RPC__in IMbnDeviceService * This, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnDeviceService, WriteData) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *WriteData )( __RPC__in IMbnDeviceService * This, /* [annotation][in] */ _In_ SAFEARRAY * deviceServiceData, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnDeviceService, get_InterfaceID) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_InterfaceID )( __RPC__in IMbnDeviceService * This, /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *InterfaceID); DECLSPEC_XFGVIRT(IMbnDeviceService, get_DeviceServiceID) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_DeviceServiceID )( __RPC__in IMbnDeviceService * This, /* [retval][ref][out] */ __RPC__deref_out_opt BSTR *DeviceServiceID); DECLSPEC_XFGVIRT(IMbnDeviceService, get_IsCommandSessionOpen) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsCommandSessionOpen )( __RPC__in IMbnDeviceService * This, /* [retval][ref][out] */ __RPC__out BOOL *value); DECLSPEC_XFGVIRT(IMbnDeviceService, get_IsDataSessionOpen) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsDataSessionOpen )( __RPC__in IMbnDeviceService * This, /* [retval][ref][out] */ __RPC__out BOOL *value); END_INTERFACE } IMbnDeviceServiceVtbl; interface IMbnDeviceService { CONST_VTBL struct IMbnDeviceServiceVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnDeviceService_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnDeviceService_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnDeviceService_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnDeviceService_QuerySupportedCommands(This,requestID) \ ( (This)->lpVtbl -> QuerySupportedCommands(This,requestID) ) #define IMbnDeviceService_OpenCommandSession(This,requestID) \ ( (This)->lpVtbl -> OpenCommandSession(This,requestID) ) #define IMbnDeviceService_CloseCommandSession(This,requestID) \ ( (This)->lpVtbl -> CloseCommandSession(This,requestID) ) #define IMbnDeviceService_SetCommand(This,commandID,deviceServiceData,requestID) \ ( (This)->lpVtbl -> SetCommand(This,commandID,deviceServiceData,requestID) ) #define IMbnDeviceService_QueryCommand(This,commandID,deviceServiceData,requestID) \ ( (This)->lpVtbl -> QueryCommand(This,commandID,deviceServiceData,requestID) ) #define IMbnDeviceService_OpenDataSession(This,requestID) \ ( (This)->lpVtbl -> OpenDataSession(This,requestID) ) #define IMbnDeviceService_CloseDataSession(This,requestID) \ ( (This)->lpVtbl -> CloseDataSession(This,requestID) ) #define IMbnDeviceService_WriteData(This,deviceServiceData,requestID) \ ( (This)->lpVtbl -> WriteData(This,deviceServiceData,requestID) ) #define IMbnDeviceService_get_InterfaceID(This,InterfaceID) \ ( (This)->lpVtbl -> get_InterfaceID(This,InterfaceID) ) #define IMbnDeviceService_get_DeviceServiceID(This,DeviceServiceID) \ ( (This)->lpVtbl -> get_DeviceServiceID(This,DeviceServiceID) ) #define IMbnDeviceService_get_IsCommandSessionOpen(This,value) \ ( (This)->lpVtbl -> get_IsCommandSessionOpen(This,value) ) #define IMbnDeviceService_get_IsDataSessionOpen(This,value) \ ( (This)->lpVtbl -> get_IsDataSessionOpen(This,value) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnDeviceService_INTERFACE_DEFINED__ */ /* interface __MIDL_itf_mbnapi_0000_0041 */ /* [local] */ #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */ #pragma endregion extern RPC_IF_HANDLE __MIDL_itf_mbnapi_0000_0041_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_mbnapi_0000_0041_v0_0_s_ifspec; #ifndef __MbnApi_LIBRARY_DEFINED__ #define __MbnApi_LIBRARY_DEFINED__ /* library MbnApi */ /* [helpstring][version][uuid] */ #pragma region Desktop Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) typedef /* [hidden] */ struct __mbnapi_ReferenceRemainingTypes__ { MBN_BAND_CLASS bandClass; MBN_CONTEXT_CONSTANTS contextConstants; MBN_CTRL_CAPS ctrlCaps; MBN_DATA_CLASS dataClass; MBN_INTERFACE_CAPS_CONSTANTS interfaceCapsConstants; MBN_PIN_CONSTANTS pinConstants; MBN_PROVIDER_CONSTANTS providerConstants; MBN_PROVIDER_STATE providerState; MBN_REGISTRATION_CONSTANTS registrationConstants; MBN_SIGNAL_CONSTANTS signalConstants; MBN_SMS_CAPS smsCaps; enum MBN_SMS_CONSTANTS smsConstants; WWAEXT_SMS_CONSTANTS wwaextSmsConstants; MBN_SMS_STATUS_FLAG smsStatusFlag; } __mbnapi_ReferenceRemainingTypes__; typedef /* [hidden] */ struct __DummyPinType__ { ULONG pinType; } __DummyPinType__; #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ #pragma endregion #pragma region Application Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */ #pragma endregion #pragma region Desktop Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */ #pragma endregion #pragma region Application Family #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) #endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */ #pragma endregion EXTERN_C const IID LIBID_MbnApi; #ifndef __IMbnPin_INTERFACE_DEFINED__ #define __IMbnPin_INTERFACE_DEFINED__ /* interface IMbnPin */ /* [helpstring][uuid][oleautomation][nonextensible][object] */ EXTERN_C const IID IID_IMbnPin; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("DCBBBAB6-2007-4BBB-AAEE-338E368AF6FA") IMbnPin : public IUnknown { public: virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_PinType( /* [retval][ref][out] */ __RPC__out MBN_PIN_TYPE *PinType) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_PinFormat( /* [retval][ref][out] */ __RPC__out MBN_PIN_FORMAT *PinFormat) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_PinLengthMin( /* [retval][ref][out] */ __RPC__out ULONG *PinLengthMin) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_PinLengthMax( /* [retval][ref][out] */ __RPC__out ULONG *PinLengthMax) = 0; virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_PinMode( /* [retval][ref][out] */ __RPC__out MBN_PIN_MODE *PinMode) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Enable( /* [string][ref][in] */ __RPC__in_string LPCWSTR pin, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Disable( /* [string][ref][in] */ __RPC__in_string LPCWSTR pin, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Enter( /* [string][ref][in] */ __RPC__in_string LPCWSTR pin, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Change( /* [string][ref][in] */ __RPC__in_string LPCWSTR pin, /* [string][ref][in] */ __RPC__in_string LPCWSTR newPin, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Unblock( /* [string][ref][in] */ __RPC__in_string LPCWSTR puk, /* [string][ref][in] */ __RPC__in_string LPCWSTR newPin, /* [annotation][out] */ _Out_ ULONG *requestID) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetPinManager( /* [retval][ref][out] */ __RPC__deref_out_opt IMbnPinManager **pinManager) = 0; }; #else /* C style interface */ typedef struct IMbnPinVtbl { BEGIN_INTERFACE DECLSPEC_XFGVIRT(IUnknown, QueryInterface) HRESULT ( STDMETHODCALLTYPE *QueryInterface )( __RPC__in IMbnPin * This, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); DECLSPEC_XFGVIRT(IUnknown, AddRef) ULONG ( STDMETHODCALLTYPE *AddRef )( __RPC__in IMbnPin * This); DECLSPEC_XFGVIRT(IUnknown, Release) ULONG ( STDMETHODCALLTYPE *Release )( __RPC__in IMbnPin * This); DECLSPEC_XFGVIRT(IMbnPin, get_PinType) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_PinType )( __RPC__in IMbnPin * This, /* [retval][ref][out] */ __RPC__out MBN_PIN_TYPE *PinType); DECLSPEC_XFGVIRT(IMbnPin, get_PinFormat) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_PinFormat )( __RPC__in IMbnPin * This, /* [retval][ref][out] */ __RPC__out MBN_PIN_FORMAT *PinFormat); DECLSPEC_XFGVIRT(IMbnPin, get_PinLengthMin) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_PinLengthMin )( __RPC__in IMbnPin * This, /* [retval][ref][out] */ __RPC__out ULONG *PinLengthMin); DECLSPEC_XFGVIRT(IMbnPin, get_PinLengthMax) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_PinLengthMax )( __RPC__in IMbnPin * This, /* [retval][ref][out] */ __RPC__out ULONG *PinLengthMax); DECLSPEC_XFGVIRT(IMbnPin, get_PinMode) /* [helpstring][id][propget] */ HRESULT ( STDMETHODCALLTYPE *get_PinMode )( __RPC__in IMbnPin * This, /* [retval][ref][out] */ __RPC__out MBN_PIN_MODE *PinMode); DECLSPEC_XFGVIRT(IMbnPin, Enable) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Enable )( __RPC__in IMbnPin * This, /* [string][ref][in] */ __RPC__in_string LPCWSTR pin, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnPin, Disable) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Disable )( __RPC__in IMbnPin * This, /* [string][ref][in] */ __RPC__in_string LPCWSTR pin, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnPin, Enter) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Enter )( __RPC__in IMbnPin * This, /* [string][ref][in] */ __RPC__in_string LPCWSTR pin, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnPin, Change) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Change )( __RPC__in IMbnPin * This, /* [string][ref][in] */ __RPC__in_string LPCWSTR pin, /* [string][ref][in] */ __RPC__in_string LPCWSTR newPin, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnPin, Unblock) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Unblock )( __RPC__in IMbnPin * This, /* [string][ref][in] */ __RPC__in_string LPCWSTR puk, /* [string][ref][in] */ __RPC__in_string LPCWSTR newPin, /* [annotation][out] */ _Out_ ULONG *requestID); DECLSPEC_XFGVIRT(IMbnPin, GetPinManager) /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *GetPinManager )( __RPC__in IMbnPin * This, /* [retval][ref][out] */ __RPC__deref_out_opt IMbnPinManager **pinManager); END_INTERFACE } IMbnPinVtbl; interface IMbnPin { CONST_VTBL struct IMbnPinVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMbnPin_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMbnPin_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMbnPin_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMbnPin_get_PinType(This,PinType) \ ( (This)->lpVtbl -> get_PinType(This,PinType) ) #define IMbnPin_get_PinFormat(This,PinFormat) \ ( (This)->lpVtbl -> get_PinFormat(This,PinFormat) ) #define IMbnPin_get_PinLengthMin(This,PinLengthMin) \ ( (This)->lpVtbl -> get_PinLengthMin(This,PinLengthMin) ) #define IMbnPin_get_PinLengthMax(This,PinLengthMax) \ ( (This)->lpVtbl -> get_PinLengthMax(This,PinLengthMax) ) #define IMbnPin_get_PinMode(This,PinMode) \ ( (This)->lpVtbl -> get_PinMode(This,PinMode) ) #define IMbnPin_Enable(This,pin,requestID) \ ( (This)->lpVtbl -> Enable(This,pin,requestID) ) #define IMbnPin_Disable(This,pin,requestID) \ ( (This)->lpVtbl -> Disable(This,pin,requestID) ) #define IMbnPin_Enter(This,pin,requestID) \ ( (This)->lpVtbl -> Enter(This,pin,requestID) ) #define IMbnPin_Change(This,pin,newPin,requestID) \ ( (This)->lpVtbl -> Change(This,pin,newPin,requestID) ) #define IMbnPin_Unblock(This,puk,newPin,requestID) \ ( (This)->lpVtbl -> Unblock(This,puk,newPin,requestID) ) #define IMbnPin_GetPinManager(This,pinManager) \ ( (This)->lpVtbl -> GetPinManager(This,pinManager) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMbnPin_INTERFACE_DEFINED__ */ EXTERN_C const CLSID CLSID_MbnConnectionProfileManager; #ifdef __cplusplus class DECLSPEC_UUID("BDFEE05A-4418-11DD-90ED-001C257CCFF1") MbnConnectionProfileManager; #endif EXTERN_C const CLSID CLSID_MbnInterfaceManager; #ifdef __cplusplus class DECLSPEC_UUID("BDFEE05B-4418-11DD-90ED-001C257CCFF1") MbnInterfaceManager; #endif EXTERN_C const CLSID CLSID_MbnConnectionManager; #ifdef __cplusplus class DECLSPEC_UUID("BDFEE05C-4418-11DD-90ED-001C257CCFF1") MbnConnectionManager; #endif EXTERN_C const CLSID CLSID_MbnDeviceServicesManager; #ifdef __cplusplus class DECLSPEC_UUID("2269DAA3-2A9F-4165-A501-CE00A6F7A75B") MbnDeviceServicesManager; #endif #endif /* __MbnApi_LIBRARY_DEFINED__ */ /* Additional Prototypes for ALL interfaces */ unsigned long __RPC_USER BSTR_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * ); unsigned char * __RPC_USER BSTR_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * ); unsigned char * __RPC_USER BSTR_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * ); void __RPC_USER BSTR_UserFree( __RPC__in unsigned long *, __RPC__in BSTR * ); unsigned long __RPC_USER LPSAFEARRAY_UserSize( __RPC__in unsigned long *, unsigned long , __RPC__in LPSAFEARRAY * ); unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in LPSAFEARRAY * ); unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out LPSAFEARRAY * ); void __RPC_USER LPSAFEARRAY_UserFree( __RPC__in unsigned long *, __RPC__in LPSAFEARRAY * ); unsigned long __RPC_USER BSTR_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in BSTR * ); unsigned char * __RPC_USER BSTR_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in BSTR * ); unsigned char * __RPC_USER BSTR_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out BSTR * ); void __RPC_USER BSTR_UserFree64( __RPC__in unsigned long *, __RPC__in BSTR * ); unsigned long __RPC_USER LPSAFEARRAY_UserSize64( __RPC__in unsigned long *, unsigned long , __RPC__in LPSAFEARRAY * ); unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal64( __RPC__in unsigned long *, __RPC__inout_xcount(0) unsigned char *, __RPC__in LPSAFEARRAY * ); unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal64(__RPC__in unsigned long *, __RPC__in_xcount(0) unsigned char *, __RPC__out LPSAFEARRAY * ); void __RPC_USER LPSAFEARRAY_UserFree64( __RPC__in unsigned long *, __RPC__in LPSAFEARRAY * ); /* end of Additional Prototypes */ #ifdef __cplusplus } #endif #endif
115,435
1,085
/* * Copyright (C) 2017-2019 Dremio Corporation * * 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. */ package com.dremio.exec.serialization; import com.dremio.common.utils.ProtobufUtils; import com.google.protobuf.Message; public class ProtoSerializer { public static <M extends Message> InstanceSerializer<M> of(Class<M> clazz) { return new JacksonSerializer<>(ProtobufUtils.newMapper(), clazz); } }
266
313
{"status_id":3764875710955520,"text":"Wihke unso illub cik maji op dore pub map odeosobop wimkeet unuwo sa kega mesebit huna kah. #camgir","user":{"user_id":7399945292218368,"name":"<NAME>","screen_name":"@vaj","created_at":424573692,"followers_count":88,"friends_count":24,"favourites_count":14},"created_at":1403298749,"favorite_count":70,"retweet_count":66,"entities":{"hashtags":[{"text":"#camgir","indices":[10,25]}]},"in_reply_to_status_id":null}
177
892
{ "schema_version": "1.2.0", "id": "GHSA-6rmj-6826-5j8h", "modified": "2022-05-13T01:16:08Z", "published": "2022-05-13T01:16:08Z", "aliases": [ "CVE-2018-18898" ], "details": "The email-ingestion feature in Best Practical Request Tracker 4.1.13 through 4.4 allows denial of service by remote attackers via an algorithmic complexity attack on email address parsing.", "severity": [ { "type": "CVSS_V3", "score": "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H" } ], "affected": [ ], "references": [ { "type": "ADVISORY", "url": "https://nvd.nist.gov/vuln/detail/CVE-2018-18898" }, { "type": "WEB", "url": "https://bestpractical.com/download-page" }, { "type": "WEB", "url": "https://lists.debian.org/debian-lts-announce/2020/02/msg00009.html" }, { "type": "WEB", "url": "https://lists.fedoraproject.org/archives/list/[email protected]/message/CPJVDT77ZPRU5Z2BEMZM7EBY6WZHUATZ/" }, { "type": "WEB", "url": "https://lists.fedoraproject.org/archives/list/[email protected]/message/YR46PPHBEM76DNN4DEQMAYIKLCO3TQU2/" }, { "type": "WEB", "url": "https://usn.ubuntu.com/4517-1/" } ], "database_specific": { "cwe_ids": [ "CWE-400" ], "severity": "HIGH", "github_reviewed": false } }
699
543
/* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package sun.java2d.xr; import static sun.java2d.loops.CompositeType.SrcNoEa; import static sun.java2d.loops.CompositeType.SrcOver; import static sun.java2d.loops.SurfaceType.AnyColor; import static sun.java2d.loops.SurfaceType.GradientPaint; import static sun.java2d.loops.SurfaceType.LinearGradientPaint; import static sun.java2d.loops.SurfaceType.OpaqueColor; import static sun.java2d.loops.SurfaceType.OpaqueGradientPaint; import static sun.java2d.loops.SurfaceType.OpaqueLinearGradientPaint; import static sun.java2d.loops.SurfaceType.OpaqueRadialGradientPaint; import static sun.java2d.loops.SurfaceType.OpaqueTexturePaint; import static sun.java2d.loops.SurfaceType.RadialGradientPaint; import static sun.java2d.loops.SurfaceType.TexturePaint; import java.awt.*; import sun.awt.*; import sun.java2d.*; import sun.java2d.loops.*; public class XRMaskFill extends MaskFill { static void register() { GraphicsPrimitive[] primitives = { new XRMaskFill(AnyColor, SrcOver, XRSurfaceData.IntRgbX11), new XRMaskFill(OpaqueColor, SrcNoEa, XRSurfaceData.IntRgbX11), new XRMaskFill(GradientPaint, SrcOver, XRSurfaceData.IntRgbX11), new XRMaskFill(OpaqueGradientPaint, SrcNoEa, XRSurfaceData.IntRgbX11), new XRMaskFill(LinearGradientPaint, SrcOver, XRSurfaceData.IntRgbX11), new XRMaskFill(OpaqueLinearGradientPaint, SrcNoEa, XRSurfaceData.IntRgbX11), new XRMaskFill(RadialGradientPaint, SrcOver, XRSurfaceData.IntRgbX11), new XRMaskFill(OpaqueRadialGradientPaint, SrcNoEa, XRSurfaceData.IntRgbX11), new XRMaskFill(TexturePaint, SrcOver, XRSurfaceData.IntRgbX11), new XRMaskFill(OpaqueTexturePaint, SrcNoEa, XRSurfaceData.IntRgbX11), new XRMaskFill(AnyColor, SrcOver, XRSurfaceData.IntArgbPreX11), new XRMaskFill(OpaqueColor, SrcNoEa, XRSurfaceData.IntArgbPreX11), new XRMaskFill(GradientPaint, SrcOver, XRSurfaceData.IntArgbPreX11), new XRMaskFill(OpaqueGradientPaint, SrcNoEa, XRSurfaceData.IntArgbPreX11), new XRMaskFill(LinearGradientPaint, SrcOver, XRSurfaceData.IntArgbPreX11), new XRMaskFill(OpaqueLinearGradientPaint, SrcNoEa, XRSurfaceData.IntArgbPreX11), new XRMaskFill(RadialGradientPaint, SrcOver, XRSurfaceData.IntArgbPreX11), new XRMaskFill(OpaqueRadialGradientPaint, SrcNoEa, XRSurfaceData.IntArgbPreX11), new XRMaskFill(TexturePaint, SrcOver, XRSurfaceData.IntArgbPreX11), new XRMaskFill(OpaqueTexturePaint, SrcNoEa, XRSurfaceData.IntArgbPreX11) }; GraphicsPrimitiveMgr.register(primitives); } protected XRMaskFill(SurfaceType srcType, CompositeType compType, SurfaceType surfaceType) { super(srcType, compType, surfaceType); } protected native void maskFill(long xsdo, int x, int y, int w, int h, int maskoff, int maskscan, int masklen, byte[] mask); public void MaskFill(SunGraphics2D sg2d, SurfaceData sData, Composite comp, final int x, final int y, final int w, final int h, final byte[] mask, final int maskoff, final int maskscan) { try { SunToolkit.awtLock(); XRSurfaceData x11sd = (XRSurfaceData) sData; x11sd.validateAsDestination(null, sg2d.getCompClip()); XRCompositeManager maskBuffer = x11sd.maskBuffer; maskBuffer.validateCompositeState(comp, sg2d.transform, sg2d.paint, sg2d); int maskPict = maskBuffer.getMaskBuffer().uploadMask(w, h, maskscan, maskoff, mask); maskBuffer.XRComposite(XRUtils.None, maskPict, x11sd.picture, x, y, 0, 0, x, y, w, h); maskBuffer.getMaskBuffer().clearUploadMask(maskPict, w, h); } finally { SunToolkit.awtUnlock(); } } }
2,450
357
/* * Psychtoolbox3/PsychSourceGL/Source/Common/IOPort/PsychSerialUnixGlue.h * * PROJECTS: * * IOPort for now. * * AUTHORS: * * <EMAIL> mk * * PLATFORMS: * * All Unix (aka Posix) systems: OS/X and Linux. * * HISTORY: * * 04/10/2008 mk Initial implementation. * 04/03/2011 mk Audited (but not tested) to be 64-bit safe. Doesn't take advantage of > 2 GB * buffers yet. This will require some minor changes. * * DESCRIPTION: * * This is the operating system dependent "glue code" layer for access to serial ports for the * Unices, ie., for GNU/Linux and Apple MacOS/X. It is used by the higher-level serial port * routines to abstract out operating system dependencies. * * The code is shared and #ifdef'ed if needed, because most of it is identical for Linux and OS/X. */ #ifndef PSYCH_IS_INCLUDED_SerialUnixGlue #define PSYCH_IS_INCLUDED_SerialUnixGlue #include <unistd.h> #include <fcntl.h> #include <sys/ioctl.h> #include <errno.h> #include <paths.h> #include <termios.h> #include <sysexits.h> #include <sys/param.h> #include <sys/select.h> #include <sys/time.h> #include <time.h> #include <pthread.h> // OS/X specific includes and structures: #if PSYCH_SYSTEM == PSYCH_OSX #include <AvailabilityMacros.h> #include <CoreFoundation/CoreFoundation.h> #include <IOKit/IOKitLib.h> #include <IOKit/serial/IOSerialKeys.h> #include <IOKit/serial/ioss.h> #include <IOKit/IOBSD.h> // End OS/X specific includes... #endif // Linux specific includes and structures: #if PSYCH_SYSTEM == PSYCH_LINUX // None yet. #endif typedef struct PsychSerialDeviceRecord { char portSpec[1000]; // Name string of the device file. int fileDescriptor; // Device handle. struct termios OriginalTTYAttrs; // Stores original settings of device to allow restore on close. unsigned char* readBuffer; // Pointer to memory buffer for reading data. unsigned int readBufferSize; // Size of readbuffer. double readTimeout; // Backup copy of current read timeout value. double pollLatency; // Seconds to sleep between spin-wait polls in 'Read'. pthread_t readerThread; // Thread handle for background reading thread. pthread_mutex_t readerLock; // Primary lock. int readerThreadWritePos; // Position of next data write for readerThread. int clientThreadReadPos; // Position of next data read from main thread. int readGranularity; // Amount of bytes to request per blocking read call in readerThread. int isBlockingBackgroundRead; // 1 = Blocking background read, 0 = Polling operation. double* timeStamps; // Buffer for async-read timestamps. Size = readBufferSize / readGranularity Bytes. int bounceBufferSize; // Size of bounceBuffer in Bytes. unsigned char* bounceBuffer; // Bouncebuffer. unsigned int readFilterFlags; // Special flags to enable certain postprocessing operations on read data. int asyncReadBytesCount; // Counter of total bytes read via async thread so far. [Updates not mutex protected!] unsigned char lineTerminator; // Line terminator byte, if any. unsigned char cookedMode; // Cooked input processing mode active? Set to 1 if so. int dontFlushOnWrite; // If set to 1, don't tcdrain() after blocking writes, otherwise do. double triggerWhen; // Target time for trigger byte emission. } PsychSerialDeviceRecord; #endif
1,778
335
<filename>A/Archdeacon_noun.json { "word": "Archdeacon", "definitions": [ "A senior Christian cleric (in the early Church a deacon, in the modern Anglican Church a priest) to whom a bishop delegates certain responsibilities." ], "parts-of-speech": "Noun" }
97
314
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by <NAME>. // #import "CDStructures.h" #import "DVTDocumentLocation-Protocol.h" @class NSIndexPath; @interface IDELogDocumentLocation : DVTDocumentLocation { NSIndexPath *_indexPath; BOOL _expandTranscript; struct _NSRange _characterRange; } @property(readonly) struct _NSRange characterRange; // @synthesize characterRange=_characterRange; @property(readonly) BOOL expandTranscript; // @synthesize expandTranscript=_expandTranscript; @property(readonly) NSIndexPath *indexPath; // @synthesize indexPath=_indexPath; - (BOOL)isEqual:(id)arg1; - (long long)compare:(id)arg1; - (void)encodeWithCoder:(id)arg1; - (id)initWithCoder:(id)arg1; - (id)initWithDocumentURL:(id)arg1 timestamp:(id)arg2 indexPath:(id)arg3 expandTranscript:(BOOL)arg4; - (id)initWithDocumentURL:(id)arg1 timestamp:(id)arg2 indexPath:(id)arg3 characterRange:(struct _NSRange)arg4; - (id)_initWithDocumentURL:(id)arg1 timestamp:(id)arg2 indexPath:(id)arg3 expandTranscript:(BOOL)arg4 characterRange:(struct _NSRange)arg5; @end
413
837
<filename>tests/bool.py<gh_stars>100-1000 import unittest import base class Suite(base.Base): def test_1(self): """Test case 1""" self.start('main') l = self.xpath('li[1]/a') l.click() self.assertEqual("Yes!", self.body_text()) def test_2(self): """Test case 2""" self.start('main') l = self.xpath('li[2]/a') l.click() self.assertEqual("No!", self.body_text())
222
3,893
<filename>Source/drlg_l4.h /** * @file drlg_l4.h * * Interface of the hell level generation algorithms. */ #ifndef __DRLG_L4_H__ #define __DRLG_L4_H__ extern int diabquad1x; extern int diabquad1y; extern int diabquad2x; extern int diabquad2y; extern int diabquad3x; extern int diabquad3y; extern int diabquad4x; extern int diabquad4y; void CreateL4Dungeon(DWORD rseed, int entry); #endif /* __DRLG_L4_H__ */
199
1,445
<reponame>prohfesor/tapiriik import time import base64 import math import hmac import hashlib import struct class TOTP: def Get(secret): counter = struct.pack(">Q", int(time.time() / 30)) key = base64.b32decode(secret.upper().encode()) csp = hmac.new(key, counter, hashlib.sha1) res = csp.digest() offset = res[19] & 0xf code_pre = struct.unpack(">I", res[offset:offset + 4])[0] code_pre = code_pre & 0x7fffffff return int(code_pre % (math.pow(10, 6)))
239
3,348
/** * 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. */ package org.apache.heron.healthmgr.detectors; import java.time.Instant; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.logging.Logger; import javax.inject.Inject; import com.microsoft.dhalion.core.Measurement; import com.microsoft.dhalion.core.MeasurementsTable; import com.microsoft.dhalion.core.Symptom; import org.apache.heron.healthmgr.HealthManagerMetrics; import org.apache.heron.healthmgr.HealthPolicyConfig; import static org.apache.heron.healthmgr.detectors.BaseDetector.SymptomType.SYMPTOM_COMP_BACK_PRESSURE; import static org.apache.heron.healthmgr.detectors.BaseDetector.SymptomType.SYMPTOM_INSTANCE_BACK_PRESSURE; import static org.apache.heron.healthmgr.sensors.BaseSensor.MetricName.METRIC_BACK_PRESSURE; public class BackPressureDetector extends BaseDetector { public static final String BACK_PRESSURE_DETECTOR = "BackPressureDetector"; static final String CONF_NOISE_FILTER = "BackPressureDetector.noiseFilterMillis"; private static final Logger LOG = Logger.getLogger(BackPressureDetector.class.getName()); private final int noiseFilterMillis; private HealthManagerMetrics publishingMetrics; @Inject BackPressureDetector(HealthPolicyConfig policyConfig, HealthManagerMetrics publishingMetrics) { noiseFilterMillis = (int) policyConfig.getConfig(CONF_NOISE_FILTER, 20); this.publishingMetrics = publishingMetrics; } /** * Detects all components initiating backpressure above the configured limit. Normally there * will be only one component * * @return A collection of symptoms each one corresponding to a components with backpressure. */ @Override public Collection<Symptom> detect(Collection<Measurement> measurements) { publishingMetrics.executeDetectorIncr(BACK_PRESSURE_DETECTOR); Collection<Symptom> result = new ArrayList<>(); Instant now = context.checkpoint(); MeasurementsTable bpMetrics = MeasurementsTable.of(measurements).type(METRIC_BACK_PRESSURE.text()); for (String component : bpMetrics.uniqueComponents()) { double compBackPressure = bpMetrics.component(component).sum(); if (compBackPressure > noiseFilterMillis) { LOG.info(String.format("Detected component back-pressure for %s, total back pressure is %f", component, compBackPressure)); List<String> addresses = Collections.singletonList(component); result.add(new Symptom(SYMPTOM_COMP_BACK_PRESSURE.text(), now, addresses)); } } for (String instance : bpMetrics.uniqueInstances()) { double totalBP = bpMetrics.instance(instance).sum(); if (totalBP > noiseFilterMillis) { LOG.info(String.format("Detected instance back-pressure for %s, total back pressure is %f", instance, totalBP)); List<String> addresses = Collections.singletonList(instance); result.add(new Symptom(SYMPTOM_INSTANCE_BACK_PRESSURE.text(), now, addresses)); } } return result; } }
1,239
1,011
<gh_stars>1000+ from django.db import models class DJAModel(models.Model): """ Base for test models that sets app_label, so they play nicely. """ class Meta: app_label = "tests" abstract = True class BasicModel(DJAModel): text = models.CharField(max_length=100) # Models for relations tests # ManyToMany class ManyToManyTarget(DJAModel): name = models.CharField(max_length=100) class ManyToManySource(DJAModel): name = models.CharField(max_length=100) targets = models.ManyToManyField(ManyToManyTarget, related_name="sources") # ForeignKey class ForeignKeyTarget(DJAModel): name = models.CharField(max_length=100) class ForeignKeySource(DJAModel): name = models.CharField(max_length=100) target = models.ForeignKey( ForeignKeyTarget, related_name="sources", on_delete=models.CASCADE )
320
660
<reponame>neerajso/media-driver /* * Copyright (c) 2019-2020, Intel Corporation * * 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. */ //! //! \file decode_scalability_singlepipe.h //! \brief Defines the common interface for decode scalability singlepipe mode. //! \details The decode scalability singlepipe interface is further sub-divided by codecs, //! this file is for the base interface which is shared by all codecs. //! #ifndef __DECODE_SCALABILITY_SINGLEPIPE_H__ #define __DECODE_SCALABILITY_SINGLEPIPE_H__ #include "mos_defs.h" #include "mos_os.h" #include "codechal_hw.h" #include "media_scalability_singlepipe.h" #include "decode_scalability_option.h" namespace decode { class DecodeScalabilitySinglePipe: public MediaScalabilitySinglePipe { public: //! //! \brief decode scalability singlepipe constructor //! \param [in] hwInterface //! Pointer to HwInterface //! \param [in] mediaContext //! Pointer to MediaContext //! \param [in] componentType //! Component type //! DecodeScalabilitySinglePipe(void *hwInterface, MediaContext *mediaContext, uint8_t componentType); //! //! \brief decode scalability singlepipe destructor //! virtual ~DecodeScalabilitySinglePipe() {}; //! //! \brief Copy constructor //! DecodeScalabilitySinglePipe(const DecodeScalabilitySinglePipe&) = delete; //! //! \brief Copy assignment operator //! DecodeScalabilitySinglePipe& operator=(const DecodeScalabilitySinglePipe&) = delete; //! //! \brief Initialize the decode single scalability //! \details It will prepare the resources needed in scalability //! and initialize the state of scalability //! \param [in] option //! Input scalability option //! \return MOS_STATUS //! MOS_STATUS_SUCCESS if success, else fail reason //! virtual MOS_STATUS Initialize(const MediaScalabilityOption &option) override; //! //! \brief Update the media scalability singlepipe mode state //! \param [in] statePars //! parameters to update the state //! \return MOS_STATUS //! MOS_STATUS_SUCCESS if success, else fail reason //! virtual MOS_STATUS UpdateState(void *statePars) override; //! //! \brief Verify command buffer //! \param [in] requestedSize //! requested size for command buffer //! \param [in] requestedPatchListSize //! requested size for patched list //! \param [out] singleTaskPhaseSupportedInPak //! Inidcate if to use single task phase in pak. //! \return MOS_STATUS //! MOS_STATUS_SUCCESS if success, else fail reason //! virtual MOS_STATUS VerifyCmdBuffer(uint32_t requestedSize, uint32_t requestedPatchListSize, bool &singleTaskPhaseSupportedInPak) override; protected: //! //! \brief Verify command buffer size and patch list size, reallocate if required //! \return MOS_STATUS //! MOS_STATUS_SUCCESS if success, else fail reason //! virtual MOS_STATUS VerifySpaceAvailable(uint32_t requestedSize, uint32_t requestedPatchListSize, bool &singleTaskPhaseSupportedInPak) override; //! //! \brief Resizes the cmd buffer and patch list with cmd buffer header //! //! \param [in] requestedCommandBufferSize //! Requested resize command buffer size //! \param [in] requestedPatchListSize //! Requested resize patchlist size //! //! \return MOS_STATUS //! MOS_STATUS_SUCCESS if success, else fail reason //! virtual MOS_STATUS ResizeCommandBufferAndPatchList( uint32_t requestedCommandBufferSize, uint32_t requestedPatchListSize) override; virtual MOS_STATUS SendAttrWithFrameTracking(MOS_COMMAND_BUFFER &cmdBuffer, bool frameTrackingRequested) override; private: CodechalHwInterface *m_hwInterface = nullptr; }; } #endif // !__MEDIA_SCALABILITY_SINGLEPIPE_H__
1,922
956
# $Id: rx.py 23 2006-11-08 15:45:33Z jonojono $ # -*- coding: utf-8 -*- """Rx Protocol.""" from __future__ import absolute_import from . import dpkt # Types DATA = 0x01 ACK = 0x02 BUSY = 0x03 ABORT = 0x04 ACKALL = 0x05 CHALLENGE = 0x06 RESPONSE = 0x07 DEBUG = 0x08 # Flags CLIENT_INITIATED = 0x01 REQUEST_ACK = 0x02 LAST_PACKET = 0x04 MORE_PACKETS = 0x08 SLOW_START_OK = 0x20 JUMBO_PACKET = 0x20 # Security SEC_NONE = 0x00 SEC_BCRYPT = 0x01 SEC_RXKAD = 0x02 SEC_RXKAD_ENC = 0x03 class Rx(dpkt.Packet): """Rx Protocol. TODO: Longer class information.... Attributes: __hdr__: Header fields of Rx. TODO. """ __hdr__ = ( ('epoch', 'I', 0), ('cid', 'I', 0), ('call', 'I', 1), ('seq', 'I', 0), ('serial', 'I', 1), ('type', 'B', 0), ('flags', 'B', CLIENT_INITIATED), ('status', 'B', 0), ('security', 'B', 0), ('sum', 'H', 0), ('service', 'H', 0) )
517
535
/* * 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. */ #include "nffs_test_utils.h" TEST_CASE_SELF(nffs_test_lost_found) { char buf[32]; struct nffs_inode_entry *inode_entry; uint32_t flash_offset; uint32_t area_offset; uint8_t area_idx; int rc; struct nffs_disk_inode ndi; uint8_t off; /* calculated offset for memset */ /*** Setup. */ rc = nffs_format(nffs_current_area_descs); TEST_ASSERT(rc == 0); rc = fs_mkdir("/mydir"); TEST_ASSERT(rc == 0); rc = fs_mkdir("/mydir/dir1"); TEST_ASSERT(rc == 0); nffs_test_util_create_file("/mydir/file1", "aaaa", 4); nffs_test_util_create_file("/mydir/dir1/file2", "bbbb", 4); /* Corrupt the mydir inode. */ rc = nffs_path_find_inode_entry("/mydir", &inode_entry); TEST_ASSERT(rc == 0); snprintf(buf, sizeof buf, "%lu", (unsigned long)inode_entry->nie_hash_entry.nhe_id); nffs_flash_loc_expand(inode_entry->nie_hash_entry.nhe_flash_loc, &area_idx, &area_offset); flash_offset = nffs_areas[area_idx].na_offset + area_offset; /* * Overwrite the sequence number - should be detected as CRC corruption */ off = (char*)&ndi.ndi_seq - (char*)&ndi; rc = flash_native_memset(flash_offset + off, 0xaa, 1); TEST_ASSERT(rc == 0); /* Clear cached data and restore from flash (i.e, simulate a reboot). */ rc = nffs_misc_reset(); TEST_ASSERT(rc == 0); rc = nffs_detect(nffs_current_area_descs); TEST_ASSERT(rc == 0); /* All contents should now be in the lost+found dir. */ struct nffs_test_file_desc *expected_system = (struct nffs_test_file_desc[]) { { .filename = "", .is_dir = 1, .children = (struct nffs_test_file_desc[]) { { .filename = "lost+found", .is_dir = 1, #if 0 .children = (struct nffs_test_file_desc[]) { { .filename = buf, .is_dir = 1, .children = (struct nffs_test_file_desc[]) { { .filename = "file1", .contents = "aaaa", .contents_len = 4, }, { .filename = "dir1", .is_dir = 1, .children = (struct nffs_test_file_desc[]) { { .filename = "file2", .contents = "bbbb", .contents_len = 4, }, { .filename = NULL, } }, }, { .filename = NULL, } }, }, { .filename = NULL, } }, #endif }, { .filename = NULL, } } } }; nffs_test_assert_system(expected_system, nffs_current_area_descs); }
1,821
1,144
<filename>backend/de.metas.handlingunits.base/src/main/java/de/metas/handlingunits/empties/EmptiesInOutLinePackingMaterialDocumentLine.java<gh_stars>1000+ package de.metas.handlingunits.empties; /* * #%L * de.metas.handlingunits.base * %% * Copyright (C) 2015 metas GmbH * %% * 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, see * <http://www.gnu.org/licenses/gpl-2.0.html>. * #L% */ import java.math.BigDecimal; import de.metas.handlingunits.impl.AbstractPackingMaterialDocumentLine; import de.metas.handlingunits.model.I_M_InOutLine; import de.metas.product.ProductId; import de.metas.uom.IUOMConversionBL; import de.metas.uom.UomId; import de.metas.util.Check; import de.metas.util.Services; /* package */class EmptiesInOutLinePackingMaterialDocumentLine extends AbstractPackingMaterialDocumentLine { private final I_M_InOutLine inoutLine; EmptiesInOutLinePackingMaterialDocumentLine(final I_M_InOutLine inoutLine) { super(); Check.assumeNotNull(inoutLine, "inoutLine not null"); this.inoutLine = inoutLine; } public I_M_InOutLine getM_InOutLine() { return inoutLine; } @Override public ProductId getProductId() { return ProductId.ofRepoId(inoutLine.getM_Product_ID()); } /** * @returns MovementQty of the wrapped inout line */ @Override public BigDecimal getQty() { return inoutLine.getMovementQty(); } /** * Sets both MovementQty and QtyEntered of the wrapped order line. * * @param qty MovementQty which will also be converted to QtyEntered. */ @Override protected void setQty(final BigDecimal qty) { inoutLine.setMovementQty(qty); final IUOMConversionBL uomConversionBL = Services.get(IUOMConversionBL.class); final BigDecimal qtyEntered = uomConversionBL.convertFromProductUOM(getProductId(), UomId.ofRepoId(inoutLine.getC_UOM_ID()), qty); inoutLine.setQtyEntered(qtyEntered); } }
832
575
<filename>ash/media/media_notification_constants.cc // Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "ash/media/media_notification_constants.h" namespace ash { const char kMediaSessionNotificationCustomViewType[] = "media-session"; const char kMediaSessionNotifierId[] = "media-session"; } // namespace ash
126
1,626
// // Copyright (c) 2016, Scientific Toolworks, Inc. // // This software is licensed under the MIT License. The LICENSE.md file // describes the conditions under which this software may be distributed. // // Author: <NAME> // #include "Installer.h" #include <QDir> Installer::Installer(const QString &name, const QString &path) : mName(name), mPath(path) {} bool Installer::exists() const { return (!mName.isEmpty() && !mPath.isEmpty() && QDir(mPath).exists(mName)); }
166
310
<reponame>dreeves/usesthis<gh_stars>100-1000 { "name": "UFO: Enemy Unknown", "description": "A strategy video game.", "url": "https://en.wikipedia.org/wiki/UFO:_Enemy_Unknown" }
72
348
<reponame>chamberone/Leaflet.PixiOverlay<gh_stars>100-1000 {"nom":"Linthal","circ":"2ème circonscription","dpt":"Haut-Rhin","inscrits":460,"abs":260,"votants":200,"blancs":17,"nuls":5,"exp":178,"res":[{"nuance":"REM","nom":"<NAME>","voix":92},{"nuance":"LR","nom":"M. <NAME>","voix":86}]}
120
840
#pragma once #define _SDK_MIN_MSC_VER 1800 #define _SDK_MAX_MSC_VER 1900 #if defined(_MSC_VER) #if _MSC_VER < _SDK_MIN_MSC_VER || _MSC_VER > _SDK_MAX_MSC_VER #error "Unsupported MSVC. Please use VS2013(v120) or compatible VS2015(v140)." #endif // _MSC_VER < 1800 || _MSC_VER > 1900 #endif // defined(_MSC_VER) #include "CStruct.h" namespace seeta { class FaceDetector2 { public: /** * \brief construct an facedetector * \param model model path */ SEETA_API FaceDetector2(const char *model); SEETA_API ~FaceDetector2(); /** * \brief detect faces * \param num [out] num of detected facess * \param image [in] * \return pointer to an array of rectangle, contains each faces location, with length of *num * \note return nullptr if no face detected * \note faces were sorted by width * length * \note returning pointer was volatile, only accessable before next API called. */ SEETA_API SeetaRect *Detect(const SeetaImageData &image, int *num = nullptr) const; private: FaceDetector2(const FaceDetector2 &other) = delete; const FaceDetector2 &operator=(const FaceDetector2 &other) = delete; void *impl; }; }
426
412
/** * @file span.h * @author <NAME> <<EMAIL>> * @date 2020-08-04 * * @copyright MIT License * * Copyright (c) 2020 <NAME> * * 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. * */ #pragma once #include <cinttypes> #include <limits> #include <type_traits> #include "stx/config.h" #include "stx/option.h" STX_BEGIN_NAMESPACE namespace internal { template <typename T, typename U> struct match_cv_impl { using type = U; }; template <typename T, typename U> struct match_cv_impl<T const, U> { using type = U const; }; template <typename T, typename U> struct match_cv_impl<T const volatile, U> { using type = U const volatile; }; template <typename T, typename U> using match_cv = typename match_cv_impl<T, U>::type; template <typename T> void type_ptr_and_size(T*, size_t) {} template <typename T, typename = void> struct is_container_impl : std::false_type {}; template <typename T> struct is_container_impl<T, decltype((type_ptr_and_size( std::data(std::declval<T>()), std::size(std::declval<T>()))), (void)0)> : std::true_type {}; template <typename T> constexpr bool is_container = is_container_impl<T>::value; template<typename Element, typename OtherElement> constexpr bool is_compatible = std::is_convertible_v< OtherElement(*)[], Element(*)[] >; template <typename T, typename Element, typename = void> struct is_compatible_container_impl : std::false_type {}; template <typename T, typename Element> struct is_compatible_container_impl<T, Element, std::void_t<decltype(std::data(std::declval<T>()))>> : std::bool_constant<is_compatible< Element, std::remove_pointer_t<decltype(std::data(std::declval<T>()))> >> {}; template<typename T, typename Element> constexpr bool is_compatible_container = is_compatible_container_impl<T, Element>::value; } // namespace internal constexpr size_t dynamic_extent = std::numeric_limits<size_t>::max(); //! //! # Span //! //! `Span` is a referencing/non-owning type-erased view over a contiguous //! sequence of objects (sequential container) and typically help to eliminate //! the use of raw pointers. A `Span` can either have a static extent, in which //! case the number of elements in the sequence is known at compile-time and //! encoded in the type, or a dynamic extent, in which case the number of //! elements in the sequence is known at runtime. //! //! `Span` is conceptually a pointer and a length into an already existing //! contiguous memory. Passing a properly-constructed `Span` instead of raw //! pointers avoids many issues related to index out of bounds errors. //! //! A static-extent span is a span whose length is known at compile-time. //! A dynamic-extent span is a span whose length varies and is only known at //! runtime. //! //! //! //! # Usage //! //! ```cpp //! //! std::vector<int> vec = {1, 2, 3, 4, 5}; //! //! // Construct a static-extent span (size known at compile time) //! Span<int, 5> a = vec; //! //! // Construct a static-extent span pointing to the first 2 elements of the //! // vector //! Span<int, 2> b = vec; //! //! // Construct a dynamic-extent span (size known at runtime) //! Span<int> c = vec; //! //! //! // Construct a static-extent span pointing to the first 2 elements of the //! // vector //! auto d = Span<int>(vec.data(), 2); //! //! //! ``` //! template <typename Element, size_t Extent = dynamic_extent> struct Span { using element_type = Element; using value_type = std::remove_cv_t<Element>; using reference = element_type&; using pointer = element_type*; using const_pointer = element_type const*; using iterator = element_type*; using const_iterator = element_type const*; using reverse_iterator = std::reverse_iterator<iterator>; using const_reverse_iterator = std::reverse_iterator<const_iterator>; using size_type = size_t; using index_type = size_t; using difference_type = ptrdiff_t; static constexpr size_t extent = Extent; static constexpr bool is_dynamic_span = false; private: // i.e. if `Element` is const or const-volatile, make `T` same template <typename T> using cv_match_ = internal::match_cv<element_type, T>; template <typename T> constexpr static bool is_compatible = internal::is_compatible<element_type, T>; static constexpr size_type byte_extent_ = Extent * (sizeof(element_type) / sizeof(std::byte)); static constexpr size_type u8_extent_ = Extent * (sizeof(element_type) / sizeof(uint8_t)); public: Span() = delete; /// copy-construct static-extent span from another static-extent span /// (compile-time bounds-checked). template <typename SrcElement, size_type SrcExtent, std::enable_if_t<is_compatible<SrcElement>, int> = 0> constexpr Span(Span<SrcElement, SrcExtent> const& src) noexcept : data_{static_cast<pointer>(src.data())} { static_assert(Extent <= SrcExtent, "performing a subspan from a static-extent span source of " "smaller extent"); } /// factory function for copy-constructing a static-extent span from another /// static-extent span (bounds-checked). template <typename SrcElement, size_type SrcExtent, std::enable_if_t<is_compatible<SrcElement>, int> = 0> static STX_OPTION_CONSTEXPR Option<Span> try_init( Span<SrcElement, SrcExtent> const& src) noexcept { if constexpr (Extent > SrcExtent) return None; return Some(Span(src)); } /// copy-construct static-extent span from a dynamic-extent span (not /// bounds-checked). /// /// Also, see: bounds-checked `Span::try_init`. template <typename SrcElement, std::enable_if_t<is_compatible<SrcElement>, int> = 0> explicit constexpr Span(Span<SrcElement, dynamic_extent> const& src) noexcept : data_{static_cast<pointer>(src.data())} {} /// factory function for copy-constructing a static-extent span from a /// dynamic-extent span (bounds-checked). template <typename SrcElement, std::enable_if_t<is_compatible<SrcElement>, int> = 0> static STX_OPTION_CONSTEXPR Option<Span> try_init( Span<SrcElement, dynamic_extent> const& src) noexcept { if (Extent > src.size()) return None; return Some(Span(src)); } /// construct static-extent span from iterator/raw-pointer (not /// bounds-checked). constexpr Span(iterator begin) noexcept : data_{begin} {}; /// construct static-extent span from array (compile-time bounds-checked). template <typename SrcElement, size_type Length, std::enable_if_t<is_compatible<SrcElement>, int> = 0> constexpr Span(SrcElement (&array)[Length]) noexcept : data_{static_cast<pointer>(array)} { static_assert(Extent <= Length, "Span extent is more than static array length"); } /// construct static-extent span from array (bounds-checked). template <typename SrcElement, size_type Length, std::enable_if_t<is_compatible<SrcElement>, int> = 0> static STX_OPTION_CONSTEXPR Option<Span> try_init( SrcElement (&array)[Length]) noexcept { if constexpr (Extent > Length) return None; return Some(Span(static_cast<pointer>(array))); } /// construct static-extent span from std::array (compile-time /// bounds-checked). template <typename SrcElement, size_type Length, std::enable_if_t<is_compatible<SrcElement>, int> = 0> constexpr Span(std::array<SrcElement, Length>& array) noexcept : data_{static_cast<pointer>(array.data())} { static_assert(Extent <= Length, "Span extent is more than std::array's length"); } /// construct static-extent span from std::array (bounds-checked). template <typename SrcElement, size_type Length, std::enable_if_t<is_compatible<SrcElement>, int> = 0> static STX_OPTION_CONSTEXPR Option<Span> try_init( std::array<SrcElement, Length>& array) noexcept { if constexpr (Extent > Length) return None; return Some(Span(static_cast<pointer>(array.data()))); } /// construct static-extent span from std::array (compile-time /// bounds-checked). template <typename SrcElement, size_type Length, std::enable_if_t<is_compatible<SrcElement const>, int> = 0> constexpr Span(std::array<SrcElement, Length> const& array) noexcept : data_{static_cast<pointer>(array.data())} { static_assert(Extent <= Length, "Span extent is more than std::array's length"); } /// construct static-extent span from std::array (bounds-checked). template <typename SrcElement, size_type Length, std::enable_if_t<is_compatible<SrcElement const>, int> = 0> static STX_OPTION_CONSTEXPR Option<Span> try_init( std::array<SrcElement, Length> const& array) noexcept { if constexpr (Extent > Length) return None; return Some(Span(static_cast<pointer>(array.data()))); } template <typename SrcElement, size_type Length> constexpr Span(std::array<SrcElement, Length>&& array) noexcept = delete; template <typename SrcElement, size_type Length> static STX_OPTION_CONSTEXPR Option<Span> try_init( std::array<SrcElement, Length>&& array) noexcept = delete; /// construct static-extent span from any container (not bounds-checked). /// /// Also, see: bounds-checked `Span::try_init`. /// /// # NOTE /// /// use only for containers storing a contiguous sequence of elements. template <typename Container, std::enable_if_t< internal::is_container<Container&> && internal::is_compatible_container<Container&, element_type>, int> = 0> explicit constexpr Span(Container& container) noexcept : data_{static_cast<pointer>(std::data(container))} {} /// factory function for constructing a static-extent span from any container /// (bounds-checked). template <typename Container, std::enable_if_t< internal::is_container<Container&> && internal::is_compatible_container<Container&, element_type>, int> = 0> static STX_OPTION_CONSTEXPR Option<Span> try_init( Container& container) noexcept { if (Extent > std::size(container)) return None; return Some(Span(std::data(container))); } constexpr Span(Span const&) noexcept = default; constexpr Span(Span&&) noexcept = default; constexpr Span& operator=(Span const&) noexcept = default; constexpr Span& operator=(Span&&) noexcept = default; ~Span() noexcept = default; /// returns a pointer to the beginning of the sequence of elements. constexpr pointer data() const noexcept { return data_; }; /// returns the number of elements in the sequence. constexpr size_type size() const noexcept { return size_; }; /// returns the size of the sequence in bytes. constexpr size_type size_bytes() const noexcept { return byte_extent_; } /// checks if the sequence is empty. constexpr bool empty() const noexcept { return size() == 0; }; /// returns an iterator to the beginning. constexpr iterator begin() const noexcept { return data_; }; /// returns an iterator to the end. constexpr iterator end() const noexcept { return begin() + size(); }; /// returns a constant iterator to the beginning. constexpr const_iterator cbegin() const noexcept { return begin(); }; /// returns a constant iterator to the end. constexpr const_iterator cend() const noexcept { return end(); }; /// returns a reverse iterator to the beginning. constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }; /// returns a reverse iterator to the end. constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }; /// returns a constant reverse iterator to the beginning. constexpr const_reverse_iterator crbegin() const noexcept { return rbegin(); }; /// returns a constant reverse iterator to the end. constexpr const_reverse_iterator crend() const noexcept { return rend(); }; /// accesses an element of the sequence (not bounds-checked). constexpr reference operator[](index_type index) const noexcept { return data()[index]; }; /// accesses an element of the sequence (bounds-checked). STX_OPTION_CONSTEXPR auto at(index_type index) const noexcept -> Option<Ref<element_type>> { if (index < size()) { return Some<Ref<element_type>>(data()[index]); } else { return None; } }; /// accesses an element of the sequence (bounds-checked). template <index_type Pos> STX_OPTION_CONSTEXPR auto at() const noexcept -> Option<Ref<element_type>> { if constexpr (Pos < Extent) { return Some<Ref<element_type>>(data()[Pos]); } else { return None; } } /// obtains a subspan starting at an offset (not bounds-checked). constexpr Span<element_type> subspan(index_type offset) const noexcept { return Span<element_type>(begin() + offset, end()); }; /// obtains a subspan starting at an offset and with a length /// (not bounds-checked). constexpr Span<element_type> subspan(index_type offset, size_type length) const noexcept { return Span<element_type>(begin() + offset, length); }; /// obtains a subspan starting at an offset (bounds-checked). STX_OPTION_CONSTEXPR Option<Span<element_type>> try_subspan( index_type offset) const noexcept { if (offset >= size()) return None; return Some(subspan(offset)); }; /// obtains a subspan starting at an offset and with a length /// (bounds-checked). STX_OPTION_CONSTEXPR Option<Span<element_type>> try_subspan( index_type offset, size_type length) const noexcept { if (offset >= size()) return None; if (begin() + offset + length > end()) return None; return Some(subspan(offset, length)); } /// obtains a subspan with offset provided via a template parameter /// (compile-time bounds-checked). template <index_type Offset> constexpr Span<element_type, (Extent - Offset)> subspan() const noexcept { static_assert(Offset < Extent, "Offset can not be greater than static-extent span's size"); return Span<element_type, (Extent - Offset)>(begin() + Offset); } /// obtains a subspan with offset and length provided via a template /// parameter (compile-time bounds-checked). template <index_type Offset, size_type Length> constexpr Span<element_type, Length> subspan() const noexcept { static_assert(Offset < Extent, "Offset can not be greater than static-extent span's size"); static_assert(Offset + Length <= Extent, "subspan length exceeds span's range"); return Span<element_type, Length>(begin() + Offset); } /// obtains a subspan with offset provided via a template parameter /// (bounds-checked). template <index_type Offset> STX_OPTION_CONSTEXPR Option<Span<element_type, (Extent - Offset)>> try_subspan() const noexcept { if constexpr (Offset >= Extent) return None; return Some(Span<element_type, (Extent - Offset)>(begin() + Offset)); } /// obtains a subspan with offset and length provided via a template parameter /// (bounds-checked). template <index_type Offset, size_type Length> STX_OPTION_CONSTEXPR Option<Span<element_type, Length>> try_subspan() const noexcept { if constexpr (Offset >= Extent) return None; if (begin() + Offset + Length > end()) return None; return Some(Span<element_type, Length>(begin() + Offset)); } /// converts the span into a view of its underlying bytes (represented with /// `std::byte`). constexpr Span<cv_match_<std::byte>, byte_extent_> as_bytes() const noexcept { return Span<cv_match_<std::byte>, byte_extent_>( reinterpret_cast<cv_match_<std::byte>*>(data())); } /// converts the span into a view of its underlying bytes (represented with /// `uint8_t`). constexpr Span<cv_match_<uint8_t>, u8_extent_> as_u8() const noexcept { return Span<cv_match_<uint8_t>, u8_extent_>( reinterpret_cast<cv_match_<uint8_t>*>(data())); } /// converts the span into an immutable span. constexpr Span<element_type const, Extent> as_const() const noexcept { return *this; } /// converts the span into another span in which reads /// and writes to the contiguous sequence are performed as volatile /// operations. constexpr Span<element_type volatile, Extent> as_volatile() const noexcept { return *this; } private: pointer data_; static constexpr size_t size_ = Extent; }; template <typename Element> struct Span<Element, dynamic_extent> { using element_type = Element; using value_type = std::remove_cv_t<Element>; using reference = element_type&; using pointer = element_type*; using const_pointer = element_type const*; using iterator = element_type*; using const_iterator = element_type const*; using reverse_iterator = std::reverse_iterator<iterator>; using const_reverse_iterator = std::reverse_iterator<const_iterator>; using size_type = size_t; using index_type = size_t; using difference_type = ptrdiff_t; static constexpr size_t extent = dynamic_extent; static constexpr bool is_dynamic_span = true; private: // i.e. if `Element` is const or const-volatile, make `T` same template <typename T> using cv_match_ = internal::match_cv<element_type, T>; template <typename T> constexpr static bool is_compatible = internal::is_compatible<element_type, T>; public: constexpr Span() noexcept : data_{nullptr}, size_{0} {} /// copy-construct dynamic-extent span from a static-extent span. template <typename SrcElement, size_type SrcExtent, std::enable_if_t<is_compatible<SrcElement>, int> = 0> constexpr Span(Span<SrcElement, SrcExtent> const& src) noexcept : data_{static_cast<pointer>(src.data())}, size_{SrcExtent} {} /// copy-construct dynamic-extent span from another dynamic-extent span. template <typename SrcElement, std::enable_if_t<is_compatible<SrcElement>, int> = 0> constexpr Span(Span<SrcElement, dynamic_extent> const& src) noexcept : data_{static_cast<pointer>(src.data())}, size_{src.size()} {} /// construct dynamic-extent span with an iterator/raw-pointer and a size template < typename Iterator, std::enable_if_t< std::is_convertible_v<Iterator&, iterator> && is_compatible<typename std::iterator_traits<Iterator>::value_type>, int> = 0> constexpr Span(Iterator begin, size_type size) noexcept : data_{static_cast<iterator>(begin)}, size_{size} {} /// construct dynamic-extent span with an iterator/raw-pointer and a size constexpr Span(iterator begin, size_type size) noexcept : data_{begin}, size_{size} {} /// construct dynamic-extent span from two iterators/raw-pointers. /// `end` must be greater than `begin`. (unchecked) /// /// Also, see checked `Span::try_init`. template < typename Iterator, std::enable_if_t< std::is_convertible_v<Iterator&, iterator> && is_compatible<typename std::iterator_traits<Iterator>::value_type>, int> = 0> constexpr Span(Iterator begin, Iterator end) noexcept : data_{begin}, size_{static_cast<size_type>(static_cast<iterator>(end) - static_cast<iterator>(begin))} {} /// construct dynamic-extent span from two iterators/raw-pointers. /// `end` must be greater than `begin`. (unchecked) /// /// Also, see checked `Span::try_init`. constexpr Span(iterator begin, iterator end) noexcept : data_{begin}, size_{static_cast<size_type>(end - begin)} {} /// factory function for constructing a span from two iterators/raw-pointers /// (checked). // /// constexpr since C++20. template < typename Iterator, std::enable_if_t< std::is_convertible_v<Iterator&, iterator> && is_compatible<typename std::iterator_traits<Iterator>::value_type>, int> = 0> static STX_OPTION_CONSTEXPR Option<Span> try_init(Iterator begin, Iterator end) noexcept { if (end < begin) return None; return Some(Span(static_cast<iterator>(begin), static_cast<iterator>(end))); } /// construct dynamic-extent span from array template <typename SrcElement, size_type Length, std::enable_if_t<is_compatible<SrcElement>, int> = 0> constexpr Span(SrcElement (&array)[Length]) : data_{static_cast<pointer>(array)}, size_{Length} {} /// construct span from any container. /// /// # NOTE /// /// use only for containers storing a contiguous sequence of elements. template <typename Container, std::enable_if_t< internal::is_container<Container&> && internal::is_compatible_container<Container&, element_type>, int> = 0> constexpr Span(Container& container) : data_{static_cast<pointer>(std::data(container))}, size_{std::size(container)} {} constexpr Span(Span const&) noexcept = default; constexpr Span(Span&&) noexcept = default; constexpr Span& operator=(Span const&) noexcept = default; constexpr Span& operator=(Span&&) noexcept = default; ~Span() noexcept = default; /// returns a pointer to the beginning of the sequence of elements. constexpr pointer data() const noexcept { return data_; }; /// returns the number of elements in the sequence. constexpr size_type size() const noexcept { return size_; }; /// returns the size of the sequence in bytes. constexpr size_type size_bytes() const noexcept { return size() * sizeof(element_type); } /// checks if the sequence is empty. constexpr bool empty() const noexcept { return size() == 0; }; /// returns an iterator to the beginning. constexpr iterator begin() const noexcept { return data_; }; /// returns an iterator to the end. constexpr iterator end() const noexcept { return begin() + size(); }; /// returns a constant iterator to the beginning. constexpr const_iterator cbegin() const noexcept { return begin(); }; /// returns a constant iterator to the end. constexpr const_iterator cend() const noexcept { return end(); }; /// returns a reverse iterator to the beginning. constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }; /// returns a reverse iterator to the end. constexpr reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }; /// returns a constant reverse iterator to the beginning. constexpr const_reverse_iterator crbegin() const noexcept { return rbegin(); }; /// returns a constant reverse iterator to the end. constexpr const_reverse_iterator crend() const noexcept { return rend(); }; /// accesses an element of the sequence (not bounds-checked). constexpr reference operator[](index_type index) const noexcept { return data()[index]; }; /// accesses an element of the sequence (bounds-checked). STX_OPTION_CONSTEXPR auto at(index_type index) const noexcept -> Option<Ref<element_type>> { if (index < size()) { return Some<Ref<element_type>>(data()[index]); } else { return None; } }; /// accesses an element of the sequence (bounds-checked). template <index_type Pos> STX_OPTION_CONSTEXPR auto at() const noexcept -> Option<Ref<element_type>> { if (Pos < size()) { return Some<Ref<element_type>>(data()[Pos]); } else { return None; } } /// obtains a subspan starting at an offset (not bounds-checked). constexpr Span<element_type> subspan(index_type offset) const noexcept { return Span<element_type>(begin() + offset, end()); }; /// obtains a subspan starting at an offset and with a length /// (not bounds-checked). constexpr Span<element_type> subspan(index_type offset, size_type length) const noexcept { return Span<element_type>(begin() + offset, length); }; /// obtains a subspan starting at an offset (bounds-checked). STX_OPTION_CONSTEXPR Option<Span<element_type>> try_subspan( index_type offset) const noexcept { if (offset >= size()) return None; return Some(subspan(offset)); }; /// obtains a subspan starting at an offset and with a length /// (bounds-checked). STX_OPTION_CONSTEXPR Option<Span<element_type>> try_subspan( index_type offset, size_type length) const noexcept { if (offset >= size()) return None; if (begin() + offset + length > end()) return None; return Some(subspan(offset, length)); }; /// obtains a subspan with offset provided via a template parameter /// (compile-time bounds-checked). template <index_type Offset> constexpr Span<element_type> subspan() const noexcept { return Span<element_type>(begin() + Offset, size() - Offset); } /// obtains a subspan with offset provided via a template parameter /// (compile-time bounds-checked). template <index_type Offset, size_type Length> constexpr Span<element_type, Length> subspan() const noexcept { return Span<element_type, Length>(begin() + Offset); } /// obtains a subspan with offset provided via a template parameter /// (bounds-checked). template <index_type Offset> STX_OPTION_CONSTEXPR Option<Span<element_type>> try_subspan() const noexcept { if (Offset >= size()) return None; return Some(Span<element_type>(begin() + Offset)); } /// obtains a subspan with offset and length provided via a template parameter /// (bounds-checked). template <index_type Offset, size_type Length> STX_OPTION_CONSTEXPR Option<Span<element_type, Length>> try_subspan() const noexcept { if (Offset >= size()) return None; if (begin() + Offset + Length > end()) return None; return Some(Span<element_type, Length>(begin() + Offset)); } /// converts the span into a view of its underlying bytes (represented with /// `std::byte`). constexpr Span<cv_match_<std::byte>> as_bytes() const noexcept { return Span<cv_match_<std::byte>>( reinterpret_cast<cv_match_<std::byte>*>(data()), size_bytes()); } /// converts the span into a view of its underlying bytes (represented with /// `uint8_t`). constexpr Span<cv_match_<uint8_t>> as_u8() const noexcept { return Span<cv_match_<uint8_t>>( reinterpret_cast<cv_match_<uint8_t>*>(data()), size_bytes()); } /// converts the span into an immutable span. constexpr Span<element_type const> as_const() const noexcept { return *this; } /// converts the span into another span in which reads /// and writes to the contiguous sequence are performed as volatile /// operations. constexpr Span<element_type volatile> as_volatile() const noexcept { return *this; } private: pointer data_; size_type size_; }; template <typename SrcElement, size_t Length> Span(SrcElement (&)[Length]) -> Span<SrcElement, Length>; template <typename SrcElement, size_t Length> Span(std::array<SrcElement, Length>&) -> Span<SrcElement, Length>; template <typename SrcElement, size_t Length> Span(std::array<SrcElement, Length> const&) -> Span<SrcElement const, Length>; template<typename Container> Span(Container& cont) -> Span<std::remove_pointer_t<decltype(std::data(cont))>>; STX_END_NAMESPACE
9,634
412
<gh_stars>100-1000 # encoding: utf-8 # Copyright 1999-2017 Alibaba Group Holding Ltd. # # 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 ..expr.exporters import get_ml_input """ K-Means related exporters """ def get_kmeans_input_append_col_idx(expr, input_name): data_obj = get_ml_input(expr, input_name) if data_obj is None: return None return ','.join([str(idx) for idx, f in enumerate(data_obj._ml_fields) if not f.is_partition])
308
2,126
from django.apps import AppConfig class DockerapiConfig(AppConfig): name = 'dockerapi'
29
852
// -*- C++ -*- // // Package: Records // Class : IdealGeometryRecord // // Implementation: // <Notes on implementation> // // Author: // Created: Mon Jul 25 11:05:09 EDT 2005 #include "Geometry/Records/interface/MTDDigiGeometryRecord.h" #include "FWCore/Framework/interface/eventsetuprecord_registration_macro.h" EVENTSETUP_RECORD_REG(MTDDigiGeometryRecord);
141
2,577
<gh_stars>1000+ # Copyright (C) Mesosphere, Inc. See LICENSE file for details. """This module provides a set of helper functions for tests. Attributes: LOG_LINE_SEARCH_INTERVAL (decimal): Defines (in seconds), intervals between subsequent scans of log buffers. """ import code import logging import os import re import signal import time import traceback from contextlib import contextmanager LOG_LINE_SEARCH_INTERVAL = 0.2 log = logging.getLogger(__name__) class GuardedSubprocess: """Context manager for Subprocess instances The purpose of this class is to provide reliable cleanup for all Subprocess class instances (AR & friends), no matter the tests results or errors. Using plain pytest fixture instead is difficult - some of the tests need to control when exactly i.e. AR is started and stopped. The test-scoped AR fixture would just start AR before running the test body and stop it right after it finishes. @contextlib.contextmanager decorator for some reason does not create context managers that work in some of the cases (__exit__ is not called). So for this reason we define one directly. """ def __init__(self, subp): self._subp = subp def __enter__(self): self._subp.start() def __exit__(self, *_): self._subp.stop() class SearchCriteria: """A helper class that is meant to group together search criteria for LineBufferFilter objects """ __slots__ = ['occurrences', 'exact'] def __init__(self, occurrences, exact): """Initialize new SearchCriteria object Attributes: occurrences (int): number of occurrences of the particular regexp in the buffer exact (bool): should the `occurrences` attribute be treated as `exact number of occurrences` (True), or `at least that many occurrences`. """ self.occurrences = occurrences self.exact = exact class LineBufferFilter: """Helper class for grepping line buffers created by LogCatcher class This class is meant to simplify searching of particular strings in line buffers created by LogCatcher object for subprocess run by this test harness. It exposes two interfaces: * context manager interface for isolating logs from particular event, i.e. lbf = LineBufferFilter(filter_regexp, line_buffer=ar_process.stderr_line_buffer) with lbf: resp = requests.get(url, allow_redirects=False, headers=header) assert lbf.extra_matches == {} In this case log buffer will be scanned only for entries that were added while executing the `requests.get()` call. * `.scan_log_buffer()` approach in case string should be searched from the beginning of the log. lbf = LineBufferFilter(filter_regexp, line_buffer=ar_process.stderr_line_buffer) lbf.scan_log_buffer() assert lbf.extra_matches == {} The result - whether the log was found or not can be determined using `extra_matches` property which provides detailed information about the lines matched and the number of occurrences. """ _filter_regexpes = None _line_buffer = None _line_buffer_start = None _timeout = None def __init__(self, filter_regexpes, line_buffer, timeout=3): """Initialize new LineBufferFilter object Create new LineBufferFilter object configured to search for string `filter_regexp` in line buffer `filter_regexp` for as much as `timeout` seconds. Args: line_buffer (list()): an array of log lines, as presented by `.*_line_buffer()` method of the object we want to scan lines for. timeout (int): how long before LineBufferFilter gives up on searching for filter_regexp in line_buffer filter_regexp: see below `filter_regexp` argument can have 3 forms: * regexp that the instance should look for in the logs. It has to be matched at least once. * a list of regexpes that the instance should look for in the logs. Each one of them has to be matched at least once. * a dictionary with regexp as a key and SearchCriteria object as the value. The SearchCriteria object determines how exactly given regexp is going to be matched """ assert isinstance(timeout, int) assert timeout >= LOG_LINE_SEARCH_INTERVAL assert isinstance(line_buffer, list) self._line_buffer = line_buffer self._timeout = timeout self._filter_regexpes = filter_regexpes def __enter__(self): assert self._line_buffer_start is None assert self._line_buffer is not None self._line_buffer_start = len(self._line_buffer) return self def scan_log_buffer(self): """Scan for `filter_regexp` since the beginning of the given instance's log This is a convenience function that forces search of the `filter_regexp` since the beginning of the log buffer. It's does by simply fixing the start position and calling the __exit__() method of the context manager """ # Bit hacky, but good enough™ self._line_buffer_start = 0 self.__exit__() def _match_line_against_filter_regexpes(self, line): """Helper method that abstracts matching of the line against multiple regexpes. Each match is registered, so that it's possible to determine if search criteria were met. Arguments: line (str): a line to match """ for filter_regexp in self._filter_regexpes: if re.search(filter_regexp, line, flags=0): sc = self._filter_regexpes[filter_regexp] if sc.exact and sc.occurrences <= 0: log.warning("filter string `%s` matched more times than requested", filter_regexp) sc.occurrences -= 1 def __exit__(self, *unused): """Context manager __exit__ method for filter string search This is the heart of the LineBufferFilter - the whole matching happens here. """ msg_fmt = "Beginning to scan for line `%s` in logline buffer" log.debug(msg_fmt, list(self._filter_regexpes.keys())) deadline = time.time() + self._timeout while time.time() < deadline: lines_scanned = 0 for log_line in self._line_buffer[self._line_buffer_start:]: self._match_line_against_filter_regexpes(log_line) if self._all_found: return lines_scanned += 1 self._line_buffer_start = self._line_buffer_start + lines_scanned msg_fmt = "waiting for strings `%s` to appear in logline buffer" log.debug(msg_fmt, self._regexpes_still_not_matched) time.sleep(LOG_LINE_SEARCH_INTERVAL) msg_fmt = "Timed out while waiting for strings `%s` to appear in logline buffer" log.debug(msg_fmt, self._regexpes_still_not_matched) @property def _regexpes_still_not_matched(self): """Helper function that returns a list of regexpes that still has not met search criterias""" return [x for x in self._filter_regexpes if self._filter_regexpes[x].occurrences > 0] @property def _all_found(self): """Helper - check if all search criterias have been met ? """ return all([sc.occurrences <= 0 for sc in self._filter_regexpes.values()]) @property def extra_matches(self): """Detailed information about regexpes that has and/or has not been matched. This property can be useful if i.e. there were mixed search criterias - some of the regexpes had to be strictly matched, some not. Return: It returns a dictionary with regexpes from `filter_regexpes` argument of `__init__()` as keys and the number of matches as values. This number can have 3 different values: * if the regexp was matched exactly the number of times specified (once for regexp and list of regexpes `filter_regexpes` argument), it has a value of zero and the key is not present in the resulting dictionary * if the input has not been matched at all in case of regexp and list of regexpes `filter_regexpes` argument, or less than requested number of times in case of detailed `filter_regexpes` form, it's a positive number * if the input has been matched more times than anticipated - a negative number. Usually it's used in `assert lbf.extra_matches == {}` form in tests """ left = {} for filter_regexp in self._filter_regexpes: search_criteria = self._filter_regexpes[filter_regexp] if search_criteria.occurrences > 0 or \ search_criteria.exact and search_criteria.occurrences < 0: search_criteria.occurrences = -search_criteria.occurrences left[filter_regexp] = search_criteria.occurrences return left def configure_logger(tests_log_level): """ Set up a logging basing on pytest cmd line args. Configure log verbosity basing on the --log-level command line argument (disabled by default). Additionally write all logs to a file (inc. DEBUG loglevel information). Arguments: tests_log_level: log level to use for STDOUT output """ rootlogger = logging.getLogger() rootlogger.handlers = [] # Set up a stderr handler for the root logger, and specify the format. fmt = "%(asctime)s.%(msecs)03d %(name)s:%(lineno)s %(levelname)s: %(message)s" formatter = logging.Formatter( fmt=fmt, datefmt="%y%m%d-%H:%M:%S" ) # Root logger should pass everything rootlogger.setLevel(logging.DEBUG) # create file handler which logs everything to a file cur_dir = os.path.dirname(__file__) log_path = os.path.abspath(os.path.join( cur_dir, "..", "logs", "test-harness.log")) fh = logging.FileHandler(log_path, mode='w', encoding='utf8') fh.setLevel(logging.DEBUG) fh.setFormatter(formatter) rootlogger.addHandler(fh) if tests_log_level != 'disabled': # create console handler with a higher log level ch = logging.StreamHandler() level = getattr(logging, tests_log_level.upper()) ch.setLevel(level) ch.setFormatter(formatter) rootlogger.addHandler(ch) def add_lo_ipaddr(nflink, ip_addr, prefix_len): """Add an ipv4 address to loopback interface. Add an ipv4 address to loopback provided that it does not already exist. Args: nflink: a pyroute2.IPRoute() object/NFLINK connection ip_addr (str): IP address prefix_len (int): prefix length """ idx = nflink.link_lookup(ifname='lo')[0] existing_ips = nflink.get_addr(index=idx) for existing_ip in existing_ips: if existing_ip['family'] != 2: # Only support only ipv4 for now, so this one is not ours continue if existing_ip['prefixlen'] != prefix_len: # Not ours, but yes - same IP with different prefix will bork # things up. But this should not happen during normal OP. continue for attr in existing_ip['attrs']: if attr[0] == "IFA_ADDRESS" and attr[1] == ip_addr: msg_fmt = "Not adding addres `%s/%s`` as it already exists`" log.info(msg_fmt, ip_addr, prefix_len) return nflink.addr('add', index=idx, address=ip_addr, mask=prefix_len) def del_lo_ipaddr(nflink, ip_addr, prefix_len): """Remove ipv4 address from loopback interface Remove existing ipv4 address, defined by ip_addr and prefix_len, from loopback interface. Args: nflink: a pyroute2.IPRoute() object/NFLINK connection ip_addr (str): IP address prefix_len (int): prefix length Raises: NetlinkError: failed to remove address, check exception data for details. """ idx = nflink.link_lookup(ifname='lo')[0] nflink.addr('del', index=idx, address=ip_addr, mask=prefix_len) def setup_thread_debugger(): """Setup a thread debbuger for pytest session This function, based on http://stackoverflow.com/a/133384, is meant to add debugging facility to pytest that will allow to debug deadlock that may sometimes occur. """ def debug(signal, frame): """Interrupt running process and provide a python prompt for interactive debugging.""" d = {'_frame': frame} # Allow access to frame object. d.update(frame.f_globals) # Unless shadowed by global d.update(frame.f_locals) i = code.InteractiveConsole(d) message = "Signal received : entering python shell.\nTraceback:\n" message += ''.join(traceback.format_stack(frame)) i.interact(message) signal.signal(signal.SIGUSR1, debug) # Register handler def ar_listen_link_setup(role, is_ee): assert role in ['master', 'agent'] if is_ee: flavour = 'ee' else: flavour = 'open' src_path = "/opt/mesosphere/etc/adminrouter-listen-{}.conf".format(flavour) dst_path = "adminrouter-listen-{}.conf".format(role) if os.path.exists(src_path): assert os.path.islink(src_path) cur_dst_path = os.readlink(src_path) if cur_dst_path != dst_path: os.unlink(src_path) os.symlink(dst_path, src_path) return os.symlink(dst_path, src_path) @contextmanager def iam_denies_all_requests(mocker_instance): """Modifies IAM mock configuration to deny all policyquery requests""" mocker_instance.send_command( endpoint_id='http://127.0.0.1:8101', func_name='deny_all_queries', ) yield mocker_instance.send_command( endpoint_id='http://127.0.0.1:8101', func_name='permit_all_queries', ) def auth_type_str(repo_type): """Return valid authentication type string for given cluster type Arguments: repo_type (bool): True/False, depending on wheter it is an EE cluster or not. Returns: String denoting valid authentication type string as used in WWW-Authenticate header. """ if repo_type: return 'acsjwt' else: return 'oauthjwt' def jwt_type_str(repo_type): """Return valid JWT type string for given cluster type Arguments: repo_type (bool): True/False, depending on wheter it is an EE cluster or not. Returns: String denoting JWT type string. """ if repo_type: return 'RS256' else: return 'HS256'
6,076
589
package rocks.inspectit.agent.java.sensor.method.remote.server.mq; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.nullValue; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; import java.util.Collections; import java.util.Enumeration; import java.util.Map; import java.util.Map.Entry; import org.mockito.InjectMocks; import org.mockito.Mock; import org.testng.annotations.Test; import io.opentracing.propagation.Format; import io.opentracing.propagation.TextMap; import io.opentracing.tag.Tags; import rocks.inspectit.agent.java.config.impl.RegisteredSensorConfig; import rocks.inspectit.agent.java.tracing.core.adapter.ResponseAdapter; import rocks.inspectit.agent.java.tracing.core.adapter.ServerRequestAdapter; import rocks.inspectit.agent.java.tracing.core.adapter.SpanContextStore; import rocks.inspectit.agent.java.tracing.core.adapter.store.NoopSpanContextStore; import rocks.inspectit.shared.all.testbase.TestBase; import rocks.inspectit.shared.all.tracing.constants.ExtraTags; import rocks.inspectit.shared.all.tracing.data.PropagationType; /** * @author <NAME> * */ @SuppressWarnings("PMD") public class JmsListenerRemoteServerSensorTest extends TestBase { @InjectMocks JmsListenerRemoteServerSensor sensor; @Mock RegisteredSensorConfig rsc; public static class GetServerRequestAdapter extends JmsListenerRemoteServerSensorTest { @Mock Object object; @Mock Message message; @Mock Destination jmsDestination; @Test public void properties() { ServerRequestAdapter<TextMap> adapter = sensor.getServerRequestAdapter(object, new Object[] { message }, rsc); assertThat(adapter.getPropagationType(), is(PropagationType.JMS)); assertThat(adapter.getFormat(), is(Format.Builtin.TEXT_MAP)); verifyZeroInteractions(object, rsc); } @Test public void destination() throws Exception { String destination = "destination"; when(message.getJMSDestination()).thenReturn(jmsDestination); when(jmsDestination.toString()).thenReturn(destination); ServerRequestAdapter<TextMap> adapter = sensor.getServerRequestAdapter(object, new Object[] { message }, rsc); Map<String, String> tags = adapter.getTags(); assertThat(tags.size(), is(1)); assertThat(tags, hasEntry(ExtraTags.JMS_MESSAGE_DESTINATION, destination)); verifyZeroInteractions(object, rsc); } @Test public void destinationNull() throws Exception { when(message.getJMSDestination()).thenReturn(null); ServerRequestAdapter<TextMap> adapter = sensor.getServerRequestAdapter(object, new Object[] { message }, rsc); Map<String, String> tags = adapter.getTags(); assertThat(tags.size(), is(0)); verifyZeroInteractions(object, rsc); } @Test public void destinationException() throws Exception { when(message.getJMSDestination()).thenThrow(new Exception()); ServerRequestAdapter<TextMap> adapter = sensor.getServerRequestAdapter(object, new Object[] { message }, rsc); Map<String, String> tags = adapter.getTags(); assertThat(tags.size(), is(0)); verifyZeroInteractions(object, rsc); } @Test public void messageId() throws Exception { String id = "id"; when(message.getJMSMessageID()).thenReturn(id); ServerRequestAdapter<TextMap> adapter = sensor.getServerRequestAdapter(object, new Object[] { message }, rsc); Map<String, String> tags = adapter.getTags(); assertThat(tags.size(), is(1)); assertThat(tags, hasEntry(ExtraTags.JMS_MESSAGE_ID, id)); verifyZeroInteractions(object, rsc); } @Test public void messageIdException() throws Exception { when(message.getJMSMessageID()).thenThrow(new Exception()); ServerRequestAdapter<TextMap> adapter = sensor.getServerRequestAdapter(object, new Object[] { message }, rsc); Map<String, String> tags = adapter.getTags(); assertThat(tags.size(), is(0)); verifyZeroInteractions(object, rsc); } @Test public void baggageExtraction() throws Exception { String key = "key"; String value = "value"; when(message.getStringProperty(key)).thenReturn(value); doReturn(Collections.enumeration(Collections.singleton(key))).when(message).getPropertyNames(); ServerRequestAdapter<TextMap> adapter = sensor.getServerRequestAdapter(object, new Object[] { message }, rsc); Entry<String, String> next = adapter.getCarrier().iterator().next(); assertThat(next.getKey(), is(key)); assertThat(next.getValue(), is(value)); assertThat(adapter.getCarrier().iterator().hasNext(), is(false)); verifyZeroInteractions(object, rsc); } @Test public void baggageExtractionEnumerationEmpty() throws Exception { doReturn(Collections.enumeration(Collections.emptyList())).when(message).getPropertyNames(); ServerRequestAdapter<TextMap> adapter = sensor.getServerRequestAdapter(object, new Object[] { message }, rsc); assertThat(adapter.getCarrier().iterator().hasNext(), is(false)); verifyZeroInteractions(object, rsc); } @Test public void baggageExtractionEnumerationNull() throws Exception { doReturn(null).when(message).getPropertyNames(); ServerRequestAdapter<TextMap> adapter = sensor.getServerRequestAdapter(object, new Object[] { message }, rsc); assertThat(adapter.getCarrier().iterator().hasNext(), is(false)); verifyZeroInteractions(object, rsc); } @Test public void contextStore() { ServerRequestAdapter<TextMap> adapter = sensor.getServerRequestAdapter(object, new Object[] { message }, rsc); SpanContextStore spanContextStore = adapter.getSpanContextStore(); assertThat(spanContextStore, is(not(nullValue()))); assertThat(spanContextStore, is(instanceOf(NoopSpanContextStore.class))); verifyZeroInteractions(object, rsc); } } public static class GetServerResponseAdapter extends JmsListenerRemoteServerSensorTest { @Mock Object object; @Mock Object result; @Test public void empty() { ResponseAdapter adapter = sensor.getServerResponseAdapter(object, null, result, false, rsc); Map<String, String> tags = adapter.getTags(); assertThat(tags.size(), is(0)); verifyZeroInteractions(object, result, rsc); } @Test public void exception() { ResponseAdapter adapter = sensor.getServerResponseAdapter(object, null, new NullPointerException(), true, rsc); Map<String, String> tags = adapter.getTags(); assertThat(tags.size(), is(2)); assertThat(tags, hasEntry(Tags.ERROR.getKey(), String.valueOf(true))); assertThat(tags, hasEntry(ExtraTags.THROWABLE_TYPE, NullPointerException.class.getSimpleName())); verifyZeroInteractions(object, rsc); } } interface Message { Destination getJMSDestination() throws Exception; String getJMSMessageID() throws Exception; String getStringProperty(String key); Enumeration<?> getPropertyNames(); }; interface Destination { }; }
2,343
1,016
/** * */ package com.thinkbiganalytics.metadata.rest.model.data; /*- * #%L * thinkbig-metadata-rest-model * %% * Copyright (C) 2017 ThinkBig Analytics * %% * 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. * #L% */ import java.util.ArrayList; import java.util.List; /** * */ public class HiveTableDatasource extends Datasource { private static final long serialVersionUID = -4852310850422331907L; private String database; private String tableName; private String modifiers; private List<HiveTableColumn> columns = new ArrayList<>(); private List<HiveTablePartition> partitions = new ArrayList<>(); public HiveTableDatasource() { super(); } public HiveTableDatasource(String name, String database, String tableName) { super(name); this.database = database; this.tableName = tableName; } public String getDatabase() { return database; } public void setDatabase(String database) { this.database = database; } public String getTableName() { return tableName; } public void setTableName(String tableName) { this.tableName = tableName; } public String getModifiers() { return modifiers; } public void setModifiers(String modifiers) { this.modifiers = modifiers; } public List<HiveTableColumn> getColumns() { return columns; } public void setFields(List<HiveTableColumn> fields) { this.columns = fields; } public List<HiveTablePartition> getPartitions() { return partitions; } public void setPartitions(List<HiveTablePartition> partitions) { this.partitions = partitions; } }
765
777
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/keyed_service/ios/browser_state_keyed_service_factory.h" #include "base/logging.h" #include "components/keyed_service/core/keyed_service.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "ios/web/public/browser_state.h" void BrowserStateKeyedServiceFactory::SetTestingFactory( web::BrowserState* context, TestingFactoryFunction testing_factory) { KeyedServiceFactory::SetTestingFactory( context, reinterpret_cast<KeyedServiceFactory::TestingFactoryFunction>( testing_factory)); } KeyedService* BrowserStateKeyedServiceFactory::SetTestingFactoryAndUse( web::BrowserState* context, TestingFactoryFunction testing_factory) { return KeyedServiceFactory::SetTestingFactoryAndUse( context, reinterpret_cast<KeyedServiceFactory::TestingFactoryFunction>( testing_factory)); } BrowserStateKeyedServiceFactory::BrowserStateKeyedServiceFactory( const char* name, BrowserStateDependencyManager* manager) : KeyedServiceFactory(name, manager) { } BrowserStateKeyedServiceFactory::~BrowserStateKeyedServiceFactory() { } KeyedService* BrowserStateKeyedServiceFactory::GetServiceForBrowserState( web::BrowserState* context, bool create) { return KeyedServiceFactory::GetServiceForContext(context, create); } web::BrowserState* BrowserStateKeyedServiceFactory::GetBrowserStateToUse( web::BrowserState* context) const { DCHECK(CalledOnValidThread()); #ifndef NDEBUG AssertContextWasntDestroyed(context); #endif // Safe default for Incognito mode: no service. if (context->IsOffTheRecord()) return nullptr; return context; } bool BrowserStateKeyedServiceFactory::ServiceIsCreatedWithBrowserState() const { return KeyedServiceBaseFactory::ServiceIsCreatedWithContext(); } bool BrowserStateKeyedServiceFactory::ServiceIsNULLWhileTesting() const { return KeyedServiceBaseFactory::ServiceIsNULLWhileTesting(); } void BrowserStateKeyedServiceFactory::BrowserStateShutdown( web::BrowserState* context) { KeyedServiceFactory::ContextShutdown(context); } void BrowserStateKeyedServiceFactory::BrowserStateDestroyed( web::BrowserState* context) { KeyedServiceFactory::ContextDestroyed(context); } std::unique_ptr<KeyedService> BrowserStateKeyedServiceFactory::BuildServiceInstanceFor( base::SupportsUserData* context) const { return BuildServiceInstanceFor(static_cast<web::BrowserState*>(context)); } bool BrowserStateKeyedServiceFactory::IsOffTheRecord( base::SupportsUserData* context) const { return static_cast<web::BrowserState*>(context)->IsOffTheRecord(); } base::SupportsUserData* BrowserStateKeyedServiceFactory::GetContextToUse( base::SupportsUserData* context) const { return GetBrowserStateToUse(static_cast<web::BrowserState*>(context)); } bool BrowserStateKeyedServiceFactory::ServiceIsCreatedWithContext() const { return ServiceIsCreatedWithBrowserState(); } void BrowserStateKeyedServiceFactory::ContextShutdown( base::SupportsUserData* context) { BrowserStateShutdown(static_cast<web::BrowserState*>(context)); } void BrowserStateKeyedServiceFactory::ContextDestroyed( base::SupportsUserData* context) { BrowserStateDestroyed(static_cast<web::BrowserState*>(context)); } void BrowserStateKeyedServiceFactory::RegisterPrefs( user_prefs::PrefRegistrySyncable* registry) { RegisterBrowserStatePrefs(registry); }
1,087
6,270
[ { "type": "bugfix", "category": "S3", "description": "fix putObject using stream <1mb" }, { "type": "feature", "category": "CognitoIdentityServiceProvider", "description": "Amazon Cognito now has API support for updating the Secure Sockets Layer (SSL) certificate for the custom domain for your user pool." }, { "type": "feature", "category": "Comprehend", "description": "This SDK release adds functionality to stop training Custom Document Classifier or Custom Entity Recognizer in Amazon Comprehend." }, { "type": "feature", "category": "Firehose", "description": "Support for specifying customized s3 keys and supplying a separate prefix for failed-records" }, { "type": "feature", "category": "KinesisVideoMedia", "description": "enable cors to make KinesisVideoMedia available by default in browser build" }, { "type": "feature", "category": "MediaLive", "description": "This release provides support for ID3 tags and video quality setting for subgop_length." }, { "type": "feature", "category": "TranscribeService", "description": "With this release, Amazon Transcribe now supports transcriptions from audio sources in Italian (it-IT)." } ]
506
850
<filename>app/classifier/classifier.cc<gh_stars>100-1000 /************************************************************************ * Author: Sundy * E-mail: <EMAIL> * Date: Jan 09,2018 ************************************************************************/ #include <fstream> #include <utility> #include <vector> #include <direct.h> #include <numeric> #include <iomanip> #include "tensorflow/cc/ops/const_op.h" #include "tensorflow/cc/ops/image_ops.h" #include "tensorflow/cc/ops/standard_ops.h" #include "tensorflow/core/framework/graph.pb.h" #include "tensorflow/core/framework/tensor.h" #include "tensorflow/core/graph/default_device.h" #include "tensorflow/core/graph/graph_def_builder.h" #include "tensorflow/core/lib/core/errors.h" #include "tensorflow/core/lib/core/stringpiece.h" #include "tensorflow/core/lib/core/threadpool.h" #include "tensorflow/core/lib/io/path.h" #include "tensorflow/core/lib/strings/stringprintf.h" #include "tensorflow/core/platform/env.h" #include "tensorflow/core/platform/init_main.h" #include "tensorflow/core/platform/logging.h" #include "tensorflow/core/platform/types.h" #include "tensorflow/core/public/session.h" #include "tensorflow/core/util/command_line_flags.h" #include "tensorflow/cc/ops/standard_ops.h" #include "tensorflow/core/public/session_options.h" #include <tensorflow/core/protobuf/meta_graph.pb.h> #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/highgui/highgui.hpp" #include "misc.h" #include "libconvert.h" using namespace cv; using namespace std; // These are all common classes it's handy to reference with no namespace. using tensorflow::Flag; using tensorflow::Tensor; using tensorflow::Status; using tensorflow::string; using tensorflow::int32; using namespace tensorflow; using namespace tensorflow::ops; struct defectBlob { int type; float confidence; cv::Rect defectRect; std::vector<cv::Point> vpts; }; struct DefectInfo { float confidence; std::vector<defectBlob> vDefects; std::shared_ptr<cv::Mat> pDefectImage_; }; static void formatFprintf(std::string& str, const char* format, ...) { char s[1000]; va_list arg_ptr; va_start(arg_ptr, format); vsprintf(s, format, arg_ptr); va_end(arg_ptr); str += s; } static std::string formatTime() { time_t now = time(0); struct tm tstruct; char buf[80]; tstruct = *localtime(&now); strftime(buf, sizeof(buf), "%Y-%m-%d-%H-%M-%S", &tstruct); return buf; } static void writeStringAppendFile(const std::string& str, FILE *fp) { int length = str.length(); fwrite(str.c_str(), length, 1, fp); fputc('\n', fp); } int mat2Tensor(std::vector<cv::Mat>& mats, Tensor& inputImg) { auto start = std::chrono::system_clock::now(); int dims = mats.size(); #pragma omp parallel for (int mt = 0; mt < dims; mt++) { cv::Mat mat = mats[mt]; // NHWC in tensorflow int width = mat.cols; int height = mat.rows; int depth = mat.channels();; if (depth == 1) { mat.convertTo(mat, CV_32FC1); } else if (depth == 3) { mat.convertTo(mat, CV_32FC3); } //string save_name = "data/mat2Tensor_" + std::to_string(mt) + ".png"; //imwrite(save_name, mat); auto inputImageMapped = inputImg.tensor<float, 4>(); // 4 tensors //Copy all the data over for (int y = 0; y < height; ++y) { const float* source_row = ((float*)mat.data) + (y * width * depth); for (int x = 0; x < width; ++x) { const float* source_pixel = source_row + (x * depth); for (int c = 0; c < depth; ++c) { const float* source_value = source_pixel + c; inputImageMapped(mt, y, x, c) = *source_value; } } } } auto end = std::chrono::system_clock::now(); //LOG(INFO) << "Convert mat to tensors took " //std::cout << "Convert mat to tensors took " << std::chrono::duration_cast<std::chrono::microseconds>(end - start).count() / 1000.0 << "ms.\n"; return 0; } int main(int argc, char* argv[]) { string graph = "model/mpb/gpuver.pb"; string labels = "model/mpb/label.txt"; int32 input_height = 1344; int32 input_width = 768; int32 window_height = 822; int32 window_width = 612; int batch = 4; float factor = 0.25; string root_dir = "."; string file_list = "data"; string file_path = tensorflow::io::JoinPath(root_dir, "data/"); //int load_color = 0; int load_channel = 1; int only_channel = 0; int smooth = 0; float input_mean = 0; float input_std = 255; string input_layer = "X"; string output_layer = "Y_out"; int save_image = 0; int method = 1; std::vector<Flag> flag_list = { Flag("graph", &graph, "graph to be executed"), Flag("labels", &labels, "name of file containing labels"), Flag("input_height", &input_height, "resize image to this height in pixels"), Flag("input_width", &input_width, "resize image to this width in pixels"), Flag("window_height", &window_height, "the height of sliding window images."), Flag("window_width", &window_width, "the width of sliding window images."), Flag("factor", &factor, "the down sample factor."), //Flag("load_color", &load_color, "load color image or not."), Flag("load_channel", &load_channel, "number of channel."), Flag("smooth", &smooth, "number of channel."), Flag("root_dir", &root_dir, "interpret image and graph file names relative to this directory"), Flag("file_path", &file_path, "image test folder"), Flag("save_image", &save_image, "save the result image?(1:NG,2:OK,3:both OK and NG.)"), Flag("batch", &batch, "the number of batchs to test."), Flag("method", &method, "load graph method(1:load graph.pb, 2: load checkpoint file).") }; string usage = tensorflow::Flags::Usage(argv[0], flag_list); const bool parse_result = tensorflow::Flags::Parse(&argc, argv, flag_list); if (!parse_result) { LOG(ERROR) << usage; return -1; } // We need to call this to set up global state for TensorFlow. tensorflow::port::InitMain(argv[0], &argc, &argv); if (argc > 1) { LOG(ERROR) << "Unknown argument " << argv[1] << "\n" << usage; return -1; } ///////////////////////////////////////////////////////////////////// SessionOptions options; std::unique_ptr < tensorflow::Session> session_; //options.config.device_filters(0) options.config.set_allow_soft_placement(true); //options.config.set_inter_op_parallelism_threads(1); //options.config.set_intra_op_parallelism_threads(1); //options.config.set_log_device_placement(true); session_.reset(tensorflow::NewSession(options)); if (session_ == nullptr) { throw runtime_error("Could not create Tensorflow session."); } string pathToGraph; string checkpointPath; if (graph.empty()) { pathToGraph = "model/mckp/model.meta"; checkpointPath = "model/mckp/model"; } else { checkpointPath = graph; pathToGraph = graph + ".meta"; } Status status; // Read in the protobuf graph we exported MetaGraphDef graph_def; status = ReadBinaryProto(Env::Default(), pathToGraph, &graph_def); if (!status.ok()) { throw runtime_error("Error reading graph definition from " + pathToGraph + ": " + status.ToString()); } // Add the graph to the session status = session_->Create(graph_def.graph_def()); if (!status.ok()) { throw runtime_error("Error creating graph: " + status.ToString()); } // Read weights from the saved checkpoint Tensor checkpointPathTensor(DT_STRING, TensorShape()); checkpointPathTensor.scalar<std::string>()() = checkpointPath; status = session_->Run({ { graph_def.saver_def().filename_tensor_name(), checkpointPathTensor }, }, {}, { graph_def.saver_def().restore_op_name() }, nullptr); if (!status.ok()) { throw runtime_error("Error loading checkpoint from " + checkpointPath + ": " + status.ToString()); } Tensor phase_train_ = Tensor(DT_BOOL, TensorShape()); phase_train_.scalar<bool>()() = false; //////////////////////////////////////////////////////////////////// auto files = get_files(file_path, "/file.txt"); std::sort(files.begin(), files.end()); _mkdir((file_path + "/NG").c_str()); _mkdir((file_path + "/OK").c_str()); std::string fileNameOK = file_path + "/OK/" + "OK_file_list.txt"; std::string fileNameNG = file_path + "/NG/" + "NG_file_list.txt"; char *okDir = new char[fileNameOK.length() + 1]; char *ngDir = new char[fileNameNG.length() + 1]; strcpy(okDir, fileNameOK.c_str()); strcpy(ngDir, fileNameNG.c_str()); FILE *fpOK = fopen(okDir, "wb"); FILE *fpNG = fopen(ngDir, "wb"); int retNG = 0; int retOK = 0; //split images int x_start = 0; int y_start = 0; for (auto fln: files) { auto start = std::chrono::system_clock::now(); std::cout<< "##############" << fln << "##############"<<std::endl; if (fln.substr(fln.length() - 3) == "txt") { continue; } cv::Mat image_mat = cv::imread(file_path + fln, CV_LOAD_IMAGE_UNCHANGED); if (image_mat.empty()) { LOG(INFO) << "Could not read " << fln ; continue; } int c_ = image_mat.channels(); if (load_channel == 1) { if (c_ != 1) { std::vector<cv::Mat> vec_mats; split(image_mat, vec_mats); image_mat = vec_mats[only_channel]; } } else if (load_channel == 3) { if (c_ != 3) { cv::cvtColor(image_mat, image_mat, CV_GRAY2BGR); } } else { fprintf(stdout,"error channel number!"); break; } int overlap_ = 0.5; int gray_threshold_ = 100; if (smooth == 1) { GaussianBlur(image_mat, image_mat, cv::Size(3, 3), 0, 0); } int x_end = image_mat.cols - window_width; int y_end = image_mat.rows - window_height; DefectInfo defectInfoN; defectInfoN.confidence = 0; defectInfoN.pDefectImage_ = std::make_shared<cv::Mat>(image_mat.rows, image_mat.cols, CV_8U); defectInfoN.vDefects.clear(); (*defectInfoN.pDefectImage_) = 0; //fprintf(stdout, "Splitting image...\n"); std::vector<cv::Mat> vec_mat; std::vector<cv::Rect> split_rects_; int sum_mat = 0; for (int x = x_start; x < x_end; x += window_width/2) { for (int y = y_start; y < y_end; y += window_height/2) { cv::Rect rect(x, y, window_width , window_height); cv::Mat sub_mat = image_mat(rect); split_rects_.push_back(rect); vec_mat.push_back(sub_mat); sum_mat++; } } std::cout << "Sum of blocks:" << sum_mat << std::endl; double max_value = 0; double min_value = 0; int countC1 = 0; int countC2 = 0; for (size_t i = 0; i < sum_mat; i++) { std::vector<cv::Mat> mats; mats.reserve(1); cv::Mat preMat = vec_mat.at(i); mats.push_back(preMat); //cv::minMaxIdx(preMat, &min_value, &max_value); //if (max_value < 100 ) { // continue; //} Tensor input_batch; if (load_channel == 1) { input_batch = Tensor(DT_FLOAT, TensorShape({ batch,window_height,window_width,1 })); //1, height, width, dept } else if (load_channel == 3) { input_batch = Tensor(DT_FLOAT, TensorShape({ batch,window_height,window_width,3 })); //3, height, width, dept } mat2Tensor(mats, input_batch); std::pair<string, Tensor> input1 = { "X",input_batch }; std::pair<string, Tensor> input2 = { "phase",phase_train_ }; // Actually run the image through the model. std::vector<Tensor> outputs; Status run_status = session_->Run({ input1,input2 }, { "Y_out" }, {}, &outputs); if (!run_status.ok()) { LOG(ERROR) << "Running model failed: " << run_status; return -1; } // Do something interesting with the results we've generated. Tensor outTensor = outputs[0]; int numT = outTensor.NumElements(); auto retMatrix = outputs[0].matrix<float>(); //std::cout << retMatrix<< std::endl; // get the average score of from output tensor float conf_threshold = 0.5; std::vector<float> results; int flag = 0; for (int j = 0; j < numT / 2; j++) { float pos_score = retMatrix(j, 0); if ((pos_score > retMatrix(j, 1)) && (pos_score >= 0.5)) { results.push_back(pos_score); flag++; } } if (flag) { float avg_conf = std::accumulate(results.begin(), results.end(), 0) / results.size() * 1.0f; if (avg_conf >= conf_threshold) { defectBlob dInfo; dInfo.type = 1; dInfo.confidence = avg_conf; dInfo.defectRect = split_rects_[i]; defectInfoN.vDefects.push_back(dInfo); } } } int sum_defects = defectInfoN.vDefects.size(); std::cout << "Sum of defects:" << sum_defects << std::endl; for (size_t i = 0; i < sum_defects; i++) { auto& di = defectInfoN.vDefects[i]; uint8_t v = std::max(0.0, di.confidence - 0.5) * 2 * 192 + 63; cv::circle(*defectInfoN.pDefectImage_, cv::Point(di.defectRect.x + window_width / 2, di.defectRect.y + window_height / 2), window_height / 2, cv::Scalar(v, v, v), -1); cv::Rect drect = di.defectRect; if (save_image == 100) { string save_name = fln + "@" + to_string(drect.x) + "_" + to_string(drect.y) + ".png"; _mkdir("./NG"); imwrite("./NG/" + save_name, image_mat(drect)); } } cv::Mat output_img = *(defectInfoN.pDefectImage_.get()); if (c_ == 1) { cv::cvtColor(image_mat, image_mat, CV_GRAY2BGR); image_mat = image_mat*0.5; } cv::Mat chs[3]; if (image_mat.channels() == 1) { chs[0] = image_mat; chs[1] = image_mat; chs[2] = image_mat.clone(); output_img.copyTo(chs[2]); } else if (image_mat.channels() == 3) { split(image_mat, chs); output_img.copyTo(chs[2], output_img); } //marking defect on defect image for (auto &di : defectInfoN.vDefects) { string str_info; std::stringstream stream; cv::Rect drect = di.defectRect; formatFprintf(str_info, "%d, %d, %d, %d, %f\n", drect.x, drect.y, drect.width, drect.height, di.confidence); writeStringAppendFile(str_info, fpNG); stream << di.confidence * 100; string str_confidence = stream.str(); auto color = cv::Scalar(255, 255, 255); putText(chs[1], str_confidence, cv::Point(drect.x + int(0.5 * drect.width) - 10, drect.y + int(0.5 * drect.height) + 5), CV_FONT_HERSHEY_SIMPLEX, 0.5, color); } if (sum_defects > 0) { cv::Mat output_defect_img; cv::merge(chs, 3, output_defect_img); if (save_image == 0) { convert::writeStringAppendToFile(fln, fpNG); } else if(save_image == 1 || save_image == 3) { cv::imwrite(file_path + "/NG/" + fln + "_" + std::to_string(sum_defects) + ".png", output_defect_img); convert::writeStringAppendToFile(fln, fpNG); } retNG++; } else { if (save_image == 0) { convert::writeStringAppendToFile(fln, fpOK); } else if (save_image == 2 || save_image == 3) { cv::imwrite(file_path + "/OK/" + fln, image_mat); convert::writeStringAppendToFile(fln, fpOK); } retOK++; } auto end = std::chrono::system_clock::now(); std::cout << "All took " << std::chrono::duration_cast<std::chrono::microseconds>(end - start).count() / 1000.0 << "ms.\n"; } float sum = (retNG + retOK)*1.0f; std::cout << "OK: " << retOK << "(" << retOK / sum << ")" << ",NG: " << retNG << "(" << retNG / sum << ")" << std::endl; std::cout << "Sum of testing " << retNG + retOK << " pcs." << std::endl; fclose(fpOK); fclose(fpNG); return 0; }
6,098
2,177
package org.nutz.mvc.testapp.classes.action.mapping; import org.nutz.mvc.annotation.ApiVersion; import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.Ok; @Ok("raw") @At("/mapping/issue1530/{version}") @ApiVersion("v1") public class Issue1530MappingAction { @ApiVersion("v1") @At("/yourname/?") public String getYourName(String name) { return "v1-" + name; } @ApiVersion("v2") @At("/yourname/?") public String getYourName2(int age) { return "v2-" + age; } }
239
301
package qouteall.imm_ptl.core.ducks; import net.minecraft.client.world.ClientWorld; public interface IEParticleManager { void ip_setWorld(ClientWorld world); }
55
424
<reponame>siliconcompiler/siliconcompiler import os import siliconcompiler def gcd_chip(): gcd_ex_dir = os.path.join(scroot(), 'examples', 'gcd') chip = siliconcompiler.Chip('gcd') chip.load_target('freepdk45_demo') chip.add('input', 'verilog', os.path.join(gcd_ex_dir, 'gcd.v')) chip.add('input', 'sdc', os.path.join(gcd_ex_dir, 'gcd.sdc')) chip.set('asic', 'diearea', [(0,0), (100.13,100.8)]) chip.set('asic', 'corearea', [(10.07,11.2), (90.25,91)]) chip.set('option', 'novercheck', 'true') chip.set('option', 'nodisplay', 'true') chip.set('option', 'quiet', 'true') chip.set('option', 'relax', 'true') return chip def scroot(): mydir = os.path.dirname(__file__) return os.path.abspath(os.path.join(mydir, '..')) def datadir(file): mydir = os.path.dirname(file) return os.path.abspath(os.path.join(mydir, 'data'))
401
4,801
from __future__ import absolute_import import os import sys import shutil import numpy as np from PIL import Image import cv2 from keras.preprocessing.image import ImageDataGenerator class ImagePreprocessor: def __init__(self): pass def build_image_dataset(self, data_input_folder, augment_data=True): print("Converting images from {} into arrays, augmentation: {}".format(data_input_folder, augment_data)) resized_img_arrays, sample_ids = self.get_resized_images(data_input_folder) if augment_data == 1: self.augment_and_save_images(resized_img_arrays, sample_ids, data_input_folder) else: self.save_resized_img_arrays(resized_img_arrays, sample_ids, data_input_folder) def get_img_features(self, png_path): img_features = self.resize_img(png_path) assert(img_features.shape == (256,256,3)) return img_features ########################################## ####### PRIVATE METHODS ################## ########################################## def save_resized_img_arrays(self, resized_img_arrays, sample_ids, output_folder): count = 0 for img_arr, sample_id in zip(resized_img_arrays, sample_ids): npz_filename = "{}/{}.npz".format(output_folder, sample_id) np.savez_compressed(npz_filename, features=img_arr) retrieve = np.load(npz_filename)["features"] assert np.array_equal(img_arr, retrieve) count += 1 print("Saved down {} resized images to folder {}".format(count, output_folder)) del resized_img_arrays def augment_and_save_images(self, resized_img_arrays, sample_ids, data_input_folder): datagen = ImageDataGenerator( rotation_range=2, width_shift_range=0.05, height_shift_range=0.05, zoom_range=0.05 ) keras_generator = datagen.flow(resized_img_arrays,sample_ids,batch_size=1) count = 0 for i in range(len(resized_img_arrays)): img_arr, sample_id = next(keras_generator) img_arr = np.squeeze(img_arr) npz_filename = "{}/{}.npz".format(data_input_folder, sample_id[0]) im = Image.fromarray(img_arr.astype('uint8')) np.savez_compressed(npz_filename, features=img_arr) retrieve = np.load(npz_filename)["features"] assert np.array_equal(img_arr, retrieve) count += 1 print("Saved down {} augmented images to folder {}".format(count, data_input_folder)) del resized_img_arrays def get_resized_images(self, pngs_input_folder): all_files = os.listdir(pngs_input_folder) png_files = [f for f in all_files if f.find(".png") != -1] images = [] labels = [] for png_file_path in png_files: png_path = "{}/{}".format(pngs_input_folder, png_file_path) sample_id = png_file_path[:png_file_path.find('.png')] resized_img_arr = self.resize_img(png_path) images.append(resized_img_arr) labels.append(sample_id) return np.array(images), np.array(labels) def resize_img(self, png_file_path): img_rgb = cv2.imread(png_file_path) img_grey = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY) img_adapted = cv2.adaptiveThreshold(img_grey, 255, cv2.ADAPTIVE_THRESH_MEAN_C,cv2.THRESH_BINARY, 101, 9) img_stacked = np.repeat(img_adapted[...,None],3,axis=2) resized = cv2.resize(img_stacked, (200,200), interpolation=cv2.INTER_AREA) bg_img = 255 * np.ones(shape=(256,256,3)) bg_img[27:227, 27:227,:] = resized bg_img /= 255 return bg_img
1,829
1,085
<reponame>luxms/dremio-oss<gh_stars>1000+ /* * Copyright (C) 2017-2019 Dremio Corporation * * 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. */ package com.dremio.exec.planner.logical; import org.apache.calcite.plan.RelOptCluster; import org.apache.calcite.plan.RelTraitSet; import org.apache.calcite.rel.RelNode; import org.apache.calcite.rel.RelShuttle; import org.apache.calcite.rel.core.Correlate; import org.apache.calcite.rel.core.CorrelationId; import org.apache.calcite.sql.SemiJoinType; import org.apache.calcite.util.ImmutableBitSet; public class CorrelateRel extends Correlate implements Rel { public CorrelateRel( RelOptCluster cluster, RelTraitSet traits, RelNode left, RelNode right, CorrelationId correlationId, ImmutableBitSet requiredColumns, SemiJoinType joinType) { super(cluster, traits, left, right, correlationId, requiredColumns, joinType); assert getConvention() == LOGICAL; } @Override public Correlate copy(RelTraitSet traitSet, RelNode left, RelNode right, CorrelationId correlationId, ImmutableBitSet requiredColumns, SemiJoinType joinType) { return new CorrelateRel(getCluster(), traitSet, left, right, correlationId, requiredColumns, joinType); } public RelNode accept(RelShuttle shuttle) { return shuttle.visit(this); } }
592
777
// Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_MANAGER_H_ #define CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_MANAGER_H_ #include "base/memory/weak_ptr.h" #include "cc/surfaces/surface_id.h" #include "cc/surfaces/surface_observer.h" #include "content/browser/renderer_host/offscreen_canvas_surface_impl.h" namespace content { class CONTENT_EXPORT OffscreenCanvasSurfaceManager : public cc::SurfaceObserver { public: OffscreenCanvasSurfaceManager(); virtual ~OffscreenCanvasSurfaceManager(); static OffscreenCanvasSurfaceManager* GetInstance(); void RegisterOffscreenCanvasSurfaceInstance(cc::FrameSinkId, OffscreenCanvasSurfaceImpl*); void UnregisterOffscreenCanvasSurfaceInstance(cc::FrameSinkId); OffscreenCanvasSurfaceImpl* GetSurfaceInstance(cc::FrameSinkId); private: friend class OffscreenCanvasSurfaceManagerTest; // cc::SurfaceObserver implementation. void OnSurfaceCreated(const cc::SurfaceInfo& surface_info) override; void OnSurfaceDamaged(const cc::SurfaceId&, bool* changed) override {} // When an OffscreenCanvasSurfaceImpl instance is destructed, it will // unregister the corresponding entry from this map. std::unordered_map<cc::FrameSinkId, OffscreenCanvasSurfaceImpl*, cc::FrameSinkIdHash> registered_surface_instances_; DISALLOW_COPY_AND_ASSIGN(OffscreenCanvasSurfaceManager); }; } // namespace content #endif // CONTENT_BROWSER_RENDERER_HOST_OFFSCREEN_CANVAS_SURFACE_MANAGER_H_
640
411
{"_version":"1.5.0","sap.app":{"_version":"1.2.0","id":"bookmarkplugin","type":"component","applicationVersion":{"version":""},"title":"{{plugin_title}}"},"sap.ui":{"_version":"1.3.0","technology":"UI5","deviceTypes":{"desktop":true,"tablet":true,"phone":true},"supportedThemes":[]},"sap.ui5":{"_version":"1.1.0","contentDensities":{"compact":true,"cozy":false},"dependencies":{"minUI5Version":"1.38.1","libs":{"sap.ui.core":{"minVersion":"1.38.1"},"sap.m":{"minVersion":"1.38.1"}}},"componentName":"bookmarkplugin"},"sap.flp":{"type":"plugin","config":{}}}
189
17,318
<reponame>woozhijun/cat package com.dianping.cat.configuration.client.transform; import com.dianping.cat.configuration.client.Constants; import com.dianping.cat.configuration.client.entity.*; import org.xml.sax.Attributes; public class DefaultSaxMaker implements IMaker<Attributes> { @Override public Bind buildBind(Attributes attributes) { String ip = attributes.getValue(Constants.ATTR_IP); String port = attributes.getValue(Constants.ATTR_PORT); Bind bind = new Bind(); if (ip != null) { bind.setIp(ip); } if (port != null) { bind.setPort(convert(Integer.class, port, null)); } return bind; } @Override public ClientConfig buildConfig(Attributes attributes) { String mode = attributes.getValue(Constants.ATTR_MODE); String enabled = attributes.getValue(Constants.ATTR_ENABLED); String dumpLocked = attributes.getValue(Constants.ATTR_DUMP_LOCKED); String domain = attributes.getValue(Constants.ATTR_DOMAIN); String maxMessageSize = attributes.getValue(Constants.ATTR_MAX_MESSAGE_SIZE); ClientConfig config = new ClientConfig(domain); if (mode != null) { config.setMode(mode); } if (enabled != null) { config.setEnabled(convert(Boolean.class, enabled, false)); } if (dumpLocked != null) { config.setDumpLocked(convert(Boolean.class, dumpLocked, null)); } if (maxMessageSize != null) { config.setMaxMessageSize(convert(Integer.class, maxMessageSize, 0)); } return config; } @Override public Domain buildDomain(Attributes attributes) { String id = attributes.getValue(Constants.ATTR_ID); String ip = attributes.getValue(Constants.ATTR_IP); String enabled = attributes.getValue(Constants.ATTR_ENABLED); String maxMessageSize = attributes.getValue(Constants.ATTR_MAX_MESSAGE_SIZE); Domain domain = new Domain(id); if (ip != null) { domain.setIp(ip); } if (enabled != null) { domain.setEnabled(convert(Boolean.class, enabled, false)); } if (maxMessageSize != null) { domain.setMaxMessageSize(convert(Integer.class, maxMessageSize, 0)); } return domain; } @Override public Property buildProperty(Attributes attributes) { String name = attributes.getValue(Constants.ATTR_NAME); Property property = new Property(); if (name != null) { property.setName(name); } return property; } @Override public Server buildServer(Attributes attributes) { String ip = attributes.getValue(Constants.ATTR_IP); String port = attributes.getValue(Constants.ATTR_PORT); String httpPort = attributes.getValue(Constants.ATTR_HTTP_PORT); String enabled = attributes.getValue(Constants.ATTR_ENABLED); Server server = new Server(ip); if (port != null) { server.setPort(convert(Integer.class, port, 0)); } if (httpPort != null) { server.setHttpPort(convert(Integer.class, httpPort, 0)); } if (enabled != null) { server.setEnabled(convert(Boolean.class, enabled, false)); } return server; } @SuppressWarnings("unchecked") protected <T> T convert(Class<T> type, String value, T defaultValue) { if (value == null) { return defaultValue; } if (type == Boolean.class) { return (T) Boolean.valueOf(value); } else if (type == Integer.class) { return (T) Integer.valueOf(value); } else if (type == Long.class) { return (T) Long.valueOf(value); } else if (type == Short.class) { return (T) Short.valueOf(value); } else if (type == Float.class) { return (T) Float.valueOf(value); } else if (type == Double.class) { return (T) Double.valueOf(value); } else if (type == Byte.class) { return (T) Byte.valueOf(value); } else if (type == Character.class) { return (T) (Character) value.charAt(0); } else { return (T) value; } } }
1,893
2,392
// Copyright (c) 2012 INRIA Sophia-Antipolis (France). // Copyright (c) 2017 GeometryFactory Sarl (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org). // // $URL: https://github.com/CGAL/cgal/blob/v5.1/Classification/include/CGAL/Classification/Feature/Echo_scatter.h $ // $Id: Echo_scatter.h 0779373 2020-03-26T13:31:46+01:00 Sébastien Loriot // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial // // Author(s) : <NAME>, <NAME> #ifndef CGAL_CLASSIFICATION_FEATURE_ECHO_SCATTER_H #define CGAL_CLASSIFICATION_FEATURE_ECHO_SCATTER_H #include <CGAL/license/Classification.h> #include <CGAL/Classification/Feature_base.h> #include <CGAL/Classification/Planimetric_grid.h> #include <CGAL/Classification/compressed_float.h> #include <CGAL/number_utils.h> #include <vector> #include <cmath> namespace CGAL { namespace Classification { namespace Feature { /*! \ingroup PkgClassificationFeatures %Feature based on echo scatter. The number of returns (echo number) is a useful information provided by most LIDAR sensors. It can help to identify trees. Its default name is "echo_scatter". \tparam GeomTraits model of \cgal Kernel. \tparam PointRange model of `ConstRange`. Its iterator type is `RandomAccessIterator` and its value type is the key type of `PointMap`. \tparam PointMap model of `ReadablePropertyMap` whose key type is the value type of the iterator of `PointRange` and value type is `GeomTraits::Point_3`. \tparam EchoMap model of `ReadablePropertyMap` whose key type is the value type of the iterator of `PointRange` and value type is `std::size_t`. */ template <typename GeomTraits, typename PointRange, typename PointMap, typename EchoMap> class Echo_scatter : public Feature_base { public: typedef Classification::Planimetric_grid<GeomTraits, PointRange, PointMap> Grid; private: typedef Classification::Image<compressed_float> Image_cfloat; const Grid& grid; Image_cfloat Scatter; std::vector<compressed_float> echo_scatter; public: /*! \brief Constructs the feature. \param input point range. \param echo_map property map to access the echo values of the input points. \param grid precomputed `Planimetric_grid`. \param radius_neighbors radius of local neighborhoods. */ Echo_scatter (const PointRange& input, EchoMap echo_map, const Grid& grid, float radius_neighbors = 1.) : grid (grid) { this->set_name ("echo_scatter"); if (radius_neighbors < 0.) radius_neighbors = 3.f * grid.resolution(); if (grid.width() * grid.height() > input.size()) echo_scatter.resize(input.size(), compressed_float(0)); else { Scatter = Image_cfloat(grid.width(), grid.height()); for (std::size_t j = 0; j < grid.height(); j++) for (std::size_t i = 0; i < grid.width(); i++) if (grid.has_points(i,j)) Scatter(i,j) = compressed_float(0); } std::size_t square = (std::size_t)(0.5 * radius_neighbors / grid.resolution()) + 1; for (std::size_t j = 0; j < grid.height(); j++) for (std::size_t i = 0; i < grid.width(); i++) if(grid.has_points(i,j)) { std::size_t squareXmin = (i < square ? 0 : i - square); std::size_t squareXmax = (std::min) (grid.width()-1, i + square); std::size_t squareYmin = (j < square ? 0 : j - square); std::size_t squareYmax = (std::min) (grid.height()-1, j + square); std::size_t NB_echo_sup=0; std::size_t NB_echo_total=0; for(std::size_t k = squareXmin; k <= squareXmax; k++){ for(std::size_t l = squareYmin; l <= squareYmax; l++){ if(CGAL::sqrt(pow((float)k-i,2)+pow((float)l-j,2))<=(float)0.5*radius_neighbors/grid.resolution()) { typename Grid::iterator end = grid.indices_end(k,l); std::size_t nb = 0; for (typename Grid::iterator it = grid.indices_begin(k,l); it != end; ++ it) { ++ nb; if(get(echo_map, *(input.begin()+(*it))) > 1) NB_echo_sup++; } NB_echo_total=NB_echo_total+nb; } } } compressed_float v = compress_float (NB_echo_sup/float(NB_echo_total)); if (echo_scatter.empty()) Scatter(i,j) = v; else { typename Grid::iterator end = grid.indices_end(i,j); for (typename Grid::iterator it = grid.indices_begin(i,j); it != end; ++ it) echo_scatter[*it] = v; } } } /// \cond SKIP_IN_MANUAL virtual float value (std::size_t pt_index) { if (echo_scatter.empty()) { std::size_t I = grid.x(pt_index); std::size_t J = grid.y(pt_index); return decompress_float (Scatter(I,J)); } return decompress_float (echo_scatter[pt_index]); } /// \endcond }; } // namespace Feature } // namespace Classification } // namespace CGAL #endif // CGAL_CLASSIFICATION_FEATURE_ECHO_SCATTER_H
2,245
709
//----------------------------------------------- // // This file is part of the Siv3D Engine. // // Copyright (c) 2008-2021 <NAME> // Copyright (c) 2016-2021 OpenSiv3D Project // // Licensed under the MIT License. // //----------------------------------------------- # include <Siv3D/Script.hpp> # include <Siv3D/Circular.hpp> namespace s3d { using namespace AngelScript; using ShapeType = Circular; static void Construct(const Circular& c, ShapeType* self) { new(self) ShapeType(c); } static void ConstructDD(double r, double theta, ShapeType* self) { new(self) ShapeType(r, theta); } static void ConstructV(const Vec2& v, ShapeType* self) { new(self) ShapeType(v); } void RegisterCircular(asIScriptEngine* engine) { constexpr char TypeName[] = "Circular"; int32 r = 0; r = engine->RegisterObjectProperty(TypeName, "double r", asOFFSET(ShapeType, r)); assert(r >= 0); r = engine->RegisterObjectProperty(TypeName, "double theta", asOFFSET(ShapeType, theta)); assert(r >= 0); r = engine->RegisterObjectBehaviour(TypeName, asBEHAVE_CONSTRUCT, "void f(const Circular &in)", asFUNCTION(Construct), asCALL_CDECL_OBJLAST); assert(r >= 0); r = engine->RegisterObjectBehaviour(TypeName, asBEHAVE_CONSTRUCT, "void f(double r, double theta)", asFUNCTION(ConstructDD), asCALL_CDECL_OBJLAST); assert(r >= 0); r = engine->RegisterObjectBehaviour(TypeName, asBEHAVE_CONSTRUCT, "void f(const Vec2& in)", asFUNCTION(ConstructV), asCALL_CDECL_OBJLAST); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Vec2 opNeg() const", asMETHODPR(Circular, operator-, () const noexcept, Circular), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Vec2 opAdd(Vec2) const", asMETHODPR(Circular, operator+, (Vec2) const noexcept, Vec2), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Vec2 opSub(Vec2) const", asMETHODPR(Circular, operator-, (Vec2) const noexcept, Vec2), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Circular rotated(double) const", asMETHODPR(ShapeType, rotated, (double) const noexcept, Circular), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Circular& rotate(double)", asMETHODPR(ShapeType, rotate, (double) noexcept, Circular&), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Float2 toFloat2() const", asMETHODPR(Circular, toFloat2, () const noexcept, Float2), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Vec2 toVec2() const", asMETHODPR(Circular, toVec2, () const noexcept, Vec2), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Float2 fastToFloat2() const", asMETHODPR(Circular, fastToFloat2, () const noexcept, Float2), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Vec2 fastToVec2() const", asMETHODPR(Circular, fastToVec2, () const noexcept, Vec2), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Vec2 toPosition() const", asMETHODPR(Circular, toPosition, () const noexcept, Vec2), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "Vec2 opImplConv() const", asMETHODPR(Circular, toVec2, () const noexcept, Vec2), asCALL_THISCALL); assert(r >= 0); r = engine->RegisterObjectMethod(TypeName, "size_t hash() const", asMETHODPR(Circular, hash, () const noexcept, size_t), asCALL_THISCALL); assert(r >= 0); } }
1,225
402
<gh_stars>100-1000 """Client for cache server. See cachesvr.py for protocol description. """ import argparse import asyncio from asyncio import test_utils import json import logging ARGS = argparse.ArgumentParser(description='Cache client example.') ARGS.add_argument( '--tls', action='store_true', dest='tls', default=False, help='Use TLS') ARGS.add_argument( '--iocp', action='store_true', dest='iocp', default=False, help='Use IOCP event loop (Windows only)') ARGS.add_argument( '--host', action='store', dest='host', default='localhost', help='Host name') ARGS.add_argument( '--port', action='store', dest='port', default=54321, type=int, help='Port number') ARGS.add_argument( '--timeout', action='store', dest='timeout', default=5, type=float, help='Timeout') ARGS.add_argument( '--max_backoff', action='store', dest='max_backoff', default=5, type=float, help='Max backoff on reconnect') ARGS.add_argument( '--ntasks', action='store', dest='ntasks', default=10, type=int, help='Number of tester tasks') ARGS.add_argument( '--ntries', action='store', dest='ntries', default=5, type=int, help='Number of request tries before giving up') args = ARGS.parse_args() class CacheClient: """Multiplexing cache client. This wraps a single connection to the cache client. The connection is automatically re-opened when an error occurs. Multiple tasks may share this object; the requests will be serialized. The public API is get(), set(), delete() (all are coroutines). """ def __init__(self, host, port, sslctx=None, loop=None): self.host = host self.port = port self.sslctx = sslctx self.loop = loop self.todo = set() self.initialized = False self.task = asyncio.Task(self.activity(), loop=self.loop) @asyncio.coroutine def get(self, key): resp = yield from self.request('get', key) if resp is None: return None return resp.get('value') @asyncio.coroutine def set(self, key, value): resp = yield from self.request('set', key, value) if resp is None: return False return resp.get('status') == 'ok' @asyncio.coroutine def delete(self, key): resp = yield from self.request('delete', key) if resp is None: return False return resp.get('status') == 'ok' @asyncio.coroutine def request(self, type, key, value=None): assert not self.task.done() data = {'type': type, 'key': key} if value is not None: data['value'] = value payload = json.dumps(data).encode('utf8') waiter = asyncio.Future(loop=self.loop) if self.initialized: try: yield from self.send(payload, waiter) except IOError: self.todo.add((payload, waiter)) else: self.todo.add((payload, waiter)) return (yield from waiter) @asyncio.coroutine def activity(self): backoff = 0 while True: try: self.reader, self.writer = yield from asyncio.open_connection( self.host, self.port, ssl=self.sslctx, loop=self.loop) except Exception as exc: backoff = min(args.max_backoff, backoff + (backoff//2) + 1) logging.info('Error connecting: %r; sleep %s', exc, backoff) yield from asyncio.sleep(backoff, loop=self.loop) continue backoff = 0 self.next_id = 0 self.pending = {} self. initialized = True try: while self.todo: payload, waiter = self.todo.pop() if not waiter.done(): yield from self.send(payload, waiter) while True: resp_id, resp = yield from self.process() if resp_id in self.pending: payload, waiter = self.pending.pop(resp_id) if not waiter.done(): waiter.set_result(resp) except Exception as exc: self.initialized = False self.writer.close() while self.pending: req_id, pair = self.pending.popitem() payload, waiter = pair if not waiter.done(): self.todo.add(pair) logging.info('Error processing: %r', exc) @asyncio.coroutine def send(self, payload, waiter): self.next_id += 1 req_id = self.next_id frame = 'request %d %d\n' % (req_id, len(payload)) self.writer.write(frame.encode('ascii')) self.writer.write(payload) self.pending[req_id] = payload, waiter yield from self.writer.drain() @asyncio.coroutine def process(self): frame = yield from self.reader.readline() if not frame: raise EOFError() head, tail = frame.split(None, 1) if head == b'error': raise IOError('OOB error: %r' % tail) if head != b'response': raise IOError('Bad frame: %r' % frame) resp_id, resp_size = map(int, tail.split()) data = yield from self.reader.readexactly(resp_size) if len(data) != resp_size: raise EOFError() resp = json.loads(data.decode('utf8')) return resp_id, resp def main(): asyncio.set_event_loop(None) if args.iocp: from asyncio.windows_events import ProactorEventLoop loop = ProactorEventLoop() else: loop = asyncio.new_event_loop() sslctx = None if args.tls: sslctx = test_utils.dummy_ssl_context() cache = CacheClient(args.host, args.port, sslctx=sslctx, loop=loop) try: loop.run_until_complete( asyncio.gather( *[testing(i, cache, loop) for i in range(args.ntasks)], loop=loop)) finally: loop.close() @asyncio.coroutine def testing(label, cache, loop): def w(g): return asyncio.wait_for(g, args.timeout, loop=loop) key = 'foo-%s' % label while True: logging.info('%s %s', label, '-'*20) try: ret = yield from w(cache.set(key, 'hello-%s-world' % label)) logging.info('%s set %s', label, ret) ret = yield from w(cache.get(key)) logging.info('%s get %s', label, ret) ret = yield from w(cache.delete(key)) logging.info('%s del %s', label, ret) ret = yield from w(cache.get(key)) logging.info('%s get2 %s', label, ret) except asyncio.TimeoutError: logging.warn('%s Timeout', label) except Exception as exc: logging.exception('%s Client exception: %r', label, exc) break if __name__ == '__main__': logging.basicConfig(level=logging.INFO) main()
3,285
435
<reponame>allen91wu/data { "description": "# Background\n\n* Why async? CPU bound vs IO bound processes.\n* Concurrency is not the same as multithreading\n* Single threaded concurrency\n\n# Generators - already in Python 2 !\n\n* Generator - a function you can pause!\n* How to implement async with generators and event loop in Python 2\n* Real working code - a Python version of the JavaScript setTimeout function\n\n# What is new in Python 3 ?\n\n* async/await - really generators in disguise!\n* asyncio library - ready made event loop and IO \n\n* new syntax and new library are independent - you can mix and match old and new!", "language": "eng", "recorded": "2017-12-03", "related_urls": [ { "label": "Talk schedule", "url": "https://2017.northbaypython.org/schedule/presentation/13/" } ], "speakers": [ "<NAME>" ], "thumbnail_url": "https://i.ytimg.com/vi/jJzHMu2H6cw/hqdefault.jpg", "title": "Async for the Python 2 Programmer", "videos": [ { "type": "youtube", "url": "https://www.youtube.com/watch?v=jJzHMu2H6cw" } ] }
392
1,165
<filename>jobs/pacman-rule-engine-2.0/src/main/java/com/tmobile/pacman/executor/JobExecutor.java /******************************************************************************* * Copyright 2018 T Mobile, Inc. or its affiliates. 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. ******************************************************************************/ package com.tmobile.pacman.executor; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.google.common.base.Joiner; import com.tmobile.pacman.commons.jobs.PacmanJob; import com.tmobile.pacman.util.CommonUtils; import com.tmobile.pacman.util.ProgramExitUtils; import com.tmobile.pacman.util.ReflectionUtils; // TODO: Auto-generated Javadoc /** * This class is responsible for firing the execute method of the Job. * * @author kkumar */ public class JobExecutor { /** The Constant logger. */ private static final Logger logger = LoggerFactory.getLogger(JobExecutor.class); /** * The main method. * * @param args job parameters * @throws InstantiationException the instantiation exception * @throws IllegalAccessException the illegal access exception * @throws IllegalArgumentException the illegal argument exception * @throws InvocationTargetException the invocation target exception * @throws JsonParseException the json parse exception * @throws JsonMappingException the json mapping exception * @throws IOException Signals that an I/O exception has occurred. * @throws NoSuchMethodException the no such method exception * @throws ClassNotFoundException the class not found exception */ public static void main(String[] args) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, JsonParseException, JsonMappingException, IOException, NoSuchMethodException, ClassNotFoundException { Map<String, String> jobParams = new HashMap<String, String>(); String programArgs = ""; if (args.length > 0) { programArgs = args[0]; jobParams = CommonUtils.createParamMap(programArgs); logger.debug("job Param String " + programArgs); } else { logger.debug("No arguments available for job execution, expecting a no args method"); } setUncaughtExceptionHandler(); logger.debug("shutdown hook engaged."); Method executeMethod = null; Object jobObject = null; Class<?> jobClass = null; try { jobClass = ReflectionUtils.findAssociateClass(PacmanJob.class, jobParams.get("package_hint")); PacmanJob job = jobClass.getAnnotation(PacmanJob.class); String methodName = job.methodToexecute(); jobObject = jobClass.newInstance(); executeMethod = ReflectionUtils.findAssociatedMethod(jobObject, methodName); } catch (Exception e) { logger.error("Please check the job class complies to implemetation contract", e); ProgramExitUtils.exitWithError(); } if(null==executeMethod){ logger.error("unable to find execute method"); ProgramExitUtils.exitWithError(); }else { long startTime = System.nanoTime(); // loop through resources and call rule execute method try { if (hasArgumentsOtherThenHints(jobParams)) executeMethod.invoke(jobObject, Collections.unmodifiableMap(jobParams)); // let rule not allow modify input else { executeMethod.invoke(jobObject); } } catch (Exception e) { logger.debug("job execution failed", e); ProgramExitUtils.exitWithError(); } long endTime = System.nanoTime(); long timeTakenToExecute = TimeUnit.MINUTES.convert(endTime - startTime, TimeUnit.NANOSECONDS); logger.info("Elapsed time in minutes for evaluation: " + timeTakenToExecute); startTime = System.nanoTime(); // process rule evaluations the annotations based on result Map<String, String> evalResults = new HashMap<>(); evalResults.put("time taken for job execution", timeTakenToExecute + ""); publishMetrics(evalResults); ProgramExitUtils.exitSucessfully(); } } /** * Checks for arguments other then hints. * * @param jobParams the job params * @return true, if successful */ private static boolean hasArgumentsOtherThenHints(Map<String, String> jobParams) { for (Entry<String, String> jobParam : jobParams.entrySet()) { if (!"package_hint".equals(jobParam.getKey())) { return Boolean.TRUE; } } return Boolean.FALSE; } /** * Publish metrics. * * @param evalResults the eval results * @return the boolean */ private static Boolean publishMetrics(Map<String, String> evalResults) { logger.info(Joiner.on("#").withKeyValueSeparator("=").join(evalResults)); return Boolean.TRUE; } /** * in case any rule throws exception and it reaches main, this will make * sure the VM is terminated gracefully close all clients here. */ private static void setUncaughtExceptionHandler() { Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { public void uncaughtException(Thread t, Throwable e) { StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); String stacktrace = sw.toString(); logger.error(stacktrace); } }); } }
2,522
672
/* * Copyright (c) Facebook, Inc. and its affiliates. * * 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. */ #include "velox/common/base/Exceptions.h" #include "velox/experimental/codegen/ast/ASTNode.h" namespace facebook::velox::codegen { /// Abstract class that represents unary expression. class UnaryExpr : public ASTNode { public: UnaryExpr(const TypePtr& type, const ASTNodePtr& child) : ASTNode(type), child_(child) {} ~UnaryExpr() override {} virtual CodeSnippet generateCode( CodegenCtx& exprCodegenCtx, const std::string& outputVarName) const override = 0; const std::vector<ASTNodePtr> children() const override { return {child_}; } ASTNodePtr child() const { return child_; } private: /// Child expression ASTNodePtr child_; }; class IsNullExpr final : public UnaryExpr { public: IsNullExpr(const TypePtr& type, const ASTNodePtr& child) : UnaryExpr(type, child) {} void validate() const override { validateTyped(); } CodeSnippet generateCode( CodegenCtx& exprCodegenCtx, const std::string& outputVarName) const override; virtual ExpressionNullMode getNullMode() const override { return ExpressionNullMode::NotNull; } }; class NotExpr final : public UnaryExpr { public: NotExpr(const TypePtr& type, const ASTNodePtr& child) : UnaryExpr(type, child) {} void validate() const override { validateTyped(); } CodeSnippet generateCode( CodegenCtx& exprCodegenCtx, const std::string& outputVarName) const override; virtual ExpressionNullMode getNullMode() const override { return ExpressionNullMode::NullInNullOut; } }; } // namespace facebook::velox::codegen
701
749
<reponame>rtshilston/flask-cors # -*- coding: utf-8 -*- """ test ~~~~ Flask-CORS is a simple extension to Flask allowing you to support cross origin resource sharing (CORS) using a simple decorator. :copyright: (c) 2016 by <NAME>. :license: MIT, see LICENSE for more details. """ from ..base_test import FlaskCorsTestCase from flask import Flask from flask_cors import * from flask_cors.core import * class MethodsCase(FlaskCorsTestCase): def setUp(self): self.app = Flask(__name__) @self.app.route('/defaults') @cross_origin() def defaults(): return 'Should only return headers on pre-flight OPTIONS request' @self.app.route('/test_methods_defined') @cross_origin(methods=['POST']) def test_get(): return 'Only allow POST' def test_defaults(self): ''' Access-Control-Allow-Methods headers should only be returned if the client makes an OPTIONS request. ''' self.assertFalse(ACL_METHODS in self.get('/defaults', origin='www.example.com').headers) self.assertFalse(ACL_METHODS in self.head('/defaults', origin='www.example.com').headers) res = self.preflight('/defaults', 'POST', origin='www.example.com') for method in ALL_METHODS: self.assertTrue(method in res.headers.get(ACL_METHODS)) def test_methods_defined(self): ''' If the methods parameter is defined, it should override the default methods defined by the user. ''' self.assertFalse(ACL_METHODS in self.get('/test_methods_defined').headers) self.assertFalse(ACL_METHODS in self.head('/test_methods_defined').headers) res = self.preflight('/test_methods_defined', 'POST', origin='www.example.com') self.assertTrue('POST' in res.headers.get(ACL_METHODS)) res = self.preflight('/test_methods_defined', 'PUT', origin='www.example.com') self.assertFalse(ACL_METHODS in res.headers) res = self.get('/test_methods_defined', origin='www.example.com') self.assertFalse(ACL_METHODS in res.headers) if __name__ == "__main__": unittest.main()
875
631
<gh_stars>100-1000 // Copyright 2018 The Beam Team // // 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. #pragma once #include "ecc_decl.h" typedef struct { secp256k1_sha256_t m_sha; } BeamCrypto_Oracle; void BeamCrypto_Oracle_Init(BeamCrypto_Oracle*); void BeamCrypto_Oracle_Expose(BeamCrypto_Oracle*, const uint8_t*, size_t); void BeamCrypto_Oracle_NextHash(BeamCrypto_Oracle*, BeamCrypto_UintBig*); void BeamCrypto_Oracle_NextScalar(BeamCrypto_Oracle*, secp256k1_scalar*); void BeamCrypto_Oracle_NextPoint(BeamCrypto_Oracle*, BeamCrypto_FlexPoint*);
338
2,151
<reponame>zipated/src // Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.chrome.browser.mojo; import org.chromium.base.annotations.CalledByNative; import org.chromium.chrome.browser.installedapp.InstalledAppProviderFactory; import org.chromium.chrome.browser.payments.PaymentRequestFactory; import org.chromium.chrome.browser.webauth.AuthenticatorFactory; import org.chromium.chrome.browser.webshare.ShareServiceImplementationFactory; import org.chromium.content_public.browser.InterfaceRegistrar; import org.chromium.content_public.browser.RenderFrameHost; import org.chromium.content_public.browser.WebContents; import org.chromium.installedapp.mojom.InstalledAppProvider; import org.chromium.payments.mojom.PaymentRequest; import org.chromium.services.service_manager.InterfaceRegistry; import org.chromium.webauth.mojom.Authenticator; import org.chromium.webshare.mojom.ShareService; @SuppressWarnings("MultipleTopLevelClassesInFile") /** Registers mojo interface implementations exposed to C++ code at the Chrome layer. */ class ChromeInterfaceRegistrar { @CalledByNative private static void registerMojoInterfaces() { InterfaceRegistrar.Registry.addWebContentsRegistrar( new ChromeWebContentsInterfaceRegistrar()); InterfaceRegistrar.Registry.addRenderFrameHostRegistrar( new ChromeRenderFrameHostInterfaceRegistrar()); } private static class ChromeWebContentsInterfaceRegistrar implements InterfaceRegistrar<WebContents> { @Override public void registerInterfaces(InterfaceRegistry registry, final WebContents webContents) { registry.addInterface( ShareService.MANAGER, new ShareServiceImplementationFactory(webContents)); } } private static class ChromeRenderFrameHostInterfaceRegistrar implements InterfaceRegistrar<RenderFrameHost> { @Override public void registerInterfaces( InterfaceRegistry registry, final RenderFrameHost renderFrameHost) { registry.addInterface( PaymentRequest.MANAGER, new PaymentRequestFactory(renderFrameHost)); registry.addInterface( InstalledAppProvider.MANAGER, new InstalledAppProviderFactory(renderFrameHost)); registry.addInterface(Authenticator.MANAGER, new AuthenticatorFactory(renderFrameHost)); } } }
866
2,127
{ "name": "devices.css", "version": "0.1.15", "homepage": "http://picturepan2.github.io/devices.css", "author": "<NAME> <<EMAIL>>", "description": "Devices.css: Modern devices in pure CSS.", "main": "dist/devices.css", "repository": { "type": "git", "url": "https://github.com/picturepan2/devices.css.git" }, "license": "MIT", "keywords": [ "css", "pure-css", "devices", "responsive" ], "bugs": { "url": "https://github.com/picturepan2/devices.css/issues" }, "devDependencies": { "gulp": "latest", "gulp-autoprefixer": "latest", "gulp-clean-css": "^3.7.0", "gulp-csscomb": "^3.0.8", "gulp-rename": "^1.2.2", "gulp-sass": "latest" }, "browserslist": [ "last 4 Chrome versions", "Edge >= 12", "Firefox ESR", "last 4 Safari versions", "last 4 Opera versions", "Explorer >= 10" ] }
398
2,322
import cartography.intel.aws.s3 import tests.data.aws.s3 TEST_ACCOUNT_ID = '000000000000' TEST_REGION = 'us-east-1' TEST_UPDATE_TAG = 123456789 def test_load_s3_buckets(neo4j_session, *args): """ Ensure that expected buckets get loaded with their key fields. """ data = tests.data.aws.s3.LIST_BUCKETS cartography.intel.aws.s3.load_s3_buckets(neo4j_session, data, TEST_ACCOUNT_ID, TEST_UPDATE_TAG) expected_nodes = { ( "bucket-1", "bucket-1", "eu-west-1", ), ( "bucket-2", "bucket-2", "me-south-1", ), ( "bucket-3", "bucket-3", None, ), } nodes = neo4j_session.run( """ MATCH (s:S3Bucket) return s.id, s.name, s.region """, ) actual_nodes = { ( n['s.id'], n['s.name'], n['s.region'], ) for n in nodes } assert actual_nodes == expected_nodes def test_load_s3_encryption(neo4j_session, *args): """ Ensure that expected bucket gets loaded with their encryption fields. """ data = tests.data.aws.s3.GET_ENCRYPTION cartography.intel.aws.s3._load_s3_encryption(neo4j_session, data, TEST_UPDATE_TAG) expected_nodes = { ( "bucket-1", True, "aws:kms", "arn:aws:kms:eu-east-1:000000000000:key/<KEY>", False, ), } nodes = neo4j_session.run( """ MATCH (s:S3Bucket) WHERE s.id = 'bucket-1' RETURN s.id, s.default_encryption, s.encryption_algorithm, s.encryption_key_id, s.bucket_key_enabled """, ) actual_nodes = { ( n['s.id'], n['s.default_encryption'], n['s.encryption_algorithm'], n['s.encryption_key_id'], n['s.bucket_key_enabled'], ) for n in nodes } assert actual_nodes == expected_nodes
1,117
4,283
/* * Copyright (c) 2008-2021, Hazelcast, 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. */ package com.hazelcast.internal.yaml; /** * Mutable interface of {@link YamlMapping} */ public interface MutableYamlMapping extends YamlMapping, MutableYamlNode { /** * Adds a new child node to the mapping with the provided name * * @param name The name of the new child * @param node The child node */ void addChild(String name, YamlNode node); /** * Removes a child with the given name if exists * * @param name The name of the child to remove */ void removeChild(String name); }
356
3,614
package com.rocketmq.demo.service; import com.rocketmq.demo.model.Order; import org.springframework.cloud.stream.annotation.StreamListener; import org.springframework.cloud.stream.messaging.Sink; import org.springframework.messaging.Message; import org.springframework.messaging.handler.annotation.Payload; import org.springframework.stereotype.Service; /** * @author zlt */ @Service public class ReceiveService { /** * 字符串消息 */ @StreamListener(Sink.INPUT) public void receiveInput(String receiveMsg) { System.out.println("input receive: " + receiveMsg); } /** * 对象消息 */ @StreamListener("input2") public void receiveInput2(@Payload Order order) { System.out.println("input2 receive: " + order); } /** * 通过spring.messaging对象来接收消息 */ @StreamListener("input3") public void receiveInput3(Message msg) { System.out.println("input3 receive: " + msg); } }
349
677
<gh_stars>100-1000 // Copyright 2017 The Lynx Authors. All rights reserved. package com.lynx.ui.event; import com.lynx.core.impl.EventModifier; import com.lynx.core.impl.RenderObjectImpl; import com.lynx.core.touch.EventInfo; import com.lynx.core.touch.TouchEventInfo; import com.lynx.core.touch.gesture.GestureEventInfo; import com.lynx.ui.LynxUI; import java.util.Map; // Touch and Gesture event flow handler public class TGFlowHandler { private LynxUI mTarget; public TGFlowHandler(LynxUI ui) { mTarget = ui; } public void handleCaptureFlow(EventInfo info) { RenderObjectImpl renderObjectImpl = mTarget.getRenderObjectImpl(); if (renderObjectImpl == null) return; String eventName = info.getType(); Map<String, EventModifier> modifiers = renderObjectImpl.getEventManager().getOptionEvent(eventName); if (modifiers == null) { return; } for (String key : modifiers.keySet()) { EventModifier modifier = modifiers.get(key); if (modifier != null && modifier.isCapture()) { emitEvent(modifier.getOriginName(), info); if (modifier.isStop()) { info.stopPropagation(); } if (modifier.isPrevent()) { info.preventDefault(); } } } } public void handlePerformFlow(EventInfo info) { RenderObjectImpl renderObjectImpl = mTarget.getRenderObjectImpl(); if (renderObjectImpl == null) return; String eventName = info.getType(); Map<String, EventModifier> modifiers = renderObjectImpl.getEventManager().getOptionEvent(eventName); if (modifiers == null) { return; } for (String key : modifiers.keySet()) { EventModifier modifier = modifiers.get(key); if (!modifier.isCapture() && modifier.mockCall() && !(modifier.isSelf() && info.getTarget() != mTarget)) { emitEvent(modifier.getOriginName(), info); } if (modifier.isStop()) { info.stopPropagation(); } if (modifier.isPrevent()) { info.preventDefault(); } } } private void emitEvent(String eventName, EventInfo info) { if (info instanceof TouchEventInfo) { emitTouchEvent(eventName, (TouchEventInfo) info); } else if (info instanceof GestureEventInfo) { emitGestureEvent(eventName, (GestureEventInfo) info); } } private void emitTouchEvent(String eventName, TouchEventInfo info) { TouchEvent touchEvent = new TouchEvent(info); mTarget.postEvent(eventName, touchEvent); } private void emitGestureEvent(String eventName, GestureEventInfo info) { GestureEvent gestureEvent = new GestureEvent(info); mTarget.postEvent(eventName, gestureEvent); } }
1,321
471
# Generated by Django 1.11.13 on 2018-05-09 18:57 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('accounting', '0026_auto_20180508_1956'), ] operations = [ migrations.RemoveField( model_name='billingrecord', name='emailed_to', ), migrations.RemoveField( model_name='wirebillingrecord', name='emailed_to', ), ]
216
500
<gh_stars>100-1000 package ddf.minim.ugens; import ddf.minim.AudioOutput; import ddf.minim.Minim; import ddf.minim.UGen; /** * A UGen that generates a simple envelope that changes from a starting value to a * middle value during an "attack" phase and then changes to an ending value * during a "damp" or "decay" phase. By default, if you only specify a damp time, * it will change from 1 to 0 over that period of time. Specifying only attack and * damp time, it will ramp up from 0 to 1 over the attack time and then 1 to 0 over * the damp time. All times are specified in seconds. * * @example Synthesis/dampExample * * @author <NAME> * * @related UGen */ public class Damp extends UGen { /** * The default input is "audio." You don't need to patch directly to this input, * patching to the UGen itself will accomplish the same thing. * * @related Damp * @related UGen.UGenInput */ public UGenInput audio; // the maximum amplitude of the damp private float maxAmp; // the current amplitude private float amp; // the time from maxAmp to afterAmplitude private float dampTime; // the time from beforeAmplitude to maxAmp private float attackTime; // amplitude before the damp hits private float beforeAmplitude; // amplitude after the release of the damp private float afterAmplitude; // the current size of the step private float timeStepSize; // the current time private float now; // the damp has been activated private boolean isActivated; // unpatch the note after it's finished private boolean unpatchAfterDamp; // it might need to unpatch from an output private AudioOutput output; // or it might need to unpatch from another ugen private UGen ugenOutput; /** * Constructor for Damp envelope. * attackTime, rise time of the damp envelope, defaults to 0. * dampTime, decay time of the damp envelope, defaults to 1. * maxAmp, maximum amlitude of the damp envelope, defaults to 1. * befAmp, amplitude before the damp envelope, * and aftAmp, amplitude after the damp envelope, * default to 0. */ public Damp() { this( 0.0f, 1.0f, 1.0f, 0.0f, 0.0f ); } /** * Constructor for Damp envelope. * attackTime, rise time of the damp envelope, defaults to 0. * maxAmp, maximum amlitude of the damp envelope, defaults to 1. * befAmp, amplitude before the damp envelope, * and aftAmp, amplitude after the damp envelope, * default to 0. * @param dampTime * float: decay time of the damp envelope, in seconds */ public Damp( float dampTime ) { this( 0.0f, dampTime, 1.0f, 0.0f, 0.0f ); } /** * Constructor for Damp envelope. * maxAmp, maximum amlitude of the damp envelope, defaults to 1. * befAmp, amplitude before the damp envelope, * and aftAmp, amplitude after the damp envelope, * default to 0. * @param attackTime * float: rise time of the damp envelope, in seconds * @param dampTime * float: decay time of the damp envelope, in seconds */ public Damp( float attackTime, float dampTime ) { this( attackTime, dampTime, 1.0f, 0.0f, 0.0f ); } /** * Constructor for Damp envelope. * befAmp, amplitude before the damp envelope, * and aftAmp, amplitude after the damp envelope, * default to 0. * @param attackTime * float: rise time of the damp envelope, in seconds * @param dampTime * float: decay time of the damp envelope, in seconds * @param maxAmp * float: maximum amplitude of the damp envelope */ public Damp( float attackTime, float dampTime, float maxAmp ) { this( attackTime, dampTime, maxAmp, 0.0f, 0.0f ); } /** * Constructor for Damp envelope. * @param attackTime * float: rise time of the damp envelope, in seconds * @param dampTime * float: decay time of the damp envelope, in seconds * @param maxAmp * float: maximum amplitude of the damp envelope * @param befAmp * float: amplitude before the damp envelope * @param aftAmp * float: amplitude after the damp envelope */ public Damp( float attackTime, float dampTime, float maxAmp, float befAmp, float aftAmp ) { super(); audio = new UGenInput(InputType.AUDIO); this.attackTime = attackTime; this.dampTime = dampTime; this.maxAmp = maxAmp; beforeAmplitude = befAmp; afterAmplitude = aftAmp; isActivated = false; amp = beforeAmplitude; Minim.debug(" attackTime = " + attackTime + " dampTime = " + dampTime + " maxAmp = " + this.maxAmp + " now = " + now ); } /** * Specifies that the damp envelope should begin. * * @example Synthesis/dampExample * * @related Damp */ public void activate() { now = 0f; isActivated = true; if( timeStepSize > attackTime ) { amp = maxAmp; } else { amp = 0f; } } /** * Permits the setting of the attackTime parameter. * * @param attackTime * float: rise time of the damp envelope, in seconds * * @related Damp */ public void setAttackTime( float attackTime ) { this.attackTime = attackTime; } /** * Permits the setting of the attackTime parameter. * * @param dampTime * float: decay time of the damp envelope, in seconds * * @related Damp */ public void setDampTime( float dampTime ) { this.dampTime = dampTime; } /** * Set the attack time and damp time parameters based on a duration. * If the current attack time is positive, and less than the total duration, * then the damp time is the total duration after the attack time, otherwise, * the attack time and damp time are both set to half the duration. * * @shortdesc Set the attack time and damp time parameters based on a duration. * * @param duration * float: duration of the entire damp envelope, in seconds * * @related Damp * * @example Synthesis/dampExample */ public void setDampTimeFromDuration( float duration ) { float tmpDampTime = duration - attackTime; if ( tmpDampTime > 0.0f ) { dampTime = tmpDampTime; } else { attackTime = duration/2.0f; dampTime = duration/2.0f; } } @Override protected void sampleRateChanged() { timeStepSize = 1/sampleRate(); } /** * Tell this Damp that it should unpatch itself from the output after the release time. * * @param output * AudioOutput: the output this should unpatch from * * @example Synthesis/dampExample * * @related Damp */ public void unpatchAfterDamp( AudioOutput output ) { unpatchAfterDamp = true; this.output = output; } /** * The UGen this Damp should unpatch itself from after the release time. * * @param output * the UGen that this Damp should unpatch to after the Damp completes * * @related Damp */ public void unpatchAfterDamp( UGen output ) { unpatchAfterDamp = true; ugenOutput = output; } @Override protected void uGenerate( float[] channels ) { // before the damp if ( !isActivated ) { for( int i = 0; i < channels.length; i++ ) { channels[ i ] = beforeAmplitude*audio.getLastValues()[ i ]; } } // after the damp else if ( now >= ( dampTime + attackTime ) ) { for( int i = 0; i < channels.length; i++ ) { channels[ i ] = afterAmplitude*audio.getLastValues()[ i ]; } if ( unpatchAfterDamp ) { if ( output != null ) { unpatch( output ); output = null; } else if ( ugenOutput != null ) { unpatch( ugenOutput ); ugenOutput = null; } unpatchAfterDamp = false; Minim.debug(" unpatching Damp "); } } // after the attack, during the decay else if ( now >= attackTime ) // in the damp time { amp += ( afterAmplitude - amp )*timeStepSize/( dampTime + attackTime - now ); for( int i = 0; i < channels.length; i++ ) { channels[i] = amp*audio.getLastValues()[ i ]; } now += timeStepSize; } else // in the attack time { amp += ( maxAmp - amp )*timeStepSize/( attackTime - now ); for( int i = 0; i < channels.length; i++ ) { channels[i] = amp*audio.getLastValues()[ i ]; } now += timeStepSize; } } }
2,895
492
<filename>imapfw/actions/__init__.py # Order of imports is order of actions in command line help message. from .unittests import UnitTests from .noop import Noop from .testrascal import TestRascal from .examine import Examine from .shell import ShellAction from .devel import Devel from .syncaccounts import SyncAccounts
92
1,178
<filename>common/c_math/filter.h /* * Copyright 2020 Makani Technologies 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. */ #ifndef COMMON_C_MATH_FILTER_H_ #define COMMON_C_MATH_FILTER_H_ #include <stdbool.h> #include <stdint.h> #include "common/c_math/vec3.h" #ifdef __cplusplus extern "C" { #endif typedef struct { double max, timer; } HoldData; typedef enum { kFilterTypeLowPass, kFilterTypeHighPass, kFilterTypeBandPass, kFilterTypeBandStop, kFilterTypeDiffAndLowPass } FilterType; typedef enum { kIntegratorModeIntegrate, kIntegratorModeReset, kIntegratorModeHold } IntegratorMode; typedef struct { double kp, ki, kd; double int_output_min, int_output_max; } PidParams; typedef struct { double *array; int32_t size; double sum; int32_t next_idx; bool full; } CircularAveragingBuffer; // Calculates a running variance of values in a circular buffer. // // Args: // x: Value to be written. // n: Length of the buffer. // x_buf: Circular buffer. // ind: Input/output parameter indicating index to write x. // Cyclically incremented by this function. // // Returns: // The variance of the elements of the updated buffer (note that the // variance is normalized by n rather than n-1, i.e. equivalent to // calling var(x_buf, 1) in MATLAB rather than var(x_buf). double RunningVar(double x, int32_t n, double x_buf[], int32_t *ind); // Single-pole low pass filter. This function calculates the filter // coefficients online, so it may be used with varying cutoff // frequencies. // // Args: // u: Input signal value. // fc: Cutoff frequency [Hz]. // ts: Sample time [s]. // y_z1: State of the filter, i.e. last output value. // // Returns: // Filtered signal. double Lpf(double u, double fc, double ts, double *y_z1); // Single-pole low pass filter on a Vec3 signal (see Lpf). const Vec3 *LpfVec3(const Vec3 *u, double fc, double ts, Vec3 *y_z1); // Single-pole high pass filter. This function calculates the filter // coefficients online, so it may be used with varying cutoff // frequencies. // // Args: // u: Input signal value. // fc: Cutoff frequency [Hz]. // ts: Sample time [s]. // y_z1: State of the filter, i.e. last output value. // // Returns: // Filtered signal. double Hpf(double u, double fc, double ts, double *y_z1, double *u_z1); // Derivative of a signal. // // Args: // u: Input signal value. // ts: Sample time [s]. // u_z1: State of the filter, i.e. last input value. // // Returns: // Derivative of u. double Diff(double u, double ts, double *u_z1); // Derivative of a Vec3 signal (see Diff). const Vec3 *DiffVec3(const Vec3 *u, double ts, Vec3 *du, Vec3 *u_z1); // Differentiates a variable with circular topology. Prevents // spurious results when crossing over the wrapping threshold. Note // that if the input can jump greater than half of the wrap range in a // single loop, then the derivative will be incorrect. // // Args: // u: Input signal value. // wrap_range: Difference between the maximum and minimum possible // values of the input. // ts: Sample time [s]. // u_z1: State of the filter, i.e. last input value. // // Returns: // Derivative of u. double DiffCircular(double u, double wrap_range, double ts, double *u_z1); // Rate limits a signal between a low and a high rate. // // Args: // u: Input signal value. // low: The signal cannot decrease faster than low [#/s]. // high: The signal cannot increase faster than high [#/s]. // ts: Sample time [s]. // y_z1: State of the filter, i.e. last output value. // // Returns: // Rate-limited signal. double RateLimit(double u, double low, double high, double ts, double *y_z1); // Rate limits an integer signal between a low and a high rate (see // RateLimit). int32_t RateLimitInt32(int32_t u, int32_t low, int32_t high, double ts, int32_t *y_z1); // Rate limits a Vec3 signal between a low and a high rate (see // RateLimit). const Vec3 *RateLimitVec3(const Vec3 *u, const Vec3 *low, const Vec3 *high, double ts, Vec3 *y_z1); // Rate limits a signal with a circular topology between a low and a // high rate. // // Args: // u: Input signal value. // low_rate: The signal cannot decrease faster than low [#/s]. // high_rate: The signal cannot increase faster than high [#/s]. // low_wrap: Minimum value of the range. // high_wrap: Maximum value of the range. // ts: Sample time [s]. // y_z1: State of the filter, i.e. last output value. // // Returns: // Rate-limited signal. double RateLimitCircular(double u, double low_rate, double high_rate, double low_wrap, double high_wrap, double ts, double *y_z1); // Linear filter in Direct Form II. // // Here is some example Python code to calculate a and b vectors for a // 10 rad/s, single-pole low pass filter in a 100 Hz loop: // // import scipy.signal as signal // (b, a) = signal.bilinear([10.0], [1.0, 10.0], 100.0) // // Args: // u: Input signal value. // n: Length of the a and b coefficient vectors. Note that this is // one more than the order of the filter. // a: Filter denominator coefficients. Note that the first // coefficient of a assumed to be 1. // b: Filter numerator coefficients. // z: Delay line, which must have length n - 1. Most recent value // is stored in z[0]. // // Returns: // Filtered signal. double Filter(double u, int32_t n, const double a[], const double b[], double z[]); // Linear filter in Direct Form II implemented with a circular buffer. // ind stores the most recent value of the delay line. double FilterCircularBuffer(double u, int32_t n, const double a[], const double b[], double z[], int32_t *ind); // Holds the maximum input value for hold_time. Resets to current // value after hold_time. // // Args: // u: Input signal value. // hold_time: Time [s] to hold the maximum value. // ts: Sample time [s]. // hold_data: State of the filter that contains the maximum value // and a countdown timer. // // Returns: // Held input value. double HoldMax(double u, double hold_time, double ts, HoldData *hold_data); // Latches a non-zero signal on for specified hold time. // // Args: // u: Input signal to latch when non-zero. // hold_time: Time [s] to latch the input signal. // ts: Sample time [s]. // counter: State of the filter that contains a countdown timer. // // Returns: // True for hold_time after u is non-zero; otherwise returns false. bool LatchOn(int32_t u, double hold_time, double ts, int32_t *counter); // Zero-order hold. Converts a signal with any sample rate to one // with sample rate ts. // // Args: // t: Current time [s]. // u: Input signal value. // ts: Sample time [s]. // t_z1: Last time [s] when this function was called. // u_z1: Last input value when this function was called. // // Returns: // Sampled signal. double Zoh(double t, double u, double ts, double *t_z1, double *u_z1); // Adds backlash to a signal. // // Args: // u: Input signal value. // width: Width of the backlash. When switching directions, the // output does not change until the input has changed by this // width. // y_z1: State of the filter, i.e. last output value. // // Returns: // Signal with backlash. double Backlash(double u, double width, double *y_z1); // Delays a signal by n samples. // // Args: // u: Input signal value. // n: Number of samples to delay the signal by. // buf: Buffer of size n to store the delayed signal. // ind: Index of the most recently added value. // // Returns: // Delayed signal. double Delay(double u, int32_t n, double buf[], int32_t *ind); // General purpose integrator with saturations and hold and reset // commands. // // Args: // u: Value to be integrated. // low: Integrator is saturated from below by this. // high: Integrator is saturated from above by this. // ts: Sample time. // mode: Either integrate, hold, or reset the integrator. // int_u: In/out argument that holds the integrator state. // // Returns: // Returns a copy of the integrator state. double Integrator(double u, double low, double high, double ts, IntegratorMode mode, double *int_u); // Runs a simple proportional-integral-derivative (PID) loop. // // The derivative of the error is an input (rather than being // calculated internally) for two reasons: 1) This allows using // measured derivative (e.g. from a rate gyro) 2) Derivative terms // should be low-pass-filtered in any case. // // Args: // error: Error signal to integrate and apply proportional gain to. // deriv_error: Derivative of the error signal. // ts: Sample time. // int_mode: Command to integrate, hold, or reset the integrator. // params: Parameter structure that include P, I, and D gains as // well as the saturation limits. // int_output: In-out parameter that holds the integrated state. // // Returns: // The output of the PID loop, which is the P, I, and D gains // multiplied by the error, error derivative, and integrated error, // respectively. double Pid(double error, double deriv_error, double ts, IntegratorMode int_mode, const PidParams *params, double *int_output); // Runs a proportional-integral-derivative (PID) loop with // back-calculation anti-windup (see Astrom and Murray, Feedback // Systems). // // Args: // error: Error signal to integrate and apply proportional gain to. // deriv_error: Derivative of the error signal. // tracking_error: This is the difference between the measured or // modeled actuator output and the output of the PID loop. // ts: Sample time. // int_mode: Command to integrate, hold, or reset the integrator. // params: Parameter structure that include P, I, and D gains as // well as the saturation limits. // int_output: In-out parameter that holds the integrated state. // // Returns: // The output of the PID loop, which is the P, I, and D gains // multiplied by the error, error derivative, and integrated error, // respectively. double PidAntiWindup(double error, double deriv_error, double tracking_error, double ts, IntegratorMode mode, const PidParams *params, double *int_output); // Linear interpolation between two PID parameter sets, p0 and p1, // based on a parameter x and the limits x_low and x_high. // // x <= x_low p_out = p0 // x_low < x < x_high linear interpolation between p0 and p1 // x >= x_high p_out = p1 void CrossfadePidParams(const PidParams *p0, const PidParams *p1, double x, double x_low, double x_high, PidParams *p_out); // Calculates the second order filter coefficients using the Tustin // method on a standard continuous second order transfer function. // // Args: // fc: Cutoff frequency [Hz]. // zeta: Damping ratio [#]. // ts: Sample time [s]. // filter_type: Enum that sets whether the filter is a low pass, // high pass, band pass, band stop, or differentiated low pass // filter. // a: Denominator coefficients. This array must have a length of 3. // b: Numerator coefficients. This array must have a length of 3. void SecondOrderFilterCoeff(double fc, double zeta, double ts, FilterType type, double a[], double b[]); // Initializes the internal state of a second-order filter implemented // in Direct Form II. The argument u0 is the steady-state input value. void Lpf2Init(double u0, double fc, double zeta, double ts, double z[]); void Lpf2Vec3Init(const Vec3 *u0, double fc, double zeta, double ts, Vec3 z[]); // Second-order low pass filter. double Lpf2(double u, double fc, double zeta, double ts, double z[]); // Second-order high pass filter. double Hpf2(double u, double fc, double zeta, double ts, double z[]); // Second-order band pass filter. double BandPass2(double u, double fc, double zeta, double ts, double z[]); // Second-order low pass filter of a differentiated signal. double DiffLpf2(double u, double fc, double zeta, double ts, double z[]); // Second-order low pass filter on a Vec3 signal. See Lpf2. const Vec3 *Lpf2Vec3(const Vec3 *u, double fc, double zeta, double ts, Vec3 *y, Vec3 z[]); // Second-order high pass filter on a Vec3 signal. See Hpf2. const Vec3 *Hpf2Vec3(const Vec3 *u, double fc, double zeta, double ts, Vec3 *y, Vec3 z[]); // Second-order band pass filter on a Vec3 signal. const Vec3 *BandPass2Vec3(const Vec3 *u, double fc, double zeta, double ts, Vec3 *y, Vec3 z[]); // Second-order low pass filter of a differentiated Vec3 signal. See // DiffLpf2. const Vec3 *DiffLpf2Vec3(const Vec3 *u, double fc, double zeta, double ts, Vec3 *y, Vec3 z[]); // Peak detection filter. Increases in the input signal are // unfiltered while decreases are low pass filtered. // // Args: // u: Input signal value. // fc_down: Low pass filter frequency [Hz] for decreasing signals. // ts: Sample time [s]. // y_z1: State of the filter, i.e. last output value. // // Returns: // Filtered signal. double PeakDetector(double u, double fc_down, double ts, double *y_z1); // Peak detection filter for a Vec3 signal. See PeakDetector. const Vec3 *PeakDetectorVec3(const Vec3 *u, double fc, double ts, Vec3 *y_z1); // Initializes a CircularAveragingBuffer with the given array and size. void InitCircularAveragingBuffer(double *array, int32_t size, CircularAveragingBuffer *buffer); // Updates the circular averaging buffer with the provided new value, and // returns the new average of the buffer. double UpdateCircularAveragingBuffer(double new_val, CircularAveragingBuffer *buffer); #ifdef __cplusplus } // extern "C" #endif #endif // COMMON_C_MATH_FILTER_H_
5,068
340
<filename>include/eve/module/real/core/function/regular/generic/compress_store.hpp //================================================================================================== /* EVE - Expressive Vector Engine Copyright : EVE Contributors & Maintainers SPDX-License-Identifier: MIT */ //================================================================================================== #pragma once #include <eve/detail/function/compress_store_impl.hpp> #include <eve/detail/kumi.hpp> namespace eve::detail { template<relative_conditional_expr C, real_scalar_value T, real_scalar_value U, typename N, simd_compatible_ptr<wide<T, N>> Ptr> EVE_FORCEINLINE T* compress_store_(EVE_SUPPORTS(cpu_), C c, safe_type, wide<T, N> v, logical<wide<U, N>> mask, Ptr ptr) noexcept { alignas(sizeof(v)) std::array<element_type_t<T>, N{}()> buffer; T* up_to = compress_store_impl(c, v, mask, buffer.begin()); std::ptrdiff_t n = up_to - buffer.begin(); auto* out = as_raw_pointer(ptr) + c.offset(as(mask)); wide<T, N> compressed{aligned_ptr<T, N>{buffer.begin()}}; store[keep_first(n)](compressed, out); return out + n; } template<relative_conditional_expr C, real_scalar_value T, real_scalar_value U, typename N, simd_compatible_ptr<wide<T, N>> Ptr> EVE_FORCEINLINE T* compress_store_(EVE_SUPPORTS(cpu_), C c, unsafe_type, wide<T, N> v, logical<wide<U, N>> mask, Ptr ptr) noexcept { if (!C::is_complete) return safe(compress_store[c])(v, mask, ptr); else return compress_store_impl(c, v, mask, ptr); } template< relative_conditional_expr C, decorator Decorator , kumi::product_type T, real_scalar_value U, typename N , data_source Ptr > EVE_FORCEINLINE auto compress_store_(EVE_SUPPORTS(cpu_), C c, Decorator d, wide<T, N> vs, logical<wide<U, N>> mask, Ptr ptrs) noexcept { return kumi::map ( [&] (auto v, auto p) { return compress_store(c, d, v, mask, p); }, vs.storage(), ptrs); } template<relative_conditional_expr C, decorator Decorator, real_scalar_value T, real_scalar_value U, typename N, simd_compatible_ptr<logical<wide<T, N>>> Ptr> EVE_FORCEINLINE logical<T>* compress_store_(EVE_SUPPORTS(cpu_), C c, Decorator d, logical<wide<T, N>> v, logical<wide<U, N>> mask, Ptr ptr) noexcept { auto* raw_ptr = compress_store(c, d, v.mask(), mask, ptr_cast<typename logical<T>::mask_type>(ptr)); return (logical<T> *)raw_ptr; } template <decorator Decorator, simd_value T, simd_value U, typename Ptr> EVE_FORCEINLINE auto compress_store_(EVE_SUPPORTS(cpu_), Decorator d, T v, logical<U> mask, Ptr ptr) noexcept -> decltype(compress_store(ignore_none, d, v, mask, ptr)) { return compress_store(ignore_none, d, v, mask, ptr); } template <decorator Decorator, simd_value T, simd_value U, typename Ptr> EVE_FORCEINLINE auto compress_store_(EVE_SUPPORTS(cpu_), Decorator d, logical<T> v, logical<U> mask, Ptr ptr) noexcept -> decltype(compress_store(ignore_none, d, v, mask, ptr)) { return compress_store(ignore_none, d, v, mask, ptr); } }
1,930
494
/** * Copyright 2013 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.netflix.astyanax.query; import java.nio.ByteBuffer; import java.util.List; import java.util.UUID; import com.netflix.astyanax.Execution; import com.netflix.astyanax.Serializer; import com.netflix.astyanax.model.CqlResult; /** * Interface for specifying parameters on a prepared CQL query. * * Values must be specified in the order that they were defined in the query. * * @author elandau * * @param <K> * @param <C> */ public interface PreparedCqlQuery<K, C> extends Execution<CqlResult<K, C>> { /** * Specify a value of custom type for which a convenience method does not exist * @param value * @param serializer */ <V> PreparedCqlQuery<K, C> withByteBufferValue(V value, Serializer<V> serializer); /** * Set the next parameter value to this ByteBuffer * @param value */ PreparedCqlQuery<K, C> withValue(ByteBuffer value); /** * Add a list of ByteBuffer values * @param value */ PreparedCqlQuery<K, C> withValues(List<ByteBuffer> value); /** * Set the next parameter value to this String * @param value */ PreparedCqlQuery<K, C> withStringValue(String value); /** * Set the next parameter value to this Integer * @param value */ PreparedCqlQuery<K, C> withIntegerValue(Integer value); /** * Set the next parameter value to this Boolean * @param value */ PreparedCqlQuery<K, C> withBooleanValue(Boolean value); /** * Set the next parameter value to this Double * @param value */ PreparedCqlQuery<K, C> withDoubleValue(Double value); /** * Set the next parameter value to this Long * @param value */ PreparedCqlQuery<K, C> withLongValue(Long value); /** * Set the next parameter value to this Float * @param value */ PreparedCqlQuery<K, C> withFloatValue(Float value); /** * Set the next parameter value to this Short * @param value */ PreparedCqlQuery<K, C> withShortValue(Short value); /** * Set the next parameter value to this Short * @param value */ PreparedCqlQuery<K, C> withUUIDValue(UUID value); }
1,003
651
package com.ncipher.km.nfkm; import com.ncipher.km.marshall.NFKM_SoftCardIdent; import com.ncipher.nfast.NFException; public class SoftCard { public void load(Module module, CmdCallBack callback) throws NFException { throw new RuntimeException("fake nCipher"); } public String getName() { throw new RuntimeException("fake nCipher"); } public NFKM_SoftCardIdent getID() { throw new RuntimeException("fake nCipher"); } }
149
644
<reponame>dendisuhubdy/coriander """ Tests the crash dump on error, makes sure we get the ll, cl, and meta """ import os from os import path import subprocess from test import test_common import pytest @pytest.mark.xfail(reason='since we always rebuild all now, this no longer is implemented to fail correclty') def test_crashdump(): """ So, what we need to do is: - use cocl to create a hostraw file (and other files besides, but we'll overwrite them) - overwrite the -device.cl file with some broken stuff - similar for the -device.ll, so it's easier to read - rerun cocl, to create the binary - run the binary - check dumpfiles are created """ cu_sourcecode = """ __global__ void mykernel(float *data) { } int main(int argc, char *argv[]) { mykernel<<<dim3(1,1,1), dim3(32,1,1)>>>(0); return 0; } """ with open('/tmp/crashdump.cu', 'w') as f: f.write(cu_sourcecode) print(subprocess.check_output([ 'bin/cocl', '/tmp/crashdump.cu' ] + test_common.cocl_options()).decode('utf-8')) for file in ['failed-kernel.cl', 'failed-kernel.ll', 'failed-kernel-meta.txt']: if path.isfile('/tmp/%s' % file): os.unlink('/tmp/%s' % file) with open('/tmp/crashdump-device.ll', 'w') as f: f.write('my pretend ll file contents') with open('/tmp/crashdump-device.cl', 'w') as f: f.write('my pretend cl file contents. this will certainly crash :-P') print(subprocess.check_output([ 'bin/cocl', '/tmp/crashdump.cu' ] + test_common.cocl_options()).decode('utf-8')) threw = False try: print(subprocess.check_output([ '/tmp/crashdump' ]).decode('utf-8')) except: threw = True assert threw with open('/tmp/failed-kernel.ll', 'r') as f: llfile = f.read() with open('/tmp/failed-kernel.cl', 'r') as f: clfile = f.read() with open('/tmp/failed-kernel-meta.txt', 'r') as f: meta = f.read() print('ll:\n[%s]' % llfile) print('cl:\n[%s]' % clfile) print('meta:\n[%s]' % meta)
900