max_stars_count
int64 301
224k
| text
stringlengths 6
1.05M
| token_count
int64 3
727k
|
---|---|---|
1,169 | <reponame>Biangkerok32/punya<filename>appinventor/appengine/src/com/google/appinventor/shared/rpc/Motd.java
// -*- mode: java; c-basic-offset: 2; -*-
// Copyright 2009-2011 Google, All Rights reserved
// Copyright 2011-2012 MIT, All rights reserved
// Released under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
package com.google.appinventor.shared.rpc;
import com.google.gwt.user.client.rpc.IsSerializable;
import java.io.Serializable;
/**
* Data Transfer Object representing motd.
*
* @author <EMAIL> (<NAME>)
*/
public class Motd implements IsSerializable, MotdProvider, Serializable {
private long id;
// Caption of the MOTD
private String caption;
// The content of the MOTD, if there is any
private String content = null;
/**
* Creates a new motd data transfer object.
*
* @param id motd's ID
* @param caption caption
* @param content more detail, if any
*/
public Motd(long id, String caption, String content) {
this.id = id;
this.caption = caption;
this.content = content;
}
/**
* Default constructor. This constructor is required by GWT.
*/
@SuppressWarnings("unused")
private Motd() {
}
/**
* Returns the id.
*
* @return id
*/
public long getId() {
return id;
}
/**
* Returns the caption.
*
* @return caption
*/
public String getCaption() {
return caption;
}
/**
* Returns whether or not the MOTD has content
*/
public boolean hasContent() {
return content != null;
}
/**
* Returns the content.
*
* @return content
*/
public String getContent() {
return content;
}
/**
* Returns this object.
*
* @return motd
*/
@Override
public Motd getMotd() {
return this;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Motd)) return false;
Motd motd = (Motd) obj;
if (!motd.getCaption().equals(this.caption)) return false;
if (!(motd.hasContent() == this.hasContent())) return false;
return motd.hasContent() ? motd.getContent().equals(this.content) : true;
}
@Override
public int hashCode() {
return (int) (id ^ (id >>> 32));
}
}
| 785 |
1,224 | /* C-style API for DIRECT functions. SGJ (August 2007). */
#include "direct-internal.h"
/* Perform global minimization using (Gablonsky implementation of) DIRECT
algorithm. Arguments:
f, f_data: the objective function and any user data
-- the objective function f(n, x, undefined_flag, data) takes 4 args:
int n: the dimension, same as dimension arg. to direct_optimize
const double *x: array x[n] of point to evaluate
int *undefined_flag: set to 1 on return if x violates constraints
or don't touch otherwise
void *data: same as f_data passed to direct_optimize
return value = value of f(x)
dimension: the number of minimization variable dimensions
lower_bounds, upper_bounds: arrays of length dimension of variable bounds
x: an array of length dimension, set to optimum variables upon return
minf: on return, set to minimum f value
magic_eps, magic_eps_abs: Jones' "magic" epsilon parameter, and
also an absolute version of the same
(not multipled by minf). Jones suggests
setting this to 1e-4, but 0 also works...
max_feval, max_iter: maximum number of function evaluations & DIRECT iters
volume_reltol: relative tolerance on hypercube volume (0 if none)
sigma_reltol: relative tolerance on hypercube "measure" (??) (0 if none)
fglobal: the global minimum of f, if known ahead of time
-- this is mainly for benchmarking, in most cases it
is not known and you should pass DIRECT_UNKNOWN_FGLOBAL
fglobal_reltol: relative tolerance on how close we should find fglobal
-- ignored if fglobal is DIRECT_UNKNOWN_FGLOBAL
logfile: an output file to write diagnostic info to (NULL for no I/O)
algorithm: whether to use the original DIRECT algorithm (DIRECT_ORIGINAL)
or Gablonsky's "improved" version (DIRECT_GABLONSKY)
*/
direct_return_code direct_optimize(
direct_objective_func f, void *f_data,
int dimension,
const double *lower_bounds, const double *upper_bounds,
double *x, double *minf,
int max_feval, int max_iter,
double start, double maxtime,
double magic_eps, double magic_eps_abs,
double volume_reltol, double sigma_reltol,
int *force_stop,
double fglobal,
double fglobal_reltol,
FILE *logfile,
direct_algorithm algorithm)
{
integer algmethod = algorithm == DIRECT_GABLONSKY;
integer ierror;
doublereal *l, *u;
int i;
/* convert to percentages: */
volume_reltol *= 100;
sigma_reltol *= 100;
fglobal_reltol *= 100;
/* make sure these are ignored if <= 0 */
if (volume_reltol <= 0) volume_reltol = -1;
if (sigma_reltol <= 0) sigma_reltol = -1;
if (fglobal == DIRECT_UNKNOWN_FGLOBAL)
fglobal_reltol = DIRECT_UNKNOWN_FGLOBAL_RELTOL;
if (dimension < 1) return DIRECT_INVALID_ARGS;
l = (doublereal *) malloc(sizeof(doublereal) * dimension * 2);
if (!l) return DIRECT_OUT_OF_MEMORY;
u = l + dimension;
for (i = 0; i < dimension; ++i) {
l[i] = lower_bounds[i];
u[i] = upper_bounds[i];
}
direct_direct_(f, x, &dimension, &magic_eps, magic_eps_abs,
&max_feval, &max_iter,
start, maxtime, force_stop,
minf,
l, u,
&algmethod,
&ierror,
logfile,
&fglobal, &fglobal_reltol,
&volume_reltol, &sigma_reltol,
f_data);
free(l);
return (direct_return_code) ierror;
}
| 1,412 |
1,350 | <reponame>Shashi-rk/azure-sdk-for-java<gh_stars>1000+
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.logic.models;
import com.azure.core.util.ExpandableStringEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.util.Collection;
/** Defines values for IntegrationServiceEnvironmentSkuScaleType. */
public final class IntegrationServiceEnvironmentSkuScaleType
extends ExpandableStringEnum<IntegrationServiceEnvironmentSkuScaleType> {
/** Static value Manual for IntegrationServiceEnvironmentSkuScaleType. */
public static final IntegrationServiceEnvironmentSkuScaleType MANUAL = fromString("Manual");
/** Static value Automatic for IntegrationServiceEnvironmentSkuScaleType. */
public static final IntegrationServiceEnvironmentSkuScaleType AUTOMATIC = fromString("Automatic");
/** Static value None for IntegrationServiceEnvironmentSkuScaleType. */
public static final IntegrationServiceEnvironmentSkuScaleType NONE = fromString("None");
/**
* Creates or finds a IntegrationServiceEnvironmentSkuScaleType from its string representation.
*
* @param name a name to look for.
* @return the corresponding IntegrationServiceEnvironmentSkuScaleType.
*/
@JsonCreator
public static IntegrationServiceEnvironmentSkuScaleType fromString(String name) {
return fromString(name, IntegrationServiceEnvironmentSkuScaleType.class);
}
/** @return known IntegrationServiceEnvironmentSkuScaleType values. */
public static Collection<IntegrationServiceEnvironmentSkuScaleType> values() {
return values(IntegrationServiceEnvironmentSkuScaleType.class);
}
}
| 495 |
338 | <reponame>XmobiTea-Family/ezyfox-server<gh_stars>100-1000
package com.tvd12.ezyfoxserver.setting;
import com.tvd12.ezyfox.util.EzyToMap;
public interface EzyBaseSocketSetting extends EzyToMap {
int getPort();
String getAddress();
boolean isActive();
boolean isSslActive();
String getCodecCreator();
}
| 147 |
348 | {"nom":"Meys","circ":"10ème circonscription","dpt":"Rhône","inscrits":608,"abs":265,"votants":343,"blancs":4,"nuls":2,"exp":337,"res":[{"nuance":"REM","nom":"<NAME>","voix":99},{"nuance":"LR","nom":"Mme <NAME>","voix":95},{"nuance":"FN","nom":"Mme <NAME>","voix":74},{"nuance":"FI","nom":"M. <NAME>","voix":31},{"nuance":"ECO","nom":"M. <NAME>","voix":12},{"nuance":"DLF","nom":"M. <NAME>","voix":12},{"nuance":"ECO","nom":"Mme <NAME>","voix":6},{"nuance":"EXD","nom":"M. <NAME>","voix":4},{"nuance":"DIV","nom":"Mme <NAME>","voix":3},{"nuance":"COM","nom":"Mme <NAME>","voix":1},{"nuance":"DVD","nom":"M. <NAME>","voix":0},{"nuance":"EXG","nom":"<NAME>","voix":0}]} | 273 |
11,750 | <gh_stars>1000+
import pytest
from _plotly_utils.basevalidators import BaseDataValidator
from plotly.graph_objs import Scatter, Bar, Box
# Fixtures
# --------
@pytest.fixture()
def validator():
return BaseDataValidator(
class_strs_map={"scatter": "Scatter", "bar": "Bar", "box": "Box"},
plotly_name="prop",
parent_name="parent",
set_uid=True,
)
@pytest.fixture()
def validator_nouid():
return BaseDataValidator(
class_strs_map={"scatter": "Scatter", "bar": "Bar", "box": "Box"},
plotly_name="prop",
parent_name="parent",
set_uid=False,
)
# Tests
# -----
def test_acceptance(validator):
val = [Scatter(mode="lines"), Box(fillcolor="yellow")]
res = validator.validate_coerce(val)
res_present = validator.present(res)
assert isinstance(res, list)
assert isinstance(res_present, tuple)
assert isinstance(res_present[0], Scatter)
assert res_present[0].type == "scatter"
assert res_present[0].mode == "lines"
assert isinstance(res_present[1], Box)
assert res_present[1].type == "box"
assert res_present[1].fillcolor == "yellow"
# Make sure UIDs are actually unique
assert res_present[0].uid != res_present[1].uid
def test_acceptance_dict(validator):
val = (dict(type="scatter", mode="lines"), dict(type="box", fillcolor="yellow"))
res = validator.validate_coerce(val)
res_present = validator.present(res)
assert isinstance(res, list)
assert isinstance(res_present, tuple)
assert isinstance(res_present[0], Scatter)
assert res_present[0].type == "scatter"
assert res_present[0].mode == "lines"
assert isinstance(res_present[1], Box)
assert res_present[1].type == "box"
assert res_present[1].fillcolor == "yellow"
# Make sure UIDs are actually unique
assert res_present[0].uid != res_present[1].uid
def test_default_is_scatter(validator):
val = [dict(mode="lines")]
res = validator.validate_coerce(val)
res_present = validator.present(res)
assert isinstance(res, list)
assert isinstance(res_present, tuple)
assert isinstance(res_present[0], Scatter)
assert res_present[0].type == "scatter"
assert res_present[0].mode == "lines"
def test_rejection_type(validator):
val = 37
with pytest.raises(ValueError) as validation_failure:
validator.validate_coerce(val)
assert "Invalid element(s)" in str(validation_failure.value)
def test_rejection_element_type(validator):
val = [42]
with pytest.raises(ValueError) as validation_failure:
validator.validate_coerce(val)
assert "Invalid element(s)" in str(validation_failure.value)
def test_rejection_element_attr(validator):
val = [dict(type="scatter", bogus=99)]
with pytest.raises(ValueError) as validation_failure:
validator.validate_coerce(val)
assert (
"Invalid property specified for object of type "
+ "plotly.graph_objs.Scatter: 'bogus'"
in str(validation_failure.value)
)
def test_rejection_element_tracetype(validator):
val = [dict(type="bogus", a=4)]
with pytest.raises(ValueError) as validation_failure:
validator.validate_coerce(val)
assert "Invalid element(s)" in str(validation_failure.value)
def test_skip_invalid(validator_nouid):
val = (
dict(
type="scatter",
mode="lines",
marker={"color": "green", "bogus": 23},
line="bad_value",
),
dict(type="box", fillcolor="yellow", bogus=111),
dict(type="bogus", mode="lines+markers", x=[2, 1, 3]),
)
expected = [
dict(type="scatter", mode="lines", marker={"color": "green"}),
dict(type="box", fillcolor="yellow"),
dict(type="scatter", mode="lines+markers", x=[2, 1, 3]),
]
res = validator_nouid.validate_coerce(val, skip_invalid=True)
assert [el.to_plotly_json() for el in res] == expected
| 1,601 |
1,268 | class SubscriptionHtml(object):
"""The HTML of an SubscriptionTracking."""
def __init__(self, subscription_html=None):
"""Create a SubscriptionHtml object
:param subscription_html: Html to be appended to the email, with the
subscription tracking link. You may control
where the link is by using the tag <% %>
:type subscription_html: string, optional
"""
self._subscription_html = None
if subscription_html is not None:
self.subscription_html = subscription_html
@property
def subscription_html(self):
"""Html to be appended to the email, with the subscription tracking link.
You may control where the link is by using the tag <% %>
:rtype: string
"""
return self._subscription_html
@subscription_html.setter
def subscription_html(self, value):
"""Html to be appended to the email, with the subscription tracking link.
You may control where the link is by using the tag <% %>
:param value: Html to be appended to the email, with the subscription
tracking link. You may control where the link is by using
the tag <% %>
:type value: string
"""
self._subscription_html = value
def get(self):
"""
Get a JSON-ready representation of this SubscriptionHtml.
:returns: This SubscriptionHtml, ready for use in a request body.
:rtype: string
"""
return self.subscription_html
| 658 |
1,457 | package org.kairosdb.rollup;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.kairosdb.core.datapoints.LongDataPointFactory;
import org.kairosdb.core.datapoints.LongDataPointFactoryImpl;
import org.kairosdb.core.datapoints.StringDataPointFactory;
import org.kairosdb.core.datastore.KairosDatastore;
import org.kairosdb.core.datastore.QueryMetric;
import org.kairosdb.core.exception.DatastoreException;
import org.kairosdb.core.reporting.ThreadReporter;
import org.kairosdb.core.scheduler.KairosDBSchedulerImpl;
import org.kairosdb.eventbus.FilterEventBus;
import org.kairosdb.eventbus.Publisher;
import org.kairosdb.events.DataPointEvent;
import org.quartz.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import static com.google.common.base.Preconditions.checkState;
public class RollUpJob implements InterruptableJob
{
private static final Logger log = LoggerFactory.getLogger(KairosDBSchedulerImpl.class);
private static final String ROLLUP_TIME = "kairosdb.rollup.execution-time";
private boolean interrupted;
private LongDataPointFactory longDataPointFactory = new LongDataPointFactoryImpl();
private StringDataPointFactory stringDataPointFactory = new StringDataPointFactory();
public RollUpJob()
{
}
@SuppressWarnings("ConstantConditions")
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException
{
JobDataMap dataMap = jobExecutionContext.getMergedJobDataMap();
processRollups(jobExecutionContext, dataMap);
}
private void processRollups(JobExecutionContext jobExecutionContext, JobDataMap dataMap)
{
try
{
RollupTask task = (RollupTask) dataMap.get("task");
FilterEventBus eventBus = (FilterEventBus) dataMap.get("eventBus");
KairosDatastore datastore = (KairosDatastore) dataMap.get("datastore");
String hostName = (String) dataMap.get("hostName");
RollupTaskStatusStore statusStore = (RollupTaskStatusStore) dataMap.get("statusStore");
checkState(task != null, "Task was null");
checkState(eventBus != null, "EventBus was null");
checkState(datastore != null, "Datastore was null");
checkState(hostName != null, "hostname was null");
checkState(statusStore != null, "statusStore was null");
if (isJobAlreadyRunning(jobExecutionContext, task.getName())) return;
Publisher<DataPointEvent> publisher = eventBus.createPublisher(DataPointEvent.class);
for (Rollup rollup : task.getRollups())
{
log.info("Executing Rollup Task: " + task.getName() + " for Rollup " + rollup.getSaveAs());
RollupTaskStatus status = new RollupTaskStatus(jobExecutionContext.getNextFireTime(), hostName);
RollupProcessor processor = new RollupProcessorImpl(datastore);
if (interrupted){
processor.interrupt();
break;
}
for (QueryMetric queryMetric : rollup.getQueryMetrics())
{
if (interrupted)
{
processor.interrupt();
break;
}
boolean success = true;
try
{
long executionStartTime = System.currentTimeMillis();
long dpCount = processor.process(statusStore, task, queryMetric, rollup.getTimeZone());
long executionLength = System.currentTimeMillis() - executionStartTime;
status.addStatus(RollupTaskStatus.createQueryMetricStatus(queryMetric.getName(), System.currentTimeMillis(), dpCount, executionLength));
}
catch (DatastoreException e)
{
success = false;
log.error("Failed to execute query for roll-up task: " + task.getName() + " roll-up: " + rollup.getSaveAs(), e);
status.addStatus(RollupTaskStatus.createErrorQueryMetricStatus(queryMetric.getName(), System.currentTimeMillis(), ExceptionUtils.getStackTrace(e), 0));
}
catch (RuntimeException e)
{
success = false;
log.error("Failed to roll-up task: " + task.getName() + " roll-up: " + rollup.getSaveAs(), e);
status.addStatus(RollupTaskStatus.createErrorQueryMetricStatus(queryMetric.getName(), System.currentTimeMillis(), ExceptionUtils.getStackTrace(e), 0));
}
finally
{
log.info("Rollup Task: " + task.getName() + " for Rollup " + rollup.getSaveAs() + " completed");
try
{
ThreadReporter.setReportTime(System.currentTimeMillis());
ThreadReporter.clearTags();
ThreadReporter.addTag("host", hostName);
ThreadReporter.addTag("rollup", rollup.getSaveAs());
ThreadReporter.addTag("rollup-task", task.getName());
ThreadReporter.addTag("status", success ? "success" : "failure");
ThreadReporter.addDataPoint(ROLLUP_TIME, System.currentTimeMillis() - ThreadReporter.getReportTime());
ThreadReporter.submitData(longDataPointFactory, stringDataPointFactory, publisher);
}
catch (DatastoreException e)
{
log.error("Could not report metrics for rollup job.", e);
}
try {
statusStore.write(task.getId(), status);
}
catch (RollUpException e) {
log.error("Could not write status to status store" , e);
}
}
}
}
}
catch (Throwable t)
{
log.error("Failed to execute job " + jobExecutionContext.toString(), t);
}
}
private boolean isJobAlreadyRunning(JobExecutionContext jobExecutionContext, String taskName) throws SchedulerException
{
List<JobExecutionContext> jobs = jobExecutionContext.getScheduler().getCurrentlyExecutingJobs();
for (JobExecutionContext job : jobs) {
if (job.getTrigger().equals(jobExecutionContext.getTrigger()) && !job.getJobInstance().equals(this)) {
log.info("There's another instance of task " + taskName + " running so exiting.");
return true;
}
}
return false;
}
@Override
public void interrupt()
{
interrupted = true;
}
}
| 2,092 |
1,738 | <filename>dev/Code/CryEngine/RenderDll/Common/OcclQuery.h
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#ifndef CRYINCLUDE_CRYENGINE_RENDERDLL_COMMON_OCCLQUERY_H
#define CRYINCLUDE_CRYENGINE_RENDERDLL_COMMON_OCCLQUERY_H
#pragma once
class COcclusionQuery
{
public:
COcclusionQuery()
: m_nVisSamples(~0)
, m_nCheckFrame(0)
, m_nDrawFrame(0)
, m_nOcclusionID(0)
{
}
~COcclusionQuery()
{
Release();
}
void Create();
void Release();
void BeginQuery();
void EndQuery();
uint32 GetVisibleSamples(bool bAsynchronous);
int GetDrawFrame() const
{
return m_nDrawFrame;
}
bool IsReady();
bool IsCreated() const { return m_nOcclusionID != 0; }
private:
int m_nVisSamples;
int m_nCheckFrame;
int m_nDrawFrame;
UINT_PTR m_nOcclusionID; // this will carry a pointer D3DQuery, so it needs to be 64-bit on Windows 64
};
#endif // CRYINCLUDE_CRYENGINE_RENDERDLL_COMMON_OCCLQUERY_H
| 605 |
14,668 | <filename>third_party/protobuf/generate_changelog.py<gh_stars>1000+
#!/usr/bin/env python
"""Generates a friendly list of changes per language since the last release."""
import sys
import os
class Language(object):
def __init__(self, name, pathspec):
self.name = name
self.pathspec = pathspec
languages = [
Language("C++", [
"':(glob)src/google/protobuf/*'",
"src/google/protobuf/compiler/cpp",
"src/google/protobuf/io",
"src/google/protobuf/util",
"src/google/protobuf/stubs",
]),
Language("Java", [
"java",
"src/google/protobuf/compiler/java",
]),
Language("Python", [
"python",
"src/google/protobuf/compiler/python",
]),
Language("JavaScript", [
"js",
"src/google/protobuf/compiler/js",
]),
Language("PHP", [
"php",
"src/google/protobuf/compiler/php",
]),
Language("Ruby", [
"ruby",
"src/google/protobuf/compiler/ruby",
]),
Language("Csharp", [
"csharp",
"src/google/protobuf/compiler/csharp",
]),
Language("Objective C", [
"objectivec",
"src/google/protobuf/compiler/objectivec",
]),
]
if len(sys.argv) < 2:
print("Usage: generate_changelog.py <previous release>")
sys.exit(1)
previous = sys.argv[1]
for language in languages:
print(language.name)
sys.stdout.flush()
os.system(("git log --pretty=oneline --abbrev-commit %s...HEAD %s | " +
"sed -e 's/^/ - /'") % (previous, " ".join(language.pathspec)))
print("")
print("To view a commit on GitHub: " +
"https://github.com/protocolbuffers/protobuf/commit/<commit id>")
| 699 |
679 | /**************************************************************
*
* 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.
*
*************************************************************/
#ifndef _SWTABLEPG_HXX
#define _SWTABLEPG_HXX
#include <sfx2/tabdlg.hxx>
#ifndef _FIXED_HXX //autogen
#include <vcl/fixed.hxx>
#endif
#ifndef _IMAGEBTN_HXX //autogen
#include <vcl/button.hxx>
#endif
#ifndef _LSTBOX_HXX //autogen
#include <vcl/lstbox.hxx>
#endif
#include <actctrl.hxx>
#include "prcntfld.hxx"
#include "swtypes.hxx"
#include "textcontrolcombo.hxx"
class SwWrtShell;
class SwTableRep;
struct TColumn
{
SwTwips nWidth;
sal_Bool bVisible;
};
class SwFormatTablePage : public SfxTabPage
{
FixedLine aOptionsFL;
FixedText aNameFT;
TableNameEdit aNameED;
FixedText aWidthFT;
PercentField aWidthMF;
CheckBox aRelWidthCB;
FixedLine aPosFL;
RadioButton aFullBtn;
RadioButton aLeftBtn;
RadioButton aFromLeftBtn;
RadioButton aRightBtn;
RadioButton aCenterBtn;
RadioButton aFreeBtn;
FixedLine aDistFL;
FixedText aLeftFT;
PercentField aLeftMF;
FixedText aRightFT;
PercentField aRightMF;
FixedText aTopFT;
MetricField aTopMF;
FixedText aBottomFT;
MetricField aBottomMF;
FixedLine aPropertiesFL;
FixedText aTextDirectionFT;
ListBox aTextDirectionLB;
SwTableRep* pTblData;
SwTwips nSaveWidth;
SwTwips nMinTableWidth;
sal_uInt16 nOldAlign;
sal_Bool bModified;
sal_Bool bFull:1;
sal_Bool bHtmlMode : 1;
void Init();
void ModifyHdl( Edit* pEdit );
DECL_LINK( AutoClickHdl, CheckBox * );
DECL_LINK( RelWidthClickHdl, CheckBox * );
DECL_LINK( RightModifyHdl, MetricField * );
DECL_LINK( UpDownLoseFocusHdl, MetricField * );
using TabPage::ActivatePage;
using TabPage::DeactivatePage;
public:
SwFormatTablePage( Window* pParent, const SfxItemSet& rSet );
static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet);
virtual sal_Bool FillItemSet( SfxItemSet& rSet );
virtual void Reset( const SfxItemSet& rSet );
virtual void ActivatePage( const SfxItemSet& rSet );
virtual int DeactivatePage( SfxItemSet* pSet = 0 );
};
/*-------------------------------------------------------
TabPage Format/Tabelle/Spalten
--------------------------------------------------------- */
#define MET_FIELDS 6 //Anzahl der verwendeten MetricFields
class SwTableColumnPage : public SfxTabPage
{
CheckBox aModifyTableCB;
CheckBox aProportionalCB;
FixedText aSpaceFT;
MetricField aSpaceED;
FixedLine aColFL;
ImageButton aUpBtn;
FixedText aFT1;
PercentField aMF1;
FixedText aFT2;
PercentField aMF2;
FixedText aFT3;
PercentField aMF3;
FixedText aFT4;
PercentField aMF4;
FixedText aFT5;
PercentField aMF5;
FixedText aFT6;
PercentField aMF6;
ImageButton aDownBtn;
SwTableRep* pTblData;
PercentField* pFieldArr[MET_FIELDS];
FixedText* pTextArr[MET_FIELDS];
SwTwips nTableWidth;
SwTwips nMinWidth;
sal_uInt16 nNoOfCols;
sal_uInt16 nNoOfVisibleCols;
//Breite merken, wenn auf autom. Ausrichtung gestellt wird
sal_uInt16 aValueTbl[MET_FIELDS];//primaere Zuordnung der MetricFields
sal_Bool bModified:1;
sal_Bool bModifyTbl:1;
sal_Bool bPercentMode:1;
void Init(sal_Bool bWeb);
DECL_LINK( AutoClickHdl, CheckBox * );
void ModifyHdl( PercentField* pEdit );
DECL_LINK( UpHdl, PercentField * );
DECL_LINK( DownHdl, PercentField * );
DECL_LINK( LoseFocusHdl, PercentField * );
DECL_LINK( ModeHdl, CheckBox * );
void UpdateCols( sal_uInt16 nAktPos );
SwTwips GetVisibleWidth(sal_uInt16 nPos);
void SetVisibleWidth(sal_uInt16 nPos, SwTwips nNewWidth);
using TabPage::ActivatePage;
using TabPage::DeactivatePage;
public:
SwTableColumnPage( Window* pParent, const SfxItemSet& rSet );
~SwTableColumnPage();
static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet);
virtual sal_Bool FillItemSet( SfxItemSet& rSet );
virtual void Reset( const SfxItemSet& rSet );
virtual void ActivatePage( const SfxItemSet& rSet );
virtual int DeactivatePage( SfxItemSet* pSet = 0 );
};
/*-----------------12.12.96 11.48-------------------
Textfluss
--------------------------------------------------*/
class SwTextFlowPage : public SfxTabPage
{
FixedLine aFlowFL;
CheckBox aPgBrkCB;
RadioButton aPgBrkRB;
RadioButton aColBrkRB;
RadioButton aPgBrkBeforeRB;
RadioButton aPgBrkAfterRB;
CheckBox aPageCollCB;
ListBox aPageCollLB;
FixedText aPageNoFT;
NumericField aPageNoNF;
CheckBox aSplitCB;
TriStateBox aSplitRowCB;
CheckBox aKeepCB;
CheckBox aHeadLineCB;
FixedText aRepeatHeaderFT; // "dummy" to build before and after FT
FixedText aRepeatHeaderBeforeFT;
NumericField aRepeatHeaderNF;
FixedText aRepeatHeaderAfterFT;
TextControlCombo aRepeatHeaderCombo;
FixedText aTextDirectionFT;
ListBox aTextDirectionLB;
FixedLine aVertOrientFL;
FixedText aVertOrientFT;
ListBox aVertOrientLB;
SwWrtShell* pShell;
sal_Bool bPageBreak;
sal_Bool bHtmlMode;
DECL_LINK( PageBreakHdl_Impl, CheckBox* );
DECL_LINK( ApplyCollClickHdl_Impl, CheckBox* );
DECL_LINK( PageBreakPosHdl_Impl, RadioButton* );
DECL_LINK( PageBreakTypeHdl_Impl, RadioButton* );
DECL_LINK( SplitHdl_Impl, CheckBox* );
DECL_LINK( SplitRowHdl_Impl, TriStateBox* );
DECL_LINK( HeadLineCBClickHdl, void* p = 0 );
SwTextFlowPage( Window* pParent, const SfxItemSet& rSet );
~SwTextFlowPage();
public:
static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet);
virtual sal_Bool FillItemSet( SfxItemSet& rSet );
virtual void Reset( const SfxItemSet& rSet );
void SetShell(SwWrtShell* pSh);
void DisablePageBreak();
};
#endif
| 2,626 |
517 | <filename>src/lib/OpenEXRUtil/ImfImage.cpp
//
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) Contributors to the OpenEXR Project.
//
//----------------------------------------------------------------------------
//
// class Image
//
//----------------------------------------------------------------------------
#include "ImfImage.h"
#include <ImfChannelList.h>
#include <Iex.h>
#include <cassert>
#include <algorithm>
using namespace IMATH_NAMESPACE;
using namespace IEX_NAMESPACE;
using namespace std;
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
namespace {
int
levelSize (int min, int max, int l, LevelRoundingMode levelRoundingMode)
{
assert (l >= 0);
if (max < min)
return 0;
int a = max - min + 1;
int b = (1 << l);
int size = a / b;
if (levelRoundingMode == ROUND_UP && size * b < a)
size += 1;
return std::max (size, 1);
}
Box2i
computeDataWindowForLevel
(const Box2i& dataWindow,
int lx, int ly,
LevelRoundingMode lrMode)
{
V2i levelMax =
dataWindow.min +
V2i (levelSize (dataWindow.min.x, dataWindow.max.x, lx, lrMode) - 1,
levelSize (dataWindow.min.y, dataWindow.max.y, ly, lrMode) - 1);
return Box2i (dataWindow.min, levelMax);
}
int
floorLog2 (int x)
{
//
// For x > 0, floorLog2(y) returns floor(log(x)/log(2)).
//
int y = 0;
while (x > 1)
{
y += 1;
x >>= 1;
}
return y;
}
int
ceilLog2 (int x)
{
//
// For x > 0, ceilLog2(y) returns ceil(log(x)/log(2)).
//
int y = 0;
int r = 0;
while (x > 1)
{
if (x & 1)
r = 1;
y += 1;
x >>= 1;
}
return y + r;
}
int
roundLog2 (int x, LevelRoundingMode levelRoundingMode)
{
if (x < 1)
return 1;
return (levelRoundingMode == ROUND_DOWN)? floorLog2 (x): ceilLog2 (x);
}
int
computeNumXLevels
(const Box2i& dataWindow,
LevelMode levelMode,
LevelRoundingMode levelRoundingMode)
{
int n = 0;
switch (levelMode)
{
case ONE_LEVEL:
n = 1;
break;
case MIPMAP_LEVELS:
{
int w = dataWindow.max.x - dataWindow.min.x + 1;
int h = dataWindow.max.y - dataWindow.min.y + 1;
n = roundLog2 (std::max (w, h), levelRoundingMode) + 1;
}
break;
case RIPMAP_LEVELS:
{
int w = dataWindow.max.x - dataWindow.min.x + 1;
n = roundLog2 (w, levelRoundingMode) + 1;
}
break;
default:
assert (false);
}
return n;
}
int
computeNumYLevels
(const Box2i& dataWindow,
LevelMode levelMode,
LevelRoundingMode levelRoundingMode)
{
int n = 0;
switch (levelMode)
{
case ONE_LEVEL:
n = 1;
break;
case MIPMAP_LEVELS:
{
int w = dataWindow.max.x - dataWindow.min.x + 1;
int h = dataWindow.max.y - dataWindow.min.y + 1;
n = roundLog2 (std::max (w, h), levelRoundingMode) + 1;
}
break;
case RIPMAP_LEVELS:
{
int h = dataWindow.max.y - dataWindow.min.y + 1;
n = roundLog2 (h, levelRoundingMode) + 1;
}
break;
default:
assert (false);
}
return n;
}
} // namespace
Image::Image ():
_dataWindow (Box2i (V2i (0, 0), V2i (-1, -1))),
_levelMode (ONE_LEVEL),
_levelRoundingMode (ROUND_DOWN),
_channels(),
_levels()
{
// empty
}
Image::~Image ()
{
clearLevels();
clearChannels();
}
LevelMode
Image::levelMode () const
{
return _levelMode;
}
LevelRoundingMode
Image::levelRoundingMode () const
{
return _levelRoundingMode;
}
int
Image::numLevels () const
{
if (_levelMode == ONE_LEVEL || _levelMode == MIPMAP_LEVELS)
return numXLevels();
else
throw LogicExc ("Number of levels query for image "
"must specify x or y direction.");
}
int
Image::numXLevels () const
{
return _levels.width();
}
int
Image::numYLevels () const
{
return _levels.height();
}
const Box2i &
Image::dataWindow () const
{
return _dataWindow;
}
const Box2i &
Image::dataWindowForLevel (int l) const
{
return dataWindowForLevel (l, l);
}
const Box2i &
Image::dataWindowForLevel (int lx, int ly) const
{
if (!levelNumberIsValid (lx, ly))
{
THROW (ArgExc,
"Cannot get data window for invalid image "
"level (" << lx << ", " << ly << ").");
}
return _levels[ly][lx]->dataWindow();
}
int
Image::levelWidth (int lx) const
{
if (lx < 0 || lx >= numXLevels())
{
THROW (ArgExc,
"Cannot get level width for invalid "
"image level number " << lx << ".");
}
return levelSize (_dataWindow.min.x, _dataWindow.max.x,
lx, _levelRoundingMode);
}
int
Image::levelHeight (int ly) const
{
if (ly < 0 || ly >= numYLevels())
{
THROW (ArgExc,
"Cannot get level height for invalid "
"image level number " << ly << ".");
}
return levelSize (_dataWindow.min.y, _dataWindow.max.y,
ly, _levelRoundingMode);
}
void
Image::resize (const Box2i &dataWindow)
{
resize (dataWindow, _levelMode, _levelRoundingMode);
}
void
Image::resize
(const Box2i &dataWindow,
LevelMode levelMode,
LevelRoundingMode levelRoundingMode)
{
try
{
clearLevels();
int nx = computeNumXLevels (dataWindow, levelMode, levelRoundingMode);
int ny = computeNumYLevels (dataWindow, levelMode, levelRoundingMode);
_levels.resizeErase (ny, nx);
for (int y = 0; y < ny; ++y)
{
for (int x = 0; x < nx; ++x)
{
if (levelMode == MIPMAP_LEVELS && x != y)
{
_levels[y][x] = 0;
continue;
}
Box2i levelDataWindow =
computeDataWindowForLevel (dataWindow,
x, y,
levelRoundingMode);
_levels[y][x] = newLevel (x, y, levelDataWindow);
for (ChannelMap::iterator i = _channels.begin();
i != _channels.end();
++i)
{
_levels[y][x]->insertChannel (i->first,
i->second.type,
i->second.xSampling,
i->second.ySampling,
i->second.pLinear);
}
}
}
_dataWindow = dataWindow;
_levelMode = levelMode;
_levelRoundingMode = levelRoundingMode;
}
catch (...)
{
clearLevels();
throw;
}
}
void
Image::shiftPixels (int dx, int dy)
{
for (ChannelMap::iterator i = _channels.begin(); i != _channels.end(); ++i)
{
if (dx % i->second.xSampling != 0)
{
THROW (ArgExc, "Cannot shift image horizontally by " << dx << " "
"pixels. The shift distance must be a multiple "
"of the x sampling rate of all channels, but the "
"x sampling rate channel " << i->first << " "
"is " << i->second.xSampling << ".");
}
if (dy % i->second.ySampling != 0)
{
THROW (ArgExc, "Cannot shift image vertically by " << dy << " "
"pixels. The shift distance must be a multiple "
"of the y sampling rate of all channels, but the "
"y sampling rate channel " << i->first << " "
"is " << i->second.ySampling << ".");
}
}
_dataWindow.min.x += dx;
_dataWindow.min.y += dy;
_dataWindow.max.x += dx;
_dataWindow.max.y += dy;
for (int y = 0; y < _levels.height(); ++y)
for (int x = 0; x < _levels.width(); ++x)
if (_levels[y][x])
_levels[y][x]->shiftPixels (dx, dy);
}
void
Image::insertChannel
(const std::string &name,
PixelType type,
int xSampling,
int ySampling,
bool pLinear)
{
try
{
_channels[name] = ChannelInfo (type, xSampling, ySampling, pLinear);
for (int y = 0; y < _levels.height(); ++y)
for (int x = 0; x < _levels.width(); ++x)
if (_levels[y][x])
_levels[y][x]->insertChannel
(name, type, xSampling, ySampling, pLinear);
}
catch (...)
{
eraseChannel (name);
throw;
}
}
void
Image::insertChannel (const string &name, const Channel &channel)
{
insertChannel (name,
channel.type,
channel.xSampling,
channel.ySampling,
channel.pLinear);
}
void
Image::eraseChannel (const std::string &name)
{
//
// Note: eraseChannel() is called to clean up if an exception is
// thrown during a call during insertChannel(), so eraseChannel()
// must work correctly even after an incomplete insertChannel()
// operation.
//
for (int y = 0; y < _levels.height(); ++y)
for (int x = 0; x < _levels.width(); ++x)
if (_levels[y][x])
_levels[y][x]->eraseChannel (name);
ChannelMap::iterator i = _channels.find (name);
if (i != _channels.end())
_channels.erase (i);
}
void
Image::clearChannels ()
{
for (int y = 0; y < _levels.height(); ++y)
for (int x = 0; x < _levels.width(); ++x)
if (_levels[y][x])
_levels[y][x]->clearChannels();
_channels.clear();
}
void
Image::renameChannel (const string &oldName, const string &newName)
{
if (oldName == newName)
return;
ChannelMap::iterator oldChannel = _channels.find (oldName);
if (oldChannel == _channels.end())
{
THROW (ArgExc, "Cannot rename image channel " << oldName << " "
"to " << newName << ". The image does not have "
"a channel called " << oldName << ".");
}
if (_channels.find (newName) != _channels.end())
{
THROW (ArgExc, "Cannot rename image channel " << oldName << " "
"to " << newName << ". The image already has "
"a channel called " << newName << ".");
}
try
{
for (int y = 0; y < _levels.height(); ++y)
for (int x = 0; x < _levels.width(); ++x)
if (_levels[y][x])
_levels[y][x]->renameChannel (oldName, newName);
_channels[newName] = oldChannel->second;
_channels.erase (oldChannel);
}
catch (...)
{
eraseChannel (oldName);
eraseChannel (newName);
throw;
}
}
void
Image::renameChannels (const RenamingMap &oldToNewNames)
{
set <string> newNames;
for (ChannelMap::const_iterator i = _channels.begin();
i != _channels.end();
++i)
{
RenamingMap::const_iterator j = oldToNewNames.find (i->first);
std::string newName = (j == oldToNewNames.end())? i->first: j->second;
if (newNames.find (newName) != newNames.end())
{
THROW (ArgExc, "Cannot rename image channels. More than one "
"channel would be named \"" << newName << "\".");
}
else
{
newNames.insert (newName);
}
}
try
{
renameChannelsInMap (oldToNewNames, _channels);
for (int y = 0; y < _levels.height(); ++y)
for (int x = 0; x < _levels.width(); ++x)
if (_levels[y][x])
_levels[y][x]->renameChannels (oldToNewNames);
}
catch (...)
{
clearChannels();
throw;
}
}
ImageLevel &
Image::level (int l)
{
return level (l, l);
}
const ImageLevel &
Image::level (int l) const
{
return level (l, l);
}
ImageLevel &
Image::level (int lx, int ly)
{
if (!levelNumberIsValid (lx, ly))
{
THROW (ArgExc,
"Cannot access image level with invalid "
"level number (" << lx << ", " << ly << ").");
}
return *_levels[ly][lx];
}
const ImageLevel &
Image::level (int lx, int ly) const
{
if (!levelNumberIsValid (lx, ly))
{
THROW (ArgExc,
"Cannot access image level with invalid "
"level number (" << lx << ", " << ly << ").");
}
return *_levels[ly][lx];
}
bool
Image::levelNumberIsValid (int lx, int ly) const
{
return lx >= 0 && lx < _levels.width() &&
ly >= 0 && ly < _levels.height() &&
_levels[ly][lx] != 0;
}
void
Image::clearLevels ()
{
_dataWindow = Box2i (V2i (0, 0), V2i (-1, -1));
for (int y = 0; y < _levels.height(); ++y)
for (int x = 0; x < _levels.width(); ++x)
delete _levels[y][x];
_levels.resizeErase (0, 0);
}
Image::ChannelInfo::ChannelInfo
(PixelType type,
int xSampling,
int ySampling,
bool pLinear)
:
type (type),
xSampling (xSampling),
ySampling (ySampling),
pLinear (pLinear)
{
// empty
}
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
| 6,547 |
3,494 | /*
Copyright (c) 2015, The Cinder Project
This code is intended to be used with the Cinder C++ library, http://libcinder.org
Redistribution and use in source and binary forms, with or without modification, are permitted provided that
the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and
the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#include "cinder/app/winrt/PlatformWinRt.h"
#include "cinder/msw/OutputDebugStringStream.h"
#include "cinder/Unicode.h"
#include "cinder/Log.h"
#include "cinder/msw/CinderMsw.h"
#include "cinder/winrt/WinRTUtils.h"
#include "cinder/ImageSourceFileWic.h"
#include "cinder/ImageTargetFileWic.h"
#include "cinder/ImageSourceFileRadiance.h"
#include "cinder/ImageFileTinyExr.h"
#include <wrl/client.h>
#include <agile.h>
#include <collection.h>
using namespace Windows::Storage;
using namespace Windows::Storage::Pickers;
using namespace Windows::ApplicationModel;
using namespace Windows::ApplicationModel::Core;
using namespace Windows::ApplicationModel::Activation;
using namespace Windows::UI::Core;
using namespace Windows::UI::Popups;
using namespace Windows::UI::Input;
using namespace Windows::System;
using namespace Windows::Foundation;
using namespace concurrency;
using namespace Platform;
using namespace Platform::Collections;
using namespace cinder::winrt;
using namespace std;
namespace cinder { namespace app {
PlatformWinRt::PlatformWinRt()
{
ImageSourceFileWic::registerSelf();
ImageTargetFileWic::registerSelf();
ImageSourceFileRadiance::registerSelf();
ImageSourceFileTinyExr::registerSelf();
ImageTargetFileTinyExr::registerSelf();
}
DataSourceRef PlatformWinRt::loadResource( const fs::path &resourcePath )
{
if( ! resourcePath.empty() )
return DataSourcePath::create( resourcePath.string() );
else
throw AssetLoadExc( resourcePath );
}
fs::path PlatformWinRt::getOpenFilePath( const fs::path &initialPath, const std::vector<std::string> &extensions )
{
throw Exception( "Unimplemented on WinRT" );
}
fs::path PlatformWinRt::getFolderPath( const fs::path &initialPath )
{
throw Exception( "Unimplemented on WinRT" );
}
fs::path PlatformWinRt::getSaveFilePath( const fs::path &initialPath, const std::vector<std::string> &extensions )
{
throw Exception( "Unimplemented on WinRT" );
}
// Add the application path
void PlatformWinRt::prepareAssetLoading()
{
Windows::ApplicationModel::Package^ package = Windows::ApplicationModel::Package::Current;
Windows::Storage::StorageFolder^ installedLocation = package->InstalledLocation;
::Platform::String^ output = installedLocation->Path;
std::wstring t = std::wstring( output->Data() );
Platform::get()->addAssetDirectory( fs::path( winrt::PlatformStringToString( output ) ) );
}
void PlatformWinRt::getOpenFilePathAsync( const std::function<void(const fs::path&)> &callback, const fs::path &initialPath, const std::vector<std::string> &extensions )
{
if( extensions.empty() )
throw Exception( "Must specify at least one file extension in extensions argument" );
// FilePicker APIs will not work if the application is in a snapped state.
// If an app wants to show a FilePicker while snapped, it must attempt to unsnap first
if( ! ensureUnsnapped() ) {
CI_LOG_E( "Application must be unsnapped" );
return;
}
FileOpenPicker^ picker = ref new FileOpenPicker();
picker->SuggestedStartLocation = PickerLocationId::Desktop;
for( auto iter = extensions.begin(); iter != extensions.end(); ++iter ) {
std::wstring temp(iter->begin(), iter->end());
picker->FileTypeFilter->Append( ref new ::Platform::String(temp.c_str()));
}
create_task( picker->PickSingleFileAsync()).then([callback]( StorageFile^ file )
{
if( file )
callback( fs::path( msw::toUtf8String( file->Path->Data() ) ) );
else
callback( fs::path() );
});
}
void PlatformWinRt::getFolderPathAsync( const std::function<void(const fs::path&)> &callback, const fs::path &initialPath )
{
/*if( extensions.empty() ) {
throw Exception( "Must specify at least one file extension in extensions argument" );
}
// FilePicker APIs will not work if the application is in a snapped state.
// If an app wants to show a FilePicker while snapped, it must attempt to unsnap first
if( ! ensureUnsnapped() ) {
CI_LOG_E( "Application must be unsnapped" );
return;
}
FolderPicker^ folderPicker = ref new FolderPicker();
folderPicker->SuggestedStartLocation = PickerLocationId::Desktop;
for( auto iter = extensions.begin(); iter != extensions.end(); ++iter ) {
std::wstring temp(iter->begin(), iter->end());
folderPicker->FileTypeFilter->Append( ref new Platform::String(temp.c_str()));
}
create_task(folderPicker->PickSingleFolderAsync()).then([f](StorageFolder^ folder)
{
if( folder ) {
callback( fs::path( msw::toUtf8String( folder->Path->Data() ) ) );
}
else {
callback( fs::path() );
}
});*/
}
void PlatformWinRt::getSaveFilePathAsync( const std::function<void(const fs::path&)> &callback, const fs::path &initialPath, const std::vector<std::string> &extensions )
{
if( initialPath.empty() )
throw Exception( "Must specify initialPath" );
if( extensions.empty() )
throw Exception( "Must specify at least one file extension" );
// FilePicker APIs will not work if the application is in a snapped state.
// If an app wants to show a FilePicker while snapped, it must attempt to unsnap first
if( ! ensureUnsnapped() ) {
CI_LOG_E( "Application must be unsnapped" );
return;
}
FileSavePicker^ savePicker = ref new FileSavePicker();
savePicker->SuggestedStartLocation = PickerLocationId::PicturesLibrary;
auto plainTextExtensions = ref new ::Platform::Collections::Vector<String^>();
if( ! extensions.empty() ) {
for( auto iter = extensions.begin(); iter != extensions.end(); ++iter ) {
std::wstring temp(iter->begin(), iter->end());
plainTextExtensions->Append( ref new ::Platform::String(temp.c_str()));
}
}
else if( ! initialPath.empty() ) {
plainTextExtensions->Append( ref new ::Platform::String( initialPath.extension().wstring().c_str() ) );
}
savePicker->FileTypeChoices->Insert( "", plainTextExtensions );
if( ! initialPath.empty() ) {
savePicker->SuggestedFileName = ref new ::Platform::String( initialPath.filename().wstring().c_str() );
}
else {
savePicker->SuggestedFileName = "New Document";
}
create_task(savePicker->PickSaveFileAsync()).then([callback]( StorageFile^ file )
{
if( file )
callback( fs::path( msw::toUtf8String( file->Path->Data() ) ) );
else
callback( fs::path() );
});
}
std::ostream& PlatformWinRt::console()
{
if( ! mOutputStream )
mOutputStream.reset( new cinder::msw::dostream );
return *mOutputStream;
}
map<string,string> PlatformWinRt::getEnvironmentVariables()
{
return map<string,string>();
}
fs::path PlatformWinRt::expandPath( const fs::path &path )
{
#if _MSC_VER <= 1800
CI_LOG_W( "Not implemented" );
return path;
#else
return fs::canonical( path );
#endif
}
fs::path PlatformWinRt::getHomeDirectory() const
{
// WinRT will throw an exception if access to DocumentsLibrary has not been requested in the App Manifest
auto folder = Windows::Storage::KnownFolders::DocumentsLibrary;
string result = PlatformStringToString(folder->Path);
return fs::path( result );
}
fs::path PlatformWinRt::getDocumentsDirectory() const
{
// WinRT will throw an exception if access to DocumentsLibrary has not been requested in the App Manifest
auto folder = Windows::Storage::KnownFolders::DocumentsLibrary;
return PlatformStringToString(folder->Path);
}
fs::path PlatformWinRt::getDefaultExecutablePath() const
{
Windows::ApplicationModel::Package^ package = Windows::ApplicationModel::Package::Current;
Windows::Storage::StorageFolder^ installedLocation = package->InstalledLocation;
::Platform::String^ output = installedLocation->Path;
std::wstring t = std::wstring( output->Data() );
return fs::path( winrt::PlatformStringToString( output ) );
}
void PlatformWinRt::launchWebBrowser( const Url &url )
{
std::u16string urlStr = toUtf16( url.str() );
auto uri = ref new Windows::Foundation::Uri( ref new ::Platform::String( (wchar_t *)urlStr.c_str() ) );
Windows::System::Launcher::LaunchUriAsync( uri );
}
void PlatformWinRt::sleep( float milliseconds )
{
CI_LOG_E( "sleep not implemented on WinRT" );
}
vector<string> PlatformWinRt::stackTrace()
{
CI_LOG_E( "stackTrace() not implemented on WinRT" );
return vector<string>();
}
void PlatformWinRt::setThreadName( const std::string &name )
{
#pragma pack(push,8)
typedef struct tagTHREADNAME_INFO {
DWORD dwType; // Must be 0x1000.
LPCSTR szName; // Pointer to name
DWORD dwThreadID; // Thread ID (-1=caller thread).
DWORD dwFlags; // Reserved for future use, must be zero.
} THREADNAME_INFO;
#pragma pack(pop)
#pragma warning(push)
#pragma warning(disable: 6320 6322)
__try {
THREADNAME_INFO info;
info.dwType = 0x1000;
info.szName = name.c_str();
info.dwThreadID = -1;
info.dwFlags = 0;
::RaiseException( 0x406D1388 /* MS_VC_EXCEPTION */, 0, sizeof(info) / sizeof(ULONG_PTR), (ULONG_PTR*)&info );
}
__except (EXCEPTION_EXECUTE_HANDLER) {
}
#pragma warning(pop)
}
const vector<DisplayRef>& PlatformWinRt::getDisplays()
{
bool sInitialized = false;
if( ! sInitialized ) {
CoreWindow^ window = CoreWindow::GetForCurrentThread();
auto newDisplay = new DisplayWinRt();
float width, height;
::GetPlatformWindowDimensions( window, &width, &height );
newDisplay->mArea = Area( 0, 0, (int)width, (int)height );
newDisplay->mBitsPerPixel = 24;
newDisplay->mContentScale = getScaleFactor();
mDisplays.push_back( DisplayRef( newDisplay ) );
sInitialized = true;
}
return mDisplays;
}
ResourceLoadExcMsw::ResourceLoadExcMsw( int mswID, const string &mswType )
: ResourceLoadExc( "" )
{
setDescription( "Failed to load resource: #" + to_string( mswID ) + " type: " + mswType );
}
} } // namespace cinder::app
| 3,594 |
1,017 | package com.xiaolyuh;
import org.apache.ibatis.session.SqlSession;
import java.net.URISyntaxException;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Objects;
/**
* @author yuhao.wang3
* @since 2019/10/12 17:23
*/
public class BaseTest {
protected void initH2db(Connection conn) throws SQLException, ClassNotFoundException, URISyntaxException {
Statement st = null;
try {
String schema = getClass().getResource("/db/schema.sql").toURI().toString().substring(6);
String data = getClass().getResource("/db/data.sql").toURI().toString().substring(6);
st = conn.createStatement();
// 这一句可以不要
st.execute("drop all objects;");
// 执行初始化语句
st.execute("runscript from '" + schema + "'");
st.execute("runscript from '" + data + "'");
} finally {
if (Objects.nonNull(st)) {
st.close();
}
}
}
protected void initH2dbMybatis(SqlSession sqlSession) throws SQLException, ClassNotFoundException, URISyntaxException {
Connection conn = sqlSession.getConnection();
try (Statement st = conn.createStatement()) {
String schema = getClass().getResource("/db/schema.sql").toURI().toString().substring(6);
String data = getClass().getResource("/db/data.sql").toURI().toString().substring(6);
// 这一句可以不要
st.execute("drop all objects;");
// 执行初始化语句
st.execute("runscript from '" + schema + "'");
st.execute("runscript from '" + data + "'");
}
}
}
| 763 |
1,350 | <filename>sdk/automanage/azure-resourcemanager-automanage/src/main/java/com/azure/resourcemanager/automanage/implementation/BestPracticesVersionsImpl.java
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.automanage.implementation;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.SimpleResponse;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.automanage.fluent.BestPracticesVersionsClient;
import com.azure.resourcemanager.automanage.fluent.models.BestPracticeInner;
import com.azure.resourcemanager.automanage.models.BestPractice;
import com.azure.resourcemanager.automanage.models.BestPracticesVersions;
import com.fasterxml.jackson.annotation.JsonIgnore;
public final class BestPracticesVersionsImpl implements BestPracticesVersions {
@JsonIgnore private final ClientLogger logger = new ClientLogger(BestPracticesVersionsImpl.class);
private final BestPracticesVersionsClient innerClient;
private final com.azure.resourcemanager.automanage.AutomanageManager serviceManager;
public BestPracticesVersionsImpl(
BestPracticesVersionsClient innerClient,
com.azure.resourcemanager.automanage.AutomanageManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public BestPractice get(String bestPracticeName, String versionName) {
BestPracticeInner inner = this.serviceClient().get(bestPracticeName, versionName);
if (inner != null) {
return new BestPracticeImpl(inner, this.manager());
} else {
return null;
}
}
public Response<BestPractice> getWithResponse(String bestPracticeName, String versionName, Context context) {
Response<BestPracticeInner> inner =
this.serviceClient().getWithResponse(bestPracticeName, versionName, context);
if (inner != null) {
return new SimpleResponse<>(
inner.getRequest(),
inner.getStatusCode(),
inner.getHeaders(),
new BestPracticeImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public PagedIterable<BestPractice> listByTenant(String bestPracticeName) {
PagedIterable<BestPracticeInner> inner = this.serviceClient().listByTenant(bestPracticeName);
return Utils.mapPage(inner, inner1 -> new BestPracticeImpl(inner1, this.manager()));
}
public PagedIterable<BestPractice> listByTenant(String bestPracticeName, Context context) {
PagedIterable<BestPracticeInner> inner = this.serviceClient().listByTenant(bestPracticeName, context);
return Utils.mapPage(inner, inner1 -> new BestPracticeImpl(inner1, this.manager()));
}
private BestPracticesVersionsClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.automanage.AutomanageManager manager() {
return this.serviceManager;
}
}
| 1,131 |
852 | /** \file
* Implementation of class RawDataCollectorByLabel
*
*/
#include "EventFilter/RawDataCollector/src/RawDataCollectorByLabel.h"
#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
#include "DataFormats/FEDRawData/interface/FEDRawData.h"
#include "DataFormats/FEDRawData/interface/FEDNumbering.h"
#include "DataFormats/Common/interface/Handle.h"
#include "FWCore/Framework/interface/Event.h"
#include "DataFormats/Provenance/interface/ProcessHistory.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include <iostream>
using namespace edm;
RawDataCollectorByLabel::RawDataCollectorByLabel(const edm::ParameterSet &pset) {
inputTags_ = pset.getParameter<std::vector<InputTag> >("RawCollectionList");
verbose_ = pset.getUntrackedParameter<int>("verbose", 0);
inputTokens_.reserve(inputTags_.size());
for (tag_iterator_t inputTag = inputTags_.begin(); inputTag != inputTags_.end(); ++inputTag) {
inputTokens_.push_back(consumes<FEDRawDataCollection>(*inputTag));
}
produces<FEDRawDataCollection>();
}
RawDataCollectorByLabel::~RawDataCollectorByLabel() {}
void RawDataCollectorByLabel::produce(Event &e, const EventSetup &c) {
/// Get Data from all FEDs
std::vector<Handle<FEDRawDataCollection> > rawData;
rawData.reserve(inputTokens_.size());
for (tok_iterator_t inputTok = inputTokens_.begin(); inputTok != inputTokens_.end(); ++inputTok) {
Handle<FEDRawDataCollection> input;
if (e.getByToken(*inputTok, input)) {
rawData.push_back(input);
}
//else{ //skipping the inputtag requested. but this is a normal operation to bare data & MC. silent warning }
}
auto producedData = std::make_unique<FEDRawDataCollection>();
for (unsigned int i = 0; i < rawData.size(); ++i) {
const FEDRawDataCollection *rdc = rawData[i].product();
if (verbose_ > 0) {
std::cout << "\nRAW collection #" << i + 1 << std::endl;
std::cout << "branch name = " << rawData[i].provenance()->branchName() << std::endl;
std::cout << "process index = " << rawData[i].provenance()->productID().processIndex() << std::endl;
}
for (int j = 0; j < FEDNumbering::MAXFEDID; ++j) {
const FEDRawData &fedData = rdc->FEDData(j);
size_t size = fedData.size();
if (size > 0) {
// this fed has data -- lets copy it
if (verbose_ > 1)
std::cout << "Copying data from FED #" << j << std::endl;
FEDRawData &fedDataProd = producedData->FEDData(j);
if (fedDataProd.size() != 0) {
if (verbose_ > 1) {
std::cout << " More than one FEDRawDataCollection with data in FED ";
std::cout << j << " Skipping the 2nd\n";
}
continue;
}
fedDataProd.resize(size);
unsigned char *dataProd = fedDataProd.data();
const unsigned char *data = fedData.data();
for (unsigned int k = 0; k < size; ++k) {
dataProd[k] = data[k];
}
}
}
}
// Insert the new product in the event
e.put(std::move(producedData));
}
| 1,234 |
375 | <gh_stars>100-1000
/**
*
*/
package org.archive.wayback.replay.charset;
import java.io.IOException;
import junit.framework.TestCase;
import org.archive.io.warc.TestWARCReader;
import org.archive.io.warc.TestWARCRecordInfo;
import org.archive.io.warc.WARCRecord;
import org.archive.wayback.core.WaybackRequest;
import org.archive.wayback.resourcestore.resourcefile.WarcResource;
/**
* test for {@link RotatingCharsetDetector}.
*/
public class RotatingCharsetDetectorTest extends TestCase {
protected WarcResource createResource(String payload, String encoding) throws IOException {
return createResource("text/html", payload, encoding);
}
protected WarcResource createResource(String contentType, String payload, String encoding) throws IOException {
final byte[] payloadBytes = payload.getBytes(encoding);
TestWARCRecordInfo recinfo = TestWARCRecordInfo.createHttpResponse(contentType, payloadBytes);
TestWARCReader wr = new TestWARCReader(recinfo);
WARCRecord rec = wr.get(0);
WarcResource resource = new WarcResource(rec, wr);
resource.parseHeaders();
return resource;
}
/**
* content is UTF-8 encoded, but META tag says it's UTF-16.
* {@link PrescanMetadataSniffer} overrides UTF-16 to UTF-8.
* @throws Exception
*/
public void testFalseMetaUTF16() throws Exception {
final String payload = "<html xmlns=\"http://www.w3.org/1999/xhtml\">" +
"<head>" +
" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-16\" />" +
" <title>Test Document</title>" +
" <link rel=\"stylesheet\" type=\"text/css\" href=\"styles.css\" />" +
"</head>" +
"<body>" +
"</body>" +
"</html>";
WarcResource resource = createResource(payload, "UTF-8");
WaybackRequest wbRequest = new WaybackRequest();
RotatingCharsetDetector cut = new RotatingCharsetDetector();
String charset = cut.getCharset(resource, wbRequest);
assertEquals("UTF-8", charset);
}
/**
* test of {@code x-} charset names.
* @throws Exception
*/
public void testXCharsetName() throws Exception {
final String payload = "<html xmlns=\"http://www.w3.org/1999/xhtml\">" +
"<head>" +
" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=x-sjis\" />" +
" <title>Test Document</title>" +
" <link rel=\"stylesheet\" type=\"text/css\" href=\"styles.css\" />" +
"</head>" +
"<body>" +
"</body>" +
"</html>";
WarcResource resource = createResource(payload, "x-sjis");
WaybackRequest wbRequest = new WaybackRequest();
RotatingCharsetDetector cut = new RotatingCharsetDetector();
String charset = cut.getCharset(resource, wbRequest);
assertEquals("x-sjis", charset);
}
/**
* test of {@code x-user-defined} charset name.
* mapped to {@code windows-1252}.
* @throws Exception
*/
public void testXUserDefined() throws Exception {
final String payload = "<html xmlns=\"http://www.w3.org/1999/xhtml\">" +
"<head>" +
" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=x-user-defined\" />" +
" <title>Test Document</title>" +
" <link rel=\"stylesheet\" type=\"text/css\" href=\"styles.css\" />" +
"</head>" +
"<body>" +
"</body>" +
"</html>";
WarcResource resource = createResource(payload, "windows-1252");
WaybackRequest wbRequest = new WaybackRequest();
RotatingCharsetDetector cut = new RotatingCharsetDetector();
String charset = cut.getCharset(resource, wbRequest);
assertEquals("windows-1252", charset);
}
/**
* content is UTF-16 encoded, but META tag says it's UTF-8.
* {@link PrescanMetadataSniffer} shall fail because it's UTF-16 encoded,
* and {@link UniversalChardetSniffer} should detect UTF-16.
* <p>Unfortunately, this test fails currently. Universal Chardet returns
* {@code null} for sample content, even with some non-ASCII chars. Hopefully
* UTF-16 texts have BOM, or plenty of non-ASCII chars make Universal Chardet
* work.</p>
* @throws Exception
*/
public void testFalseMetaUTF8() throws Exception {
final String payload = "<html xmlns=\"http://www.w3.org/1999/xhtml\">" +
"<head>" +
" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />" +
" <title>Test Document</title>" +
" <link rel=\"stylesheet\" type=\"text/css\" href=\"styles.css\" />" +
"</head>" +
"<body>" +
"</body>" +
"</html>";
WarcResource resource = createResource(payload, "UTF-16BE");
WaybackRequest wbRequest = new WaybackRequest();
RotatingCharsetDetector cut = new RotatingCharsetDetector();
String charset = cut.getCharset(resource, wbRequest);
//assertEquals("UTF-16BE", charset);
}
/**
* test of {@link ContentTypeHeaderSniffer}
* @throws Exception
*/
public void testContentTypeHeaderSniffer() throws Exception {
ContentTypeHeaderSniffer cut = new ContentTypeHeaderSniffer();
final String payload = "<html>" +
"<body>" +
"</body>" +
"</html>";
{
WarcResource resource = createResource("text/html", payload, "UTF-8");
String enc = cut.sniff(resource);
assertNull(enc);
}
{
WarcResource resource = createResource("text/html;charset=utf-8", payload, "UTF-8");
String enc = cut.sniff(resource);
assertEquals("utf-8", enc);
}
{
WarcResource resource = createResource("text/html; charset=shift_jis", payload, "shift_jis");
String enc = cut.sniff(resource);
assertEquals("shift_jis", enc);
}
{
// rescuing broken charset name
WarcResource resource = createResource("text/html; charset=i so-8859-1", payload, "iso-8859-1");
String enc = cut.sniff(resource);
// sniffer maps "iso-8859-1" to "cp1252";
assertEquals("windows-1252", enc);
}
}
// more tests?
}
| 2,104 |
884 | <reponame>rt112000/CDM
[
{
"annotationName" : "version",
"traitValue" : "means.measurement.version"
}
] | 66 |
2,577 | <filename>engine/src/test/java/org/camunda/bpm/engine/test/api/authorization/externaltask/SetExternalTaskRetriesAuthorizationTest.java<gh_stars>1000+
/*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership. Camunda licenses this file to you under the Apache License,
* Version 2.0; 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.camunda.bpm.engine.test.api.authorization.externaltask;
import org.camunda.bpm.engine.externaltask.ExternalTask;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.test.Deployment;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
/**
* @author <NAME>
*
*/
@RunWith(Parameterized.class)
public class SetExternalTaskRetriesAuthorizationTest extends HandleExternalTaskAuthorizationTest {
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/api/externaltask/oneExternalTaskProcess.bpmn20.xml")
public void testSetRetries() {
// given
ProcessInstance processInstance = engineRule.getRuntimeService().startProcessInstanceByKey("oneExternalTaskProcess");
ExternalTask task = engineRule.getExternalTaskService().createExternalTaskQuery().singleResult();
// when
authRule
.init(scenario)
.withUser("userId")
.bindResource("processInstanceId", processInstance.getId())
.bindResource("processDefinitionKey", "oneExternalTaskProcess")
.start();
engineRule.getExternalTaskService().setRetries(task.getId(), 5);
// then
if (authRule.assertScenario(scenario)) {
task = engineRule.getExternalTaskService().createExternalTaskQuery().singleResult();
Assert.assertEquals(5, (int) task.getRetries());
}
}
}
| 710 |
312 | <gh_stars>100-1000
#include "clar_libgit2.h"
#include "config.h"
static git_config *cfg;
void test_config_validkeyname__initialize(void)
{
cl_fixture_sandbox("config/config10");
cl_git_pass(git_config_open_ondisk(&cfg, "config10"));
}
void test_config_validkeyname__cleanup(void)
{
git_config_free(cfg);
cfg = NULL;
cl_fixture_cleanup("config10");
}
static void assert_invalid_config_key_name(const char *name)
{
git_buf buf = GIT_BUF_INIT;
cl_git_fail_with(git_config_get_string_buf(&buf, cfg, name),
GIT_EINVALIDSPEC);
cl_git_fail_with(git_config_set_string(cfg, name, "42"),
GIT_EINVALIDSPEC);
cl_git_fail_with(git_config_delete_entry(cfg, name),
GIT_EINVALIDSPEC);
cl_git_fail_with(git_config_get_multivar_foreach(cfg, name, "*", NULL, NULL),
GIT_EINVALIDSPEC);
cl_git_fail_with(git_config_set_multivar(cfg, name, "*", "42"),
GIT_EINVALIDSPEC);
}
void test_config_validkeyname__accessing_requires_a_valid_name(void)
{
assert_invalid_config_key_name("");
assert_invalid_config_key_name(".");
assert_invalid_config_key_name("..");
assert_invalid_config_key_name("core.");
assert_invalid_config_key_name("d#ff.dirstat.lines");
assert_invalid_config_key_name("diff.dirstat.lines#");
assert_invalid_config_key_name("dif\nf.dirstat.lines");
assert_invalid_config_key_name("dif.dir\nstat.lines");
assert_invalid_config_key_name("dif.dirstat.li\nes");
}
| 594 |
1,020 | <filename>end-to-end-tests/src/main/java/com/amazonaws/blox/integ/BloxTestStack.java
/*
* Copyright 2017 Amazon.com, 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. A copy of the
* License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "LICENSE" file accompanying this file. This file 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.amazonaws.blox.integ;
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
import com.amazonaws.blox.Blox;
import java.util.List;
import software.amazon.awssdk.services.cloudformation.CloudFormationClient;
import software.amazon.awssdk.services.ecs.ECSClient;
import software.amazon.awssdk.services.ecs.model.Task;
import software.amazon.awssdk.utils.Validate;
/**
* Facade over everything in an end-to-end Blox stack that's needed in tests.
*
* <p>TODO: it makes more sense to wire the individual support classes into the unit tests instead
* of this whole stack, so this will probably be removed soon.
*/
public class BloxTestStack {
private final String bloxEndpoint;
private final CloudFormationClient cloudFormationClient;
private final ECSClient ecsClient;
private final CloudFormationStacks stacks;
private final ECSClusterWrapper ecs;
private final Blox blox;
public BloxTestStack(String bloxEndpoint) {
Validate.notEmpty(bloxEndpoint, "Blox endpoint cannot be empty.");
this.bloxEndpoint = bloxEndpoint;
this.cloudFormationClient = CloudFormationClient.create();
this.ecsClient = ECSClient.create();
this.stacks = new CloudFormationStacks(cloudFormationClient);
this.ecs = new ECSClusterWrapper(ecsClient, stacks);
this.blox =
Blox.builder()
.iamCredentials(new DefaultAWSCredentialsProviderChain())
.endpoint(this.bloxEndpoint)
.build();
}
public Blox getBlox() {
return this.blox;
}
public List<Task> describeTasks() {
return ecs.describeTasks();
}
public String getTransientTaskDefinition() {
return ecs.getTransientTaskDefinition();
}
public String getPersistentTaskDefinition() {
return ecs.getPersistentTaskDefinition();
}
public String getCluster() {
return ecs.getCluster();
}
public void reset() {
ecs.reset();
}
}
| 831 |
2,942 | /*
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.spring.initializr.web.test;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.servlet.RequestDispatcher;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.client.ClientHttpRequest;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.mock.http.client.MockClientHttpRequest;
import org.springframework.mock.http.client.MockClientHttpResponse;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.restdocs.snippet.Snippet;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import org.springframework.util.Assert;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.request;
/**
* @author <NAME>
*/
public class MockMvcClientHttpRequestFactory implements ClientHttpRequestFactory {
private final MockMvc mockMvc;
private String label = "UNKNOWN";
private List<String> fields = new ArrayList<>();
public MockMvcClientHttpRequestFactory(MockMvc mockMvc) {
Assert.notNull(mockMvc, "MockMvc must not be null");
this.mockMvc = mockMvc;
}
@Override
public ClientHttpRequest createRequest(final URI uri, final HttpMethod httpMethod) throws IOException {
return new MockClientHttpRequest(httpMethod, uri) {
@Override
public ClientHttpResponse executeInternal() throws IOException {
try {
MockHttpServletRequestBuilder requestBuilder = request(httpMethod, uri.toString());
requestBuilder.content(getBodyAsBytes());
requestBuilder.headers(getHeaders());
MockHttpServletResponse servletResponse = actions(requestBuilder).andReturn().getResponse();
HttpStatus status = HttpStatus.valueOf(servletResponse.getStatus());
if (status.value() >= 400) {
requestBuilder = request(HttpMethod.GET, "/error")
.requestAttr(RequestDispatcher.ERROR_STATUS_CODE, status.value())
.requestAttr(RequestDispatcher.ERROR_REQUEST_URI, uri.toString());
if (servletResponse.getErrorMessage() != null) {
requestBuilder.requestAttr(RequestDispatcher.ERROR_MESSAGE,
servletResponse.getErrorMessage());
}
// Overwrites the snippets from the first request
servletResponse = actions(requestBuilder).andReturn().getResponse();
}
byte[] body = servletResponse.getContentAsByteArray();
HttpHeaders headers = getResponseHeaders(servletResponse);
MockClientHttpResponse clientResponse = new MockClientHttpResponse(body, status);
clientResponse.getHeaders().putAll(headers);
return clientResponse;
}
catch (Exception ex) {
throw new IllegalStateException(ex);
}
}
};
}
private ResultActions actions(MockHttpServletRequestBuilder requestBuilder) throws Exception {
ResultActions actions = MockMvcClientHttpRequestFactory.this.mockMvc.perform(requestBuilder);
List<Snippet> snippets = new ArrayList<>();
for (String field : this.fields) {
snippets.add(new ResponseFieldSnippet(field));
}
actions.andDo(document(this.label, preprocessResponse(prettyPrint()), snippets.toArray(new Snippet[0])));
this.fields = new ArrayList<>();
return actions;
}
private HttpHeaders getResponseHeaders(MockHttpServletResponse response) {
HttpHeaders headers = new HttpHeaders();
for (String name : response.getHeaderNames()) {
List<String> values = response.getHeaders(name);
for (String value : values) {
headers.add(name, value);
}
}
return headers;
}
public void setTest(Class<?> testClass, Method testMethod) {
this.label = testMethod.getName();
}
public void setFields(String... fields) {
this.fields = Arrays.asList(fields);
}
}
| 1,586 |
453 | <reponame>enfoTek/tomato.linksys.e2000.nvram-mod<filename>tools-src/gnu/glibc/sysdeps/unix/sysv/linux/kernel-features.h
/* Set flags signalling availability of kernel features based on given
kernel version number.
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* This file must not contain any C code. At least it must be protected
to allow using the file also in assembler files. */
#ifndef __LINUX_KERNEL_VERSION
/* We assume the worst; all kernels should be supported. */
# define __LINUX_KERNEL_VERSION 0
#endif
/* We assume for __LINUX_KERNEL_VERSION the same encoding used in
linux/version.h. I.e., the major, minor, and subminor all get a
byte with the major number being in the highest byte. This means
we can do numeric comparisons.
In the following we will define certain symbols depending on
whether the describes kernel feature is available in the kernel
version given by __LINUX_KERNEL_VERSION. We are not always exactly
recording the correct versions in which the features were
introduced. If somebody cares these values can afterwards be
corrected. Most of the numbers here are set corresponding to
2.2.0. */
/* `getcwd' system call. */
#if __LINUX_KERNEL_VERSION >= 131584
# define __ASSUME_GETCWD_SYSCALL 1
#endif
/* Real-time signal became usable in 2.1.70. */
#if __LINUX_KERNEL_VERSION >= 131398
# define __ASSUME_REALTIME_SIGNALS 1
#endif
/* When were the `pread'/`pwrite' syscalls introduced? */
#if __LINUX_KERNEL_VERSION >= 131584
# define __ASSUME_PREAD_SYSCALL 1
# define __ASSUME_PWRITE_SYSCALL 1
#endif
/* When was `poll' introduced? */
#if __LINUX_KERNEL_VERSION >= 131584
# define __ASSUME_POLL_SYSCALL 1
#endif
/* The `lchown' syscall was introduced in 2.1.80. */
#if __LINUX_KERNEL_VERSION >= 131408
# define __ASSUME_LCHOWN_SYSCALL 1
#endif
/* When did the `setresuid' sysall became available? */
#if __LINUX_KERNEL_VERSION >= 131584 && !defined __sparc__
# define __ASSUME_SETRESUID_SYSCALL 1
#endif
/* The SIOCGIFNAME ioctl is available starting with 2.1.50. */
#if __LINUX_KERNEL_VERSION >= 131408
# define __ASSUME_SIOCGIFNAME 1
#endif
/* On x86 another `getrlimit' syscall was added in 2.3.25. */
#if __LINUX_KERNEL_VERSION >= 131865 && defined __i386__
# define __ASSUME_NEW_GETRLIMIT_SYSCALL 1
#endif
/* On x86 the truncate64/ftruncate64 syscalls were introduced in 2.3.31. */
#if __LINUX_KERNEL_VERSION >= 131871 && defined __i386__
# define __ASSUME_TRUNCATE64_SYSCALL 1
#endif
/* On x86 the mmap2 syscall was introduced in 2.3.31. */
#if __LINUX_KERNEL_VERSION >= 131871 && defined __i386__
# define __ASSUME_MMAP2_SYSCALL 1
#endif
/* On x86 the stat64/lstat64/fstat64 syscalls were introduced in 2.3.34. */
#if __LINUX_KERNEL_VERSION >= 131874 && defined __i386__
# define __ASSUME_STAT64_SYSCALL 1
#endif
/* On sparc and ARM the truncate64/ftruncate64/mmap2/stat64/lstat64/fstat64
syscalls were introduced in 2.3.35. */
#if __LINUX_KERNEL_VERSION >= 131875 && (defined __sparc__ || defined __arm__)
# define __ASSUME_TRUNCATE64_SYSCALL 1
# define __ASSUME_MMAP2_SYSCALL 1
# define __ASSUME_STAT64_SYSCALL 1
#endif
/* I know for sure that these are in 2.3.35 on powerpc. */
#if __LINUX_KERNEL_VERSION >= 131875 && defined __powerpc__
# define __ASSUME_TRUNCATE64_SYSCALL 1
# define __ASSUME_STAT64_SYSCALL 1
# define __ASSUME_NEW_GETRLIMIT_SYSCALL 1
#endif
/* Linux 2.3.39 introduced 32bit UID/GIDs and IPC64. Some platforms had 32
bit type all along. */
#if __LINUX_KERNEL_VERSION >= 131879 || defined __powerpc__ || defined __mips__
# define __ASSUME_32BITUIDS 1
# ifndef __powerpc__
# define __ASSUME_IPC64 1
# endif
# ifdef __sparc__
# define __ASSUME_SETRESUID_SYSCALL 1
# endif
#endif
/* Linux 2.4.0 on PPC introduced a correct IPC64. */
#if __LINUX_KERNEL_VERSION >= 132096 && defined __powerpc__
# define __ASSUME_IPC64 1
#endif
/* We can use the LDTs for threading with Linux 2.3.99 and newer. */
#if __LINUX_KERNEL_VERSION >= 131939
# define __ASSUME_LDT_WORKS 1
#endif
/* The changed st_ino field appeared in 2.4.0-test6. But we cannot
distinguish this version from other 2.4.0 releases. Therefore play
save and assume it available is for 2.4.1 and up. */
#if __LINUX_KERNEL_VERSION >= 132097
# define __ASSUME_ST_INO_64_BIT 1
#endif
/* To support locking of large files a new fcntl() syscall was introduced
in 2.4.0-test7. We test for 2.4.1 for the earliest version we know
the syscall is available. */
#if __LINUX_KERNEL_VERSION >= 132097 && (defined __i386__ || defined __sparc__)
# define __ASSUME_FCNTL64 1
#endif
/* Arm got fcntl64 in 2.4.4, PowerPC and SH have it also in 2.4.4 (I
don't know when it got introduced). */
#if __LINUX_KERNEL_VERSION >= 132100 \
&& (defined __arm__ || defined __powerpc__ || defined __sh__)
# define __ASSUME_FCNTL64 1
#endif
/* The getdents64 syscall was introduced in 2.4.0-test7. We test for
2.4.1 for the earliest version we know the syscall is available. */
#if __LINUX_KERNEL_VERSION >= 132097
# define __ASSUME_GETDENTS64_SYSCALL 1
#endif
/* When did O_DIRECTORY became available? Early in 2.3 but when?
Be safe, use 2.3.99. */
#if __LINUX_KERNEL_VERSION >= 131939
# define __ASSUME_O_DIRECTORY 1
#endif
/* Starting with one of the 2.4.0 pre-releases the Linux kernel passes
up the page size information. */
#if __LINUX_KERNEL_VERSION >= 132097
# define __ASSUME_AT_PAGESIZE 1
#endif
/* Starting with 2.4.5 kernels PPC passes the AUXV in the standard way
and the mmap2 syscall made it into the official kernel. */
#if __LINUX_KERNEL_VERSION >= (132096+5) && defined __powerpc__
# define __ASSUME_STD_AUXV 1
# define __ASSUME_MMAP2_SYSCALL 1
#endif
/* There are an infinite number of PA-RISC kernel versions numbered
2.4.0. But they've not really been released as such. We require
and expect the final version here. */
#ifdef __hppa__
# define __ASSUME_32BITUIDS 1
# define __ASSUME_TRUNCATE64_SYSCALL 1
# define __ASSUME_MMAP2_SYSCALL 1
# define __ASSUME_STAT64_SYSCALL 1
# define __ASSUME_IPC64 1
# define __ASSUME_ST_INO_64_BIT 1
# define __ASSUME_FCNTL64 1
# define __ASSUME_GETDENTS64_SYSCALL 1
#endif
| 2,540 |
605 | {
"pages": {
"clipPath": {
"cssExampleSrc": "./live-examples/css-examples/masking/clip-path.css",
"exampleCode": "./live-examples/css-examples/masking/clip-path.html",
"fileName": "clip-path.html",
"title": "CSS Demo: clip-path",
"type": "css"
},
"maskClip": {
"cssExampleSrc": "./live-examples/css-examples/masking/mask-clip.css",
"exampleCode": "./live-examples/css-examples/masking/mask-clip.html",
"fileName": "mask-clip.html",
"title": "CSS Demo: mask-clip",
"type": "css"
},
"maskComposite": {
"cssExampleSrc": "./live-examples/css-examples/masking/mask-composite.css",
"exampleCode": "./live-examples/css-examples/masking/mask-composite.html",
"fileName": "mask-composite.html",
"title": "CSS Demo: mask-composite",
"type": "css"
},
"maskImage": {
"cssExampleSrc": "./live-examples/css-examples/masking/mask-image.css",
"exampleCode": "./live-examples/css-examples/masking/mask-image.html",
"fileName": "mask-image.html",
"title": "CSS Demo: mask-image",
"type": "css"
},
"maskMode": {
"cssExampleSrc": "./live-examples/css-examples/masking/mask-mode.css",
"exampleCode": "./live-examples/css-examples/masking/mask-mode.html",
"fileName": "mask-mode.html",
"title": "CSS Demo: mask-mode",
"type": "css"
},
"maskOrigin": {
"cssExampleSrc": "./live-examples/css-examples/masking/mask-origin.css",
"exampleCode": "./live-examples/css-examples/masking/mask-origin.html",
"fileName": "mask-origin.html",
"title": "CSS Demo: mask-origin",
"type": "css"
},
"maskPosition": {
"cssExampleSrc": "./live-examples/css-examples/masking/mask-position.css",
"exampleCode": "./live-examples/css-examples/masking/mask-position.html",
"fileName": "mask-position.html",
"title": "CSS Demo: mask-position",
"type": "css"
},
"maskRepeat": {
"cssExampleSrc": "./live-examples/css-examples/masking/mask-repeat.css",
"exampleCode": "./live-examples/css-examples/masking/mask-repeat.html",
"fileName": "mask-repeat.html",
"title": "CSS Demo: mask-repeat",
"type": "css"
},
"maskSize": {
"cssExampleSrc": "./live-examples/css-examples/masking/mask-size.css",
"exampleCode": "./live-examples/css-examples/masking/mask-size.html",
"fileName": "mask-size.html",
"title": "CSS Demo: mask-size",
"type": "css"
},
"maskType": {
"cssExampleSrc": "./live-examples/css-examples/masking/mask-type.css",
"exampleCode": "./live-examples/css-examples/masking/mask-type.html",
"fileName": "mask-type.html",
"title": "CSS Demo: mask-type",
"type": "css"
},
"mask": {
"cssExampleSrc": "./live-examples/css-examples/masking/mask.css",
"exampleCode": "./live-examples/css-examples/masking/mask.html",
"fileName": "mask.html",
"title": "CSS Demo: mask",
"type": "css"
}
}
}
| 1,882 |
1,056 | <reponame>Antholoj/netbeans
/*
* 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.subversion;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.netbeans.modules.masterfs.providers.BaseAnnotationProvider;
import org.netbeans.modules.masterfs.providers.InterceptionListener;
import org.netbeans.modules.masterfs.providers.ProvidedExtensions;
import org.netbeans.modules.masterfs.providers.ProvidedExtensions.DeleteHandler;
import org.openide.filesystems.FileAttributeEvent;
import org.openide.filesystems.FileChangeListener;
import org.openide.filesystems.FileEvent;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileRenameEvent;
import org.openide.filesystems.FileStateInvalidException;
import org.openide.filesystems.FileSystem;
import org.openide.filesystems.FileUtil;
/**
*
* @author tomas
*/
public class TestAnnotationProvider extends BaseAnnotationProvider {
static TestAnnotationProvider instance = null;
List<String> events = new ArrayList<String>();
FilesystemInterceptor interceptor = new FilesystemInterceptor();
public TestAnnotationProvider() {
instance = this;
}
void init() {
Set filesystems = getRootFilesystems();
for (Iterator i = filesystems.iterator(); i.hasNext();) {
FileSystem fileSystem = (FileSystem) i.next();
fileSystem.addFileChangeListener(interceptor);
}
events.clear();
}
void reset() {
Set filesystems = getRootFilesystems();
for (Iterator i = filesystems.iterator(); i.hasNext();) {
FileSystem fileSystem = (FileSystem) i.next();
fileSystem.removeFileChangeListener(interceptor);
}
events.clear();
}
@Override
public String annotateName(String name, Set files) {
return "";
}
@Override
public String annotateNameHtml(String name, Set files) {
return "";
}
@Override
public InterceptionListener getInterceptionListener() {
return interceptor;
}
private class FilesystemInterceptor extends ProvidedExtensions implements FileChangeListener {
@Override
public void beforeChange(FileObject fo) {
events.add("beforeChange " + fo);
super.beforeChange(fo);
}
@Override
public boolean canWrite(File f) {
events.add("canWrite " + f);
return super.canWrite(f);
}
@Override
public void fileLocked(FileObject fo) throws IOException {
events.add("fileLocked " + fo);
super.fileLocked(fo);
}
@Override
public void fileUnlocked(FileObject fo) {
events.add("fileUnlocked " + fo);
super.fileUnlocked(fo);
}
@Override
public IOHandler getMoveHandler(File from, File to) {
events.add("getMoveHandler " + from + " -> " + to);
return super.getMoveHandler(from, to);
}
@Override
public IOHandler getRenameHandler(File from, String newName) {
events.add("getMoveHandler " + from + " -> " + newName);
return super.getRenameHandler(from, newName);
}
// create
@Override
public void beforeCreate(FileObject parent, String name, boolean isFolder) {
events.add("beforeCreate " + parent + " " + name + " " + isFolder);
}
@Override
public void createFailure(FileObject parent, String name, boolean isFolder) {
events.add("createFailure " + parent + " " + name + " " + isFolder);
}
@Override
public void createSuccess(FileObject fo) {
events.add("createSuccess " + fo);
}
public void fileFolderCreated(FileEvent fe) {
events.add("fileFolderCreated " + fe.getFile());
}
public void fileDataCreated(FileEvent fe) {
events.add("fileDataCreated " + fe.getFile());
}
// delete
@Override
public void beforeDelete(FileObject fo) {
events.add("beforeDelete " + fo);
}
public void fileDeleted(FileEvent fe) {
events.add("fileDeleted " + fe.getFile());
}
@Override
public void deleteFailure(FileObject fo) {
events.add("deleteFailure " + fo);
}
@Override
public void deleteSuccess(FileObject fo) {
events.add("deleteSuccess " + fo);
}
@Override
public DeleteHandler getDeleteHandler(File f) {
events.add("getDeleteHandler " + f);
return new DeleteHandler() {
public boolean delete(File file) {
events.add("getDeleteHandler.delete " + file);
deleteRecursively(file);
return true;
}
};
}
public void fileChanged(FileEvent fe) {
events.add("fileChanged " + fe.getFile());
}
public void fileRenamed(FileRenameEvent fe) {
events.add("fileRenamed " + fe.getFile());
}
public void fileAttributeChanged(FileAttributeEvent fe) {
events.add("fileAttributeChanged " + fe.getFile());
}
}
private Set<FileSystem> getRootFilesystems() {
Set<FileSystem> filesystems = new HashSet<FileSystem>();
File [] roots = File.listRoots();
for (int i = 0; i < roots.length; i++) {
File root = roots[i];
FileObject fo = FileUtil.toFileObject(FileUtil.normalizeFile(root));
if (fo == null) continue;
try {
filesystems.add(fo.getFileSystem());
} catch (FileStateInvalidException e) {
// ignore invalid filesystems
}
}
return filesystems;
}
private static void deleteRecursively(File file) {
if (file.isDirectory()) {
File [] files = file.listFiles();
for (int i = 0; i < files.length; i++) {
deleteRecursively(files[i]);
}
}
file.delete();
}
}
| 3,007 |
850 | <reponame>langsunny/DEye
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: tensorflow/core/protobuf/meta_graph.proto
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "tensorflow/core/protobuf/meta_graph.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
namespace tensorflow {
namespace {
const ::google::protobuf::Descriptor* MetaGraphDef_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
MetaGraphDef_reflection_ = NULL;
const ::google::protobuf::Descriptor* MetaGraphDef_MetaInfoDef_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
MetaGraphDef_MetaInfoDef_reflection_ = NULL;
const ::google::protobuf::Descriptor* MetaGraphDef_CollectionDefEntry_descriptor_ = NULL;
const ::google::protobuf::Descriptor* MetaGraphDef_SignatureDefEntry_descriptor_ = NULL;
const ::google::protobuf::Descriptor* CollectionDef_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CollectionDef_reflection_ = NULL;
struct CollectionDefOneofInstance {
const ::tensorflow::CollectionDef_NodeList* node_list_;
const ::tensorflow::CollectionDef_BytesList* bytes_list_;
const ::tensorflow::CollectionDef_Int64List* int64_list_;
const ::tensorflow::CollectionDef_FloatList* float_list_;
const ::tensorflow::CollectionDef_AnyList* any_list_;
}* CollectionDef_default_oneof_instance_ = NULL;
const ::google::protobuf::Descriptor* CollectionDef_NodeList_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CollectionDef_NodeList_reflection_ = NULL;
const ::google::protobuf::Descriptor* CollectionDef_BytesList_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CollectionDef_BytesList_reflection_ = NULL;
const ::google::protobuf::Descriptor* CollectionDef_Int64List_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CollectionDef_Int64List_reflection_ = NULL;
const ::google::protobuf::Descriptor* CollectionDef_FloatList_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CollectionDef_FloatList_reflection_ = NULL;
const ::google::protobuf::Descriptor* CollectionDef_AnyList_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CollectionDef_AnyList_reflection_ = NULL;
const ::google::protobuf::Descriptor* TensorInfo_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
TensorInfo_reflection_ = NULL;
struct TensorInfoOneofInstance {
::google::protobuf::internal::ArenaStringPtr name_;
const ::tensorflow::TensorInfo_CooSparse* coo_sparse_;
}* TensorInfo_default_oneof_instance_ = NULL;
const ::google::protobuf::Descriptor* TensorInfo_CooSparse_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
TensorInfo_CooSparse_reflection_ = NULL;
const ::google::protobuf::Descriptor* SignatureDef_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
SignatureDef_reflection_ = NULL;
const ::google::protobuf::Descriptor* SignatureDef_InputsEntry_descriptor_ = NULL;
const ::google::protobuf::Descriptor* SignatureDef_OutputsEntry_descriptor_ = NULL;
const ::google::protobuf::Descriptor* AssetFileDef_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
AssetFileDef_reflection_ = NULL;
} // namespace
void protobuf_AssignDesc_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto() GOOGLE_ATTRIBUTE_COLD;
void protobuf_AssignDesc_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto() {
protobuf_AddDesc_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
const ::google::protobuf::FileDescriptor* file =
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
"tensorflow/core/protobuf/meta_graph.proto");
GOOGLE_CHECK(file != NULL);
MetaGraphDef_descriptor_ = file->message_type(0);
static const int MetaGraphDef_offsets_[6] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef, meta_info_def_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef, graph_def_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef, saver_def_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef, collection_def_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef, signature_def_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef, asset_file_def_),
};
MetaGraphDef_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
MetaGraphDef_descriptor_,
MetaGraphDef::internal_default_instance(),
MetaGraphDef_offsets_,
-1,
-1,
-1,
sizeof(MetaGraphDef),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef, _internal_metadata_));
MetaGraphDef_MetaInfoDef_descriptor_ = MetaGraphDef_descriptor_->nested_type(0);
static const int MetaGraphDef_MetaInfoDef_offsets_[6] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef_MetaInfoDef, meta_graph_version_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef_MetaInfoDef, stripped_op_list_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef_MetaInfoDef, any_info_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef_MetaInfoDef, tags_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef_MetaInfoDef, tensorflow_version_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef_MetaInfoDef, tensorflow_git_version_),
};
MetaGraphDef_MetaInfoDef_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
MetaGraphDef_MetaInfoDef_descriptor_,
MetaGraphDef_MetaInfoDef::internal_default_instance(),
MetaGraphDef_MetaInfoDef_offsets_,
-1,
-1,
-1,
sizeof(MetaGraphDef_MetaInfoDef),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MetaGraphDef_MetaInfoDef, _internal_metadata_));
MetaGraphDef_CollectionDefEntry_descriptor_ = MetaGraphDef_descriptor_->nested_type(1);
MetaGraphDef_SignatureDefEntry_descriptor_ = MetaGraphDef_descriptor_->nested_type(2);
CollectionDef_descriptor_ = file->message_type(1);
static const int CollectionDef_offsets_[6] = {
PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(CollectionDef_default_oneof_instance_, node_list_),
PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(CollectionDef_default_oneof_instance_, bytes_list_),
PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(CollectionDef_default_oneof_instance_, int64_list_),
PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(CollectionDef_default_oneof_instance_, float_list_),
PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(CollectionDef_default_oneof_instance_, any_list_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef, kind_),
};
CollectionDef_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
CollectionDef_descriptor_,
CollectionDef::internal_default_instance(),
CollectionDef_offsets_,
-1,
-1,
-1,
CollectionDef_default_oneof_instance_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef, _oneof_case_[0]),
sizeof(CollectionDef),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef, _internal_metadata_));
CollectionDef_NodeList_descriptor_ = CollectionDef_descriptor_->nested_type(0);
static const int CollectionDef_NodeList_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef_NodeList, value_),
};
CollectionDef_NodeList_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
CollectionDef_NodeList_descriptor_,
CollectionDef_NodeList::internal_default_instance(),
CollectionDef_NodeList_offsets_,
-1,
-1,
-1,
sizeof(CollectionDef_NodeList),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef_NodeList, _internal_metadata_));
CollectionDef_BytesList_descriptor_ = CollectionDef_descriptor_->nested_type(1);
static const int CollectionDef_BytesList_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef_BytesList, value_),
};
CollectionDef_BytesList_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
CollectionDef_BytesList_descriptor_,
CollectionDef_BytesList::internal_default_instance(),
CollectionDef_BytesList_offsets_,
-1,
-1,
-1,
sizeof(CollectionDef_BytesList),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef_BytesList, _internal_metadata_));
CollectionDef_Int64List_descriptor_ = CollectionDef_descriptor_->nested_type(2);
static const int CollectionDef_Int64List_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef_Int64List, value_),
};
CollectionDef_Int64List_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
CollectionDef_Int64List_descriptor_,
CollectionDef_Int64List::internal_default_instance(),
CollectionDef_Int64List_offsets_,
-1,
-1,
-1,
sizeof(CollectionDef_Int64List),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef_Int64List, _internal_metadata_));
CollectionDef_FloatList_descriptor_ = CollectionDef_descriptor_->nested_type(3);
static const int CollectionDef_FloatList_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef_FloatList, value_),
};
CollectionDef_FloatList_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
CollectionDef_FloatList_descriptor_,
CollectionDef_FloatList::internal_default_instance(),
CollectionDef_FloatList_offsets_,
-1,
-1,
-1,
sizeof(CollectionDef_FloatList),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef_FloatList, _internal_metadata_));
CollectionDef_AnyList_descriptor_ = CollectionDef_descriptor_->nested_type(4);
static const int CollectionDef_AnyList_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef_AnyList, value_),
};
CollectionDef_AnyList_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
CollectionDef_AnyList_descriptor_,
CollectionDef_AnyList::internal_default_instance(),
CollectionDef_AnyList_offsets_,
-1,
-1,
-1,
sizeof(CollectionDef_AnyList),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CollectionDef_AnyList, _internal_metadata_));
TensorInfo_descriptor_ = file->message_type(2);
static const int TensorInfo_offsets_[5] = {
PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(TensorInfo_default_oneof_instance_, name_),
PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(TensorInfo_default_oneof_instance_, coo_sparse_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TensorInfo, dtype_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TensorInfo, tensor_shape_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TensorInfo, encoding_),
};
TensorInfo_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
TensorInfo_descriptor_,
TensorInfo::internal_default_instance(),
TensorInfo_offsets_,
-1,
-1,
-1,
TensorInfo_default_oneof_instance_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TensorInfo, _oneof_case_[0]),
sizeof(TensorInfo),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TensorInfo, _internal_metadata_));
TensorInfo_CooSparse_descriptor_ = TensorInfo_descriptor_->nested_type(0);
static const int TensorInfo_CooSparse_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TensorInfo_CooSparse, values_tensor_name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TensorInfo_CooSparse, indices_tensor_name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TensorInfo_CooSparse, dense_shape_tensor_name_),
};
TensorInfo_CooSparse_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
TensorInfo_CooSparse_descriptor_,
TensorInfo_CooSparse::internal_default_instance(),
TensorInfo_CooSparse_offsets_,
-1,
-1,
-1,
sizeof(TensorInfo_CooSparse),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TensorInfo_CooSparse, _internal_metadata_));
SignatureDef_descriptor_ = file->message_type(3);
static const int SignatureDef_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SignatureDef, inputs_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SignatureDef, outputs_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SignatureDef, method_name_),
};
SignatureDef_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
SignatureDef_descriptor_,
SignatureDef::internal_default_instance(),
SignatureDef_offsets_,
-1,
-1,
-1,
sizeof(SignatureDef),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SignatureDef, _internal_metadata_));
SignatureDef_InputsEntry_descriptor_ = SignatureDef_descriptor_->nested_type(0);
SignatureDef_OutputsEntry_descriptor_ = SignatureDef_descriptor_->nested_type(1);
AssetFileDef_descriptor_ = file->message_type(4);
static const int AssetFileDef_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AssetFileDef, tensor_info_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AssetFileDef, filename_),
};
AssetFileDef_reflection_ =
::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(
AssetFileDef_descriptor_,
AssetFileDef::internal_default_instance(),
AssetFileDef_offsets_,
-1,
-1,
-1,
sizeof(AssetFileDef),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AssetFileDef, _internal_metadata_));
}
namespace {
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
void protobuf_AssignDescriptorsOnce() {
::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
&protobuf_AssignDesc_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto);
}
void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
MetaGraphDef_descriptor_, MetaGraphDef::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
MetaGraphDef_MetaInfoDef_descriptor_, MetaGraphDef_MetaInfoDef::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
MetaGraphDef_CollectionDefEntry_descriptor_,
::google::protobuf::internal::MapEntry<
::std::string,
::tensorflow::CollectionDef,
::google::protobuf::internal::WireFormatLite::TYPE_STRING,
::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
0>::CreateDefaultInstance(
MetaGraphDef_CollectionDefEntry_descriptor_));
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
MetaGraphDef_SignatureDefEntry_descriptor_,
::google::protobuf::internal::MapEntry<
::std::string,
::tensorflow::SignatureDef,
::google::protobuf::internal::WireFormatLite::TYPE_STRING,
::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
0>::CreateDefaultInstance(
MetaGraphDef_SignatureDefEntry_descriptor_));
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CollectionDef_descriptor_, CollectionDef::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CollectionDef_NodeList_descriptor_, CollectionDef_NodeList::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CollectionDef_BytesList_descriptor_, CollectionDef_BytesList::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CollectionDef_Int64List_descriptor_, CollectionDef_Int64List::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CollectionDef_FloatList_descriptor_, CollectionDef_FloatList::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CollectionDef_AnyList_descriptor_, CollectionDef_AnyList::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
TensorInfo_descriptor_, TensorInfo::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
TensorInfo_CooSparse_descriptor_, TensorInfo_CooSparse::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
SignatureDef_descriptor_, SignatureDef::internal_default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
SignatureDef_InputsEntry_descriptor_,
::google::protobuf::internal::MapEntry<
::std::string,
::tensorflow::TensorInfo,
::google::protobuf::internal::WireFormatLite::TYPE_STRING,
::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
0>::CreateDefaultInstance(
SignatureDef_InputsEntry_descriptor_));
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
SignatureDef_OutputsEntry_descriptor_,
::google::protobuf::internal::MapEntry<
::std::string,
::tensorflow::TensorInfo,
::google::protobuf::internal::WireFormatLite::TYPE_STRING,
::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
0>::CreateDefaultInstance(
SignatureDef_OutputsEntry_descriptor_));
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
AssetFileDef_descriptor_, AssetFileDef::internal_default_instance());
}
} // namespace
void protobuf_ShutdownFile_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto() {
MetaGraphDef_default_instance_.Shutdown();
delete MetaGraphDef_reflection_;
MetaGraphDef_MetaInfoDef_default_instance_.Shutdown();
delete MetaGraphDef_MetaInfoDef_reflection_;
CollectionDef_default_instance_.Shutdown();
delete CollectionDef_default_oneof_instance_;
delete CollectionDef_reflection_;
CollectionDef_NodeList_default_instance_.Shutdown();
delete CollectionDef_NodeList_reflection_;
CollectionDef_BytesList_default_instance_.Shutdown();
delete CollectionDef_BytesList_reflection_;
CollectionDef_Int64List_default_instance_.Shutdown();
delete CollectionDef_Int64List_reflection_;
CollectionDef_FloatList_default_instance_.Shutdown();
delete CollectionDef_FloatList_reflection_;
CollectionDef_AnyList_default_instance_.Shutdown();
delete CollectionDef_AnyList_reflection_;
TensorInfo_default_instance_.Shutdown();
delete TensorInfo_default_oneof_instance_;
delete TensorInfo_reflection_;
TensorInfo_CooSparse_default_instance_.Shutdown();
delete TensorInfo_CooSparse_reflection_;
SignatureDef_default_instance_.Shutdown();
delete SignatureDef_reflection_;
AssetFileDef_default_instance_.Shutdown();
delete AssetFileDef_reflection_;
}
void protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto_impl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
::google::protobuf::protobuf_InitDefaults_google_2fprotobuf_2fany_2eproto();
::tensorflow::protobuf_InitDefaults_tensorflow_2fcore_2fframework_2fgraph_2eproto();
::tensorflow::protobuf_InitDefaults_tensorflow_2fcore_2fframework_2fop_5fdef_2eproto();
::tensorflow::protobuf_InitDefaults_tensorflow_2fcore_2fframework_2ftensor_5fshape_2eproto();
::tensorflow::protobuf_InitDefaults_tensorflow_2fcore_2fframework_2ftypes_2eproto();
::tensorflow::protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fsaver_2eproto();
::google::protobuf::internal::GetEmptyString();
MetaGraphDef_default_instance_.DefaultConstruct();
::google::protobuf::internal::GetEmptyString();
MetaGraphDef_MetaInfoDef_default_instance_.DefaultConstruct();
::google::protobuf::internal::GetEmptyString();
::google::protobuf::internal::GetEmptyString();
CollectionDef_default_instance_.DefaultConstruct();
CollectionDef_default_oneof_instance_ = new CollectionDefOneofInstance();
::google::protobuf::internal::GetEmptyString();
CollectionDef_NodeList_default_instance_.DefaultConstruct();
::google::protobuf::internal::GetEmptyString();
CollectionDef_BytesList_default_instance_.DefaultConstruct();
CollectionDef_Int64List_default_instance_.DefaultConstruct();
CollectionDef_FloatList_default_instance_.DefaultConstruct();
CollectionDef_AnyList_default_instance_.DefaultConstruct();
::google::protobuf::internal::GetEmptyString();
TensorInfo_default_instance_.DefaultConstruct();
TensorInfo_default_oneof_instance_ = new TensorInfoOneofInstance();
::google::protobuf::internal::GetEmptyString();
TensorInfo_CooSparse_default_instance_.DefaultConstruct();
::google::protobuf::internal::GetEmptyString();
SignatureDef_default_instance_.DefaultConstruct();
::google::protobuf::internal::GetEmptyString();
AssetFileDef_default_instance_.DefaultConstruct();
MetaGraphDef_default_instance_.get_mutable()->InitAsDefaultInstance();
MetaGraphDef_MetaInfoDef_default_instance_.get_mutable()->InitAsDefaultInstance();
CollectionDef_default_instance_.get_mutable()->InitAsDefaultInstance();
CollectionDef_NodeList_default_instance_.get_mutable()->InitAsDefaultInstance();
CollectionDef_BytesList_default_instance_.get_mutable()->InitAsDefaultInstance();
CollectionDef_Int64List_default_instance_.get_mutable()->InitAsDefaultInstance();
CollectionDef_FloatList_default_instance_.get_mutable()->InitAsDefaultInstance();
CollectionDef_AnyList_default_instance_.get_mutable()->InitAsDefaultInstance();
TensorInfo_default_instance_.get_mutable()->InitAsDefaultInstance();
TensorInfo_CooSparse_default_instance_.get_mutable()->InitAsDefaultInstance();
SignatureDef_default_instance_.get_mutable()->InitAsDefaultInstance();
AssetFileDef_default_instance_.get_mutable()->InitAsDefaultInstance();
}
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto_once_);
void protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto() {
::google::protobuf::GoogleOnceInit(&protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto_once_,
&protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto_impl);
}
void protobuf_AddDesc_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto_impl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n)tensorflow/core/protobuf/meta_graph.pr"
"oto\022\ntensorflow\032\031google/protobuf/any.pro"
"to\032%tensorflow/core/framework/graph.prot"
"o\032&tensorflow/core/framework/op_def.prot"
"o\032,tensorflow/core/framework/tensor_shap"
"e.proto\032%tensorflow/core/framework/types"
".proto\032$tensorflow/core/protobuf/saver.p"
"roto\"\303\005\n\014MetaGraphDef\022;\n\rmeta_info_def\030\001"
" \001(\0132$.tensorflow.MetaGraphDef.MetaInfoD"
"ef\022\'\n\tgraph_def\030\002 \001(\0132\024.tensorflow.Graph"
"Def\022\'\n\tsaver_def\030\003 \001(\0132\024.tensorflow.Save"
"rDef\022C\n\016collection_def\030\004 \003(\0132+.tensorflo"
"w.MetaGraphDef.CollectionDefEntry\022A\n\rsig"
"nature_def\030\005 \003(\0132*.tensorflow.MetaGraphD"
"ef.SignatureDefEntry\0220\n\016asset_file_def\030\006"
" \003(\0132\030.tensorflow.AssetFileDef\032\311\001\n\013MetaI"
"nfoDef\022\032\n\022meta_graph_version\030\001 \001(\t\022,\n\020st"
"ripped_op_list\030\002 \001(\0132\022.tensorflow.OpList"
"\022&\n\010any_info\030\003 \001(\0132\024.google.protobuf.Any"
"\022\014\n\004tags\030\004 \003(\t\022\032\n\022tensorflow_version\030\005 \001"
"(\t\022\036\n\026tensorflow_git_version\030\006 \001(\t\032O\n\022Co"
"llectionDefEntry\022\013\n\003key\030\001 \001(\t\022(\n\005value\030\002"
" \001(\0132\031.tensorflow.CollectionDef:\0028\001\032M\n\021S"
"ignatureDefEntry\022\013\n\003key\030\001 \001(\t\022\'\n\005value\030\002"
" \001(\0132\030.tensorflow.SignatureDef:\0028\001\"\337\003\n\rC"
"ollectionDef\0227\n\tnode_list\030\001 \001(\0132\".tensor"
"flow.CollectionDef.NodeListH\000\0229\n\nbytes_l"
"ist\030\002 \001(\0132#.tensorflow.CollectionDef.Byt"
"esListH\000\0229\n\nint64_list\030\003 \001(\0132#.tensorflo"
"w.CollectionDef.Int64ListH\000\0229\n\nfloat_lis"
"t\030\004 \001(\0132#.tensorflow.CollectionDef.Float"
"ListH\000\0225\n\010any_list\030\005 \001(\0132!.tensorflow.Co"
"llectionDef.AnyListH\000\032\031\n\010NodeList\022\r\n\005val"
"ue\030\001 \003(\t\032\032\n\tBytesList\022\r\n\005value\030\001 \003(\014\032\036\n\t"
"Int64List\022\021\n\005value\030\001 \003(\003B\002\020\001\032\036\n\tFloatLis"
"t\022\021\n\005value\030\001 \003(\002B\002\020\001\032.\n\007AnyList\022#\n\005value"
"\030\001 \003(\0132\024.google.protobuf.AnyB\006\n\004kind\"\240\002\n"
"\nTensorInfo\022\016\n\004name\030\001 \001(\tH\000\0226\n\ncoo_spars"
"e\030\004 \001(\0132 .tensorflow.TensorInfo.CooSpars"
"eH\000\022#\n\005dtype\030\002 \001(\0162\024.tensorflow.DataType"
"\0222\n\014tensor_shape\030\003 \001(\0132\034.tensorflow.Tens"
"orShapeProto\032e\n\tCooSparse\022\032\n\022values_tens"
"or_name\030\001 \001(\t\022\033\n\023indices_tensor_name\030\002 \001"
"(\t\022\037\n\027dense_shape_tensor_name\030\003 \001(\tB\n\n\010e"
"ncoding\"\240\002\n\014SignatureDef\0224\n\006inputs\030\001 \003(\013"
"2$.tensorflow.SignatureDef.InputsEntry\0226"
"\n\007outputs\030\002 \003(\0132%.tensorflow.SignatureDe"
"f.OutputsEntry\022\023\n\013method_name\030\003 \001(\t\032E\n\013I"
"nputsEntry\022\013\n\003key\030\001 \001(\t\022%\n\005value\030\002 \001(\0132\026"
".tensorflow.TensorInfo:\0028\001\032F\n\014OutputsEnt"
"ry\022\013\n\003key\030\001 \001(\t\022%\n\005value\030\002 \001(\0132\026.tensorf"
"low.TensorInfo:\0028\001\"M\n\014AssetFileDef\022+\n\013te"
"nsor_info\030\001 \001(\0132\026.tensorflow.TensorInfo\022"
"\020\n\010filename\030\002 \001(\tB0\n\030org.tensorflow.fram"
"eworkB\017MetaGraphProtosP\001\370\001\001b\006proto3", 2195);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"tensorflow/core/protobuf/meta_graph.proto", &protobuf_RegisterTypes);
::google::protobuf::protobuf_AddDesc_google_2fprotobuf_2fany_2eproto();
::tensorflow::protobuf_AddDesc_tensorflow_2fcore_2fframework_2fgraph_2eproto();
::tensorflow::protobuf_AddDesc_tensorflow_2fcore_2fframework_2fop_5fdef_2eproto();
::tensorflow::protobuf_AddDesc_tensorflow_2fcore_2fframework_2ftensor_5fshape_2eproto();
::tensorflow::protobuf_AddDesc_tensorflow_2fcore_2fframework_2ftypes_2eproto();
::tensorflow::protobuf_AddDesc_tensorflow_2fcore_2fprotobuf_2fsaver_2eproto();
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto);
}
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AddDesc_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto_once_);
void protobuf_AddDesc_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto() {
::google::protobuf::GoogleOnceInit(&protobuf_AddDesc_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto_once_,
&protobuf_AddDesc_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto_impl);
}
// Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto {
StaticDescriptorInitializer_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto() {
protobuf_AddDesc_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
}
} static_descriptor_initializer_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto_;
namespace {
static void MergeFromFail(int line) GOOGLE_ATTRIBUTE_COLD GOOGLE_ATTRIBUTE_NORETURN;
static void MergeFromFail(int line) {
::google::protobuf::internal::MergeFromFail(__FILE__, line);
}
} // namespace
// ===================================================================
void MetaGraphDef_MetaInfoDef::_slow_mutable_stripped_op_list() {
stripped_op_list_ = ::google::protobuf::Arena::CreateMessage< ::tensorflow::OpList >(
GetArenaNoVirtual());
}
::tensorflow::OpList* MetaGraphDef_MetaInfoDef::_slow_release_stripped_op_list() {
if (stripped_op_list_ == NULL) {
return NULL;
} else {
::tensorflow::OpList* temp = new ::tensorflow::OpList(*stripped_op_list_);
stripped_op_list_ = NULL;
return temp;
}
}
::tensorflow::OpList* MetaGraphDef_MetaInfoDef::unsafe_arena_release_stripped_op_list() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.MetaGraphDef.MetaInfoDef.stripped_op_list)
::tensorflow::OpList* temp = stripped_op_list_;
stripped_op_list_ = NULL;
return temp;
}
void MetaGraphDef_MetaInfoDef::_slow_set_allocated_stripped_op_list(
::google::protobuf::Arena* message_arena, ::tensorflow::OpList** stripped_op_list) {
if (message_arena != NULL &&
::google::protobuf::Arena::GetArena(*stripped_op_list) == NULL) {
message_arena->Own(*stripped_op_list);
} else if (message_arena !=
::google::protobuf::Arena::GetArena(*stripped_op_list)) {
::tensorflow::OpList* new_stripped_op_list =
::google::protobuf::Arena::CreateMessage< ::tensorflow::OpList >(
message_arena);
new_stripped_op_list->CopyFrom(**stripped_op_list);
*stripped_op_list = new_stripped_op_list;
}
}
void MetaGraphDef_MetaInfoDef::unsafe_arena_set_allocated_stripped_op_list(
::tensorflow::OpList* stripped_op_list) {
if (GetArenaNoVirtual() == NULL) {
delete stripped_op_list_;
}
stripped_op_list_ = stripped_op_list;
if (stripped_op_list) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.MetaGraphDef.MetaInfoDef.stripped_op_list)
}
void MetaGraphDef_MetaInfoDef::_slow_mutable_any_info() {
any_info_ = ::google::protobuf::Arena::Create< ::google::protobuf::Any >(
GetArenaNoVirtual());
}
::google::protobuf::Any* MetaGraphDef_MetaInfoDef::_slow_release_any_info() {
if (any_info_ == NULL) {
return NULL;
} else {
::google::protobuf::Any* temp = new ::google::protobuf::Any(*any_info_);
any_info_ = NULL;
return temp;
}
}
::google::protobuf::Any* MetaGraphDef_MetaInfoDef::unsafe_arena_release_any_info() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.MetaGraphDef.MetaInfoDef.any_info)
::google::protobuf::Any* temp = any_info_;
any_info_ = NULL;
return temp;
}
void MetaGraphDef_MetaInfoDef::unsafe_arena_set_allocated_any_info(
::google::protobuf::Any* any_info) {
if (GetArenaNoVirtual() == NULL) {
delete any_info_;
}
any_info_ = any_info;
if (any_info) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.MetaGraphDef.MetaInfoDef.any_info)
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int MetaGraphDef_MetaInfoDef::kMetaGraphVersionFieldNumber;
const int MetaGraphDef_MetaInfoDef::kStrippedOpListFieldNumber;
const int MetaGraphDef_MetaInfoDef::kAnyInfoFieldNumber;
const int MetaGraphDef_MetaInfoDef::kTagsFieldNumber;
const int MetaGraphDef_MetaInfoDef::kTensorflowVersionFieldNumber;
const int MetaGraphDef_MetaInfoDef::kTensorflowGitVersionFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
MetaGraphDef_MetaInfoDef::MetaGraphDef_MetaInfoDef()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.MetaGraphDef.MetaInfoDef)
}
MetaGraphDef_MetaInfoDef::MetaGraphDef_MetaInfoDef(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena),
tags_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.MetaGraphDef.MetaInfoDef)
}
void MetaGraphDef_MetaInfoDef::InitAsDefaultInstance() {
stripped_op_list_ = const_cast< ::tensorflow::OpList*>(
::tensorflow::OpList::internal_default_instance());
any_info_ = const_cast< ::google::protobuf::Any*>(
::google::protobuf::Any::internal_default_instance());
}
MetaGraphDef_MetaInfoDef::MetaGraphDef_MetaInfoDef(const MetaGraphDef_MetaInfoDef& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:tensorflow.MetaGraphDef.MetaInfoDef)
}
void MetaGraphDef_MetaInfoDef::SharedCtor() {
meta_graph_version_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
tensorflow_version_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
tensorflow_git_version_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
stripped_op_list_ = NULL;
any_info_ = NULL;
_cached_size_ = 0;
}
MetaGraphDef_MetaInfoDef::~MetaGraphDef_MetaInfoDef() {
// @@protoc_insertion_point(destructor:tensorflow.MetaGraphDef.MetaInfoDef)
SharedDtor();
}
void MetaGraphDef_MetaInfoDef::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
meta_graph_version_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
tensorflow_version_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
tensorflow_git_version_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
if (this != &MetaGraphDef_MetaInfoDef_default_instance_.get()) {
delete stripped_op_list_;
delete any_info_;
}
}
void MetaGraphDef_MetaInfoDef::ArenaDtor(void* object) {
MetaGraphDef_MetaInfoDef* _this = reinterpret_cast< MetaGraphDef_MetaInfoDef* >(object);
(void)_this;
}
void MetaGraphDef_MetaInfoDef::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void MetaGraphDef_MetaInfoDef::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* MetaGraphDef_MetaInfoDef::descriptor() {
protobuf_AssignDescriptorsOnce();
return MetaGraphDef_MetaInfoDef_descriptor_;
}
const MetaGraphDef_MetaInfoDef& MetaGraphDef_MetaInfoDef::default_instance() {
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<MetaGraphDef_MetaInfoDef> MetaGraphDef_MetaInfoDef_default_instance_;
MetaGraphDef_MetaInfoDef* MetaGraphDef_MetaInfoDef::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<MetaGraphDef_MetaInfoDef>(arena);
}
void MetaGraphDef_MetaInfoDef::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.MetaGraphDef.MetaInfoDef)
meta_graph_version_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
if (GetArenaNoVirtual() == NULL && stripped_op_list_ != NULL) delete stripped_op_list_;
stripped_op_list_ = NULL;
if (GetArenaNoVirtual() == NULL && any_info_ != NULL) delete any_info_;
any_info_ = NULL;
tensorflow_version_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
tensorflow_git_version_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
tags_.Clear();
}
bool MetaGraphDef_MetaInfoDef::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.MetaGraphDef.MetaInfoDef)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string meta_graph_version = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_meta_graph_version()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->meta_graph_version().data(), this->meta_graph_version().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version"));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_stripped_op_list;
break;
}
// optional .tensorflow.OpList stripped_op_list = 2;
case 2: {
if (tag == 18) {
parse_stripped_op_list:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_stripped_op_list()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_any_info;
break;
}
// optional .google.protobuf.Any any_info = 3;
case 3: {
if (tag == 26) {
parse_any_info:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_any_info()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_tags;
break;
}
// repeated string tags = 4;
case 4: {
if (tag == 34) {
parse_tags:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->add_tags()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->tags(this->tags_size() - 1).data(),
this->tags(this->tags_size() - 1).length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.MetaGraphDef.MetaInfoDef.tags"));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_tags;
if (input->ExpectTag(42)) goto parse_tensorflow_version;
break;
}
// optional string tensorflow_version = 5;
case 5: {
if (tag == 42) {
parse_tensorflow_version:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_tensorflow_version()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->tensorflow_version().data(), this->tensorflow_version().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version"));
} else {
goto handle_unusual;
}
if (input->ExpectTag(50)) goto parse_tensorflow_git_version;
break;
}
// optional string tensorflow_git_version = 6;
case 6: {
if (tag == 50) {
parse_tensorflow_git_version:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_tensorflow_git_version()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->tensorflow_git_version().data(), this->tensorflow_git_version().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version"));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.MetaGraphDef.MetaInfoDef)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.MetaGraphDef.MetaInfoDef)
return false;
#undef DO_
}
void MetaGraphDef_MetaInfoDef::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.MetaGraphDef.MetaInfoDef)
// optional string meta_graph_version = 1;
if (this->meta_graph_version().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->meta_graph_version().data(), this->meta_graph_version().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->meta_graph_version(), output);
}
// optional .tensorflow.OpList stripped_op_list = 2;
if (this->has_stripped_op_list()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *this->stripped_op_list_, output);
}
// optional .google.protobuf.Any any_info = 3;
if (this->has_any_info()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, *this->any_info_, output);
}
// repeated string tags = 4;
for (int i = 0; i < this->tags_size(); i++) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->tags(i).data(), this->tags(i).length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.MetaInfoDef.tags");
::google::protobuf::internal::WireFormatLite::WriteString(
4, this->tags(i), output);
}
// optional string tensorflow_version = 5;
if (this->tensorflow_version().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->tensorflow_version().data(), this->tensorflow_version().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
5, this->tensorflow_version(), output);
}
// optional string tensorflow_git_version = 6;
if (this->tensorflow_git_version().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->tensorflow_git_version().data(), this->tensorflow_git_version().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
6, this->tensorflow_git_version(), output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.MetaGraphDef.MetaInfoDef)
}
::google::protobuf::uint8* MetaGraphDef_MetaInfoDef::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.MetaGraphDef.MetaInfoDef)
// optional string meta_graph_version = 1;
if (this->meta_graph_version().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->meta_graph_version().data(), this->meta_graph_version().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->meta_graph_version(), target);
}
// optional .tensorflow.OpList stripped_op_list = 2;
if (this->has_stripped_op_list()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *this->stripped_op_list_, false, target);
}
// optional .google.protobuf.Any any_info = 3;
if (this->has_any_info()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
3, *this->any_info_, false, target);
}
// repeated string tags = 4;
for (int i = 0; i < this->tags_size(); i++) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->tags(i).data(), this->tags(i).length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.MetaInfoDef.tags");
target = ::google::protobuf::internal::WireFormatLite::
WriteStringToArray(4, this->tags(i), target);
}
// optional string tensorflow_version = 5;
if (this->tensorflow_version().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->tensorflow_version().data(), this->tensorflow_version().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
5, this->tensorflow_version(), target);
}
// optional string tensorflow_git_version = 6;
if (this->tensorflow_git_version().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->tensorflow_git_version().data(), this->tensorflow_git_version().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
6, this->tensorflow_git_version(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.MetaGraphDef.MetaInfoDef)
return target;
}
size_t MetaGraphDef_MetaInfoDef::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.MetaGraphDef.MetaInfoDef)
size_t total_size = 0;
// optional string meta_graph_version = 1;
if (this->meta_graph_version().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->meta_graph_version());
}
// optional .tensorflow.OpList stripped_op_list = 2;
if (this->has_stripped_op_list()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->stripped_op_list_);
}
// optional .google.protobuf.Any any_info = 3;
if (this->has_any_info()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->any_info_);
}
// optional string tensorflow_version = 5;
if (this->tensorflow_version().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->tensorflow_version());
}
// optional string tensorflow_git_version = 6;
if (this->tensorflow_git_version().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->tensorflow_git_version());
}
// repeated string tags = 4;
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->tags_size());
for (int i = 0; i < this->tags_size(); i++) {
total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
this->tags(i));
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void MetaGraphDef_MetaInfoDef::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.MetaGraphDef.MetaInfoDef)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const MetaGraphDef_MetaInfoDef* source =
::google::protobuf::internal::DynamicCastToGenerated<const MetaGraphDef_MetaInfoDef>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.MetaGraphDef.MetaInfoDef)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.MetaGraphDef.MetaInfoDef)
UnsafeMergeFrom(*source);
}
}
void MetaGraphDef_MetaInfoDef::MergeFrom(const MetaGraphDef_MetaInfoDef& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.MetaGraphDef.MetaInfoDef)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void MetaGraphDef_MetaInfoDef::UnsafeMergeFrom(const MetaGraphDef_MetaInfoDef& from) {
GOOGLE_DCHECK(&from != this);
tags_.UnsafeMergeFrom(from.tags_);
if (from.meta_graph_version().size() > 0) {
set_meta_graph_version(from.meta_graph_version());
}
if (from.has_stripped_op_list()) {
mutable_stripped_op_list()->::tensorflow::OpList::MergeFrom(from.stripped_op_list());
}
if (from.has_any_info()) {
mutable_any_info()->::google::protobuf::Any::MergeFrom(from.any_info());
}
if (from.tensorflow_version().size() > 0) {
set_tensorflow_version(from.tensorflow_version());
}
if (from.tensorflow_git_version().size() > 0) {
set_tensorflow_git_version(from.tensorflow_git_version());
}
}
void MetaGraphDef_MetaInfoDef::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.MetaGraphDef.MetaInfoDef)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void MetaGraphDef_MetaInfoDef::CopyFrom(const MetaGraphDef_MetaInfoDef& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.MetaGraphDef.MetaInfoDef)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool MetaGraphDef_MetaInfoDef::IsInitialized() const {
return true;
}
void MetaGraphDef_MetaInfoDef::Swap(MetaGraphDef_MetaInfoDef* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
MetaGraphDef_MetaInfoDef temp;
temp.UnsafeMergeFrom(*this);
CopyFrom(*other);
other->CopyFrom(temp);
}
}
void MetaGraphDef_MetaInfoDef::UnsafeArenaSwap(MetaGraphDef_MetaInfoDef* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void MetaGraphDef_MetaInfoDef::InternalSwap(MetaGraphDef_MetaInfoDef* other) {
meta_graph_version_.Swap(&other->meta_graph_version_);
std::swap(stripped_op_list_, other->stripped_op_list_);
std::swap(any_info_, other->any_info_);
tags_.UnsafeArenaSwap(&other->tags_);
tensorflow_version_.Swap(&other->tensorflow_version_);
tensorflow_git_version_.Swap(&other->tensorflow_git_version_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata MetaGraphDef_MetaInfoDef::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = MetaGraphDef_MetaInfoDef_descriptor_;
metadata.reflection = MetaGraphDef_MetaInfoDef_reflection_;
return metadata;
}
// -------------------------------------------------------------------
void MetaGraphDef::_slow_mutable_meta_info_def() {
meta_info_def_ = ::google::protobuf::Arena::CreateMessage< ::tensorflow::MetaGraphDef_MetaInfoDef >(
GetArenaNoVirtual());
}
::tensorflow::MetaGraphDef_MetaInfoDef* MetaGraphDef::_slow_release_meta_info_def() {
if (meta_info_def_ == NULL) {
return NULL;
} else {
::tensorflow::MetaGraphDef_MetaInfoDef* temp = new ::tensorflow::MetaGraphDef_MetaInfoDef(*meta_info_def_);
meta_info_def_ = NULL;
return temp;
}
}
::tensorflow::MetaGraphDef_MetaInfoDef* MetaGraphDef::unsafe_arena_release_meta_info_def() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.MetaGraphDef.meta_info_def)
::tensorflow::MetaGraphDef_MetaInfoDef* temp = meta_info_def_;
meta_info_def_ = NULL;
return temp;
}
void MetaGraphDef::_slow_set_allocated_meta_info_def(
::google::protobuf::Arena* message_arena, ::tensorflow::MetaGraphDef_MetaInfoDef** meta_info_def) {
if (message_arena != NULL &&
::google::protobuf::Arena::GetArena(*meta_info_def) == NULL) {
message_arena->Own(*meta_info_def);
} else if (message_arena !=
::google::protobuf::Arena::GetArena(*meta_info_def)) {
::tensorflow::MetaGraphDef_MetaInfoDef* new_meta_info_def =
::google::protobuf::Arena::CreateMessage< ::tensorflow::MetaGraphDef_MetaInfoDef >(
message_arena);
new_meta_info_def->CopyFrom(**meta_info_def);
*meta_info_def = new_meta_info_def;
}
}
void MetaGraphDef::unsafe_arena_set_allocated_meta_info_def(
::tensorflow::MetaGraphDef_MetaInfoDef* meta_info_def) {
if (GetArenaNoVirtual() == NULL) {
delete meta_info_def_;
}
meta_info_def_ = meta_info_def;
if (meta_info_def) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.MetaGraphDef.meta_info_def)
}
void MetaGraphDef::_slow_mutable_graph_def() {
graph_def_ = ::google::protobuf::Arena::CreateMessage< ::tensorflow::GraphDef >(
GetArenaNoVirtual());
}
::tensorflow::GraphDef* MetaGraphDef::_slow_release_graph_def() {
if (graph_def_ == NULL) {
return NULL;
} else {
::tensorflow::GraphDef* temp = new ::tensorflow::GraphDef(*graph_def_);
graph_def_ = NULL;
return temp;
}
}
::tensorflow::GraphDef* MetaGraphDef::unsafe_arena_release_graph_def() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.MetaGraphDef.graph_def)
::tensorflow::GraphDef* temp = graph_def_;
graph_def_ = NULL;
return temp;
}
void MetaGraphDef::_slow_set_allocated_graph_def(
::google::protobuf::Arena* message_arena, ::tensorflow::GraphDef** graph_def) {
if (message_arena != NULL &&
::google::protobuf::Arena::GetArena(*graph_def) == NULL) {
message_arena->Own(*graph_def);
} else if (message_arena !=
::google::protobuf::Arena::GetArena(*graph_def)) {
::tensorflow::GraphDef* new_graph_def =
::google::protobuf::Arena::CreateMessage< ::tensorflow::GraphDef >(
message_arena);
new_graph_def->CopyFrom(**graph_def);
*graph_def = new_graph_def;
}
}
void MetaGraphDef::unsafe_arena_set_allocated_graph_def(
::tensorflow::GraphDef* graph_def) {
if (GetArenaNoVirtual() == NULL) {
delete graph_def_;
}
graph_def_ = graph_def;
if (graph_def) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.MetaGraphDef.graph_def)
}
void MetaGraphDef::_slow_mutable_saver_def() {
saver_def_ = ::google::protobuf::Arena::CreateMessage< ::tensorflow::SaverDef >(
GetArenaNoVirtual());
}
::tensorflow::SaverDef* MetaGraphDef::_slow_release_saver_def() {
if (saver_def_ == NULL) {
return NULL;
} else {
::tensorflow::SaverDef* temp = new ::tensorflow::SaverDef(*saver_def_);
saver_def_ = NULL;
return temp;
}
}
::tensorflow::SaverDef* MetaGraphDef::unsafe_arena_release_saver_def() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.MetaGraphDef.saver_def)
::tensorflow::SaverDef* temp = saver_def_;
saver_def_ = NULL;
return temp;
}
void MetaGraphDef::_slow_set_allocated_saver_def(
::google::protobuf::Arena* message_arena, ::tensorflow::SaverDef** saver_def) {
if (message_arena != NULL &&
::google::protobuf::Arena::GetArena(*saver_def) == NULL) {
message_arena->Own(*saver_def);
} else if (message_arena !=
::google::protobuf::Arena::GetArena(*saver_def)) {
::tensorflow::SaverDef* new_saver_def =
::google::protobuf::Arena::CreateMessage< ::tensorflow::SaverDef >(
message_arena);
new_saver_def->CopyFrom(**saver_def);
*saver_def = new_saver_def;
}
}
void MetaGraphDef::unsafe_arena_set_allocated_saver_def(
::tensorflow::SaverDef* saver_def) {
if (GetArenaNoVirtual() == NULL) {
delete saver_def_;
}
saver_def_ = saver_def;
if (saver_def) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.MetaGraphDef.saver_def)
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int MetaGraphDef::kMetaInfoDefFieldNumber;
const int MetaGraphDef::kGraphDefFieldNumber;
const int MetaGraphDef::kSaverDefFieldNumber;
const int MetaGraphDef::kCollectionDefFieldNumber;
const int MetaGraphDef::kSignatureDefFieldNumber;
const int MetaGraphDef::kAssetFileDefFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
MetaGraphDef::MetaGraphDef()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.MetaGraphDef)
}
MetaGraphDef::MetaGraphDef(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena),
collection_def_(arena),
signature_def_(arena),
asset_file_def_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.MetaGraphDef)
}
void MetaGraphDef::InitAsDefaultInstance() {
meta_info_def_ = const_cast< ::tensorflow::MetaGraphDef_MetaInfoDef*>(
::tensorflow::MetaGraphDef_MetaInfoDef::internal_default_instance());
graph_def_ = const_cast< ::tensorflow::GraphDef*>(
::tensorflow::GraphDef::internal_default_instance());
saver_def_ = const_cast< ::tensorflow::SaverDef*>(
::tensorflow::SaverDef::internal_default_instance());
}
MetaGraphDef::MetaGraphDef(const MetaGraphDef& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:tensorflow.MetaGraphDef)
}
void MetaGraphDef::SharedCtor() {
collection_def_.SetAssignDescriptorCallback(
protobuf_AssignDescriptorsOnce);
collection_def_.SetEntryDescriptor(
&::tensorflow::MetaGraphDef_CollectionDefEntry_descriptor_);
signature_def_.SetAssignDescriptorCallback(
protobuf_AssignDescriptorsOnce);
signature_def_.SetEntryDescriptor(
&::tensorflow::MetaGraphDef_SignatureDefEntry_descriptor_);
meta_info_def_ = NULL;
graph_def_ = NULL;
saver_def_ = NULL;
_cached_size_ = 0;
}
MetaGraphDef::~MetaGraphDef() {
// @@protoc_insertion_point(destructor:tensorflow.MetaGraphDef)
SharedDtor();
}
void MetaGraphDef::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
if (this != &MetaGraphDef_default_instance_.get()) {
delete meta_info_def_;
delete graph_def_;
delete saver_def_;
}
}
void MetaGraphDef::ArenaDtor(void* object) {
MetaGraphDef* _this = reinterpret_cast< MetaGraphDef* >(object);
(void)_this;
}
void MetaGraphDef::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void MetaGraphDef::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* MetaGraphDef::descriptor() {
protobuf_AssignDescriptorsOnce();
return MetaGraphDef_descriptor_;
}
const MetaGraphDef& MetaGraphDef::default_instance() {
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<MetaGraphDef> MetaGraphDef_default_instance_;
MetaGraphDef* MetaGraphDef::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<MetaGraphDef>(arena);
}
void MetaGraphDef::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.MetaGraphDef)
if (GetArenaNoVirtual() == NULL && meta_info_def_ != NULL) delete meta_info_def_;
meta_info_def_ = NULL;
if (GetArenaNoVirtual() == NULL && graph_def_ != NULL) delete graph_def_;
graph_def_ = NULL;
if (GetArenaNoVirtual() == NULL && saver_def_ != NULL) delete saver_def_;
saver_def_ = NULL;
collection_def_.Clear();
signature_def_.Clear();
asset_file_def_.Clear();
}
bool MetaGraphDef::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.MetaGraphDef)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .tensorflow.MetaGraphDef.MetaInfoDef meta_info_def = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_meta_info_def()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_graph_def;
break;
}
// optional .tensorflow.GraphDef graph_def = 2;
case 2: {
if (tag == 18) {
parse_graph_def:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_graph_def()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_saver_def;
break;
}
// optional .tensorflow.SaverDef saver_def = 3;
case 3: {
if (tag == 26) {
parse_saver_def:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_saver_def()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_collection_def;
break;
}
// map<string, .tensorflow.CollectionDef> collection_def = 4;
case 4: {
if (tag == 34) {
parse_collection_def:
DO_(input->IncrementRecursionDepth());
parse_loop_collection_def:
MetaGraphDef_CollectionDefEntry::Parser< ::google::protobuf::internal::MapField<
::std::string, ::tensorflow::CollectionDef,
::google::protobuf::internal::WireFormatLite::TYPE_STRING,
::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
0 >,
::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef > > parser(&collection_def_);
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, &parser));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
parser.key().data(), parser.key().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.MetaGraphDef.CollectionDefEntry.key"));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_loop_collection_def;
if (input->ExpectTag(42)) goto parse_loop_signature_def;
input->UnsafeDecrementRecursionDepth();
break;
}
// map<string, .tensorflow.SignatureDef> signature_def = 5;
case 5: {
if (tag == 42) {
DO_(input->IncrementRecursionDepth());
parse_loop_signature_def:
MetaGraphDef_SignatureDefEntry::Parser< ::google::protobuf::internal::MapField<
::std::string, ::tensorflow::SignatureDef,
::google::protobuf::internal::WireFormatLite::TYPE_STRING,
::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
0 >,
::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef > > parser(&signature_def_);
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, &parser));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
parser.key().data(), parser.key().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.MetaGraphDef.SignatureDefEntry.key"));
} else {
goto handle_unusual;
}
if (input->ExpectTag(42)) goto parse_loop_signature_def;
if (input->ExpectTag(50)) goto parse_loop_asset_file_def;
input->UnsafeDecrementRecursionDepth();
break;
}
// repeated .tensorflow.AssetFileDef asset_file_def = 6;
case 6: {
if (tag == 50) {
DO_(input->IncrementRecursionDepth());
parse_loop_asset_file_def:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth(
input, add_asset_file_def()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(50)) goto parse_loop_asset_file_def;
input->UnsafeDecrementRecursionDepth();
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.MetaGraphDef)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.MetaGraphDef)
return false;
#undef DO_
}
void MetaGraphDef::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.MetaGraphDef)
// optional .tensorflow.MetaGraphDef.MetaInfoDef meta_info_def = 1;
if (this->has_meta_info_def()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->meta_info_def_, output);
}
// optional .tensorflow.GraphDef graph_def = 2;
if (this->has_graph_def()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *this->graph_def_, output);
}
// optional .tensorflow.SaverDef saver_def = 3;
if (this->has_saver_def()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, *this->saver_def_, output);
}
// map<string, .tensorflow.CollectionDef> collection_def = 4;
if (!this->collection_def().empty()) {
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >::const_pointer
ConstPtr;
typedef ConstPtr SortItem;
typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
struct Utf8Check {
static void Check(ConstPtr p) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
p->first.data(), p->first.length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.CollectionDefEntry.key");
}
};
if (output->IsSerializationDeterminstic() &&
this->collection_def().size() > 1) {
::google::protobuf::scoped_array<SortItem> items(
new SortItem[this->collection_def().size()]);
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >::size_type size_type;
size_type n = 0;
for (::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >::const_iterator
it = this->collection_def().begin();
it != this->collection_def().end(); ++it, ++n) {
items[n] = SortItem(&*it);
}
::std::sort(&items[0], &items[n], Less());
::google::protobuf::scoped_ptr<MetaGraphDef_CollectionDefEntry> entry;
for (size_type i = 0; i < n; i++) {
entry.reset(collection_def_.NewEntryWrapper(
items[i]->first, items[i]->second));
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, *entry, output);
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(items[i]);
}
} else {
::google::protobuf::scoped_ptr<MetaGraphDef_CollectionDefEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >::const_iterator
it = this->collection_def().begin();
it != this->collection_def().end(); ++it) {
entry.reset(collection_def_.NewEntryWrapper(
it->first, it->second));
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, *entry, output);
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(&*it);
}
}
}
// map<string, .tensorflow.SignatureDef> signature_def = 5;
if (!this->signature_def().empty()) {
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >::const_pointer
ConstPtr;
typedef ConstPtr SortItem;
typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
struct Utf8Check {
static void Check(ConstPtr p) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
p->first.data(), p->first.length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.SignatureDefEntry.key");
}
};
if (output->IsSerializationDeterminstic() &&
this->signature_def().size() > 1) {
::google::protobuf::scoped_array<SortItem> items(
new SortItem[this->signature_def().size()]);
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >::size_type size_type;
size_type n = 0;
for (::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >::const_iterator
it = this->signature_def().begin();
it != this->signature_def().end(); ++it, ++n) {
items[n] = SortItem(&*it);
}
::std::sort(&items[0], &items[n], Less());
::google::protobuf::scoped_ptr<MetaGraphDef_SignatureDefEntry> entry;
for (size_type i = 0; i < n; i++) {
entry.reset(signature_def_.NewEntryWrapper(
items[i]->first, items[i]->second));
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
5, *entry, output);
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(items[i]);
}
} else {
::google::protobuf::scoped_ptr<MetaGraphDef_SignatureDefEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >::const_iterator
it = this->signature_def().begin();
it != this->signature_def().end(); ++it) {
entry.reset(signature_def_.NewEntryWrapper(
it->first, it->second));
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
5, *entry, output);
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(&*it);
}
}
}
// repeated .tensorflow.AssetFileDef asset_file_def = 6;
for (unsigned int i = 0, n = this->asset_file_def_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
6, this->asset_file_def(i), output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.MetaGraphDef)
}
::google::protobuf::uint8* MetaGraphDef::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.MetaGraphDef)
// optional .tensorflow.MetaGraphDef.MetaInfoDef meta_info_def = 1;
if (this->has_meta_info_def()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->meta_info_def_, false, target);
}
// optional .tensorflow.GraphDef graph_def = 2;
if (this->has_graph_def()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *this->graph_def_, false, target);
}
// optional .tensorflow.SaverDef saver_def = 3;
if (this->has_saver_def()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
3, *this->saver_def_, false, target);
}
// map<string, .tensorflow.CollectionDef> collection_def = 4;
if (!this->collection_def().empty()) {
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >::const_pointer
ConstPtr;
typedef ConstPtr SortItem;
typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
struct Utf8Check {
static void Check(ConstPtr p) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
p->first.data(), p->first.length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.CollectionDefEntry.key");
}
};
if (deterministic &&
this->collection_def().size() > 1) {
::google::protobuf::scoped_array<SortItem> items(
new SortItem[this->collection_def().size()]);
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >::size_type size_type;
size_type n = 0;
for (::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >::const_iterator
it = this->collection_def().begin();
it != this->collection_def().end(); ++it, ++n) {
items[n] = SortItem(&*it);
}
::std::sort(&items[0], &items[n], Less());
::google::protobuf::scoped_ptr<MetaGraphDef_CollectionDefEntry> entry;
for (size_type i = 0; i < n; i++) {
entry.reset(collection_def_.NewEntryWrapper(
items[i]->first, items[i]->second));
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
4, *entry, deterministic, target);
;
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(items[i]);
}
} else {
::google::protobuf::scoped_ptr<MetaGraphDef_CollectionDefEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >::const_iterator
it = this->collection_def().begin();
it != this->collection_def().end(); ++it) {
entry.reset(collection_def_.NewEntryWrapper(
it->first, it->second));
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
4, *entry, deterministic, target);
;
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(&*it);
}
}
}
// map<string, .tensorflow.SignatureDef> signature_def = 5;
if (!this->signature_def().empty()) {
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >::const_pointer
ConstPtr;
typedef ConstPtr SortItem;
typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
struct Utf8Check {
static void Check(ConstPtr p) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
p->first.data(), p->first.length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.MetaGraphDef.SignatureDefEntry.key");
}
};
if (deterministic &&
this->signature_def().size() > 1) {
::google::protobuf::scoped_array<SortItem> items(
new SortItem[this->signature_def().size()]);
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >::size_type size_type;
size_type n = 0;
for (::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >::const_iterator
it = this->signature_def().begin();
it != this->signature_def().end(); ++it, ++n) {
items[n] = SortItem(&*it);
}
::std::sort(&items[0], &items[n], Less());
::google::protobuf::scoped_ptr<MetaGraphDef_SignatureDefEntry> entry;
for (size_type i = 0; i < n; i++) {
entry.reset(signature_def_.NewEntryWrapper(
items[i]->first, items[i]->second));
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
5, *entry, deterministic, target);
;
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(items[i]);
}
} else {
::google::protobuf::scoped_ptr<MetaGraphDef_SignatureDefEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >::const_iterator
it = this->signature_def().begin();
it != this->signature_def().end(); ++it) {
entry.reset(signature_def_.NewEntryWrapper(
it->first, it->second));
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
5, *entry, deterministic, target);
;
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(&*it);
}
}
}
// repeated .tensorflow.AssetFileDef asset_file_def = 6;
for (unsigned int i = 0, n = this->asset_file_def_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
6, this->asset_file_def(i), false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.MetaGraphDef)
return target;
}
size_t MetaGraphDef::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.MetaGraphDef)
size_t total_size = 0;
// optional .tensorflow.MetaGraphDef.MetaInfoDef meta_info_def = 1;
if (this->has_meta_info_def()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->meta_info_def_);
}
// optional .tensorflow.GraphDef graph_def = 2;
if (this->has_graph_def()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->graph_def_);
}
// optional .tensorflow.SaverDef saver_def = 3;
if (this->has_saver_def()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->saver_def_);
}
// map<string, .tensorflow.CollectionDef> collection_def = 4;
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->collection_def_size());
{
::google::protobuf::scoped_ptr<MetaGraphDef_CollectionDefEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >::const_iterator
it = this->collection_def().begin();
it != this->collection_def().end(); ++it) {
if (entry.get() != NULL && entry->GetArena() != NULL) {
entry.release();
}
entry.reset(collection_def_.NewEntryWrapper(it->first, it->second));
total_size += ::google::protobuf::internal::WireFormatLite::
MessageSizeNoVirtual(*entry);
}
if (entry.get() != NULL && entry->GetArena() != NULL) {
entry.release();
}
}
// map<string, .tensorflow.SignatureDef> signature_def = 5;
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->signature_def_size());
{
::google::protobuf::scoped_ptr<MetaGraphDef_SignatureDefEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >::const_iterator
it = this->signature_def().begin();
it != this->signature_def().end(); ++it) {
if (entry.get() != NULL && entry->GetArena() != NULL) {
entry.release();
}
entry.reset(signature_def_.NewEntryWrapper(it->first, it->second));
total_size += ::google::protobuf::internal::WireFormatLite::
MessageSizeNoVirtual(*entry);
}
if (entry.get() != NULL && entry->GetArena() != NULL) {
entry.release();
}
}
// repeated .tensorflow.AssetFileDef asset_file_def = 6;
{
unsigned int count = this->asset_file_def_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->asset_file_def(i));
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void MetaGraphDef::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.MetaGraphDef)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const MetaGraphDef* source =
::google::protobuf::internal::DynamicCastToGenerated<const MetaGraphDef>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.MetaGraphDef)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.MetaGraphDef)
UnsafeMergeFrom(*source);
}
}
void MetaGraphDef::MergeFrom(const MetaGraphDef& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.MetaGraphDef)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void MetaGraphDef::UnsafeMergeFrom(const MetaGraphDef& from) {
GOOGLE_DCHECK(&from != this);
collection_def_.MergeFrom(from.collection_def_);
signature_def_.MergeFrom(from.signature_def_);
asset_file_def_.MergeFrom(from.asset_file_def_);
if (from.has_meta_info_def()) {
mutable_meta_info_def()->::tensorflow::MetaGraphDef_MetaInfoDef::MergeFrom(from.meta_info_def());
}
if (from.has_graph_def()) {
mutable_graph_def()->::tensorflow::GraphDef::MergeFrom(from.graph_def());
}
if (from.has_saver_def()) {
mutable_saver_def()->::tensorflow::SaverDef::MergeFrom(from.saver_def());
}
}
void MetaGraphDef::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.MetaGraphDef)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void MetaGraphDef::CopyFrom(const MetaGraphDef& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.MetaGraphDef)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool MetaGraphDef::IsInitialized() const {
return true;
}
void MetaGraphDef::Swap(MetaGraphDef* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
MetaGraphDef temp;
temp.UnsafeMergeFrom(*this);
CopyFrom(*other);
other->CopyFrom(temp);
}
}
void MetaGraphDef::UnsafeArenaSwap(MetaGraphDef* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void MetaGraphDef::InternalSwap(MetaGraphDef* other) {
std::swap(meta_info_def_, other->meta_info_def_);
std::swap(graph_def_, other->graph_def_);
std::swap(saver_def_, other->saver_def_);
collection_def_.Swap(&other->collection_def_);
signature_def_.Swap(&other->signature_def_);
asset_file_def_.UnsafeArenaSwap(&other->asset_file_def_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata MetaGraphDef::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = MetaGraphDef_descriptor_;
metadata.reflection = MetaGraphDef_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// MetaGraphDef_MetaInfoDef
// optional string meta_graph_version = 1;
void MetaGraphDef_MetaInfoDef::clear_meta_graph_version() {
meta_graph_version_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
const ::std::string& MetaGraphDef_MetaInfoDef::meta_graph_version() const {
// @@protoc_insertion_point(field_get:tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version)
return meta_graph_version_.Get(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void MetaGraphDef_MetaInfoDef::set_meta_graph_version(const ::std::string& value) {
meta_graph_version_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
// @@protoc_insertion_point(field_set:tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version)
}
void MetaGraphDef_MetaInfoDef::set_meta_graph_version(const char* value) {
meta_graph_version_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_char:tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version)
}
void MetaGraphDef_MetaInfoDef::set_meta_graph_version(const char* value,
size_t size) {
meta_graph_version_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version)
}
::std::string* MetaGraphDef_MetaInfoDef::mutable_meta_graph_version() {
// @@protoc_insertion_point(field_mutable:tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version)
return meta_graph_version_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* MetaGraphDef_MetaInfoDef::release_meta_graph_version() {
// @@protoc_insertion_point(field_release:tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version)
return meta_graph_version_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* MetaGraphDef_MetaInfoDef::unsafe_arena_release_meta_graph_version() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version)
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
return meta_graph_version_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
}
void MetaGraphDef_MetaInfoDef::set_allocated_meta_graph_version(::std::string* meta_graph_version) {
if (meta_graph_version != NULL) {
} else {
}
meta_graph_version_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), meta_graph_version,
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version)
}
void MetaGraphDef_MetaInfoDef::unsafe_arena_set_allocated_meta_graph_version(
::std::string* meta_graph_version) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
if (meta_graph_version != NULL) {
} else {
}
meta_graph_version_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
meta_graph_version, GetArenaNoVirtual());
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.MetaGraphDef.MetaInfoDef.meta_graph_version)
}
// optional .tensorflow.OpList stripped_op_list = 2;
bool MetaGraphDef_MetaInfoDef::has_stripped_op_list() const {
return this != internal_default_instance() && stripped_op_list_ != NULL;
}
void MetaGraphDef_MetaInfoDef::clear_stripped_op_list() {
if (GetArenaNoVirtual() == NULL && stripped_op_list_ != NULL) delete stripped_op_list_;
stripped_op_list_ = NULL;
}
const ::tensorflow::OpList& MetaGraphDef_MetaInfoDef::stripped_op_list() const {
// @@protoc_insertion_point(field_get:tensorflow.MetaGraphDef.MetaInfoDef.stripped_op_list)
return stripped_op_list_ != NULL ? *stripped_op_list_
: *::tensorflow::OpList::internal_default_instance();
}
::tensorflow::OpList* MetaGraphDef_MetaInfoDef::mutable_stripped_op_list() {
if (stripped_op_list_ == NULL) {
_slow_mutable_stripped_op_list();
}
// @@protoc_insertion_point(field_mutable:tensorflow.MetaGraphDef.MetaInfoDef.stripped_op_list)
return stripped_op_list_;
}
::tensorflow::OpList* MetaGraphDef_MetaInfoDef::release_stripped_op_list() {
// @@protoc_insertion_point(field_release:tensorflow.MetaGraphDef.MetaInfoDef.stripped_op_list)
if (GetArenaNoVirtual() != NULL) {
return _slow_release_stripped_op_list();
} else {
::tensorflow::OpList* temp = stripped_op_list_;
stripped_op_list_ = NULL;
return temp;
}
}
void MetaGraphDef_MetaInfoDef::set_allocated_stripped_op_list(::tensorflow::OpList* stripped_op_list) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == NULL) {
delete stripped_op_list_;
}
if (stripped_op_list != NULL) {
_slow_set_allocated_stripped_op_list(message_arena, &stripped_op_list);
}
stripped_op_list_ = stripped_op_list;
if (stripped_op_list) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.MetaGraphDef.MetaInfoDef.stripped_op_list)
}
// optional .google.protobuf.Any any_info = 3;
bool MetaGraphDef_MetaInfoDef::has_any_info() const {
return this != internal_default_instance() && any_info_ != NULL;
}
void MetaGraphDef_MetaInfoDef::clear_any_info() {
if (GetArenaNoVirtual() == NULL && any_info_ != NULL) delete any_info_;
any_info_ = NULL;
}
const ::google::protobuf::Any& MetaGraphDef_MetaInfoDef::any_info() const {
// @@protoc_insertion_point(field_get:tensorflow.MetaGraphDef.MetaInfoDef.any_info)
return any_info_ != NULL ? *any_info_
: *::google::protobuf::Any::internal_default_instance();
}
::google::protobuf::Any* MetaGraphDef_MetaInfoDef::mutable_any_info() {
if (any_info_ == NULL) {
_slow_mutable_any_info();
}
// @@protoc_insertion_point(field_mutable:tensorflow.MetaGraphDef.MetaInfoDef.any_info)
return any_info_;
}
::google::protobuf::Any* MetaGraphDef_MetaInfoDef::release_any_info() {
// @@protoc_insertion_point(field_release:tensorflow.MetaGraphDef.MetaInfoDef.any_info)
if (GetArenaNoVirtual() != NULL) {
return _slow_release_any_info();
} else {
::google::protobuf::Any* temp = any_info_;
any_info_ = NULL;
return temp;
}
}
void MetaGraphDef_MetaInfoDef::set_allocated_any_info(::google::protobuf::Any* any_info) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == NULL) {
delete any_info_;
}
if (any_info != NULL) {
if (message_arena != NULL) {
message_arena->Own(any_info);
}
}
any_info_ = any_info;
if (any_info) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.MetaGraphDef.MetaInfoDef.any_info)
}
// repeated string tags = 4;
int MetaGraphDef_MetaInfoDef::tags_size() const {
return tags_.size();
}
void MetaGraphDef_MetaInfoDef::clear_tags() {
tags_.Clear();
}
const ::std::string& MetaGraphDef_MetaInfoDef::tags(int index) const {
// @@protoc_insertion_point(field_get:tensorflow.MetaGraphDef.MetaInfoDef.tags)
return tags_.Get(index);
}
::std::string* MetaGraphDef_MetaInfoDef::mutable_tags(int index) {
// @@protoc_insertion_point(field_mutable:tensorflow.MetaGraphDef.MetaInfoDef.tags)
return tags_.Mutable(index);
}
void MetaGraphDef_MetaInfoDef::set_tags(int index, const ::std::string& value) {
// @@protoc_insertion_point(field_set:tensorflow.MetaGraphDef.MetaInfoDef.tags)
tags_.Mutable(index)->assign(value);
}
void MetaGraphDef_MetaInfoDef::set_tags(int index, const char* value) {
tags_.Mutable(index)->assign(value);
// @@protoc_insertion_point(field_set_char:tensorflow.MetaGraphDef.MetaInfoDef.tags)
}
void MetaGraphDef_MetaInfoDef::set_tags(int index, const char* value, size_t size) {
tags_.Mutable(index)->assign(
reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:tensorflow.MetaGraphDef.MetaInfoDef.tags)
}
::std::string* MetaGraphDef_MetaInfoDef::add_tags() {
// @@protoc_insertion_point(field_add_mutable:tensorflow.MetaGraphDef.MetaInfoDef.tags)
return tags_.Add();
}
void MetaGraphDef_MetaInfoDef::add_tags(const ::std::string& value) {
tags_.Add()->assign(value);
// @@protoc_insertion_point(field_add:tensorflow.MetaGraphDef.MetaInfoDef.tags)
}
void MetaGraphDef_MetaInfoDef::add_tags(const char* value) {
tags_.Add()->assign(value);
// @@protoc_insertion_point(field_add_char:tensorflow.MetaGraphDef.MetaInfoDef.tags)
}
void MetaGraphDef_MetaInfoDef::add_tags(const char* value, size_t size) {
tags_.Add()->assign(reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_add_pointer:tensorflow.MetaGraphDef.MetaInfoDef.tags)
}
const ::google::protobuf::RepeatedPtrField< ::std::string>&
MetaGraphDef_MetaInfoDef::tags() const {
// @@protoc_insertion_point(field_list:tensorflow.MetaGraphDef.MetaInfoDef.tags)
return tags_;
}
::google::protobuf::RepeatedPtrField< ::std::string>*
MetaGraphDef_MetaInfoDef::mutable_tags() {
// @@protoc_insertion_point(field_mutable_list:tensorflow.MetaGraphDef.MetaInfoDef.tags)
return &tags_;
}
// optional string tensorflow_version = 5;
void MetaGraphDef_MetaInfoDef::clear_tensorflow_version() {
tensorflow_version_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
const ::std::string& MetaGraphDef_MetaInfoDef::tensorflow_version() const {
// @@protoc_insertion_point(field_get:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version)
return tensorflow_version_.Get(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void MetaGraphDef_MetaInfoDef::set_tensorflow_version(const ::std::string& value) {
tensorflow_version_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
// @@protoc_insertion_point(field_set:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version)
}
void MetaGraphDef_MetaInfoDef::set_tensorflow_version(const char* value) {
tensorflow_version_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_char:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version)
}
void MetaGraphDef_MetaInfoDef::set_tensorflow_version(const char* value,
size_t size) {
tensorflow_version_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version)
}
::std::string* MetaGraphDef_MetaInfoDef::mutable_tensorflow_version() {
// @@protoc_insertion_point(field_mutable:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version)
return tensorflow_version_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* MetaGraphDef_MetaInfoDef::release_tensorflow_version() {
// @@protoc_insertion_point(field_release:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version)
return tensorflow_version_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* MetaGraphDef_MetaInfoDef::unsafe_arena_release_tensorflow_version() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version)
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
return tensorflow_version_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
}
void MetaGraphDef_MetaInfoDef::set_allocated_tensorflow_version(::std::string* tensorflow_version) {
if (tensorflow_version != NULL) {
} else {
}
tensorflow_version_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), tensorflow_version,
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version)
}
void MetaGraphDef_MetaInfoDef::unsafe_arena_set_allocated_tensorflow_version(
::std::string* tensorflow_version) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
if (tensorflow_version != NULL) {
} else {
}
tensorflow_version_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
tensorflow_version, GetArenaNoVirtual());
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_version)
}
// optional string tensorflow_git_version = 6;
void MetaGraphDef_MetaInfoDef::clear_tensorflow_git_version() {
tensorflow_git_version_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
const ::std::string& MetaGraphDef_MetaInfoDef::tensorflow_git_version() const {
// @@protoc_insertion_point(field_get:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version)
return tensorflow_git_version_.Get(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void MetaGraphDef_MetaInfoDef::set_tensorflow_git_version(const ::std::string& value) {
tensorflow_git_version_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
// @@protoc_insertion_point(field_set:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version)
}
void MetaGraphDef_MetaInfoDef::set_tensorflow_git_version(const char* value) {
tensorflow_git_version_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_char:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version)
}
void MetaGraphDef_MetaInfoDef::set_tensorflow_git_version(const char* value,
size_t size) {
tensorflow_git_version_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version)
}
::std::string* MetaGraphDef_MetaInfoDef::mutable_tensorflow_git_version() {
// @@protoc_insertion_point(field_mutable:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version)
return tensorflow_git_version_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* MetaGraphDef_MetaInfoDef::release_tensorflow_git_version() {
// @@protoc_insertion_point(field_release:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version)
return tensorflow_git_version_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* MetaGraphDef_MetaInfoDef::unsafe_arena_release_tensorflow_git_version() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version)
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
return tensorflow_git_version_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
}
void MetaGraphDef_MetaInfoDef::set_allocated_tensorflow_git_version(::std::string* tensorflow_git_version) {
if (tensorflow_git_version != NULL) {
} else {
}
tensorflow_git_version_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), tensorflow_git_version,
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version)
}
void MetaGraphDef_MetaInfoDef::unsafe_arena_set_allocated_tensorflow_git_version(
::std::string* tensorflow_git_version) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
if (tensorflow_git_version != NULL) {
} else {
}
tensorflow_git_version_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
tensorflow_git_version, GetArenaNoVirtual());
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.MetaGraphDef.MetaInfoDef.tensorflow_git_version)
}
inline const MetaGraphDef_MetaInfoDef* MetaGraphDef_MetaInfoDef::internal_default_instance() {
return &MetaGraphDef_MetaInfoDef_default_instance_.get();
}
// -------------------------------------------------------------------
// MetaGraphDef
// optional .tensorflow.MetaGraphDef.MetaInfoDef meta_info_def = 1;
bool MetaGraphDef::has_meta_info_def() const {
return this != internal_default_instance() && meta_info_def_ != NULL;
}
void MetaGraphDef::clear_meta_info_def() {
if (GetArenaNoVirtual() == NULL && meta_info_def_ != NULL) delete meta_info_def_;
meta_info_def_ = NULL;
}
const ::tensorflow::MetaGraphDef_MetaInfoDef& MetaGraphDef::meta_info_def() const {
// @@protoc_insertion_point(field_get:tensorflow.MetaGraphDef.meta_info_def)
return meta_info_def_ != NULL ? *meta_info_def_
: *::tensorflow::MetaGraphDef_MetaInfoDef::internal_default_instance();
}
::tensorflow::MetaGraphDef_MetaInfoDef* MetaGraphDef::mutable_meta_info_def() {
if (meta_info_def_ == NULL) {
_slow_mutable_meta_info_def();
}
// @@protoc_insertion_point(field_mutable:tensorflow.MetaGraphDef.meta_info_def)
return meta_info_def_;
}
::tensorflow::MetaGraphDef_MetaInfoDef* MetaGraphDef::release_meta_info_def() {
// @@protoc_insertion_point(field_release:tensorflow.MetaGraphDef.meta_info_def)
if (GetArenaNoVirtual() != NULL) {
return _slow_release_meta_info_def();
} else {
::tensorflow::MetaGraphDef_MetaInfoDef* temp = meta_info_def_;
meta_info_def_ = NULL;
return temp;
}
}
void MetaGraphDef::set_allocated_meta_info_def(::tensorflow::MetaGraphDef_MetaInfoDef* meta_info_def) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == NULL) {
delete meta_info_def_;
}
if (meta_info_def != NULL) {
_slow_set_allocated_meta_info_def(message_arena, &meta_info_def);
}
meta_info_def_ = meta_info_def;
if (meta_info_def) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.MetaGraphDef.meta_info_def)
}
// optional .tensorflow.GraphDef graph_def = 2;
bool MetaGraphDef::has_graph_def() const {
return this != internal_default_instance() && graph_def_ != NULL;
}
void MetaGraphDef::clear_graph_def() {
if (GetArenaNoVirtual() == NULL && graph_def_ != NULL) delete graph_def_;
graph_def_ = NULL;
}
const ::tensorflow::GraphDef& MetaGraphDef::graph_def() const {
// @@protoc_insertion_point(field_get:tensorflow.MetaGraphDef.graph_def)
return graph_def_ != NULL ? *graph_def_
: *::tensorflow::GraphDef::internal_default_instance();
}
::tensorflow::GraphDef* MetaGraphDef::mutable_graph_def() {
if (graph_def_ == NULL) {
_slow_mutable_graph_def();
}
// @@protoc_insertion_point(field_mutable:tensorflow.MetaGraphDef.graph_def)
return graph_def_;
}
::tensorflow::GraphDef* MetaGraphDef::release_graph_def() {
// @@protoc_insertion_point(field_release:tensorflow.MetaGraphDef.graph_def)
if (GetArenaNoVirtual() != NULL) {
return _slow_release_graph_def();
} else {
::tensorflow::GraphDef* temp = graph_def_;
graph_def_ = NULL;
return temp;
}
}
void MetaGraphDef::set_allocated_graph_def(::tensorflow::GraphDef* graph_def) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == NULL) {
delete graph_def_;
}
if (graph_def != NULL) {
_slow_set_allocated_graph_def(message_arena, &graph_def);
}
graph_def_ = graph_def;
if (graph_def) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.MetaGraphDef.graph_def)
}
// optional .tensorflow.SaverDef saver_def = 3;
bool MetaGraphDef::has_saver_def() const {
return this != internal_default_instance() && saver_def_ != NULL;
}
void MetaGraphDef::clear_saver_def() {
if (GetArenaNoVirtual() == NULL && saver_def_ != NULL) delete saver_def_;
saver_def_ = NULL;
}
const ::tensorflow::SaverDef& MetaGraphDef::saver_def() const {
// @@protoc_insertion_point(field_get:tensorflow.MetaGraphDef.saver_def)
return saver_def_ != NULL ? *saver_def_
: *::tensorflow::SaverDef::internal_default_instance();
}
::tensorflow::SaverDef* MetaGraphDef::mutable_saver_def() {
if (saver_def_ == NULL) {
_slow_mutable_saver_def();
}
// @@protoc_insertion_point(field_mutable:tensorflow.MetaGraphDef.saver_def)
return saver_def_;
}
::tensorflow::SaverDef* MetaGraphDef::release_saver_def() {
// @@protoc_insertion_point(field_release:tensorflow.MetaGraphDef.saver_def)
if (GetArenaNoVirtual() != NULL) {
return _slow_release_saver_def();
} else {
::tensorflow::SaverDef* temp = saver_def_;
saver_def_ = NULL;
return temp;
}
}
void MetaGraphDef::set_allocated_saver_def(::tensorflow::SaverDef* saver_def) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == NULL) {
delete saver_def_;
}
if (saver_def != NULL) {
_slow_set_allocated_saver_def(message_arena, &saver_def);
}
saver_def_ = saver_def;
if (saver_def) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.MetaGraphDef.saver_def)
}
// map<string, .tensorflow.CollectionDef> collection_def = 4;
int MetaGraphDef::collection_def_size() const {
return collection_def_.size();
}
void MetaGraphDef::clear_collection_def() {
collection_def_.Clear();
}
const ::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >&
MetaGraphDef::collection_def() const {
// @@protoc_insertion_point(field_map:tensorflow.MetaGraphDef.collection_def)
return collection_def_.GetMap();
}
::google::protobuf::Map< ::std::string, ::tensorflow::CollectionDef >*
MetaGraphDef::mutable_collection_def() {
// @@protoc_insertion_point(field_mutable_map:tensorflow.MetaGraphDef.collection_def)
return collection_def_.MutableMap();
}
// map<string, .tensorflow.SignatureDef> signature_def = 5;
int MetaGraphDef::signature_def_size() const {
return signature_def_.size();
}
void MetaGraphDef::clear_signature_def() {
signature_def_.Clear();
}
const ::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >&
MetaGraphDef::signature_def() const {
// @@protoc_insertion_point(field_map:tensorflow.MetaGraphDef.signature_def)
return signature_def_.GetMap();
}
::google::protobuf::Map< ::std::string, ::tensorflow::SignatureDef >*
MetaGraphDef::mutable_signature_def() {
// @@protoc_insertion_point(field_mutable_map:tensorflow.MetaGraphDef.signature_def)
return signature_def_.MutableMap();
}
// repeated .tensorflow.AssetFileDef asset_file_def = 6;
int MetaGraphDef::asset_file_def_size() const {
return asset_file_def_.size();
}
void MetaGraphDef::clear_asset_file_def() {
asset_file_def_.Clear();
}
const ::tensorflow::AssetFileDef& MetaGraphDef::asset_file_def(int index) const {
// @@protoc_insertion_point(field_get:tensorflow.MetaGraphDef.asset_file_def)
return asset_file_def_.Get(index);
}
::tensorflow::AssetFileDef* MetaGraphDef::mutable_asset_file_def(int index) {
// @@protoc_insertion_point(field_mutable:tensorflow.MetaGraphDef.asset_file_def)
return asset_file_def_.Mutable(index);
}
::tensorflow::AssetFileDef* MetaGraphDef::add_asset_file_def() {
// @@protoc_insertion_point(field_add:tensorflow.MetaGraphDef.asset_file_def)
return asset_file_def_.Add();
}
::google::protobuf::RepeatedPtrField< ::tensorflow::AssetFileDef >*
MetaGraphDef::mutable_asset_file_def() {
// @@protoc_insertion_point(field_mutable_list:tensorflow.MetaGraphDef.asset_file_def)
return &asset_file_def_;
}
const ::google::protobuf::RepeatedPtrField< ::tensorflow::AssetFileDef >&
MetaGraphDef::asset_file_def() const {
// @@protoc_insertion_point(field_list:tensorflow.MetaGraphDef.asset_file_def)
return asset_file_def_;
}
inline const MetaGraphDef* MetaGraphDef::internal_default_instance() {
return &MetaGraphDef_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int CollectionDef_NodeList::kValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
CollectionDef_NodeList::CollectionDef_NodeList()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.CollectionDef.NodeList)
}
CollectionDef_NodeList::CollectionDef_NodeList(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena),
value_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.CollectionDef.NodeList)
}
void CollectionDef_NodeList::InitAsDefaultInstance() {
}
CollectionDef_NodeList::CollectionDef_NodeList(const CollectionDef_NodeList& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:tensorflow.CollectionDef.NodeList)
}
void CollectionDef_NodeList::SharedCtor() {
_cached_size_ = 0;
}
CollectionDef_NodeList::~CollectionDef_NodeList() {
// @@protoc_insertion_point(destructor:tensorflow.CollectionDef.NodeList)
SharedDtor();
}
void CollectionDef_NodeList::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
}
void CollectionDef_NodeList::ArenaDtor(void* object) {
CollectionDef_NodeList* _this = reinterpret_cast< CollectionDef_NodeList* >(object);
(void)_this;
}
void CollectionDef_NodeList::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void CollectionDef_NodeList::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CollectionDef_NodeList::descriptor() {
protobuf_AssignDescriptorsOnce();
return CollectionDef_NodeList_descriptor_;
}
const CollectionDef_NodeList& CollectionDef_NodeList::default_instance() {
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<CollectionDef_NodeList> CollectionDef_NodeList_default_instance_;
CollectionDef_NodeList* CollectionDef_NodeList::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<CollectionDef_NodeList>(arena);
}
void CollectionDef_NodeList::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.CollectionDef.NodeList)
value_.Clear();
}
bool CollectionDef_NodeList::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.CollectionDef.NodeList)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated string value = 1;
case 1: {
if (tag == 10) {
parse_value:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->add_value()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->value(this->value_size() - 1).data(),
this->value(this->value_size() - 1).length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.CollectionDef.NodeList.value"));
} else {
goto handle_unusual;
}
if (input->ExpectTag(10)) goto parse_value;
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.CollectionDef.NodeList)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.CollectionDef.NodeList)
return false;
#undef DO_
}
void CollectionDef_NodeList::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.CollectionDef.NodeList)
// repeated string value = 1;
for (int i = 0; i < this->value_size(); i++) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->value(i).data(), this->value(i).length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.CollectionDef.NodeList.value");
::google::protobuf::internal::WireFormatLite::WriteString(
1, this->value(i), output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.CollectionDef.NodeList)
}
::google::protobuf::uint8* CollectionDef_NodeList::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.CollectionDef.NodeList)
// repeated string value = 1;
for (int i = 0; i < this->value_size(); i++) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->value(i).data(), this->value(i).length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.CollectionDef.NodeList.value");
target = ::google::protobuf::internal::WireFormatLite::
WriteStringToArray(1, this->value(i), target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.CollectionDef.NodeList)
return target;
}
size_t CollectionDef_NodeList::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.CollectionDef.NodeList)
size_t total_size = 0;
// repeated string value = 1;
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->value_size());
for (int i = 0; i < this->value_size(); i++) {
total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
this->value(i));
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CollectionDef_NodeList::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.CollectionDef.NodeList)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const CollectionDef_NodeList* source =
::google::protobuf::internal::DynamicCastToGenerated<const CollectionDef_NodeList>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.CollectionDef.NodeList)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.CollectionDef.NodeList)
UnsafeMergeFrom(*source);
}
}
void CollectionDef_NodeList::MergeFrom(const CollectionDef_NodeList& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.CollectionDef.NodeList)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void CollectionDef_NodeList::UnsafeMergeFrom(const CollectionDef_NodeList& from) {
GOOGLE_DCHECK(&from != this);
value_.UnsafeMergeFrom(from.value_);
}
void CollectionDef_NodeList::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.CollectionDef.NodeList)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CollectionDef_NodeList::CopyFrom(const CollectionDef_NodeList& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.CollectionDef.NodeList)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool CollectionDef_NodeList::IsInitialized() const {
return true;
}
void CollectionDef_NodeList::Swap(CollectionDef_NodeList* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
CollectionDef_NodeList temp;
temp.UnsafeMergeFrom(*this);
CopyFrom(*other);
other->CopyFrom(temp);
}
}
void CollectionDef_NodeList::UnsafeArenaSwap(CollectionDef_NodeList* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void CollectionDef_NodeList::InternalSwap(CollectionDef_NodeList* other) {
value_.UnsafeArenaSwap(&other->value_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata CollectionDef_NodeList::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CollectionDef_NodeList_descriptor_;
metadata.reflection = CollectionDef_NodeList_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int CollectionDef_BytesList::kValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
CollectionDef_BytesList::CollectionDef_BytesList()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.CollectionDef.BytesList)
}
CollectionDef_BytesList::CollectionDef_BytesList(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena),
value_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.CollectionDef.BytesList)
}
void CollectionDef_BytesList::InitAsDefaultInstance() {
}
CollectionDef_BytesList::CollectionDef_BytesList(const CollectionDef_BytesList& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:tensorflow.CollectionDef.BytesList)
}
void CollectionDef_BytesList::SharedCtor() {
_cached_size_ = 0;
}
CollectionDef_BytesList::~CollectionDef_BytesList() {
// @@protoc_insertion_point(destructor:tensorflow.CollectionDef.BytesList)
SharedDtor();
}
void CollectionDef_BytesList::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
}
void CollectionDef_BytesList::ArenaDtor(void* object) {
CollectionDef_BytesList* _this = reinterpret_cast< CollectionDef_BytesList* >(object);
(void)_this;
}
void CollectionDef_BytesList::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void CollectionDef_BytesList::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CollectionDef_BytesList::descriptor() {
protobuf_AssignDescriptorsOnce();
return CollectionDef_BytesList_descriptor_;
}
const CollectionDef_BytesList& CollectionDef_BytesList::default_instance() {
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<CollectionDef_BytesList> CollectionDef_BytesList_default_instance_;
CollectionDef_BytesList* CollectionDef_BytesList::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<CollectionDef_BytesList>(arena);
}
void CollectionDef_BytesList::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.CollectionDef.BytesList)
value_.Clear();
}
bool CollectionDef_BytesList::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.CollectionDef.BytesList)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated bytes value = 1;
case 1: {
if (tag == 10) {
parse_value:
DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
input, this->add_value()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(10)) goto parse_value;
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.CollectionDef.BytesList)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.CollectionDef.BytesList)
return false;
#undef DO_
}
void CollectionDef_BytesList::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.CollectionDef.BytesList)
// repeated bytes value = 1;
for (int i = 0; i < this->value_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteBytes(
1, this->value(i), output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.CollectionDef.BytesList)
}
::google::protobuf::uint8* CollectionDef_BytesList::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.CollectionDef.BytesList)
// repeated bytes value = 1;
for (int i = 0; i < this->value_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteBytesToArray(1, this->value(i), target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.CollectionDef.BytesList)
return target;
}
size_t CollectionDef_BytesList::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.CollectionDef.BytesList)
size_t total_size = 0;
// repeated bytes value = 1;
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->value_size());
for (int i = 0; i < this->value_size(); i++) {
total_size += ::google::protobuf::internal::WireFormatLite::BytesSize(
this->value(i));
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CollectionDef_BytesList::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.CollectionDef.BytesList)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const CollectionDef_BytesList* source =
::google::protobuf::internal::DynamicCastToGenerated<const CollectionDef_BytesList>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.CollectionDef.BytesList)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.CollectionDef.BytesList)
UnsafeMergeFrom(*source);
}
}
void CollectionDef_BytesList::MergeFrom(const CollectionDef_BytesList& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.CollectionDef.BytesList)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void CollectionDef_BytesList::UnsafeMergeFrom(const CollectionDef_BytesList& from) {
GOOGLE_DCHECK(&from != this);
value_.UnsafeMergeFrom(from.value_);
}
void CollectionDef_BytesList::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.CollectionDef.BytesList)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CollectionDef_BytesList::CopyFrom(const CollectionDef_BytesList& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.CollectionDef.BytesList)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool CollectionDef_BytesList::IsInitialized() const {
return true;
}
void CollectionDef_BytesList::Swap(CollectionDef_BytesList* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
CollectionDef_BytesList temp;
temp.UnsafeMergeFrom(*this);
CopyFrom(*other);
other->CopyFrom(temp);
}
}
void CollectionDef_BytesList::UnsafeArenaSwap(CollectionDef_BytesList* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void CollectionDef_BytesList::InternalSwap(CollectionDef_BytesList* other) {
value_.UnsafeArenaSwap(&other->value_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata CollectionDef_BytesList::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CollectionDef_BytesList_descriptor_;
metadata.reflection = CollectionDef_BytesList_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int CollectionDef_Int64List::kValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
CollectionDef_Int64List::CollectionDef_Int64List()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.CollectionDef.Int64List)
}
CollectionDef_Int64List::CollectionDef_Int64List(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena),
value_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.CollectionDef.Int64List)
}
void CollectionDef_Int64List::InitAsDefaultInstance() {
}
CollectionDef_Int64List::CollectionDef_Int64List(const CollectionDef_Int64List& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:tensorflow.CollectionDef.Int64List)
}
void CollectionDef_Int64List::SharedCtor() {
_cached_size_ = 0;
}
CollectionDef_Int64List::~CollectionDef_Int64List() {
// @@protoc_insertion_point(destructor:tensorflow.CollectionDef.Int64List)
SharedDtor();
}
void CollectionDef_Int64List::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
}
void CollectionDef_Int64List::ArenaDtor(void* object) {
CollectionDef_Int64List* _this = reinterpret_cast< CollectionDef_Int64List* >(object);
(void)_this;
}
void CollectionDef_Int64List::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void CollectionDef_Int64List::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CollectionDef_Int64List::descriptor() {
protobuf_AssignDescriptorsOnce();
return CollectionDef_Int64List_descriptor_;
}
const CollectionDef_Int64List& CollectionDef_Int64List::default_instance() {
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<CollectionDef_Int64List> CollectionDef_Int64List_default_instance_;
CollectionDef_Int64List* CollectionDef_Int64List::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<CollectionDef_Int64List>(arena);
}
void CollectionDef_Int64List::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.CollectionDef.Int64List)
value_.Clear();
}
bool CollectionDef_Int64List::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.CollectionDef.Int64List)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated int64 value = 1 [packed = true];
case 1: {
if (tag == 10) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive<
::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
input, this->mutable_value())));
} else if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<
::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
1, 10, input, this->mutable_value())));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.CollectionDef.Int64List)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.CollectionDef.Int64List)
return false;
#undef DO_
}
void CollectionDef_Int64List::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.CollectionDef.Int64List)
// repeated int64 value = 1 [packed = true];
if (this->value_size() > 0) {
::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
output->WriteVarint32(_value_cached_byte_size_);
}
for (int i = 0; i < this->value_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteInt64NoTag(
this->value(i), output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.CollectionDef.Int64List)
}
::google::protobuf::uint8* CollectionDef_Int64List::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.CollectionDef.Int64List)
// repeated int64 value = 1 [packed = true];
if (this->value_size() > 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
1,
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
_value_cached_byte_size_, target);
}
for (int i = 0; i < this->value_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteInt64NoTagToArray(this->value(i), target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.CollectionDef.Int64List)
return target;
}
size_t CollectionDef_Int64List::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.CollectionDef.Int64List)
size_t total_size = 0;
// repeated int64 value = 1 [packed = true];
{
size_t data_size = 0;
unsigned int count = this->value_size();
for (unsigned int i = 0; i < count; i++) {
data_size += ::google::protobuf::internal::WireFormatLite::
Int64Size(this->value(i));
}
if (data_size > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_value_cached_byte_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
total_size += data_size;
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CollectionDef_Int64List::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.CollectionDef.Int64List)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const CollectionDef_Int64List* source =
::google::protobuf::internal::DynamicCastToGenerated<const CollectionDef_Int64List>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.CollectionDef.Int64List)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.CollectionDef.Int64List)
UnsafeMergeFrom(*source);
}
}
void CollectionDef_Int64List::MergeFrom(const CollectionDef_Int64List& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.CollectionDef.Int64List)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void CollectionDef_Int64List::UnsafeMergeFrom(const CollectionDef_Int64List& from) {
GOOGLE_DCHECK(&from != this);
value_.UnsafeMergeFrom(from.value_);
}
void CollectionDef_Int64List::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.CollectionDef.Int64List)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CollectionDef_Int64List::CopyFrom(const CollectionDef_Int64List& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.CollectionDef.Int64List)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool CollectionDef_Int64List::IsInitialized() const {
return true;
}
void CollectionDef_Int64List::Swap(CollectionDef_Int64List* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
CollectionDef_Int64List temp;
temp.UnsafeMergeFrom(*this);
CopyFrom(*other);
other->CopyFrom(temp);
}
}
void CollectionDef_Int64List::UnsafeArenaSwap(CollectionDef_Int64List* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void CollectionDef_Int64List::InternalSwap(CollectionDef_Int64List* other) {
value_.UnsafeArenaSwap(&other->value_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata CollectionDef_Int64List::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CollectionDef_Int64List_descriptor_;
metadata.reflection = CollectionDef_Int64List_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int CollectionDef_FloatList::kValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
CollectionDef_FloatList::CollectionDef_FloatList()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.CollectionDef.FloatList)
}
CollectionDef_FloatList::CollectionDef_FloatList(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena),
value_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.CollectionDef.FloatList)
}
void CollectionDef_FloatList::InitAsDefaultInstance() {
}
CollectionDef_FloatList::CollectionDef_FloatList(const CollectionDef_FloatList& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:tensorflow.CollectionDef.FloatList)
}
void CollectionDef_FloatList::SharedCtor() {
_cached_size_ = 0;
}
CollectionDef_FloatList::~CollectionDef_FloatList() {
// @@protoc_insertion_point(destructor:tensorflow.CollectionDef.FloatList)
SharedDtor();
}
void CollectionDef_FloatList::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
}
void CollectionDef_FloatList::ArenaDtor(void* object) {
CollectionDef_FloatList* _this = reinterpret_cast< CollectionDef_FloatList* >(object);
(void)_this;
}
void CollectionDef_FloatList::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void CollectionDef_FloatList::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CollectionDef_FloatList::descriptor() {
protobuf_AssignDescriptorsOnce();
return CollectionDef_FloatList_descriptor_;
}
const CollectionDef_FloatList& CollectionDef_FloatList::default_instance() {
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<CollectionDef_FloatList> CollectionDef_FloatList_default_instance_;
CollectionDef_FloatList* CollectionDef_FloatList::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<CollectionDef_FloatList>(arena);
}
void CollectionDef_FloatList::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.CollectionDef.FloatList)
value_.Clear();
}
bool CollectionDef_FloatList::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.CollectionDef.FloatList)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated float value = 1 [packed = true];
case 1: {
if (tag == 10) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive<
float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
input, this->mutable_value())));
} else if (tag == 13) {
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<
float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
1, 10, input, this->mutable_value())));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.CollectionDef.FloatList)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.CollectionDef.FloatList)
return false;
#undef DO_
}
void CollectionDef_FloatList::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.CollectionDef.FloatList)
// repeated float value = 1 [packed = true];
if (this->value_size() > 0) {
::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
output->WriteVarint32(_value_cached_byte_size_);
}
for (int i = 0; i < this->value_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteFloatNoTag(
this->value(i), output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.CollectionDef.FloatList)
}
::google::protobuf::uint8* CollectionDef_FloatList::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.CollectionDef.FloatList)
// repeated float value = 1 [packed = true];
if (this->value_size() > 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
1,
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
_value_cached_byte_size_, target);
}
for (int i = 0; i < this->value_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteFloatNoTagToArray(this->value(i), target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.CollectionDef.FloatList)
return target;
}
size_t CollectionDef_FloatList::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.CollectionDef.FloatList)
size_t total_size = 0;
// repeated float value = 1 [packed = true];
{
size_t data_size = 0;
unsigned int count = this->value_size();
data_size = 4UL * count;
if (data_size > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(data_size);
}
int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_value_cached_byte_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
total_size += data_size;
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CollectionDef_FloatList::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.CollectionDef.FloatList)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const CollectionDef_FloatList* source =
::google::protobuf::internal::DynamicCastToGenerated<const CollectionDef_FloatList>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.CollectionDef.FloatList)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.CollectionDef.FloatList)
UnsafeMergeFrom(*source);
}
}
void CollectionDef_FloatList::MergeFrom(const CollectionDef_FloatList& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.CollectionDef.FloatList)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void CollectionDef_FloatList::UnsafeMergeFrom(const CollectionDef_FloatList& from) {
GOOGLE_DCHECK(&from != this);
value_.UnsafeMergeFrom(from.value_);
}
void CollectionDef_FloatList::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.CollectionDef.FloatList)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CollectionDef_FloatList::CopyFrom(const CollectionDef_FloatList& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.CollectionDef.FloatList)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool CollectionDef_FloatList::IsInitialized() const {
return true;
}
void CollectionDef_FloatList::Swap(CollectionDef_FloatList* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
CollectionDef_FloatList temp;
temp.UnsafeMergeFrom(*this);
CopyFrom(*other);
other->CopyFrom(temp);
}
}
void CollectionDef_FloatList::UnsafeArenaSwap(CollectionDef_FloatList* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void CollectionDef_FloatList::InternalSwap(CollectionDef_FloatList* other) {
value_.UnsafeArenaSwap(&other->value_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata CollectionDef_FloatList::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CollectionDef_FloatList_descriptor_;
metadata.reflection = CollectionDef_FloatList_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int CollectionDef_AnyList::kValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
CollectionDef_AnyList::CollectionDef_AnyList()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.CollectionDef.AnyList)
}
CollectionDef_AnyList::CollectionDef_AnyList(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena),
value_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.CollectionDef.AnyList)
}
void CollectionDef_AnyList::InitAsDefaultInstance() {
}
CollectionDef_AnyList::CollectionDef_AnyList(const CollectionDef_AnyList& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:tensorflow.CollectionDef.AnyList)
}
void CollectionDef_AnyList::SharedCtor() {
_cached_size_ = 0;
}
CollectionDef_AnyList::~CollectionDef_AnyList() {
// @@protoc_insertion_point(destructor:tensorflow.CollectionDef.AnyList)
SharedDtor();
}
void CollectionDef_AnyList::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
}
void CollectionDef_AnyList::ArenaDtor(void* object) {
CollectionDef_AnyList* _this = reinterpret_cast< CollectionDef_AnyList* >(object);
(void)_this;
}
void CollectionDef_AnyList::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void CollectionDef_AnyList::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CollectionDef_AnyList::descriptor() {
protobuf_AssignDescriptorsOnce();
return CollectionDef_AnyList_descriptor_;
}
const CollectionDef_AnyList& CollectionDef_AnyList::default_instance() {
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<CollectionDef_AnyList> CollectionDef_AnyList_default_instance_;
CollectionDef_AnyList* CollectionDef_AnyList::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<CollectionDef_AnyList>(arena);
}
void CollectionDef_AnyList::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.CollectionDef.AnyList)
value_.Clear();
}
bool CollectionDef_AnyList::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.CollectionDef.AnyList)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated .google.protobuf.Any value = 1;
case 1: {
if (tag == 10) {
DO_(input->IncrementRecursionDepth());
parse_loop_value:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth(
input, add_value()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(10)) goto parse_loop_value;
input->UnsafeDecrementRecursionDepth();
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.CollectionDef.AnyList)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.CollectionDef.AnyList)
return false;
#undef DO_
}
void CollectionDef_AnyList::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.CollectionDef.AnyList)
// repeated .google.protobuf.Any value = 1;
for (unsigned int i = 0, n = this->value_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->value(i), output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.CollectionDef.AnyList)
}
::google::protobuf::uint8* CollectionDef_AnyList::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.CollectionDef.AnyList)
// repeated .google.protobuf.Any value = 1;
for (unsigned int i = 0, n = this->value_size(); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, this->value(i), false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.CollectionDef.AnyList)
return target;
}
size_t CollectionDef_AnyList::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.CollectionDef.AnyList)
size_t total_size = 0;
// repeated .google.protobuf.Any value = 1;
{
unsigned int count = this->value_size();
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->value(i));
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CollectionDef_AnyList::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.CollectionDef.AnyList)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const CollectionDef_AnyList* source =
::google::protobuf::internal::DynamicCastToGenerated<const CollectionDef_AnyList>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.CollectionDef.AnyList)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.CollectionDef.AnyList)
UnsafeMergeFrom(*source);
}
}
void CollectionDef_AnyList::MergeFrom(const CollectionDef_AnyList& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.CollectionDef.AnyList)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void CollectionDef_AnyList::UnsafeMergeFrom(const CollectionDef_AnyList& from) {
GOOGLE_DCHECK(&from != this);
value_.MergeFrom(from.value_);
}
void CollectionDef_AnyList::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.CollectionDef.AnyList)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CollectionDef_AnyList::CopyFrom(const CollectionDef_AnyList& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.CollectionDef.AnyList)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool CollectionDef_AnyList::IsInitialized() const {
return true;
}
void CollectionDef_AnyList::Swap(CollectionDef_AnyList* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
CollectionDef_AnyList temp;
temp.UnsafeMergeFrom(*this);
CopyFrom(*other);
other->CopyFrom(temp);
}
}
void CollectionDef_AnyList::UnsafeArenaSwap(CollectionDef_AnyList* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void CollectionDef_AnyList::InternalSwap(CollectionDef_AnyList* other) {
value_.UnsafeArenaSwap(&other->value_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata CollectionDef_AnyList::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CollectionDef_AnyList_descriptor_;
metadata.reflection = CollectionDef_AnyList_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int CollectionDef::kNodeListFieldNumber;
const int CollectionDef::kBytesListFieldNumber;
const int CollectionDef::kInt64ListFieldNumber;
const int CollectionDef::kFloatListFieldNumber;
const int CollectionDef::kAnyListFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
CollectionDef::CollectionDef()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.CollectionDef)
}
CollectionDef::CollectionDef(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.CollectionDef)
}
void CollectionDef::InitAsDefaultInstance() {
CollectionDef_default_oneof_instance_->node_list_ = const_cast< ::tensorflow::CollectionDef_NodeList*>(
::tensorflow::CollectionDef_NodeList::internal_default_instance());
CollectionDef_default_oneof_instance_->bytes_list_ = const_cast< ::tensorflow::CollectionDef_BytesList*>(
::tensorflow::CollectionDef_BytesList::internal_default_instance());
CollectionDef_default_oneof_instance_->int64_list_ = const_cast< ::tensorflow::CollectionDef_Int64List*>(
::tensorflow::CollectionDef_Int64List::internal_default_instance());
CollectionDef_default_oneof_instance_->float_list_ = const_cast< ::tensorflow::CollectionDef_FloatList*>(
::tensorflow::CollectionDef_FloatList::internal_default_instance());
CollectionDef_default_oneof_instance_->any_list_ = const_cast< ::tensorflow::CollectionDef_AnyList*>(
::tensorflow::CollectionDef_AnyList::internal_default_instance());
}
CollectionDef::CollectionDef(const CollectionDef& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:tensorflow.CollectionDef)
}
void CollectionDef::SharedCtor() {
clear_has_kind();
_cached_size_ = 0;
}
CollectionDef::~CollectionDef() {
// @@protoc_insertion_point(destructor:tensorflow.CollectionDef)
SharedDtor();
}
void CollectionDef::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
if (has_kind()) {
clear_kind();
}
}
void CollectionDef::ArenaDtor(void* object) {
CollectionDef* _this = reinterpret_cast< CollectionDef* >(object);
(void)_this;
}
void CollectionDef::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void CollectionDef::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CollectionDef::descriptor() {
protobuf_AssignDescriptorsOnce();
return CollectionDef_descriptor_;
}
const CollectionDef& CollectionDef::default_instance() {
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<CollectionDef> CollectionDef_default_instance_;
CollectionDef* CollectionDef::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<CollectionDef>(arena);
}
void CollectionDef::clear_kind() {
// @@protoc_insertion_point(one_of_clear_start:tensorflow.CollectionDef)
switch (kind_case()) {
case kNodeList: {
if (GetArenaNoVirtual() == NULL) {
delete kind_.node_list_;
}
break;
}
case kBytesList: {
if (GetArenaNoVirtual() == NULL) {
delete kind_.bytes_list_;
}
break;
}
case kInt64List: {
if (GetArenaNoVirtual() == NULL) {
delete kind_.int64_list_;
}
break;
}
case kFloatList: {
if (GetArenaNoVirtual() == NULL) {
delete kind_.float_list_;
}
break;
}
case kAnyList: {
if (GetArenaNoVirtual() == NULL) {
delete kind_.any_list_;
}
break;
}
case KIND_NOT_SET: {
break;
}
}
_oneof_case_[0] = KIND_NOT_SET;
}
void CollectionDef::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.CollectionDef)
clear_kind();
}
bool CollectionDef::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.CollectionDef)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .tensorflow.CollectionDef.NodeList node_list = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_node_list()));
} else {
goto handle_unusual;
}
goto after_any_list;
break;
}
// optional .tensorflow.CollectionDef.BytesList bytes_list = 2;
case 2: {
if (tag == 18) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_bytes_list()));
} else {
goto handle_unusual;
}
goto after_any_list;
break;
}
// optional .tensorflow.CollectionDef.Int64List int64_list = 3;
case 3: {
if (tag == 26) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_int64_list()));
} else {
goto handle_unusual;
}
goto after_any_list;
break;
}
// optional .tensorflow.CollectionDef.FloatList float_list = 4;
case 4: {
if (tag == 34) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_float_list()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(42)) goto parse_any_list;
break;
}
// optional .tensorflow.CollectionDef.AnyList any_list = 5;
case 5: {
if (tag == 42) {
parse_any_list:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_any_list()));
} else {
goto handle_unusual;
}
after_any_list:
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.CollectionDef)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.CollectionDef)
return false;
#undef DO_
}
void CollectionDef::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.CollectionDef)
// optional .tensorflow.CollectionDef.NodeList node_list = 1;
if (has_node_list()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *kind_.node_list_, output);
}
// optional .tensorflow.CollectionDef.BytesList bytes_list = 2;
if (has_bytes_list()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *kind_.bytes_list_, output);
}
// optional .tensorflow.CollectionDef.Int64List int64_list = 3;
if (has_int64_list()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, *kind_.int64_list_, output);
}
// optional .tensorflow.CollectionDef.FloatList float_list = 4;
if (has_float_list()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, *kind_.float_list_, output);
}
// optional .tensorflow.CollectionDef.AnyList any_list = 5;
if (has_any_list()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
5, *kind_.any_list_, output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.CollectionDef)
}
::google::protobuf::uint8* CollectionDef::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.CollectionDef)
// optional .tensorflow.CollectionDef.NodeList node_list = 1;
if (has_node_list()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *kind_.node_list_, false, target);
}
// optional .tensorflow.CollectionDef.BytesList bytes_list = 2;
if (has_bytes_list()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *kind_.bytes_list_, false, target);
}
// optional .tensorflow.CollectionDef.Int64List int64_list = 3;
if (has_int64_list()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
3, *kind_.int64_list_, false, target);
}
// optional .tensorflow.CollectionDef.FloatList float_list = 4;
if (has_float_list()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
4, *kind_.float_list_, false, target);
}
// optional .tensorflow.CollectionDef.AnyList any_list = 5;
if (has_any_list()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
5, *kind_.any_list_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.CollectionDef)
return target;
}
size_t CollectionDef::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.CollectionDef)
size_t total_size = 0;
switch (kind_case()) {
// optional .tensorflow.CollectionDef.NodeList node_list = 1;
case kNodeList: {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*kind_.node_list_);
break;
}
// optional .tensorflow.CollectionDef.BytesList bytes_list = 2;
case kBytesList: {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*kind_.bytes_list_);
break;
}
// optional .tensorflow.CollectionDef.Int64List int64_list = 3;
case kInt64List: {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*kind_.int64_list_);
break;
}
// optional .tensorflow.CollectionDef.FloatList float_list = 4;
case kFloatList: {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*kind_.float_list_);
break;
}
// optional .tensorflow.CollectionDef.AnyList any_list = 5;
case kAnyList: {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*kind_.any_list_);
break;
}
case KIND_NOT_SET: {
break;
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CollectionDef::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.CollectionDef)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const CollectionDef* source =
::google::protobuf::internal::DynamicCastToGenerated<const CollectionDef>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.CollectionDef)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.CollectionDef)
UnsafeMergeFrom(*source);
}
}
void CollectionDef::MergeFrom(const CollectionDef& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.CollectionDef)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void CollectionDef::UnsafeMergeFrom(const CollectionDef& from) {
GOOGLE_DCHECK(&from != this);
switch (from.kind_case()) {
case kNodeList: {
mutable_node_list()->::tensorflow::CollectionDef_NodeList::MergeFrom(from.node_list());
break;
}
case kBytesList: {
mutable_bytes_list()->::tensorflow::CollectionDef_BytesList::MergeFrom(from.bytes_list());
break;
}
case kInt64List: {
mutable_int64_list()->::tensorflow::CollectionDef_Int64List::MergeFrom(from.int64_list());
break;
}
case kFloatList: {
mutable_float_list()->::tensorflow::CollectionDef_FloatList::MergeFrom(from.float_list());
break;
}
case kAnyList: {
mutable_any_list()->::tensorflow::CollectionDef_AnyList::MergeFrom(from.any_list());
break;
}
case KIND_NOT_SET: {
break;
}
}
}
void CollectionDef::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.CollectionDef)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CollectionDef::CopyFrom(const CollectionDef& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.CollectionDef)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool CollectionDef::IsInitialized() const {
return true;
}
void CollectionDef::Swap(CollectionDef* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
CollectionDef temp;
temp.UnsafeMergeFrom(*this);
CopyFrom(*other);
other->CopyFrom(temp);
}
}
void CollectionDef::UnsafeArenaSwap(CollectionDef* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void CollectionDef::InternalSwap(CollectionDef* other) {
std::swap(kind_, other->kind_);
std::swap(_oneof_case_[0], other->_oneof_case_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata CollectionDef::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CollectionDef_descriptor_;
metadata.reflection = CollectionDef_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// CollectionDef_NodeList
// repeated string value = 1;
int CollectionDef_NodeList::value_size() const {
return value_.size();
}
void CollectionDef_NodeList::clear_value() {
value_.Clear();
}
const ::std::string& CollectionDef_NodeList::value(int index) const {
// @@protoc_insertion_point(field_get:tensorflow.CollectionDef.NodeList.value)
return value_.Get(index);
}
::std::string* CollectionDef_NodeList::mutable_value(int index) {
// @@protoc_insertion_point(field_mutable:tensorflow.CollectionDef.NodeList.value)
return value_.Mutable(index);
}
void CollectionDef_NodeList::set_value(int index, const ::std::string& value) {
// @@protoc_insertion_point(field_set:tensorflow.CollectionDef.NodeList.value)
value_.Mutable(index)->assign(value);
}
void CollectionDef_NodeList::set_value(int index, const char* value) {
value_.Mutable(index)->assign(value);
// @@protoc_insertion_point(field_set_char:tensorflow.CollectionDef.NodeList.value)
}
void CollectionDef_NodeList::set_value(int index, const char* value, size_t size) {
value_.Mutable(index)->assign(
reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:tensorflow.CollectionDef.NodeList.value)
}
::std::string* CollectionDef_NodeList::add_value() {
// @@protoc_insertion_point(field_add_mutable:tensorflow.CollectionDef.NodeList.value)
return value_.Add();
}
void CollectionDef_NodeList::add_value(const ::std::string& value) {
value_.Add()->assign(value);
// @@protoc_insertion_point(field_add:tensorflow.CollectionDef.NodeList.value)
}
void CollectionDef_NodeList::add_value(const char* value) {
value_.Add()->assign(value);
// @@protoc_insertion_point(field_add_char:tensorflow.CollectionDef.NodeList.value)
}
void CollectionDef_NodeList::add_value(const char* value, size_t size) {
value_.Add()->assign(reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_add_pointer:tensorflow.CollectionDef.NodeList.value)
}
const ::google::protobuf::RepeatedPtrField< ::std::string>&
CollectionDef_NodeList::value() const {
// @@protoc_insertion_point(field_list:tensorflow.CollectionDef.NodeList.value)
return value_;
}
::google::protobuf::RepeatedPtrField< ::std::string>*
CollectionDef_NodeList::mutable_value() {
// @@protoc_insertion_point(field_mutable_list:tensorflow.CollectionDef.NodeList.value)
return &value_;
}
inline const CollectionDef_NodeList* CollectionDef_NodeList::internal_default_instance() {
return &CollectionDef_NodeList_default_instance_.get();
}
// -------------------------------------------------------------------
// CollectionDef_BytesList
// repeated bytes value = 1;
int CollectionDef_BytesList::value_size() const {
return value_.size();
}
void CollectionDef_BytesList::clear_value() {
value_.Clear();
}
const ::std::string& CollectionDef_BytesList::value(int index) const {
// @@protoc_insertion_point(field_get:tensorflow.CollectionDef.BytesList.value)
return value_.Get(index);
}
::std::string* CollectionDef_BytesList::mutable_value(int index) {
// @@protoc_insertion_point(field_mutable:tensorflow.CollectionDef.BytesList.value)
return value_.Mutable(index);
}
void CollectionDef_BytesList::set_value(int index, const ::std::string& value) {
// @@protoc_insertion_point(field_set:tensorflow.CollectionDef.BytesList.value)
value_.Mutable(index)->assign(value);
}
void CollectionDef_BytesList::set_value(int index, const char* value) {
value_.Mutable(index)->assign(value);
// @@protoc_insertion_point(field_set_char:tensorflow.CollectionDef.BytesList.value)
}
void CollectionDef_BytesList::set_value(int index, const void* value, size_t size) {
value_.Mutable(index)->assign(
reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_set_pointer:tensorflow.CollectionDef.BytesList.value)
}
::std::string* CollectionDef_BytesList::add_value() {
// @@protoc_insertion_point(field_add_mutable:tensorflow.CollectionDef.BytesList.value)
return value_.Add();
}
void CollectionDef_BytesList::add_value(const ::std::string& value) {
value_.Add()->assign(value);
// @@protoc_insertion_point(field_add:tensorflow.CollectionDef.BytesList.value)
}
void CollectionDef_BytesList::add_value(const char* value) {
value_.Add()->assign(value);
// @@protoc_insertion_point(field_add_char:tensorflow.CollectionDef.BytesList.value)
}
void CollectionDef_BytesList::add_value(const void* value, size_t size) {
value_.Add()->assign(reinterpret_cast<const char*>(value), size);
// @@protoc_insertion_point(field_add_pointer:tensorflow.CollectionDef.BytesList.value)
}
const ::google::protobuf::RepeatedPtrField< ::std::string>&
CollectionDef_BytesList::value() const {
// @@protoc_insertion_point(field_list:tensorflow.CollectionDef.BytesList.value)
return value_;
}
::google::protobuf::RepeatedPtrField< ::std::string>*
CollectionDef_BytesList::mutable_value() {
// @@protoc_insertion_point(field_mutable_list:tensorflow.CollectionDef.BytesList.value)
return &value_;
}
inline const CollectionDef_BytesList* CollectionDef_BytesList::internal_default_instance() {
return &CollectionDef_BytesList_default_instance_.get();
}
// -------------------------------------------------------------------
// CollectionDef_Int64List
// repeated int64 value = 1 [packed = true];
int CollectionDef_Int64List::value_size() const {
return value_.size();
}
void CollectionDef_Int64List::clear_value() {
value_.Clear();
}
::google::protobuf::int64 CollectionDef_Int64List::value(int index) const {
// @@protoc_insertion_point(field_get:tensorflow.CollectionDef.Int64List.value)
return value_.Get(index);
}
void CollectionDef_Int64List::set_value(int index, ::google::protobuf::int64 value) {
value_.Set(index, value);
// @@protoc_insertion_point(field_set:tensorflow.CollectionDef.Int64List.value)
}
void CollectionDef_Int64List::add_value(::google::protobuf::int64 value) {
value_.Add(value);
// @@protoc_insertion_point(field_add:tensorflow.CollectionDef.Int64List.value)
}
const ::google::protobuf::RepeatedField< ::google::protobuf::int64 >&
CollectionDef_Int64List::value() const {
// @@protoc_insertion_point(field_list:tensorflow.CollectionDef.Int64List.value)
return value_;
}
::google::protobuf::RepeatedField< ::google::protobuf::int64 >*
CollectionDef_Int64List::mutable_value() {
// @@protoc_insertion_point(field_mutable_list:tensorflow.CollectionDef.Int64List.value)
return &value_;
}
inline const CollectionDef_Int64List* CollectionDef_Int64List::internal_default_instance() {
return &CollectionDef_Int64List_default_instance_.get();
}
// -------------------------------------------------------------------
// CollectionDef_FloatList
// repeated float value = 1 [packed = true];
int CollectionDef_FloatList::value_size() const {
return value_.size();
}
void CollectionDef_FloatList::clear_value() {
value_.Clear();
}
float CollectionDef_FloatList::value(int index) const {
// @@protoc_insertion_point(field_get:tensorflow.CollectionDef.FloatList.value)
return value_.Get(index);
}
void CollectionDef_FloatList::set_value(int index, float value) {
value_.Set(index, value);
// @@protoc_insertion_point(field_set:tensorflow.CollectionDef.FloatList.value)
}
void CollectionDef_FloatList::add_value(float value) {
value_.Add(value);
// @@protoc_insertion_point(field_add:tensorflow.CollectionDef.FloatList.value)
}
const ::google::protobuf::RepeatedField< float >&
CollectionDef_FloatList::value() const {
// @@protoc_insertion_point(field_list:tensorflow.CollectionDef.FloatList.value)
return value_;
}
::google::protobuf::RepeatedField< float >*
CollectionDef_FloatList::mutable_value() {
// @@protoc_insertion_point(field_mutable_list:tensorflow.CollectionDef.FloatList.value)
return &value_;
}
inline const CollectionDef_FloatList* CollectionDef_FloatList::internal_default_instance() {
return &CollectionDef_FloatList_default_instance_.get();
}
// -------------------------------------------------------------------
// CollectionDef_AnyList
// repeated .google.protobuf.Any value = 1;
int CollectionDef_AnyList::value_size() const {
return value_.size();
}
void CollectionDef_AnyList::clear_value() {
value_.Clear();
}
const ::google::protobuf::Any& CollectionDef_AnyList::value(int index) const {
// @@protoc_insertion_point(field_get:tensorflow.CollectionDef.AnyList.value)
return value_.Get(index);
}
::google::protobuf::Any* CollectionDef_AnyList::mutable_value(int index) {
// @@protoc_insertion_point(field_mutable:tensorflow.CollectionDef.AnyList.value)
return value_.Mutable(index);
}
::google::protobuf::Any* CollectionDef_AnyList::add_value() {
// @@protoc_insertion_point(field_add:tensorflow.CollectionDef.AnyList.value)
return value_.Add();
}
::google::protobuf::RepeatedPtrField< ::google::protobuf::Any >*
CollectionDef_AnyList::mutable_value() {
// @@protoc_insertion_point(field_mutable_list:tensorflow.CollectionDef.AnyList.value)
return &value_;
}
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Any >&
CollectionDef_AnyList::value() const {
// @@protoc_insertion_point(field_list:tensorflow.CollectionDef.AnyList.value)
return value_;
}
inline const CollectionDef_AnyList* CollectionDef_AnyList::internal_default_instance() {
return &CollectionDef_AnyList_default_instance_.get();
}
// -------------------------------------------------------------------
// CollectionDef
// optional .tensorflow.CollectionDef.NodeList node_list = 1;
bool CollectionDef::has_node_list() const {
return kind_case() == kNodeList;
}
void CollectionDef::set_has_node_list() {
_oneof_case_[0] = kNodeList;
}
void CollectionDef::clear_node_list() {
if (has_node_list()) {
if (GetArenaNoVirtual() == NULL) {
delete kind_.node_list_;
}
clear_has_kind();
}
}
const ::tensorflow::CollectionDef_NodeList& CollectionDef::node_list() const {
// @@protoc_insertion_point(field_get:tensorflow.CollectionDef.node_list)
return has_node_list()
? *kind_.node_list_
: ::tensorflow::CollectionDef_NodeList::default_instance();
}
::tensorflow::CollectionDef_NodeList* CollectionDef::mutable_node_list() {
if (!has_node_list()) {
clear_kind();
set_has_node_list();
kind_.node_list_ =
::google::protobuf::Arena::CreateMessage< ::tensorflow::CollectionDef_NodeList >(
GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:tensorflow.CollectionDef.node_list)
return kind_.node_list_;
}
::tensorflow::CollectionDef_NodeList* CollectionDef::release_node_list() {
// @@protoc_insertion_point(field_release:tensorflow.CollectionDef.node_list)
if (has_node_list()) {
clear_has_kind();
if (GetArenaNoVirtual() != NULL) {
::tensorflow::CollectionDef_NodeList* temp = new ::tensorflow::CollectionDef_NodeList(*kind_.node_list_);
kind_.node_list_ = NULL;
return temp;
} else {
::tensorflow::CollectionDef_NodeList* temp = kind_.node_list_;
kind_.node_list_ = NULL;
return temp;
}
} else {
return NULL;
}
}
void CollectionDef::set_allocated_node_list(::tensorflow::CollectionDef_NodeList* node_list) {
clear_kind();
if (node_list) {
if (GetArenaNoVirtual() != NULL &&
::google::protobuf::Arena::GetArena(node_list) == NULL) {
GetArenaNoVirtual()->Own(node_list);
} else if (GetArenaNoVirtual() !=
::google::protobuf::Arena::GetArena(node_list)) {
::tensorflow::CollectionDef_NodeList* new_node_list =
::google::protobuf::Arena::CreateMessage< ::tensorflow::CollectionDef_NodeList >(
GetArenaNoVirtual());
new_node_list->CopyFrom(*node_list);
node_list = new_node_list;
}
set_has_node_list();
kind_.node_list_ = node_list;
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.CollectionDef.node_list)
}
::tensorflow::CollectionDef_NodeList* CollectionDef::unsafe_arena_release_node_list() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.CollectionDef.node_list)
if (has_node_list()) {
clear_has_kind();
::tensorflow::CollectionDef_NodeList* temp = kind_.node_list_;
kind_.node_list_ = NULL;
return temp;
} else {
return NULL;
}
}
void CollectionDef::unsafe_arena_set_allocated_node_list(::tensorflow::CollectionDef_NodeList* node_list) {
clear_kind();
if (node_list) {
set_has_node_list();
kind_.node_list_ = node_list;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.CollectionDef.node_list)
}
// optional .tensorflow.CollectionDef.BytesList bytes_list = 2;
bool CollectionDef::has_bytes_list() const {
return kind_case() == kBytesList;
}
void CollectionDef::set_has_bytes_list() {
_oneof_case_[0] = kBytesList;
}
void CollectionDef::clear_bytes_list() {
if (has_bytes_list()) {
if (GetArenaNoVirtual() == NULL) {
delete kind_.bytes_list_;
}
clear_has_kind();
}
}
const ::tensorflow::CollectionDef_BytesList& CollectionDef::bytes_list() const {
// @@protoc_insertion_point(field_get:tensorflow.CollectionDef.bytes_list)
return has_bytes_list()
? *kind_.bytes_list_
: ::tensorflow::CollectionDef_BytesList::default_instance();
}
::tensorflow::CollectionDef_BytesList* CollectionDef::mutable_bytes_list() {
if (!has_bytes_list()) {
clear_kind();
set_has_bytes_list();
kind_.bytes_list_ =
::google::protobuf::Arena::CreateMessage< ::tensorflow::CollectionDef_BytesList >(
GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:tensorflow.CollectionDef.bytes_list)
return kind_.bytes_list_;
}
::tensorflow::CollectionDef_BytesList* CollectionDef::release_bytes_list() {
// @@protoc_insertion_point(field_release:tensorflow.CollectionDef.bytes_list)
if (has_bytes_list()) {
clear_has_kind();
if (GetArenaNoVirtual() != NULL) {
::tensorflow::CollectionDef_BytesList* temp = new ::tensorflow::CollectionDef_BytesList(*kind_.bytes_list_);
kind_.bytes_list_ = NULL;
return temp;
} else {
::tensorflow::CollectionDef_BytesList* temp = kind_.bytes_list_;
kind_.bytes_list_ = NULL;
return temp;
}
} else {
return NULL;
}
}
void CollectionDef::set_allocated_bytes_list(::tensorflow::CollectionDef_BytesList* bytes_list) {
clear_kind();
if (bytes_list) {
if (GetArenaNoVirtual() != NULL &&
::google::protobuf::Arena::GetArena(bytes_list) == NULL) {
GetArenaNoVirtual()->Own(bytes_list);
} else if (GetArenaNoVirtual() !=
::google::protobuf::Arena::GetArena(bytes_list)) {
::tensorflow::CollectionDef_BytesList* new_bytes_list =
::google::protobuf::Arena::CreateMessage< ::tensorflow::CollectionDef_BytesList >(
GetArenaNoVirtual());
new_bytes_list->CopyFrom(*bytes_list);
bytes_list = new_bytes_list;
}
set_has_bytes_list();
kind_.bytes_list_ = bytes_list;
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.CollectionDef.bytes_list)
}
::tensorflow::CollectionDef_BytesList* CollectionDef::unsafe_arena_release_bytes_list() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.CollectionDef.bytes_list)
if (has_bytes_list()) {
clear_has_kind();
::tensorflow::CollectionDef_BytesList* temp = kind_.bytes_list_;
kind_.bytes_list_ = NULL;
return temp;
} else {
return NULL;
}
}
void CollectionDef::unsafe_arena_set_allocated_bytes_list(::tensorflow::CollectionDef_BytesList* bytes_list) {
clear_kind();
if (bytes_list) {
set_has_bytes_list();
kind_.bytes_list_ = bytes_list;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.CollectionDef.bytes_list)
}
// optional .tensorflow.CollectionDef.Int64List int64_list = 3;
bool CollectionDef::has_int64_list() const {
return kind_case() == kInt64List;
}
void CollectionDef::set_has_int64_list() {
_oneof_case_[0] = kInt64List;
}
void CollectionDef::clear_int64_list() {
if (has_int64_list()) {
if (GetArenaNoVirtual() == NULL) {
delete kind_.int64_list_;
}
clear_has_kind();
}
}
const ::tensorflow::CollectionDef_Int64List& CollectionDef::int64_list() const {
// @@protoc_insertion_point(field_get:tensorflow.CollectionDef.int64_list)
return has_int64_list()
? *kind_.int64_list_
: ::tensorflow::CollectionDef_Int64List::default_instance();
}
::tensorflow::CollectionDef_Int64List* CollectionDef::mutable_int64_list() {
if (!has_int64_list()) {
clear_kind();
set_has_int64_list();
kind_.int64_list_ =
::google::protobuf::Arena::CreateMessage< ::tensorflow::CollectionDef_Int64List >(
GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:tensorflow.CollectionDef.int64_list)
return kind_.int64_list_;
}
::tensorflow::CollectionDef_Int64List* CollectionDef::release_int64_list() {
// @@protoc_insertion_point(field_release:tensorflow.CollectionDef.int64_list)
if (has_int64_list()) {
clear_has_kind();
if (GetArenaNoVirtual() != NULL) {
::tensorflow::CollectionDef_Int64List* temp = new ::tensorflow::CollectionDef_Int64List(*kind_.int64_list_);
kind_.int64_list_ = NULL;
return temp;
} else {
::tensorflow::CollectionDef_Int64List* temp = kind_.int64_list_;
kind_.int64_list_ = NULL;
return temp;
}
} else {
return NULL;
}
}
void CollectionDef::set_allocated_int64_list(::tensorflow::CollectionDef_Int64List* int64_list) {
clear_kind();
if (int64_list) {
if (GetArenaNoVirtual() != NULL &&
::google::protobuf::Arena::GetArena(int64_list) == NULL) {
GetArenaNoVirtual()->Own(int64_list);
} else if (GetArenaNoVirtual() !=
::google::protobuf::Arena::GetArena(int64_list)) {
::tensorflow::CollectionDef_Int64List* new_int64_list =
::google::protobuf::Arena::CreateMessage< ::tensorflow::CollectionDef_Int64List >(
GetArenaNoVirtual());
new_int64_list->CopyFrom(*int64_list);
int64_list = new_int64_list;
}
set_has_int64_list();
kind_.int64_list_ = int64_list;
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.CollectionDef.int64_list)
}
::tensorflow::CollectionDef_Int64List* CollectionDef::unsafe_arena_release_int64_list() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.CollectionDef.int64_list)
if (has_int64_list()) {
clear_has_kind();
::tensorflow::CollectionDef_Int64List* temp = kind_.int64_list_;
kind_.int64_list_ = NULL;
return temp;
} else {
return NULL;
}
}
void CollectionDef::unsafe_arena_set_allocated_int64_list(::tensorflow::CollectionDef_Int64List* int64_list) {
clear_kind();
if (int64_list) {
set_has_int64_list();
kind_.int64_list_ = int64_list;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.CollectionDef.int64_list)
}
// optional .tensorflow.CollectionDef.FloatList float_list = 4;
bool CollectionDef::has_float_list() const {
return kind_case() == kFloatList;
}
void CollectionDef::set_has_float_list() {
_oneof_case_[0] = kFloatList;
}
void CollectionDef::clear_float_list() {
if (has_float_list()) {
if (GetArenaNoVirtual() == NULL) {
delete kind_.float_list_;
}
clear_has_kind();
}
}
const ::tensorflow::CollectionDef_FloatList& CollectionDef::float_list() const {
// @@protoc_insertion_point(field_get:tensorflow.CollectionDef.float_list)
return has_float_list()
? *kind_.float_list_
: ::tensorflow::CollectionDef_FloatList::default_instance();
}
::tensorflow::CollectionDef_FloatList* CollectionDef::mutable_float_list() {
if (!has_float_list()) {
clear_kind();
set_has_float_list();
kind_.float_list_ =
::google::protobuf::Arena::CreateMessage< ::tensorflow::CollectionDef_FloatList >(
GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:tensorflow.CollectionDef.float_list)
return kind_.float_list_;
}
::tensorflow::CollectionDef_FloatList* CollectionDef::release_float_list() {
// @@protoc_insertion_point(field_release:tensorflow.CollectionDef.float_list)
if (has_float_list()) {
clear_has_kind();
if (GetArenaNoVirtual() != NULL) {
::tensorflow::CollectionDef_FloatList* temp = new ::tensorflow::CollectionDef_FloatList(*kind_.float_list_);
kind_.float_list_ = NULL;
return temp;
} else {
::tensorflow::CollectionDef_FloatList* temp = kind_.float_list_;
kind_.float_list_ = NULL;
return temp;
}
} else {
return NULL;
}
}
void CollectionDef::set_allocated_float_list(::tensorflow::CollectionDef_FloatList* float_list) {
clear_kind();
if (float_list) {
if (GetArenaNoVirtual() != NULL &&
::google::protobuf::Arena::GetArena(float_list) == NULL) {
GetArenaNoVirtual()->Own(float_list);
} else if (GetArenaNoVirtual() !=
::google::protobuf::Arena::GetArena(float_list)) {
::tensorflow::CollectionDef_FloatList* new_float_list =
::google::protobuf::Arena::CreateMessage< ::tensorflow::CollectionDef_FloatList >(
GetArenaNoVirtual());
new_float_list->CopyFrom(*float_list);
float_list = new_float_list;
}
set_has_float_list();
kind_.float_list_ = float_list;
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.CollectionDef.float_list)
}
::tensorflow::CollectionDef_FloatList* CollectionDef::unsafe_arena_release_float_list() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.CollectionDef.float_list)
if (has_float_list()) {
clear_has_kind();
::tensorflow::CollectionDef_FloatList* temp = kind_.float_list_;
kind_.float_list_ = NULL;
return temp;
} else {
return NULL;
}
}
void CollectionDef::unsafe_arena_set_allocated_float_list(::tensorflow::CollectionDef_FloatList* float_list) {
clear_kind();
if (float_list) {
set_has_float_list();
kind_.float_list_ = float_list;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.CollectionDef.float_list)
}
// optional .tensorflow.CollectionDef.AnyList any_list = 5;
bool CollectionDef::has_any_list() const {
return kind_case() == kAnyList;
}
void CollectionDef::set_has_any_list() {
_oneof_case_[0] = kAnyList;
}
void CollectionDef::clear_any_list() {
if (has_any_list()) {
if (GetArenaNoVirtual() == NULL) {
delete kind_.any_list_;
}
clear_has_kind();
}
}
const ::tensorflow::CollectionDef_AnyList& CollectionDef::any_list() const {
// @@protoc_insertion_point(field_get:tensorflow.CollectionDef.any_list)
return has_any_list()
? *kind_.any_list_
: ::tensorflow::CollectionDef_AnyList::default_instance();
}
::tensorflow::CollectionDef_AnyList* CollectionDef::mutable_any_list() {
if (!has_any_list()) {
clear_kind();
set_has_any_list();
kind_.any_list_ =
::google::protobuf::Arena::CreateMessage< ::tensorflow::CollectionDef_AnyList >(
GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:tensorflow.CollectionDef.any_list)
return kind_.any_list_;
}
::tensorflow::CollectionDef_AnyList* CollectionDef::release_any_list() {
// @@protoc_insertion_point(field_release:tensorflow.CollectionDef.any_list)
if (has_any_list()) {
clear_has_kind();
if (GetArenaNoVirtual() != NULL) {
::tensorflow::CollectionDef_AnyList* temp = new ::tensorflow::CollectionDef_AnyList(*kind_.any_list_);
kind_.any_list_ = NULL;
return temp;
} else {
::tensorflow::CollectionDef_AnyList* temp = kind_.any_list_;
kind_.any_list_ = NULL;
return temp;
}
} else {
return NULL;
}
}
void CollectionDef::set_allocated_any_list(::tensorflow::CollectionDef_AnyList* any_list) {
clear_kind();
if (any_list) {
if (GetArenaNoVirtual() != NULL &&
::google::protobuf::Arena::GetArena(any_list) == NULL) {
GetArenaNoVirtual()->Own(any_list);
} else if (GetArenaNoVirtual() !=
::google::protobuf::Arena::GetArena(any_list)) {
::tensorflow::CollectionDef_AnyList* new_any_list =
::google::protobuf::Arena::CreateMessage< ::tensorflow::CollectionDef_AnyList >(
GetArenaNoVirtual());
new_any_list->CopyFrom(*any_list);
any_list = new_any_list;
}
set_has_any_list();
kind_.any_list_ = any_list;
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.CollectionDef.any_list)
}
::tensorflow::CollectionDef_AnyList* CollectionDef::unsafe_arena_release_any_list() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.CollectionDef.any_list)
if (has_any_list()) {
clear_has_kind();
::tensorflow::CollectionDef_AnyList* temp = kind_.any_list_;
kind_.any_list_ = NULL;
return temp;
} else {
return NULL;
}
}
void CollectionDef::unsafe_arena_set_allocated_any_list(::tensorflow::CollectionDef_AnyList* any_list) {
clear_kind();
if (any_list) {
set_has_any_list();
kind_.any_list_ = any_list;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.CollectionDef.any_list)
}
bool CollectionDef::has_kind() const {
return kind_case() != KIND_NOT_SET;
}
void CollectionDef::clear_has_kind() {
_oneof_case_[0] = KIND_NOT_SET;
}
CollectionDef::KindCase CollectionDef::kind_case() const {
return CollectionDef::KindCase(_oneof_case_[0]);
}
inline const CollectionDef* CollectionDef::internal_default_instance() {
return &CollectionDef_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int TensorInfo_CooSparse::kValuesTensorNameFieldNumber;
const int TensorInfo_CooSparse::kIndicesTensorNameFieldNumber;
const int TensorInfo_CooSparse::kDenseShapeTensorNameFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
TensorInfo_CooSparse::TensorInfo_CooSparse()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.TensorInfo.CooSparse)
}
TensorInfo_CooSparse::TensorInfo_CooSparse(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.TensorInfo.CooSparse)
}
void TensorInfo_CooSparse::InitAsDefaultInstance() {
}
TensorInfo_CooSparse::TensorInfo_CooSparse(const TensorInfo_CooSparse& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:tensorflow.TensorInfo.CooSparse)
}
void TensorInfo_CooSparse::SharedCtor() {
values_tensor_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
indices_tensor_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
dense_shape_tensor_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
_cached_size_ = 0;
}
TensorInfo_CooSparse::~TensorInfo_CooSparse() {
// @@protoc_insertion_point(destructor:tensorflow.TensorInfo.CooSparse)
SharedDtor();
}
void TensorInfo_CooSparse::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
values_tensor_name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
indices_tensor_name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
dense_shape_tensor_name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
}
void TensorInfo_CooSparse::ArenaDtor(void* object) {
TensorInfo_CooSparse* _this = reinterpret_cast< TensorInfo_CooSparse* >(object);
(void)_this;
}
void TensorInfo_CooSparse::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void TensorInfo_CooSparse::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* TensorInfo_CooSparse::descriptor() {
protobuf_AssignDescriptorsOnce();
return TensorInfo_CooSparse_descriptor_;
}
const TensorInfo_CooSparse& TensorInfo_CooSparse::default_instance() {
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<TensorInfo_CooSparse> TensorInfo_CooSparse_default_instance_;
TensorInfo_CooSparse* TensorInfo_CooSparse::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<TensorInfo_CooSparse>(arena);
}
void TensorInfo_CooSparse::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.TensorInfo.CooSparse)
values_tensor_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
indices_tensor_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
dense_shape_tensor_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
bool TensorInfo_CooSparse::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.TensorInfo.CooSparse)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string values_tensor_name = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_values_tensor_name()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->values_tensor_name().data(), this->values_tensor_name().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.TensorInfo.CooSparse.values_tensor_name"));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_indices_tensor_name;
break;
}
// optional string indices_tensor_name = 2;
case 2: {
if (tag == 18) {
parse_indices_tensor_name:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_indices_tensor_name()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->indices_tensor_name().data(), this->indices_tensor_name().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.TensorInfo.CooSparse.indices_tensor_name"));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_dense_shape_tensor_name;
break;
}
// optional string dense_shape_tensor_name = 3;
case 3: {
if (tag == 26) {
parse_dense_shape_tensor_name:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_dense_shape_tensor_name()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->dense_shape_tensor_name().data(), this->dense_shape_tensor_name().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.TensorInfo.CooSparse.dense_shape_tensor_name"));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.TensorInfo.CooSparse)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.TensorInfo.CooSparse)
return false;
#undef DO_
}
void TensorInfo_CooSparse::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.TensorInfo.CooSparse)
// optional string values_tensor_name = 1;
if (this->values_tensor_name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->values_tensor_name().data(), this->values_tensor_name().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.TensorInfo.CooSparse.values_tensor_name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->values_tensor_name(), output);
}
// optional string indices_tensor_name = 2;
if (this->indices_tensor_name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->indices_tensor_name().data(), this->indices_tensor_name().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.TensorInfo.CooSparse.indices_tensor_name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->indices_tensor_name(), output);
}
// optional string dense_shape_tensor_name = 3;
if (this->dense_shape_tensor_name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->dense_shape_tensor_name().data(), this->dense_shape_tensor_name().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.TensorInfo.CooSparse.dense_shape_tensor_name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
3, this->dense_shape_tensor_name(), output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.TensorInfo.CooSparse)
}
::google::protobuf::uint8* TensorInfo_CooSparse::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.TensorInfo.CooSparse)
// optional string values_tensor_name = 1;
if (this->values_tensor_name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->values_tensor_name().data(), this->values_tensor_name().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.TensorInfo.CooSparse.values_tensor_name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->values_tensor_name(), target);
}
// optional string indices_tensor_name = 2;
if (this->indices_tensor_name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->indices_tensor_name().data(), this->indices_tensor_name().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.TensorInfo.CooSparse.indices_tensor_name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->indices_tensor_name(), target);
}
// optional string dense_shape_tensor_name = 3;
if (this->dense_shape_tensor_name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->dense_shape_tensor_name().data(), this->dense_shape_tensor_name().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.TensorInfo.CooSparse.dense_shape_tensor_name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
3, this->dense_shape_tensor_name(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.TensorInfo.CooSparse)
return target;
}
size_t TensorInfo_CooSparse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.TensorInfo.CooSparse)
size_t total_size = 0;
// optional string values_tensor_name = 1;
if (this->values_tensor_name().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->values_tensor_name());
}
// optional string indices_tensor_name = 2;
if (this->indices_tensor_name().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->indices_tensor_name());
}
// optional string dense_shape_tensor_name = 3;
if (this->dense_shape_tensor_name().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->dense_shape_tensor_name());
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void TensorInfo_CooSparse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.TensorInfo.CooSparse)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const TensorInfo_CooSparse* source =
::google::protobuf::internal::DynamicCastToGenerated<const TensorInfo_CooSparse>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.TensorInfo.CooSparse)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.TensorInfo.CooSparse)
UnsafeMergeFrom(*source);
}
}
void TensorInfo_CooSparse::MergeFrom(const TensorInfo_CooSparse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.TensorInfo.CooSparse)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void TensorInfo_CooSparse::UnsafeMergeFrom(const TensorInfo_CooSparse& from) {
GOOGLE_DCHECK(&from != this);
if (from.values_tensor_name().size() > 0) {
set_values_tensor_name(from.values_tensor_name());
}
if (from.indices_tensor_name().size() > 0) {
set_indices_tensor_name(from.indices_tensor_name());
}
if (from.dense_shape_tensor_name().size() > 0) {
set_dense_shape_tensor_name(from.dense_shape_tensor_name());
}
}
void TensorInfo_CooSparse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.TensorInfo.CooSparse)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void TensorInfo_CooSparse::CopyFrom(const TensorInfo_CooSparse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.TensorInfo.CooSparse)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool TensorInfo_CooSparse::IsInitialized() const {
return true;
}
void TensorInfo_CooSparse::Swap(TensorInfo_CooSparse* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
TensorInfo_CooSparse temp;
temp.UnsafeMergeFrom(*this);
CopyFrom(*other);
other->CopyFrom(temp);
}
}
void TensorInfo_CooSparse::UnsafeArenaSwap(TensorInfo_CooSparse* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void TensorInfo_CooSparse::InternalSwap(TensorInfo_CooSparse* other) {
values_tensor_name_.Swap(&other->values_tensor_name_);
indices_tensor_name_.Swap(&other->indices_tensor_name_);
dense_shape_tensor_name_.Swap(&other->dense_shape_tensor_name_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata TensorInfo_CooSparse::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = TensorInfo_CooSparse_descriptor_;
metadata.reflection = TensorInfo_CooSparse_reflection_;
return metadata;
}
// -------------------------------------------------------------------
void TensorInfo::_slow_mutable_tensor_shape() {
tensor_shape_ = ::google::protobuf::Arena::CreateMessage< ::tensorflow::TensorShapeProto >(
GetArenaNoVirtual());
}
::tensorflow::TensorShapeProto* TensorInfo::_slow_release_tensor_shape() {
if (tensor_shape_ == NULL) {
return NULL;
} else {
::tensorflow::TensorShapeProto* temp = new ::tensorflow::TensorShapeProto(*tensor_shape_);
tensor_shape_ = NULL;
return temp;
}
}
::tensorflow::TensorShapeProto* TensorInfo::unsafe_arena_release_tensor_shape() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.TensorInfo.tensor_shape)
::tensorflow::TensorShapeProto* temp = tensor_shape_;
tensor_shape_ = NULL;
return temp;
}
void TensorInfo::_slow_set_allocated_tensor_shape(
::google::protobuf::Arena* message_arena, ::tensorflow::TensorShapeProto** tensor_shape) {
if (message_arena != NULL &&
::google::protobuf::Arena::GetArena(*tensor_shape) == NULL) {
message_arena->Own(*tensor_shape);
} else if (message_arena !=
::google::protobuf::Arena::GetArena(*tensor_shape)) {
::tensorflow::TensorShapeProto* new_tensor_shape =
::google::protobuf::Arena::CreateMessage< ::tensorflow::TensorShapeProto >(
message_arena);
new_tensor_shape->CopyFrom(**tensor_shape);
*tensor_shape = new_tensor_shape;
}
}
void TensorInfo::unsafe_arena_set_allocated_tensor_shape(
::tensorflow::TensorShapeProto* tensor_shape) {
if (GetArenaNoVirtual() == NULL) {
delete tensor_shape_;
}
tensor_shape_ = tensor_shape;
if (tensor_shape) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.TensorInfo.tensor_shape)
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int TensorInfo::kNameFieldNumber;
const int TensorInfo::kCooSparseFieldNumber;
const int TensorInfo::kDtypeFieldNumber;
const int TensorInfo::kTensorShapeFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
TensorInfo::TensorInfo()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.TensorInfo)
}
TensorInfo::TensorInfo(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.TensorInfo)
}
void TensorInfo::InitAsDefaultInstance() {
TensorInfo_default_oneof_instance_->name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
TensorInfo_default_oneof_instance_->coo_sparse_ = const_cast< ::tensorflow::TensorInfo_CooSparse*>(
::tensorflow::TensorInfo_CooSparse::internal_default_instance());
tensor_shape_ = const_cast< ::tensorflow::TensorShapeProto*>(
::tensorflow::TensorShapeProto::internal_default_instance());
}
TensorInfo::TensorInfo(const TensorInfo& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:tensorflow.TensorInfo)
}
void TensorInfo::SharedCtor() {
tensor_shape_ = NULL;
dtype_ = 0;
clear_has_encoding();
_cached_size_ = 0;
}
TensorInfo::~TensorInfo() {
// @@protoc_insertion_point(destructor:tensorflow.TensorInfo)
SharedDtor();
}
void TensorInfo::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
if (has_encoding()) {
clear_encoding();
}
if (this != &TensorInfo_default_instance_.get()) {
delete tensor_shape_;
}
}
void TensorInfo::ArenaDtor(void* object) {
TensorInfo* _this = reinterpret_cast< TensorInfo* >(object);
(void)_this;
}
void TensorInfo::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void TensorInfo::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* TensorInfo::descriptor() {
protobuf_AssignDescriptorsOnce();
return TensorInfo_descriptor_;
}
const TensorInfo& TensorInfo::default_instance() {
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<TensorInfo> TensorInfo_default_instance_;
TensorInfo* TensorInfo::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<TensorInfo>(arena);
}
void TensorInfo::clear_encoding() {
// @@protoc_insertion_point(one_of_clear_start:tensorflow.TensorInfo)
switch (encoding_case()) {
case kName: {
encoding_.name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
break;
}
case kCooSparse: {
if (GetArenaNoVirtual() == NULL) {
delete encoding_.coo_sparse_;
}
break;
}
case ENCODING_NOT_SET: {
break;
}
}
_oneof_case_[0] = ENCODING_NOT_SET;
}
void TensorInfo::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.TensorInfo)
dtype_ = 0;
if (GetArenaNoVirtual() == NULL && tensor_shape_ != NULL) delete tensor_shape_;
tensor_shape_ = NULL;
clear_encoding();
}
bool TensorInfo::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.TensorInfo)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string name = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.TensorInfo.name"));
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_dtype;
break;
}
// optional .tensorflow.DataType dtype = 2;
case 2: {
if (tag == 16) {
parse_dtype:
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
set_dtype(static_cast< ::tensorflow::DataType >(value));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_tensor_shape;
break;
}
// optional .tensorflow.TensorShapeProto tensor_shape = 3;
case 3: {
if (tag == 26) {
parse_tensor_shape:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_tensor_shape()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_coo_sparse;
break;
}
// optional .tensorflow.TensorInfo.CooSparse coo_sparse = 4;
case 4: {
if (tag == 34) {
parse_coo_sparse:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_coo_sparse()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.TensorInfo)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.TensorInfo)
return false;
#undef DO_
}
void TensorInfo::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.TensorInfo)
// optional string name = 1;
if (has_name()) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.TensorInfo.name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->name(), output);
}
// optional .tensorflow.DataType dtype = 2;
if (this->dtype() != 0) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
2, this->dtype(), output);
}
// optional .tensorflow.TensorShapeProto tensor_shape = 3;
if (this->has_tensor_shape()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, *this->tensor_shape_, output);
}
// optional .tensorflow.TensorInfo.CooSparse coo_sparse = 4;
if (has_coo_sparse()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, *encoding_.coo_sparse_, output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.TensorInfo)
}
::google::protobuf::uint8* TensorInfo::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.TensorInfo)
// optional string name = 1;
if (has_name()) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.TensorInfo.name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->name(), target);
}
// optional .tensorflow.DataType dtype = 2;
if (this->dtype() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
2, this->dtype(), target);
}
// optional .tensorflow.TensorShapeProto tensor_shape = 3;
if (this->has_tensor_shape()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
3, *this->tensor_shape_, false, target);
}
// optional .tensorflow.TensorInfo.CooSparse coo_sparse = 4;
if (has_coo_sparse()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
4, *encoding_.coo_sparse_, false, target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.TensorInfo)
return target;
}
size_t TensorInfo::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.TensorInfo)
size_t total_size = 0;
// optional .tensorflow.DataType dtype = 2;
if (this->dtype() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->dtype());
}
// optional .tensorflow.TensorShapeProto tensor_shape = 3;
if (this->has_tensor_shape()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->tensor_shape_);
}
switch (encoding_case()) {
// optional string name = 1;
case kName: {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name());
break;
}
// optional .tensorflow.TensorInfo.CooSparse coo_sparse = 4;
case kCooSparse: {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*encoding_.coo_sparse_);
break;
}
case ENCODING_NOT_SET: {
break;
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void TensorInfo::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.TensorInfo)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const TensorInfo* source =
::google::protobuf::internal::DynamicCastToGenerated<const TensorInfo>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.TensorInfo)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.TensorInfo)
UnsafeMergeFrom(*source);
}
}
void TensorInfo::MergeFrom(const TensorInfo& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.TensorInfo)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void TensorInfo::UnsafeMergeFrom(const TensorInfo& from) {
GOOGLE_DCHECK(&from != this);
switch (from.encoding_case()) {
case kName: {
set_name(from.name());
break;
}
case kCooSparse: {
mutable_coo_sparse()->::tensorflow::TensorInfo_CooSparse::MergeFrom(from.coo_sparse());
break;
}
case ENCODING_NOT_SET: {
break;
}
}
if (from.dtype() != 0) {
set_dtype(from.dtype());
}
if (from.has_tensor_shape()) {
mutable_tensor_shape()->::tensorflow::TensorShapeProto::MergeFrom(from.tensor_shape());
}
}
void TensorInfo::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.TensorInfo)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void TensorInfo::CopyFrom(const TensorInfo& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.TensorInfo)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool TensorInfo::IsInitialized() const {
return true;
}
void TensorInfo::Swap(TensorInfo* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
TensorInfo temp;
temp.UnsafeMergeFrom(*this);
CopyFrom(*other);
other->CopyFrom(temp);
}
}
void TensorInfo::UnsafeArenaSwap(TensorInfo* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void TensorInfo::InternalSwap(TensorInfo* other) {
std::swap(dtype_, other->dtype_);
std::swap(tensor_shape_, other->tensor_shape_);
std::swap(encoding_, other->encoding_);
std::swap(_oneof_case_[0], other->_oneof_case_[0]);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata TensorInfo::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = TensorInfo_descriptor_;
metadata.reflection = TensorInfo_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// TensorInfo_CooSparse
// optional string values_tensor_name = 1;
void TensorInfo_CooSparse::clear_values_tensor_name() {
values_tensor_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
const ::std::string& TensorInfo_CooSparse::values_tensor_name() const {
// @@protoc_insertion_point(field_get:tensorflow.TensorInfo.CooSparse.values_tensor_name)
return values_tensor_name_.Get(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void TensorInfo_CooSparse::set_values_tensor_name(const ::std::string& value) {
values_tensor_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
// @@protoc_insertion_point(field_set:tensorflow.TensorInfo.CooSparse.values_tensor_name)
}
void TensorInfo_CooSparse::set_values_tensor_name(const char* value) {
values_tensor_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_char:tensorflow.TensorInfo.CooSparse.values_tensor_name)
}
void TensorInfo_CooSparse::set_values_tensor_name(const char* value,
size_t size) {
values_tensor_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:tensorflow.TensorInfo.CooSparse.values_tensor_name)
}
::std::string* TensorInfo_CooSparse::mutable_values_tensor_name() {
// @@protoc_insertion_point(field_mutable:tensorflow.TensorInfo.CooSparse.values_tensor_name)
return values_tensor_name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* TensorInfo_CooSparse::release_values_tensor_name() {
// @@protoc_insertion_point(field_release:tensorflow.TensorInfo.CooSparse.values_tensor_name)
return values_tensor_name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* TensorInfo_CooSparse::unsafe_arena_release_values_tensor_name() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.TensorInfo.CooSparse.values_tensor_name)
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
return values_tensor_name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
}
void TensorInfo_CooSparse::set_allocated_values_tensor_name(::std::string* values_tensor_name) {
if (values_tensor_name != NULL) {
} else {
}
values_tensor_name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), values_tensor_name,
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:tensorflow.TensorInfo.CooSparse.values_tensor_name)
}
void TensorInfo_CooSparse::unsafe_arena_set_allocated_values_tensor_name(
::std::string* values_tensor_name) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
if (values_tensor_name != NULL) {
} else {
}
values_tensor_name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
values_tensor_name, GetArenaNoVirtual());
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.TensorInfo.CooSparse.values_tensor_name)
}
// optional string indices_tensor_name = 2;
void TensorInfo_CooSparse::clear_indices_tensor_name() {
indices_tensor_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
const ::std::string& TensorInfo_CooSparse::indices_tensor_name() const {
// @@protoc_insertion_point(field_get:tensorflow.TensorInfo.CooSparse.indices_tensor_name)
return indices_tensor_name_.Get(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void TensorInfo_CooSparse::set_indices_tensor_name(const ::std::string& value) {
indices_tensor_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
// @@protoc_insertion_point(field_set:tensorflow.TensorInfo.CooSparse.indices_tensor_name)
}
void TensorInfo_CooSparse::set_indices_tensor_name(const char* value) {
indices_tensor_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_char:tensorflow.TensorInfo.CooSparse.indices_tensor_name)
}
void TensorInfo_CooSparse::set_indices_tensor_name(const char* value,
size_t size) {
indices_tensor_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:tensorflow.TensorInfo.CooSparse.indices_tensor_name)
}
::std::string* TensorInfo_CooSparse::mutable_indices_tensor_name() {
// @@protoc_insertion_point(field_mutable:tensorflow.TensorInfo.CooSparse.indices_tensor_name)
return indices_tensor_name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* TensorInfo_CooSparse::release_indices_tensor_name() {
// @@protoc_insertion_point(field_release:tensorflow.TensorInfo.CooSparse.indices_tensor_name)
return indices_tensor_name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* TensorInfo_CooSparse::unsafe_arena_release_indices_tensor_name() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.TensorInfo.CooSparse.indices_tensor_name)
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
return indices_tensor_name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
}
void TensorInfo_CooSparse::set_allocated_indices_tensor_name(::std::string* indices_tensor_name) {
if (indices_tensor_name != NULL) {
} else {
}
indices_tensor_name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), indices_tensor_name,
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:tensorflow.TensorInfo.CooSparse.indices_tensor_name)
}
void TensorInfo_CooSparse::unsafe_arena_set_allocated_indices_tensor_name(
::std::string* indices_tensor_name) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
if (indices_tensor_name != NULL) {
} else {
}
indices_tensor_name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
indices_tensor_name, GetArenaNoVirtual());
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.TensorInfo.CooSparse.indices_tensor_name)
}
// optional string dense_shape_tensor_name = 3;
void TensorInfo_CooSparse::clear_dense_shape_tensor_name() {
dense_shape_tensor_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
const ::std::string& TensorInfo_CooSparse::dense_shape_tensor_name() const {
// @@protoc_insertion_point(field_get:tensorflow.TensorInfo.CooSparse.dense_shape_tensor_name)
return dense_shape_tensor_name_.Get(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void TensorInfo_CooSparse::set_dense_shape_tensor_name(const ::std::string& value) {
dense_shape_tensor_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
// @@protoc_insertion_point(field_set:tensorflow.TensorInfo.CooSparse.dense_shape_tensor_name)
}
void TensorInfo_CooSparse::set_dense_shape_tensor_name(const char* value) {
dense_shape_tensor_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_char:tensorflow.TensorInfo.CooSparse.dense_shape_tensor_name)
}
void TensorInfo_CooSparse::set_dense_shape_tensor_name(const char* value,
size_t size) {
dense_shape_tensor_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:tensorflow.TensorInfo.CooSparse.dense_shape_tensor_name)
}
::std::string* TensorInfo_CooSparse::mutable_dense_shape_tensor_name() {
// @@protoc_insertion_point(field_mutable:tensorflow.TensorInfo.CooSparse.dense_shape_tensor_name)
return dense_shape_tensor_name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* TensorInfo_CooSparse::release_dense_shape_tensor_name() {
// @@protoc_insertion_point(field_release:tensorflow.TensorInfo.CooSparse.dense_shape_tensor_name)
return dense_shape_tensor_name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* TensorInfo_CooSparse::unsafe_arena_release_dense_shape_tensor_name() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.TensorInfo.CooSparse.dense_shape_tensor_name)
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
return dense_shape_tensor_name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
}
void TensorInfo_CooSparse::set_allocated_dense_shape_tensor_name(::std::string* dense_shape_tensor_name) {
if (dense_shape_tensor_name != NULL) {
} else {
}
dense_shape_tensor_name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), dense_shape_tensor_name,
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:tensorflow.TensorInfo.CooSparse.dense_shape_tensor_name)
}
void TensorInfo_CooSparse::unsafe_arena_set_allocated_dense_shape_tensor_name(
::std::string* dense_shape_tensor_name) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
if (dense_shape_tensor_name != NULL) {
} else {
}
dense_shape_tensor_name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
dense_shape_tensor_name, GetArenaNoVirtual());
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.TensorInfo.CooSparse.dense_shape_tensor_name)
}
inline const TensorInfo_CooSparse* TensorInfo_CooSparse::internal_default_instance() {
return &TensorInfo_CooSparse_default_instance_.get();
}
// -------------------------------------------------------------------
// TensorInfo
// optional string name = 1;
bool TensorInfo::has_name() const {
return encoding_case() == kName;
}
void TensorInfo::set_has_name() {
_oneof_case_[0] = kName;
}
void TensorInfo::clear_name() {
if (has_name()) {
encoding_.name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
clear_has_encoding();
}
}
const ::std::string& TensorInfo::name() const {
// @@protoc_insertion_point(field_get:tensorflow.TensorInfo.name)
if (has_name()) {
return encoding_.name_.Get(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
return *&::google::protobuf::internal::GetEmptyStringAlreadyInited();
}
void TensorInfo::set_name(const ::std::string& value) {
if (!has_name()) {
clear_encoding();
set_has_name();
encoding_.name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
encoding_.name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value,
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set:tensorflow.TensorInfo.name)
}
void TensorInfo::set_name(const char* value) {
if (!has_name()) {
clear_encoding();
set_has_name();
encoding_.name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
encoding_.name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(value), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_char:tensorflow.TensorInfo.name)
}
void TensorInfo::set_name(const char* value,
size_t size) {
if (!has_name()) {
clear_encoding();
set_has_name();
encoding_.name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
encoding_.name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
reinterpret_cast<const char*>(value), size),
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:tensorflow.TensorInfo.name)
}
::std::string* TensorInfo::mutable_name() {
if (!has_name()) {
clear_encoding();
set_has_name();
encoding_.name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
return encoding_.name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
// @@protoc_insertion_point(field_mutable:tensorflow.TensorInfo.name)
}
::std::string* TensorInfo::release_name() {
// @@protoc_insertion_point(field_release:tensorflow.TensorInfo.name)
if (has_name()) {
clear_has_encoding();
return encoding_.name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
} else {
return NULL;
}
}
::std::string* TensorInfo::unsafe_arena_release_name() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.TensorInfo.name)
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
if (has_name()) {
clear_has_encoding();
return encoding_.name_.UnsafeArenaRelease(
&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
} else {
return NULL;
}
}
void TensorInfo::set_allocated_name(::std::string* name) {
if (!has_name()) {
encoding_.name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
clear_encoding();
if (name != NULL) {
set_has_name();
encoding_.name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name,
GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.TensorInfo.name)
}
void TensorInfo::unsafe_arena_set_allocated_name(::std::string* name) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
if (!has_name()) {
encoding_.name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
clear_encoding();
if (name) {
set_has_name();
encoding_.name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), name, GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.TensorInfo.name)
}
// optional .tensorflow.TensorInfo.CooSparse coo_sparse = 4;
bool TensorInfo::has_coo_sparse() const {
return encoding_case() == kCooSparse;
}
void TensorInfo::set_has_coo_sparse() {
_oneof_case_[0] = kCooSparse;
}
void TensorInfo::clear_coo_sparse() {
if (has_coo_sparse()) {
if (GetArenaNoVirtual() == NULL) {
delete encoding_.coo_sparse_;
}
clear_has_encoding();
}
}
const ::tensorflow::TensorInfo_CooSparse& TensorInfo::coo_sparse() const {
// @@protoc_insertion_point(field_get:tensorflow.TensorInfo.coo_sparse)
return has_coo_sparse()
? *encoding_.coo_sparse_
: ::tensorflow::TensorInfo_CooSparse::default_instance();
}
::tensorflow::TensorInfo_CooSparse* TensorInfo::mutable_coo_sparse() {
if (!has_coo_sparse()) {
clear_encoding();
set_has_coo_sparse();
encoding_.coo_sparse_ =
::google::protobuf::Arena::CreateMessage< ::tensorflow::TensorInfo_CooSparse >(
GetArenaNoVirtual());
}
// @@protoc_insertion_point(field_mutable:tensorflow.TensorInfo.coo_sparse)
return encoding_.coo_sparse_;
}
::tensorflow::TensorInfo_CooSparse* TensorInfo::release_coo_sparse() {
// @@protoc_insertion_point(field_release:tensorflow.TensorInfo.coo_sparse)
if (has_coo_sparse()) {
clear_has_encoding();
if (GetArenaNoVirtual() != NULL) {
::tensorflow::TensorInfo_CooSparse* temp = new ::tensorflow::TensorInfo_CooSparse(*encoding_.coo_sparse_);
encoding_.coo_sparse_ = NULL;
return temp;
} else {
::tensorflow::TensorInfo_CooSparse* temp = encoding_.coo_sparse_;
encoding_.coo_sparse_ = NULL;
return temp;
}
} else {
return NULL;
}
}
void TensorInfo::set_allocated_coo_sparse(::tensorflow::TensorInfo_CooSparse* coo_sparse) {
clear_encoding();
if (coo_sparse) {
if (GetArenaNoVirtual() != NULL &&
::google::protobuf::Arena::GetArena(coo_sparse) == NULL) {
GetArenaNoVirtual()->Own(coo_sparse);
} else if (GetArenaNoVirtual() !=
::google::protobuf::Arena::GetArena(coo_sparse)) {
::tensorflow::TensorInfo_CooSparse* new_coo_sparse =
::google::protobuf::Arena::CreateMessage< ::tensorflow::TensorInfo_CooSparse >(
GetArenaNoVirtual());
new_coo_sparse->CopyFrom(*coo_sparse);
coo_sparse = new_coo_sparse;
}
set_has_coo_sparse();
encoding_.coo_sparse_ = coo_sparse;
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.TensorInfo.coo_sparse)
}
::tensorflow::TensorInfo_CooSparse* TensorInfo::unsafe_arena_release_coo_sparse() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.TensorInfo.coo_sparse)
if (has_coo_sparse()) {
clear_has_encoding();
::tensorflow::TensorInfo_CooSparse* temp = encoding_.coo_sparse_;
encoding_.coo_sparse_ = NULL;
return temp;
} else {
return NULL;
}
}
void TensorInfo::unsafe_arena_set_allocated_coo_sparse(::tensorflow::TensorInfo_CooSparse* coo_sparse) {
clear_encoding();
if (coo_sparse) {
set_has_coo_sparse();
encoding_.coo_sparse_ = coo_sparse;
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.TensorInfo.coo_sparse)
}
// optional .tensorflow.DataType dtype = 2;
void TensorInfo::clear_dtype() {
dtype_ = 0;
}
::tensorflow::DataType TensorInfo::dtype() const {
// @@protoc_insertion_point(field_get:tensorflow.TensorInfo.dtype)
return static_cast< ::tensorflow::DataType >(dtype_);
}
void TensorInfo::set_dtype(::tensorflow::DataType value) {
dtype_ = value;
// @@protoc_insertion_point(field_set:tensorflow.TensorInfo.dtype)
}
// optional .tensorflow.TensorShapeProto tensor_shape = 3;
bool TensorInfo::has_tensor_shape() const {
return this != internal_default_instance() && tensor_shape_ != NULL;
}
void TensorInfo::clear_tensor_shape() {
if (GetArenaNoVirtual() == NULL && tensor_shape_ != NULL) delete tensor_shape_;
tensor_shape_ = NULL;
}
const ::tensorflow::TensorShapeProto& TensorInfo::tensor_shape() const {
// @@protoc_insertion_point(field_get:tensorflow.TensorInfo.tensor_shape)
return tensor_shape_ != NULL ? *tensor_shape_
: *::tensorflow::TensorShapeProto::internal_default_instance();
}
::tensorflow::TensorShapeProto* TensorInfo::mutable_tensor_shape() {
if (tensor_shape_ == NULL) {
_slow_mutable_tensor_shape();
}
// @@protoc_insertion_point(field_mutable:tensorflow.TensorInfo.tensor_shape)
return tensor_shape_;
}
::tensorflow::TensorShapeProto* TensorInfo::release_tensor_shape() {
// @@protoc_insertion_point(field_release:tensorflow.TensorInfo.tensor_shape)
if (GetArenaNoVirtual() != NULL) {
return _slow_release_tensor_shape();
} else {
::tensorflow::TensorShapeProto* temp = tensor_shape_;
tensor_shape_ = NULL;
return temp;
}
}
void TensorInfo::set_allocated_tensor_shape(::tensorflow::TensorShapeProto* tensor_shape) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == NULL) {
delete tensor_shape_;
}
if (tensor_shape != NULL) {
_slow_set_allocated_tensor_shape(message_arena, &tensor_shape);
}
tensor_shape_ = tensor_shape;
if (tensor_shape) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.TensorInfo.tensor_shape)
}
bool TensorInfo::has_encoding() const {
return encoding_case() != ENCODING_NOT_SET;
}
void TensorInfo::clear_has_encoding() {
_oneof_case_[0] = ENCODING_NOT_SET;
}
TensorInfo::EncodingCase TensorInfo::encoding_case() const {
return TensorInfo::EncodingCase(_oneof_case_[0]);
}
inline const TensorInfo* TensorInfo::internal_default_instance() {
return &TensorInfo_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int SignatureDef::kInputsFieldNumber;
const int SignatureDef::kOutputsFieldNumber;
const int SignatureDef::kMethodNameFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
SignatureDef::SignatureDef()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.SignatureDef)
}
SignatureDef::SignatureDef(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena),
inputs_(arena),
outputs_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.SignatureDef)
}
void SignatureDef::InitAsDefaultInstance() {
}
SignatureDef::SignatureDef(const SignatureDef& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:tensorflow.SignatureDef)
}
void SignatureDef::SharedCtor() {
inputs_.SetAssignDescriptorCallback(
protobuf_AssignDescriptorsOnce);
inputs_.SetEntryDescriptor(
&::tensorflow::SignatureDef_InputsEntry_descriptor_);
outputs_.SetAssignDescriptorCallback(
protobuf_AssignDescriptorsOnce);
outputs_.SetEntryDescriptor(
&::tensorflow::SignatureDef_OutputsEntry_descriptor_);
method_name_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
_cached_size_ = 0;
}
SignatureDef::~SignatureDef() {
// @@protoc_insertion_point(destructor:tensorflow.SignatureDef)
SharedDtor();
}
void SignatureDef::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
method_name_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
}
void SignatureDef::ArenaDtor(void* object) {
SignatureDef* _this = reinterpret_cast< SignatureDef* >(object);
(void)_this;
}
void SignatureDef::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void SignatureDef::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* SignatureDef::descriptor() {
protobuf_AssignDescriptorsOnce();
return SignatureDef_descriptor_;
}
const SignatureDef& SignatureDef::default_instance() {
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<SignatureDef> SignatureDef_default_instance_;
SignatureDef* SignatureDef::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<SignatureDef>(arena);
}
void SignatureDef::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.SignatureDef)
method_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
inputs_.Clear();
outputs_.Clear();
}
bool SignatureDef::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.SignatureDef)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// map<string, .tensorflow.TensorInfo> inputs = 1;
case 1: {
if (tag == 10) {
DO_(input->IncrementRecursionDepth());
parse_loop_inputs:
SignatureDef_InputsEntry::Parser< ::google::protobuf::internal::MapField<
::std::string, ::tensorflow::TensorInfo,
::google::protobuf::internal::WireFormatLite::TYPE_STRING,
::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
0 >,
::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo > > parser(&inputs_);
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, &parser));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
parser.key().data(), parser.key().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.SignatureDef.InputsEntry.key"));
} else {
goto handle_unusual;
}
if (input->ExpectTag(10)) goto parse_loop_inputs;
if (input->ExpectTag(18)) goto parse_loop_outputs;
input->UnsafeDecrementRecursionDepth();
break;
}
// map<string, .tensorflow.TensorInfo> outputs = 2;
case 2: {
if (tag == 18) {
DO_(input->IncrementRecursionDepth());
parse_loop_outputs:
SignatureDef_OutputsEntry::Parser< ::google::protobuf::internal::MapField<
::std::string, ::tensorflow::TensorInfo,
::google::protobuf::internal::WireFormatLite::TYPE_STRING,
::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
0 >,
::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo > > parser(&outputs_);
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, &parser));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
parser.key().data(), parser.key().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.SignatureDef.OutputsEntry.key"));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_loop_outputs;
input->UnsafeDecrementRecursionDepth();
if (input->ExpectTag(26)) goto parse_method_name;
break;
}
// optional string method_name = 3;
case 3: {
if (tag == 26) {
parse_method_name:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_method_name()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->method_name().data(), this->method_name().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.SignatureDef.method_name"));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.SignatureDef)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.SignatureDef)
return false;
#undef DO_
}
void SignatureDef::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.SignatureDef)
// map<string, .tensorflow.TensorInfo> inputs = 1;
if (!this->inputs().empty()) {
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_pointer
ConstPtr;
typedef ConstPtr SortItem;
typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
struct Utf8Check {
static void Check(ConstPtr p) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
p->first.data(), p->first.length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.SignatureDef.InputsEntry.key");
}
};
if (output->IsSerializationDeterminstic() &&
this->inputs().size() > 1) {
::google::protobuf::scoped_array<SortItem> items(
new SortItem[this->inputs().size()]);
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::size_type size_type;
size_type n = 0;
for (::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_iterator
it = this->inputs().begin();
it != this->inputs().end(); ++it, ++n) {
items[n] = SortItem(&*it);
}
::std::sort(&items[0], &items[n], Less());
::google::protobuf::scoped_ptr<SignatureDef_InputsEntry> entry;
for (size_type i = 0; i < n; i++) {
entry.reset(inputs_.NewEntryWrapper(
items[i]->first, items[i]->second));
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *entry, output);
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(items[i]);
}
} else {
::google::protobuf::scoped_ptr<SignatureDef_InputsEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_iterator
it = this->inputs().begin();
it != this->inputs().end(); ++it) {
entry.reset(inputs_.NewEntryWrapper(
it->first, it->second));
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *entry, output);
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(&*it);
}
}
}
// map<string, .tensorflow.TensorInfo> outputs = 2;
if (!this->outputs().empty()) {
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_pointer
ConstPtr;
typedef ConstPtr SortItem;
typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
struct Utf8Check {
static void Check(ConstPtr p) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
p->first.data(), p->first.length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.SignatureDef.OutputsEntry.key");
}
};
if (output->IsSerializationDeterminstic() &&
this->outputs().size() > 1) {
::google::protobuf::scoped_array<SortItem> items(
new SortItem[this->outputs().size()]);
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::size_type size_type;
size_type n = 0;
for (::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_iterator
it = this->outputs().begin();
it != this->outputs().end(); ++it, ++n) {
items[n] = SortItem(&*it);
}
::std::sort(&items[0], &items[n], Less());
::google::protobuf::scoped_ptr<SignatureDef_OutputsEntry> entry;
for (size_type i = 0; i < n; i++) {
entry.reset(outputs_.NewEntryWrapper(
items[i]->first, items[i]->second));
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *entry, output);
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(items[i]);
}
} else {
::google::protobuf::scoped_ptr<SignatureDef_OutputsEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_iterator
it = this->outputs().begin();
it != this->outputs().end(); ++it) {
entry.reset(outputs_.NewEntryWrapper(
it->first, it->second));
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *entry, output);
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(&*it);
}
}
}
// optional string method_name = 3;
if (this->method_name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->method_name().data(), this->method_name().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.SignatureDef.method_name");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
3, this->method_name(), output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.SignatureDef)
}
::google::protobuf::uint8* SignatureDef::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.SignatureDef)
// map<string, .tensorflow.TensorInfo> inputs = 1;
if (!this->inputs().empty()) {
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_pointer
ConstPtr;
typedef ConstPtr SortItem;
typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
struct Utf8Check {
static void Check(ConstPtr p) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
p->first.data(), p->first.length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.SignatureDef.InputsEntry.key");
}
};
if (deterministic &&
this->inputs().size() > 1) {
::google::protobuf::scoped_array<SortItem> items(
new SortItem[this->inputs().size()]);
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::size_type size_type;
size_type n = 0;
for (::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_iterator
it = this->inputs().begin();
it != this->inputs().end(); ++it, ++n) {
items[n] = SortItem(&*it);
}
::std::sort(&items[0], &items[n], Less());
::google::protobuf::scoped_ptr<SignatureDef_InputsEntry> entry;
for (size_type i = 0; i < n; i++) {
entry.reset(inputs_.NewEntryWrapper(
items[i]->first, items[i]->second));
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *entry, deterministic, target);
;
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(items[i]);
}
} else {
::google::protobuf::scoped_ptr<SignatureDef_InputsEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_iterator
it = this->inputs().begin();
it != this->inputs().end(); ++it) {
entry.reset(inputs_.NewEntryWrapper(
it->first, it->second));
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *entry, deterministic, target);
;
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(&*it);
}
}
}
// map<string, .tensorflow.TensorInfo> outputs = 2;
if (!this->outputs().empty()) {
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_pointer
ConstPtr;
typedef ConstPtr SortItem;
typedef ::google::protobuf::internal::CompareByDerefFirst<SortItem> Less;
struct Utf8Check {
static void Check(ConstPtr p) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
p->first.data(), p->first.length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.SignatureDef.OutputsEntry.key");
}
};
if (deterministic &&
this->outputs().size() > 1) {
::google::protobuf::scoped_array<SortItem> items(
new SortItem[this->outputs().size()]);
typedef ::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::size_type size_type;
size_type n = 0;
for (::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_iterator
it = this->outputs().begin();
it != this->outputs().end(); ++it, ++n) {
items[n] = SortItem(&*it);
}
::std::sort(&items[0], &items[n], Less());
::google::protobuf::scoped_ptr<SignatureDef_OutputsEntry> entry;
for (size_type i = 0; i < n; i++) {
entry.reset(outputs_.NewEntryWrapper(
items[i]->first, items[i]->second));
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *entry, deterministic, target);
;
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(items[i]);
}
} else {
::google::protobuf::scoped_ptr<SignatureDef_OutputsEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_iterator
it = this->outputs().begin();
it != this->outputs().end(); ++it) {
entry.reset(outputs_.NewEntryWrapper(
it->first, it->second));
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
2, *entry, deterministic, target);
;
if (entry->GetArena() != NULL) {
entry.release();
}
Utf8Check::Check(&*it);
}
}
}
// optional string method_name = 3;
if (this->method_name().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->method_name().data(), this->method_name().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.SignatureDef.method_name");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
3, this->method_name(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.SignatureDef)
return target;
}
size_t SignatureDef::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.SignatureDef)
size_t total_size = 0;
// optional string method_name = 3;
if (this->method_name().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->method_name());
}
// map<string, .tensorflow.TensorInfo> inputs = 1;
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->inputs_size());
{
::google::protobuf::scoped_ptr<SignatureDef_InputsEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_iterator
it = this->inputs().begin();
it != this->inputs().end(); ++it) {
if (entry.get() != NULL && entry->GetArena() != NULL) {
entry.release();
}
entry.reset(inputs_.NewEntryWrapper(it->first, it->second));
total_size += ::google::protobuf::internal::WireFormatLite::
MessageSizeNoVirtual(*entry);
}
if (entry.get() != NULL && entry->GetArena() != NULL) {
entry.release();
}
}
// map<string, .tensorflow.TensorInfo> outputs = 2;
total_size += 1 *
::google::protobuf::internal::FromIntSize(this->outputs_size());
{
::google::protobuf::scoped_ptr<SignatureDef_OutputsEntry> entry;
for (::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >::const_iterator
it = this->outputs().begin();
it != this->outputs().end(); ++it) {
if (entry.get() != NULL && entry->GetArena() != NULL) {
entry.release();
}
entry.reset(outputs_.NewEntryWrapper(it->first, it->second));
total_size += ::google::protobuf::internal::WireFormatLite::
MessageSizeNoVirtual(*entry);
}
if (entry.get() != NULL && entry->GetArena() != NULL) {
entry.release();
}
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void SignatureDef::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.SignatureDef)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const SignatureDef* source =
::google::protobuf::internal::DynamicCastToGenerated<const SignatureDef>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.SignatureDef)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.SignatureDef)
UnsafeMergeFrom(*source);
}
}
void SignatureDef::MergeFrom(const SignatureDef& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.SignatureDef)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void SignatureDef::UnsafeMergeFrom(const SignatureDef& from) {
GOOGLE_DCHECK(&from != this);
inputs_.MergeFrom(from.inputs_);
outputs_.MergeFrom(from.outputs_);
if (from.method_name().size() > 0) {
set_method_name(from.method_name());
}
}
void SignatureDef::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.SignatureDef)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void SignatureDef::CopyFrom(const SignatureDef& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.SignatureDef)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool SignatureDef::IsInitialized() const {
return true;
}
void SignatureDef::Swap(SignatureDef* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
SignatureDef temp;
temp.UnsafeMergeFrom(*this);
CopyFrom(*other);
other->CopyFrom(temp);
}
}
void SignatureDef::UnsafeArenaSwap(SignatureDef* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void SignatureDef::InternalSwap(SignatureDef* other) {
inputs_.Swap(&other->inputs_);
outputs_.Swap(&other->outputs_);
method_name_.Swap(&other->method_name_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata SignatureDef::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = SignatureDef_descriptor_;
metadata.reflection = SignatureDef_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// SignatureDef
// map<string, .tensorflow.TensorInfo> inputs = 1;
int SignatureDef::inputs_size() const {
return inputs_.size();
}
void SignatureDef::clear_inputs() {
inputs_.Clear();
}
const ::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >&
SignatureDef::inputs() const {
// @@protoc_insertion_point(field_map:tensorflow.SignatureDef.inputs)
return inputs_.GetMap();
}
::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >*
SignatureDef::mutable_inputs() {
// @@protoc_insertion_point(field_mutable_map:tensorflow.SignatureDef.inputs)
return inputs_.MutableMap();
}
// map<string, .tensorflow.TensorInfo> outputs = 2;
int SignatureDef::outputs_size() const {
return outputs_.size();
}
void SignatureDef::clear_outputs() {
outputs_.Clear();
}
const ::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >&
SignatureDef::outputs() const {
// @@protoc_insertion_point(field_map:tensorflow.SignatureDef.outputs)
return outputs_.GetMap();
}
::google::protobuf::Map< ::std::string, ::tensorflow::TensorInfo >*
SignatureDef::mutable_outputs() {
// @@protoc_insertion_point(field_mutable_map:tensorflow.SignatureDef.outputs)
return outputs_.MutableMap();
}
// optional string method_name = 3;
void SignatureDef::clear_method_name() {
method_name_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
const ::std::string& SignatureDef::method_name() const {
// @@protoc_insertion_point(field_get:tensorflow.SignatureDef.method_name)
return method_name_.Get(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void SignatureDef::set_method_name(const ::std::string& value) {
method_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
// @@protoc_insertion_point(field_set:tensorflow.SignatureDef.method_name)
}
void SignatureDef::set_method_name(const char* value) {
method_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_char:tensorflow.SignatureDef.method_name)
}
void SignatureDef::set_method_name(const char* value,
size_t size) {
method_name_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:tensorflow.SignatureDef.method_name)
}
::std::string* SignatureDef::mutable_method_name() {
// @@protoc_insertion_point(field_mutable:tensorflow.SignatureDef.method_name)
return method_name_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* SignatureDef::release_method_name() {
// @@protoc_insertion_point(field_release:tensorflow.SignatureDef.method_name)
return method_name_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* SignatureDef::unsafe_arena_release_method_name() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.SignatureDef.method_name)
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
return method_name_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
}
void SignatureDef::set_allocated_method_name(::std::string* method_name) {
if (method_name != NULL) {
} else {
}
method_name_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), method_name,
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:tensorflow.SignatureDef.method_name)
}
void SignatureDef::unsafe_arena_set_allocated_method_name(
::std::string* method_name) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
if (method_name != NULL) {
} else {
}
method_name_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
method_name, GetArenaNoVirtual());
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.SignatureDef.method_name)
}
inline const SignatureDef* SignatureDef::internal_default_instance() {
return &SignatureDef_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
void AssetFileDef::_slow_mutable_tensor_info() {
tensor_info_ = ::google::protobuf::Arena::CreateMessage< ::tensorflow::TensorInfo >(
GetArenaNoVirtual());
}
::tensorflow::TensorInfo* AssetFileDef::_slow_release_tensor_info() {
if (tensor_info_ == NULL) {
return NULL;
} else {
::tensorflow::TensorInfo* temp = new ::tensorflow::TensorInfo(*tensor_info_);
tensor_info_ = NULL;
return temp;
}
}
::tensorflow::TensorInfo* AssetFileDef::unsafe_arena_release_tensor_info() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.AssetFileDef.tensor_info)
::tensorflow::TensorInfo* temp = tensor_info_;
tensor_info_ = NULL;
return temp;
}
void AssetFileDef::_slow_set_allocated_tensor_info(
::google::protobuf::Arena* message_arena, ::tensorflow::TensorInfo** tensor_info) {
if (message_arena != NULL &&
::google::protobuf::Arena::GetArena(*tensor_info) == NULL) {
message_arena->Own(*tensor_info);
} else if (message_arena !=
::google::protobuf::Arena::GetArena(*tensor_info)) {
::tensorflow::TensorInfo* new_tensor_info =
::google::protobuf::Arena::CreateMessage< ::tensorflow::TensorInfo >(
message_arena);
new_tensor_info->CopyFrom(**tensor_info);
*tensor_info = new_tensor_info;
}
}
void AssetFileDef::unsafe_arena_set_allocated_tensor_info(
::tensorflow::TensorInfo* tensor_info) {
if (GetArenaNoVirtual() == NULL) {
delete tensor_info_;
}
tensor_info_ = tensor_info;
if (tensor_info) {
} else {
}
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.AssetFileDef.tensor_info)
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int AssetFileDef::kTensorInfoFieldNumber;
const int AssetFileDef::kFilenameFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
AssetFileDef::AssetFileDef()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (this != internal_default_instance()) protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
SharedCtor();
// @@protoc_insertion_point(constructor:tensorflow.AssetFileDef)
}
AssetFileDef::AssetFileDef(::google::protobuf::Arena* arena)
: ::google::protobuf::Message(),
_internal_metadata_(arena) {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
#endif // GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
SharedCtor();
RegisterArenaDtor(arena);
// @@protoc_insertion_point(arena_constructor:tensorflow.AssetFileDef)
}
void AssetFileDef::InitAsDefaultInstance() {
tensor_info_ = const_cast< ::tensorflow::TensorInfo*>(
::tensorflow::TensorInfo::internal_default_instance());
}
AssetFileDef::AssetFileDef(const AssetFileDef& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL) {
SharedCtor();
UnsafeMergeFrom(from);
// @@protoc_insertion_point(copy_constructor:tensorflow.AssetFileDef)
}
void AssetFileDef::SharedCtor() {
filename_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
tensor_info_ = NULL;
_cached_size_ = 0;
}
AssetFileDef::~AssetFileDef() {
// @@protoc_insertion_point(destructor:tensorflow.AssetFileDef)
SharedDtor();
}
void AssetFileDef::SharedDtor() {
::google::protobuf::Arena* arena = GetArenaNoVirtual();
if (arena != NULL) {
return;
}
filename_.Destroy(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), arena);
if (this != &AssetFileDef_default_instance_.get()) {
delete tensor_info_;
}
}
void AssetFileDef::ArenaDtor(void* object) {
AssetFileDef* _this = reinterpret_cast< AssetFileDef* >(object);
(void)_this;
}
void AssetFileDef::RegisterArenaDtor(::google::protobuf::Arena* arena) {
}
void AssetFileDef::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* AssetFileDef::descriptor() {
protobuf_AssignDescriptorsOnce();
return AssetFileDef_descriptor_;
}
const AssetFileDef& AssetFileDef::default_instance() {
protobuf_InitDefaults_tensorflow_2fcore_2fprotobuf_2fmeta_5fgraph_2eproto();
return *internal_default_instance();
}
::google::protobuf::internal::ExplicitlyConstructed<AssetFileDef> AssetFileDef_default_instance_;
AssetFileDef* AssetFileDef::New(::google::protobuf::Arena* arena) const {
return ::google::protobuf::Arena::CreateMessage<AssetFileDef>(arena);
}
void AssetFileDef::Clear() {
// @@protoc_insertion_point(message_clear_start:tensorflow.AssetFileDef)
if (GetArenaNoVirtual() == NULL && tensor_info_ != NULL) delete tensor_info_;
tensor_info_ = NULL;
filename_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
bool AssetFileDef::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:tensorflow.AssetFileDef)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .tensorflow.TensorInfo tensor_info = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_tensor_info()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_filename;
break;
}
// optional string filename = 2;
case 2: {
if (tag == 18) {
parse_filename:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_filename()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->filename().data(), this->filename().length(),
::google::protobuf::internal::WireFormatLite::PARSE,
"tensorflow.AssetFileDef.filename"));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:tensorflow.AssetFileDef)
return true;
failure:
// @@protoc_insertion_point(parse_failure:tensorflow.AssetFileDef)
return false;
#undef DO_
}
void AssetFileDef::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:tensorflow.AssetFileDef)
// optional .tensorflow.TensorInfo tensor_info = 1;
if (this->has_tensor_info()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, *this->tensor_info_, output);
}
// optional string filename = 2;
if (this->filename().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->filename().data(), this->filename().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.AssetFileDef.filename");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->filename(), output);
}
// @@protoc_insertion_point(serialize_end:tensorflow.AssetFileDef)
}
::google::protobuf::uint8* AssetFileDef::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:tensorflow.AssetFileDef)
// optional .tensorflow.TensorInfo tensor_info = 1;
if (this->has_tensor_info()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageNoVirtualToArray(
1, *this->tensor_info_, false, target);
}
// optional string filename = 2;
if (this->filename().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->filename().data(), this->filename().length(),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"tensorflow.AssetFileDef.filename");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->filename(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:tensorflow.AssetFileDef)
return target;
}
size_t AssetFileDef::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:tensorflow.AssetFileDef)
size_t total_size = 0;
// optional .tensorflow.TensorInfo tensor_info = 1;
if (this->has_tensor_info()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->tensor_info_);
}
// optional string filename = 2;
if (this->filename().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->filename());
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void AssetFileDef::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:tensorflow.AssetFileDef)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
const AssetFileDef* source =
::google::protobuf::internal::DynamicCastToGenerated<const AssetFileDef>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:tensorflow.AssetFileDef)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:tensorflow.AssetFileDef)
UnsafeMergeFrom(*source);
}
}
void AssetFileDef::MergeFrom(const AssetFileDef& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:tensorflow.AssetFileDef)
if (GOOGLE_PREDICT_TRUE(&from != this)) {
UnsafeMergeFrom(from);
} else {
MergeFromFail(__LINE__);
}
}
void AssetFileDef::UnsafeMergeFrom(const AssetFileDef& from) {
GOOGLE_DCHECK(&from != this);
if (from.has_tensor_info()) {
mutable_tensor_info()->::tensorflow::TensorInfo::MergeFrom(from.tensor_info());
}
if (from.filename().size() > 0) {
set_filename(from.filename());
}
}
void AssetFileDef::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:tensorflow.AssetFileDef)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void AssetFileDef::CopyFrom(const AssetFileDef& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:tensorflow.AssetFileDef)
if (&from == this) return;
Clear();
UnsafeMergeFrom(from);
}
bool AssetFileDef::IsInitialized() const {
return true;
}
void AssetFileDef::Swap(AssetFileDef* other) {
if (other == this) return;
if (GetArenaNoVirtual() == other->GetArenaNoVirtual()) {
InternalSwap(other);
} else {
AssetFileDef temp;
temp.UnsafeMergeFrom(*this);
CopyFrom(*other);
other->CopyFrom(temp);
}
}
void AssetFileDef::UnsafeArenaSwap(AssetFileDef* other) {
if (other == this) return;
GOOGLE_DCHECK(GetArenaNoVirtual() == other->GetArenaNoVirtual());
InternalSwap(other);
}
void AssetFileDef::InternalSwap(AssetFileDef* other) {
std::swap(tensor_info_, other->tensor_info_);
filename_.Swap(&other->filename_);
_internal_metadata_.Swap(&other->_internal_metadata_);
std::swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata AssetFileDef::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = AssetFileDef_descriptor_;
metadata.reflection = AssetFileDef_reflection_;
return metadata;
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// AssetFileDef
// optional .tensorflow.TensorInfo tensor_info = 1;
bool AssetFileDef::has_tensor_info() const {
return this != internal_default_instance() && tensor_info_ != NULL;
}
void AssetFileDef::clear_tensor_info() {
if (GetArenaNoVirtual() == NULL && tensor_info_ != NULL) delete tensor_info_;
tensor_info_ = NULL;
}
const ::tensorflow::TensorInfo& AssetFileDef::tensor_info() const {
// @@protoc_insertion_point(field_get:tensorflow.AssetFileDef.tensor_info)
return tensor_info_ != NULL ? *tensor_info_
: *::tensorflow::TensorInfo::internal_default_instance();
}
::tensorflow::TensorInfo* AssetFileDef::mutable_tensor_info() {
if (tensor_info_ == NULL) {
_slow_mutable_tensor_info();
}
// @@protoc_insertion_point(field_mutable:tensorflow.AssetFileDef.tensor_info)
return tensor_info_;
}
::tensorflow::TensorInfo* AssetFileDef::release_tensor_info() {
// @@protoc_insertion_point(field_release:tensorflow.AssetFileDef.tensor_info)
if (GetArenaNoVirtual() != NULL) {
return _slow_release_tensor_info();
} else {
::tensorflow::TensorInfo* temp = tensor_info_;
tensor_info_ = NULL;
return temp;
}
}
void AssetFileDef::set_allocated_tensor_info(::tensorflow::TensorInfo* tensor_info) {
::google::protobuf::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == NULL) {
delete tensor_info_;
}
if (tensor_info != NULL) {
_slow_set_allocated_tensor_info(message_arena, &tensor_info);
}
tensor_info_ = tensor_info;
if (tensor_info) {
} else {
}
// @@protoc_insertion_point(field_set_allocated:tensorflow.AssetFileDef.tensor_info)
}
// optional string filename = 2;
void AssetFileDef::clear_filename() {
filename_.ClearToEmpty(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
const ::std::string& AssetFileDef::filename() const {
// @@protoc_insertion_point(field_get:tensorflow.AssetFileDef.filename)
return filename_.Get(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void AssetFileDef::set_filename(const ::std::string& value) {
filename_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value, GetArenaNoVirtual());
// @@protoc_insertion_point(field_set:tensorflow.AssetFileDef.filename)
}
void AssetFileDef::set_filename(const char* value) {
filename_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value),
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_char:tensorflow.AssetFileDef.filename)
}
void AssetFileDef::set_filename(const char* value,
size_t size) {
filename_.Set(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
reinterpret_cast<const char*>(value), size), GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_pointer:tensorflow.AssetFileDef.filename)
}
::std::string* AssetFileDef::mutable_filename() {
// @@protoc_insertion_point(field_mutable:tensorflow.AssetFileDef.filename)
return filename_.Mutable(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* AssetFileDef::release_filename() {
// @@protoc_insertion_point(field_release:tensorflow.AssetFileDef.filename)
return filename_.Release(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), GetArenaNoVirtual());
}
::std::string* AssetFileDef::unsafe_arena_release_filename() {
// @@protoc_insertion_point(field_unsafe_arena_release:tensorflow.AssetFileDef.filename)
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
return filename_.UnsafeArenaRelease(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
GetArenaNoVirtual());
}
void AssetFileDef::set_allocated_filename(::std::string* filename) {
if (filename != NULL) {
} else {
}
filename_.SetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), filename,
GetArenaNoVirtual());
// @@protoc_insertion_point(field_set_allocated:tensorflow.AssetFileDef.filename)
}
void AssetFileDef::unsafe_arena_set_allocated_filename(
::std::string* filename) {
GOOGLE_DCHECK(GetArenaNoVirtual() != NULL);
if (filename != NULL) {
} else {
}
filename_.UnsafeArenaSetAllocated(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
filename, GetArenaNoVirtual());
// @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.AssetFileDef.filename)
}
inline const AssetFileDef* AssetFileDef::internal_default_instance() {
return &AssetFileDef_default_instance_.get();
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// @@protoc_insertion_point(namespace_scope)
} // namespace tensorflow
// @@protoc_insertion_point(global_scope)
| 114,079 |
1,601 | # -------------------------------------------------------------------------
#
# Part of the CodeChecker project, under the Apache License v2.0 with
# LLVM Exceptions. See LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# -------------------------------------------------------------------------
from abc import abstractmethod
import logging
import os
import re
from ..output_parser import get_next, BaseParser, Event
LOG = logging.getLogger('ReportConverter')
class SANParser(BaseParser):
""" Parser for Clang UndefinedBehaviourSanitizer console outputs.
Example output
/a/b/main.cpp:13:10: runtime error: load of value 7...
"""
def __init__(self):
super(SANParser, self).__init__()
# Regex for parsing stack trace line.
# It has the following format:
# #1 0x42a51d in main /dummy/main.cpp:24:2
self.stack_trace_re = re.compile(r'^\s+#\d+')
self.file_re = re.compile(
r'(?P<path>[\S]+?):(?P<line>\d+)(:(?P<column>\d+))?')
@abstractmethod
def parse_sanitizer_message(self, it, line):
""" Parse the given line. """
raise NotImplementedError("Subclasses should implement this!")
def parse_message(self, it, line):
"""Parse the given line.
Returns a (message, next_line) pair or throws a StopIteration.
The message could be None.
"""
message, next_line = self.parse_sanitizer_message(it, line)
if message:
return message, next_line
return None, next(it)
def parse_stack_trace_line(self, line):
""" Parse the given stack trace line.
Return an event if the file in the stack trace line exists otherwise
it returns None.
"""
file_match = self.file_re.search(line)
if not file_match:
return None
file_path = file_match.group('path')
if file_path and os.path.exists(file_path):
col = file_match.group('column')
return Event(os.path.abspath(file_path),
int(file_match.group('line')),
int(col) if col else 0,
line.rstrip())
return None
def parse_stack_trace(self, it, line):
""" Iterate over lines and parse stack traces. """
events = []
stack_traces = []
while line.strip():
event = self.parse_stack_trace_line(line)
if event:
events.append(event)
stack_traces.append(line)
line = get_next(it)
events.reverse()
return stack_traces, events, line
| 1,132 |
3,246 | package org.datatransferproject.transfer.deezer.model;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* POJO of track: https://developers.deezer.com/api/track
*/
public class Track {
private long id;
private boolean readable;
private String title;
@JsonProperty("short_title") private String shortTitle;
@JsonProperty("short_version") private String titleVersion;
private String isrc;
private String link;
private int duration;
@JsonProperty("track_position") private int trackPosition;
@JsonProperty("disk_position") private int diskPosition;
private Artist artist;
private Album album;
public long getId() {
return id;
}
public boolean isReadable() {
return readable;
}
public String getTitle() {
return title;
}
public String getShortTitle() {
return shortTitle;
}
public String getTitleVersion() {
return titleVersion;
}
public String getIsrc() {
return isrc;
}
public String getLink() {
return link;
}
public int getDuration() {
return duration;
}
public int getTrackPosition() {
return trackPosition;
}
public int getDiskPosition() {
return diskPosition;
}
public Artist getArtist() {
return artist;
}
public Album getAlbum() {
return album;
}
@Override
public String toString() {
return String.format("Track{id=%s, title=\"%s\", isrc=%s}",
id,
title,
isrc);
}
}
| 485 |
301 | /******************************************************************
*
* Copyright 2016 Samsung Electronics 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 org.iotivity.service.rc;
import org.iotivity.service.resourcecontainer.BundleResource;
import org.iotivity.service.resourcecontainer.RcsResourceAttributes;
import org.iotivity.service.rc.RCServer;
import static org.iotivity.service.rc.RCTestAppStaticUtil.*;
import static org.iotivity.service.testapp.framework.Base.*;
import org.iotivity.service.rc.RCClient;
import java.util.*;
public class Action {
private static int ADDED_BUNDLE_COUNT = 1;
private static int STARTED_BUNDLE_COUNT = 1;
private static final int BUNDLE_MAX_SIZE = 2;
private RCServer rcServer;
private RCClient rcClient;
private Vector<BundleInformation> vecBundleInfoList;
Action() {
rcServer = new RCServer();
rcClient = new RCClient();
vecBundleInfoList = new Vector<BundleInformation>();
initializeBundleInfo();
}
public void startContainer() {
if (RCServer.isContainerStarted) {
showOutPut("Resource container has been started already...");
return;
}
rcServer.rcStartContainer();
initializeBundleInfo();
ADDED_BUNDLE_COUNT = 1;
STARTED_BUNDLE_COUNT = 1;
}
public void stopContainer() {
if (!RCServer.isContainerStarted) {
showOutPut("Please start resource container before perform this action...");
return;
}
rcServer.rcStopContainer();
initializeBundleInfo();
ADDED_BUNDLE_COUNT = 1;
STARTED_BUNDLE_COUNT = 1;
}
public void addBundle() {
if (ADDED_BUNDLE_COUNT > 2) {
showOutPut("Sorry.You can add maximum 2 bundle id for this test application...");
return;
}
int flag = getARandomAvailableBundleID();
if (flag == BUNDLE_MAX_SIZE + 1) {
showOutPut("Existing bundle id is already added...");
return;
}
rcServer.rcAddBundle(vecBundleInfoList.elementAt(flag).mBundleId,
vecBundleInfoList.elementAt(flag).mBundleUri,
vecBundleInfoList.elementAt(flag).mBundlePath,
vecBundleInfoList.elementAt(flag).mActivator,
vecBundleInfoList.elementAt(flag).mBundleParams);
vecBundleInfoList.elementAt(flag).isBundleIDAdded = true;
ADDED_BUNDLE_COUNT++;
}
public void removeBundle() {
if (ADDED_BUNDLE_COUNT <= 1) {
showOutPut("Sorry.There is no added bundle id to remove...");
return;
}
int flag = getARandomActiveBundleID();
if (flag == BUNDLE_MAX_SIZE) {
showOutPut("Existing bundle id is already removed...");
return;
}
// Note:Before remove bundle Hue(light type) registered resource should
// be unregistered
if (vecBundleInfoList.elementAt(flag).mBundleId
.compareTo(HUE_BUNDLE_ID) == 0) {
BundleResource bundleResource = getBundleResourceInstance(flag);
rcServer.rcUnregisterResource(bundleResource,
vecBundleInfoList.elementAt(flag).mBundleId, false);
vecBundleInfoList.elementAt(flag).isBundleResourceRegistered = false;
}
rcServer.rcRemoveBundle(vecBundleInfoList.elementAt(flag).mBundleId);
vecBundleInfoList.elementAt(flag).isBundleIDAdded = false;
vecBundleInfoList.elementAt(flag).isBundleStarted = false;
vecBundleInfoList.elementAt(flag).isBundleResourceAdded = false;
vecBundleInfoList.elementAt(flag).isBundleResourceRegistered = false;
STARTED_BUNDLE_COUNT--;
ADDED_BUNDLE_COUNT--;
}
public void startBundle() {
if (STARTED_BUNDLE_COUNT > 2) {
showOutPut("Sorry.There is no bundle id is remaining to start..");
return;
}
int flag = getARandomActiveAndStoppedBundleID();
if (flag == BUNDLE_MAX_SIZE) {
showOutPut("Existing bundle id is already started...");
return;
}
rcServer.rcStartBundle(vecBundleInfoList.elementAt(flag).mBundleId);
vecBundleInfoList.elementAt(flag).isBundleStarted = true;
STARTED_BUNDLE_COUNT++;
if (vecBundleInfoList.elementAt(flag).isBundleResourceAdded) {
HashMap<String, String> resourceParams = new HashMap<String, String>();
resourceParams.put("resourceType",
vecBundleInfoList.elementAt(flag).mResourceType);
resourceParams.put("address",
vecBundleInfoList.elementAt(flag).mResourceAddress);
rcServer.rcAddResourceConfig(
vecBundleInfoList.elementAt(flag).mBundleId,
vecBundleInfoList.elementAt(flag).mResourceURI,
resourceParams, false);
vecBundleInfoList.elementAt(flag).isBundleResourceAdded = true;
if (vecBundleInfoList.elementAt(flag).mBundleId
.compareTo(HUE_BUNDLE_ID) == 0) {
BundleResource bundleResource = getBundleResourceInstance(flag);
rcServer.rcRegisterResource(
vecBundleInfoList.elementAt(flag).mBundleId,
bundleResource, false);
vecBundleInfoList.elementAt(flag).isBundleResourceRegistered = true;
}
}
}
public void stopBundle() {
if (STARTED_BUNDLE_COUNT <= 1) {
showOutPut("Sorry.There is no bundle id is remaining to stop..");
return;
}
int flag = getARandomAvailableStartedBundleID();
if (flag == BUNDLE_MAX_SIZE) {
showOutPut("Existing bundle id is already stopped...");
return;
}
rcServer.rcStopBundle(vecBundleInfoList.elementAt(flag).mBundleId);
vecBundleInfoList.elementAt(flag).isBundleStarted = false;
STARTED_BUNDLE_COUNT--;
if (vecBundleInfoList.elementAt(flag).mBundleId
.compareTo(HUE_BUNDLE_ID) == 0) {
BundleResource bundleResource = getBundleResourceInstance(flag);
rcServer.rcUnregisterResource(bundleResource,
vecBundleInfoList.elementAt(flag).mBundleId, false);
vecBundleInfoList.elementAt(flag).isBundleResourceRegistered = false;
}
}
public void addResources() {
if (ADDED_BUNDLE_COUNT <= 1) {
showOutPut("Please add bundle first...");
return;
}
int flag = getActiveBundleIDAvailableForAddResource();
if (flag == BUNDLE_MAX_SIZE) {
showOutPut("Existing bundle id is already used.Please add bundle first...");
return;
}
HashMap<String, String> resourceParams = new HashMap<String, String>();
resourceParams.put("resourceType",
vecBundleInfoList.elementAt(flag).mResourceType);
resourceParams.put("address",
vecBundleInfoList.elementAt(flag).mResourceAddress);
rcServer.rcAddResourceConfig(
vecBundleInfoList.elementAt(flag).mBundleId,
vecBundleInfoList.elementAt(flag).mResourceURI, resourceParams,
true);
vecBundleInfoList.elementAt(flag).isBundleResourceAdded = true;
}
public void registerResources() {
int flag = getActiveBundleIDThatUsedForAddResourceAndNotRegistered();
if (flag == BUNDLE_MAX_SIZE) {
showOutPut("Sorry.There is no active bundle id having unregistered resource...");
return;
}
BundleResource bundleResource = getBundleResourceInstance(flag);
rcServer.rcRegisterResource(
vecBundleInfoList.elementAt(flag).mBundleId, bundleResource,
true);
vecBundleInfoList.elementAt(flag).isBundleResourceRegistered = true;
}
public void unRegisterResources() {
int flag = getActiveBundleIDThatUsedForAddResourceAndRegistered();
if (flag == BUNDLE_MAX_SIZE) {
showOutPut("Sorry.There is no active bundle having registered resource...");
return;
}
BundleResource bundleResource = getBundleResourceInstance(flag);
rcServer.rcUnregisterResource(bundleResource,
vecBundleInfoList.elementAt(flag).mBundleId, true);
vecBundleInfoList.elementAt(flag).isBundleResourceRegistered = false;
}
public void removeResources() {
int flag = getActiveBundleIDThatUsedForAddResource();
if (flag == BUNDLE_MAX_SIZE) {
showOutPut("Sorry.There is no active bundle having this resource...");
return;
}
if (vecBundleInfoList.elementAt(flag).mBundleId
.compareTo(HUE_BUNDLE_ID) == 0) {
BundleResource bundleResource = getBundleResourceInstance(flag);
rcServer.rcUnregisterResource(bundleResource,
vecBundleInfoList.elementAt(flag).mBundleId, false);
vecBundleInfoList.elementAt(flag).isBundleResourceRegistered = false;
}
rcServer.rcRemoveResourceConfig(
vecBundleInfoList.elementAt(flag).mBundleId,
vecBundleInfoList.elementAt(flag).mResourceURI);
vecBundleInfoList.elementAt(flag).isBundleResourceAdded = false;
}
public void displayCurrentBundleList() {
rcServer.rcDisplayCurrentBundleList();
}
public void displayCurrentResourceList() {
showOutPut("Existing bundle resource's are : ");
for (int index = 0; index < vecBundleInfoList.size(); index++) {
if (vecBundleInfoList.elementAt(index).isBundleIDAdded
&& vecBundleInfoList.elementAt(index).isBundleResourceAdded) {
rcServer.rcDisplayCurrentResourceList(vecBundleInfoList
.elementAt(index).mBundleId);
}
}
// Note:Search for default configured resource
rcServer.rcDisplayCurrentResourceList(DI_BUNDLE_ID);
}
public void clearLog() {
clearOutPut();
}
public void exitTestApp() {
initializeBundleInfo();
rcServer.rcExitTestApp();
}
public void observeResourceContainer() {
rcClient.rcObserveResourceContainer();
}
// ************************************Local function *******************//
class BundleInformation {
public String mBundleId;
public String mBundleName;
public String mBundleUri;
public String mBundlePath;
public String mActivator;
public Map<String, String> mBundleParams;
public String mResourceType;
public String mResourceAddress;
public String mResourceURI;
public Boolean isBundleStarted;
public Boolean isBundleIDAdded;
public Boolean isBundleResourceAdded;
public Boolean isBundleResourceRegistered;
public BundleInformation(String id, String name, String uri,
String path, String activator, Map<String, String> params,
String types, String address, String resourceURI) {
mBundleId = id;
mBundleName = name;
mBundleUri = uri;
mBundlePath = path;
mActivator = activator;
mBundleParams = params;
mResourceType = types;
mResourceURI = resourceURI;
mResourceAddress = address;
isBundleStarted = false;
isBundleIDAdded = false;
isBundleResourceAdded = false;
isBundleResourceRegistered = false;
}
}
private void initializeBundleInfo() {
BundleInformation BMIBundle = new BundleInformation(BMI_BUNDLE_ID,
BMI_NAME, BMI_BUNDLE_URI, BMI_SO_PATH, BMI_BUNDLE_ACTIVATOR,
new HashMap<String, String>(), BMI_BUNDLE_RESOURCE_TYPE,
BMI_BUNDLE_RESOURCE_ADDRESS, BMI_BUNDLE_RESOURCE_URI);
BundleInformation HueBundle = new BundleInformation(HUE_BUNDLE_ID,
HUE_BUNDLE_NAME, HUE_BUNDLE_URI, HUE_BUNDLE_JAR,
HUE_BUNDLE_ACTIVATOR, new HashMap<String, String>(),
HUE_BUNDLE_RESOURCE_TYPE, HUE_BUNDLE_RESOURCE_ADDRESS,
HUE_BUNDLE_RESOURCE_URI);
vecBundleInfoList.add(BMIBundle);
vecBundleInfoList.add(HueBundle);
}
private BundleResource getBundleResourceInstance(int flag) {
BundleResource bundleResource = new BundleResource() {
@Override
protected void initAttributes() {
// TODO Auto-generated method stub
}
@Override
public void handleSetAttributesRequest(RcsResourceAttributes value) {
// TODO Auto-generated method stub
}
@Override
public RcsResourceAttributes handleGetAttributesRequest() {
// TODO Auto-generated method stub
return null;
}
@Override
public void deactivateResource() {
// TODO Auto-generated method stub
}
};
bundleResource.setName(vecBundleInfoList.elementAt(flag).mBundleName);
bundleResource
.setAddress(vecBundleInfoList.elementAt(flag).mResourceAddress);
bundleResource
.setResourceType(vecBundleInfoList.elementAt(flag).mResourceType);
bundleResource.setURI(vecBundleInfoList.elementAt(flag).mResourceURI);
return bundleResource;
}
private int getARandomAvailableBundleID() {
int flag = BUNDLE_MAX_SIZE;
for (int index = 0; index < vecBundleInfoList.size(); index++) {
if (!vecBundleInfoList.elementAt(index).isBundleIDAdded) {
flag = index;
break;
}
}
return flag;
}
int getARandomActiveAndStoppedBundleID() {
int flag = BUNDLE_MAX_SIZE;
for (int index = 0; index < vecBundleInfoList.size(); index++) {
if ((vecBundleInfoList.elementAt(index).isBundleIDAdded)
&& !(vecBundleInfoList.elementAt(index).isBundleStarted)) {
flag = index;
break;
}
}
return flag;
}
int getARandomAvailableStartedBundleID() {
int flag = BUNDLE_MAX_SIZE;
for (int index = 0; index < vecBundleInfoList.size(); index++) {
if (vecBundleInfoList.elementAt(index).isBundleIDAdded
&& vecBundleInfoList.elementAt(index).isBundleStarted) {
flag = index;
break;
}
}
return flag;
}
int getARandomActiveBundleID() {
int flag = BUNDLE_MAX_SIZE;
for (int index = 0; index < vecBundleInfoList.size(); index++) {
if (vecBundleInfoList.elementAt(index).isBundleIDAdded) {
flag = index;
break;
}
}
return flag;
}
int getActiveBundleIDAvailableForAddResource() {
int flag = BUNDLE_MAX_SIZE;
for (int index = 0; index < vecBundleInfoList.size(); index++) {
if (vecBundleInfoList.elementAt(index).isBundleIDAdded
&& !vecBundleInfoList.elementAt(index).isBundleResourceAdded) {
flag = index;
break;
}
}
return flag;
}
int getActiveBundleIDThatUsedForAddResource() {
int flag = BUNDLE_MAX_SIZE;
for (int index = 0; index < vecBundleInfoList.size(); index++) {
if (vecBundleInfoList.elementAt(index).isBundleIDAdded
&& vecBundleInfoList.elementAt(index).isBundleResourceAdded) {
flag = index;
break;
}
}
return flag;
}
int getActiveBundleIDThatUsedForAddResourceAndNotRegistered() {
int flag = BUNDLE_MAX_SIZE;
for (int index = 0; index < vecBundleInfoList.size(); index++) {
if (vecBundleInfoList.elementAt(index).isBundleIDAdded
&& vecBundleInfoList.elementAt(index).isBundleResourceAdded
&& !vecBundleInfoList.elementAt(index).isBundleResourceRegistered) {
flag = index;
break;
}
}
return flag;
}
int getActiveBundleIDThatUsedForAddResourceAndRegistered() {
int flag = BUNDLE_MAX_SIZE;
for (int index = 0; index < vecBundleInfoList.size(); index++) {
if (vecBundleInfoList.elementAt(index).isBundleIDAdded
&& vecBundleInfoList.elementAt(index).isBundleResourceAdded
&& vecBundleInfoList.elementAt(index).isBundleResourceRegistered) {
flag = index;
break;
}
}
return flag;
}
}
| 8,109 |
965 | <reponame>bobbrow/cpp-docs
// Declare an array of integers
CAtlArray<int> iGrowArray;
// Add an element
iGrowArray.Add(0);
// Add an extra element at position 19.
// This will grow the array to accommodate.
iGrowArray.SetAtGrow(19, 0);
// Confirm size of new array
ATLASSERT(iGrowArray.GetCount() == 20);
// Note: the values at position 1 to 18
// are undefined. | 144 |
554 | //
// UILabel+TextColor.h
// UILabel+TextColor
//
// Copyright (c) 2015 Draveness. All rights reserved.
//
// These files are generated by ruby script, if you want to modify code
// in this file, you are supposed to update the ruby code, run it and
// test it. And finally open a pull request.
#import <UIKit/UIKit.h>
@interface UILabel (TextColor)
/**
* Set this property when switch to night version uilabel TextColor turns to this color.
*/
@property (nonatomic, strong) UIColor *nightTextColor;
/**
* UILabel TextColor in normal version.
*/
@property (nonatomic, strong, readonly) UIColor *normalTextColor;
@end
| 194 |
14,668 | <reponame>zealoussnow/chromium
// Copyright 2015 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 COMPONENTS_METRICS_UI_SCREEN_INFO_METRICS_PROVIDER_H_
#define COMPONENTS_METRICS_UI_SCREEN_INFO_METRICS_PROVIDER_H_
#include "components/metrics/metrics_provider.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/size.h"
namespace metrics {
// ScreenInfoMetricsProvider provides metrics related to screen info.
class ScreenInfoMetricsProvider : public MetricsProvider {
public:
ScreenInfoMetricsProvider();
ScreenInfoMetricsProvider(const ScreenInfoMetricsProvider&) = delete;
ScreenInfoMetricsProvider& operator=(const ScreenInfoMetricsProvider&) =
delete;
~ScreenInfoMetricsProvider() override;
// MetricsProvider:
void ProvideSystemProfileMetrics(
SystemProfileProto* system_profile_proto) override;
protected:
// Exposed for the sake of mocking in test code.
// Returns the screen size for the primary monitor if available.
virtual absl::optional<gfx::Size> GetScreenSize() const;
// Returns the device scale factor for the primary monitor.
virtual float GetScreenDeviceScaleFactor() const;
// Returns the number of monitors the user is using.
virtual int GetScreenCount() const;
};
} // namespace metrics
#endif // COMPONENTS_METRICS_UI_SCREEN_INFO_METRICS_PROVIDER_H_
| 447 |
390 | package com.rackspacecloud.blueflood.inputs.constraints;
import com.rackspacecloud.blueflood.service.Configuration;
import com.rackspacecloud.blueflood.service.CoreConfig;
/**
* Constants to set limits for allowed epoch ranges.
*/
public enum EpochRangeLimits {
BEFORE_CURRENT_TIME_MS(Configuration.getInstance().getLongProperty(CoreConfig.BEFORE_CURRENT_COLLECTIONTIME_MS)),
AFTER_CURRENT_TIME_MS(Configuration.getInstance().getLongProperty(CoreConfig.AFTER_CURRENT_COLLECTIONTIME_MS));
private long value;
EpochRangeLimits(long value) {
this.value = value;
}
public long getValue() {
return value;
}
}
| 225 |
475 | <gh_stars>100-1000
#include "../include/Neuron.h"
#include <assert.h>
#include <iostream>
#include <stdlib.h>
using namespace net;
Neuron::Neuron(int numInputs) {
weights = std::vector<double>(numInputs+1);
for(int a = 0; a < numInputs+1; a++) {
weights[a] = Neuron::randomWeight();
}
}
Neuron::Neuron(std::vector<double> w) {
weights = w;
}
void Neuron::randomizeWeights() {
for(unsigned int a = 0; a < weights.size(); a++) {
weights[a] = Neuron::randomWeight();
}
}
double Neuron::getOutput(std::vector<double> inputs) {
assert(inputs.size() == weights.size() - 1);
double returnNumber = 0;
for(unsigned int a = 0; a < inputs.size(); a++) {
returnNumber += inputs[a]*weights[a];
}
returnNumber += -1 * weights[weights.size()-1];
return returnNumber;
}
| 305 |
335 | /*
Copyright (C) 2016 Quaternion Risk Management Ltd
All rights reserved.
This file is part of ORE, a free-software/open-source library
for transparent pricing and risk analysis - http://opensourcerisk.org
ORE is free software: you can redistribute it and/or modify it
under the terms of the Modified BSD License. You should have received a
copy of the license along with this program.
The license is also available online at <http://opensourcerisk.org>
This program is distributed on the basis that it will form a useful
contribution to risk analytics and model standardisation, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
*/
#include <boost/algorithm/string.hpp>
#include <boost/timer/timer.hpp>
#ifdef BOOST_MSVC
// disable warning C4503: '__LINE__Var': decorated name length exceeded, name was truncated
// This pragma statement needs to be at the top of the file - lower and it will not work:
// http://stackoverflow.com/questions/9673504/is-it-possible-to-disable-compiler-warning-c4503
// http://boost.2283326.n4.nabble.com/General-Warnings-and-pragmas-in-MSVC-td2587449.html
#pragma warning(disable : 4503)
#endif
#include <boost/filesystem.hpp>
#include <orea/orea.hpp>
#include <ored/ored.hpp>
#include <ored/utilities/calendaradjustmentconfig.hpp>
#include <ored/utilities/currencyconfig.hpp>
#include <ql/cashflows/floatingratecoupon.hpp>
#include <ql/time/calendars/all.hpp>
#include <ql/time/daycounters/all.hpp>
#include <orea/app/oreapp.hpp>
using namespace std;
using namespace ore::data;
using namespace ore::analytics;
using boost::timer::cpu_timer;
using boost::timer::default_places;
namespace {
vector<string> getFilenames(const string& fileString, const string& path) {
vector<string> fileNames;
boost::split(fileNames, fileString, boost::is_any_of(",;"), boost::token_compress_on);
for (auto it = fileNames.begin(); it < fileNames.end(); it++) {
boost::trim(*it);
*it = path + "/" + *it;
}
return fileNames;
}
} // anonymous namespace
namespace ore {
namespace analytics {
OREApp::OREApp(boost::shared_ptr<Parameters> params, ostream& out)
: tab_(40), progressBarWidth_(72 - std::min<Size>(tab_, 67)), params_(params),
asof_(parseDate(params_->get("setup", "asofDate"))), out_(out), cubeDepth_(0) {
// Set global evaluation date
Settings::instance().evaluationDate() = asof_;
// initialise some pointers
conventions_ = boost::make_shared<Conventions>();
marketParameters_ = boost::make_shared<TodaysMarketParameters>();
curveConfigs_ = boost::make_shared<CurveConfigurations>();
// Set up logging
setupLog();
// Read setup
readSetup();
}
OREApp::~OREApp() {
// Close logs
closeLog();
}
int OREApp::run() {
cpu_timer timer;
try {
out_ << "ORE starting" << std::endl;
LOG("ORE starting");
// readSetup();
/*********
* Load Reference Data
*/
out_ << setw(tab_) << left << "Reference... " << flush;
getReferenceData();
out_ << "OK" << endl;
/*********
* Build Markets
*/
buildMarket();
/************************
*Build Pricing Engine Factory
*/
out_ << setw(tab_) << left << "Engine factory... " << flush;
engineFactory_ = buildEngineFactory(market_, "setup", true);
out_ << "OK" << endl;
/******************************
* Load and Build the Portfolio
*/
out_ << setw(tab_) << left << "Portfolio... " << flush;
portfolio_ = buildPortfolio(engineFactory_);
out_ << "OK" << endl;
/******************************
* Write initial reports
*/
writeInitialReports();
/**************************
* Write base scenario file
*/
out_ << setw(tab_) << left << "Write Base Scenario... " << flush;
if (writeBaseScenario_) {
writeBaseScenario();
out_ << "OK" << endl;
} else {
LOG("skip base scenario");
out_ << "SKIP" << endl;
}
/**********************
* Sensitivity analysis
*/
if (sensitivity_) {
out_ << setw(tab_) << left << "Sensitivity Report... " << flush;
// We reset this here because the date grid building in sensitivity analysis depends on it.
Settings::instance().evaluationDate() = asof_;
sensitivityRunner_ = getSensitivityRunner();
sensitivityRunner_->runSensitivityAnalysis(market_, *conventions_, *curveConfigs_, *marketParameters_);
out_ << "OK" << endl;
} else {
LOG("skip sensitivity analysis");
out_ << setw(tab_) << left << "Sensitivity... ";
out_ << "SKIP" << endl;
}
/****************
* Stress testing
*/
if (stress_) {
runStressTest();
} else {
LOG("skip stress test");
out_ << setw(tab_) << left << "Stress testing... ";
out_ << "SKIP" << endl;
}
/****************
* Parametric VaR
*/
if (parametricVar_) {
runParametricVar();
} else {
LOG("skip parametric var");
out_ << setw(tab_) << left << "Parametric VaR... ";
out_ << "SKIP" << endl;
}
/***************************************************
* Use XVA runner if we want both simulation and XVA
*/
bool useXvaRunner = false;
if (params_->hasGroup("xva") && params_->has("xva", "useXvaRunner"))
useXvaRunner = parseBool(params_->get("xva", "useXvaRunner"));
if (simulate_ && xva_ && useXvaRunner) {
LOG("Use XvaRunner");
// if (cptyCube_) {
// LOG("with cptyCube");
// QL_REQUIRE(cptyCube_->numIds() == portfolio_->counterparties().size() + 1,
// "cptyCube x dimension (" << cptyCube_->numIds() << ") does not match portfolio size ("
// << portfolio_->counterparties().size() << " minus 1)");
// }
// else {
// LOG("without cptyCube");
// }
// // Use pre-generared scenarios
// if (!scenarioData_)
// loadScenarioData();
// QL_REQUIRE(scenarioData_->dimDates() == cube_->dates().size(),
// "scenario dates do not match cube grid size");
// QL_REQUIRE(scenarioData_->dimSamples() == cube_->samples(),
// "scenario sample size does not match cube sample size");
out_ << setw(tab_) << left << "XVA simulation... " << flush;
boost::shared_ptr<XvaRunner> xva = getXvaRunner();
xva->runXva(market_, true);
postProcess_ = xva->postProcess();
out_ << "OK" << endl;
out_ << setw(tab_) << left << "Write XVA Reports... " << flush;
writeXVAReports();
if (writeDIMReport_)
writeDIMReport();
out_ << "OK" << endl;
} else {
/******************************************
* Simulation: Scenario and Cube Generation
*/
if (simulate_) {
generateNPVCube();
} else {
LOG("skip simulation");
out_ << setw(tab_) << left << "Simulation... ";
out_ << "SKIP" << endl;
}
/*****************************
* Aggregation and XVA Reports
*/
out_ << setw(tab_) << left << "Aggregation and XVA Reports... " << flush;
if (xva_) {
// We reset this here because the date grid building below depends on it.
Settings::instance().evaluationDate() = asof_;
// Use pre-generated cube
if (!cube_)
loadCube();
QL_REQUIRE(cube_->numIds() == portfolio_->size(),
"cube x dimension (" << cube_->numIds() << ") does not match portfolio size ("
<< portfolio_->size() << ")");
// Use pre-generared scenarios
if (!scenarioData_)
loadScenarioData();
QL_REQUIRE(scenarioData_->dimDates() == cube_->dates().size(),
"scenario dates do not match cube grid size");
QL_REQUIRE(scenarioData_->dimSamples() == cube_->samples(),
"scenario sample size does not match cube sample size");
runPostProcessor();
out_ << "OK" << endl;
out_ << setw(tab_) << left << "Write Reports... " << flush;
writeXVAReports();
if (writeDIMReport_)
writeDIMReport();
out_ << "OK" << endl;
} else {
LOG("skip XVA reports");
out_ << "SKIP" << endl;
}
}
} catch (std::exception& e) {
ALOG("Error: " << e.what());
out_ << "Error: " << e.what() << endl;
return 1;
}
timer.stop();
out_ << "run time: " << setprecision(2) << timer.format(default_places, "%w") << " sec" << endl;
out_ << "ORE done." << endl;
LOG("ORE done.");
return 0;
}
boost::shared_ptr<XvaRunner> OREApp::getXvaRunner() {
LOG(" OREApp::getXvaRunner() called");
string baseCcy = params_->get("simulation", "baseCurrency");
boost::shared_ptr<EngineData> engineData = getEngineData("simulation");
boost::shared_ptr<NettingSetManager> nettingSetManager = initNettingSetManager();
boost::shared_ptr<TodaysMarketParameters> marketParameters = getMarketParameters();
boost::shared_ptr<ScenarioSimMarketParameters> simMarketParameters = getSimMarketData();
boost::shared_ptr<ScenarioGeneratorData> scenarioGeneratorData = getScenarioGeneratorData();
boost::shared_ptr<CrossAssetModelData> modelData = getCrossAssetModelData();
map<string, bool> analytics;
analytics["exerciseNextBreak"] = parseBool(params_->get("xva", "exerciseNextBreak"));
analytics["exposureProfiles"] = parseBool(params_->get("xva", "exposureProfiles"));
analytics["cva"] = parseBool(params_->get("xva", "cva"));
analytics["dva"] = parseBool(params_->get("xva", "dva"));
analytics["fva"] = parseBool(params_->get("xva", "fva"));
analytics["colva"] = parseBool(params_->get("xva", "colva"));
analytics["collateralFloor"] = parseBool(params_->get("xva", "collateralFloor"));
if (params_->has("xva", "kva"))
analytics["kva"] = parseBool(params_->get("xva", "kva"));
else
analytics["kva"] = false;
if (params_->has("xva", "mva"))
analytics["mva"] = parseBool(params_->get("xva", "mva"));
else
analytics["mva"] = false;
if (params_->has("xva", "dim"))
analytics["dim"] = parseBool(params_->get("xva", "dim"));
else
analytics["dim"] = false;
if (params_->has("xva", "cvaSensi"))
analytics["cvaSensi"] = parseBool(params_->get("xva", "cvaSensi"));
else
analytics["cvaSensi"] = false;
const boost::shared_ptr<ReferenceDataManager>& referenceData = nullptr;
QuantLib::Real dimQuantile = 0.99;
QuantLib::Size dimHorizonCalendarDays = 14;
string dvaName = params_->get("xva", "dvaName");
string fvaLendingCurve = params_->get("xva", "fvaLendingCurve");
string fvaBorrowingCurve = params_->get("xva", "fvaBorrowingCurve");
string calculationType = params_->get("xva", "calculationType");
bool fullInitialCollateralisation = false;
if (params_->has("xva", "fullInitialCollateralisation")) {
fullInitialCollateralisation = parseBool(params_->get("xva", "fullInitialCollateralisation"));
}
bool storeFlows = params_->has("simulation", "storeFlows") && parseBool(params_->get("simulation", "storeFlows"));
analytics["flipViewXVA"] = false;
if (params_->has("xva", "flipViewXVA")) {
analytics["flipViewXVA"] = parseBool(params_->get("xva", "flipViewXVA"));
}
string flipViewBorrowingCurvePostfix = "_BORROW";
string flipViewLendingCurvePostfix = "_LEND";
if (analytics["flipViewXVA"]) {
flipViewBorrowingCurvePostfix = params_->get("xva", "flipViewBorrowingCurvePostfix");
flipViewLendingCurvePostfix = params_->get("xva", "flipViewLendingCurvePostfix");
}
boost::shared_ptr<XvaRunner> xva = boost::make_shared<XvaRunner>(
asof_, baseCcy, portfolio_, nettingSetManager, engineData, curveConfigs_, conventions_, marketParameters,
simMarketParameters, scenarioGeneratorData, modelData, getExtraLegBuilders(), getExtraEngineBuilders(),
referenceData, iborFallbackConfig_, dimQuantile, dimHorizonCalendarDays, analytics, calculationType, dvaName,
fvaBorrowingCurve, fvaLendingCurve, fullInitialCollateralisation, storeFlows);
return xva;
}
void OREApp::readSetup() {
params_->log();
inputPath_ = params_->get("setup", "inputPath");
outputPath_ = params_->get("setup", "outputPath");
if (params_->has("setup", "observationModel")) {
string om = params_->get("setup", "observationModel");
ObservationMode::instance().setMode(om);
LOG("Observation Mode is " << om);
}
if (params_->has("setup", "calendarAdjustment") && params_->get("setup", "calendarAdjustment") != "") {
CalendarAdjustmentConfig calendarAdjustments;
string calendarAdjustmentFile = inputPath_ + "/" + params_->get("setup", "calendarAdjustment");
LOG("Load calendarAdjustment from file" << calendarAdjustmentFile);
calendarAdjustments.fromFile(calendarAdjustmentFile);
}
if (params_->has("setup", "currencyConfiguration") && params_->get("setup", "currencyConfiguration") != "") {
CurrencyConfig currencyConfig;
string currencyConfigFile = inputPath_ + "/" + params_->get("setup", "currencyConfiguration");
LOG("Load currency configurations from file " << currencyConfigFile);
currencyConfig.fromFile(currencyConfigFile);
}
iborFallbackConfig_ = IborFallbackConfig::defaultConfig();
if (params_->has("setup", "iborFallbackConfig") && params_->get("setup", "iborFallbackConfig") != "") {
std::string tmp = inputPath_ + "/" + params_->get("setup", "iborFallbackConfig");
LOG("Load iborFallbackConfig from file" << tmp);
iborFallbackConfig_.fromFile(tmp);
} else {
LOG("Using default iborFallbackConfig");
}
writeInitialReports_ = true;
simulate_ = (params_->hasGroup("simulation") && params_->get("simulation", "active") == "Y") ? true : false;
buildSimMarket_ = true;
xva_ = (params_->hasGroup("xva") && params_->get("xva", "active") == "Y") ? true : false;
writeDIMReport_ = (params_->hasGroup("xva") && params_->has("xva", "dim") && parseBool(params_->get("xva", "dim")))
? true
: false;
sensitivity_ = (params_->hasGroup("sensitivity") && params_->get("sensitivity", "active") == "Y") ? true : false;
stress_ = (params_->hasGroup("stress") && params_->get("stress", "active") == "Y") ? true : false;
parametricVar_ =
(params_->hasGroup("parametricVar") && params_->get("parametricVar", "active") == "Y") ? true : false;
writeBaseScenario_ =
(params_->hasGroup("baseScenario") && params_->get("baseScenario", "active") == "Y") ? true : false;
continueOnError_ = false;
if (params_->has("setup", "continueOnError"))
continueOnError_ = parseBool(params_->get("setup", "continueOnError"));
lazyMarketBuilding_ = true;
if (params_->has("setup", "lazyMarketBuilding"))
lazyMarketBuilding_ = parseBool(params_->get("setup", "lazyMarketBuilding"));
}
void OREApp::setupLog() {
string outputPath = params_->get("setup", "outputPath");
string logFile = outputPath + "/" + params_->get("setup", "logFile");
Size logMask = 15; // Default level
// Get log mask if available
if (params_->has("setup", "logMask")) {
logMask = static_cast<Size>(parseInteger(params_->get("setup", "logMask")));
}
boost::filesystem::path p{outputPath};
if (!boost::filesystem::exists(p)) {
boost::filesystem::create_directories(p);
}
QL_REQUIRE(boost::filesystem::is_directory(p), "output path '" << outputPath << "' is not a directory.");
Log::instance().registerLogger(boost::make_shared<FileLogger>(logFile));
Log::instance().setMask(logMask);
Log::instance().switchOn();
}
void OREApp::closeLog() { Log::instance().removeAllLoggers(); }
void OREApp::getReferenceData() {
if (params_->has("setup", "referenceDataFile") && params_->get("setup", "referenceDataFile") != "") {
string referenceDataFile = inputPath_ + "/" + params_->get("setup", "referenceDataFile");
referenceData_ = boost::make_shared<BasicReferenceDataManager>(referenceDataFile);
} else {
LOG("No referenceDataFile file loaded");
}
}
void OREApp::getConventions() {
if (params_->has("setup", "conventionsFile") && params_->get("setup", "conventionsFile") != "") {
string conventionsFile = inputPath_ + "/" + params_->get("setup", "conventionsFile");
conventions_->fromFile(conventionsFile);
} else {
WLOG("No conventions file loaded");
}
}
boost::shared_ptr<TodaysMarketParameters> OREApp::getMarketParameters() {
if (params_->has("setup", "marketConfigFile") && params_->get("setup", "marketConfigFile") != "") {
string marketConfigFile = inputPath_ + "/" + params_->get("setup", "marketConfigFile");
marketParameters_->fromFile(marketConfigFile);
} else {
WLOG("No market parameters loaded");
}
return marketParameters_;
}
boost::shared_ptr<EngineData> OREApp::getEngineData(string groupName) {
boost::shared_ptr<EngineData> engineData = boost::make_shared<EngineData>();
string pricingEnginesFile = inputPath_ + "/" + params_->get(groupName, "pricingEnginesFile");
engineData->fromFile(pricingEnginesFile);
return engineData;
}
boost::shared_ptr<CrossAssetModelData> OREApp::getCrossAssetModelData() {
string simulationConfigFile = inputPath_ + "/" + params_->get("simulation", "simulationConfigFile");
boost::shared_ptr<CrossAssetModelData> modelData = boost::make_shared<CrossAssetModelData>();
modelData->fromFile(simulationConfigFile);
return modelData;
}
boost::shared_ptr<EngineFactory> OREApp::buildEngineFactory(const boost::shared_ptr<Market>& market,
const string& groupName,
const bool generateAdditionalResults) const {
MEM_LOG;
LOG("Building an engine factory")
map<MarketContext, string> configurations;
boost::shared_ptr<EngineData> engineData = boost::make_shared<EngineData>();
string pricingEnginesFile = inputPath_ + "/" + params_->get(groupName, "pricingEnginesFile");
if (params_->get(groupName, "pricingEnginesFile") != "")
engineData->fromFile(pricingEnginesFile);
engineData->globalParameters()["GenerateAdditionalResults"] = generateAdditionalResults ? "true" : "false";
configurations[MarketContext::irCalibration] = params_->get("markets", "lgmcalibration");
configurations[MarketContext::fxCalibration] = params_->get("markets", "fxcalibration");
configurations[MarketContext::pricing] = params_->get("markets", "pricing");
boost::shared_ptr<EngineFactory> factory =
boost::make_shared<EngineFactory>(engineData, market, configurations, getExtraEngineBuilders(),
getExtraLegBuilders(), referenceData_, iborFallbackConfig_);
LOG("Engine factory built");
MEM_LOG;
return factory;
}
boost::shared_ptr<TradeFactory> OREApp::buildTradeFactory() const {
boost::shared_ptr<TradeFactory> tf = boost::make_shared<TradeFactory>();
tf->addExtraBuilders(getExtraTradeBuilders(tf));
return tf;
}
boost::shared_ptr<Portfolio> OREApp::buildPortfolio(const boost::shared_ptr<EngineFactory>& factory) {
MEM_LOG;
LOG("Building portfolio");
boost::shared_ptr<Portfolio> portfolio = loadPortfolio();
portfolio->build(factory);
LOG("Portfolio built");
MEM_LOG;
return portfolio;
}
boost::shared_ptr<Portfolio> OREApp::loadPortfolio() {
string portfoliosString = params_->get("setup", "portfolioFile");
boost::shared_ptr<Portfolio> portfolio = boost::make_shared<Portfolio>();
if (params_->get("setup", "portfolioFile") == "")
return portfolio;
vector<string> portfolioFiles = getFilenames(portfoliosString, inputPath_);
for (auto portfolioFile : portfolioFiles) {
portfolio->load(portfolioFile, buildTradeFactory());
}
return portfolio;
}
boost::shared_ptr<ScenarioSimMarketParameters> OREApp::getSimMarketData() {
string simulationConfigFile = inputPath_ + "/" + params_->get("simulation", "simulationConfigFile");
boost::shared_ptr<ScenarioSimMarketParameters> simMarketData(new ScenarioSimMarketParameters);
simMarketData->fromFile(simulationConfigFile);
return simMarketData;
}
boost::shared_ptr<ScenarioGeneratorData> OREApp::getScenarioGeneratorData() {
string simulationConfigFile = inputPath_ + "/" + params_->get("simulation", "simulationConfigFile");
boost::shared_ptr<ScenarioGeneratorData> sgd(new ScenarioGeneratorData);
sgd->fromFile(simulationConfigFile);
auto grid = sgd->getGrid();
DLOG("grid size=" << grid->size() << ", dates=" << grid->dates().size()
<< ", valuationDates=" << grid->valuationDates().size()
<< ", closeOutDates=" << grid->closeOutDates().size());
useCloseOutLag_ = sgd->withCloseOutLag();
useMporStickyDate_ = sgd->withMporStickyDate();
return sgd;
}
boost::shared_ptr<QuantExt::CrossAssetModel> OREApp::buildCam(boost::shared_ptr<Market> market,
const bool continueOnCalibrationError) {
LOG("Build Simulation Model (continueOnCalibrationError = " << std::boolalpha << continueOnCalibrationError << ")");
string simulationConfigFile = inputPath_ + "/" + params_->get("simulation", "simulationConfigFile");
LOG("Load simulation model data from file: " << simulationConfigFile);
boost::shared_ptr<CrossAssetModelData> modelData = boost::make_shared<CrossAssetModelData>();
modelData->fromFile(simulationConfigFile);
string lgmCalibrationMarketStr = Market::defaultConfiguration;
if (params_->has("markets", "lgmcalibration"))
lgmCalibrationMarketStr = params_->get("markets", "lgmcalibration");
string fxCalibrationMarketStr = Market::defaultConfiguration;
if (params_->has("markets", "fxcalibration"))
fxCalibrationMarketStr = params_->get("markets", "fxcalibration");
string eqCalibrationMarketStr = Market::defaultConfiguration;
if (params_->has("markets", "eqcalibration"))
eqCalibrationMarketStr = params_->get("markets", "eqcalibration");
string infCalibrationMarketStr = Market::defaultConfiguration;
if (params_->has("markets", "infcalibration"))
infCalibrationMarketStr = params_->get("markets", "infcalibration");
string crCalibrationMarketStr = Market::defaultConfiguration;
if (params_->has("markets", "crcalibration"))
crCalibrationMarketStr = params_->get("markets", "crcalibration");
string simulationMarketStr = Market::defaultConfiguration;
if (params_->has("markets", "simulation"))
simulationMarketStr = params_->get("markets", "simulation");
CrossAssetModelBuilder modelBuilder(market, modelData, lgmCalibrationMarketStr, fxCalibrationMarketStr,
eqCalibrationMarketStr, infCalibrationMarketStr, crCalibrationMarketStr,
simulationMarketStr, ActualActual(), false, continueOnCalibrationError);
boost::shared_ptr<QuantExt::CrossAssetModel> model = *modelBuilder.model();
return model;
}
boost::shared_ptr<ScenarioGenerator>
OREApp::buildScenarioGenerator(boost::shared_ptr<Market> market,
boost::shared_ptr<ScenarioSimMarketParameters> simMarketData,
boost::shared_ptr<ScenarioGeneratorData> sgd, const bool continueOnCalibrationError) {
boost::shared_ptr<QuantExt::CrossAssetModel> model = buildCam(market, continueOnCalibrationError);
LOG("Load Simulation Parameters");
ScenarioGeneratorBuilder sgb(sgd);
boost::shared_ptr<ScenarioFactory> sf = boost::make_shared<SimpleScenarioFactory>();
boost::shared_ptr<ScenarioGenerator> sg = sgb.build(
model, sf, simMarketData, asof_, market, params_->get("markets", "simulation")); // pricing or simulation?
// Optionally write out scenarios
if (params_->has("simulation", "scenariodump")) {
string filename = outputPath_ + "/" + params_->get("simulation", "scenariodump");
sg = boost::make_shared<ScenarioWriter>(sg, filename);
}
return sg;
}
void OREApp::writeInitialReports() {
MEM_LOG;
LOG("Writing initial reports");
/************
* Curve dump
*/
out_ << setw(tab_) << left << "Curve Report... " << flush;
if (params_->hasGroup("curves") && params_->get("curves", "active") == "Y") {
string fileName = outputPath_ + "/" + params_->get("curves", "outputFileName");
CSVFileReport curvesReport(fileName);
DateGrid grid(params_->get("curves", "grid"));
getReportWriter()->writeCurves(curvesReport, params_->get("curves", "configuration"), grid, *marketParameters_,
market_, continueOnError_);
out_ << "OK" << endl;
} else {
LOG("skip curve report");
out_ << "SKIP" << endl;
}
/*********************
* Portfolio valuation
*/
out_ << setw(tab_) << left << "NPV Report... " << flush;
if (params_->hasGroup("npv") && params_->get("npv", "active") == "Y") {
string fileName = outputPath_ + "/" + params_->get("npv", "outputFileName");
CSVFileReport npvReport(fileName);
getReportWriter()->writeNpv(npvReport, params_->get("npv", "baseCurrency"), market_,
params_->get("markets", "pricing"), portfolio_);
out_ << "OK" << endl;
} else {
LOG("skip portfolio valuation");
out_ << "SKIP" << endl;
}
/*********************
* Additional Results
*/
out_ << setw(tab_) << left << "Additional Results... " << flush;
if (params_->hasGroup("additionalResults") && params_->get("additionalResults", "active") == "Y") {
string fileName = outputPath_ + "/" + params_->get("additionalResults", "outputFileName");
CSVFileReport addResultReport(fileName);
getReportWriter()->writeAdditionalResultsReport(addResultReport, portfolio_, market_, params_->get("npv", "baseCurrency"));
out_ << "OK" << endl;
} else {
LOG("skip additional results");
out_ << "SKIP" << endl;
}
/*********************
* TodaysMarket calibration
*/
out_ << setw(tab_) << left << "TodaysMarket Calibration... " << flush;
if (params_->hasGroup("todaysMarketCalibration") && params_->get("todaysMarketCalibration", "active") == "Y") {
string fileName = outputPath_ + "/" + params_->get("todaysMarketCalibration", "outputFileName");
CSVFileReport todaysMarketCalibrationReport(fileName);
auto todaysMarket = boost::dynamic_pointer_cast<TodaysMarket>(market_);
if(todaysMarket) {
getReportWriter()->writeTodaysMarketCalibrationReport(todaysMarketCalibrationReport,
todaysMarket->calibrationInfo());
}
out_ << "OK" << endl;
} else {
LOG("skip additional results");
out_ << "SKIP" << endl;
}
/**********************
* Cash flow generation
*/
out_ << setw(tab_) << left << "Cashflow Report... " << flush;
if (params_->hasGroup("cashflow") && params_->get("cashflow", "active") == "Y") {
bool includePastCashflows = params_->has("cashflow", "includePastCashflows") &&
parseBool(params_->get("cashflow", "includePastCashflows"));
string fileName = outputPath_ + "/" + params_->get("cashflow", "outputFileName");
CSVFileReport cashflowReport(fileName);
getReportWriter()->writeCashflow(cashflowReport, portfolio_, market_, params_->get("markets", "pricing"),
includePastCashflows);
out_ << "OK" << endl;
} else {
LOG("skip cashflow generation");
out_ << "SKIP" << endl;
}
LOG("Initial reports written");
MEM_LOG;
}
boost::shared_ptr<ReportWriter> OREApp::getReportWriter() const {
return boost::shared_ptr<ReportWriter>(getReportWriterImpl());
}
boost::shared_ptr<SensitivityRunner> OREApp::getSensitivityRunner() {
return boost::make_shared<SensitivityRunner>(params_, buildTradeFactory(), getExtraEngineBuilders(),
getExtraLegBuilders(), referenceData_, iborFallbackConfig_,
continueOnError_);
}
void OREApp::runStressTest() {
MEM_LOG;
LOG("Running stress test");
out_ << setw(tab_) << left << "Stress Test Report... " << flush;
// We reset this here because the date grid building below depends on it.
Settings::instance().evaluationDate() = asof_;
LOG("Get Simulation Market Parameters");
string marketConfigFile = inputPath_ + "/" + params_->get("stress", "marketConfigFile");
boost::shared_ptr<ScenarioSimMarketParameters> simMarketData(new ScenarioSimMarketParameters);
simMarketData->fromFile(marketConfigFile);
LOG("Get Stress Test Parameters");
string stressConfigFile = inputPath_ + "/" + params_->get("stress", "stressConfigFile");
boost::shared_ptr<StressTestScenarioData> stressData(new StressTestScenarioData);
stressData->fromFile(stressConfigFile);
LOG("Get Engine Data");
string pricingEnginesFile = inputPath_ + "/" + params_->get("stress", "pricingEnginesFile");
boost::shared_ptr<EngineData> engineData = boost::make_shared<EngineData>();
engineData->fromFile(pricingEnginesFile);
LOG("Get Portfolio");
boost::shared_ptr<Portfolio> portfolio = loadPortfolio();
LOG("Build Stress Test");
string marketConfiguration = params_->get("markets", "pricing");
boost::shared_ptr<StressTest> stressTest = boost::make_shared<StressTest>(
portfolio, market_, marketConfiguration, engineData, simMarketData, stressData, *conventions_, *curveConfigs_,
*marketParameters_, nullptr, getExtraEngineBuilders(), getExtraLegBuilders(), referenceData_,
iborFallbackConfig_, continueOnError_);
string outputFile = outputPath_ + "/" + params_->get("stress", "scenarioOutputFile");
Real threshold = parseReal(params_->get("stress", "outputThreshold"));
boost::shared_ptr<Report> stressReport = boost::make_shared<CSVFileReport>(outputFile);
stressTest->writeReport(stressReport, threshold);
out_ << "OK" << endl;
LOG("Stress test completed");
MEM_LOG;
}
void OREApp::runParametricVar() {
MEM_LOG;
LOG("Running parametric VaR");
out_ << setw(tab_) << left << "Parametric VaR Report... " << flush;
LOG("Get sensitivity data");
string sensiFile = inputPath_ + "/" + params_->get("parametricVar", "sensitivityInputFile");
auto ss = boost::make_shared<SensitivityFileStream>(sensiFile);
LOG("Build trade to portfolio id mapping");
map<string, set<string>> tradePortfolio;
for (auto const& t : portfolio_->trades()) {
tradePortfolio[t->id()].insert(t->portfolioIds().begin(), t->portfolioIds().end());
}
LOG("Load covariance matrix data");
map<std::pair<RiskFactorKey, RiskFactorKey>, Real> covarData;
loadCovarianceDataFromCsv(covarData, inputPath_ + "/" + params_->get("parametricVar", "covarianceInputFile"));
Size mcSamples = Null<Size>(), mcSeed = Null<Size>();
string method = params_->get("parametricVar", "method");
if (method == "MonteCarlo") {
mcSamples = parseInteger(params_->get("parametricVar", "mcSamples"));
mcSeed = parseInteger(params_->get("parametricVar", "mcSeed"));
}
string portfolioFilter =
params_->has("parametricVar", "portfolioFilter") ? params_->get("parametricVar", "portfolioFilter") : "";
LOG("Build parametric var report");
auto calc =
buildParametricVarCalculator(tradePortfolio, portfolioFilter, ss, covarData,
parseListOfValues<Real>(params_->get("parametricVar", "quantiles"), &parseReal),
method, mcSamples, mcSeed, parseBool(params_->get("parametricVar", "breakdown")),
parseBool(params_->get("parametricVar", "salvageCovarianceMatrix")));
CSVFileReport report(outputPath_ + "/" + params_->get("parametricVar", "outputFile"));
calc->calculate(report);
out_ << "OK" << endl;
LOG("Parametric VaR completed");
MEM_LOG;
}
boost::shared_ptr<ParametricVarCalculator>
OREApp::buildParametricVarCalculator(const std::map<std::string, std::set<std::string>>& tradePortfolio,
const std::string& portfolioFilter,
const boost::shared_ptr<SensitivityStream>& sensitivities,
const std::map<std::pair<RiskFactorKey, RiskFactorKey>, Real> covariance,
const std::vector<Real>& p, const std::string& method, const Size mcSamples,
const Size mcSeed, const bool breakdown, const bool salvageCovarianceMatrix) {
return boost::make_shared<ParametricVarCalculator>(tradePortfolio, portfolioFilter, sensitivities, covariance, p,
method, mcSamples, mcSeed, breakdown, salvageCovarianceMatrix);
}
void OREApp::writeBaseScenario() {
MEM_LOG;
LOG("Writing base scenario");
Date today = Settings::instance().evaluationDate();
LOG("Get Market Configuration");
string marketConfiguration = params_->get("baseScenario", "marketConfiguration");
LOG("Get Simulation Market Parameters");
string marketConfigFile = inputPath_ + "/" + params_->get("baseScenario", "marketConfigFile");
boost::shared_ptr<ScenarioSimMarketParameters> simMarketData(new ScenarioSimMarketParameters);
simMarketData->fromFile(marketConfigFile);
auto simMarket = boost::make_shared<ScenarioSimMarket>(market_, simMarketData, *conventions_, marketConfiguration,
*curveConfigs_, *marketParameters_, continueOnError_, false,
false, false, iborFallbackConfig_);
boost::shared_ptr<Scenario> scenario = simMarket->baseScenario();
QL_REQUIRE(scenario->asof() == today, "dates do not match");
string outputFile = outputPath_ + "/" + params_->get("baseScenario", "outputFileName");
string separator = params_->get("baseScenario", "separator");
QL_REQUIRE(separator.length() == 1, "separator needs length 1: " << separator);
const char sep = separator.c_str()[0];
bool append = parseBool(params_->get("baseScenario", "append"));
bool writeHeader = parseBool(params_->get("baseScenario", "header"));
string mode = append ? "a+" : "w+";
ScenarioWriter sw(outputFile, sep, mode);
sw.writeScenario(scenario, writeHeader);
DLOG("Base scenario written to file " << outputFile);
LOG("Base scenario written");
MEM_LOG;
}
void OREApp::initAggregationScenarioData() {
scenarioData_ = boost::make_shared<InMemoryAggregationScenarioData>(grid_->valuationDates().size(), samples_);
}
void OREApp::initCube(boost::shared_ptr<NPVCube>& cube, const std::vector<std::string>& ids, const Size cubeDepth) {
QL_REQUIRE(cubeDepth > 0, "zero cube depth given");
if (cubeDepth == 1)
cube = boost::make_shared<SinglePrecisionInMemoryCube>(asof_, ids, grid_->valuationDates(), samples_, 0.0f);
else
cube = boost::make_shared<SinglePrecisionInMemoryCubeN>(asof_, ids, grid_->valuationDates(), samples_,
cubeDepth, 0.0f);
LOG("init NPV cube with depth: " << cubeDepth);
}
void OREApp::buildNPVCube() {
LOG("Build valuation cube engine");
// Valuation calculators
string baseCurrency = params_->get("simulation", "baseCurrency");
vector<boost::shared_ptr<ValuationCalculator>> calculators;
if (useCloseOutLag_) {
boost::shared_ptr<NPVCalculator> npvCalc = boost::make_shared<NPVCalculator>(baseCurrency);
// calculators.push_back(boost::make_shared<NPVCalculator>(baseCurrency));
// default date value stored at index 0, close-out value at index 1
calculators.push_back(boost::make_shared<MPORCalculator>(npvCalc, 0, 1));
} else {
calculators.push_back(boost::make_shared<NPVCalculator>(baseCurrency));
}
if (storeFlows_) {
// cash flow stored at index 1 (no close-out lag) or 2 (have close-out lag)
calculators.push_back(boost::make_shared<CashflowCalculator>(baseCurrency, asof_, grid_, cubeDepth_ - 1));
}
bool flipViewXVA = false;
if (params_->has("xva", "flipViewXVA")) {
flipViewXVA = parseBool(params_->get("xva", "flipViewXVA"));
}
if (useCloseOutLag_)
cubeInterpreter_ = boost::make_shared<MporGridCubeInterpretation>(grid_, flipViewXVA);
else
cubeInterpreter_ = boost::make_shared<RegularCubeInterpretation>(flipViewXVA);
vector<boost::shared_ptr<CounterpartyCalculator>> cptyCalculators;
if (storeSp_) {
const string configuration = params_->get("markets", "simulation");
cptyCalculators.push_back(boost::make_shared<SurvivalProbabilityCalculator>(configuration));
}
LOG("Build cube");
ValuationEngine engine(asof_, grid_, simMarket_);
ostringstream o;
o.str("");
o << "Build Cube " << simPortfolio_->size() << " x " << grid_->valuationDates().size() << " x " << samples_
<< "... ";
auto progressBar = boost::make_shared<SimpleProgressBar>(o.str(), tab_, progressBarWidth_);
auto progressLog = boost::make_shared<ProgressLog>("Building cube...");
engine.registerProgressIndicator(progressBar);
engine.registerProgressIndicator(progressLog);
engine.buildCube(simPortfolio_, cube_, calculators, useMporStickyDate_, nettingSetCube_, cptyCube_, cptyCalculators);
out_ << "OK" << endl;
}
void OREApp::setCubeDepth(const boost::shared_ptr<ScenarioGeneratorData>& sgd) {
cubeDepth_ = 1;
if (sgd->withCloseOutLag())
cubeDepth_++;
if (params_->has("simulation", "storeFlows") && parseBool(params_->get("simulation", "storeFlows"))) {
cubeDepth_++;
}
}
void OREApp::initialiseNPVCubeGeneration(boost::shared_ptr<Portfolio> portfolio) {
out_ << setw(tab_) << left << "Simulation Setup... ";
LOG("Load Simulation Market Parameters");
boost::shared_ptr<ScenarioSimMarketParameters> simMarketData = getSimMarketData();
boost::shared_ptr<ScenarioGeneratorData> sgd = getScenarioGeneratorData();
grid_ = sgd->getGrid();
samples_ = sgd->samples();
if (buildSimMarket_) {
LOG("Build Simulation Market");
simMarket_ = boost::make_shared<ScenarioSimMarket>(
market_, simMarketData, *conventions_, boost::make_shared<FixingManager>(asof_),
params_->get("markets", "simulation"), *curveConfigs_, *marketParameters_, continueOnError_, false, true,
false, iborFallbackConfig_);
string groupName = "simulation";
boost::shared_ptr<EngineFactory> simFactory = buildEngineFactory(simMarket_, groupName);
auto continueOnCalErr = simFactory->engineData()->globalParameters().find("ContinueOnCalibrationError");
boost::shared_ptr<ScenarioGenerator> sg =
buildScenarioGenerator(market_, simMarketData, sgd,
continueOnCalErr != simFactory->engineData()->globalParameters().end() &&
parseBool(continueOnCalErr->second));
simMarket_->scenarioGenerator() = sg;
LOG("Build portfolio linked to sim market");
Size n = portfolio->size();
portfolio->build(simFactory);
simPortfolio_ = portfolio;
if (simPortfolio_->size() != n) {
ALOG("There were errors during the sim portfolio building - check the sim market setup? Could build "
<< simPortfolio_->size() << " trades out of " << n);
}
out_ << "OK" << endl;
}
setCubeDepth(sgd);
storeFlows_ = params_->has("simulation", "storeFlows") && parseBool(params_->get("simulation", "storeFlows"));
nettingSetCube_ = nullptr;
initCube(cube_, simPortfolio_->ids(), cubeDepth_);
// initialise counterparty cube for the storage of survival probabilities
storeSp_ = false;
if (params_->has("simulation", "storeSurvivalProbabilities") &&
params_->get("simulation", "storeSurvivalProbabilities") == "Y") {
storeSp_ = true;
auto counterparties = simPortfolio_->counterparties();
counterparties.push_back(params_->get("xva", "dvaName"));
initCube(cptyCube_, counterparties, 1);
} else {
cptyCube_ = nullptr;
}
ostringstream o;
o << "Aggregation Scenario Data " << grid_->valuationDates().size() << " x " << samples_ << "... ";
out_ << setw(tab_) << o.str() << flush;
initAggregationScenarioData();
// Set AggregationScenarioData
simMarket_->aggregationScenarioData() = scenarioData_;
out_ << "OK" << endl;
}
void OREApp::generateNPVCube() {
MEM_LOG;
LOG("Running NPV cube generation");
boost::shared_ptr<Portfolio> portfolio = loadPortfolio();
initialiseNPVCubeGeneration(portfolio);
buildNPVCube();
writeCube(cube_, "cubeFile");
if (nettingSetCube_)
writeCube(nettingSetCube_, "nettingSetCubeFile");
if (cptyCube_)
writeCube(cptyCube_, "cptyCubeFile");
writeScenarioData();
LOG("NPV cube generation completed");
MEM_LOG;
}
void OREApp::writeCube(boost::shared_ptr<NPVCube> cube, const std::string& cubeFileParam) {
out_ << setw(tab_) << left << "Write Cube... " << flush;
if (params_->has("simulation", cubeFileParam)) {
string cubeFileName = outputPath_ + "/" + params_->get("simulation", cubeFileParam);
cube->save(cubeFileName);
LOG("Write cube '" << cubeFileName << "'");
out_ << "OK" << endl;
} else {
LOG("Did not write cube, since parameter simulation/" << cubeFileParam << " not specified.");
out_ << "SKIP" << endl;
}
}
void OREApp::writeScenarioData() {
out_ << setw(tab_) << left << "Write Aggregation Scenario Data... " << flush;
LOG("Write scenario data");
bool skipped = true;
if (params_->has("simulation", "aggregationScenarioDataFileName")) {
// binary output
string outputFileNameAddScenData =
outputPath_ + "/" + params_->get("simulation", "aggregationScenarioDataFileName");
scenarioData_->save(outputFileNameAddScenData);
out_ << "OK" << endl;
skipped = false;
}
if (params_->has("simulation", "aggregationScenarioDataDump")) {
// csv output
string outputFileNameAddScenData =
outputPath_ + "/" + params_->get("simulation", "aggregationScenarioDataDump");
CSVFileReport report(outputFileNameAddScenData);
getReportWriter()->writeAggregationScenarioData(report, *scenarioData_);
skipped = false;
}
if (skipped)
out_ << "SKIP" << endl;
}
void OREApp::loadScenarioData() {
string scenarioFile = outputPath_ + "/" + params_->get("xva", "scenarioFile");
scenarioData_ = boost::make_shared<InMemoryAggregationScenarioData>();
scenarioData_->load(scenarioFile);
}
void OREApp::loadCube() {
// loade usual NPV cube on trade level
string cubeFile = outputPath_ + "/" + params_->get("xva", "cubeFile");
bool hyperCube = false;
if (params_->has("xva", "hyperCube"))
hyperCube = parseBool(params_->get("xva", "hyperCube"));
if (hyperCube)
cube_ = boost::make_shared<SinglePrecisionInMemoryCubeN>();
else
cube_ = boost::make_shared<SinglePrecisionInMemoryCube>();
LOG("Load cube from file " << cubeFile);
cube_->load(cubeFile);
cubeDepth_ = cube_->depth();
LOG("Cube loading done: ids=" << cube_->numIds() << " dates=" << cube_->numDates()
<< " samples=" << cube_->samples() << " depth=" << cube_->depth());
// load additional cube on netting set level (if specified)
if (params_->has("xva", "nettingSetCubeFile") && params_->get("xva", "nettingSetCubeFile") != "") {
string cubeFile2 = outputPath_ + "/" + params_->get("xva", "nettingSetCubeFile");
bool hyperCube2 = false;
if (params_->has("xva", "hyperNettingSetCube"))
hyperCube2 = parseBool(params_->get("xva", "hyperNettingSetCube"));
if (hyperCube2)
nettingSetCube_ = boost::make_shared<SinglePrecisionInMemoryCubeN>();
else
nettingSetCube_ = boost::make_shared<SinglePrecisionInMemoryCube>();
LOG("Load netting set cube from file " << cubeFile2);
nettingSetCube_->load(cubeFile2);
LOG("Cube loading done: ids=" << nettingSetCube_->numIds() << " dates=" << nettingSetCube_->numDates()
<< " samples=" << nettingSetCube_->samples()
<< " depth=" << nettingSetCube_->depth());
}
// load additional cube on counterparty level (if specified)
if (params_->has("xva", "cptyCubeFile") && params_->get("xva", "cptyCubeFile") != "") {
string cubeFile3 = outputPath_ + "/" + params_->get("xva", "cptyCubeFile");
cptyCube_ = boost::make_shared<SinglePrecisionInMemoryCube>();
LOG("Load counterparty cube from file " << cubeFile3);
cptyCube_->load(cubeFile3);
LOG("Cube loading done: ids=" << cptyCube_->numIds() << " dates=" << cptyCube_->numDates()
<< " samples=" << cptyCube_->samples()
<< " depth=" << cptyCube_->depth());
}
}
boost::shared_ptr<NettingSetManager> OREApp::initNettingSetManager() {
string csaFile = inputPath_ + "/" + params_->get("xva", "csaFile");
boost::shared_ptr<NettingSetManager> netting = boost::make_shared<NettingSetManager>();
netting->fromFile(csaFile);
return netting;
}
void OREApp::runPostProcessor() {
boost::shared_ptr<NettingSetManager> netting = initNettingSetManager();
map<string, bool> analytics;
analytics["exerciseNextBreak"] = parseBool(params_->get("xva", "exerciseNextBreak"));
analytics["exposureProfiles"] = parseBool(params_->get("xva", "exposureProfiles"));
analytics["cva"] = parseBool(params_->get("xva", "cva"));
analytics["dva"] = parseBool(params_->get("xva", "dva"));
analytics["fva"] = parseBool(params_->get("xva", "fva"));
analytics["colva"] = parseBool(params_->get("xva", "colva"));
analytics["collateralFloor"] = parseBool(params_->get("xva", "collateralFloor"));
if (params_->has("xva", "kva"))
analytics["kva"] = parseBool(params_->get("xva", "kva"));
else
analytics["kva"] = false;
if (params_->has("xva", "mva"))
analytics["mva"] = parseBool(params_->get("xva", "mva"));
else
analytics["mva"] = false;
if (params_->has("xva", "dim"))
analytics["dim"] = parseBool(params_->get("xva", "dim"));
else
analytics["dim"] = false;
if (params_->has("xva", "dynamicCredit"))
analytics["dynamicCredit"] = parseBool(params_->get("xva", "dynamicCredit"));
else
analytics["dynamicCredit"] = false;
if (params_->has("xva", "cvaSensi"))
analytics["cvaSensi"] = parseBool(params_->get("xva", "cvaSensi"));
else
analytics["cvaSensi"] = false;
string baseCurrency = params_->get("xva", "baseCurrency");
string calculationType = params_->get("xva", "calculationType");
string allocationMethod = params_->get("xva", "allocationMethod");
Real marginalAllocationLimit = parseReal(params_->get("xva", "marginalAllocationLimit"));
Real quantile = parseReal(params_->get("xva", "quantile"));
string dvaName = params_->get("xva", "dvaName");
string fvaLendingCurve = params_->get("xva", "fvaLendingCurve");
string fvaBorrowingCurve = params_->get("xva", "fvaBorrowingCurve");
Real dimQuantile = 0.99;
Size dimHorizonCalendarDays = 14;
Size dimRegressionOrder = 0;
vector<string> dimRegressors;
// Warning dimScaling set but not used.
// Real dimScaling = 1.0;
Size dimLocalRegressionEvaluations = 0;
Real dimLocalRegressionBandwidth = 0.25;
Real kvaCapitalDiscountRate = 0.10;
Real kvaAlpha = 1.4;
Real kvaRegAdjustment = 12.5;
Real kvaCapitalHurdle = 0.012;
Real kvaOurPdFloor = 0.03;
Real kvaTheirPdFloor = 0.03;
Real kvaOurCvaRiskWeight = 0.05;
Real kvaTheirCvaRiskWeight = 0.05;
if (analytics["kva"]) {
kvaCapitalDiscountRate = parseReal(params_->get("xva", "kvaCapitalDiscountRate"));
kvaAlpha = parseReal(params_->get("xva", "kvaAlpha"));
kvaRegAdjustment = parseReal(params_->get("xva", "kvaRegAdjustment"));
kvaCapitalHurdle = parseReal(params_->get("xva", "kvaCapitalHurdle"));
kvaOurPdFloor = parseReal(params_->get("xva", "kvaOurPdFloor"));
kvaTheirPdFloor = parseReal(params_->get("xva", "kvaTheirPdFloor"));
kvaOurCvaRiskWeight = parseReal(params_->get("xva", "kvaOurCvaRiskWeight"));
kvaTheirCvaRiskWeight = parseReal(params_->get("xva", "kvaTheirCvaRiskWeight"));
}
if (analytics["mva"] || analytics["dim"]) {
dimQuantile = parseReal(params_->get("xva", "dimQuantile"));
dimHorizonCalendarDays = parseInteger(params_->get("xva", "dimHorizonCalendarDays"));
dimRegressionOrder = parseInteger(params_->get("xva", "dimRegressionOrder"));
string dimRegressorsString = params_->get("xva", "dimRegressors");
dimRegressors = parseListOfValues(dimRegressorsString);
// dimScaling = parseReal(params_->get("xva", "dimScaling"));
dimLocalRegressionEvaluations = parseInteger(params_->get("xva", "dimLocalRegressionEvaluations"));
dimLocalRegressionBandwidth = parseReal(params_->get("xva", "dimLocalRegressionBandwidth"));
}
string marketConfiguration = params_->get("markets", "simulation");
bool fullInitialCollateralisation = false;
if (params_->has("xva", "fullInitialCollateralisation")) {
fullInitialCollateralisation = parseBool(params_->get("xva", "fullInitialCollateralisation"));
}
analytics["flipViewXVA"] = false;
if (params_->has("xva", "flipViewXVA")) {
analytics["flipViewXVA"] = parseBool(params_->get("xva", "flipViewXVA"));
}
// FIXME: Needs the "simulation" section in ore.xml with consistent simulation.xml
if (!cubeInterpreter_) {
boost::shared_ptr<ScenarioGeneratorData> sgd = getScenarioGeneratorData();
if (sgd->withCloseOutLag())
cubeInterpreter_ = boost::make_shared<MporGridCubeInterpretation>(sgd->getGrid(), analytics["flipViewXVA"]);
else
cubeInterpreter_ = boost::make_shared<RegularCubeInterpretation>(analytics["flipViewXVA"]);
}
if (!dimCalculator_ && (analytics["mva"] || analytics["dim"])) {
ALOG("dim calculator not set, create RegressionDynamicInitialMarginCalculator");
dimCalculator_ = boost::make_shared<RegressionDynamicInitialMarginCalculator>(
portfolio_, cube_, cubeInterpreter_, scenarioData_, dimQuantile, dimHorizonCalendarDays, dimRegressionOrder,
dimRegressors, dimLocalRegressionEvaluations, dimLocalRegressionBandwidth);
}
std::vector<Period> cvaSensiGrid;
if (params_->has("xva", "cvaSensiGrid"))
cvaSensiGrid = parseListOfValues<Period>(params_->get("xva", "cvaSensiGrid"), &parsePeriod);
Real cvaSensiShiftSize = 0.0;
if (params_->has("xva", "cvaSensiShiftSize"))
cvaSensiShiftSize = parseReal(params_->get("xva", "cvaSensiShiftSize"));
string flipViewBorrowingCurvePostfix = "_BORROW";
string flipViewLendingCurvePostfix = "_LEND";
if (analytics["flipViewXVA"]) {
flipViewBorrowingCurvePostfix = params_->get("xva", "flipViewBorrowingCurvePostfix");
flipViewLendingCurvePostfix = params_->get("xva", "flipViewLendingCurvePostfix");
}
postProcess_ = boost::make_shared<PostProcess>(
portfolio_, netting, market_, marketConfiguration, cube_, scenarioData_, analytics, baseCurrency,
allocationMethod, marginalAllocationLimit, quantile, calculationType, dvaName, fvaBorrowingCurve,
fvaLendingCurve, dimCalculator_, cubeInterpreter_, fullInitialCollateralisation, cvaSensiGrid,
cvaSensiShiftSize, kvaCapitalDiscountRate, kvaAlpha, kvaRegAdjustment, kvaCapitalHurdle, kvaOurPdFloor,
kvaTheirPdFloor, kvaOurCvaRiskWeight, kvaTheirCvaRiskWeight, cptyCube_, flipViewBorrowingCurvePostfix,
flipViewLendingCurvePostfix);
}
void OREApp::writeXVAReports() {
MEM_LOG;
LOG("Writing XVA reports");
bool exposureByTrade = true;
if (params_->has("xva", "exposureProfilesByTrade"))
exposureByTrade = parseBool(params_->get("xva", "exposureProfilesByTrade"));
if (exposureByTrade) {
for (auto t : postProcess_->tradeIds()) {
ostringstream o;
o << outputPath_ << "/exposure_trade_" << t << ".csv";
string tradeExposureFile = o.str();
CSVFileReport tradeExposureReport(tradeExposureFile);
getReportWriter()->writeTradeExposures(tradeExposureReport, postProcess_, t);
}
}
for (auto n : postProcess_->nettingSetIds()) {
ostringstream o1;
o1 << outputPath_ << "/exposure_nettingset_" << n << ".csv";
string nettingSetExposureFile = o1.str();
CSVFileReport nettingSetExposureReport(nettingSetExposureFile);
getReportWriter()->writeNettingSetExposures(nettingSetExposureReport, postProcess_, n);
ostringstream o2;
o2 << outputPath_ << "/colva_nettingset_" << n << ".csv";
string nettingSetColvaFile = o2.str();
CSVFileReport nettingSetColvaReport(nettingSetColvaFile);
getReportWriter()->writeNettingSetColva(nettingSetColvaReport, postProcess_, n);
ostringstream o3;
o3 << outputPath_ << "/cva_sensitivity_nettingset_" << n << ".csv";
string nettingSetCvaSensiFile = o3.str();
CSVFileReport nettingSetCvaSensitivityReport(nettingSetCvaSensiFile);
getReportWriter()->writeNettingSetCvaSensitivities(nettingSetCvaSensitivityReport, postProcess_, n);
}
string XvaFile = outputPath_ + "/xva.csv";
CSVFileReport xvaReport(XvaFile);
getReportWriter()->writeXVA(xvaReport, params_->get("xva", "allocationMethod"), portfolio_, postProcess_);
map<string, string> nettingSetMap = portfolio_->nettingSetMap();
string rawCubeOutputFile = params_->get("xva", "rawCubeOutputFile");
if (rawCubeOutputFile != "") {
CubeWriter cw1(outputPath_ + "/" + rawCubeOutputFile);
cw1.write(postProcess_->cube(), nettingSetMap);
}
string netCubeOutputFile = params_->get("xva", "netCubeOutputFile");
if (netCubeOutputFile != "") {
CubeWriter cw2(outputPath_ + "/" + netCubeOutputFile);
cw2.write(postProcess_->netCube(), nettingSetMap);
}
LOG("XVA reports written");
MEM_LOG;
}
void OREApp::writeDIMReport() {
string dimFile1 = outputPath_ + "/" + params_->get("xva", "dimEvolutionFile");
vector<string> dimFiles2;
for (auto f : parseListOfValues(params_->get("xva", "dimRegressionFiles")))
dimFiles2.push_back(outputPath_ + "/" + f);
string nettingSet = params_->get("xva", "dimOutputNettingSet");
std::vector<Size> dimOutputGridPoints =
parseListOfValues<Size>(params_->get("xva", "dimOutputGridPoints"), &parseInteger);
ore::data::CSVFileReport dimEvolutionReport(dimFile1);
postProcess_->exportDimEvolution(dimEvolutionReport);
vector<boost::shared_ptr<ore::data::Report>> reportVec;
for (Size i = 0; i < dimOutputGridPoints.size(); ++i)
reportVec.push_back(boost::make_shared<ore::data::CSVFileReport>(dimFiles2[i]));
postProcess_->exportDimRegression(nettingSet, dimOutputGridPoints, reportVec);
}
void OREApp::buildMarket(const std::string& todaysMarketXML, const std::string& curveConfigXML,
const std::string& conventionsXML, const std::vector<string>& marketData,
const std::vector<string>& fixingData) {
MEM_LOG;
LOG("Building today's market");
if (conventionsXML == "")
getConventions();
else
conventions_->fromXMLString(conventionsXML);
if (todaysMarketXML == "")
getMarketParameters();
else
marketParameters_->fromXMLString(todaysMarketXML);
if (curveConfigXML != "")
curveConfigs_->fromXMLString(curveConfigXML);
else if (params_->has("setup", "curveConfigFile") && params_->get("setup", "curveConfigFile") != "") {
out_ << setw(tab_) << left << "Curve configuration... " << flush;
string inputPath = params_->get("setup", "inputPath");
string curveConfigFile = inputPath + "/" + params_->get("setup", "curveConfigFile");
LOG("Load curve configurations from file");
curveConfigs_->fromFile(curveConfigFile);
out_ << "OK" << endl;
} else {
WLOG("No curve configurations loaded");
}
string implyTodaysFixingsString = params_->get("setup", "implyTodaysFixings");
bool implyTodaysFixings = parseBool(implyTodaysFixingsString);
boost::shared_ptr<Loader> loader;
if (marketData.size() == 0 || fixingData.size() == 0) {
/*******************************
* Market and fixing data loader
*/
if (params_->has("setup", "marketDataFile") && params_->get("setup", "marketDataFile") != "") {
out_ << setw(tab_) << left << "Market data loader... " << flush;
string marketFileString = params_->get("setup", "marketDataFile");
vector<string> marketFiles = getFilenames(marketFileString, inputPath_);
string fixingFileString = params_->get("setup", "fixingDataFile");
vector<string> fixingFiles = getFilenames(fixingFileString, inputPath_);
vector<string> dividendFiles = {};
if (params_->has("setup", "dividendDataFile")) {
string dividendFileString = params_->get("setup", "dividendDataFile");
dividendFiles = getFilenames(dividendFileString, inputPath_);
}
loader = boost::make_shared<CSVLoader>(marketFiles, fixingFiles, dividendFiles, implyTodaysFixings);
out_ << "OK" << endl;
} else {
WLOG("No market data loaded from file");
}
} else {
LOG("Load market and fixing data from string vectors");
loader = boost::make_shared<InMemoryLoader>();
loadDataFromBuffers(*boost::static_pointer_cast<InMemoryLoader>(loader), marketData, fixingData,
implyTodaysFixings);
}
// add generated data to the loader (implied bond spreads, ...)
boost::shared_ptr<Loader> jointLoader;
auto generatedData = generateMarketData(loader);
if (generatedData != nullptr) {
jointLoader = boost::make_shared<CompositeLoader>(loader, generatedData);
} else {
jointLoader = loader;
}
// build market
out_ << setw(tab_) << left << "Market... " << flush;
market_ = boost::make_shared<TodaysMarket>(asof_, marketParameters_, jointLoader, curveConfigs_, conventions_,
continueOnError_, true, lazyMarketBuilding_, referenceData_, false,
iborFallbackConfig_);
out_ << "OK" << endl;
LOG("Today's market built");
MEM_LOG;
}
boost::shared_ptr<MarketImpl> OREApp::getMarket() const {
QL_REQUIRE(market_ != nullptr, "OREApp::getMarket(): original market is null");
return boost::dynamic_pointer_cast<MarketImpl>(market_);
}
boost::shared_ptr<EngineFactory> OREApp::buildEngineFactoryFromXMLString(const boost::shared_ptr<Market>& market,
const std::string& pricingEngineXML,
const bool generateAdditionalResults) {
DLOG("OREApp::buildEngineFactoryFromXMLString called");
if (pricingEngineXML == "")
return buildEngineFactory(market, "setup", generateAdditionalResults);
else {
boost::shared_ptr<EngineData> engineData = boost::make_shared<EngineData>();
engineData->fromXMLString(pricingEngineXML);
engineData->globalParameters()["GenerateAdditionalResults"] = generateAdditionalResults ? "true" : "false";
map<MarketContext, string> configurations;
configurations[MarketContext::irCalibration] = params_->get("markets", "lgmcalibration");
configurations[MarketContext::fxCalibration] = params_->get("markets", "fxcalibration");
configurations[MarketContext::pricing] = params_->get("markets", "pricing");
boost::shared_ptr<EngineFactory> factory =
boost::make_shared<EngineFactory>(engineData, market, configurations, getExtraEngineBuilders(),
getExtraLegBuilders(), referenceData_, iborFallbackConfig_);
return factory;
}
}
} // namespace analytics
} // namespace ore
| 25,031 |
986 | <filename>lib-src/libsndfile/tests/ogg_opus_test.c<gh_stars>100-1000
/*
** Copyright (C) 2007-2018 <NAME> <<EMAIL>>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "sfconfig.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#else
#include "sf_unistd.h"
#endif
#include <math.h>
#include <inttypes.h>
#include <sndfile.h>
#include "utils.h"
#define SAMPLE_RATE 48000
#define DATA_LENGTH (SAMPLE_RATE / 8)
typedef union
{ double d [DATA_LENGTH] ;
float f [DATA_LENGTH] ;
int i [DATA_LENGTH] ;
short s [DATA_LENGTH] ;
} BUFFER ;
static BUFFER data_out ;
static BUFFER data_in ;
static void
ogg_opus_short_test (void)
{ const char * filename = "ogg_opus_short.opus" ;
SNDFILE * file ;
SF_INFO sfinfo ;
short seek_data [10] ;
unsigned k ;
print_test_name ("ogg_opus_short_test", filename) ;
/* Generate float data. */
gen_windowed_sine_float (data_out.f, ARRAY_LEN (data_out.f), 1.0 * 0x7F00) ;
/* Convert to short. */
for (k = 0 ; k < ARRAY_LEN (data_out.s) ; k++)
data_out.s [k] = lrintf (data_out.f [k]) ;
memset (&sfinfo, 0, sizeof (sfinfo)) ;
/* Set up output file type. */
sfinfo.format = SF_FORMAT_OGG | SF_FORMAT_OPUS ;
sfinfo.channels = 1 ;
sfinfo.samplerate = SAMPLE_RATE ;
/* Write the output file. */
file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
test_write_short_or_die (file, 0, data_out.s, ARRAY_LEN (data_out.s), __LINE__) ;
sf_close (file) ;
/* Read the file in again. */
memset (&sfinfo, 0, sizeof (sfinfo)) ;
file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
test_read_short_or_die (file, 0, data_in.s, ARRAY_LEN (data_in.s), __LINE__) ;
sf_close (file) ;
puts ("ok") ;
/* Test seeking. */
print_test_name ("ogg_opus_seek_test", filename) ;
file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
test_seek_or_die (file, 10, SEEK_SET, 10, sfinfo.channels, __LINE__) ;
test_read_short_or_die (file, 0, seek_data, ARRAY_LEN (seek_data), __LINE__) ;
compare_short_or_die (seek_data, data_in.s + 10, ARRAY_LEN (seek_data), __LINE__) ;
/* Test seek to end of file. */
test_seek_or_die (file, 0, SEEK_END, sfinfo.frames, sfinfo.channels, __LINE__) ;
sf_close (file) ;
puts ("ok") ;
unlink (filename) ;
} /* ogg_opus_short_test */
static void
ogg_opus_int_test (void)
{ const char * filename = "ogg_opus_int.opus" ;
SNDFILE * file ;
SF_INFO sfinfo ;
int seek_data [10] ;
unsigned k ;
print_test_name ("ogg_opus_int_test", filename) ;
/* Generate float data. */
gen_windowed_sine_float (data_out.f, ARRAY_LEN (data_out.f), 1.0 * 0x7FFF0000) ;
/* Convert to integer. */
for (k = 0 ; k < ARRAY_LEN (data_out.i) ; k++)
data_out.i [k] = lrintf (data_out.f [k]) ;
memset (&sfinfo, 0, sizeof (sfinfo)) ;
/* Set up output file type. */
sfinfo.format = SF_FORMAT_OGG | SF_FORMAT_OPUS ;
sfinfo.channels = 1 ;
sfinfo.samplerate = SAMPLE_RATE ;
/* Write the output file. */
file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
test_write_int_or_die (file, 0, data_out.i, ARRAY_LEN (data_out.i), __LINE__) ;
sf_close (file) ;
/* Read the file in again. */
memset (&sfinfo, 0, sizeof (sfinfo)) ;
file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
test_read_int_or_die (file, 0, data_in.i, ARRAY_LEN (data_in.i), __LINE__) ;
sf_close (file) ;
puts ("ok") ;
/* Test seeking. */
print_test_name ("ogg_opus_seek_test", filename) ;
file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
test_seek_or_die (file, 10, SEEK_SET, 10, sfinfo.channels, __LINE__) ;
test_read_int_or_die (file, 0, seek_data, ARRAY_LEN (seek_data), __LINE__) ;
compare_int_or_die (seek_data, data_in.i + 10, ARRAY_LEN (seek_data), __LINE__) ;
sf_close (file) ;
puts ("ok") ;
unlink (filename) ;
} /* ogg_opus_int_test */
static void
ogg_opus_float_test (void)
{ const char * filename = "ogg_opus_float.opus" ;
SNDFILE * file ;
SF_INFO sfinfo ;
float seek_data [10] ;
print_test_name ("ogg_opus_float_test", filename) ;
gen_windowed_sine_float (data_out.f, ARRAY_LEN (data_out.f), 0.95) ;
memset (&sfinfo, 0, sizeof (sfinfo)) ;
/* Set up output file type. */
sfinfo.format = SF_FORMAT_OGG | SF_FORMAT_OPUS ;
sfinfo.channels = 1 ;
sfinfo.samplerate = SAMPLE_RATE ;
/* Write the output file. */
file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
test_write_float_or_die (file, 0, data_out.f, ARRAY_LEN (data_out.f), __LINE__) ;
sf_close (file) ;
/* Read the file in again. */
memset (&sfinfo, 0, sizeof (sfinfo)) ;
file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
test_read_float_or_die (file, 0, data_in.f, ARRAY_LEN (data_in.f), __LINE__) ;
sf_close (file) ;
puts ("ok") ;
/* Test seeking. */
print_test_name ("ogg_opus_seek_test", filename) ;
file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
test_seek_or_die (file, 10, SEEK_SET, 10, sfinfo.channels, __LINE__) ;
test_read_float_or_die (file, 0, seek_data, ARRAY_LEN (seek_data), __LINE__) ;
compare_float_or_die (seek_data, data_in.f + 10, ARRAY_LEN (seek_data), __LINE__) ;
sf_close (file) ;
puts ("ok") ;
unlink (filename) ;
} /* ogg_opus_float_test */
static void
ogg_opus_double_test (void)
{ const char * filename = "ogg_opus_double.opus" ;
SNDFILE * file ;
SF_INFO sfinfo ;
double seek_data [10] ;
print_test_name ("ogg_opus_double_test", filename) ;
gen_windowed_sine_double (data_out.d, ARRAY_LEN (data_out.d), 0.95) ;
memset (&sfinfo, 0, sizeof (sfinfo)) ;
/* Set up output file type. */
sfinfo.format = SF_FORMAT_OGG | SF_FORMAT_OPUS ;
sfinfo.channels = 1 ;
sfinfo.samplerate = SAMPLE_RATE ;
/* Write the output file. */
file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
test_write_double_or_die (file, 0, data_out.d, ARRAY_LEN (data_out.d), __LINE__) ;
sf_close (file) ;
/* Read the file in again. */
memset (&sfinfo, 0, sizeof (sfinfo)) ;
file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
test_read_double_or_die (file, 0, data_in.d, ARRAY_LEN (data_in.d), __LINE__) ;
sf_close (file) ;
puts ("ok") ;
/* Test seeking. */
print_test_name ("ogg_opus_seek_test", filename) ;
file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
test_seek_or_die (file, 10, SEEK_SET, 10, sfinfo.channels, __LINE__) ;
test_read_double_or_die (file, 0, seek_data, ARRAY_LEN (seek_data), __LINE__) ;
compare_double_or_die (seek_data, data_in.d + 10, ARRAY_LEN (seek_data), __LINE__) ;
sf_close (file) ;
puts ("ok") ;
unlink (filename) ;
} /* ogg_opus_double_test */
static void
ogg_opus_stereo_seek_test (const char * filename, int format)
{ static float data [SAMPLE_RATE] ;
static float stereo_out [SAMPLE_RATE * 2] ;
SNDFILE * file ;
SF_INFO sfinfo ;
sf_count_t pos ;
unsigned k ;
print_test_name (__func__, filename) ;
gen_windowed_sine_float (data, ARRAY_LEN (data), 0.95) ;
for (k = 0 ; k < ARRAY_LEN (data) ; k++)
{ stereo_out [2 * k] = data [k] ;
stereo_out [2 * k + 1] = data [ARRAY_LEN (data) - k - 1] ;
} ;
memset (&sfinfo, 0, sizeof (sfinfo)) ;
/* Set up output file type. */
sfinfo.format = format ;
sfinfo.channels = 2 ;
sfinfo.samplerate = SAMPLE_RATE ;
/* Write the output file. */
file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
test_write_float_or_die (file, 0, stereo_out, ARRAY_LEN (stereo_out), __LINE__) ;
sf_close (file) ;
/* Open file in again for reading. */
memset (&sfinfo, 0, sizeof (sfinfo)) ;
file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
/* Read in the whole file. */
test_read_float_or_die (file, 0, stereo_out, ARRAY_LEN (stereo_out), __LINE__) ;
/* Now hammer seeking code. */
test_seek_or_die (file, 234, SEEK_SET, 234, sfinfo.channels, __LINE__) ;
test_readf_float_or_die (file, 0, data, 10, __LINE__) ;
compare_float_or_die (data, stereo_out + (234 * sfinfo.channels), 10, __LINE__) ;
test_seek_or_die (file, 442, SEEK_SET, 442, sfinfo.channels, __LINE__) ;
test_readf_float_or_die (file, 0, data, 10, __LINE__) ;
compare_float_or_die (data, stereo_out + (442 * sfinfo.channels), 10, __LINE__) ;
test_seek_or_die (file, 12, SEEK_CUR, 442 + 10 + 12, sfinfo.channels, __LINE__) ;
test_readf_float_or_die (file, 0, data, 10, __LINE__) ;
compare_float_or_die (data, stereo_out + ((442 + 10 + 12) * sfinfo.channels), 10, __LINE__) ;
test_seek_or_die (file, 12, SEEK_CUR, 442 + 20 + 24, sfinfo.channels, __LINE__) ;
test_readf_float_or_die (file, 0, data, 10, __LINE__) ;
compare_float_or_die (data, stereo_out + ((442 + 20 + 24) * sfinfo.channels), 10, __LINE__) ;
pos = 500 - sfinfo.frames ;
test_seek_or_die (file, pos, SEEK_END, 500, sfinfo.channels, __LINE__) ;
test_readf_float_or_die (file, 0, data, 10, __LINE__) ;
compare_float_or_die (data, stereo_out + (500 * sfinfo.channels), 10, __LINE__) ;
pos = 10 - sfinfo.frames ;
test_seek_or_die (file, pos, SEEK_END, 10, sfinfo.channels, __LINE__) ;
test_readf_float_or_die (file, 0, data, 10, __LINE__) ;
compare_float_or_die (data, stereo_out + (10 * sfinfo.channels), 10, __LINE__) ;
sf_close (file) ;
puts ("ok") ;
unlink (filename) ;
} /* ogg_opus_stereo_seek_test */
static void
ogg_opus_original_samplerate_test (void)
{ const char * filename = "ogg_opus_original_samplerate.opus" ;
SNDFILE * file ;
SF_INFO sfinfo ;
int original_samplerate = 54321 ;
sf_count_t frames ;
print_test_name ("ogg_opus_original_samplerate_test", filename) ;
gen_windowed_sine_double (data_out.d, ARRAY_LEN (data_out.d), 0.95) ;
memset (&sfinfo, 0, sizeof (sfinfo)) ;
/* Set up output file type. */
sfinfo.format = SF_FORMAT_OGG | SF_FORMAT_OPUS ;
sfinfo.channels = 1 ;
sfinfo.samplerate = SAMPLE_RATE ;
/* Write the output file. */
file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
if (sf_command (file, SFC_SET_ORIGINAL_SAMPLERATE, &original_samplerate, sizeof (original_samplerate)) != SF_TRUE)
{ printf ("\nCommand SFC_SET_ORIGINAL_SAMPLERATE failed!\n") ;
exit (1) ;
} ;
test_write_double_or_die (file, 0, data_out.d, ARRAY_LEN (data_out.d), __LINE__) ;
if (sf_command (file, SFC_SET_ORIGINAL_SAMPLERATE, &original_samplerate, sizeof (original_samplerate)) != SF_FALSE)
{ printf ("\nCommand SFC_SET_ORIGINAL_SAMPLERATE succeeded when it should have failed!") ;
exit (1) ;
} ;
sf_close (file) ;
/* Read the file in again. */
memset (&sfinfo, 0, sizeof (sfinfo)) ;
original_samplerate = 0 ;
file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
if (sf_command (file, SFC_GET_ORIGINAL_SAMPLERATE, &original_samplerate, sizeof (original_samplerate)) != SF_TRUE
|| original_samplerate != 54321)
{ printf ("\nCommand SFC_GET_ORIGINAL_SAMPLERATE failed!\n") ;
exit (1) ;
} ;
test_read_double_or_die (file, 0, data_in.d, 8, __LINE__) ;
if (sf_command (file, SFC_SET_ORIGINAL_SAMPLERATE, &original_samplerate, sizeof (original_samplerate)) == SF_TRUE)
{ printf ("\nCommand SFC_SET_ORIGINAL_SAMPLERATE succeeded when it should have failed!\n") ;
exit (1) ;
} ;
sf_close (file) ;
/* Test changing the decoder. */
file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
frames = sfinfo.frames ;
original_samplerate = 16000 ;
if (sf_command (file, SFC_SET_ORIGINAL_SAMPLERATE, &original_samplerate, sizeof (original_samplerate)) != SF_TRUE)
{ printf ("\nCommand SFC_SET_ORIGINAL_SAMPLERATE failed!\n") ;
exit (1) ;
} ;
if (sf_command (file, SFC_GET_CURRENT_SF_INFO, &sfinfo, sizeof (sfinfo)))
{ printf ("\nCommand SFC_GET_CURRENT_SF_INFO failed!\n") ;
exit (1) ;
} ;
if (frames / (48000 / 16000) != sfinfo.frames)
{ printf ("\nIncorrect frame count! (%" PRId64 " vs %" PRId64")\n", frames / (48000 / 16000), sfinfo.frames) ;
exit (1) ;
} ;
test_read_double_or_die (file, 0, data_out.d, sfinfo.frames, __LINE__) ;
sf_close (file) ;
puts ("ok") ;
unlink (filename) ;
} /* ogg_opus_original_samplerate_test */
int
main (void)
{
if (HAVE_EXTERNAL_XIPH_LIBS)
{ ogg_opus_short_test () ;
ogg_opus_int_test () ;
ogg_opus_float_test () ;
ogg_opus_double_test () ;
ogg_opus_stereo_seek_test ("ogg_opus_seek.opus", SF_FORMAT_OGG | SF_FORMAT_OPUS) ;
ogg_opus_original_samplerate_test () ;
}
else
puts (" No Ogg/Opus tests because Ogg/Opus support was not compiled in.") ;
return 0 ;
} /* main */
| 5,508 |
335 | <gh_stars>100-1000
{
"word": "Swift",
"definitions": [
"Happening quickly or promptly.",
"Moving or capable of moving at high speed."
],
"parts-of-speech": "Adjective"
} | 87 |
2,326 | //
// Copyright RIME Developers
// Distributed under the BSD License
//
// 2013-07-02 <NAME> <<EMAIL>>
//
#ifndef RIME_FORMATTER_H_
#define RIME_FORMATTER_H_
#include <rime/common.h>
#include <rime/component.h>
#include <rime/ticket.h>
namespace rime {
class Engine;
class Formatter : public Class<Formatter, const Ticket&> {
public:
Formatter(const Ticket& ticket)
: engine_(ticket.engine), name_space_(ticket.name_space) {}
virtual ~Formatter() = default;
virtual void Format(string* text) = 0;
protected:
Engine* engine_;
string name_space_;
};
} // namespace rime
#endif // RIME_FORMATTER_H_
| 228 |
1,809 | <filename>java/src/main/java/com/d_project/qrcode/BitBuffer.java
package com.d_project.qrcode;
/**
* BitBuffer
* @author <NAME>
*/
class BitBuffer {
private byte[] buffer;
private int length;
private int inclements;
public BitBuffer() {
inclements = 32;
buffer = new byte[inclements];
length = 0;
}
public byte[] getBuffer() {
return buffer;
}
public int getLengthInBits() {
return length;
}
public String toString() {
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < getLengthInBits(); i++) {
buffer.append(get(i)? '1' : '0');
}
return buffer.toString();
}
private boolean get(int index) {
return ( (buffer[index / 8] >>> (7 - index % 8) ) & 1) == 1;
}
public void put(int num, int length) {
for (int i = 0; i < length; i++) {
put( ( (num >>> (length - i - 1) ) & 1) == 1);
}
}
public void put(boolean bit) {
if (length == buffer.length * 8) {
byte[] newBuffer = new byte[buffer.length + inclements];
System.arraycopy(buffer, 0, newBuffer, 0, buffer.length);
buffer = newBuffer;
}
if (bit) {
buffer[length / 8] |= (0x80 >>> (length % 8) );
}
length++;
}
}
| 489 |
957 | <reponame>OscarZero/netBare<filename>netbare-core/src/main/java/com/github/megatronking/netbare/ssl/SSLRefluxCallback.java<gh_stars>100-1000
/* NetBare - An android network capture and injection library.
* Copyright (C) 2018-2019 <NAME>
* Copyright (C) 2018-2019 GuoShi
*
* NetBare 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 Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* NetBare 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 NetBare.
* If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.megatronking.netbare.ssl;
import com.github.megatronking.netbare.gateway.Request;
import com.github.megatronking.netbare.gateway.Response;
import java.io.IOException;
import java.nio.ByteBuffer;
/**
* A callback to receive SSL plaintext packets and input them to {@link javax.net.ssl.SSLEngine}.
*
* @author <NAME>
* @since 2018-11-15 14:35
*/
public interface SSLRefluxCallback<Req extends Request, Res extends Response> {
void onRequest(Req request, ByteBuffer buffer) throws IOException;
void onResponse(Res response, ByteBuffer buffer) throws IOException;
}
| 457 |
11,811 | /*
* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
package org.antlr.v4.codegen.model;
import org.antlr.v4.codegen.OutputModelFactory;
import org.antlr.v4.runtime.misc.IntervalSet;
import org.antlr.v4.tool.ast.GrammarAST;
/** */
public class ThrowRecognitionException extends SrcOp {
public int decision;
public String grammarFile;
public int grammarLine;
public int grammarCharPosInLine;
public ThrowRecognitionException(OutputModelFactory factory, GrammarAST ast, IntervalSet expecting) {
super(factory, ast);
//this.decision = ((BlockStartState)ast.ATNState).decision;
grammarLine = ast.getLine();
grammarLine = ast.getCharPositionInLine();
grammarFile = factory.getGrammar().fileName;
//this.expecting = factory.createExpectingBitSet(ast, decision, expecting, "error");
// factory.defineBitSet(this.expecting);
}
}
| 325 |
2,382 | from matplotlib import pyplot
from shapely.geometry import Point
from descartes import PolygonPatch
from figures import SIZE, BLUE, GRAY, set_limits
fig = pyplot.figure(1, figsize=SIZE, dpi=90)
a = Point(1, 1).buffer(1.5)
b = Point(2, 1).buffer(1.5)
# 1
ax = fig.add_subplot(121)
patch1 = PolygonPatch(a, fc=GRAY, ec=GRAY, alpha=0.2, zorder=1)
ax.add_patch(patch1)
patch2 = PolygonPatch(b, fc=GRAY, ec=GRAY, alpha=0.2, zorder=1)
ax.add_patch(patch2)
c = a.intersection(b)
patchc = PolygonPatch(c, fc=BLUE, ec=BLUE, alpha=0.5, zorder=2)
ax.add_patch(patchc)
ax.set_title('a.intersection(b)')
set_limits(ax, -1, 4, -1, 3)
#2
ax = fig.add_subplot(122)
patch1 = PolygonPatch(a, fc=GRAY, ec=GRAY, alpha=0.2, zorder=1)
ax.add_patch(patch1)
patch2 = PolygonPatch(b, fc=GRAY, ec=GRAY, alpha=0.2, zorder=1)
ax.add_patch(patch2)
c = a.symmetric_difference(b)
if c.geom_type == 'Polygon':
patchc = PolygonPatch(c, fc=BLUE, ec=BLUE, alpha=0.5, zorder=2)
ax.add_patch(patchc)
elif c.geom_type == 'MultiPolygon':
for p in c:
patchp = PolygonPatch(p, fc=BLUE, ec=BLUE, alpha=0.5, zorder=2)
ax.add_patch(patchp)
ax.set_title('a.symmetric_difference(b)')
set_limits(ax, -1, 4, -1, 3)
pyplot.show()
| 584 |
3,428 | /**
* @license Apache-2.0
*
* Copyright (c) 2021 The Stdlib Authors.
*
* 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 "stdlib/math/base/ops/cadd.h"
#include "stdlib/complex/float64.h"
#include "stdlib/complex/reim.h"
/**
* Adds two double-precision complex floating-point numbers.
*
* @param z1 input value
* @param z2 input value
* @return result
*
* @example
* #include "stdlib/complex/float64.h"
* #include "stdlib/complex/real.h"
* #include "stdlib/complex/imag.h"
*
* stdlib_complex128_t z = stdlib_complex128( 3.0, -2.0 );
*
* stdlib_complex128_t out = stdlib_base_cadd( z, z );
*
* double re = stdlib_real( out );
* // returns 6.0
*
* double im = stdlib_imag( out );
* // returns -4.0
*/
stdlib_complex128_t stdlib_base_cadd( const stdlib_complex128_t z1, const stdlib_complex128_t z2 ) {
double re1;
double re2;
double im1;
double im2;
double re;
double im;
stdlib_reim( z1, &re1, &im1 );
stdlib_reim( z2, &re2, &im2 );
re = re1 + re2;
im = im1 + im2;
return stdlib_complex128( re, im );
}
| 569 |
1,744 | <reponame>jalcoriza/got-your-back
mappings = {
# af (1/73)
'INKASSIE': 'INBOX',
'ASBLIK': 'TRASH',
'BELANGRIK': 'IMPORTANT',
'GESTER': 'STARRED',
'GESTUURDE E-POS': 'SENT',
'KONSEPTE': 'DRAFT',
'STROOIPOS': 'SPAM',
# az (2/73)
'GƏLƏNLƏR': 'INBOX',
'GÖNDƏRILƏNLƏR': 'SENT',
'QARALAMALAR': 'DRAFT',
'ULDUZLU': 'STARRED',
'ZIBIL QUTUSU': 'TRASH',
'ÖNƏMLI': 'IMPORTANT',
# id (3/73)
'KOTAK MASUK': 'INBOX',
'BERBINTANG': 'STARRED',
'DRAF': 'DRAFT',
'PENTING': 'IMPORTANT',
'SURAT TERKIRIM': 'SENT',
'TONG SAMPAH': 'TRASH',
# ms (4/73)
'PETI MASUK': 'INBOX',
'DIBINTANGKAN': 'STARRED',
'DRAF': 'DRAFT',
'MEL DIHANTAR': 'SENT',
'PENTING': 'IMPORTANT',
'SAMPAH': 'TRASH',
# ca (5/73)
'SAFATA D’ENTRADA': 'INBOX',
'CORREU BROSSA': 'SPAM',
'ENVIATS': 'SENT',
'ESBORRANYS': 'DRAFT',
'IMPORTANTS': 'IMPORTANT',
'MISSATGES DESTACATS': 'STARRED',
'PAPERERA': 'TRASH',
# cs (6/73)
'DORUČENÁ POŠTA': 'INBOX',
'DŮLEŽITÉ': 'IMPORTANT',
'KONCEPTY': 'DRAFT',
'KOŠ': 'TRASH',
'ODESLANÁ POŠTA': 'SENT',
'S HVĚZDIČKOU': 'STARRED',
# cy (7/73)
'BLWCH DERBYN': 'INBOX',
'BIN SBWRIEL': 'TRASH',
'DRAFFT': 'DRAFT',
'E-BOST SOTHACH': 'SPAM',
'NEGESEUON A ANFONWYD': 'SENT',
'PWYSIG': 'IMPORTANT',
'SERENNOG': 'STARRED',
# da (8/73)
'INDBAKKE': 'INBOX',
'KLADDER': 'DRAFT',
'PAPIRKURV': 'TRASH',
'SENDTE MAILS': 'SENT',
'STJERNEMARKEREDE': 'STARRED',
'VIGTIGT': 'IMPORTANT',
# de (9/73)
'POSTEINGANG': 'INBOX',
'ENTWÜRFE': 'DRAFT',
'GESENDET': 'SENT',
'MARKIERT': 'STARRED',
'PAPIERKORB': 'TRASH',
'WICHTIG': 'IMPORTANT',
# et (10/73)
'POSTKAST': 'INBOX',
'MUSTANDID': 'DRAFT',
'OLULINE': 'IMPORTANT',
'PRÜGIKAST': 'TRASH',
'RÄMPSPOST': 'SPAM',
'SAADETUD KIRJAD': 'SENT',
'TÄRNIGA': 'STARRED',
# en-GB (11/73)
'BIN': 'TRASH',
'DRAFTS': 'DRAFT',
'SENT MAIL': 'SENT',
# en (12/73)
'DRAFTS': 'DRAFT',
'SENT MAIL': 'SENT',
# es (13/73)
'RECIBIDOS': 'INBOX',
'BORRADORES': 'DRAFT',
'DESTACADOS': 'STARRED',
'ENVIADOS': 'SENT',
'IMPORTANTES': 'IMPORTANT',
'PAPELERA': 'TRASH',
# es-419 (14/73)
'RECIBIDOS': 'INBOX',
'BORRADORES': 'DRAFT',
'DESTACADOS': 'STARRED',
'ENVIADOS': 'SENT',
'IMPORTANTES': 'IMPORTANT',
'PAPELERA': 'TRASH',
# eu (15/73)
'SARRERA-ONTZIA': 'INBOX',
'<NAME>': 'SENT',
'GARRANTZITSUAK': 'IMPORTANT',
'IZARDUNAK': 'STARRED',
'SPAMA': 'SPAM',
'ZABORRONTZIA': 'TRASH',
'ZIRRIBORROAK': 'DRAFT',
# fil (16/73)
'MAHALAGA': 'IMPORTANT',
'MAY-BITUIN': 'STARRED',
'MGA DRAFT': 'DRAFT',
'<NAME>': 'SENT',
# fr (17/73)
'BOÎTE DE RÉCEPTION': 'INBOX',
'BROUILLONS': 'DRAFT',
'CORBEILLE': 'TRASH',
'MESSAGES ENVOYÉS': 'SENT',
'SUIVIS': 'STARRED',
# fr-CA (18/73)
'BOÎTE DE RÉCEPTION': 'INBOX',
'BROUILLONS': 'DRAFT',
'CORBEILLE': 'TRASH',
'FAVORIS': 'STARRED',
'IMPORTANTS': 'IMPORTANT',
'MESSAGES ENVOYÉS': 'SENT',
'POURRIEL': 'SPAM',
# ga (19/73)
'BOSCA ISTEACH': 'INBOX',
'BRUSCAR': 'TRASH',
'DRÉACHTAÍ': 'DRAFT',
'LE RÉILTÍN': 'STARRED',
'SEOLTA': 'SENT',
'TURSCAR': 'SPAM',
'TÁBHACHTACH': 'IMPORTANT',
# gl (20/73)
'CAIXA DE ENTRADA': 'INBOX',
'BORRADORES': 'DRAFT',
'CAIXA DA PAPELEIRA': 'TRASH',
'CORREO ENVIADO': 'SENT',
'IMPORTANTES': 'IMPORTANT',
'MARCADO CON ESTRELA': 'STARRED',
# hr (21/73)
'PRISTIGLA POŠTA': 'INBOX',
'NEŽELJENA POŠTA': 'SPAM',
'OTPAD': 'TRASH',
'POSLANA POŠTA': 'SENT',
'SA ZVJEZDICOM': 'STARRED',
'SKICE': 'DRAFT',
'VAŽNO': 'IMPORTANT',
# it (22/73)
'POSTA IN ARRIVO': 'INBOX',
'BOZZE': 'DRAFT',
'CESTINO': 'TRASH',
'IMPORTANTI': 'IMPORTANT',
'POSTA INVIATA': 'SENT',
'SPECIALI': 'STARRED',
# zu (23/73)
'IBHOKISI LOKUNGENAYO': 'INBOX',
'IMEYILI ETHUNYELWE': 'SENT',
'OKUBALULEKILE': 'IMPORTANT',
'OKUNENKANYEZI': 'STARRED',
'OKUNGAPHELELE': 'DRAFT',
'UDOTI': 'TRASH',
'UGAXEKILE': 'SPAM',
# is (24/73)
'PÓSTHÓLF': 'INBOX',
'DRÖG': 'DRAFT',
'MIKILVÆGT': 'IMPORTANT',
'RUSL': 'TRASH',
'RUSLPÓSTUR': 'SPAM',
'SENDUR PÓSTUR': 'SENT',
'STJÖRNUMERKT': 'STARRED',
# sw (25/73)
'KIKASHA': 'INBOX',
'BARUA ZILIZOTUMWA': 'SENT',
'BARUA TAKA': 'SPAM',
'MUHIMU': 'IMPORTANT',
'RASIMU': 'DRAFT',
'TUPIO': 'TRASH',
'ZENYE NYOTA': 'STARRED',
# lv (26/73)
'IESŪTNE': 'INBOX',
'AR ZVAIGZNĪTI': 'STARRED',
'MELNRAKSTI': 'DRAFT',
'MISKASTE': 'TRASH',
'MĒSTULES': 'SPAM',
'NOSŪTNE': 'SENT',
'SVARĪGI': 'IMPORTANT',
# lt (27/73)
'GAUTIEJI': 'INBOX',
'IŠSIŲSTI LAIŠKAI': 'SENT',
'JUODRAŠČIAI': 'DRAFT',
'PAŽYMĖTI ŽVAIGŽDUTE': 'STARRED',
'SVARBU': 'IMPORTANT',
'ŠIUKŠLIADĖŽĖ': 'TRASH',
'ŠLAMŠTAS': 'SPAM',
# hu (28/73)
'GAUTIEJI': 'INBOX',
'IŠSIŲSTI LAIŠKAI': 'SENT',
'JUODRAŠČIAI': 'DRAFT',
'PAŽYMĖTI ŽVAIGŽDUTE': 'STARRED',
'SVARBU': 'IMPORTANT',
'ŠIUKŠLIADĖŽĖ': 'TRASH',
'ŠLAMŠTAS': 'SPAM',
# no (29/73)
'INNBOKS': 'INBOX',
'PAPIRKURV': 'TRASH',
'SENDT E-POST': 'SENT',
'STJERNEMERKET': 'STARRED',
'SØPPELPOST': 'SPAM',
'UTKAST': 'DRAFT',
'VIKTIG': 'IMPORTANT',
# nl (30/73)
'BELANGRIJK': 'IMPORTANT',
'CONCEPTEN': 'DRAFT',
'MET STER': 'STARRED',
'PRULLENBAK': 'TRASH',
'VERZONDEN BERICHTEN': 'SENT',
# pl (31/73)
'ODEBRANE': 'INBOX',
'KOSZ': 'TRASH',
'OZNACZONE GWIAZDKĄ': 'STARRED',
'WAŻNE': 'IMPORTANT',
'WERSJE ROBOCZE': 'DRAFT',
'WYSŁANE': 'SENT',
# pt-BR (32/73)
'CAIXA DE ENTRADA': 'INBOX',
'COM ESTRELA': 'STARRED',
'E-MAILS ENVIADOS': 'SENT',
'IMPORTANTE': 'IMPORTANT',
'LIXEIRA': 'TRASH',
'RASCUNHOS': 'DRAFT',
# pt-PT (33/73)
'CAIXA DE ENTRADA': 'INBOX',
'CAIXOTE DO LIXO': 'TRASH',
'COM ESTRELA': 'STARRED',
'CORREIO ENVIADO': 'SENT',
'IMPORTANTE': 'IMPORTANT',
'RASCUNHOS': 'DRAFT',
# ro (34/73)
'MESAJE PRIMITE': 'INBOX',
'COȘ DE GUNOI': 'TRASH',
'IMPORTANTE': 'IMPORTANT',
'MESAJE IMPORTANTE': 'STARRED',
'MESAJE NEFINALIZATE': 'DRAFT',
'MESAJE TRIMISE': 'SENT',
# sk (35/73)
'DORUČENÉ': 'INBOX',
'DÔLEŽITÉ': 'IMPORTANT',
'KÔŠ': 'TRASH',
'ODOSLANÉ': 'SENT',
'ROZPÍSANÉ SPRÁVY': 'DRAFT',
'S HVIEZDIČKOU': 'STARRED',
# sl (36/73)
'PREJETO': 'INBOX',
'OSNUTKI': 'DRAFT',
'POMEMBNO': 'IMPORTANT',
'POSLANO': 'SENT',
'SMETNJAK': 'TRASH',
'VSILJENA POŠTA': 'SPAM',
'Z ZVEZDICO': 'STARRED',
# fi (37/73)
'POSTILAATIKKO': 'INBOX',
'LUONNOKSET': 'DRAFT',
'LÄHETETYT VIESTIT': 'SENT',
'ROSKAKORI': 'TRASH',
'ROSKAPOSTI': 'SPAM',
'TÄHDELLÄ MERKITYT': 'STARRED',
'TÄRKEÄÄ': 'IMPORTANT',
# sv (38/73)
'INKORGEN': 'INBOX',
'PAPPERSKORGEN': 'TRASH',
'SKICKAT': 'SENT',
'SKRÄPPOST': 'SPAM',
'STJÄRNMÄRKTA': 'STARRED',
'UTKAST': 'DRAFT',
'VIKTIGT': 'IMPORTANT',
# vi (39/73)
'HỘP THƯ ĐẾN': 'INBOX',
'QUAN TRỌNG': 'IMPORTANT',
'THÙNG RÁC': 'TRASH',
'THƯ GẮN DẤU SAO': 'STARRED',
'THƯ NHÁP': 'DRAFT',
'THƯ ĐÃ GỬI': 'SENT',
# tr (40/73)
'GELEN KUTUSU': 'INBOX',
'GÖNDERILMIŞ POSTALAR': 'SENT',
'TASLAKLAR': 'DRAFT',
'YILDIZLI': 'STARRED',
'ÇÖP KUTUSU': 'TRASH',
'ÖNEMLI': 'IMPORTANT',
# el (41/73)
'ΑΝΕΠΙΘΎΜΗΤΑ': 'SPAM',
'ΑΠΕΣΤΑΛΜΈΝΑ': 'SENT',
'ΚΆΔΟΣ ΑΠΟΡΡΙΜΜΆΤΩΝ': 'TRASH',
'ΜΕ ΑΣΤΈΡΙ': 'STARRED',
'ΠΡΌΧΕΙΡΑ': 'DRAFT',
'ΣΗΜΑΝΤΙΚΆ': 'IMPORTANT',
'ΕΙΣΕΡΧΌΜΕΝΑ': 'INBOX',
# bg (42/73)
'ВАЖНО': 'IMPORTANT',
'ИЗПРАТЕНИ': 'SENT',
'КОШЧЕ': 'TRASH',
'СПАМ': 'SPAM',
'СЪС ЗВЕЗДА': 'STARRED',
'ЧЕРНОВИ': 'DRAFT',
'ВХ. ПОЩА': 'INBOX',
# mn (43/73)
'ИЛГЭЭСЭН ИМЭЙЛ': 'SENT',
'НООРГУУД': 'DRAFT',
'ОДТОЙ': 'STARRED',
'СПАМ': 'SPAM',
'ХОГИЙН САВ': 'TRASH',
'ЧУХАЛ': 'IMPORTANT',
'ИРСЭН ИМЭЙЛ': 'INBOX',
# ru (44/73)
'ВАЖНОЕ': 'IMPORTANT',
'КОРЗИНА': 'TRASH',
'ОТПРАВЛЕННЫЕ': 'SENT',
'ПОМЕЧЕННЫЕ': 'STARRED',
'СПАМ': 'SPAM',
'ЧЕРНОВИКИ': 'DRAFT',
'ВХОДЯЩИЕ': 'INBOX',
# sr (45/73)
'ВАЖНО': 'IMPORTANT',
'НЕДОВРШЕНЕ': 'DRAFT',
'НЕПОЖЕЉНЕ': 'SPAM',
'ОТПАД': 'TRASH',
'ПОСЛАТЕ': 'SENT',
'СА ЗВЕЗДИЦОМ': 'STARRED',
'ПРИМЉЕНЕ': 'INBOX',
# uk (46/73)
'ІЗ ЗІРОЧКОЮ': 'STARRED',
'ВАЖЛИВО': 'IMPORTANT',
'КОШИК': 'TRASH',
'НАДІСЛАНІ': 'SENT',
'СПАМ': 'SPAM',
'ЧЕРНЕТКИ': 'DRAFT',
'ВХІДНІ': 'INBOX',
# hy (47/73)
'ԱՂԲԱՐԿՂ': 'TRASH',
'ԱՍՏՂԱՆՇՎԱԾ': 'STARRED',
'ԿԱՐԵՒՈՐ': 'IMPORTANT',
'ՈՒՂԱՐԿՎԱԾ': 'SENT',
'ՍՊԱՄ': 'SPAM',
'ՍԵՒԱԳՐԵՐ': 'DRAFT',
'ՄՈՒՏՔԻ ԱՐԿՂ': 'INBOX',
# he (48/73)
'אשפה': 'TRASH',
'דואר יוצא': 'SENT',
'חשוב': 'IMPORTANT',
'טיוטות': 'DRAFT',
'מסומן בכוכב': 'STARRED',
'ספאם': 'SPAM',
'דואר נכנס': 'INBOX',
# ur (49/73)
'اہم': 'IMPORTANT',
'بھیجے گئے پیغامات': 'SENT',
'ستارے کے نشان والے': 'STARRED',
'سپام': 'SPAM',
'مسودہ س': 'DRAFT',
'کوڑے کی ٹوکری': 'TRASH',
'موصول شدہ پیغامات': 'INBOX',
# ar (50/73)
'الرسائل المميزة بنجمة': 'STARRED',
'الرسائل غير المرغوب فيها': 'SPAM',
'المهـملات': 'TRASH',
'بريد مرسل': 'SENT',
'مسودّات': 'DRAFT',
'مهم': 'IMPORTANT',
'البريد الوارد': 'INBOX',
# fa (51/73)
'حذفشدهها': 'TRASH',
'ستارهدار': 'STARRED',
'مهم': 'IMPORTANT',
'نامههای فرستاده شده': 'SENT',
'هرزنامه': 'SPAM',
'پیشنویسها': 'DRAFT',
'صندوق ورودی': 'INBOX',
# ne (52/73)
'ड्राफ्ट': 'DRAFT',
'ताराङ्कित': 'STARRED',
'पठाइएको मेल': 'SENT',
'महत्त्वपूर्ण': 'IMPORTANT',
'रद्दी टोकरी': 'TRASH',
'स्प्याम': 'SPAM',
'इनबक्स': 'INBOX',
# mr (53/73)
'तारांकित': 'STARRED',
'पाठवलेले मेल': 'SENT',
'मसुदे': 'DRAFT',
'महत्त्वाचे': 'IMPORTANT',
'वगळलेले': 'TRASH',
'स्पॅम': 'SPAM',
'इनबॉक्स': 'INBOX',
# hi (54/73)
'अधूरा ईमेल': 'DRAFT',
'अनचाहा': 'SPAM',
'कूड़ेदान': 'TRASH',
'भेजी गई मेल': 'SENT',
'महत्वपूर्ण': 'IMPORTANT',
'स्टार के निशान वाला': 'STARRED',
'इनबॉक्स': 'INBOX',
# bn (55/73)
'গুরুত্বপূর্ণ': 'IMPORTANT',
'ট্র্যাশ': 'TRASH',
'ড্রাফ্ট': 'DRAFT',
'তারকাচিহ্নিত': 'STARRED',
'প্রেরিত মেল': 'SENT',
'স্প্যাম': 'SPAM',
'ইনবক্স': 'INBOX',
# gu (56/73)
'ટ્રેશ': 'TRASH',
'ડ્રાફ્ટ્સ': 'DRAFT',
'તારાંકિત': 'STARRED',
'મહત્વપૂર્ણ': 'IMPORTANT',
'મોકલેલા મેઇલ': 'SENT',
'સ્પામ': 'SPAM',
'ઇનબોકસ': 'INBOX',
# ta (57/73)
'அனுப்பிய அஞ்சல்': 'SENT',
'நட்சத்திரமிட்டது': 'STARRED',
'நீக்கப்பட்டவை': 'TRASH',
'முக்கியமானவை': 'IMPORTANT',
'வரைவுகள்': 'DRAFT',
'ஸ்பேம்': 'SPAM',
'இன்பாக்ஸ்': 'INBOX',
# te (58/73)
'చిత్తుప్రతులు': 'DRAFT',
'ట్రాష్': 'TRASH',
'నక్షత్రం గుర్తుతో': 'STARRED',
'పంపిన సందేశాలు': 'SENT',
'ముఖ్యమైన': 'IMPORTANT',
'స్పామ్': 'SPAM',
'ఇన్బాక్స్': 'INBOX',
# kn (59/73)
'ಅನುಪಯುಕ್ತ': 'TRASH',
'ಕಳುಹಿಸಿದ ಮೇಲ್': 'SENT',
'ಡ್ರಾಫ್ಟ್ಗಳು': 'DRAFT',
'ನಕ್ಷತ್ರ ಹಾಕಿದ': 'STARRED',
'ಪ್ರಮುಖ': 'IMPORTANT',
'ಸ್ಪ್ಯಾಮ್': 'SPAM',
'ಇನ್ಬಾಕ್ಸ್': 'INBOX',
# ml (60/73)
'അയച്ച മെയിൽ': 'SENT',
'ട്രാഷ്': 'TRASH',
'ഡ്രാഫ്റ്റുകൾ': 'DRAFT',
'നക്ഷത്രമിട്ടവ': 'STARRED',
'പ്രധാനപ്പെട്ടവ': 'IMPORTANT',
'സ്പാം': 'SPAM',
'ഇൻബോക്സ്': 'INBOX',
# si (61/73)
'අපද්රව්ය': 'TRASH',
'අයාචිත තැපෑල': 'SPAM',
'කටු සටහන්': 'DRAFT',
'තරු ලකුණු කළ': 'STARRED',
'යැවූ ලිපි': 'SENT',
'වැදගත්': 'IMPORTANT',
'එන ලිපි': 'INBOX',
# th (62/73)
'จดหมายขยะ': 'SPAM',
'จดหมายที่ส่งแล้ว': 'SENT',
'ติดดาว': 'STARRED',
'ถังขยะ': 'TRASH',
'ร่างจดหมาย': 'DRAFT',
'สำคัญ': 'IMPORTANT',
'กล่องจดหมาย': 'INBOX',
# lo (63/73)
'ຈົດໝາຍທີ່ສົ່ງແລ້ວ': 'SENT',
'ຕິດດາວ': 'STARRED',
'ຖັງຂີ້ເຫຍື້ອ': 'TRASH',
'ສະບັບຮ່າງ': 'DRAFT',
'ສະແປມ': 'SPAM',
'ສຳຄັນ': 'IMPORTANT',
'ອິນບັອກ': 'INBOX',
# my (64/73)
'စတားတပ်ထားသော': 'STARRED',
'စပမ်း': 'SPAM',
'ထွက်စာ': 'SENT',
'မူကြမ်းများ': 'DRAFT',
'အမှိုက်ပုံး': 'TRASH',
'အရေးကြီး': 'IMPORTANT',
'ဝင်စာ': 'INBOX',
# ka (65/73)
'ᲒᲐᲒᲖᲐᲕᲜᲘᲚᲔᲑᲘ': 'SENT',
'ᲕᲐᲠᲡᲙᲕᲚᲐᲕᲘᲐᲜᲘ': 'STARRED',
'ᲛᲜᲘᲨᲕᲜᲔᲚᲝᲕᲐᲜᲘ': 'IMPORTANT',
'ᲛᲝᲜᲐᲮᲐᲖᲔᲑᲘ': 'DRAFT',
'ᲡᲞᲐᲛᲘ': 'SPAM',
'ᲬᲐᲨᲚᲘᲚᲔᲑᲘ': 'TRASH',
'ᲨᲔᲛᲝᲡᲣᲚᲔᲑᲘ.': 'INBOX',
# am (66/73)
'ረቂቆች': 'DRAFT',
'አስፈላጊ': 'IMPORTANT',
'አይፈለጌ መልዕክት': 'SPAM',
'ኮከብ የተደረገባቸው': 'STARRED',
'የተላከ ኢሜይል': 'SENT',
'ጣል': 'TRASH',
'የገቢ መልዕክት ሳጥን': 'INBOX',
# chr (67/73)
'ᎢᎬᏱ ᎪᏪᎸᏅ': 'DRAFT',
'ᎤᎵᏍᎨᏓ': 'IMPORTANT',
'ᎤᏲ': 'TRASH',
'ᎤᏲᎢ': 'SPAM',
'ᏃᏈᏏ ᎪᏪᎳᏅᎯ': 'STARRED',
'ᏫᎦᏅᏅᎯ ᎪᏪᎸ': 'SENT',
'ᎧᏁᏌᎢᏱ': 'INBOX',
# km (68/73)
'ធុងសំរាម': 'TRASH',
'បានដាក់ផ្កាយ': 'STARRED',
'សេចក្ដីព្រាង': 'DRAFT',
'សំខាន់': 'IMPORTANT',
'អ៊ីមែលបានផ្ញើ': 'SENT',
'សារឥតបានការ': 'SPAM',
'ប្រអប់ទទួល': 'INBOX',
# zh-HK (69/73)
'垃圾桶': 'TRASH',
'垃圾郵件': 'SPAM',
'寄件備份': 'SENT',
'已加星號': 'STARRED',
'草稿': 'DRAFT',
'重要郵件': 'IMPORTANT',
'收件箱': 'INBOX',
# zh-CN (70/73)
'垃圾邮件': 'SPAM',
'已删除邮件': 'TRASH',
'已加星标': 'STARRED',
'已发邮件': 'SENT',
'草稿': 'DRAFT',
'重要': 'IMPORTANT',
'收件箱': 'INBOX',
# zh-TW (71/73)
'垃圾桶': 'TRASH',
'垃圾郵件': 'SPAM',
'寄件備份': 'SENT',
'已加星號': 'STARRED',
'草稿': 'DRAFT',
'重要郵件': 'IMPORTANT',
'收件匣': 'INBOX',
# ja (72/73)
'ゴミ箱': 'TRASH',
'スター付き': 'STARRED',
'下書き': 'DRAFT',
'迷惑メール': 'SPAM',
'送信済みメール': 'SENT',
'重要': 'IMPORTANT',
'受信トレイ': 'INBOX',
# ko (73/73)
'별표편지함': 'STARRED',
'보낸편지함': 'SENT',
'스팸함': 'SPAM',
'임시보관함': 'DRAFT',
'중요': 'IMPORTANT',
'휴지통': 'TRASH',
'받은편지함': 'INBOX',
} | 10,385 |
3,269 | <filename>C++/reverse-string.cpp
// Time: O(n)
// Space: O(1)
class Solution {
public:
void reverseString(vector<char>& s) {
for (int i = 0, j = s.size() - 1; i < j; ++i, --j) {
swap(s[i], s[j]);
}
}
};
// Time: O(n)
// Space: O(1)
class Solution2 {
public:
void reverseString(vector<char>& s) {
reverse(s.begin(), s.end());
}
};
| 194 |
9,516 | <reponame>ketyi/dgl
/*!
* Copyright (c) 2016 by Contributors
* \file runtime_base.h
* \brief Base of all C APIs
*/
#ifndef DGL_RUNTIME_RUNTIME_BASE_H_
#define DGL_RUNTIME_RUNTIME_BASE_H_
#include <dgl/runtime/c_runtime_api.h>
#include <stdexcept>
/*! \brief macro to guard beginning and end section of all functions */
#define API_BEGIN() try {
/*! \brief every function starts with API_BEGIN();
and finishes with API_END() or API_END_HANDLE_ERROR */
#define API_END() } catch(std::runtime_error &_except_) { return DGLAPIHandleException(_except_); } return 0; // NOLINT(*)
/*!
* \brief every function starts with API_BEGIN();
* and finishes with API_END() or API_END_HANDLE_ERROR
* The finally clause contains procedure to cleanup states when an error happens.
*/
#define API_END_HANDLE_ERROR(Finalize) } catch(std::runtime_error &_except_) { Finalize; return DGLAPIHandleException(_except_); } return 0; // NOLINT(*)
/*!
* \brief handle exception throwed out
* \param e the exception
* \return the return value of API after exception is handled
*/
inline int DGLAPIHandleException(const std::runtime_error &e) {
DGLAPISetLastError(e.what());
return -1;
}
#endif // DGL_RUNTIME_RUNTIME_BASE_H_
| 430 |
348 | <reponame>chamberone/Leaflet.PixiOverlay
{"nom":"Beaujeu","circ":"9ème circonscription","dpt":"Rhône","inscrits":1324,"abs":709,"votants":615,"blancs":4,"nuls":1,"exp":610,"res":[{"nuance":"LR","nom":"<NAME>","voix":218},{"nuance":"REM","nom":"Mme <NAME>","voix":179},{"nuance":"FN","nom":"<NAME>","voix":101},{"nuance":"FI","nom":"Mme <NAME>","voix":37},{"nuance":"ECO","nom":"Mme <NAME>","voix":24},{"nuance":"DLF","nom":"<NAME>","voix":14},{"nuance":"RDG","nom":"Mme <NAME>","voix":13},{"nuance":"DVD","nom":"M. <NAME>","voix":12},{"nuance":"ECO","nom":"Mme <NAME>","voix":3},{"nuance":"COM","nom":"M. <NAME>","voix":3},{"nuance":"EXG","nom":"Mme <NAME>","voix":3},{"nuance":"DIV","nom":"Mme <NAME>","voix":2},{"nuance":"DIV","nom":"Mme <NAME>","voix":1}]} | 311 |
1,305 | <gh_stars>1000+
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package javax.swing.plaf;
import java.awt.Color;
import java.beans.ConstructorProperties;
/*
* A subclass of Color that implements UIResource. UI
* classes that create colors should use this class.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @see javax.swing.plaf.UIResource
* @author <NAME>
*
*/
public class ColorUIResource extends Color implements UIResource
{
@ConstructorProperties({"red", "green", "blue"})
public ColorUIResource(int r, int g, int b) {
super(r, g, b);
}
public ColorUIResource(int rgb) {
super(rgb);
}
public ColorUIResource(float r, float g, float b) {
super(r, g, b);
}
public ColorUIResource(Color c) {
super(c.getRGB(), (c.getRGB() & 0xFF000000) != 0xFF000000);
}
}
| 514 |
338 | <reponame>ayumi-cloud/browscap<filename>resources/devices/tablet/ceros.json<gh_stars>100-1000
{
"Ceros CT9716-B": {
"type": "tablet",
"properties": {
"Device_Name": "Revolution",
"Device_Code_Name": "CT9716-B",
"Device_Maker": "Ceros",
"Device_Pointing_Method": "touchscreen",
"Device_Brand_Name": "Ceros"
},
"standard": true
}
}
| 171 |
3,469 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__author__ = 'AJay'
__mtime__ = '2019/4/15 0015'
"""
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import time
import threading
from datetime import datetime
import tkinter as tk
import os
from db import MongoArticle,MongoUrl,MongoConfig
from multiprocessing import Process, JoinableQueue
from tkinter import *
from tkinter import scrolledtext
from tkinter import messagebox
class MainPage(object):
def __init__(self, master):
self.window = master
sw = self.window.winfo_screenwidth()
sh = self.window.winfo_screenheight()
ww = 1400
wh = 650
x = (sw - ww) / 2
y = (sh - wh) / 2
self.window.geometry('%dx%d+%d+%d' % (ww, wh, x, y)) # 父容器大小
self.threadnumVar = tk.IntVar()
self.timeVar = tk.IntVar()
self.save_pathVar = tk.StringVar()
self.logMessage = JoinableQueue()
self.errMessage = JoinableQueue()
self.dbconf = MongoConfig()
self.dburl = MongoUrl()
self.dbarticle = MongoArticle()
self.create_page()
self.show_logs()
self.asyCraler()
def asyCraler(self):
from run_main import NewsClawer
nc = NewsClawer()
nc.init_set()
t = threading.Thread(target=nc.run, args=())
t.start()
print('启动主线程')
def say_export_data(self):
t = threading.Thread(target=self.export_data, args=())
t.start()
print('启动主线程保存数据')
self.exportDbBtn.config(state=tk.DISABLED)
def _temp_t(self):
from souhu.souhu_new import SouhuSpider
ss = SouhuSpider()
self.startBtn.config(text='正在采集')
while True:
ss.run(self.logMessage,self.errMessage)
configs = self.dbconf.select_one()
sleep_time = configs.get("time", 60)
print(sleep_time)
time.sleep(int(sleep_time))
self.errMessage.put('【周期扫描】:{}秒'.format(sleep_time))
def create_page(self):
self.meun() # 菜单
self.config() # 配置
self.log() # 日志
self.error_log() # 系统日志
self.img() # 图片
# self.loading() # 进度条
def img(self): # 图片
photo = PhotoImage(file='news.png')
label = Label(image=photo)
label.image = photo
label.grid(row=0, column=2, columnspan=2, rowspan=2, sticky=W + E + N + S, padx=5, pady=5)
def config(self): # 配置
Config = tk.LabelFrame(self.window, text="配置", padx=25, pady=5) # 水平,垂直方向上的边距均为 10
Config.place(x=30, y=100)
tk.Label(Config, text="爬取频率/s:").grid(column=0, row=0, sticky='w', pady=5) #
tk.Label(Config, text="爬取线程:").grid(column=0, row=1, sticky='w', pady=5) # 添加波特率标签
tk.Label(Config, text="保存路径:").grid(column=0, row=2, sticky='w', pady=5) # 添加波特率标签
try:
configs = self.dbconf.select_one()
self.threadnum = configs.get('thread')
self.timenum = configs.get('time')
self.save_path = configs.get('path')
except Exception as e:
self.dbconf.insert({"flag": 1, "time": 60, "thread": 10,"path":"news"})
self.threadnum = 10
self.timenum = 60
self.save_path="默认路径news"
self.threadnumVar.set(self.threadnum)
self.timeVar.set(self.timenum)
self.save_pathVar.set(self.save_path)
self.threadEntry = tk.Entry(Config, textvariable=self.threadnumVar, width=22)
self.threadEntry.grid(column=1, row=1, pady=5)
self.timeEntry = tk.Entry(Config, textvariable=self.timeVar, width=22)
self.timeEntry.grid(column=1, row=0, pady=5)
print(self.save_pathVar)
self.pathEntry = tk.Entry(Config, textvariable=self.save_pathVar, width=22)
self.pathEntry.grid(column=1, row=2, pady=5)
self.logoutBtn = tk.Button(Config, text="测试路径", command=self.check_path)
self.logoutBtn.grid(column=2, row=2, pady=5, ipadx=15, padx=15)
Config_start = tk.LabelFrame(self.window, text="", padx=10, pady=5) # 水平,垂直方向上的边距均为 10
Config_start.place(x=30, y=250)
tk.Button(Config_start, text="更新配置", command=self.updata_config).grid(column=0, row=0, pady=5, ipadx=20,padx=15)
self.clearDbBtn = tk.Button(Config_start, text="清空数据库", command=self.clearDB)
self.clearDbBtn.config(bg='red')
self.clearDbBtn.grid(column=1, row=1, pady=5, ipadx=15,padx=15)
self.logoutBtn = tk.Button(Config_start, text="清除缓存", command=self.clear_product)
self.logoutBtn.grid(column=0, row=1, pady=5, ipadx=15,padx=15)
self.exportDbBtn = tk.Button(Config_start, text="导出数据", command=self.say_export_data)
# self.exportDbBtn.config(state=tk.DISABLED)
self.exportDbBtn.grid(column=2, row=1, pady=5, ipadx=15,padx=15)
self.startBtn = tk.Button(Config_start, text="开始采集", command=self.start_spider)
self.startBtn.grid(column=0, row=2, pady=5, ipadx=15)
# self.stopBtn = tk.Button(Config_start, text="停止采集", command=self.stop_spider)
# self.stopBtn.grid(column=2, row=2, pady=5, ipadx=15)
def log(self): # 日志
self.logMessage.put('欢迎使用【新闻网采集器器定制版ByAjay13】')
logInformation = tk.LabelFrame(self.window, text="日志", padx=10, pady=10) # 水平,垂直方向上的边距均为10
logInformation.place(x=450, y=100)
self.logInformation_Window = scrolledtext.ScrolledText(logInformation, width=118, height=22, padx=10, pady=10,
wrap=tk.WORD)
self.logInformation_Window.grid()
def error_log(self): # 系统日志
error_logInformation = tk.LabelFrame(self.window, text="系统日志", padx=10, pady=10) # 水平,垂直方向上的边距均为10
error_logInformation.place(x=450, y=460)
self.errorInformation_Window = scrolledtext.ScrolledText(error_logInformation, width=118, height=8, padx=10,
pady=10,
wrap=tk.WORD)
self.errorInformation_Window.grid()
# 菜单说明
def meun(self):
menubar = tk.Menu(self.window)
aboutmemu = tk.Menu(menubar, tearoff=0)
menubar.add_cascade(label='关于', menu=aboutmemu)
aboutmemu.add_command(label='软件说明', command=self.show_Description)
aboutmemu.add_command(label='版本', command=self.show_Version)
aboutmemu.add_command(label='开发者', command=self.show_Developer)
window.config(menu=menubar)
# 检测路径
def check_path(self):
from export_article import EexportTxt
et = EexportTxt()
path = self.pathEntry.get()
checkout = et.check_input_path(path)
if checkout:
tk.messagebox.showinfo(title='路径', message='路径正确!')
elif path=="默认路径news":
tk.messagebox.showinfo(title='路径', message='保存路径将作为默认路径!')
else:
tk.messagebox.showerror(title='路径', message='路径不正确!创建正确路径')
# 导出数据
def export_data(self):
from export_article import EexportTxt
et = EexportTxt()
path = self.pathEntry.get()
et.run(input_path=path,errMessage=self.errMessage)
# 跟新配置
def updata_config(self):
self.logMessage.put('更新配置')
threadnum = self.threadEntry.get()
timenum = self.timeEntry.get()
path = self.pathEntry.get()
self.dbconf.update(thread=threadnum,time=timenum,path=path)
tk.messagebox.showinfo(title='配置', message='配置信息更新成功!')
def start_spider(self):
# TODO: 获取所有的配置信息函数。
self.errMessage.put('开始新闻数据采集')
self.startBtn.config(state=tk.DISABLED)
t = threading.Thread(target=self._temp_t, args=())
# t.daemon=True
t.start()
print('启动线程')
def clear_product(self):
if tk.messagebox.askyesno(title='删除', message='这将清空缓存数据,是否确定删除?'):
self.errMessage.put('开始清除数据库缓存')
self.dburl.delete_all({})
self.errMessage.put('清除数据库缓存结束')
tk.messagebox.showinfo(title='恭喜', message='清除数据库缓存结束')
# 清空数据库
def clearDB(self):
if tk.messagebox.askyesno(title='删除', message='这将清空所有的数据,是否确定删除?'):
if tk.messagebox.askyesno(title='再次确认', message='清空数据后请重启软件,是否确定删除?'):
self.dbconf.delete_all({})
self.dburl.delete_all({})
self.dbarticle.delete_all({})
self.errMessage.put('清除数据库所有数据')
self.errMessage.put('请重新启动软件,加载配置')
self.window.update()
tk.messagebox.showinfo(title='恭喜', message='所有数据清除完成!请重新启动软件,加载配置')
def log_queue(self):
while True:
log = self.logMessage.get()
date = datetime.now().strftime("%m-%d %H:%M:%S")
self.logInformation_Window.insert(END, '[{date}][{log}]'.format(date=date, log=log) + '\n')
self.logInformation_Window.see(END)
# self.logMessage.task_done()
def errlog_queue(self):
while True:
log = self.errMessage.get()
if log==1:
self.exportDbBtn.config(state=tk.ACTIVE)
date = datetime.now().strftime("%m-%d %H:%M:%S")
self.errorInformation_Window.insert(END, '[{date}][{log}]'.format(date=date, log=log) + '\n')
self.errorInformation_Window.see(END)
def show_logs(self):
Tlog_queue = threading.Thread(target=self.log_queue, args=())
Terrlog_queue = threading.Thread(target=self.errlog_queue, args=())
Tlog_queue.daemon = True
Tlog_queue.start()
Terrlog_queue.daemon = True
Terrlog_queue.start()
# self.logMessage.join()
def show_Description(self):
Description(self.window)
def show_Version(self):
Version(self.window)
def show_Developer(self):
Developer(self.window)
# 使用说明界面
class Description():
'''
软件描述说明介绍界面
'''
def __init__(self, master):
self.master = master
self.window = tk.Toplevel(master)
self.window.wm_attributes('-topmost', 1)
sw = self.window.winfo_screenwidth()
sh = self.window.winfo_screenheight()
ww = 650
wh = 720
x = (sw - ww) / 3
y = (sh - wh) / 3
self.window.geometry('%dx%d+%d+%d' % (ww, wh, x, y)) # 父容器大小
self.window.title('使用说明')
self.create_page()
def create_page(self):
Dev = tk.LabelFrame(self.window, text="关于使用说明", padx=10, pady=5) # 水平,垂直方向上的边距均为 10
Dev.place(x=50, y=50)
text = "【使用前仔细阅读使用说明】 \n\n" \
"使用说明\n" \
"本项目采用多线程爬取新闻网咨询,爬取速度快,效率高。\n" \
"根据数据库能做到新闻去重,不去爬取已经爬取过的新闻\n\n" \
"**注意事项**\n\n" \
"- 爬取之前检测数据库是否开启成功\n\n" \
"- 爬取频率:为多久进行一次爬取,默认数值60s,可以根据需求设置\n5分钟=5*60=300秒,时间间隔太小会封ip\n\n" \
"- 爬取线程: 爬取的线程与电脑的性能有关、一般电脑10个线程,\n电脑性能高可以开50、100个\n\n"\
"- 爬取的路径:爬取路径错误或者路径不设置将会文件将导出到news文件夹下面\n\n"\
"- 每次修改配置后,可以需要更新配置,\n\n"\
"- 清除缓存后,将删除所有的爬取信息\n\n"\
"- 清空数据库后,将删除所有的的数据库\n\n"\
"- 建议每隔5天左右清空一次数据库,将减少电脑压力\n\n"\
"- 关闭程序后结束爬取\n\n"\
" \n"\
"- 祝你使用愉快\n"\
tk.Label(Dev, text=text, justify='left').grid(column=0, row=0, sticky='w', pady=5, padx=5) # 添加用户账号
# 版本说明界面
class Version():
'''
软件版本说明介绍界面
'''
def __init__(self, master):
self.master = master
self.window = tk.Toplevel(master)
self.window.wm_attributes('-topmost', 1)
sw = self.window.winfo_screenwidth()
sh = self.window.winfo_screenheight()
ww = 400
wh = 300
x = (sw - ww) / 3
y = (sh - wh) / 3
self.window.geometry('%dx%d+%d+%d' % (ww, wh, x, y)) # 父容器大小
self.window.title('软件版本')
self.create_page()
def create_page(self):
Dev = tk.LabelFrame(self.window, text="关于版本更新", padx=10, pady=5) # 水平,垂直方向上的边距均为 10
Dev.place(x=50, y=50)
text = " 2019年5月 10日 版本:V1.0 正式版\n " \
" 2019年5月 09日 版本:V0.2\n "
tk.Label(Dev, text=text).grid(column=0, row=0, sticky='w', pady=5, padx=5) # 添加用户账号
# 开发者说明界面
class Developer():
'''
软件开发者介绍界面
'''
def __init__(self, master):
self.master = master
self.window = tk.Toplevel(master)
self.window.wm_attributes('-topmost', 1)
sw = self.window.winfo_screenwidth()
sh = self.window.winfo_screenheight()
ww = 400
wh = 300
x = (sw - ww) / 3
y = (sh - wh) / 3
self.window.geometry('%dx%d+%d+%d' % (ww, wh, x, y)) # 父容器大小
self.window.title('开发者')
self.create_page()
def create_page(self):
Dev = tk.LabelFrame(self.window, text="关于开发者", padx=10, pady=5) # 水平,垂直方向上的边距均为 10
Dev.place(x=50, y=50)
text = " 作者:AJay13\n" \
" 技能:熟悉各项爬虫与反爬虫,数据清洗,\n 网站搭建,软件编写\n" \
" 联系:BoeSKh5446sa23sadKJH84ads5\n"
tk.Label(Dev, text=text, justify='left').grid(column=0, row=0, sticky='w', pady=5, padx=5) # 添加用户账号
# 版本测试时间
def test_time(over_time):
from datetime import datetime
d2 = datetime.strptime(over_time, '%Y-%m-%d %H:%M:%S')
now = datetime.now()
if d2 > now:
return True
else:
return False
if __name__ == '__main__':
if test_time('2020-5-11 16:00:00'): # 测试授权日期
window = tk.Tk() # 父容器
print('开始')
window.title("新闻网采集器器定制版ByAjay13") # 父容器标题
basePath = os.path.abspath(os.path.dirname(__file__))
print('base_path基础路径',basePath)
if not os.path.exists(os.path.join(basePath, 'temp')):
os.mkdir(os.path.join(basePath, 'temp'))
if not os.path.exists(os.path.join(basePath, 'log')):
os.mkdir(os.path.join(basePath, 'log'))
mongod = os.path.join(basePath, 'bin', 'mongod.exe')
dbpath = os.path.join(basePath, 'temp')
logpath = os.path.join(basePath, 'log', 'mongodb.log')
#'D:\mongodb\bin\mongod.exe --dbpath D:\mongodb\xianyudb --logpath D:\mongodb\tb_log\MongoDB.log --directoryperdb --serviceName mongodb_tb --install'
if not os.path.exists(logpath):
os.system(
'{} --dbpath {} --logpath {} --directoryperdb --serviceName mongodb --install'.format(mongod, dbpath,
logpath))
os.system('net start mongodb')
else:
os.system('net start mongodb')
MainPage(window)
# 前提配置
# 配置mongodb为数据服务 初始化配置服务
'''
启动服务器服务
尝试链接数据库,搜寻配置项中db=1.链接不成功
alert 弹出数据库配置错误,尝试自动初始化,或联系管理员
1.创建本地mongodb的数据库文件夹
2.创建本地mongodb的数据库日志的文件夹
3.使用配置服务的命令
4.启动服务
5.数据库配置项中插入db为1
服务正常启动,tk面板加载配置项
异步爬虫线程启动,按照每隔10秒读取配置项内容。然后加载到进程中
关键字为:start == 1 开始加入爬取队列
'''
print('监听')
window.mainloop()
else:
window = tk.Tk() # 父容器
window.title("新闻网采集器器定制版ByAjay13") # 父容器标题
window.wm_attributes('-topmost', 1)
sw = window.winfo_screenwidth()
sh = window.winfo_screenheight()
ww = 400
wh = 300
x = (sw - ww) / 3
y = (sh - wh) / 3
window.geometry('%dx%d+%d+%d' % (ww, wh, x, y)) # 父容器大小
Dev = tk.LabelFrame(window, text="授权超时", padx=10, pady=5) # 水平,垂直方向上的边距均为 10
Dev.place(x=50, y=50)
text = " 你已经超出授权使用期限\n" \
" 请联系管理员进行提权\n \n" \
" 联系:BoeSKh5446sa23sadKJH84ads5\n"
tk.Label(Dev, text=text, justify='left').grid(column=0, row=0, sticky='w', pady=5, padx=5) # 添加用户账号
window.mainloop()
| 10,413 |
516 | <reponame>GReguig/kymatio
"""
Classification of MNIST with scattering
=======================================
Here we demonstrate a simple application of scattering on the MNIST dataset.
We use 10000 images to train a linear classifier. Features are normalized by
batch normalization.
"""
###############################################################################
# Preliminaries
# -------------
#
# Since we're using TensorFlow and Keras to train the model, import the
# relevant modules.
import tensorflow as tf
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Flatten, Dense
###############################################################################
# Finally, we import the `Scattering2D` class from the `kymatio.keras`
# package.
from kymatio.keras import Scattering2D
###############################################################################
# Training and testing the model
# ------------------------------
#
# First, we load in the data and normalize it.
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
x_train, x_test = x_train / 255., x_test / 255.
###############################################################################
# We then create a Keras model using the scattering transform followed by a
# dense layer and a softmax activation.
inputs = Input(shape=(28, 28))
x = Scattering2D(J=3, L=8)(inputs)
x = Flatten()(x)
x_out = Dense(10, activation='softmax')(x)
model = Model(inputs, x_out)
###############################################################################
# Display the created model.
model.summary()
###############################################################################
# Once the model is created, we couple it with an Adam optimizer and a
# cross-entropy loss function.
model.compile(optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
###############################################################################
# We then train the model using `model.fit` on a subset of the MNIST data.
model.fit(x_train[:10000], y_train[:10000], epochs=15,
batch_size=64, validation_split=0.2)
###############################################################################
# Finally, we evaluate the model on the held-out test data.
model.evaluate(x_test, y_test)
| 624 |
2,647 | '''
Same Tree
Given two binary trees, write a function to check if they are the same or not.
Two binary trees are considered the same if they are structurally identical and the nodes have the same value.
Input: 1 1
/ \ / \
2 3 2 3
Output: True
Input: 1 1
/ \
2 2
Output: False
=========================================
Traverse both trees in same time and if something isn't equal, return False.
Time Complexity: O(N)
Space Complexity: O(N) , because of the recursion stack (but this is if the tree is one branch), O(LogN) if the tree is balanced.
'''
############
# Solution #
############
# import TreeNode class from tree_helpers.py
from tree_helpers import TreeNode
def is_same_tree(p, q):
if (p is None) and (p == q):
return True
if (p is None) or (q is None):
return False
if p.val != q.val:
return False
# check left
if not is_same_tree(p.left, q.left):
return False
# check right
if not is_same_tree(p.right, q.right):
return False
return True
###########
# Testing #
###########
# Test 1
# Correct result => True
p = TreeNode(1, TreeNode(2), TreeNode(3))
q = TreeNode(1, TreeNode(2), TreeNode(3))
print(is_same_tree(p, q))
# Test 2
# Correct result => False
p = TreeNode(1, TreeNode(2))
q = TreeNode(1, None, TreeNode(2))
print(is_same_tree(p, q)) | 568 |
930 | package com.foxinmy.weixin4j.interceptor;
import com.foxinmy.weixin4j.handler.WeixinMessageHandler;
import com.foxinmy.weixin4j.request.WeixinMessage;
import com.foxinmy.weixin4j.request.WeixinRequest;
import com.foxinmy.weixin4j.response.WeixinResponse;
import io.netty.channel.ChannelHandlerContext;
/**
* 消息拦截适配
*
* @className MessageInterceptorAdapter
* @author jinyu(<EMAIL>)
* @date 2015年5月14日
* @since JDK 1.6
* @see
*/
public abstract class MessageInterceptorAdapter implements WeixinMessageInterceptor {
@Override
public boolean preHandle(ChannelHandlerContext context, WeixinRequest request, WeixinMessage message,
WeixinMessageHandler handler) {
return true;
}
@Override
public void postHandle(ChannelHandlerContext context, WeixinRequest request, WeixinResponse response,
WeixinMessage message, WeixinMessageHandler handler) {
}
@Override
public void afterCompletion(ChannelHandlerContext context, WeixinRequest request, WeixinResponse response,
WeixinMessage message, WeixinMessageHandler handler, Exception exception) {
}
@Override
public int weight() {
return 0;
}
}
| 436 |
4,184 | /**
* Copyright (c) 2007-2013, <NAME>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of Timothy Stack nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef byte_array_hh
#define byte_array_hh
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <string>
#include <ostream>
#include "base/lnav_log.hh"
template<size_t COUNT, typename T = unsigned char>
struct byte_array {
static constexpr size_t BYTE_COUNT = COUNT * sizeof(T);
static constexpr size_t STRING_SIZE = BYTE_COUNT * 2 + 1;
byte_array() { };
byte_array(const byte_array &other)
{
memcpy(this->ba_data, other.ba_data, BYTE_COUNT);
};
bool operator<(const byte_array &other) const
{
return memcmp(this->ba_data, other.ba_data, BYTE_COUNT) < 0;
};
bool operator!=(const byte_array &other) const
{
return memcmp(this->ba_data, other.ba_data, BYTE_COUNT) != 0;
};
bool operator==(const byte_array &other) const
{
return memcmp(this->ba_data, other.ba_data, BYTE_COUNT) == 0;
};
void clear()
{
memset(this->ba_data, 0, BYTE_COUNT);
};
void to_string(char *buffer) const
{
require(buffer != nullptr);
for (size_t lpc = 0; lpc < BYTE_COUNT; lpc++) {
snprintf(&buffer[lpc * 2], 3, "%02x", this->ba_data[lpc]);
}
};
std::string to_string() const
{
char buffer[STRING_SIZE];
this->to_string(buffer);
return std::string(buffer);
}
const unsigned char *in() const { return this->ba_data; };
T *out(int offset = 0) {
T *ptr = (T *)this->ba_data;
return &ptr[offset];
};
unsigned char ba_data[BYTE_COUNT];
};
template<size_t COUNT, typename T = unsigned char>
std::ostream& operator<<(std::ostream& os, const byte_array<COUNT, T>& ba)
{
os << ba.to_string();
return os;
}
#endif
| 1,189 |
1,184 | <filename>plyer/platforms/ios/vibrator.py
'''Implementation Vibrator for iOS.
Install: Add AudioToolbox framework to your application.
'''
import ctypes
from plyer.facades import Vibrator
class IosVibrator(Vibrator):
'''iOS Vibrator class.
iOS doesn't support any feature.
All time, pattern, repetition are ignored.
'''
def __init__(self):
super().__init__()
try:
self._func = ctypes.CDLL(None).AudioServicesPlaySystemSound
except AttributeError:
self._func = None
def _vibrate(self, time=None, **kwargs):
# kSystemSoundID_Vibrate is 0x00000FFF
self._func(0xFFF)
def _pattern(self, pattern=None, repeat=None, **kwargs):
self._vibrate()
def _exists(self, **kwargs):
return self._func is not None
def _cancel(self, **kwargs):
pass
def instance():
'''Returns Vibrator
:return: instance of class IosVibrator
'''
return IosVibrator()
| 406 |
596 | <reponame>nandhinianandj/Axelrod
"""Tests APavlov strategies."""
import axelrod as axl
from .test_player import TestPlayer
C, D = axl.Action.C, axl.Action.D
class TestAPavlov2006(TestPlayer):
name = "<NAME>"
player = axl.APavlov2006
expected_classifier = {
"memory_depth": float("inf"),
"stochastic": False,
"makes_use_of": set(),
"long_run_time": False,
"inspects_source": False,
"manipulates_source": False,
"manipulates_state": False,
}
def test_strategy_versus_cooperator(self):
actions = [(C, C)] * 7
self.versus_test(
axl.Cooperator(),
expected_actions=actions,
attrs={"opponent_class": "Cooperative"},
)
def test_strategy_versus_mock_player(self):
"""Tests that one defection after does not affect opponent_class determination."""
opponent = axl.MockPlayer(actions=[C] * 6 + [D])
actions = [(C, C)] * 6 + [(C, D), (D, C)]
self.versus_test(
opponent,
expected_actions=actions,
attrs={"opponent_class": "Cooperative"},
)
def test_strategy_versus_defector(self):
"""Tests that defector is recognized correctly."""
actions = [(C, D)] + [(D, D)] * 6
self.versus_test(
axl.Defector(),
expected_actions=actions,
attrs={"opponent_class": "ALLD"},
)
def test_strategy_stft(self):
"""Tests that STFT can be identified by DCDCDC and the subsequent response."""
opponent = axl.CyclerDC()
actions = [
(C, D),
(D, C),
(C, D),
(D, C),
(C, D),
(D, C),
(C, D),
(C, C),
(C, D),
(D, C),
]
self.versus_test(
opponent, expected_actions=actions, attrs={"opponent_class": "STFT"}
)
def test_strategy_PavlovD(self):
"""Tests that PavolvD is identified by DDCDDC."""
opponent = axl.Cycler(cycle="DDC")
actions = [(C, D), (D, D), (D, C), (C, D), (D, D), (D, C), (D, D)]
self.versus_test(
opponent,
expected_actions=actions,
attrs={"opponent_class": "PavlovD"},
)
def test_strategy_PavlovD2(self):
"""Tests that PavolvD is identified by DDCDDC and that the response
is D then C"""
opponent = axl.MockPlayer(actions=[D, D, C, D, D, C, D])
actions = [
(C, D),
(D, D),
(D, C),
(C, D),
(D, D),
(D, C),
(D, D),
(C, D),
]
self.versus_test(
opponent,
expected_actions=actions,
attrs={"opponent_class": "PavlovD"},
)
def test_strategy_random(self):
opponent = axl.MockPlayer(actions=[C, C, C, D, D, D])
actions = [(C, C), (C, C), (C, C), (C, D), (D, D), (D, D), (D, C)]
self.versus_test(
opponent,
expected_actions=actions,
attrs={"opponent_class": "Random"},
)
def test_strategy_random2(self):
opponent = axl.MockPlayer(actions=[D, D, D, C, C, C])
actions = [(C, D), (D, D), (D, D), (D, C), (C, C), (C, C), (D, D)]
self.versus_test(
opponent,
expected_actions=actions,
attrs={"opponent_class": "Random"},
)
class TestAPavlov2011(TestPlayer):
name = "<NAME>"
player = axl.APavlov2011
expected_classifier = {
"memory_depth": float("inf"),
"stochastic": False,
"makes_use_of": set(),
"long_run_time": False,
"inspects_source": False,
"manipulates_source": False,
"manipulates_state": False,
}
def test_strategy_cooperator(self):
actions = [(C, C)] * 8
self.versus_test(
axl.Cooperator(),
expected_actions=actions,
attrs={"opponent_class": "Cooperative"},
)
def test_strategy_defector(self):
actions = [(C, D)] + [(D, D)] * 9
self.versus_test(
axl.Defector(),
expected_actions=actions,
attrs={"opponent_class": "ALLD"},
)
def test_strategy_defector2(self):
opponent = axl.MockPlayer(actions=[C, D, D, D, D, D, D])
actions = [(C, C), (C, D)] + [(D, D)] * 5 + [(D, C)]
self.versus_test(
opponent, expected_actions=actions, attrs={"opponent_class": "ALLD"}
)
def test_strategy_defector3(self):
opponent = axl.MockPlayer(actions=[C, C, D, D, D, D, D])
actions = [(C, C), (C, C), (C, D)] + [(D, D)] * 4 + [(D, C)]
self.versus_test(
opponent, expected_actions=actions, attrs={"opponent_class": "ALLD"}
)
def test_strategy_defector4(self):
opponent = axl.MockPlayer(actions=[C, D, D, C, D, D, D])
actions = [
(C, C),
(C, D),
(D, D),
(D, C),
(C, D),
(D, D),
(D, D),
(D, C),
]
self.versus_test(
opponent, expected_actions=actions, attrs={"opponent_class": "ALLD"}
)
def test_strategy_stft(self):
opponent = axl.MockPlayer(actions=[C, D, D, C, C, D, D])
actions = [
(C, C),
(C, D),
(D, D),
(D, C),
(C, C),
(C, D),
(C, D),
(D, C),
]
self.versus_test(
opponent, expected_actions=actions, attrs={"opponent_class": "STFT"}
)
def test_strategy_stft2(self):
opponent = axl.MockPlayer(actions=[C, D, C, D, C, D, D])
actions = [
(C, C),
(C, D),
(D, C),
(C, D),
(D, C),
(C, D),
(C, D),
(D, C),
]
self.versus_test(
opponent, expected_actions=actions, attrs={"opponent_class": "STFT"}
)
def test_strategy_stft3(self):
opponent = axl.MockPlayer(actions=[D, D, D, C, C, C, C])
actions = [
(C, D),
(D, D),
(D, D),
(D, C),
(C, C),
(C, C),
(C, C),
(C, D),
]
self.versus_test(
opponent, expected_actions=actions, attrs={"opponent_class": "STFT"}
)
def test_strategy_random(self):
opponent = axl.MockPlayer(actions=[C, C, C, C, D, D])
actions = [
(C, C),
(C, C),
(C, C),
(C, C),
(C, D),
(D, D),
(D, C),
(D, C),
]
self.versus_test(
opponent,
expected_actions=actions,
attrs={"opponent_class": "Random"},
)
def test_strategy_random2(self):
opponent = axl.MockPlayer(actions=[D, D, C, C, C, C])
actions = [
(C, D),
(D, D),
(D, C),
(C, C),
(C, C),
(C, C),
(D, D),
(D, D),
]
self.versus_test(
opponent,
expected_actions=actions,
attrs={"opponent_class": "Random"},
)
| 4,141 |
986 | /**********************************************************************
Sneedacity - A Digital Audio Editor
Copyright 1999-2018 Audacity Team, 2021 Sneedacity Team
License: wxwidgets
<NAME>
******************************************************************//**
\file SetEnvelopeCommand.h
\brief Declarations of SetEnvelopeCommand class
*//*******************************************************************/
#ifndef __SET_ENVELOPE_COMMAND__
#define __SET_ENVELOPE_COMMAND__
#include "SetTrackInfoCommand.h"
class SetEnvelopeCommand : public SetTrackBase
{
public:
static const ComponentInterfaceSymbol Symbol;
SetEnvelopeCommand();
// ComponentInterface overrides
ComponentInterfaceSymbol GetSymbol() override {return Symbol;};
TranslatableString GetDescription() override {return XO("Sets an envelope point position.");};
bool DefineParams( ShuttleParams & S ) override;
void PopulateOrExchange(ShuttleGui & S) override;
// SneedacityCommand overrides
ManualPageID ManualPage() override {return L"Extra_Menu:_Scriptables_I#set_envelope";}
bool ApplyInner( const CommandContext & context, Track * t ) override;
public:
double mT;
double mV;
bool mbDelete;
bool bHasT;
bool bHasV;
bool bHasDelete;
};
#endif /* End of include guard: __SETTRACKINFOCOMMAND__ */
| 388 |
450 | /*
* 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 "ContainerExceptionMap.h"
namespace libyarn {
ContainerExceptionMap::ContainerExceptionMap() {
ceProto = ContainerExceptionMapProto::default_instance();
}
ContainerExceptionMap::ContainerExceptionMap(
const ContainerExceptionMapProto &proto) :
ceProto(proto) {
}
ContainerExceptionMap::~ContainerExceptionMap() {
}
ContainerExceptionMapProto& ContainerExceptionMap::getProto() {
return ceProto;
}
void ContainerExceptionMap::setContainerId(ContainerId &cId) {
ContainerIdProto* idProto = new ContainerIdProto();
idProto->CopyFrom(cId.getProto());
ceProto.set_allocated_container_id(idProto);
}
ContainerId ContainerExceptionMap::getContainerId() {
return ContainerId(ceProto.container_id());
}
void ContainerExceptionMap::setSerializedException(
SerializedException & exception) {
SerializedExceptionProto* proto = new SerializedExceptionProto();
proto->CopyFrom(exception.getProto());
ceProto.set_allocated_exception(proto);
}
SerializedException ContainerExceptionMap::getSerializedException() {
return SerializedException(ceProto.exception());
}
} /* namespace libyarn */
| 537 |
879 | <gh_stars>100-1000
package org.zstack.kvm;
import org.springframework.http.HttpMethod;
import org.zstack.header.host.HostVO;
import org.zstack.header.message.APIMessage;
import org.zstack.header.message.APIParam;
import org.zstack.header.rest.RestRequest;
import java.util.HashSet;
import java.util.Set;
/**
* Created by xing5 on 2016/3/14.
*/
@RestRequest(
path = "/hosts/kvm/actions",
isAction = true,
method = HttpMethod.PUT,
responseClass = APIKvmRunShellEvent.class
)
public class APIKvmRunShellMsg extends APIMessage {
@APIParam(resourceType = HostVO.class, nonempty = true)
private Set<String> hostUuids;
@APIParam
private String script;
public Set<String> getHostUuids() {
return hostUuids;
}
public void setHostUuids(Set<String> hostUuids) {
this.hostUuids = hostUuids;
}
public String getScript() {
return script;
}
public void setScript(String script) {
this.script = script;
}
public static APIKvmRunShellMsg __example__() {
APIKvmRunShellMsg msg = new APIKvmRunShellMsg();
Set <String >set = new HashSet();
set.add(uuid());
set.add(uuid());
msg.setHostUuids(set);
msg.setScript("ls");
return msg;
}
}
| 551 |
2,487 | /*
* Copyright (C) 2018 Zhejiang xiaominfo Technology CO.,LTD.
* All rights reserved.
* Official Web Site: http://www.xiaominfo.com.
* Developer Web Site: http://open.xiaominfo.com.
*/
package com.github.xiaoymin.knife4j.aggre.eureka;
import java.util.List;
/**
* Eureka注册中心应用Model
* @author <a href="mailto:<EMAIL>"><EMAIL></a>
* 2020/11/16 22:20
* @since:knife4j-aggregation-spring-boot-starter 2.0.8
*/
public class EurekaApplication {
/**
* 服务列表
*/
private String name;
/**
* 实例列表
*/
private List<EurekaInstance> instance;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<EurekaInstance> getInstance() {
return instance;
}
public void setInstance(List<EurekaInstance> instance) {
this.instance = instance;
}
}
| 380 |
2,151 | # 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.
import contextlib
import httplib
import os
import shutil
import tempfile
import unittest
from device_setup import _WprHost
from options import OPTIONS
from trace_test.webserver_test import WebServer
from wpr_backend import WprUrlEntry, WprRequest, ExtractRequestsFromLog
LOADING_DIR = os.path.dirname(__file__)
class MockWprResponse(object):
def __init__(self, headers):
self.original_headers = headers
class WprUrlEntryTest(unittest.TestCase):
@classmethod
def _CreateWprUrlEntry(cls, headers):
wpr_response = MockWprResponse(headers)
return WprUrlEntry('GET http://a.com/', wpr_response)
def testExtractUrl(self):
self.assertEquals('http://aa.bb/c',
WprUrlEntry._ExtractUrl('GET http://aa.bb/c'))
self.assertEquals('http://aa.b/c',
WprUrlEntry._ExtractUrl('POST http://aa.b/c'))
self.assertEquals('http://a.bb/c',
WprUrlEntry._ExtractUrl('WHATEVER http://a.bb/c'))
self.assertEquals('https://aa.bb/c',
WprUrlEntry._ExtractUrl('GET https://aa.bb/c'))
self.assertEquals('http://aa.bb',
WprUrlEntry._ExtractUrl('GET http://aa.bb'))
self.assertEquals('http://aa.bb',
WprUrlEntry._ExtractUrl('GET http://aa.bb FOO BAR'))
def testGetResponseHeadersDict(self):
entry = self._CreateWprUrlEntry([('header0', 'value0'),
('header1', 'value1'),
('header0', 'value2'),
('header2', 'value3'),
('header0', 'value4'),
('HEadEr3', 'VaLue4')])
headers = entry.GetResponseHeadersDict()
self.assertEquals(4, len(headers))
self.assertEquals('value0,value2,value4', headers['header0'])
self.assertEquals('value1', headers['header1'])
self.assertEquals('value3', headers['header2'])
self.assertEquals('VaLue4', headers['header3'])
def testSetResponseHeader(self):
entry = self._CreateWprUrlEntry([('header0', 'value0'),
('header1', 'value1')])
entry.SetResponseHeader('new_header0', 'new_value0')
headers = entry.GetResponseHeadersDict()
self.assertEquals(3, len(headers))
self.assertEquals('new_value0', headers['new_header0'])
self.assertEquals('new_header0', entry._wpr_response.original_headers[2][0])
entry = self._CreateWprUrlEntry([('header0', 'value0'),
('header1', 'value1'),
('header2', 'value1'),])
entry.SetResponseHeader('header1', 'new_value1')
headers = entry.GetResponseHeadersDict()
self.assertEquals(3, len(headers))
self.assertEquals('new_value1', headers['header1'])
self.assertEquals('header1', entry._wpr_response.original_headers[1][0])
entry = self._CreateWprUrlEntry([('header0', 'value0'),
('hEADEr1', 'value1'),
('header2', 'value1'),])
entry.SetResponseHeader('header1', 'new_value1')
headers = entry.GetResponseHeadersDict()
self.assertEquals(3, len(headers))
self.assertEquals('new_value1', headers['header1'])
self.assertEquals('hEADEr1', entry._wpr_response.original_headers[1][0])
entry = self._CreateWprUrlEntry([('header0', 'value0'),
('header1', 'value1'),
('header2', 'value2'),
('header1', 'value3'),
('header3', 'value4'),
('heADer1', 'value5')])
entry.SetResponseHeader('header1', 'new_value2')
headers = entry.GetResponseHeadersDict()
self.assertEquals(4, len(headers))
self.assertEquals('new_value2', headers['header1'])
self.assertEquals('header1', entry._wpr_response.original_headers[1][0])
self.assertEquals('header3', entry._wpr_response.original_headers[3][0])
self.assertEquals('value4', entry._wpr_response.original_headers[3][1])
entry = self._CreateWprUrlEntry([('header0', 'value0'),
('heADer1', 'value1'),
('header2', 'value2'),
('HEader1', 'value3'),
('header3', 'value4'),
('header1', 'value5')])
entry.SetResponseHeader('header1', 'new_value2')
headers = entry.GetResponseHeadersDict()
self.assertEquals(4, len(headers))
self.assertEquals('new_value2', headers['header1'])
self.assertEquals('heADer1', entry._wpr_response.original_headers[1][0])
self.assertEquals('header3', entry._wpr_response.original_headers[3][0])
self.assertEquals('value4', entry._wpr_response.original_headers[3][1])
def testDeleteResponseHeader(self):
entry = self._CreateWprUrlEntry([('header0', 'value0'),
('header1', 'value1'),
('header0', 'value2'),
('header2', 'value3')])
entry.DeleteResponseHeader('header1')
self.assertNotIn('header1', entry.GetResponseHeadersDict())
self.assertEquals(2, len(entry.GetResponseHeadersDict()))
entry.DeleteResponseHeader('header0')
self.assertNotIn('header0', entry.GetResponseHeadersDict())
self.assertEquals(1, len(entry.GetResponseHeadersDict()))
entry = self._CreateWprUrlEntry([('header0', 'value0'),
('hEAder1', 'value1'),
('header0', 'value2'),
('heaDEr2', 'value3')])
entry.DeleteResponseHeader('header1')
self.assertNotIn('header1', entry.GetResponseHeadersDict())
self.assertEquals(2, len(entry.GetResponseHeadersDict()))
def testRemoveResponseHeaderDirectives(self):
entry = self._CreateWprUrlEntry([('hEAder0', 'keyWOrd0,KEYword1'),
('heaDER1', 'value1'),
('headeR2', 'value3')])
entry.RemoveResponseHeaderDirectives('header0', {'keyword1', 'keyword0'})
self.assertNotIn('header0', entry.GetResponseHeadersDict())
entry = self._CreateWprUrlEntry([('heADEr0', 'keYWOrd0'),
('hEADERr1', 'value1'),
('HEAder0', 'keywoRD1,keYwoRd2'),
('hEADer2', 'value3')])
entry.RemoveResponseHeaderDirectives('header0', {'keyword1'})
self.assertEquals(
'keYWOrd0,keYwoRd2', entry.GetResponseHeadersDict()['header0'])
self.assertEquals(3, len(entry._wpr_response.original_headers))
self.assertEquals(
'keYWOrd0,keYwoRd2', entry._wpr_response.original_headers[0][1])
class WprHostTest(unittest.TestCase):
def setUp(self):
OPTIONS.ParseArgs([])
self._server_address = None
self._wpr_http_port = None
self._tmp_directory = tempfile.mkdtemp(prefix='tmp_test_')
def tearDown(self):
shutil.rmtree(self._tmp_directory)
def _TmpPath(self, name):
return os.path.join(self._tmp_directory, name)
def _LogPath(self):
return self._TmpPath('wpr.log')
def _ArchivePath(self):
return self._TmpPath('wpr')
@contextlib.contextmanager
def RunWebServer(self):
assert self._server_address is None
with WebServer.Context(
source_dir=os.path.join(LOADING_DIR, 'trace_test', 'tests'),
communication_dir=self._tmp_directory) as server:
self._server_address = server.Address()
yield
@contextlib.contextmanager
def RunWpr(self, record):
assert self._server_address is not None
assert self._wpr_http_port is None
with _WprHost(self._ArchivePath(), record=record,
out_log_path=self._LogPath()) as (http_port, https_port):
del https_port # unused
self._wpr_http_port = http_port
yield http_port
def DoHttpRequest(self, path, expected_status=200, destination='wpr'):
assert self._server_address is not None
if destination == 'wpr':
assert self._wpr_http_port is not None
connection = httplib.HTTPConnection('127.0.0.1', self._wpr_http_port)
elif destination == 'server':
connection = httplib.HTTPConnection(self._server_address)
else:
assert False
try:
connection.request(
"GET", '/' + path, headers={'Host': self._server_address})
response = connection.getresponse()
finally:
connection.close()
self.assertEquals(expected_status, response.status)
def _GenRawWprRequest(self, path):
assert self._wpr_http_port is not None
url = 'http://127.0.0.1:{}/web-page-replay-{}'.format(
self._wpr_http_port, path)
return WprRequest(is_served=True, method='GET', is_wpr_host=True, url=url)
def GenRawRequest(self, path, is_served):
assert self._server_address is not None
return WprRequest(is_served=is_served, method='GET', is_wpr_host=False,
url='http://{}/{}'.format(self._server_address, path))
def AssertWprParsedRequests(self, ref_requests):
all_ref_requests = []
all_ref_requests.append(self._GenRawWprRequest('generate-200'))
all_ref_requests.extend(ref_requests)
all_ref_requests.append(self._GenRawWprRequest('generate-200'))
all_ref_requests.append(self._GenRawWprRequest('command-exit'))
requests = ExtractRequestsFromLog(self._LogPath())
self.assertEquals(all_ref_requests, requests)
self._wpr_http_port = None
def testExtractRequestsFromLog(self):
with self.RunWebServer():
with self.RunWpr(record=True):
self.DoHttpRequest('1.html')
self.DoHttpRequest('2.html')
ref_requests = [
self.GenRawRequest('1.html', is_served=True),
self.GenRawRequest('2.html', is_served=True)]
self.AssertWprParsedRequests(ref_requests)
with self.RunWpr(record=False):
self.DoHttpRequest('2.html')
self.DoHttpRequest('1.html')
ref_requests = [
self.GenRawRequest('2.html', is_served=True),
self.GenRawRequest('1.html', is_served=True)]
self.AssertWprParsedRequests(ref_requests)
def testExtractRequestsFromLogHaveCorrectIsServed(self):
with self.RunWebServer():
with self.RunWpr(record=True):
self.DoHttpRequest('4.html', expected_status=404)
ref_requests = [self.GenRawRequest('4.html', is_served=True)]
self.AssertWprParsedRequests(ref_requests)
with self.RunWpr(record=False):
self.DoHttpRequest('4.html', expected_status=404)
self.DoHttpRequest('5.html', expected_status=404)
ref_requests = [self.GenRawRequest('4.html', is_served=True),
self.GenRawRequest('5.html', is_served=False)]
self.AssertWprParsedRequests(ref_requests)
def testExtractRequestsFromLogHaveCorrectIsWprHost(self):
PATH = 'web-page-replay-generate-200'
with self.RunWebServer():
self.DoHttpRequest(PATH, expected_status=404, destination='server')
with self.RunWpr(record=True):
self.DoHttpRequest(PATH)
ref_requests = [self.GenRawRequest(PATH, is_served=True)]
self.AssertWprParsedRequests(ref_requests)
if __name__ == '__main__':
unittest.main()
| 5,228 |
921 | // Copyright (c) 2015-2020 <NAME> <<EMAIL>> Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.vladsch.md.nav.psi.element;
import com.intellij.psi.stubs.StubElement;
import org.jetbrains.annotations.NotNull;
public interface MdLinkElementStub<Elem extends MdLinkElement> extends StubElement<Elem> {
@NotNull
String getLinkRefWithAnchorText();
}
| 139 |
1,936 | #ifndef FEATURE_TRACKING_FEATURE_TRACKING_PIPELINE_H_
#define FEATURE_TRACKING_FEATURE_TRACKING_PIPELINE_H_
#include <string>
#include <vector>
#include <aslam/common/memory.h>
#include <aslam/common/statistics/accumulator.h>
#include <aslam/frames/feature-track.h>
#include <aslam/visualization/feature-track-visualizer.h>
#include <maplab-common/macros.h>
#include <posegraph/unique-id.h>
#include "feature-tracking/feature-detection-extraction.h"
#include "feature-tracking/feature-track-extractor.h"
namespace aslam {
class FeatureTrackerLk;
class VisualNFrame;
}
namespace vi_map {
class VIMap;
class MissionId;
}
namespace aslam_cv_visualization {
class VisualNFrameFeatureTrackVisualizer;
}
namespace feature_tracking {
/// Pipeline to rerun tracking of features and triangulation of landmarks on a
/// already existing VIMap (i.e. with pose-graph, etc.).
/// Visualization of keypoints, keypoint matches and feature tracks is
/// available. See the flags at the top of the the source file.
class FeatureTrackingPipeline {
public:
MAPLAB_POINTER_TYPEDEFS(FeatureTrackingPipeline);
MAPLAB_DISALLOW_EVIL_CONSTRUCTORS(FeatureTrackingPipeline);
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
FeatureTrackingPipeline();
virtual ~FeatureTrackingPipeline() = default;
/// Reruns tracking and triangulation on all missions of the given map.
/// Note: This at first removes all existing landmarks and observations in the
/// map!
void runTrackingAndTriangulationForAllMissions(vi_map::VIMap* map);
/// Rerun tracking and triangulation for a given mission.
/// Note: This at first removes all existing landmarks and observations in the
/// map!
void runTrackingAndTriangulationForMission(
vi_map::MissionId mission_id, vi_map::VIMap* map);
protected:
inline bool hasFirstNFrameBeenProcessed() const {
return processed_first_nframe_;
}
const std::string feature_tracking_ros_base_topic_;
const bool visualize_keypoint_matches_;
private:
virtual void initialize(const aslam::NCamera::ConstPtr& ncamera) = 0;
virtual void trackFeaturesNFrame(
const aslam::Transformation& T_Bk_Bkp1, aslam::VisualNFrame* nframe_k,
aslam::VisualNFrame* nframe_kp1) = 0;
// Loads the raw-images specified in the resources table of the given map and
// assigns them to the frames of the nframe of the given vertex.
void assignRawImagesToNFrame(
const pose_graph::VertexId& vertex_id, vi_map::VIMap* map) const;
// Looks for terminated feature tracks, triangulates them and adds them to the
// given map.
void extractAndTriangulateTerminatedFeatureTracks(
const aslam::VisualNFrame::ConstPtr& nframe, vi_map::VIMap* map);
aslam_cv_visualization::VisualNFrameFeatureTrackVisualizer
feature_track_visualizer_;
vio_common::FeatureTrackExtractor::UniquePtr track_extractor_;
typedef AlignedUnorderedMap<aslam::NFramesId, pose_graph::VertexId>
NFrameIdToVertexIdMap;
NFrameIdToVertexIdMap nframe_id_to_vertex_id_map_;
bool processed_first_nframe_;
statistics::Accumulator<size_t, size_t, statistics::kInfiniteWindowSize>
successfully_triangulated_landmarks_accumulator_;
};
} // namespace feature_tracking
#endif // FEATURE_TRACKING_FEATURE_TRACKING_PIPELINE_H_
| 1,082 |
668 | /*
* Copyright (c) 2018, Oracle and/or its affiliates.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <polyglot.h>
int check_types(void *value) {
int ret = 0;
if (polyglot_is_value(value)) {
ret |= 1;
}
if (polyglot_is_null(value)) {
ret |= 2;
}
if (polyglot_is_number(value)) {
ret |= 4;
}
if (polyglot_is_boolean(value)) {
ret |= 8;
}
if (polyglot_is_string(value)) {
ret |= 16;
}
if (polyglot_can_execute(value)) {
ret |= 32;
}
if (polyglot_has_array_elements(value)) {
ret |= 64;
}
if (polyglot_has_members(value)) {
ret |= 128;
}
if (polyglot_can_instantiate(value)) {
ret |= 256;
}
return ret;
}
int check_types_nativeptr() {
void *ptr = (void *) 0xdead;
return check_types(ptr);
}
| 825 |
372 | package graphql.kickstart.spring.webflux;
import graphql.kickstart.execution.context.GraphQLKickstartContext;
import org.springframework.web.reactive.socket.WebSocketSession;
public interface GraphQLSpringWebSocketSessionContext extends GraphQLKickstartContext {
WebSocketSession getWebSocketSession();
}
| 83 |
628 | <filename>c/custom_alloc.h
int use_real_malloc = 1;
int use_fake_malloc = 0;
void* custom_alloc_opaque = &use_real_malloc;
unsigned char huge_buffer[1024*1024 * 255];
size_t huge_buffer_offset = 0;
const uint32_t science = 0x5C1E11CE;
void * custom_malloc_f(void* opaque, size_t user_size) {
unsigned char * retval;
size_t amt = user_size + 2*sizeof(opaque) + 4 + 32;
if (opaque == &use_fake_malloc) {
retval = &huge_buffer[huge_buffer_offset];
huge_buffer_offset += amt;
} else {
retval = (unsigned char*)malloc(amt);
}
memset(retval, 0x34, 2*sizeof(opaque) + 4 + 32); // make sure control areas are initialized to something--to help debug
memcpy(retval, &science, 4);
memcpy(retval + 4, &opaque, sizeof(opaque));
memcpy(retval + 4 + sizeof(opaque), &user_size, sizeof(size_t));
signed char alignment_offset = (32 - (((size_t)(retval + 4 + sizeof(opaque) + sizeof(size_t) + 1)) & 0x1f)) & 0x1f;
retval[sizeof(opaque) + sizeof(size_t) + 4 + alignment_offset] = alignment_offset;
void * final_return = retval + sizeof(opaque) + sizeof(size_t) + 4 + 1 + alignment_offset;
assert((((size_t)final_return)&0x1f) == 0);
return final_return;
}
void * (*custom_malloc)(void* opaque, size_t data) = &custom_malloc_f;
void custom_free_f(void* opaque, void *mfd) {
void * local_opaque;
uint32_t local_science;
size_t local_size = 0;
char * local_mfd = (char *)mfd;
if (mfd == NULL) {
return;
}
local_mfd -= 1;
local_mfd -= *local_mfd;
local_mfd -= 4;
local_mfd -= sizeof(opaque);
local_mfd -= sizeof(size_t);
memcpy(&local_science, local_mfd, 4);
assert(local_science == science);
memcpy(&local_opaque, local_mfd + 4, sizeof(opaque));
memcpy(&local_size, local_mfd + 4 + sizeof(opaque), sizeof(size_t));
assert(opaque == local_opaque);
if (opaque == &use_fake_malloc) {
void *retval = &huge_buffer[huge_buffer_offset];
if ((void*)(retval - local_size) == mfd) {
huge_buffer_offset -= 4 + sizeof(opaque) + sizeof(size_t) + local_size;
}
} else {
free(local_mfd);
}
}
void (*custom_free)(void* opaque, void *mfd) = &custom_free_f;
void custom_atoi(char * dst, size_t data) {
if (!data) {
memcpy(dst, "0\0", 2);
return;
}
char *ptr = dst;
while(data) {
*ptr = '0' + (data % 10);
++ptr;
data /= 10;
}
*ptr = '\0';
int del = (int)(ptr - dst);
int i;
for (i = 0;i < del/2;i+= 1) {
char tmp = dst[i];
dst[i] = *(ptr - i - 1);
*(ptr - i - 1) = tmp;
}
}
| 1,206 |
2,978 | /*
* Copyright Strimzi authors.
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
*/
package io.strimzi.systemtest.annotations;
import io.strimzi.test.k8s.KubeClusterResource;
import io.strimzi.test.k8s.cluster.OpenShift;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.jupiter.api.extension.ConditionEvaluationResult;
import org.junit.jupiter.api.extension.ExecutionCondition;
import org.junit.jupiter.api.extension.ExtensionContext;
public class OpenShiftOnlyCondition implements ExecutionCondition {
private static final Logger LOGGER = LogManager.getLogger(OpenShiftOnlyCondition.class);
@Override
public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext extensionContext) {
KubeClusterResource clusterResource = KubeClusterResource.getInstance();
if (clusterResource.cluster() instanceof OpenShift) {
return ConditionEvaluationResult.enabled("Test is enabled");
} else {
LOGGER.info("{} is @OpenShiftOnly, but the running cluster is not OpenShift: Ignoring {}",
extensionContext.getDisplayName(),
extensionContext.getDisplayName()
);
return ConditionEvaluationResult.disabled("Test is disabled");
}
}
}
| 489 |
376 | <reponame>cjsmeele/Kvasir
#pragma once
#include <Chip/Unknown/Spansion/MB9BF10xN/FLASH_IF.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/CRG.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/CRTRIM.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/SWWDT.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/HWWDT.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/DTIM.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/MFT0.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/MFT1.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/BTIOSEL03.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/BTIOSEL47.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/SBSSR.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/BT0.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/BT1.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/BT2.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/BT3.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/BT4.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/BT5.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/BT6.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/BT7.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/QPRC0.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/QPRC1.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/WC.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/MFT_PPG.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/ADC0.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/ADC1.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/ADC2.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/EXTI.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/INTREQ.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/GPIO.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/LVD.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/MFS0.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/MFS1.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/MFS2.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/MFS3.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/MFS4.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/MFS5.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/MFS6.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/MFS7.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/CRC.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/EXBUS.hpp>
#include <Chip/Unknown/Spansion/MB9BF10xN/DMAC.hpp>
| 1,037 |
713 | <gh_stars>100-1000
package org.infinispan.commons.configuration.io;
/**
* @since 12.1
* @author <NAME> <<EMAIL>%gt;
*/
public interface Location {
int getLineNumber();
int getColumnNumber();
static Location of(int line, int column) {
return new Location() {
@Override
public int getLineNumber() {
return line;
}
@Override
public int getColumnNumber() {
return column;
}
public String toString() {
return "[" + line + ',' + column + ']';
}
};
}
}
| 224 |
1,036 | <filename>pkg/alsa-lib/alsa/version.h<gh_stars>1000+
/*
* version.h
*/
#define SND_LIB_MAJOR 1 /**< major number of library version */
#define SND_LIB_MINOR 2 /**< minor number of library version */
#define SND_LIB_SUBMINOR 5 /**< subminor number of library version */
#define SND_LIB_EXTRAVER 1000000 /**< extra version number, used mainly for betas */
/** library version */
#define SND_LIB_VER(maj, min, sub) (((maj)<<16)|((min)<<8)|(sub))
#define SND_LIB_VERSION SND_LIB_VER(SND_LIB_MAJOR, SND_LIB_MINOR, SND_LIB_SUBMINOR)
/** library version (string) */
#define SND_LIB_VERSION_STR "1.2.5.1"
| 237 |
8,664 | <reponame>Taritsyn/ChakraCore
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#pragma once
#if defined(__ANDROID__)
#include <pthread.h>
#endif
#include "Runtime.h"
#include "Library/JavascriptRegularExpression.h"
#include "Library/JavascriptProxy.h"
#include "Library/SameValueComparer.h"
#include "Library/MapOrSetDataList.h"
#include "Library/JavascriptMap.h"
#include "Library/JavascriptSet.h"
#include "Library/JavascriptWeakMap.h"
#include "Library/JavascriptWeakSet.h"
// =================
#include "SCATypes.h"
#include "SCAEngine.h"
#include "SCAPropBag.h"
#include "StreamHelper.h"
#include "StreamReader.h"
#include "StreamWriter.h"
#include "SCADeserialization.h"
#include "SCASerialization.h"
#include "SCACore.h"
| 296 |
714 | <filename>Examples/external/nowide/test/exampleProject/example_main.cpp<gh_stars>100-1000
//
// Copyright (c) 2019 <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)
//
#include <nowide/args.hpp>
#include <nowide/convert.hpp>
int main(int argc, char** argv, char** env)
{
nowide::args _(argc, argv, env);
if(argc < 1)
return 1;
if(nowide::narrow(nowide::widen(argv[0])) != argv[0])
return 1;
return 0;
}
| 231 |
310 | <reponame>isabella232/PropertyCross
#ifndef FAVOURITES_H
#define FAVOURITES_H
#include "property.h"
#include <QAbstractListModel>
/**
* A Class which saves Favourited Properties in to persistent storage
*/
class FavouritesStorage : public QObject
{
Q_OBJECT
public:
FavouritesStorage(QObject *parent = 0);
public slots:
void addNewFavourite(Property property);
void removeFavourite(Property property);
void addNewFavourite(QString guid, QString summary, QString price, QString bedrooms, QString bathrooms, QString propertyType, QString title, QString thumbnailUrl, QString imageUrl);
void removeFavourite(QString guid, QString summary, QString price, QString bedrooms, QString bathrooms, QString propertyType, QString title, QString thumbnailUrl, QString imageUrl);
/** Removes all favourites from the persistent storage */
void removeAllFavourites();
/** Get a list of the favourited properties from the storage */
const QList<Property> getFavouritedProperties();
/** Determines if a property is in the storage of favourited properties
* param property The property to query
* return true if property is in storage, false otherwise */
bool isFavourited(QString property);
/** Helper method to trigger the toggleFavourite method */
void triggerFavouriteToggle();
signals:
/** Is emitted if there was any change to the storage */
void favouritedPropertiesChanged();
/** Is emitted to let UI components know that they should change their state */
void toggleFavourite();
private:
};
/** The Model of the Favourited Properties, to be used in a Listview */
class FavouritedPropertyListingModel : public QAbstractListModel {
Q_OBJECT
public:
enum PropertyRoles {
GuidRole = Qt::UserRole + 1,
SummaryRole,
PriceRole,
BedroomsRole,
BathroomsRole,
PropertyTypeRole,
TitleRole,
ThumbnailUrlRole,
ImageUrlRole
};
FavouritedPropertyListingModel(QObject *parent = 0);
void addProperty(const Property &property);
int rowCount(const QModelIndex & parent = QModelIndex()) const;
QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
public slots:
void addToListing(QSharedPointer<QList<Property*> > ptrList);
void resetListing();
void reloadFavouritedFromStorage();
protected:
QHash<int, QByteArray> roleNames() const;
private:
QList<Property> m_properties;
};
#endif // FAVOURITES_H
| 810 |
448 | <filename>Public/Src/Cache/ContentStore/VfsTest/Test/LoggingConfiguration.json
{
"Types": [ "File", "Console" ],
"FileAutoFlush": false,
"FileBaseName": "ContentStoreDistributedTest"
}
| 71 |
9,136 | /*
GWEN
Copyright (c) 2010 <NAME>
See license in Gwen.h
*/
#include "Gwen/Controls/TreeControl.h"
#include "Gwen/Controls/ScrollControl.h"
#include "Gwen/Utility.h"
using namespace Gwen;
using namespace Gwen::Controls;
GWEN_CONTROL_CONSTRUCTOR(TreeControl)
{
m_TreeControl = this;
m_bUpdateScrollBar = 2;
m_ToggleButton->DelayedDelete();
m_ToggleButton = NULL;
m_Title->DelayedDelete();
m_Title = NULL;
m_InnerPanel->DelayedDelete();
m_InnerPanel = NULL;
m_bAllowMultipleSelection = false;
m_ScrollControl = new ScrollControl(this);
m_ScrollControl->Dock(Pos::Fill);
m_ScrollControl->SetScroll(false, true);
m_ScrollControl->SetAutoHideBars(true);
m_ScrollControl->SetMargin(Margin(1, 1, 1, 1));
m_InnerPanel = m_ScrollControl;
m_ScrollControl->SetInnerSize(1000, 1000);
}
void TreeControl::Render(Skin::Base* skin)
{
if (ShouldDrawBackground())
skin->DrawTreeControl(this);
}
void TreeControl::ForceUpdateScrollBars()
{
m_ScrollControl->UpdateScrollBars();
}
void TreeControl::OnChildBoundsChanged(Gwen::Rect /*oldChildBounds*/, Base* /*pChild*/)
{
}
void TreeControl::Clear()
{
m_ScrollControl->Clear();
}
void TreeControl::Layout(Skin::Base* skin)
{
BaseClass::BaseClass::Layout(skin);
}
void TreeControl::PostLayout(Skin::Base* skin)
{
BaseClass::BaseClass::PostLayout(skin);
}
void TreeControl::OnNodeAdded(TreeNode* pNode)
{
pNode->onNamePress.Add(this, &TreeControl::OnNodeSelection);
}
void TreeControl::OnNodeSelection(Controls::Base* /*control*/)
{
//printf("TreeControl::OnNodeSelection\n");
if (!m_bAllowMultipleSelection || !Gwen::Input::IsKeyDown(Key::Control))
DeselectAll();
}
void TreeControl::iterate(int action, int* maxItem, int* curItem)
{
Base::List& children = m_InnerPanel->GetChildren();
for (Base::List::iterator iter = children.begin(); iter != children.end(); ++iter)
{
TreeNode* pChild = (*iter)->DynamicCastTreeNode();
if (!pChild)
continue;
pChild->iterate(action, maxItem, curItem);
}
}
bool TreeControl::OnKeyUp(bool bDown)
{
if (bDown)
{
// int maxIndex = 0;
int newIndex = 0;
int maxItem = 0;
int curItem = -1;
iterate(ITERATE_ACTION_FIND_SELECTED_INDEX, &maxItem, &curItem);
// maxIndex = maxItem;
int targetItem = curItem;
if (curItem > 0)
{
maxItem = 0;
int deselectIndex = targetItem;
targetItem--;
newIndex = targetItem;
iterate(ITERATE_ACTION_SELECT, &maxItem, &targetItem);
if (targetItem < 0)
{
maxItem = 0;
iterate(ITERATE_ACTION_DESELECT_INDEX, &maxItem, &deselectIndex);
}
curItem = newIndex;
// float amount = float(newIndex)/float(maxIndex);
float viewSize = m_ScrollControl->m_VerticalScrollBar->getViewableContentSize();
float contSize = m_ScrollControl->m_VerticalScrollBar->getContentSize();
float curAmount = m_ScrollControl->m_VerticalScrollBar->GetScrolledAmount();
// float minCoordViewableWindow = curAmount*contSize;
//float maxCoordViewableWindow = minCoordViewableWindow+viewSize;
float minCoordSelectedItem = curItem * 16.f;
// float maxCoordSelectedItem = (curItem+1)*16.f;
if (contSize != viewSize)
{
{
float newAmount = float(minCoordSelectedItem) / (contSize - viewSize);
if (newAmount < curAmount)
{
m_ScrollControl->m_VerticalScrollBar->SetScrolledAmount(newAmount, true);
}
}
{
int numItems = (viewSize) / 16 - 1;
float newAmount = float((curItem - numItems) * 16) / (contSize - viewSize);
if (newAmount > curAmount)
{
m_ScrollControl->m_VerticalScrollBar->SetScrolledAmount(newAmount, true);
}
}
}
}
}
ForceUpdateScrollBars();
return true;
}
bool TreeControl::OnKeyDown(bool bDown)
{
if (bDown)
{
// int maxIndex = 0;
int newIndex = 0;
int maxItem = 0;
int curItem = -1;
iterate(ITERATE_ACTION_FIND_SELECTED_INDEX, &maxItem, &curItem);
// maxIndex = maxItem;
int targetItem = curItem;
if (curItem >= 0)
{
maxItem = 0;
int deselectIndex = targetItem;
targetItem++;
newIndex = targetItem;
iterate(ITERATE_ACTION_SELECT, &maxItem, &targetItem);
if (targetItem < 0)
{
maxItem = 0;
iterate(ITERATE_ACTION_DESELECT_INDEX, &maxItem, &deselectIndex);
}
curItem = newIndex;
// float amount = (int)float(newIndex)/float(maxIndex);
float viewSize = m_ScrollControl->m_VerticalScrollBar->getViewableContentSize();
float contSize = m_ScrollControl->m_VerticalScrollBar->getContentSize();
float curAmount = m_ScrollControl->m_VerticalScrollBar->GetScrolledAmount();
// float minCoordViewableWindow = curAmount*contSize;
//float maxCoordViewableWindow = minCoordViewableWindow+viewSize;
float minCoordSelectedItem = curItem * 16.f;
//float maxCoordSelectedItem = (curItem+1)*16.f;
if (contSize != viewSize)
{
{
float newAmount = float(minCoordSelectedItem) / (contSize - viewSize);
if (newAmount < curAmount)
{
m_ScrollControl->m_VerticalScrollBar->SetScrolledAmount(newAmount, true);
}
}
{
int numItems = (viewSize) / 16 - 1;
float newAmount = float((curItem - numItems) * 16) / (contSize - viewSize);
if (newAmount > curAmount)
{
m_ScrollControl->m_VerticalScrollBar->SetScrolledAmount(newAmount, true);
}
}
}
}
}
ForceUpdateScrollBars();
return true;
}
extern int avoidUpdate;
bool TreeControl::OnKeyRight(bool bDown)
{
if (bDown)
{
avoidUpdate = -3;
iterate(ITERATE_ACTION_OPEN, 0, 0);
int maxItem = 0;
int curItem = 0;
iterate(ITERATE_ACTION_FIND_SELECTED_INDEX, &maxItem, &curItem);
// float amount = float(curItem)/float(maxItem);
float viewSize = m_ScrollControl->m_VerticalScrollBar->getViewableContentSize();
float contSize = m_ScrollControl->m_VerticalScrollBar->getContentSize();
float curAmount = m_ScrollControl->m_VerticalScrollBar->GetScrolledAmount();
// float minCoordViewableWindow = curAmount*contSize;
// float maxCoordViewableWindow = minCoordViewableWindow+viewSize;
float minCoordSelectedItem = curItem * 16.f;
// float maxCoordSelectedItem = (curItem+1)*16.f;
if (contSize != viewSize)
{
{
float newAmount = float(minCoordSelectedItem) / (contSize - viewSize);
if (newAmount < curAmount)
{
m_ScrollControl->m_VerticalScrollBar->SetScrolledAmount(newAmount, true);
}
}
{
int numItems = (viewSize) / 16 - 1;
float newAmount = float((curItem - numItems) * 16) / (contSize - viewSize);
if (newAmount > curAmount)
{
m_ScrollControl->m_VerticalScrollBar->SetScrolledAmount(newAmount, true);
}
}
}
Invalidate();
}
ForceUpdateScrollBars();
return true;
}
bool TreeControl::OnKeyLeft(bool bDown)
{
if (bDown)
{
avoidUpdate = -3;
iterate(ITERATE_ACTION_CLOSE, 0, 0);
int maxItems = 0;
int curItem = 0;
iterate(ITERATE_ACTION_FIND_SELECTED_INDEX, &maxItems, &curItem);
// float amount = float(curItem)/float(maxItems);
// m_ScrollControl->m_VerticalScrollBar->SetScrolledAmount(amount,true);
float viewSize = m_ScrollControl->m_VerticalScrollBar->getViewableContentSize();
float contSize = m_ScrollControl->m_VerticalScrollBar->getContentSize();
float curAmount = m_ScrollControl->m_VerticalScrollBar->GetScrolledAmount();
// float minCoordViewableWindow = curAmount*contSize;
// float maxCoordViewableWindow = minCoordViewableWindow+viewSize;
float minCoordSelectedItem = curItem * 16.f;
// float maxCoordSelectedItem = (curItem+1)*16.f;
if (contSize != viewSize)
{
{
float newAmount = float(minCoordSelectedItem) / (contSize - viewSize);
if (newAmount < curAmount)
{
m_ScrollControl->m_VerticalScrollBar->SetScrolledAmount(newAmount, true);
}
}
{
int numItems = (viewSize) / 16 - 1;
float newAmount = float((curItem - numItems) * 16) / (contSize - viewSize);
if (newAmount > curAmount)
{
m_ScrollControl->m_VerticalScrollBar->SetScrolledAmount(newAmount, true);
}
Invalidate();
}
}
//viewSize/contSize
//printf("!\n");
//this->Layout(0);
}
ForceUpdateScrollBars();
return true;
}
| 3,222 |
884 | <reponame>rt112000/CDM
{
"documentVersion": "1.2.1",
"jsonSchemaSemanticVersion": "1.0.0",
"imports": [
{
"corpusPath": "/core/cdsConcepts.1.0.1.cdm.json"
},
{
"corpusPath": "/core/wellKnownCDSAttributeGroups.1.2.1.cdm.json"
},
{
"corpusPath": "/core/applicationCommon/Currency.1.2.1.cdm.json"
},
{
"corpusPath": "/core/applicationCommon/foundationCommon/Company.1.2.1.cdm.json"
},
{
"corpusPath": "Ledger.0.9.1.cdm.json"
},
{
"corpusPath": "FiscalCalendarPeriod.0.8.2.cdm.json"
},
{
"corpusPath": "MainAccount.0.9.1.cdm.json"
},
{
"corpusPath": "MainAccountCategory.0.8.2.cdm.json"
},
{
"corpusPath": "FinancialActivity.0.9.1.cdm.json"
}
]
} | 418 |
18,012 | /*
* 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.dubbo.rpc.protocol.tri;
import io.netty.util.AsciiString;
public class TripleConstant {
public static final String CONTENT_PROTO = "application/grpc+proto";
public static final String APPLICATION_GRPC = "application/grpc";
public static final String TEXT_PLAIN_UTF8 = "text/plain; encoding=utf-8";
public static final String TRI_VERSION = "3.0-TRI";
public static final String SERIALIZATION_KEY = "serialization";
public static final String TE_KEY = "te";
public static final String HESSIAN4 = "hessian4";
public static final String HESSIAN2 = "hessian2";
public static final String HEADER_BIN_SUFFIX = "-bin";
public static final AsciiString HTTPS_SCHEME = AsciiString.of("https");
public static final AsciiString HTTP_SCHEME = AsciiString.of("http");
}
| 472 |
1,442 | <reponame>VersiraSec/epsilon-cfw<gh_stars>1000+
#ifndef SETTINGS_MAIN_CONTROLLER_H
#define SETTINGS_MAIN_CONTROLLER_H
#include <apps/shared/settings_message_tree.h>
#include <escher/selectable_list_view_controller.h>
#include <escher/message_table_cell_with_chevron_and_message.h>
#include <escher/message_table_cell_with_switch.h>
#include "message_table_cell_with_gauge_with_separator.h"
#include "sub_menu/about_controller.h"
#include "sub_menu/display_mode_controller.h"
#include "sub_menu/exam_mode_controller.h"
#include "sub_menu/localization_controller.h"
#include "sub_menu/preferences_controller.h"
namespace Settings {
extern const Shared::SettingsMessageTree s_modelAngleChildren[3];
extern const Shared::SettingsMessageTree s_modelEditionModeChildren[2];
extern const Shared::SettingsMessageTree s_modelFloatDisplayModeChildren[4];
extern const Shared::SettingsMessageTree s_modelComplexFormatChildren[3];
extern const Shared::SettingsMessageTree s_modelFontChildren[2];
extern const Shared::SettingsMessageTree s_modelExamChildren[2];
extern const Shared::SettingsMessageTree s_modelAboutChildren[3];
extern const Shared::SettingsMessageTree s_model;
class MainController : public Escher::SelectableListViewController {
public:
MainController(Escher::Responder * parentResponder, Escher::InputEventHandlerDelegate * inputEventHandlerDelegate);
bool handleEvent(Ion::Events::Event event) override;
void didBecomeFirstResponder() override;
int numberOfRows() const override;
KDCoordinate nonMemoizedRowHeight(int j) override;
Escher::HighlightCell * reusableCell(int index, int type) override;
int reusableCellCount(int type) override;
int typeAtIndex(int index) override;
void willDisplayCellForIndex(Escher::HighlightCell * cell, int index) override;
void viewWillAppear() override;
TELEMETRY_ID("");
private:
constexpr static int k_indexOfAngleUnitCell = 0;
constexpr static int k_indexOfDisplayModeCell = k_indexOfAngleUnitCell + 1;
constexpr static int k_indexOfEditionModeCell = k_indexOfDisplayModeCell + 1;
constexpr static int k_indexOfComplexFormatCell = k_indexOfEditionModeCell + 1;
constexpr static int k_indexOfBrightnessCell = k_indexOfComplexFormatCell + 1;
constexpr static int k_indexOfFontCell = k_indexOfBrightnessCell + 1;
constexpr static int k_indexOfLanguageCell = k_indexOfFontCell + 1;
constexpr static int k_indexOfCountryCell = k_indexOfLanguageCell + 1;
constexpr static int k_indexOfExamModeCell = k_indexOfCountryCell + 1;
/* Pop-up cell and About cell are located at the same index because pop-up
* cell is optional. We must always correct k_indexOfAboutCell with
* hasPrompt() (TODO: make hasPrompt() constexpr and correct
* k_indexOfAboutCell) */
constexpr static int k_indexOfPopUpCell = k_indexOfExamModeCell + 1;
constexpr static int k_indexOfAboutCell = k_indexOfExamModeCell + 1;
static const Shared::SettingsMessageTree * model();
Escher::StackViewController * stackController() const;
I18n::Message promptMessage() const;
bool hasPrompt() const { return promptMessage() != I18n::Message::Default; }
constexpr static int k_numberOfSimpleChevronCells = ((Ion::Display::Height - Escher::Metric::TitleBarHeight) / Escher::TableCell::k_minimalLargeFontCellHeight) + 2; // Remaining cell can be above and below so we add +2
Escher::MessageTableCellWithChevronAndMessage m_cells[k_numberOfSimpleChevronCells];
MessageTableCellWithGaugeWithSeparator m_brightnessCell;
Escher::MessageTableCellWithSwitch m_popUpCell;
PreferencesController m_preferencesController;
DisplayModeController m_displayModeController;
LocalizationController m_localizationController;
ExamModeController m_examModeController;
AboutController m_aboutController;
};
}
#endif
| 1,168 |
1,056 | <filename>platform/options.api/src/org/netbeans/modules/options/advanced/AdvancedPanel.java
/*
* 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.options.advanced;
import java.awt.BorderLayout;
import java.beans.PropertyChangeListener;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.netbeans.modules.options.OptionsPanelControllerAccessor;
import org.netbeans.modules.options.Utils;
import org.netbeans.spi.options.OptionsPanelController;
import org.openide.util.HelpCtx;
import org.openide.util.Lookup;
import org.openide.util.LookupEvent;
import org.openide.util.LookupListener;
import org.openide.util.NbBundle;
/**
* Implementation of one panel in Options Dialog.
*
* @author <NAME>
*/
public final class AdvancedPanel extends JPanel {
JTabbedPane tabbedPanel;
private static final Logger LOGGER = Logger.getLogger(AdvancedPanel.class.getName());
private LookupListener listener = new LookupListenerImpl();
private Model model;
private String subpath;
private ChangeListener changeListener = new ChangeListener () {
public void stateChanged(ChangeEvent e) {
handleTabSwitched(null, null);
}
};
/*
* @param subpath path to folder under OptionsDialog folder containing
* instances of AdvancedOption class. Path is composed from registration
* names divided by slash.
*/
AdvancedPanel(String subpath) {
this.subpath = subpath;
this.model = new Model(subpath, listener);
}
public void update () {
int idx = tabbedPanel.getSelectedIndex();
if (idx != -1) {
String category = tabbedPanel.getTitleAt(idx);
model.update (category);
}
}
public void applyChanges () {
model.applyChanges ();
}
public void cancel () {
model.cancel ();
}
public HelpCtx getHelpCtx () {
return model.getHelpCtx ((tabbedPanel != null) ? ((JComponent)tabbedPanel.getSelectedComponent ()) : null);
}
public boolean dataValid () {
return model.isValid ();
}
public boolean isChanged () {
return model.isChanged ();
}
public void addModelPropertyChangeListener(PropertyChangeListener listener) {
model.addPropertyChangeListener(listener);
}
public void removeModelPropertyChangeListener(PropertyChangeListener listener) {
model.removePropertyChangeListener(listener);
}
public Lookup getLookup () {
return model.getLookup ();
}
void init() {
// init components
tabbedPanel = new JTabbedPane();
tabbedPanel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(AdvancedPanel.class, "AdvancedPanel.tabbedPanel.AD"));
// define layout
setLayout (new BorderLayout ());
removeAll(); // #157434 - remove previous tabbedPanel
add (tabbedPanel, BorderLayout.CENTER);
initTabbedPane();
}
private void initTabbedPane() {
tabbedPanel.removeChangeListener(changeListener);
tabbedPanel.removeAll();
List<String> categories = model.getCategories();
tabbedPanel.setVisible(categories.size() > 0);
for (String category : categories) {
tabbedPanel.addTab(category, new JLabel(category));
}
tabbedPanel.addChangeListener(changeListener);
handleTabSwitched(null, null);
}
public void setCurrentSubcategory(String path) {
String subcategoryID = path.indexOf('/') == -1 ? path : path.substring(0, path.indexOf('/'));
final String subcategorySubpath = path.indexOf('/') == -1 ? null : path.substring(path.indexOf('/')+1);
LOGGER.fine("Set current subcategory: "+path); // NOI18N
if(!model.getIDs().contains(subcategoryID)) {
LOGGER.warning("Subcategory "+subcategoryID+" not found."); //NOI18N
return;
}
String newDisplayName = model.getDisplayName(subcategoryID);
String currentDisplayName = getSelectedDisplayName();
if (!newDisplayName.equals(currentDisplayName)) {
for (int i = 0; i < tabbedPanel.getComponentCount(); i++) {
if (tabbedPanel.getTitleAt(i).equals(newDisplayName)) {
tabbedPanel.setSelectedIndex(i);
break;
}
}
}
if(subcategorySubpath != null) {
OptionsPanelControllerAccessor.getDefault().setCurrentSubcategory(model.getController(subcategoryID), subcategorySubpath);
}
}
private String getSelectedDisplayName() {
String categoryDisplayName = null;
final int selectedIndex = tabbedPanel.getSelectedIndex();
if (selectedIndex != -1) {
categoryDisplayName = tabbedPanel.getTitleAt(selectedIndex);
}
return categoryDisplayName;
}
private void handleTabSwitched(String searchText, List<String> matchedKeywords) {
final int selectedIndex = tabbedPanel.getSelectedIndex() >= 0 ? tabbedPanel.getSelectedIndex() : -1;
if (selectedIndex != -1) {
String category = tabbedPanel.getTitleAt(selectedIndex);
if (tabbedPanel.getSelectedComponent() instanceof JLabel) {
JComponent panel = model.getPanel(category);
if( null == panel.getBorder() ) {
panel.setBorder(BorderFactory.createEmptyBorder(11,11,11,11));
}
JScrollPane scroll = new JScrollPane(panel);
scroll.setOpaque(false);
scroll.getViewport().setOpaque(false);
scroll.setBorder(BorderFactory.createEmptyBorder());
scroll.getVerticalScrollBar().setUnitIncrement(Utils.ScrollBarUnitIncrement);
scroll.getHorizontalScrollBar().setUnitIncrement(Utils.ScrollBarUnitIncrement);
tabbedPanel.setComponentAt(tabbedPanel.getSelectedIndex(), scroll);
}
model.update(category);
if (searchText != null && matchedKeywords != null) {
OptionsPanelController controller = model.getController(model.getID(category));
if(controller == null) {
LOGGER.log(Level.WARNING, "No controller found for category: {0}", category); //NOI18N
} else {
controller.handleSuccessfulSearch(searchText, matchedKeywords);
}
}
firePropertyChange (OptionsPanelController.PROP_HELP_CTX, null, null);
}
}
void handleSearch(String searchText, List<String> matchedKeywords) {
handleTabSwitched(searchText, matchedKeywords);
}
private class LookupListenerImpl implements LookupListener {
public void resultChanged(LookupEvent ev) {
model = new Model(subpath, listener);
if(SwingUtilities.isEventDispatchThread()) {
initTabbedPane();
} else {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
initTabbedPane();
}
});
}
}
}
}
| 3,301 |
327 | /* <NAME> `gentilkiwi`
https://blog.gentilkiwi.com
<EMAIL>
Licence : https://creativecommons.org/licenses/by/4.0/
*/
#include "kull_m_service.h"
BOOL kull_m_service_getUniqueForName(PCWSTR serviceName, SERVICE_STATUS_PROCESS * pServiceStatusProcess)
{
BOOL status = FALSE;
SC_HANDLE hSC, hS;
DWORD szNeeded;
if(hSC = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_CONNECT))
{
if(hS = OpenService(hSC, serviceName, SERVICE_QUERY_STATUS))
{
status = QueryServiceStatusEx(hS, SC_STATUS_PROCESS_INFO, (BYTE *) pServiceStatusProcess, sizeof(SERVICE_STATUS_PROCESS), &szNeeded);
CloseServiceHandle(hS);
}
CloseServiceHandle(hSC);
}
return status;
}
BOOL kull_m_service_start(PCWSTR serviceName)
{
BOOL status = FALSE;
SC_HANDLE hSC, hS;
if(hSC = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_CONNECT))
{
if(hS = OpenService(hSC, serviceName, SERVICE_START))
{
status = StartService(hS, 0, NULL);
CloseServiceHandle(hS);
}
CloseServiceHandle(hSC);
}
return status;
}
BOOL kull_m_service_remove(PCWSTR serviceName)
{
BOOL status = FALSE;
SC_HANDLE hSC, hS;
if(hSC = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_CONNECT))
{
if(hS = OpenService(hSC, serviceName, DELETE))
{
status = DeleteService(hS);
CloseServiceHandle(hS);
}
CloseServiceHandle(hSC);
}
return status;
}
BOOL kull_m_service_genericControl(PCWSTR serviceName, DWORD dwDesiredAccess, DWORD dwControl, LPSERVICE_STATUS ptrServiceStatus)
{
BOOL status = FALSE;
SC_HANDLE hSC, hS;
SERVICE_STATUS serviceStatus;
if(hSC = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_CONNECT))
{
if(hS = OpenService(hSC, serviceName, dwDesiredAccess))
{
status = ControlService(hS, dwControl, ptrServiceStatus ? ptrServiceStatus : &serviceStatus);
CloseServiceHandle(hS);
}
CloseServiceHandle(hSC);
}
return status;
}
BOOL kull_m_service_stop(PCWSTR serviceName)
{
return(kull_m_service_genericControl(serviceName, SERVICE_STOP, SERVICE_CONTROL_STOP, NULL));
}
BOOL kull_m_service_suspend(PCWSTR serviceName)
{
return(kull_m_service_genericControl(serviceName, SERVICE_PAUSE_CONTINUE, SERVICE_CONTROL_PAUSE, NULL));
}
BOOL kull_m_service_resume(PCWSTR serviceName)
{
return(kull_m_service_genericControl(serviceName, SERVICE_PAUSE_CONTINUE, SERVICE_CONTROL_CONTINUE, NULL));
}
BOOL kull_m_service_preshutdown(PCWSTR serviceName)
{
return(kull_m_service_genericControl(serviceName, SERVICE_ALL_ACCESS, SERVICE_CONTROL_PRESHUTDOWN, NULL));
}
BOOL kull_m_service_shutdown(PCWSTR serviceName)
{
return(kull_m_service_genericControl(serviceName, SERVICE_ALL_ACCESS, SERVICE_CONTROL_SHUTDOWN, NULL));
}
BOOL kull_m_service_addWorldToSD(SC_HANDLE monHandle)
{
BOOL status = FALSE;
DWORD dwSizeNeeded;
PSECURITY_DESCRIPTOR oldSd, newSd;
SECURITY_DESCRIPTOR dummySdForXP;
SID_IDENTIFIER_AUTHORITY SIDAuthWorld = SECURITY_WORLD_SID_AUTHORITY;
EXPLICIT_ACCESS ForEveryOne = {
SERVICE_QUERY_STATUS | SERVICE_QUERY_CONFIG | SERVICE_INTERROGATE | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_PAUSE_CONTINUE | SERVICE_START | SERVICE_STOP | SERVICE_USER_DEFINED_CONTROL | READ_CONTROL,
SET_ACCESS,
NO_INHERITANCE,
{NULL, NO_MULTIPLE_TRUSTEE, TRUSTEE_IS_SID, TRUSTEE_IS_WELL_KNOWN_GROUP, NULL}
};
if(!QueryServiceObjectSecurity(monHandle, DACL_SECURITY_INFORMATION, &dummySdForXP, 0, &dwSizeNeeded) && (GetLastError() == ERROR_INSUFFICIENT_BUFFER))
{
if(oldSd = (PSECURITY_DESCRIPTOR) LocalAlloc(LPTR, dwSizeNeeded))
{
if(QueryServiceObjectSecurity(monHandle, DACL_SECURITY_INFORMATION, oldSd, dwSizeNeeded, &dwSizeNeeded))
{
if(AllocateAndInitializeSid(&SIDAuthWorld, 1, SECURITY_WORLD_RID, 0, 0, 0, 0, 0, 0, 0, (PSID *)&ForEveryOne.Trustee.ptstrName))
{
if(BuildSecurityDescriptor(NULL, NULL, 1, &ForEveryOne, 0, NULL, oldSd, &dwSizeNeeded, &newSd) == ERROR_SUCCESS)
{
status = SetServiceObjectSecurity(monHandle, DACL_SECURITY_INFORMATION, newSd);
LocalFree(newSd);
}
FreeSid(ForEveryOne.Trustee.ptstrName);
}
}
LocalFree(oldSd);
}
}
return status;
}
BOOL kull_m_service_install(PCWSTR serviceName, PCWSTR displayName, PCWSTR binPath, DWORD serviceType, DWORD startType, BOOL startIt)
{
BOOL status = FALSE;
SC_HANDLE hSC = NULL, hS = NULL;
if(hSC = OpenSCManager(NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_CONNECT | SC_MANAGER_CREATE_SERVICE))
{
if(hS = OpenService(hSC, serviceName, SERVICE_START))
{
kprintf(L"[+] \'%s\' service already registered\n", serviceName);
}
else
{
if(GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST)
{
kprintf(L"[*] \'%s\' service not present\n", serviceName);
if(hS = CreateService(hSC, serviceName, displayName, READ_CONTROL | WRITE_DAC | SERVICE_START, serviceType, startType, SERVICE_ERROR_NORMAL, binPath, NULL, NULL, NULL, NULL, NULL))
{
kprintf(L"[+] \'%s\' service successfully registered\n", serviceName);
if(status = kull_m_service_addWorldToSD(hS))
kprintf(L"[+] \'%s\' service ACL to everyone\n", serviceName);
else PRINT_ERROR_AUTO(L"kull_m_service_addWorldToSD");
}
else PRINT_ERROR_AUTO(L"CreateService");
}
else PRINT_ERROR_AUTO(L"OpenService");
}
if(hS)
{
if(startIt)
{
if(status = StartService(hS, 0, NULL))
kprintf(L"[+] \'%s\' service started\n", serviceName);
else if(GetLastError() == ERROR_SERVICE_ALREADY_RUNNING)
kprintf(L"[*] \'%s\' service already started\n", serviceName);
else PRINT_ERROR_AUTO(L"StartService");
}
CloseServiceHandle(hS);
}
CloseServiceHandle(hSC);
}
else PRINT_ERROR_AUTO(L"OpenSCManager(create)");
return status;
}
BOOL kull_m_service_uninstall(PCWSTR serviceName)
{
BOOL status = FALSE, toRemove = TRUE;
if(kull_m_service_stop(serviceName))
kprintf(L"[+] \'%s\' service stopped\n", serviceName);
else if(GetLastError() == ERROR_SERVICE_NOT_ACTIVE)
kprintf(L"[*] \'%s\' service not running\n", serviceName);
else
{
toRemove = FALSE;
PRINT_ERROR_AUTO(L"kull_m_service_stop");
}
if(toRemove)
{
if(status = kull_m_service_remove(serviceName))
kprintf(L"[+] \'%s\' service removed\n", serviceName);
else PRINT_ERROR_AUTO(L"kull_m_service_remove");
}
return STATUS_SUCCESS;
} | 2,639 |
723 |
#import <AppKit/AppKit.h>
@interface PassThruImageView : NSImageView
@end
| 30 |
1,184 | '''
CPU
===
Simple Example
---------------
To get CPU count::
>>> from plyer import cpu
>>> # 1 socket, 1 core per socket, 2 threads per core
>>> cpu.sockets # 1 CPU socket (or slot)
1
>>> cpu.physical # 1 CPU socket * 1 core per socket
1
>>> cpu.logical # 1 CPU socket * 1 core per socket * 2 threads per core
2
Supported Platforms
-------------------
MacOS
Linux
Windows
'''
class CPU:
'''
Facade providing info about sockets, physical and logical
number of processors.
'''
@property
def sockets(self):
'''
Property that contains the count of CPU sockets.
'''
return self._sockets()
@property
def physical(self):
'''
Property that contains the total number of physical cores
(max core count) in the system.
.. note:: `sockets * cores per socket`
'''
return self._physical()
@property
def logical(self):
'''
Property that contains the total number of logical cores
(max thread count) in the system.
.. note:: `sockets * cores per socket * threads per core`
'''
return self._logical()
@property
def cache(self):
'''
Property that contains the count of L1, L2, L3 caches in the system
as a dictionary `{'L1': int, 'L2': int, 'L3': int}`.
'''
return self._cache()
@property
def numa(self):
'''
Property that contains the count of NUMA nodes in the system.
.. note:: https://en.wikipedia.org/wiki/Non-uniform_memory_access
'''
return self._numa()
# private
def _sockets(self):
raise NotImplementedError()
def _physical(self):
raise NotImplementedError()
def _logical(self):
raise NotImplementedError()
def _cache(self):
raise NotImplementedError()
def _numa(self):
raise NotImplementedError()
| 797 |
335 | {
"word": "Tertiary",
"definitions": [
"Third in order or level.",
"Relating to or denoting education at a level beyond that provided by schools, especially that provided by a college or university.",
"Relating to or denoting the medical treatment provided at a specialist institution.",
"Relating to or denoting the first period of the Cenozoic era, between the Cretaceous and Quaternary periods, and comprising the Palaeogene and Neogene sub-periods.",
"(of an organic compound) having its functional group located on a carbon atom which is itself bonded to three other carbon atoms.",
"(chiefly of amines) derived from ammonia by replacement of three hydrogen atoms by organic groups."
],
"parts-of-speech": "Adjective"
} | 230 |
1,592 | /*
This file is a part of the NVDA project.
Copyright 2018 NV Access Limited.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2.0, as published by
the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This license can be found at:
http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
#pragma once
#include <windows.h>
// A Smart Library handle.
// Construct it with a handle returned by LoadLibrary or similar.
// Once the object goes out of scope, FreeLibrary will automatically be called on the handle.
class CLoadedLibrary {
private:
HMODULE _hModule {nullptr};
CLoadedLibrary(const CLoadedLibrary&)=delete;
const CLoadedLibrary& operator=(const CLoadedLibrary&)=delete;
public:
CLoadedLibrary(HMODULE h): _hModule(h) {};
void free() {
if(_hModule) {
FreeLibrary(_hModule);
_hModule=nullptr;
}
}
CLoadedLibrary& operator=(HMODULE h) {
free();
_hModule=h;
return *this;
}
operator HMODULE() {
return _hModule;
}
operator bool() {
return static_cast<bool>(_hModule);
}
~CLoadedLibrary() {
free();
}
};
| 501 |
1,056 | /*
* 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.html.custom.hints;
import java.util.Objects;
import org.netbeans.modules.csl.api.HintFix;
import org.netbeans.modules.html.custom.conf.Configuration;
import org.netbeans.modules.parsing.api.Snapshot;
import org.openide.cookies.OpenCookie;
import org.openide.filesystems.FileObject;
import org.openide.loaders.DataObject;
import org.openide.util.NbBundle;
/**
*
* @author marek
*/
@NbBundle.Messages(value = "editProjectConfiguration=Edit project's editor custom elements configuration file")
public final class EditProjectsConfFix implements HintFix {
private final Snapshot snapshot;
public EditProjectsConfFix(Snapshot snapshot) {
this.snapshot = snapshot;
}
@Override
public String getDescription() {
return Bundle.editProjectConfiguration();
}
@Override
public void implement() throws Exception {
Configuration conf = Configuration.get(snapshot.getSource().getFileObject());
FileObject projectsConfigurationFile = conf.getProjectsConfigurationFile();
if(projectsConfigurationFile != null) {
DataObject dobj = DataObject.find(projectsConfigurationFile);
OpenCookie oc = dobj.getLookup().lookup(OpenCookie.class);
oc.open();
}
}
@Override
public boolean isSafe() {
return true;
}
@Override
public boolean isInteractive() {
return false;
}
@Override
public int hashCode() {
int hash = 7;
hash = 37 * hash + Objects.hashCode(this.snapshot);
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final EditProjectsConfFix other = (EditProjectsConfFix) obj;
if (!Objects.equals(this.snapshot, other.snapshot)) {
return false;
}
return true;
}
}
| 982 |
706 | /**********************************************************************
Copyright (c) 2020 Advanced Micro Devices, Inc. All rights reserved.
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.
********************************************************************/
#include "scene_trace.h"
#include <unordered_map>
#include "utils/memory_layout.h"
namespace rt::vulkan
{
namespace
{
uint32_t GetBvhNodeCount(uint32_t prim_count) { return 2 * prim_count - 1; }
constexpr char const* s_trace_full_closest_kernel_name = "trace_scene_full_closest.comp.spv";
constexpr char const* s_trace_full_any_kernel_name = "trace_scene_full_any.comp.spv";
constexpr char const* s_trace_instance_closest_kernel_name = "trace_scene_instance_closest.comp.spv";
constexpr char const* s_trace_instance_any_kernel_name = "trace_scene_instance_any.comp.spv";
constexpr char const* s_trace_full_closest_indirect_kernel_name = "trace_scene_full_closest_i.comp.spv";
constexpr char const* s_trace_full_any_indirect_kernel_name = "trace_scene_full_any_i.comp.spv";
constexpr char const* s_trace_instance_closest_indirect_kernel_name = "trace_scene_instance_closest_i.comp.spv";
constexpr char const* s_trace_instance_any_indirect_kernel_name = "trace_scene_instance_any_i.comp.spv";
struct TraceKey
{
RRIntersectQuery query;
RRIntersectQueryOutput query_output;
bool indirect;
bool operator==(const TraceKey& other) const
{
return (query == other.query && query_output == other.query_output && indirect == other.indirect);
}
};
struct KeyHasher
{
size_t operator()(const TraceKey& k) const
{
using std::hash;
constexpr size_t kNumber = 17;
return kNumber * kNumber * k.query + kNumber * k.query_output + uint32_t(k.indirect);
}
};
struct TraceValue
{
TraceValue(char const* kernel_name) : name(kernel_name) {}
char const* name;
std::vector<DescriptorSet> desc_set;
ShaderPtr kernel;
};
constexpr uint32_t kGroupSize = 128u;
constexpr uint32_t kStackSize = 64u;
} // namespace
struct TraceScene::TraceSceneImpl
{
std::shared_ptr<GpuHelper> gpu_helper_;
ShaderManager const& shader_manager_;
// shader things
std::unordered_map<TraceKey, TraceValue, KeyHasher> trace_kernels_ = {
{{RR_INTERSECT_QUERY_CLOSEST, RR_INTERSECT_QUERY_OUTPUT_FULL_HIT, false}, {s_trace_full_closest_kernel_name}},
{{RR_INTERSECT_QUERY_CLOSEST, RR_INTERSECT_QUERY_OUTPUT_INSTANCE_ID, false},
{s_trace_instance_closest_kernel_name}},
{{RR_INTERSECT_QUERY_ANY, RR_INTERSECT_QUERY_OUTPUT_FULL_HIT, false}, {s_trace_full_any_kernel_name}},
{{RR_INTERSECT_QUERY_ANY, RR_INTERSECT_QUERY_OUTPUT_INSTANCE_ID, false}, {s_trace_instance_any_kernel_name}},
{{RR_INTERSECT_QUERY_CLOSEST, RR_INTERSECT_QUERY_OUTPUT_FULL_HIT, true},
{s_trace_full_closest_indirect_kernel_name}},
{{RR_INTERSECT_QUERY_CLOSEST, RR_INTERSECT_QUERY_OUTPUT_INSTANCE_ID, true},
{s_trace_instance_closest_indirect_kernel_name}},
{{RR_INTERSECT_QUERY_ANY, RR_INTERSECT_QUERY_OUTPUT_FULL_HIT, true}, {s_trace_full_any_indirect_kernel_name}},
{{RR_INTERSECT_QUERY_ANY, RR_INTERSECT_QUERY_OUTPUT_INSTANCE_ID, true},
{s_trace_instance_any_indirect_kernel_name}}};
DescriptorCacheTable<5, 1> cache_;
TraceSceneImpl(std::shared_ptr<GpuHelper> helper, ShaderManager const& shader_manager)
: gpu_helper_(helper), shader_manager_(shader_manager), cache_(gpu_helper_)
{
Init();
}
void Init()
{
for (auto& kernel : trace_kernels_)
{
kernel.second.kernel = shader_manager_.CreateKernel(kernel.second.name);
kernel.second.desc_set = shader_manager_.CreateDescriptorSets(kernel.second.kernel);
shader_manager_.PrepareKernel(kernel.second.name, kernel.second.desc_set);
}
}
~TraceSceneImpl()
{
for (auto kernel : trace_kernels_)
{
for (auto& desc : kernel.second.desc_set)
{
gpu_helper_->device.destroyDescriptorSetLayout(desc.layout_);
}
}
}
};
TraceScene::TraceScene(std::shared_ptr<GpuHelper> gpu_helper, ShaderManager const& shader_manager)
: impl_(std::make_unique<TraceSceneImpl>(gpu_helper, shader_manager))
{
}
TraceScene::~TraceScene() = default;
void TraceScene::operator()(vk::CommandBuffer command_buffer,
RRIntersectQuery query,
RRIntersectQueryOutput query_output,
vk::Buffer bvh,
size_t bvh_offset,
ChildrenBvhsDesc const& children_bvh,
uint32_t ray_count,
vk::Buffer ray_count_buffer,
size_t ray_count_buffer_offset,
vk::Buffer rays,
size_t rays_offset,
vk::Buffer hits,
size_t hits_offset,
vk::Buffer scratch,
size_t scratch_offset)
{
auto descriptor_set = GetDescriptor(query,
query_output,
bvh,
bvh_offset,
children_bvh,
ray_count_buffer,
ray_count_buffer_offset,
rays,
rays_offset,
hits,
hits_offset,
scratch,
scratch_offset);
ShaderPtr kernel = impl_->trace_kernels_.at({query, query_output, bool(ray_count_buffer)}).kernel;
uint32_t num_groups = CeilDivide(ray_count, kGroupSize);
uint32_t constants[] = {ray_count};
// Set prim counter push constant.
impl_->gpu_helper_->EncodePushConstant(kernel->pipeline_layout, 0u, sizeof(constants), constants, command_buffer);
impl_->gpu_helper_->EncodeBindDescriptorSets(&descriptor_set, 1u, 0u, kernel->pipeline_layout, command_buffer);
// Launch kernel.
impl_->shader_manager_.EncodeDispatch1D(*kernel, num_groups, command_buffer);
impl_->gpu_helper_->EncodeBufferBarrier(hits,
vk::AccessFlagBits::eShaderWrite,
vk::AccessFlagBits::eShaderRead,
vk::PipelineStageFlagBits::eComputeShader,
vk::PipelineStageFlagBits::eComputeShader,
command_buffer);
}
size_t TraceScene::GetScratchSize(uint32_t ray_count) const { return sizeof(uint32_t) * kStackSize * ray_count; }
vk::DescriptorSet TraceScene::GetDescriptor(RRIntersectQuery query,
RRIntersectQueryOutput query_output,
vk::Buffer bvh,
size_t bvh_offset,
ChildrenBvhsDesc const& children_bvh,
vk::Buffer ray_count_buffer,
size_t ray_count_buffer_offset,
vk::Buffer rays,
size_t rays_offset,
vk::Buffer hits,
size_t hits_offset,
vk::Buffer scratch,
size_t scratch_offset)
{
std::array<vk::Buffer, 5> key = {bvh, ray_count_buffer, rays, hits, scratch};
if (impl_->cache_.Contains(key))
{
return impl_->cache_.Get(key)[0];
}
auto prim_count = children_bvh.bvhs_count;
auto bvh_size = RoundUp(uint32_t(GetBvhNodeCount(prim_count) * sizeof(BvhNode)), kAlignment);
auto transforms_size = RoundUp(uint32_t(2 * prim_count * sizeof(Transform)), kAlignment);
std::vector<vk::DescriptorBufferInfo> info = {
{bvh, bvh_offset, bvh_size}, {bvh, bvh_offset + bvh_size, transforms_size}, {rays, rays_offset, VK_WHOLE_SIZE}};
if (ray_count_buffer)
{
info.emplace_back(ray_count_buffer, ray_count_buffer_offset, VK_WHOLE_SIZE);
}
info.emplace_back(hits, hits_offset, VK_WHOLE_SIZE);
info.emplace_back(scratch, scratch_offset, VK_WHOLE_SIZE);
for (const auto& child : children_bvh.buffers)
{
info.emplace_back(child.first, child.second, VK_WHOLE_SIZE);
}
auto trace_value = impl_->trace_kernels_.at({query, query_output, bool(ray_count_buffer)});
vk::DescriptorSet trace_desc_set = impl_->gpu_helper_->AllocateDescriptorSet(trace_value.desc_set[0].layout_);
impl_->gpu_helper_->WriteDescriptorSet(trace_desc_set, info.data(), (uint32_t)info.size());
impl_->cache_.Push(key, {trace_desc_set});
return trace_desc_set;
}
} // namespace rt::vulkan | 5,394 |
486 | //
// RKAppDelegate.h
// RKTagsView
//
// Created by <NAME> on 03/02/2016.
// Copyright (c) 2016 <NAME>. All rights reserved.
//
@import UIKit;
@interface RKAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
| 101 |
831 | package com.android.tools.idea.gradle.project;
import org.jetbrains.plugins.gradle.service.project.GradleImportCustomizer;
public class AndroidStudioGradleImportCustomizer extends GradleImportCustomizer {
@Override
public String getPlatformPrefix() {
return "AndroidStudio";
}
@Override
public boolean useExtraJvmArgs() {
return true;
}
}
| 111 |
2,771 | <filename>app/src/main/java/com/shizhefei/indicator/spring/SpringActivity.java
package com.shizhefei.indicator.spring;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.shizhefei.indicator.DisplayUtil;
import com.shizhefei.indicator.demo.R;
import com.shizhefei.view.indicator.Indicator;
import com.shizhefei.view.indicator.IndicatorViewPager;
import com.shizhefei.view.indicator.IndicatorViewPager.IndicatorPagerAdapter;
import com.shizhefei.view.indicator.IndicatorViewPager.IndicatorViewPagerAdapter;
import com.shizhefei.view.indicator.ScrollIndicatorView;
import com.shizhefei.view.indicator.slidebar.SpringBar;
import com.shizhefei.view.indicator.transition.OnTransitionTextListener;
public class SpringActivity extends Activity {
private IndicatorViewPager indicatorViewPager;
private LayoutInflater inflate;
private int unSelectColor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_spring);
ViewPager viewPager = (ViewPager) findViewById(R.id.spring_viewPager);
Indicator indicator = (ScrollIndicatorView) findViewById(R.id.spring_indicator);
int selectColor = Color.parseColor("#f8f8f8");
unSelectColor = Color.parseColor("#010101");
indicator.setOnTransitionListener(new OnTransitionTextListener().setColor(selectColor, unSelectColor));
indicator.setScrollBar(new SpringBar(getApplicationContext(), Color.GRAY));
// indicator.setScrollBar(new ColorBar(getApplicationContext(), Color.RED, 5));
viewPager.setOffscreenPageLimit(4);
indicatorViewPager = new IndicatorViewPager(indicator, viewPager);
inflate = LayoutInflater.from(getApplicationContext());
indicatorViewPager.setAdapter(adapter);
indicatorViewPager.setCurrentItem(5, false);
}
private IndicatorPagerAdapter adapter = new IndicatorViewPagerAdapter() {
@Override
public View getViewForTab(int position, View convertView, ViewGroup container) {
if (convertView == null) {
convertView = inflate.inflate(R.layout.tab_top, container, false);
}
TextView textView = (TextView) convertView;
int padding = DisplayUtil.dipToPix(getApplicationContext(), 30);
textView.setPadding(padding, 0, padding, 0);
textView.setText(String.valueOf(position));
textView.setTextColor(unSelectColor);
return convertView;
}
@Override
public View getViewForPage(int position, View convertView, ViewGroup container) {
if (convertView == null) {
convertView = inflate.inflate(R.layout.fragment_tabmain_item, container, false);
}
final TextView textView = (TextView) convertView.findViewById(R.id.fragment_mainTab_item_textView);
textView.setText(" " + position + " 界面加载完毕");
final ProgressBar progressBar = (ProgressBar) convertView.findViewById(R.id.fragment_mainTab_item_progressBar);
new Handler() {
public void handleMessage(android.os.Message msg) {
textView.setVisibility(View.VISIBLE);
progressBar.setVisibility(View.GONE);
}
}.sendEmptyMessageDelayed(1, 3000);
return convertView;
}
@Override
public int getItemPosition(Object object) {
//这是ViewPager适配器的特点,有两个值 POSITION_NONE,POSITION_UNCHANGED,默认就是POSITION_UNCHANGED,
// 表示数据没变化不用更新.notifyDataChange的时候重新调用getViewForPage
return PagerAdapter.POSITION_UNCHANGED;
}
@Override
public int getCount() {
return 16;
}
};
}
| 1,731 |
384 | <gh_stars>100-1000
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.tez.dag.app.dag.impl;
public class ServicePluginInfo {
private String containerLauncherName;
private String taskSchedulerName;
private String taskCommunicatorName;
private String containerLauncherClassName;
private String taskSchedulerClassName;
private String taskCommunicatorClassName;
public ServicePluginInfo() {
}
public String getContainerLauncherName() {
return containerLauncherName;
}
public ServicePluginInfo setContainerLauncherName(String containerLauncherName) {
this.containerLauncherName = containerLauncherName;
return this;
}
public String getTaskSchedulerName() {
return taskSchedulerName;
}
public ServicePluginInfo setTaskSchedulerName(String taskSchedulerName) {
this.taskSchedulerName = taskSchedulerName;
return this;
}
public String getTaskCommunicatorName() {
return taskCommunicatorName;
}
public ServicePluginInfo setTaskCommunicatorName(String taskCommunicatorName) {
this.taskCommunicatorName = taskCommunicatorName;
return this;
}
public String getContainerLauncherClassName() {
return containerLauncherClassName;
}
public ServicePluginInfo setContainerLauncherClassName(String containerLauncherClassName) {
this.containerLauncherClassName = containerLauncherClassName;
return this;
}
public String getTaskSchedulerClassName() {
return taskSchedulerClassName;
}
public ServicePluginInfo setTaskSchedulerClassName(String taskSchedulerClassName) {
this.taskSchedulerClassName = taskSchedulerClassName;
return this;
}
public String getTaskCommunicatorClassName() {
return taskCommunicatorClassName;
}
public ServicePluginInfo setTaskCommunicatorClassName(String taskCommunicatorClassName) {
this.taskCommunicatorClassName = taskCommunicatorClassName;
return this;
}
@Override
public String toString() {
return "ServicePluginInfo {" +
"containerLauncherName=" + containerLauncherName +
", taskSchedulerName=" + taskSchedulerName +
", taskCommunicatorName=" + taskCommunicatorName +
", containerLauncherClassName=" + containerLauncherClassName +
", taskSchedulerClassName=" + taskSchedulerClassName +
", taskCommunicatorClassName=" + taskCommunicatorClassName +
" }";
}
}
| 917 |
28,056 | package com.alibaba.json.bvt.serializer;
import java.io.File;
import org.junit.Assert;
import junit.framework.TestCase;
import com.alibaba.fastjson.JSON;
public class FileTest extends TestCase {
public void test_file() throws Exception {
File file = new File("abc.txt");
String text = JSON.toJSONString(file);
Assert.assertEquals(JSON.toJSONString(file.getPath()), text);
File file2 = JSON.parseObject(text, File.class);
Assert.assertEquals(file, file2);
}
}
| 241 |
351 | <reponame>possibilities/CQ-editor
from sys import platform
from path import Path
from os import system
from shutil import make_archive
from cq_editor import __version__ as version
out_p = Path('dist/CQ-editor')
out_p.rmtree_p()
build_p = Path('build')
build_p.rmtree_p()
system("pyinstaller pyinstaller.spec")
if platform == 'linux':
with out_p:
p = Path('.').glob('libpython*')[0]
p.symlink(p.split(".so")[0]+".so")
make_archive(f'CQ-editor-{version}-linux64','bztar', out_p / '..', 'CQ-editor')
elif platform == 'win32':
make_archive(f'CQ-editor-{version}-win64','zip', out_p / '..', 'CQ-editor')
| 281 |
553 | /****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
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.
****************************************************************************/
package org.cocos2dx.plugin;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Hashtable;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.KeyEvent;
public class IAPAlipay implements InterfaceIAP {
private static final String LOG_TAG = "IAPAlipay";
private static Activity mContext = null;
private static boolean bDebug = false;
private static Handler mHandler = null;
private static IAPAlipay mAdapter = null;
protected static void LogE(String msg, Exception e) {
Log.e(LOG_TAG, msg, e);
e.printStackTrace();
}
protected static void LogD(String msg) {
if (bDebug) {
Log.d(LOG_TAG, msg);
}
}
public IAPAlipay(Context context) {
mContext = (Activity) context;
mAdapter = this;
PluginWrapper.runOnMainThread(new Runnable() {
@Override
public void run() {
initUIHandle();
}
});
}
@Override
public void configDeveloperInfo(Hashtable<String, String> cpInfo) {
LogD("initDeveloperInfo invoked " + cpInfo.toString());
try {
PartnerConfig.PARTNER = cpInfo.get("AlipayPartner");
PartnerConfig.SELLER = cpInfo.get("AlipaySeller");
PartnerConfig.RSA_PRIVATE = cpInfo.get("AlipayRsaPrivate");
PartnerConfig.RSA_ALIPAY_PUBLIC = cpInfo.get("AlipayPublic");
PartnerConfig.ALIPAY_PLUGIN_NAME = cpInfo.get("AlipayPluginName");
strPayAccount = cpInfo.get("AlipayRoyPayAccount");
strReceiveAccount = cpInfo.get("AlipayRoyReceiveAccount");
fPayPercent = ((cpInfo.get("AlipayRoyPercent") == null) ? 0.0f : Float.parseFloat(cpInfo.get("AlipayRoyPercent")));
strRoyTip = cpInfo.get("AlipayRoyTip");
strNotifyUrl = ((null == cpInfo.get("AlipayNotifyUrl")) ? "" : cpInfo.get("AlipayNotifyUrl"));
} catch (Exception e) {
LogE("Developer info is wrong!", e);
}
}
@Override
public void payForProduct(Hashtable<String, String> info) {
LogD("payForProduct invoked " + info.toString());
if (! networkReachable()) {
payResult(IAPWrapper.PAYRESULT_FAIL, "网络不可用");
return;
}
final Hashtable<String, String> productInfo = info;
PluginWrapper.runOnMainThread(new Runnable() {
@Override
public void run() {
MobileSecurePayHelper mspHelper = new MobileSecurePayHelper(mContext);
boolean bInstalled = mspHelper.detectMobile_sp();
if (! bInstalled) {
payResult(IAPWrapper.PAYRESULT_FAIL, "未安装支付宝插件");
return;
}
// start pay for this order.
// 根据订单信息开始进行支付
try {
// prepare the order info.
// 准备订单信息
String orderInfo = getOrderInfo(productInfo);
// 这里根据签名方式对订单信息进行签名
String signType = getSignType();
String strsign = sign(signType, orderInfo);
// 对签名进行编码
strsign = URLEncoder.encode(strsign);
// 组装好参数
String info = orderInfo + "&sign=" + "\"" + strsign + "\"" + "&" + getSignType();
LogD("pay info : " + info);
// start the pay.
// 调用pay方法进行支付
MobileSecurePayer msp = new MobileSecurePayer();
boolean bRet = msp.pay(info, mHandler, AlixId.RQF_PAY, mContext);
if (bRet) {
// show the progress bar to indicate that we have started
// paying.
// 显示“正在支付”进度条
closeProgress();
mProgress = BaseHelper.showProgress(mContext, null, "正在支付", false, true);
} else {
payResult(IAPWrapper.PAYRESULT_FAIL, "支付失败");
return;
}
} catch (Exception ex) {
LogE("Remote call failed", ex);
payResult(IAPWrapper.PAYRESULT_FAIL, "remote call failed");
return;
}
}
});
}
@Override
public void setDebugMode(boolean debug) {
bDebug = debug;
}
@Override
public String getSDKVersion() {
return "Unknown version";
}
static class AlixOnCancelListener implements DialogInterface.OnCancelListener {
Activity mcontext;
AlixOnCancelListener(Activity context) {
mcontext = context;
}
public void onCancel(DialogInterface dialog) {
mcontext.onKeyDown(KeyEvent.KEYCODE_BACK, null);
}
}
private static void initUIHandle() {
//
// the handler use to receive the pay result.
// 这里接收支付结果,支付宝手机端同步通知
mHandler = new Handler() {
public void handleMessage(Message msg) {
try {
String strRet = (String) msg.obj;
LogD("handle msg : " + msg.toString());
switch (msg.what) {
case AlixId.RQF_PAY: {
LogD("msg.what is RQF_PAY");
mAdapter.closeProgress();
// 从通知中获取参数
try {
// 获取交易状态,具体状态代码请参看文档
String memo = "memo=";
int imemoStart = strRet.indexOf("memo=");
imemoStart += memo.length();
int imemoEnd = strRet.indexOf(";result=");
memo = strRet.substring(imemoStart, imemoEnd);
// 对通知进行验签
ResultChecker resultChecker = new ResultChecker(strRet);
int retVal = resultChecker.checkSign();
// 返回验签结果以及交易状态
if (retVal == ResultChecker.RESULT_CHECK_SIGN_FAILED) {
payResult(IAPWrapper.PAYRESULT_FAIL, "签名验证失败");
} else if (retVal == ResultChecker.RESULT_CHECK_SIGN_SUCCEED && resultChecker.isPayOk()) {
payResult(IAPWrapper.PAYRESULT_SUCCESS, "支付成功");
} else {
payResult(IAPWrapper.PAYRESULT_FAIL, "支付失败");
}
} catch (Exception e) {
e.printStackTrace();
payResult(IAPWrapper.PAYRESULT_FAIL, "结果解析失败");
}
}
break;
default:
mAdapter.closeProgress();
payResult(IAPWrapper.PAYRESULT_FAIL, "支付失败");
break;
}
super.handleMessage(msg);
} catch (Exception e) {
e.printStackTrace();
}
}
};
}
/**
* get the selected order info for pay. 获取商品订单信息
*
* @param position
* 商品在列表中的位置
* @return
*/
private static String strPayAccount = "";
private static String strReceiveAccount = "";
private static float fPayPercent = 0.0f;
private static String strRoyTip = "";
private static String strNotifyUrl = "";
private String getOrderInfo(Hashtable<String, String> info) {
String strRet = null;
try {
float price = Float.parseFloat(info.get("productPrice"));//IAPProducts.getProductPrice(productID);
String productName = info.get("productName");
String productDesc = info.get("productDesc");
String royParam = "";
if (fPayPercent > 0 ) {
float royValue = fPayPercent * price;
royParam = strPayAccount + "^" + strReceiveAccount + "^" + royValue + "^"+ strRoyTip;
royParam = "&royalty_parameters=\""+ royParam + "\"" + "&royalty_type=\"10" + "\"";
}
strRet = "partner=\"" + PartnerConfig.PARTNER + "\""
+ "&seller=\"" + PartnerConfig.SELLER + "\""
+ "&out_trade_no=\"" + getOutTradeNo() + "\""
+ "&subject=\"" + productName + "\""
+ "&body=\"" + productDesc + "\""
+ "&total_fee=\"" + price + "\""
+ "¬ify_url=\"" + strNotifyUrl + "\""
+ royParam;
} catch (Exception e) {
LogE("Product info parse error", e);
}
LogD("order info : " + strRet);
return strRet;
}
/**
* get the out_trade_no for an order.
* 获取外部订单号
*
* @return
*/
String getOutTradeNo() {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
Date date = new Date();
String strKey = format.format(date);
java.util.Random r = new java.util.Random();
strKey = strKey + r.nextInt(10000);
return strKey;
}
//
//
/**
* sign the order info.
* 对订单信息进行签名
*
* @param signType 签名方式
* @param content 待签名订单信息
* @return
*/
private String sign(String signType, String content) {
LogD("sign params :");
LogD("type : " + signType + ", content : " + content + ", private : " + PartnerConfig.RSA_PRIVATE);
return Rsa.sign(content, PartnerConfig.RSA_PRIVATE);
}
/**
* get the sign type we use.
* 获取签名方式
*
* @return
*/
private String getSignType() {
String getSignType = "sign_type=" + "\"" + "RSA" + "\"";
return getSignType;
}
private ProgressDialog mProgress = null;
void closeProgress() {
try {
if (mProgress != null) {
mProgress.dismiss();
mProgress = null;
}
} catch (Exception e) {
e.printStackTrace();
}
}
private boolean networkReachable() {
boolean bRet = false;
try {
ConnectivityManager conn = (ConnectivityManager)mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = conn.getActiveNetworkInfo();
bRet = (null == netInfo) ? false : netInfo.isAvailable();
} catch (Exception e) {
LogE("Fail to check network status", e);
}
LogD("NetWork reachable : " + bRet);
return bRet;
}
private static void payResult(int ret, String msg) {
IAPWrapper.onPayResult(mAdapter, ret, msg);
LogD("Alipay result : " + ret + " msg : " + msg);
}
@Override
public String getPluginVersion() {
return "0.2.0";
}
}
| 4,709 |
794 | /*
* 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.mina.api;
import org.apache.mina.service.executor.IoHandlerExecutor;
/**
* Handle all the I/O events generated by a {@link IoService}.
* <p>
* You should handle your business logic in an IoHandler implementation.
* <p>
* The {@link IoFilter} is dedicated to message transformation, but the IoHandler is mean to be the core of your
* business logic.
* <p>
* If you need to implement blocking code in your {@link IoHandler}, then you need to add a {@link IoHandlerExecutor} in
* the enclosing {@link IoService}.
*/
public interface IoHandler {
/**
* Invoked when a connection has been opened.
*
* @param session {@link IoSession} associated with the invocation
*/
void sessionOpened(IoSession session);
/**
* Invoked when a connection is closed.
*
* @param session {@link IoSession} associated with the invocation
*/
void sessionClosed(IoSession session);
/**
* Invoked with the related {@link IdleStatus} when a connection becomes idle.
*
* @param session {@link IoSession} associated with the invocation
*/
void sessionIdle(IoSession session, IdleStatus status);
/**
* Invoked when a message is received.
*
* @param session {@link IoSession} associated with the invocation
* @param message the incoming message to process
*/
void messageReceived(IoSession session, Object message);
/**
* Invoked when a high level message was written to the low level O/S buffer.
*
* @param session {@link IoSession} associated with the invocation
* @param message the incoming message to process
*/
void messageSent(IoSession session, Object message);
/**
* Invoked when a new service is activated by an {@link IoService}.
*
* @param service the {@link IoService}
*/
void serviceActivated(IoService service);
/**
* Invoked when a service is inactivated by an {@link IoService}.
*
* @param service the {@link IoService}
*/
void serviceInactivated(IoService service);
/**
* Invoked when any runtime exception is thrown during session processing (filters, unexpected error, etc..).
*
* @param session the session related to the exception
* @param cause the caught exception
*/
void exceptionCaught(IoSession session, Exception cause);
/**
* Invoked for secured session when the handshake has been started. May be called
* several times for a single session in case of rehandshake.
* @param session {@link IoSession} associated with the invocation
*/
void handshakeStarted(IoSession abstractIoSession);
/**
* Invoked for secured session when the handshake has been completed. May be called
* several times for a single session in case of rehandshake.
* @param session {@link IoSession} associated with the invocation
*/
void handshakeCompleted(IoSession session);
/**
* Invoked for secured session when underlying SSL/TLS session has been closed.
* @param session {@link IoSession} associated with the invocation
*/
void secureClosed(IoSession session);
}
| 1,237 |
16,989 | <reponame>jobechoi/bazel<filename>src/main/res/winsdk_toolchain.bzl
# Copyright 2019 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Toolchain definition for Windows Resource Compiler toolchains.
Usage:
load(
":winsdk_toolchain.bzl",
"WINDOWS_RESOURCE_COMPILER_TOOLCHAIN_TYPE",
"windows_resource_compiler_toolchain",
)
windows_resource_compiler_toolchain(
name = "foo_rc_toolchain",
rc_path = "...", # label of Resource Compiler or its wrapper
)
toolchain(
name = "foo_rc",
exec_compatible_with = [
# Add constraints here, if applicable.
],
target_compatible_with = [
# Add constraints here, if applicable.
],
toolchain = ":foo_rc_toolchain",
toolchain_type = WINDOWS_RESOURCE_COMPILER_TOOLCHAIN_TYPE,
)
"""
WINDOWS_RESOURCE_COMPILER_TOOLCHAIN_TYPE = "@io_bazel//src/main/res:toolchain_type"
WindowsResourceCompilerInfo = provider(
fields = ["rc_exe"],
doc = "Toolchain info for the Resource Compiler on Windows",
)
def _impl(ctx):
toolchain_info = platform_common.ToolchainInfo(
win_rc_info = WindowsResourceCompilerInfo(
rc_exe = ctx.executable.rc_exe,
),
)
return [toolchain_info]
windows_resource_compiler_toolchain = rule(
doc = "Toolchain rule for the Resource Compiler on Windows",
implementation = _impl,
attrs = {
"rc_exe": attr.label(
allow_files = True,
executable = True,
cfg = "host",
doc = "Label of the resource compiler (or a wrapper script)",
),
},
)
| 843 |
463 | <reponame>jasnzhuang/Personal-Homework
#ifndef __MST_H__
#define __MST_H__
#include "conf.h"
#include "union_find_set.h"
class MST
{
UFS ufs;
std::vector<Edge>edge, mst;
public:
//set the precision in output mst total weight
static int MST_PRECISION;
//Using Kruskal algorithm to calculate minimum spanning tree.
MST(const std::vector<Edge> &_edge);
//Saving minimum spanning tree's infomation into file $(filename).
std::vector<Edge> Save(const std::string &filename);
};
class Prim
{
std::vector<ld>dist;
std::vector<int>left, right;
public:
//Using Prim algorithm to calculate minimum spanning tree.
Prim(std::vector<Simple_Point>data);
};
#endif
| 262 |
384 | <gh_stars>100-1000
import graphene
import graphene_django_optimizer as gql_optimizer
from nautobot.virtualization.models import VirtualMachine, VMInterface
from nautobot.virtualization.filters import VirtualMachineFilterSet, VMInterfaceFilterSet
class VirtualMachineType(gql_optimizer.OptimizedDjangoObjectType):
"""GraphQL type object for VirtualMachine model."""
class Meta:
model = VirtualMachine
filterset_class = VirtualMachineFilterSet
class VMInterfaceType(gql_optimizer.OptimizedDjangoObjectType):
"""GraphQL type object for VMInterface model."""
class Meta:
model = VMInterface
filterset_class = VMInterfaceFilterSet
exclude = ["_name"]
ip_addresses = graphene.List("nautobot.ipam.graphql.types.IPAddressType")
# VMInterface.ip_addresses is the reverse side of a GenericRelation that cannot be auto-optimized.
# See: https://github.com/tfoxy/graphene-django-optimizer#advanced-usage
@gql_optimizer.resolver_hints(
model_field="ip_addresses",
)
def resolve_ip_addresses(self, args):
return self.ip_addresses.all()
| 390 |
16,989 | // Copyright 2016 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.devtools.build.lib.windows;
import com.google.devtools.build.lib.shell.ShellUtils;
import com.google.devtools.build.lib.shell.Subprocess;
import com.google.devtools.build.lib.shell.SubprocessBuilder;
import com.google.devtools.build.lib.shell.SubprocessBuilder.StreamAction;
import com.google.devtools.build.lib.shell.SubprocessFactory;
import com.google.devtools.build.lib.vfs.PathFragment;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
/** A subprocess factory that uses the Win32 API. */
public class WindowsSubprocessFactory implements SubprocessFactory {
public static final WindowsSubprocessFactory INSTANCE = new WindowsSubprocessFactory();
@Override
public Subprocess create(SubprocessBuilder builder) throws IOException {
List<String> argv = builder.getArgv();
// DO NOT quote argv0, createProcess will do it for us.
String argv0 = processArgv0(argv.get(0));
String argvRest =
argv.size() > 1
? escapeArgvRest(argv.subList(1, argv.size()), argv0.equals("cmd.exe"))
: "";
byte[] env = convertEnvToNative(builder.getEnv());
String stdoutPath = getRedirectPath(builder.getStdout(), builder.getStdoutFile());
String stderrPath = getRedirectPath(builder.getStderr(), builder.getStderrFile());
long nativeProcess =
WindowsProcesses.createProcess(
argv0,
argvRest,
env,
builder.getWorkingDirectory().getPath(),
stdoutPath,
stderrPath,
builder.redirectErrorStream());
String error = WindowsProcesses.processGetLastError(nativeProcess);
if (!error.isEmpty()) {
WindowsProcesses.deleteProcess(nativeProcess);
throw new IOException(error);
}
return new WindowsSubprocess(
nativeProcess,
argv0 + " " + argvRest,
stdoutPath != null,
stderrPath != null,
builder.getTimeoutMillis());
}
private static String escapeArgvRest(List<String> argv, boolean isCmd) {
StringBuilder result = new StringBuilder();
boolean first = true;
for (String arg : argv) {
if (first) {
first = false;
} else {
result.append(" ");
}
if (isCmd) {
result.append(arg);
} else {
result.append(ShellUtils.windowsEscapeArg(arg));
}
}
return result.toString();
}
public static String processArgv0(String argv0) {
// Normalize the path and make it Windows-style.
// If argv0 is at least MAX_PATH (260 chars) long, createNativeProcess calls GetShortPathNameW
// to obtain a 8dot3 name for it (thereby support long paths in CreateProcessA), but then argv0
// must be prefixed with "\\?\" for GetShortPathNameW to work, so it also must be an absolute,
// normalized, Windows-style path.
// Therefore if it's absolute, then normalize it also.
// If it's not absolute, then it cannot be longer than MAX_PATH, since MAX_PATH also limits the
// length of file names.
PathFragment argv0fragment = PathFragment.create(argv0);
return argv0fragment.isAbsolute() ? argv0fragment.getPathString().replace('/', '\\') : argv0;
}
private static String getRedirectPath(StreamAction action, File file) {
switch (action) {
case DISCARD:
return "NUL"; // That's /dev/null on Windows
case REDIRECT:
return file.getPath();
case STREAM:
return null;
default:
throw new IllegalStateException();
}
}
/** Converts an environment map to the format expected in lpEnvironment by CreateProcess(). */
private static byte[] convertEnvToNative(Map<String, String> envMap) throws IOException {
Map<String, String> realEnv = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
Map<String, String> systemEnv = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
if (envMap != null) {
realEnv.putAll(envMap);
}
// It is fine to use System.getenv to get default SYSTEMROOT and SYSTEMDRIVE, because they are
// very special system environment variables and Bazel's client and server are running on the
// same machine, so it should be the same in client environment.
systemEnv.putAll(System.getenv());
// Some versions of MSVCRT.DLL and tools require SYSTEMROOT and SYSTEMDRIVE to be set. They are
// very common environment variables on Windows, so we add these environment variables
// regardless of whether the caller requested it or not.
String[] systemEnvironmentVars = {"SYSTEMROOT", "SYSTEMDRIVE"};
for (String env : systemEnvironmentVars) {
if (realEnv.getOrDefault(env, null) == null) {
String value = systemEnv.getOrDefault(env, null);
if (value != null) {
realEnv.put(env, value);
}
}
}
if (realEnv.isEmpty()) {
// Special case: CreateProcess() always expects the environment block to be terminated
// with two zeros.
return "\0".getBytes(StandardCharsets.UTF_16LE);
}
StringBuilder result = new StringBuilder();
for (Map.Entry<String, String> entry : realEnv.entrySet()) {
if (entry.getKey().contains("=")) {
// lpEnvironment requires no '=' in environment variable name, but on Windows,
// System.getenv() returns environment variables like '=C:' or '=ExitCode', so it can't
// be an error, we have ignore them here.
continue;
}
result.append(entry.getKey() + "=" + entry.getValue() + "\0");
}
result.append("\0");
return result.toString().getBytes(StandardCharsets.UTF_16LE);
}
}
| 2,236 |
511 | /****************************************************************************
*
* Copyright 2016 Samsung Electronics 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.
*
****************************************************************************/
/********************************************************************************
* libc/pthread/pthread_barrierwait.c
*
* Copyright (C) 2007, 2009, 2014 <NAME>. All rights reserved.
* Author: <NAME> <<EMAIL>>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
********************************************************************************/
/********************************************************************************
* Included Files
********************************************************************************/
#include <tinyara/config.h>
#include <sys/types.h>
#include <pthread.h>
#include <semaphore.h>
#include <sched.h>
#include <errno.h>
#include <debug.h>
/********************************************************************************
* Definitions
********************************************************************************/
/********************************************************************************
* Private Type Declarations
********************************************************************************/
/********************************************************************************
* Global Variables
********************************************************************************/
/********************************************************************************
* Private Variables
********************************************************************************/
/********************************************************************************
* Private Function Prototypes
********************************************************************************/
/********************************************************************************
* Public Functions
********************************************************************************/
/********************************************************************************
* Name: pthread_barrier_wait
*
* Description:
* The pthread_barrier_wait() function synchronizse participating threads at
* the barrier referenced by 'barrier'. The calling thread is blocked until
* the required number of threads have called pthread_barrier_wait() specifying
* the same 'barrier'. When the required number of threads have called
* pthread_barrier_wait() specifying the 'barrier', the constant
* PTHREAD_BARRIER_SERIAL_THREAD will be returned to one unspecified thread
* and zero will be returned to each of the remaining threads. At this point,
* the barrier will be reset to the state it had as a result of the most recent
* pthread_barrier_init() function that referenced it.
*
* The constant PTHREAD_BARRIER_SERIAL_THREAD is defined in pthread.h and its
* value must be distinct from any other value returned by pthread_barrier_wait().
*
* The results are undefined if this function is called with an uninitialized
* barrier.
*
* If a signal is delivered to a thread blocked on a barrier, upon return from
* the signal handler the thread will resume waiting at the barrier if the barrier
* wait has not completed; otherwise, the thread will continue as normal from
* the completed barrier wait. Until the thread in the signal handler returns
* from it, it is unspecified whether other threads may proceed past the barrier
* once they have all reached it.
*
* A thread that has blocked on a barrier will not prevent any unblocked thread
* that is eligible to use the same processing resources from eventually making
* forward progress in its execution. Eligibility for processing resources will
* be determined by the scheduling policy.
*
* Parameters:
* barrier - the barrier to wait on
*
* Return Value:
* 0 (OK) on success or EINVAL if the barrier is not valid.
*
* Assumptions:
*
********************************************************************************/
int pthread_barrier_wait(FAR pthread_barrier_t *barrier)
{
int semcount;
int ret = OK;
if (!barrier) {
return EINVAL;
}
/* Disable pre-emption throughout the following */
sched_lock();
/* Find out how many threads are already waiting at the barrier */
ret = sem_getvalue(&barrier->sem, &semcount);
if (ret != OK) {
sched_unlock();
return EINVAL;
}
/* If the number of waiters would be equal to the count, then we are done */
if ((1 - semcount) >= (int)barrier->count) {
/* Free all of the waiting threads */
while (semcount < 0) {
(void)sem_post(&barrier->sem);
(void)sem_getvalue(&barrier->sem, &semcount);
}
/* Then return PTHREAD_BARRIER_SERIAL_THREAD to the final thread */
sched_unlock();
return PTHREAD_BARRIER_SERIAL_THREAD;
} else {
/* Otherwise, this thread must wait as well */
while (sem_wait(&barrier->sem) != OK) {
/* If the thread is awakened by a signal, just continue to wait */
int errornumber = get_errno();
if (errornumber != EINTR) {
/* If it is awakened by some other error, then there is a
* problem
*/
sched_unlock();
return errornumber;
}
}
/* We will only get here when we are one of the N-1 threads that were
* waiting for the final thread at the barrier. We just need to return
* zero.
*/
sched_unlock();
return 0;
}
}
| 1,847 |
6,224 | <filename>drivers/display/display_st7789v.h<gh_stars>1000+
/*
* Copyright (c) 2019 <NAME>
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ST7789V_DISPLAY_DRIVER_H__
#define ST7789V_DISPLAY_DRIVER_H__
#include <zephyr.h>
#define ST7789V_CMD_SW_RESET 0x01
#define ST7789V_CMD_SLEEP_IN 0x10
#define ST7789V_CMD_SLEEP_OUT 0x11
#define ST7789V_CMD_INV_OFF 0x20
#define ST7789V_CMD_INV_ON 0x21
#define ST7789V_CMD_GAMSET 0x26
#define ST7789V_CMD_DISP_OFF 0x28
#define ST7789V_CMD_DISP_ON 0x29
#define ST7789V_CMD_CASET 0x2a
#define ST7789V_CMD_RASET 0x2b
#define ST7789V_CMD_RAMWR 0x2c
#define ST7789V_CMD_MADCTL 0x36
#define ST7789V_MADCTL_MY_TOP_TO_BOTTOM 0x00
#define ST7789V_MADCTL_MY_BOTTOM_TO_TOP 0x80
#define ST7789V_MADCTL_MX_LEFT_TO_RIGHT 0x00
#define ST7789V_MADCTL_MX_RIGHT_TO_LEFT 0x40
#define ST7789V_MADCTL_MV_REVERSE_MODE 0x20
#define ST7789V_MADCTL_MV_NORMAL_MODE 0x00
#define ST7789V_MADCTL_ML 0x10
#define ST7789V_MADCTL_RBG 0x00
#define ST7789V_MADCTL_BGR 0x08
#define ST7789V_MADCTL_MH_LEFT_TO_RIGHT 0x00
#define ST7789V_MADCTL_MH_RIGHT_TO_LEFT 0x04
#define ST7789V_CMD_COLMOD 0x3a
#define ST7789V_COLMOD_RGB_65K (0x5 << 4)
#define ST7789V_COLMOD_RGB_262K (0x6 << 4)
#define ST7789V_COLMOD_FMT_12bit (3)
#define ST7789V_COLMOD_FMT_16bit (5)
#define ST7789V_COLMOD_FMT_18bit (6)
#define ST7789V_CMD_RAMCTRL 0xb0
#define ST7789V_CMD_RGBCTRL 0xb1
#define ST7789V_CMD_PORCTRL 0xb2
#define ST7789V_CMD_CMD2EN 0xdf
#define ST7789V_CMD_DGMEN 0xba
#define ST7789V_CMD_GCTRL 0xb7
#define ST7789V_CMD_VCOMS 0xbb
#define ST7789V_CMD_LCMCTRL 0xc0
#define ST7789V_LCMCTRL_XMY 0x40
#define ST7789V_LCMCTRL_XBGR 0x20
#define ST7789V_LCMCTRL_XINV 0x10
#define ST7789V_LCMCTRL_XMX 0x08
#define ST7789V_LCMCTRL_XMH 0x04
#define ST7789V_LCMCTRL_XMV 0x02
#define ST7789V_CMD_VDVVRHEN 0xc2
#define ST7789V_CMD_VRH 0xc3
#define ST7789V_CMD_VDS 0xc4
#define ST7789V_CMD_FRCTRL2 0xc6
#define ST7789V_CMD_PWCTRL1 0xd0
#define ST7789V_CMD_PVGAMCTRL 0xe0
#define ST7789V_CMD_NVGAMCTRL 0xe1
#endif
| 1,212 |