hexsha stringlengths 40 40 | size int64 7 1.05M | ext stringclasses 13
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 269 | max_stars_repo_name stringlengths 5 108 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 9 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 269 | max_issues_repo_name stringlengths 5 116 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 9 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 269 | max_forks_repo_name stringlengths 5 116 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 9 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 7 1.05M | avg_line_length float64 1.21 330k | max_line_length int64 6 990k | alphanum_fraction float64 0.01 0.99 | author_id stringlengths 2 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9250c4276c9287cf4fabf1563d07006eba3cc982 | 8,629 | cpp | C++ | pgadmin/schema/pgTextSearchConfiguration.cpp | jinfroster/pgadmin3 | 8d573a7f13a8b4161225363f1972d75004589275 | [
"PostgreSQL"
] | null | null | null | pgadmin/schema/pgTextSearchConfiguration.cpp | jinfroster/pgadmin3 | 8d573a7f13a8b4161225363f1972d75004589275 | [
"PostgreSQL"
] | null | null | null | pgadmin/schema/pgTextSearchConfiguration.cpp | jinfroster/pgadmin3 | 8d573a7f13a8b4161225363f1972d75004589275 | [
"PostgreSQL"
] | null | null | null | //////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
//
// Copyright (C) 2002 - 2014, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
// pgTextSearchConfiguration.cpp - Text Search Configuration class
//
//////////////////////////////////////////////////////////////////////////
// wxWindows headers
#include <wx/wx.h>
// App headers
#include "pgAdmin3.h"
#include "utils/misc.h"
#include "schema/pgTextSearchConfiguration.h"
pgTextSearchConfiguration::pgTextSearchConfiguration(pgSchema *newSchema, const wxString &newName)
: pgSchemaObject(newSchema, textSearchConfigurationFactory, newName)
{
}
pgTextSearchConfiguration::~pgTextSearchConfiguration()
{
}
wxString pgTextSearchConfiguration::GetTranslatedMessage(int kindOfMessage) const
{
wxString message = wxEmptyString;
switch (kindOfMessage)
{
case RETRIEVINGDETAILS:
message = _("Retrieving details on FTS configuration");
message += wxT(" ") + GetName();
break;
case REFRESHINGDETAILS:
message = _("Refreshing FTS configuration");
message += wxT(" ") + GetName();
break;
case DROPINCLUDINGDEPS:
message = wxString::Format(_("Are you sure you wish to drop FTS configuration \"%s\" including all objects that depend on it?"),
GetFullIdentifier().c_str());
break;
case DROPEXCLUDINGDEPS:
message = wxString::Format(_("Are you sure you wish to drop FTS configuration \"%s\"?"),
GetFullIdentifier().c_str());
break;
case DROPCASCADETITLE:
message = _("Drop FTS configuration cascaded?");
break;
case DROPTITLE:
message = _("Drop FTS configuration?");
break;
case PROPERTIESREPORT:
message = _("FTS configuration properties report");
message += wxT(" - ") + GetName();
break;
case PROPERTIES:
message = _("FTS configuration properties");
break;
case DDLREPORT:
message = _("FTS configuration DDL report");
message += wxT(" - ") + GetName();
break;
case DDL:
message = _("FTS configuration DDL");
break;
case DEPENDENCIESREPORT:
message = _("FTS configuration dependencies report");
message += wxT(" - ") + GetName();
break;
case DEPENDENCIES:
message = _("FTS configuration dependencies");
break;
case DEPENDENTSREPORT:
message = _("FTS configuration dependents report");
message += wxT(" - ") + GetName();
break;
case DEPENDENTS:
message = _("FTS configuration dependents");
break;
}
return message;
}
bool pgTextSearchConfiguration::DropObject(wxFrame *frame, ctlTree *browser, bool cascaded)
{
wxString sql = wxT("DROP TEXT SEARCH CONFIGURATION ") + this->GetSchema()->GetQuotedIdentifier() + wxT(".") + qtIdent(this->GetIdentifier());
if (cascaded)
sql += wxT(" CASCADE");
return GetDatabase()->ExecuteVoid(sql);
}
wxString pgTextSearchConfiguration::GetSql(ctlTree *browser)
{
if (sql.IsNull())
{
sql = wxT("-- Text Search Configuration: ") + GetFullIdentifier() + wxT("\n\n")
+ wxT("-- DROP TEXT SEARCH CONFIGURATION ") + GetFullIdentifier() + wxT("\n\n")
+ wxT("CREATE TEXT SEARCH CONFIGURATION ") + GetFullIdentifier() + wxT(" (")
+ wxT("\n PARSER = ") + qtTypeIdent(GetParser())
+ wxT("\n);\n");
for (size_t i = 0 ; i < tokens.GetCount() ; i++)
sql += wxT("ALTER TEXT SEARCH CONFIGURATION ") + GetQuotedFullIdentifier()
+ wxT(" ADD MAPPING FOR ") + tokens.Item(i).BeforeFirst('/')
+ wxT(" WITH ") + tokens.Item(i).AfterFirst('/')
+ wxT(";\n");
if (!GetComment().IsNull())
sql += wxT("COMMENT ON TEXT SEARCH CONFIGURATION ") + GetFullIdentifier()
+ wxT(" IS ") + qtDbString(GetComment()) + wxT(";\n");
}
return sql;
}
void pgTextSearchConfiguration::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
if (properties)
{
CreateListColumns(properties);
properties->AppendItem(_("Name"), GetName());
properties->AppendItem(_("OID"), GetOid());
properties->AppendItem(_("Owner"), GetOwner());
properties->AppendItem(_("Parser"), GetParser());
properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
}
}
pgObject *pgTextSearchConfiguration::Refresh(ctlTree *browser, const wxTreeItemId item)
{
pgObject *config = 0;
pgCollection *coll = browser->GetParentCollection(item);
if (coll)
config = textSearchConfigurationFactory.CreateObjects(coll, 0, wxT("\n AND cfg.oid=") + GetOidStr());
return config;
}
///////////////////////////////////////////////////
pgTextSearchConfigurationCollection::pgTextSearchConfigurationCollection(pgaFactory *factory, pgSchema *sch)
: pgSchemaObjCollection(factory, sch)
{
}
wxString pgTextSearchConfigurationCollection::GetTranslatedMessage(int kindOfMessage) const
{
wxString message = wxEmptyString;
switch (kindOfMessage)
{
case RETRIEVINGDETAILS:
message = _("Retrieving details on FTS configurations");
break;
case REFRESHINGDETAILS:
message = _("Refreshing FTS configurations");
break;
case OBJECTSLISTREPORT:
message = _("FTS configurations list report");
break;
}
return message;
}
//////////////////////////////////////////////////////
pgObject *pgTextSearchConfigurationFactory::CreateObjects(pgCollection *collection, ctlTree *browser, const wxString &restriction)
{
pgTextSearchConfiguration *config = 0;
pgSet *configurations;
configurations = collection->GetDatabase()->ExecuteSet(
wxT("SELECT cfg.oid, cfg.cfgname, pg_get_userbyid(cfg.cfgowner) as cfgowner, cfg.cfgparser, parser.prsname as parsername, description\n")
wxT(" FROM pg_ts_config cfg\n")
wxT(" LEFT OUTER JOIN pg_ts_parser parser ON parser.oid=cfg.cfgparser\n")
wxT(" LEFT OUTER JOIN pg_description des ON (des.objoid=cfg.oid AND des.classoid='pg_ts_config'::regclass)\n")
wxT(" WHERE cfg.cfgnamespace = ") + collection->GetSchema()->GetOidStr()
+ restriction + wxT("\n")
wxT(" ORDER BY cfg.cfgname"));
if (configurations)
{
while (!configurations->Eof())
{
config = new pgTextSearchConfiguration(collection->GetSchema(), configurations->GetVal(wxT("cfgname")));
config->iSetOid(configurations->GetOid(wxT("oid")));
config->iSetOwner(configurations->GetVal(wxT("cfgowner")));
config->iSetComment(configurations->GetVal(wxT("description")));
config->iSetParser(configurations->GetVal(wxT("parsername")));
config->iSetParserOid(configurations->GetOid(wxT("cfgparser")));
pgSet *maps;
maps = collection->GetDatabase()->ExecuteSet(
wxT("SELECT\n")
wxT(" (SELECT t.alias FROM pg_catalog.ts_token_type(cfgparser) AS t")
wxT(" WHERE t.tokid = maptokentype) AS tokenalias,\n")
wxT(" dictname\n")
wxT("FROM pg_ts_config_map\n")
wxT(" LEFT OUTER JOIN pg_ts_config ON mapcfg=pg_ts_config.oid\n")
wxT(" LEFT OUTER JOIN pg_ts_dict ON mapdict=pg_ts_dict.oid\n")
wxT("WHERE mapcfg=") + config->GetOidStr() + wxT("\n")
wxT("ORDER BY 1, mapseqno"));
if (maps)
{
wxString tokenToAdd;
while (!maps->Eof())
{
if (tokenToAdd.Length() > 0 &&
!tokenToAdd.BeforeFirst('/').IsSameAs(maps->GetVal(wxT("tokenalias")), false))
{
config->GetTokens().Add(tokenToAdd);
tokenToAdd = wxT("");
}
if (tokenToAdd.Length() == 0)
tokenToAdd = maps->GetVal(wxT("tokenalias")) + wxT("/") + maps->GetVal(wxT("dictname"));
else
tokenToAdd += wxT(",") + maps->GetVal(wxT("dictname"));
maps->MoveNext();
}
delete maps;
}
if (browser)
{
browser->AppendObject(collection, config);
configurations->MoveNext();
}
else
break;
}
delete configurations;
}
return config;
}
#include "images/configuration.pngc"
#include "images/configurations.pngc"
pgTextSearchConfigurationFactory::pgTextSearchConfigurationFactory()
: pgSchemaObjFactory(__("FTS Configuration"), __("New FTS Configuration..."), __("Create a new FTS Configuration."), configuration_png_img)
{
}
pgCollection *pgTextSearchConfigurationFactory::CreateCollection(pgObject *obj)
{
return new pgTextSearchConfigurationCollection(GetCollectionFactory(), (pgSchema *)obj);
}
pgTextSearchConfigurationFactory textSearchConfigurationFactory;
static pgaCollectionFactory cf(&textSearchConfigurationFactory, __("FTS Configurations"), configurations_png_img);
| 31.039568 | 159 | 0.651872 | jinfroster |
92519d1ea5853a0ea2efd1ca92d5b7c841d73af3 | 12,245 | cpp | C++ | gen/blink/bindings/core/v8/V8SVGStyleElement.cpp | wenfeifei/miniblink49 | 2ed562ff70130485148d94b0e5f4c343da0c2ba4 | [
"Apache-2.0"
] | 5,964 | 2016-09-27T03:46:29.000Z | 2022-03-31T16:25:27.000Z | gen/blink/bindings/core/v8/V8SVGStyleElement.cpp | w4454962/miniblink49 | b294b6eacb3333659bf7b94d670d96edeeba14c0 | [
"Apache-2.0"
] | 459 | 2016-09-29T00:51:38.000Z | 2022-03-07T14:37:46.000Z | gen/blink/bindings/core/v8/V8SVGStyleElement.cpp | w4454962/miniblink49 | b294b6eacb3333659bf7b94d670d96edeeba14c0 | [
"Apache-2.0"
] | 1,006 | 2016-09-27T05:17:27.000Z | 2022-03-30T02:46:51.000Z | // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
#include "config.h"
#include "V8SVGStyleElement.h"
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/V8DOMConfiguration.h"
#include "bindings/core/v8/V8ObjectConstructor.h"
#include "bindings/core/v8/V8StyleSheet.h"
#include "core/dom/ContextFeatures.h"
#include "core/dom/Document.h"
#include "core/frame/UseCounter.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/TraceEvent.h"
#include "wtf/GetPtr.h"
#include "wtf/RefPtr.h"
namespace blink {
// Suppress warning: global constructors, because struct WrapperTypeInfo is trivial
// and does not depend on another global objects.
#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wglobal-constructors"
#endif
const WrapperTypeInfo V8SVGStyleElement::wrapperTypeInfo = { gin::kEmbedderBlink, V8SVGStyleElement::domTemplate, V8SVGStyleElement::refObject, V8SVGStyleElement::derefObject, V8SVGStyleElement::trace, 0, 0, V8SVGStyleElement::preparePrototypeObject, V8SVGStyleElement::installConditionallyEnabledProperties, "SVGStyleElement", &V8SVGElement::wrapperTypeInfo, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::NodeClassId, WrapperTypeInfo::InheritFromEventTarget, WrapperTypeInfo::Dependent, WrapperTypeInfo::WillBeGarbageCollectedObject };
#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
#pragma clang diagnostic pop
#endif
// This static member must be declared by DEFINE_WRAPPERTYPEINFO in SVGStyleElement.h.
// For details, see the comment of DEFINE_WRAPPERTYPEINFO in
// bindings/core/v8/ScriptWrappable.h.
const WrapperTypeInfo& SVGStyleElement::s_wrapperTypeInfo = V8SVGStyleElement::wrapperTypeInfo;
namespace SVGStyleElementV8Internal {
static void typeAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
SVGStyleElement* impl = V8SVGStyleElement::toImpl(holder);
v8SetReturnValueString(info, impl->type(), info.GetIsolate());
}
static void typeAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
SVGStyleElementV8Internal::typeAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void typeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
SVGStyleElement* impl = V8SVGStyleElement::toImpl(holder);
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
impl->setType(cppValue);
}
static void typeAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
SVGStyleElementV8Internal::typeAttributeSetter(v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void mediaAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
SVGStyleElement* impl = V8SVGStyleElement::toImpl(holder);
v8SetReturnValueString(info, impl->media(), info.GetIsolate());
}
static void mediaAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
SVGStyleElementV8Internal::mediaAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void mediaAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
SVGStyleElement* impl = V8SVGStyleElement::toImpl(holder);
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
impl->setMedia(cppValue);
}
static void mediaAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
SVGStyleElementV8Internal::mediaAttributeSetter(v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void titleAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
SVGStyleElement* impl = V8SVGStyleElement::toImpl(holder);
v8SetReturnValueString(info, impl->title(), info.GetIsolate());
}
static void titleAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionContext(info.GetIsolate()), UseCounter::SVGStyleElementTitle);
SVGStyleElementV8Internal::titleAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void titleAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
SVGStyleElement* impl = V8SVGStyleElement::toImpl(holder);
V8StringResource<> cppValue = v8Value;
if (!cppValue.prepare())
return;
impl->setTitle(cppValue);
}
static void titleAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionContext(info.GetIsolate()), UseCounter::SVGStyleElementTitle);
SVGStyleElementV8Internal::titleAttributeSetter(v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void sheetAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
SVGStyleElement* impl = V8SVGStyleElement::toImpl(holder);
v8SetReturnValueFast(info, WTF::getPtr(impl->sheet()), impl);
}
static void sheetAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
SVGStyleElementV8Internal::sheetAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void disabledAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
SVGStyleElement* impl = V8SVGStyleElement::toImpl(holder);
v8SetReturnValueBool(info, impl->disabled());
}
static void disabledAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionContext(info.GetIsolate()), UseCounter::V8SVGStyleElement_Disabled_AttributeGetter);
SVGStyleElementV8Internal::disabledAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
static void disabledAttributeSetter(v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
ExceptionState exceptionState(ExceptionState::SetterContext, "disabled", "SVGStyleElement", holder, info.GetIsolate());
SVGStyleElement* impl = V8SVGStyleElement::toImpl(holder);
bool cppValue = toBoolean(info.GetIsolate(), v8Value, exceptionState);
if (exceptionState.throwIfNeeded())
return;
impl->setDisabled(cppValue);
}
static void disabledAttributeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Value> v8Value = info[0];
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionContext(info.GetIsolate()), UseCounter::V8SVGStyleElement_Disabled_AttributeSetter);
SVGStyleElementV8Internal::disabledAttributeSetter(v8Value, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
} // namespace SVGStyleElementV8Internal
static const V8DOMConfiguration::AccessorConfiguration V8SVGStyleElementAccessors[] = {
{"type", SVGStyleElementV8Internal::typeAttributeGetterCallback, SVGStyleElementV8Internal::typeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"media", SVGStyleElementV8Internal::mediaAttributeGetterCallback, SVGStyleElementV8Internal::mediaAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"title", SVGStyleElementV8Internal::titleAttributeGetterCallback, SVGStyleElementV8Internal::titleAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"sheet", SVGStyleElementV8Internal::sheetAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
{"disabled", SVGStyleElementV8Internal::disabledAttributeGetterCallback, SVGStyleElementV8Internal::disabledAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
};
static void installV8SVGStyleElementTemplate(v8::Local<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
{
functionTemplate->ReadOnlyPrototype();
v8::Local<v8::Signature> defaultSignature;
defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "SVGStyleElement", V8SVGElement::domTemplate(isolate), V8SVGStyleElement::internalFieldCount,
0, 0,
V8SVGStyleElementAccessors, WTF_ARRAY_LENGTH(V8SVGStyleElementAccessors),
0, 0);
v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();
ALLOW_UNUSED_LOCAL(instanceTemplate);
v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();
ALLOW_UNUSED_LOCAL(prototypeTemplate);
// Custom toString template
functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
}
v8::Local<v8::FunctionTemplate> V8SVGStyleElement::domTemplate(v8::Isolate* isolate)
{
return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8SVGStyleElementTemplate);
}
bool V8SVGStyleElement::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
{
return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
}
v8::Local<v8::Object> V8SVGStyleElement::findInstanceInPrototypeChain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
{
return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
}
SVGStyleElement* V8SVGStyleElement::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value)
{
return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)) : 0;
}
void V8SVGStyleElement::refObject(ScriptWrappable* scriptWrappable)
{
#if !ENABLE(OILPAN)
scriptWrappable->toImpl<SVGStyleElement>()->ref();
#endif
}
void V8SVGStyleElement::derefObject(ScriptWrappable* scriptWrappable)
{
#if !ENABLE(OILPAN)
scriptWrappable->toImpl<SVGStyleElement>()->deref();
#endif
}
} // namespace blink
| 48.59127 | 553 | 0.76276 | wenfeifei |
9257cb0b19647e7db2a84ae5a346f6c96efbaaff | 12,986 | cpp | C++ | VGP330/11_HelloPostProcessing/GameState.cpp | TheJimmyGod/JimmyGod_Engine | b9752c6fbd9db17dc23f03330b5e4537bdcadf8e | [
"MIT"
] | null | null | null | VGP330/11_HelloPostProcessing/GameState.cpp | TheJimmyGod/JimmyGod_Engine | b9752c6fbd9db17dc23f03330b5e4537bdcadf8e | [
"MIT"
] | null | null | null | VGP330/11_HelloPostProcessing/GameState.cpp | TheJimmyGod/JimmyGod_Engine | b9752c6fbd9db17dc23f03330b5e4537bdcadf8e | [
"MIT"
] | null | null | null | #include "GameState.h"
#include <ImGui/Inc/imgui.h>
using namespace JimmyGod::Input;
using namespace JimmyGod::Graphics;
using namespace JimmyGod::Math;
static bool ActiveRadialBlur = false;
static bool ActiveGaussianBlur = false;
static bool ActiveGreyscale = false;
static bool ActiveNegative = false;
static bool cloudMap = true;
void GameState::Initialize()
{
GraphicsSystem::Get()->SetClearColor(Colors::Gray);
mCamera.SetPosition({ 0.0f,0.0f,-200.0f });
mCamera.SetDirection({ 0.0f,0.0f,1.0f });
mMesh = MeshBuilder::CreateSphere(50.0f,64,64);
mMeshBuffer.Initialize(mMesh);
mTransformBuffer.Initialize();
mLightBuffer.Initialize();
mMaterialBuffer.Initialize();
mDirectionalLight.direction = Normalize({ 1.0f, -1.0f, 1.0f });
mDirectionalLight.ambient = { 0.2f, 0.2f, 0.2f, 1.0f };
mDirectionalLight.diffuse = { 0.75f,0.75f,0.75f,1.0f };
mDirectionalLight.specular = { 0.5f,0.5f,0.5f,1.0f };
mMaterial.ambient = { 1.0f };
mMaterial.diffuse = { 1.0f };
mMaterial.specular = { 1.0f };
mMaterial.power = { 10.0f };
mSettings.bumpMapWeight = { 0.2f };
mSettingsBuffer.Initialize();
mSampler.Initialize(Sampler::Filter::Anisotropic, Sampler::AddressMode::Clamp);
std::filesystem::path assets = "../../Assets/Shaders/Earth.fx";
mBlendState.Initialize(BlendState::Mode::AlphaPremultiplied);
mEarth.Initialize("../../Assets/Textures/JimmyEarth.jpg");
mEarthSpecualr.Initialize("../../Assets/Textures/earth_spec.jpg");
mEarthDisplacement.Initialize("../../Assets/Textures/earth_bump.jpg");
mNightMap.Initialize("../../Assets/Textures/earth_lights.jpg");
mEarthCould.Initialize("../../Assets/Textures/earth_clouds.jpg");
mEarthVertexShader.Initialize(assets, "VSEarth",Vertex::Format);
mEarthPixelShader.Initialize(assets, "PSEarth");
mCloudVertexShader.Initialize(assets, "VSCloud", Vertex::Format);
mCloudPixelShader.Initialize(assets, "PSCloud");
mNormalMap.Initialize("../../Assets/Textures/earth_normal.jpg");
auto graphicsSystem = GraphicsSystem::Get();
mRenderTarget.Initialize(graphicsSystem->GetBackBufferWidth(),
graphicsSystem->GetBackBufferHeight(),RenderTarget::Format::RGBA_U8);
mNDCMesh = MeshBuilder::CreateNDCQuad();
mScreenQuadBuffer.Initialize(mNDCMesh);
mPostProcessingVertexShader.Initialize("../../Assets/Shaders/PostProcess.fx", VertexPX::Format);
mPostProcessingPixelShader.Initialize("../../Assets/Shaders/PostProcess.fx", "PSNoProcessing");
// Space
mSkyDome.Intialize("../../Assets/Textures/Space.jpg", 1000, 12, 360, {0.0f,0.0f,0.0f});
// Moon
mMoon.Initialize("../../Assets/Textures/Moon.jpg", Vector3{ 75.5f,0.0f,0.0f }, 15.0f, 12.0f, 36.0f);
// Mercury
mMercury.Initialize("../../Assets/Textures/Mercury.jpg", Vector3{ 130.0f,0.0f,0.0f }, 24.0f, 12.0f, 36.0f);
// Venus
mVenus.Initialize("../../Assets/Textures/Venus.jpg", Vector3{ 170.0f,0.0f,0.0f }, 28.0f, 12.0f, 36.0f);
// Mars
mMars.Initialize("../../Assets/Textures/Mars.jpg", Vector3{ 200.0f,0.0f,0.0f }, 32.0f, 12.0f, 36.0f);
// Jupitor
mJupiter.Initialize("../../Assets/Textures/Jupiter.jpg", Vector3{ 280.0f,0.0f,0.0f }, 62.0f, 12.0f, 36.0f);
// Saturn
mSaturn.Initialize("../../Assets/Textures/Saturn.jpg", Vector3{ 360.0f,0.0f,0.0f }, 27.0f, 12.0f, 36.0f);
// Uranos
mUranos.Initialize("../../Assets/Textures/Uranos.jpg", Vector3{ 420.0f,0.0f,0.0f }, 25.0f, 12.0f, 36.0f);
// Neptune
mNeptune.Initialize("../../Assets/Textures/Neptune.jpg", Vector3{ 480.0f,0.0f,0.0f }, 23.0f, 12.0f, 36.0f);
}
void GameState::Terminate()
{
mRenderTarget.Terminate();
mScreenQuadBuffer.Terminate();
mPostProcessingPixelShader.Terminate();
mPostProcessingVertexShader.Terminate();
mSettingsBuffer.Terminate();
mNormalMap.Terminate();
mEarthVertexShader.Terminate();
mEarthPixelShader.Terminate();
mCloudPixelShader.Terminate();
mCloudVertexShader.Terminate();
mMaterialBuffer.Terminate();
mLightBuffer.Terminate();
mMeshBuffer.Terminate();
mSampler.Terminate();
mEarth.Terminate();
mEarthDisplacement.Terminate();
mEarthSpecualr.Terminate();
mNightMap.Terminate();
mBlendState.Terminate();
mEarthCould.Terminate();
mSkyDome.Terminate();
mMoon.Terminate();
mMercury.Terminate();
mVenus.Terminate();
mMars.Terminate();
mJupiter.Terminate();
mSaturn.Terminate();
mUranos.Terminate();
mNeptune.Terminate();
}
void GameState::Update(float deltaTime)
{
const float kMoveSpeed = 100.5f;
const float kTurnSpeed = 0.5f;
mAccelation = Vector3::Zero;
auto inputSystem = InputSystem::Get();
if (inputSystem->IsKeyDown(KeyCode::W))
{
mCamera.Walk(kMoveSpeed*deltaTime);
mAccelation += kMoveSpeed;
}
if (inputSystem->IsKeyDown(KeyCode::S))
{
mCamera.Walk(-kMoveSpeed * deltaTime);
mAccelation -= kMoveSpeed;
}
if (inputSystem->IsKeyDown(KeyCode::A))
mCamera.Strafe(-kMoveSpeed * deltaTime);
if (inputSystem->IsKeyDown(KeyCode::D))
mCamera.Strafe(kMoveSpeed * deltaTime);
mCloudRotation += 0.0001f;
//mVelocity += mAccelation * deltaTime;
//auto Speed = Magnitude(mVelocity);
//if (ActiveRadialBlur)
//{
// if (Speed > 30.0f && Speed < 500.0f)
// mPostProcessingPixelShader.Initialize("../../Assets/Shaders/PostProcess.fx", "PSRadialBlur");
// else
// mPostProcessingPixelShader.Initialize("../../Assets/Shaders/PostProcess.fx", "PSNoProcessing");
//}
mSkyDome.Update(mCamera);
mMoon.Update(deltaTime);
mMercury.Update(deltaTime);
mVenus.Update(deltaTime);
mMars.Update(deltaTime);
mJupiter.Update(deltaTime);
mSaturn.Update(deltaTime);
mUranos.Update(deltaTime);
mNeptune.Update(deltaTime);
}
void GameState::Render()
{
mRenderTarget.BeginRender();
DrawScene();
mRenderTarget.EndRender();
mRenderTarget.BindPS(0);
PostProcess();
mRenderTarget.UnbindPS(0);
std::string str1 = (ActiveRadialBlur) ? "Active Radial Blur" : "Inactive Radial Blur";
SpriteRenderManager::Get()->DrawScreenText(str1.c_str(), 1050.0f, 600.0f, 15.0f, (!ActiveRadialBlur) ? Colors::WhiteSmoke : Colors::Magenta);
std::string str2 = (ActiveGaussianBlur) ? "Active Gaussian Blur" : "Inactive Gaussian Blur";
SpriteRenderManager::Get()->DrawScreenText(str2.c_str(), 1050.0f, 620.0f, 15.0f, (!ActiveGaussianBlur) ? Colors::WhiteSmoke : Colors::Magenta);
std::string str3 = (ActiveGreyscale) ? "Active Greyscale" : "Inactive Greyscale";
SpriteRenderManager::Get()->DrawScreenText(str3.c_str(), 1050.0f, 640.0f, 15.0f, (!ActiveGreyscale) ? Colors::WhiteSmoke : Colors::Magenta);
std::string str4 = (ActiveNegative) ? "Active Negative" : "Inactive Negative";
SpriteRenderManager::Get()->DrawScreenText(str4.c_str(), 1050.0f, 660.0f, 15.0f, (!ActiveNegative) ? Colors::WhiteSmoke : Colors::Magenta);
}
void GameState::DebugUI()
{
//ImGui::ShowDemoWindow();
ImGui::Begin("Settings", nullptr, ImGuiWindowFlags_AlwaysAutoResize);
if (ImGui::CollapsingHeader("Light", ImGuiTreeNodeFlags_DefaultOpen))
{
bool directionChanged = false;
directionChanged |= ImGui::DragFloat("Direction X##Light", &mDirectionalLight.direction.x, 0.01f);
directionChanged |= ImGui::DragFloat("Direction Y##Light", &mDirectionalLight.direction.y, 0.01f);
directionChanged |= ImGui::DragFloat("Direction Z##Light", &mDirectionalLight.direction.z, 0.01f);
if (directionChanged)
{
mDirectionalLight.direction = Normalize(mDirectionalLight.direction);
}
ImGui::ColorEdit4("Ambient##Light", &mDirectionalLight.ambient.x);
ImGui::ColorEdit4("Diffuse##Light", &mDirectionalLight.diffuse.x);
ImGui::ColorEdit4("Specular##Light", &mDirectionalLight.specular.x);
}
if (ImGui::CollapsingHeader("Material", ImGuiTreeNodeFlags_DefaultOpen))
{
ImGui::ColorEdit4("Ambient##Material", &mMaterial.ambient.x);
ImGui::ColorEdit4("Diffuse##Material", &mMaterial.diffuse.x);
ImGui::ColorEdit4("Specular##Material", &mMaterial.specular.x);
ImGui::DragFloat("Power##Material", &mMaterial.power, 1.0f,1.0f,100.0f);
}
if (ImGui::CollapsingHeader("Settings", ImGuiTreeNodeFlags_DefaultOpen))
{
static bool specularMap = true;
static bool normalMap = true;
ImGui::SliderFloat("Displacement", &mSettings.bumpMapWeight, 0.2f, 100.0f);
if(ImGui::Checkbox("Cloud Map", &cloudMap)){}
if (ImGui::Checkbox("Normal", &normalMap))
{
mSettings.normalMapWeight = normalMap ? 1.0f : 0.0f;
}
if (ImGui::Checkbox("Specular", &specularMap))
{
mSettings.specularWeight = specularMap ? 1.0f : 0.0f;
}
if (ImGui::Button("Radial Blur"))
{
if (ActiveGaussianBlur || ActiveGreyscale || ActiveNegative)
ActiveRadialBlur = false;
else
{
ActiveRadialBlur = !ActiveRadialBlur;
if (!ActiveRadialBlur)
mPostProcessingPixelShader.Initialize("../../Assets/Shaders/PostProcess.fx", "PSNoProcessing");
else
mPostProcessingPixelShader.Initialize("../../Assets/Shaders/PostProcess.fx", "PSRadialBlur");
}
}
if (ImGui::Button("Gaussian"))
{
if (ActiveRadialBlur || ActiveGreyscale || ActiveNegative)
ActiveGaussianBlur = false;
else
{
ActiveGaussianBlur = !ActiveGaussianBlur;
if (!ActiveGaussianBlur)
mPostProcessingPixelShader.Initialize("../../Assets/Shaders/PostProcess.fx", "PSNoProcessing");
else
mPostProcessingPixelShader.Initialize("../../Assets/Shaders/PostProcess.fx", "PSGaussian");
}
}
if (ImGui::Button("GreyScale"))
{
if (ActiveRadialBlur || ActiveGaussianBlur || ActiveNegative)
ActiveGreyscale = false;
else
{
ActiveGreyscale = !ActiveGreyscale;
if (!ActiveGreyscale)
mPostProcessingPixelShader.Initialize("../../Assets/Shaders/PostProcess.fx", "PSNoProcessing");
else
mPostProcessingPixelShader.Initialize("../../Assets/Shaders/PostProcess.fx", "PSGreyScale");
}
}
if (ImGui::Button("Negative"))
{
if (ActiveRadialBlur || ActiveGreyscale || ActiveGaussianBlur)
ActiveNegative = false;
else
{
ActiveNegative = !ActiveNegative;
if (!ActiveNegative)
mPostProcessingPixelShader.Initialize("../../Assets/Shaders/PostProcess.fx", "PSNoProcessing");
else
mPostProcessingPixelShader.Initialize("../../Assets/Shaders/PostProcess.fx", "PSNegative");
}
}
}
if (ImGui::CollapsingHeader("Transform", ImGuiTreeNodeFlags_DefaultOpen))
{
ImGui::DragFloat3("Rotation##Transform", &mRotation.x, 0.01f);
}
ImGui::End();
}
void GameState::DrawScene()
{
auto matView = mCamera.GetViewMatrix();
auto matProj = mCamera.GetPerspectiveMatrix();
auto matTrans = Matrix4::Translation({ -1.25f,0.0f,0.0f });
auto matRot = Matrix4::RotationX(mRotation.x) * Matrix4::RotationY(mRotation.y);
auto matWorld = matRot * matTrans;
mSkyDome.Render(mCamera);
TransformData transformData;
transformData.world = Transpose(matWorld);
transformData.wvp = Transpose(matWorld * matView * matProj);
transformData.viewPosition = mCamera.GetPosition();
mTransformBuffer.Update(&transformData);
mTransformBuffer.BindVS(0);
mTransformBuffer.BindPS(0);
mLightBuffer.Update(&mDirectionalLight);
mLightBuffer.BindVS(1);
mLightBuffer.BindPS(1);
mMaterialBuffer.Update(&mMaterial);
mMaterialBuffer.BindVS(2);
mMaterialBuffer.BindPS(2);
mSettingsBuffer.Update(&mSettings);
mSettingsBuffer.BindVS(3);
mSettingsBuffer.BindPS(3);
mEarthPixelShader.Bind();
mEarthVertexShader.Bind();
mEarth.BindPS(0);
mEarthSpecualr.BindPS(1);
mEarthDisplacement.BindVS(2);
mNormalMap.BindPS(3);
mNightMap.BindPS(4);
mMeshBuffer.Draw();
BlendState::ClearState();
// --- Cloud
if (cloudMap)
{
matRot = Matrix4::RotationX(mRotation.x) * Matrix4::RotationY(mRotation.y + mCloudRotation);
matWorld = matRot * matTrans;
transformData.world = Transpose(matWorld);
transformData.wvp = Transpose(matWorld * matView * matProj);
transformData.viewPosition = mCamera.GetPosition();
mTransformBuffer.Update(&transformData);
mTransformBuffer.BindVS(0);
mTransformBuffer.BindPS(0);
mCloudPixelShader.Bind();
mCloudVertexShader.Bind();
mEarthCould.BindPS(5);
mEarthCould.BindVS(5);
mBlendState.Set();
mMeshBuffer.Draw();
}
mMoon.Render(mCamera, 1.5f, 0.15f, matWorld);
mMercury.Render(mCamera, 2.1f, 0.2f, matWorld);
mVenus.Render(mCamera, 2.6f, 0.25f, matWorld);
mMars.Render(mCamera, 3.1f, 0.3f, matWorld);
mJupiter.Render(mCamera, 3.6f, 0.5f, matWorld);
mSaturn.Render(mCamera, 4.1f, 0.3f, matWorld);
mUranos.Render(mCamera, 4.6f, 0.2f, matWorld);
mNeptune.Render(mCamera, 5.1f, 0.2f, matWorld);
SimpleDraw::Render(mCamera);
}
void GameState::PostProcess()
{
mPostProcessingVertexShader.Bind();
mPostProcessingPixelShader.Bind();
mSampler.BindPS();
mScreenQuadBuffer.Draw();
}
// Blending : find color = Source color * SourceBlend + destinationColor * destinationBlend
// destinationColor = represent the pixel on the backbuffer | 34.721925 | 145 | 0.705452 | TheJimmyGod |
925a0eae58dc60ac694c0d0907dc8632d741dbda | 26,849 | cc | C++ | src/net/quic/proto/source_address_token.pb.cc | acmd/GIT-TCC-LIBQUIC-ACMD | f100c1ff7b4c24ed2fbb3ae11d9516f6ce5ccc6d | [
"BSD-3-Clause"
] | 1,760 | 2015-03-16T07:29:25.000Z | 2022-03-29T17:04:54.000Z | src/net/quic/core/proto/source_address_token.pb.cc | 18901233704/libquic | 8954789a056d8e7d5fcb6452fd1572ca57eb5c4e | [
"BSD-3-Clause"
] | 41 | 2015-03-26T02:03:34.000Z | 2022-02-09T09:38:47.000Z | src/net/quic/core/proto/source_address_token.pb.cc | 18901233704/libquic | 8954789a056d8e7d5fcb6452fd1572ca57eb5c4e | [
"BSD-3-Clause"
] | 336 | 2015-03-16T13:52:52.000Z | 2022-03-21T10:44:58.000Z | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: source_address_token.proto
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "source_address_token.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/io/zero_copy_stream_impl_lite.h>
// @@protoc_insertion_point(includes)
namespace net {
void protobuf_ShutdownFile_source_5faddress_5ftoken_2eproto() {
delete SourceAddressToken::default_instance_;
delete SourceAddressTokens::default_instance_;
}
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
void protobuf_AddDesc_source_5faddress_5ftoken_2eproto_impl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#else
void protobuf_AddDesc_source_5faddress_5ftoken_2eproto() {
static bool already_here = false;
if (already_here) return;
already_here = true;
GOOGLE_PROTOBUF_VERIFY_VERSION;
#endif
::net::protobuf_AddDesc_cached_5fnetwork_5fparameters_2eproto();
SourceAddressToken::default_instance_ = new SourceAddressToken();
SourceAddressTokens::default_instance_ = new SourceAddressTokens();
SourceAddressToken::default_instance_->InitAsDefaultInstance();
SourceAddressTokens::default_instance_->InitAsDefaultInstance();
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_source_5faddress_5ftoken_2eproto);
}
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AddDesc_source_5faddress_5ftoken_2eproto_once_);
void protobuf_AddDesc_source_5faddress_5ftoken_2eproto() {
::google::protobuf::GoogleOnceInit(&protobuf_AddDesc_source_5faddress_5ftoken_2eproto_once_,
&protobuf_AddDesc_source_5faddress_5ftoken_2eproto_impl);
}
#else
// Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer_source_5faddress_5ftoken_2eproto {
StaticDescriptorInitializer_source_5faddress_5ftoken_2eproto() {
protobuf_AddDesc_source_5faddress_5ftoken_2eproto();
}
} static_descriptor_initializer_source_5faddress_5ftoken_2eproto_;
#endif
namespace {
static void MergeFromFail(int line) GOOGLE_ATTRIBUTE_COLD;
GOOGLE_ATTRIBUTE_NOINLINE static void MergeFromFail(int line) {
GOOGLE_CHECK(false) << __FILE__ << ":" << line;
}
} // namespace
// ===================================================================
static ::std::string* MutableUnknownFieldsForSourceAddressToken(
SourceAddressToken* ptr) {
return ptr->mutable_unknown_fields();
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int SourceAddressToken::kIpFieldNumber;
const int SourceAddressToken::kTimestampFieldNumber;
const int SourceAddressToken::kCachedNetworkParametersFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
SourceAddressToken::SourceAddressToken()
: ::google::protobuf::MessageLite(), _arena_ptr_(NULL) {
SharedCtor();
// @@protoc_insertion_point(constructor:net.SourceAddressToken)
}
void SourceAddressToken::InitAsDefaultInstance() {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
cached_network_parameters_ = const_cast< ::net::CachedNetworkParameters*>(
::net::CachedNetworkParameters::internal_default_instance());
#else
cached_network_parameters_ = const_cast< ::net::CachedNetworkParameters*>(&::net::CachedNetworkParameters::default_instance());
#endif
}
SourceAddressToken::SourceAddressToken(const SourceAddressToken& from)
: ::google::protobuf::MessageLite(),
_arena_ptr_(NULL) {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:net.SourceAddressToken)
}
void SourceAddressToken::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
_unknown_fields_.UnsafeSetDefault(
&::google::protobuf::internal::GetEmptyStringAlreadyInited());
ip_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
timestamp_ = GOOGLE_LONGLONG(0);
cached_network_parameters_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
SourceAddressToken::~SourceAddressToken() {
// @@protoc_insertion_point(destructor:net.SourceAddressToken)
SharedDtor();
}
void SourceAddressToken::SharedDtor() {
_unknown_fields_.DestroyNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited());
ip_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
if (this != &default_instance()) {
#else
if (this != default_instance_) {
#endif
delete cached_network_parameters_;
}
}
void SourceAddressToken::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const SourceAddressToken& SourceAddressToken::default_instance() {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_AddDesc_source_5faddress_5ftoken_2eproto();
#else
if (default_instance_ == NULL) protobuf_AddDesc_source_5faddress_5ftoken_2eproto();
#endif
return *default_instance_;
}
SourceAddressToken* SourceAddressToken::default_instance_ = NULL;
SourceAddressToken* SourceAddressToken::New(::google::protobuf::Arena* arena) const {
SourceAddressToken* n = new SourceAddressToken;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void SourceAddressToken::Clear() {
// @@protoc_insertion_point(message_clear_start:net.SourceAddressToken)
if (_has_bits_[0 / 32] & 7u) {
if (has_ip()) {
ip_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
timestamp_ = GOOGLE_LONGLONG(0);
if (has_cached_network_parameters()) {
if (cached_network_parameters_ != NULL) cached_network_parameters_->::net::CachedNetworkParameters::Clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
_unknown_fields_.ClearToEmptyNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
bool SourceAddressToken::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
::google::protobuf::io::LazyStringOutputStream unknown_fields_string(
::google::protobuf::internal::NewPermanentCallback(
&MutableUnknownFieldsForSourceAddressToken, this));
::google::protobuf::io::CodedOutputStream unknown_fields_stream(
&unknown_fields_string, false);
// @@protoc_insertion_point(parse_start:net.SourceAddressToken)
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)) {
// required bytes ip = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
input, this->mutable_ip()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_timestamp;
break;
}
// required int64 timestamp = 2;
case 2: {
if (tag == 16) {
parse_timestamp:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>(
input, ×tamp_)));
set_has_timestamp();
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_cached_network_parameters;
break;
}
// optional .net.CachedNetworkParameters cached_network_parameters = 3;
case 3: {
if (tag == 26) {
parse_cached_network_parameters:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_cached_network_parameters()));
} 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, &unknown_fields_stream));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:net.SourceAddressToken)
return true;
failure:
// @@protoc_insertion_point(parse_failure:net.SourceAddressToken)
return false;
#undef DO_
}
void SourceAddressToken::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:net.SourceAddressToken)
// required bytes ip = 1;
if (has_ip()) {
::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
1, this->ip(), output);
}
// required int64 timestamp = 2;
if (has_timestamp()) {
::google::protobuf::internal::WireFormatLite::WriteInt64(2, this->timestamp(), output);
}
// optional .net.CachedNetworkParameters cached_network_parameters = 3;
if (has_cached_network_parameters()) {
::google::protobuf::internal::WireFormatLite::WriteMessage(
3, *this->cached_network_parameters_, output);
}
output->WriteRaw(unknown_fields().data(),
static_cast<int>(unknown_fields().size()));
// @@protoc_insertion_point(serialize_end:net.SourceAddressToken)
}
int SourceAddressToken::RequiredFieldsByteSizeFallback() const {
// @@protoc_insertion_point(required_fields_byte_size_fallback_start:net.SourceAddressToken)
int total_size = 0;
if (has_ip()) {
// required bytes ip = 1;
total_size += 1 +
::google::protobuf::internal::WireFormatLite::BytesSize(
this->ip());
}
if (has_timestamp()) {
// required int64 timestamp = 2;
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int64Size(
this->timestamp());
}
return total_size;
}
int SourceAddressToken::ByteSize() const {
// @@protoc_insertion_point(message_byte_size_start:net.SourceAddressToken)
int total_size = 0;
if (((_has_bits_[0] & 0x00000003) ^ 0x00000003) == 0) { // All required fields are present.
// required bytes ip = 1;
total_size += 1 +
::google::protobuf::internal::WireFormatLite::BytesSize(
this->ip());
// required int64 timestamp = 2;
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int64Size(
this->timestamp());
} else {
total_size += RequiredFieldsByteSizeFallback();
}
// optional .net.CachedNetworkParameters cached_network_parameters = 3;
if (has_cached_network_parameters()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
*this->cached_network_parameters_);
}
total_size += unknown_fields().size();
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void SourceAddressToken::CheckTypeAndMergeFrom(
const ::google::protobuf::MessageLite& from) {
MergeFrom(*::google::protobuf::down_cast<const SourceAddressToken*>(&from));
}
void SourceAddressToken::MergeFrom(const SourceAddressToken& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:net.SourceAddressToken)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_ip()) {
set_has_ip();
ip_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.ip_);
}
if (from.has_timestamp()) {
set_timestamp(from.timestamp());
}
if (from.has_cached_network_parameters()) {
mutable_cached_network_parameters()->::net::CachedNetworkParameters::MergeFrom(from.cached_network_parameters());
}
}
if (!from.unknown_fields().empty()) {
mutable_unknown_fields()->append(from.unknown_fields());
}
}
void SourceAddressToken::CopyFrom(const SourceAddressToken& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:net.SourceAddressToken)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool SourceAddressToken::IsInitialized() const {
if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
return true;
}
void SourceAddressToken::Swap(SourceAddressToken* other) {
if (other == this) return;
InternalSwap(other);
}
void SourceAddressToken::InternalSwap(SourceAddressToken* other) {
ip_.Swap(&other->ip_);
std::swap(timestamp_, other->timestamp_);
std::swap(cached_network_parameters_, other->cached_network_parameters_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
::std::string SourceAddressToken::GetTypeName() const {
return "net.SourceAddressToken";
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// SourceAddressToken
// required bytes ip = 1;
bool SourceAddressToken::has_ip() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
void SourceAddressToken::set_has_ip() {
_has_bits_[0] |= 0x00000001u;
}
void SourceAddressToken::clear_has_ip() {
_has_bits_[0] &= ~0x00000001u;
}
void SourceAddressToken::clear_ip() {
ip_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_ip();
}
const ::std::string& SourceAddressToken::ip() const {
// @@protoc_insertion_point(field_get:net.SourceAddressToken.ip)
return ip_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void SourceAddressToken::set_ip(const ::std::string& value) {
set_has_ip();
ip_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:net.SourceAddressToken.ip)
}
void SourceAddressToken::set_ip(const char* value) {
set_has_ip();
ip_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:net.SourceAddressToken.ip)
}
void SourceAddressToken::set_ip(const void* value, size_t size) {
set_has_ip();
ip_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:net.SourceAddressToken.ip)
}
::std::string* SourceAddressToken::mutable_ip() {
set_has_ip();
// @@protoc_insertion_point(field_mutable:net.SourceAddressToken.ip)
return ip_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* SourceAddressToken::release_ip() {
// @@protoc_insertion_point(field_release:net.SourceAddressToken.ip)
clear_has_ip();
return ip_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void SourceAddressToken::set_allocated_ip(::std::string* ip) {
if (ip != NULL) {
set_has_ip();
} else {
clear_has_ip();
}
ip_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ip);
// @@protoc_insertion_point(field_set_allocated:net.SourceAddressToken.ip)
}
// required int64 timestamp = 2;
bool SourceAddressToken::has_timestamp() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
void SourceAddressToken::set_has_timestamp() {
_has_bits_[0] |= 0x00000002u;
}
void SourceAddressToken::clear_has_timestamp() {
_has_bits_[0] &= ~0x00000002u;
}
void SourceAddressToken::clear_timestamp() {
timestamp_ = GOOGLE_LONGLONG(0);
clear_has_timestamp();
}
::google::protobuf::int64 SourceAddressToken::timestamp() const {
// @@protoc_insertion_point(field_get:net.SourceAddressToken.timestamp)
return timestamp_;
}
void SourceAddressToken::set_timestamp(::google::protobuf::int64 value) {
set_has_timestamp();
timestamp_ = value;
// @@protoc_insertion_point(field_set:net.SourceAddressToken.timestamp)
}
// optional .net.CachedNetworkParameters cached_network_parameters = 3;
bool SourceAddressToken::has_cached_network_parameters() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
void SourceAddressToken::set_has_cached_network_parameters() {
_has_bits_[0] |= 0x00000004u;
}
void SourceAddressToken::clear_has_cached_network_parameters() {
_has_bits_[0] &= ~0x00000004u;
}
void SourceAddressToken::clear_cached_network_parameters() {
if (cached_network_parameters_ != NULL) cached_network_parameters_->::net::CachedNetworkParameters::Clear();
clear_has_cached_network_parameters();
}
const ::net::CachedNetworkParameters& SourceAddressToken::cached_network_parameters() const {
// @@protoc_insertion_point(field_get:net.SourceAddressToken.cached_network_parameters)
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
return cached_network_parameters_ != NULL ? *cached_network_parameters_ : *default_instance().cached_network_parameters_;
#else
return cached_network_parameters_ != NULL ? *cached_network_parameters_ : *default_instance_->cached_network_parameters_;
#endif
}
::net::CachedNetworkParameters* SourceAddressToken::mutable_cached_network_parameters() {
set_has_cached_network_parameters();
if (cached_network_parameters_ == NULL) {
cached_network_parameters_ = new ::net::CachedNetworkParameters;
}
// @@protoc_insertion_point(field_mutable:net.SourceAddressToken.cached_network_parameters)
return cached_network_parameters_;
}
::net::CachedNetworkParameters* SourceAddressToken::release_cached_network_parameters() {
// @@protoc_insertion_point(field_release:net.SourceAddressToken.cached_network_parameters)
clear_has_cached_network_parameters();
::net::CachedNetworkParameters* temp = cached_network_parameters_;
cached_network_parameters_ = NULL;
return temp;
}
void SourceAddressToken::set_allocated_cached_network_parameters(::net::CachedNetworkParameters* cached_network_parameters) {
delete cached_network_parameters_;
cached_network_parameters_ = cached_network_parameters;
if (cached_network_parameters) {
set_has_cached_network_parameters();
} else {
clear_has_cached_network_parameters();
}
// @@protoc_insertion_point(field_set_allocated:net.SourceAddressToken.cached_network_parameters)
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// ===================================================================
static ::std::string* MutableUnknownFieldsForSourceAddressTokens(
SourceAddressTokens* ptr) {
return ptr->mutable_unknown_fields();
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int SourceAddressTokens::kTokensFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
SourceAddressTokens::SourceAddressTokens()
: ::google::protobuf::MessageLite(), _arena_ptr_(NULL) {
SharedCtor();
// @@protoc_insertion_point(constructor:net.SourceAddressTokens)
}
void SourceAddressTokens::InitAsDefaultInstance() {
}
SourceAddressTokens::SourceAddressTokens(const SourceAddressTokens& from)
: ::google::protobuf::MessageLite(),
_arena_ptr_(NULL) {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:net.SourceAddressTokens)
}
void SourceAddressTokens::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
_unknown_fields_.UnsafeSetDefault(
&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
SourceAddressTokens::~SourceAddressTokens() {
// @@protoc_insertion_point(destructor:net.SourceAddressTokens)
SharedDtor();
}
void SourceAddressTokens::SharedDtor() {
_unknown_fields_.DestroyNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited());
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
if (this != &default_instance()) {
#else
if (this != default_instance_) {
#endif
}
}
void SourceAddressTokens::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const SourceAddressTokens& SourceAddressTokens::default_instance() {
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_AddDesc_source_5faddress_5ftoken_2eproto();
#else
if (default_instance_ == NULL) protobuf_AddDesc_source_5faddress_5ftoken_2eproto();
#endif
return *default_instance_;
}
SourceAddressTokens* SourceAddressTokens::default_instance_ = NULL;
SourceAddressTokens* SourceAddressTokens::New(::google::protobuf::Arena* arena) const {
SourceAddressTokens* n = new SourceAddressTokens;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void SourceAddressTokens::Clear() {
// @@protoc_insertion_point(message_clear_start:net.SourceAddressTokens)
tokens_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
_unknown_fields_.ClearToEmptyNoArena(
&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
bool SourceAddressTokens::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
::google::protobuf::io::LazyStringOutputStream unknown_fields_string(
::google::protobuf::internal::NewPermanentCallback(
&MutableUnknownFieldsForSourceAddressTokens, this));
::google::protobuf::io::CodedOutputStream unknown_fields_stream(
&unknown_fields_string, false);
// @@protoc_insertion_point(parse_start:net.SourceAddressTokens)
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 .net.SourceAddressToken tokens = 4;
case 4: {
if (tag == 34) {
DO_(input->IncrementRecursionDepth());
parse_loop_tokens:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth(
input, add_tokens()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_loop_tokens;
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, &unknown_fields_stream));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:net.SourceAddressTokens)
return true;
failure:
// @@protoc_insertion_point(parse_failure:net.SourceAddressTokens)
return false;
#undef DO_
}
void SourceAddressTokens::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:net.SourceAddressTokens)
// repeated .net.SourceAddressToken tokens = 4;
for (unsigned int i = 0, n = this->tokens_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessage(
4, this->tokens(i), output);
}
output->WriteRaw(unknown_fields().data(),
static_cast<int>(unknown_fields().size()));
// @@protoc_insertion_point(serialize_end:net.SourceAddressTokens)
}
int SourceAddressTokens::ByteSize() const {
// @@protoc_insertion_point(message_byte_size_start:net.SourceAddressTokens)
int total_size = 0;
// repeated .net.SourceAddressToken tokens = 4;
total_size += 1 * this->tokens_size();
for (int i = 0; i < this->tokens_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->tokens(i));
}
total_size += unknown_fields().size();
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void SourceAddressTokens::CheckTypeAndMergeFrom(
const ::google::protobuf::MessageLite& from) {
MergeFrom(*::google::protobuf::down_cast<const SourceAddressTokens*>(&from));
}
void SourceAddressTokens::MergeFrom(const SourceAddressTokens& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:net.SourceAddressTokens)
if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__);
tokens_.MergeFrom(from.tokens_);
if (!from.unknown_fields().empty()) {
mutable_unknown_fields()->append(from.unknown_fields());
}
}
void SourceAddressTokens::CopyFrom(const SourceAddressTokens& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:net.SourceAddressTokens)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool SourceAddressTokens::IsInitialized() const {
if (!::google::protobuf::internal::AllAreInitialized(this->tokens())) return false;
return true;
}
void SourceAddressTokens::Swap(SourceAddressTokens* other) {
if (other == this) return;
InternalSwap(other);
}
void SourceAddressTokens::InternalSwap(SourceAddressTokens* other) {
tokens_.UnsafeArenaSwap(&other->tokens_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
::std::string SourceAddressTokens::GetTypeName() const {
return "net.SourceAddressTokens";
}
#if PROTOBUF_INLINE_NOT_IN_HEADERS
// SourceAddressTokens
// repeated .net.SourceAddressToken tokens = 4;
int SourceAddressTokens::tokens_size() const {
return tokens_.size();
}
void SourceAddressTokens::clear_tokens() {
tokens_.Clear();
}
const ::net::SourceAddressToken& SourceAddressTokens::tokens(int index) const {
// @@protoc_insertion_point(field_get:net.SourceAddressTokens.tokens)
return tokens_.Get(index);
}
::net::SourceAddressToken* SourceAddressTokens::mutable_tokens(int index) {
// @@protoc_insertion_point(field_mutable:net.SourceAddressTokens.tokens)
return tokens_.Mutable(index);
}
::net::SourceAddressToken* SourceAddressTokens::add_tokens() {
// @@protoc_insertion_point(field_add:net.SourceAddressTokens.tokens)
return tokens_.Add();
}
::google::protobuf::RepeatedPtrField< ::net::SourceAddressToken >*
SourceAddressTokens::mutable_tokens() {
// @@protoc_insertion_point(field_mutable_list:net.SourceAddressTokens.tokens)
return &tokens_;
}
const ::google::protobuf::RepeatedPtrField< ::net::SourceAddressToken >&
SourceAddressTokens::tokens() const {
// @@protoc_insertion_point(field_list:net.SourceAddressTokens.tokens)
return tokens_;
}
#endif // PROTOBUF_INLINE_NOT_IN_HEADERS
// @@protoc_insertion_point(namespace_scope)
} // namespace net
// @@protoc_insertion_point(global_scope)
| 34.959635 | 129 | 0.73783 | acmd |
925b5196589388e9a1896e0d317515e5cd754e49 | 374 | cpp | C++ | source/GameLogicNew.cpp | gennariarmando/v-hud | 788196fb3ce5a983073f0475f06b041c5a4ea949 | [
"MIT"
] | 69 | 2021-08-09T21:26:26.000Z | 2022-03-25T08:47:42.000Z | source/GameLogicNew.cpp | gennariarmando/v-hud | 788196fb3ce5a983073f0475f06b041c5a4ea949 | [
"MIT"
] | 84 | 2021-12-01T15:15:27.000Z | 2022-03-30T05:12:50.000Z | source/GameLogicNew.cpp | gennariarmando/v-hud | 788196fb3ce5a983073f0475f06b041c5a4ea949 | [
"MIT"
] | 12 | 2021-12-25T09:27:08.000Z | 2022-03-25T08:47:43.000Z | #include "VHud.h"
#include "GameLogicNew.h"
#include "HudNew.h"
#include "MenuNew.h"
using namespace plugin;
CGameLogicNew GameLogicNew;
static LateStaticInit InstallHooks([]() {
CdeclEvent<AddressList<0x442128, H_CALL>, PRIORITY_BEFORE, ArgPickNone, void()> OnResurrection;
OnResurrection += [] {
CHudNew::ReInit();
MenuNew.Clear();
};
});
| 19.684211 | 99 | 0.684492 | gennariarmando |
925d1bbdfc9349a924cbaf83942bedb466df6b64 | 1,084 | cpp | C++ | 11678 Cards Exchange.cpp | zihadboss/UVA-Solutions | 020fdcb09da79dc0a0411b04026ce3617c09cd27 | [
"Apache-2.0"
] | 86 | 2016-01-20T11:36:50.000Z | 2022-03-06T19:43:14.000Z | 11678 Cards Exchange.cpp | Mehedishihab/UVA-Solutions | 474fe3d9d9ba574b97fd40ca5abb22ada95654a1 | [
"Apache-2.0"
] | null | null | null | 11678 Cards Exchange.cpp | Mehedishihab/UVA-Solutions | 474fe3d9d9ba574b97fd40ca5abb22ada95654a1 | [
"Apache-2.0"
] | 113 | 2015-12-04T06:40:57.000Z | 2022-02-11T02:14:28.000Z | #include <cstdio>
#include <map>
using namespace std;
int main()
{
map<int, bool> cards;
int aCards, bCards, current, aCount, bCount;
while (scanf("%d %d", &aCards, &bCards), aCards && bCards)
{
aCount = bCount = 0;
cards.clear();
for (int i = 0; i < aCards; ++i)
{
scanf("%d", ¤t);
if (cards.find(current) == cards.end())
{
++aCount;
cards[current] = true;
}
}
for (int i = 0; i < bCards; ++i)
{
scanf("%d", ¤t);
map<int, bool>::iterator iter = cards.find(current);
if (iter == cards.end())
{
cards[current] = false;
++bCount;
}
else if (iter->second)
{
iter->second = false;
--aCount;
}
}
printf("%d\n", aCount < bCount ? aCount : bCount);
}
} | 21.68 | 64 | 0.373616 | zihadboss |
925ddd8946d79262da8a38c9ee87c991b78b3bb1 | 3,730 | cpp | C++ | ugene/src/plugins/remote_service/src/RemoteServicePlugin.cpp | iganna/lspec | c75cba3e4fa9a46abeecbf31b5d467827cf4fec0 | [
"MIT"
] | null | null | null | ugene/src/plugins/remote_service/src/RemoteServicePlugin.cpp | iganna/lspec | c75cba3e4fa9a46abeecbf31b5d467827cf4fec0 | [
"MIT"
] | null | null | null | ugene/src/plugins/remote_service/src/RemoteServicePlugin.cpp | iganna/lspec | c75cba3e4fa9a46abeecbf31b5d467827cf4fec0 | [
"MIT"
] | null | null | null | /**
* UGENE - Integrated Bioinformatics Tools.
* Copyright (C) 2008-2012 UniPro <ugene@unipro.ru>
* http://ugene.unipro.ru
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include <U2Core/AppContext.h>
#include <U2Core/Settings.h>
#include <U2Core/TaskStarter.h>
#include <U2Core/CMDLineRegistry.h>
#include <U2Remote/RemoteMachineMonitor.h>
#include "RemoteServiceCommon.h"
#include "RemoteServicePlugin.h"
#include "RemoteServiceSettingsUI.h"
#include "RemoteServicePingTask.h"
namespace U2 {
#define EC2_URL "http://184.73.180.209:80/rservice/engine"
#define EC2_PASS "rulezzz"
#define PING_REMOTE_SERVICE "ping-remote-service"
extern "C" Q_DECL_EXPORT U2::Plugin* U2_PLUGIN_INIT_FUNC()
{
RemoteServicePlugin* plug = new RemoteServicePlugin();
return plug;
}
const QString RemoteServiceCommon::WEB_TRANSPORT_PROTOCOL_ID = "Web transport protocol";
static void cleanupRemoteMachineMonitor() {
RemoteMachineMonitor* rmm = AppContext::getRemoteMachineMonitor();
QList<RemoteMachineSettingsPtr> items = rmm->getRemoteMachineMonitorItems();
foreach (const RemoteMachineSettingsPtr& item, items) {
rmm->removeMachineConfiguration(item);
}
}
RemoteServicePlugin::RemoteServicePlugin():
Plugin(tr("UGENE Remote Service Support"),
tr("Launching remote tasks via UGENE Remote Service")),
protocolUI((NULL == AppContext::getMainWindow())? NULL:(new RemoteServiceSettingsUI())),
protocolInfo( RemoteServiceCommon::WEB_TRANSPORT_PROTOCOL_ID , protocolUI.get(),
&remoteMachineFactory )
{
AppContext::getProtocolInfoRegistry()->registerProtocolInfo(&protocolInfo);
if (thisIsFirstLaunch()) {
cleanupRemoteMachineMonitor();
RemoteServiceSettingsPtr settings( new RemoteServiceMachineSettings(EC2_URL) );
settings->setupCredentials(RemoteServiceMachineSettings::GUEST_ACCOUNT, EC2_PASS, true);
AppContext::getRemoteMachineMonitor()->addMachineConfiguration(settings);
}
registerCMDLineHelp();
processCMDLineOptions();
}
RemoteServicePlugin::~RemoteServicePlugin()
{
}
void RemoteServicePlugin::registerCMDLineHelp()
{
}
void RemoteServicePlugin::processCMDLineOptions()
{
CMDLineRegistry * cmdlineReg = AppContext::getCMDLineRegistry();
assert(cmdlineReg != NULL);
if( cmdlineReg->hasParameter( PING_REMOTE_SERVICE ) )
{
QString machinePath = cmdlineReg->getParameterValue(PING_REMOTE_SERVICE);
Task * t = new RemoteServicePingTask(machinePath);
connect(AppContext::getPluginSupport(), SIGNAL(si_allStartUpPluginsLoaded()), new TaskStarter(t), SLOT(registerTask()));
}
}
#define NOT_FIRST_LAUNCH "remote_service/not_first_launch"
bool RemoteServicePlugin::thisIsFirstLaunch()
{
Settings* settings = AppContext::getSettings();
QString key = settings->toVersionKey(NOT_FIRST_LAUNCH);
if (settings->contains(key)) {
return false;
} else {
settings->setValue(key, QVariant(true));
return true;
}
}
} // namespace U2
| 31.610169 | 128 | 0.736729 | iganna |
177df375e0ba93a76b8d74c51ee777016f3e5064 | 1,726 | cpp | C++ | codeforces/A - Acacius and String/Wrong answer on pretest 2.cpp | kzvd4729/Problem-Solving | 13b105e725a4c2f8db7fecc5d7a8f932b9fef4ab | [
"MIT"
] | 1 | 2022-02-11T16:55:36.000Z | 2022-02-11T16:55:36.000Z | codeforces/A - Acacius and String/Wrong answer on pretest 2.cpp | kzvd4729/Problem-Solving | 13b105e725a4c2f8db7fecc5d7a8f932b9fef4ab | [
"MIT"
] | null | null | null | codeforces/A - Acacius and String/Wrong answer on pretest 2.cpp | kzvd4729/Problem-Solving | 13b105e725a4c2f8db7fecc5d7a8f932b9fef4ab | [
"MIT"
] | null | null | null | /****************************************************************************************
* @author: * kzvd4729 created: Jul/19/2020 15:20
* solution_verdict: Wrong answer on pretest 2 language: GNU C++17
* run_time: 15 ms memory_used: 3600 KB
* problem: https://codeforces.com/contest/1379/problem/A
****************************************************************************************/
#include<iostream>
#include<vector>
#include<cstring>
#include<map>
#include<bitset>
#include<assert.h>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<set>
#include<queue>
#include<unordered_map>
#include<random>
#include<chrono>
#include<stack>
#include<deque>
#define endl '\n'
#define long long long
using namespace std;
const int N=1e6;
string p="abacaba",s;
bool solve()
{
int n;cin>>n;cin>>s;
int cnt=0;
for(int i=0;i<n;i++)
{
int f=1;
for(int j=0;j<p.size();j++)
{
if(i+j==n){f=0;break;}
if(s[i+j]!=p[j])f=0;
}
cnt+=f;
}
if(cnt==1)
{
for(int i=0;i<n;i++)if(s[i]=='?')s[i]='d';
return true;
}
if(cnt>1)return false;
for(int i=0;i<n;i++)
{
int f=1;
for(int j=0;j<p.size();j++)
{
if(i+j==n){f=0;break;}
if(s[i+j]==p[j]||s[i+j]=='?');
else f=0;
}
if(f)
{
for(int j=0;j<p.size();j++)
s[i+j]=p[j];
return true;
}
}
return false;
}
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);
int t;cin>>t;
while(t--)
{
if(solve())cout<<"Yes\n"<<s<<"\n";
else cout<<"No\n";
}
return 0;
} | 22.710526 | 111 | 0.445539 | kzvd4729 |
178144aa9475178f061047f39de48fe5181a1534 | 10,949 | hpp | C++ | libraries/chain/include/graphene/chain/contract_object.hpp | BlockLink/HX-core | 646bdb19d7be7b4fd1ee94c777ef8e42d9aea783 | [
"MIT"
] | 1 | 2018-12-12T08:38:09.000Z | 2018-12-12T08:38:09.000Z | libraries/chain/include/graphene/chain/contract_object.hpp | BlockLink/HX-core | 646bdb19d7be7b4fd1ee94c777ef8e42d9aea783 | [
"MIT"
] | null | null | null | libraries/chain/include/graphene/chain/contract_object.hpp | BlockLink/HX-core | 646bdb19d7be7b4fd1ee94c777ef8e42d9aea783 | [
"MIT"
] | null | null | null | #pragma once
#include <graphene/chain/protocol/operations.hpp>
#include <graphene/db/generic_index.hpp>
#include <boost/multi_index/composite_key.hpp>
#include <graphene/chain/contract_entry.hpp>
#include <graphene/chain/vesting_balance_object.hpp>
#include <vector>
namespace graphene {
namespace chain {
struct by_contract_id;
struct by_contract_name {};
class contract_object : public abstract_object<contract_object> {
public:
static const uint8_t space_id = protocol_ids;
static const uint8_t type_id = contract_object_type;
uint32_t registered_block;
uvm::blockchain::Code code;
address owner_address;
time_point_sec create_time;
string name;
contract_address_type contract_address;
string contract_name;
string contract_desc;
contract_type type_of_contract = normal_contract;
string native_contract_key; // key to find native contract code
vector<contract_address_type> derived;
contract_address_type inherit_from;
};
struct by_owner{};
struct by_contract_obj_id {};
struct by_registered_block {};
typedef multi_index_container<
contract_object,
indexed_by<
ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>,
ordered_unique<tag<by_contract_id>, member<contract_object, contract_address_type, &contract_object::contract_address>>,
ordered_non_unique<tag<by_contract_name>, member<contract_object, string, &contract_object::contract_name>>,
ordered_non_unique<tag<by_owner>, member<contract_object, address, &contract_object::owner_address>>,
ordered_non_unique<tag<by_registered_block>, member<contract_object, uint32_t, &contract_object::registered_block>>
>> contract_object_multi_index_type;
typedef generic_index<contract_object, contract_object_multi_index_type> contract_object_index;
class contract_storage_change_object : public abstract_object<contract_storage_change_object> {
public:
static const uint8_t space_id = protocol_ids;
static const uint8_t type_id = contract_storage_change_object_type;
contract_address_type contract_address;
uint32_t block_num;
};
struct by_block_num {};
typedef multi_index_container<
contract_storage_change_object,
indexed_by<
ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>,
ordered_unique<tag<by_contract_id>, member<contract_storage_change_object, contract_address_type, &contract_storage_change_object::contract_address>>,
ordered_non_unique<tag<by_block_num>, member<contract_storage_change_object, uint32_t, &contract_storage_change_object::block_num>>
>> contract_storage_change_object_multi_index_type;
typedef generic_index<contract_storage_change_object, contract_storage_change_object_multi_index_type> contract_storage_change_index;
class contract_storage_object : public abstract_object<contract_storage_object> {
public:
static const uint8_t space_id = protocol_ids;
static const uint8_t type_id = contract_storage_object_type;
contract_address_type contract_address;
string storage_name;
std::vector<char> storage_value;
};
struct by_contract_id_storage_name {};
typedef multi_index_container<
contract_storage_object,
indexed_by<
ordered_unique<tag<by_id>, member<object, object_id_type, &object::id>>,
ordered_unique< tag<by_contract_id_storage_name>,
composite_key<
contract_storage_object,
member<contract_storage_object, contract_address_type, &contract_storage_object::contract_address>,
member<contract_storage_object, string, &contract_storage_object::storage_name>
>
>
>> contract_storage_object_multi_index_type;
typedef generic_index<contract_storage_object, contract_storage_object_multi_index_type> contract_storage_object_index;
class contract_balance_object : public abstract_object<contract_balance_object>
{
public:
static const uint8_t space_id = protocol_ids;
static const uint8_t type_id = contract_balance_object_type;
bool is_vesting_balance()const
{
return vesting_policy.valid();
}
asset available(fc::time_point_sec now)const
{
return is_vesting_balance() ? vesting_policy->get_allowed_withdraw({ balance, now,{} })
: balance;
}
void adjust_balance(asset delta, fc::time_point_sec now)
{
balance += delta;
last_claim_date = now;
}
contract_address_type owner;
asset balance;
optional<linear_vesting_policy> vesting_policy;
time_point_sec last_claim_date;
asset_id_type asset_type()const { return balance.asset_id; }
};
struct by_owner;
/**
* @ingroup object_index
*/
using contract_balance_multi_index_type = multi_index_container<
contract_balance_object,
indexed_by<
ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
ordered_non_unique< tag<by_contract_id>, member< contract_balance_object, contract_address_type, &contract_balance_object::owner > >,
ordered_non_unique< tag<by_owner>, composite_key<
contract_balance_object,
member<contract_balance_object, contract_address_type, &contract_balance_object::owner>,
const_mem_fun<contract_balance_object, asset_id_type, &contract_balance_object::asset_type>
> >
>
>;
/**
* @ingroup object_index
*/
using contract_balance_index = generic_index<contract_balance_object, contract_balance_multi_index_type>;
class contract_event_notify_object : public abstract_object<contract_event_notify_object>
{
public:
static const uint8_t space_id = protocol_ids;
static const uint8_t type_id = contract_event_notify_object_type;
contract_address_type contract_address;
string event_name;
string event_arg;
transaction_id_type trx_id;
uint64_t block_num;
uint64_t op_num;
};
using contract_event_notify_multi_index_type = multi_index_container<
contract_event_notify_object,
indexed_by<
ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
ordered_non_unique<tag<by_contract_id>, member<contract_event_notify_object, contract_address_type, &contract_event_notify_object::contract_address>>
>
>;
using contract_event_notify_index = generic_index<contract_event_notify_object, contract_event_notify_multi_index_type>;
class contract_invoke_result_object : public abstract_object<contract_invoke_result_object>
{
public:
static const uint8_t space_id = protocol_ids;
static const uint8_t type_id = contract_invoke_result_object_type;
transaction_id_type trx_id;
uint32_t block_num;
int op_num;
std::string api_result;
std::vector<contract_event_notify_info> events;
bool exec_succeed = true;
share_type acctual_fee;
address invoker;
std::map<std::string, contract_storage_changes_type, comparator_for_string> storage_changes;
std::map<std::pair<contract_address_type, asset_id_type>, share_type> contract_withdraw;
std::map<std::pair<contract_address_type, asset_id_type>, share_type> contract_balances;
std::map<std::pair<address, asset_id_type>, share_type> deposit_to_address;
std::map<std::pair<contract_address_type, asset_id_type>, share_type> deposit_contract;
inline bool operator<(const contract_invoke_result_object& obj) const
{
if (block_num < obj.block_num)
return true;
if(block_num == obj.block_num)
return op_num < obj.op_num;
return false;
}
};
struct by_trxid_and_opnum {};
struct by_trxid {};
using contract_invoke_result_multi_index_type = multi_index_container <
contract_invoke_result_object,
indexed_by <
ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
ordered_non_unique<tag<by_trxid>, member<contract_invoke_result_object, transaction_id_type, &contract_invoke_result_object::trx_id>>,
ordered_unique<tag<by_trxid_and_opnum>,
composite_key<contract_invoke_result_object,
member<contract_invoke_result_object, transaction_id_type, &contract_invoke_result_object::trx_id>,
member<contract_invoke_result_object, int, &contract_invoke_result_object::op_num>>>
>
>;
using contract_invoke_result_index = generic_index<contract_invoke_result_object, contract_invoke_result_multi_index_type>;
class contract_hash_entry
{
public:
std::string contract_address;
std::string hash;
public:
contract_hash_entry() {}
inline contract_hash_entry(const chain::contract_object& cont)
{
contract_address = cont.contract_address.operator fc::string();
hash = cont.code.GetHash();
}
};
}
}
FC_REFLECT_DERIVED(graphene::chain::contract_object, (graphene::db::object),
(registered_block)(code)(owner_address)(create_time)(name)(contract_address)(type_of_contract)(native_contract_key)(contract_name)(contract_desc)(derived)(inherit_from))
FC_REFLECT_DERIVED(graphene::chain::contract_storage_object, (graphene::db::object),
(contract_address)(storage_name)(storage_value))
FC_REFLECT_DERIVED(graphene::chain::contract_balance_object, (graphene::db::object),
(owner)(balance)(vesting_policy)(last_claim_date))
FC_REFLECT_DERIVED(graphene::chain::contract_event_notify_object, (graphene::db::object),
(contract_address)(event_name)(event_arg)(trx_id)(block_num)(op_num))
FC_REFLECT_DERIVED(graphene::chain::contract_invoke_result_object, (graphene::db::object),
(trx_id)(block_num)(op_num)(api_result)(events)(exec_succeed)(acctual_fee)(invoker)(contract_withdraw)(contract_balances)(deposit_to_address)(deposit_contract))
//(contract_withdraw)(contract_balances)(deposit_to_address)(deposit_contract)
FC_REFLECT(graphene::chain::contract_hash_entry,(contract_address)(hash))
FC_REFLECT_DERIVED(graphene::chain::contract_storage_change_object, (graphene::db::object),(contract_address)(block_num)) | 47.193966 | 173 | 0.704539 | BlockLink |
178214975f3950a6298c123328751d524acfcf13 | 7,538 | cpp | C++ | lib/cml/utils/Command_line.cpp | JayKickliter/CML | d21061a3abc013a8386798280b9595e9d4a2978c | [
"MIT"
] | null | null | null | lib/cml/utils/Command_line.cpp | JayKickliter/CML | d21061a3abc013a8386798280b9595e9d4a2978c | [
"MIT"
] | null | null | null | lib/cml/utils/Command_line.cpp | JayKickliter/CML | d21061a3abc013a8386798280b9595e9d4a2978c | [
"MIT"
] | null | null | null | /*
Name: Command_line.cpp
Copyright(c) 2019 Mateusz Semegen
This code is licensed under MIT license (see LICENSE file for details)
*/
//this
#include <cml/utils/Command_line.hpp>
//cml
#include <cml/common/memory.hpp>
#include <cml/debug/assert.hpp>
#include <cml/hal/peripherals/USART.hpp>
namespace cml {
namespace utils {
using namespace cml::collection;
using namespace cml::common;
using namespace cml::hal;
void Command_line::update()
{
char c[] = { 0, 0, 0 };
uint32_t length = this->read_character.function(c, sizeof(c), this->read_character.p_user_data);
if (1 == length)
{
switch (c[0])
{
case '\n':
{
if (this->line_length > 0)
{
this->line_buffer[this->line_length] = 0;
this->commands_carousel.push(this->line_buffer, this->line_length);
this->callback_parameters_buffer_view = this->get_callback_parameters(this->line_buffer,
this->line_length,
" -",
2);
bool command_executed = this->execute_command(this->callback_parameters_buffer_view);
if (false == command_executed)
{
this->write_new_line();
this->write_string.function(this->p_command_not_found_message,
this->command_not_found_message_length,
this->write_string.p_user_data);
}
this->line_length = 0;
}
this->write_new_line();
this->write_prompt();
}
break;
case '\b':
{
if (this->line_length > 0)
{
this->line_buffer[this->line_length--] = 0;
this->write_string.function("\b \b", 3, this->write_string.p_user_data);
}
}
break;
default:
{
if (this->line_length + 1 < config::command_line::line_buffer_capacity)
{
this->line_buffer[this->line_length++] = c[0];
this->write_character.function(c[0], this->write_character.p_user_data);
}
}
}
}
else if (3 == length && '\033' == c[0])
{
this->execute_escape_sequence(c[1], c[2]);
}
}
Vector<Command_line::Callback::Parameter> Command_line::get_callback_parameters(char* a_p_line,
uint32_t a_length,
const char* a_p_separators,
uint32_t a_separators_count)
{
Vector<Callback::Parameter> ret(this->callback_parameters_buffer,
config::command_line::callback_parameters_buffer_capacity);
auto contains = [](char a_character, const char* a_p_separators, uint32_t a_separators_count)
{
bool ret = false;
for (decltype(a_separators_count) i = 0; i < a_separators_count && false == ret; i++)
{
ret = a_p_separators[i] == a_character;
}
return ret;
};
const char* p_begin = &(a_p_line[0]);
for (decltype(a_length) i = 0; i < a_length && false == ret.is_full(); i++)
{
if (nullptr != p_begin && true == contains(a_p_line[i], a_p_separators, a_separators_count))
{
assert(&(a_p_line[i]) > p_begin);
ret.push_back({ p_begin, static_cast<uint32_t>(&(a_p_line[i]) - p_begin) });
a_p_line[i] = 0;
p_begin = nullptr;
}
else if (nullptr == p_begin && false == contains(a_p_line[i], a_p_separators, a_separators_count))
{
p_begin = &(a_p_line[i]);
}
}
if (nullptr != p_begin && false == ret.is_full())
{
assert(&(a_p_line[a_length]) > p_begin);
ret.push_back({ p_begin, static_cast<uint32_t>(&(a_p_line[a_length]) - p_begin) });
}
return ret;
}
bool Command_line::execute_command(const Vector<Callback::Parameter>& a_parameters)
{
uint32_t index = this->callbacks_buffer_view.get_capacity();
for (uint32_t i = 0; i < this->callbacks_buffer_view.get_length() &&
this->callbacks_buffer_view.get_capacity() == index; i++)
{
if (true == cstring::equals(a_parameters[0].a_p_value,
this->callbacks_buffer_view[i].p_name,
a_parameters[0].length))
{
index = i;
}
}
bool ret = index != this->callbacks_buffer_view.get_capacity();
if (true == ret)
{
this->callbacks_buffer_view[index].function(a_parameters, this->callbacks_buffer_view[index].p_user_data);
}
return ret;
}
void Command_line::execute_escape_sequence(char a_first, char a_second)
{
if ('[' == a_first && this->commands_carousel.get_length() > 0)
{
this->write_string.function("\033[2K\r", 5, this->write_string.p_user_data);
this->write_prompt();
switch (a_second)
{
case 'A':
{
const Commands_carousel::Command& command = this->commands_carousel.read_next();
memory::copy(this->line_buffer, sizeof(this->line_buffer), command.buffer, command.length);
this->line_length = command.length;
this->write_string.function(command.buffer, command.length, this->write_string.p_user_data);
}
break;
case 'B':
{
const Commands_carousel::Command& command = this->commands_carousel.read_prev();
memory::copy(this->line_buffer, sizeof(this->line_buffer), command.buffer, command.length);
this->line_length = command.length;
this->write_string.function(command.buffer, command.length, this->write_string.p_user_data);
}
break;
}
}
}
void Command_line::Commands_carousel::push(const char* a_p_line, uint32_t a_length)
{
if (this->write_index == config::command_line::commands_carousel_capacity)
{
this->write_index = 0;
}
this->commands[this->write_index].length = a_length;
memory::copy(this->commands[this->write_index].buffer,
sizeof(this->commands[this->write_index].buffer),
a_p_line,
a_length);
this->write_index++;
if (this->length < config::command_line::commands_carousel_capacity)
{
this->length++;
}
}
const Command_line::Commands_carousel::Command& Command_line::Commands_carousel::read_next() const
{
assert(this->length > 0);
return this->commands[this->read_index++ % this->length];
}
const Command_line::Commands_carousel::Command& Command_line::Commands_carousel::read_prev() const
{
assert(this->length > 0);
return this->commands[this->read_index-- % this->length];
}
} // namespace utils
} // namespace cml | 32.491379 | 114 | 0.529849 | JayKickliter |
1783119049e7e8958e5190c6a21a7eafa84b09dd | 5,349 | cpp | C++ | experiment/synth.cpp | keryell/muSYCL | 130e4b29c3a4daf4c908b08263b53910acb13787 | [
"Apache-2.0"
] | 16 | 2021-05-07T11:33:59.000Z | 2022-03-05T02:36:06.000Z | experiment/synth.cpp | keryell/muSYCL | 130e4b29c3a4daf4c908b08263b53910acb13787 | [
"Apache-2.0"
] | null | null | null | experiment/synth.cpp | keryell/muSYCL | 130e4b29c3a4daf4c908b08263b53910acb13787 | [
"Apache-2.0"
] | null | null | null | #include "rtaudio/RtAudio.h"
#include "rtmidi/RtMidi.h"
#include <atomic>
#include <chrono>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <iostream>
#include <thread>
#include <vector>
/// The configuration part to adapt to the context
// Jack
auto constexpr midi_api = RtMidi::UNIX_JACK;
auto constexpr midi_in_port = 0;
// ALSA
//auto constexpr midi_api = RtMidi::LINUX_ALSA;
//auto constexpr midi_in_port = 1;
/// The configuration part to adapt to the context
// Jack
auto constexpr audio_api = RtAudio::UNIX_JACK;
// ALSA
//auto constexpr audio_api = RtAudio::LINUX_ALSA;
// To use time unit literals directly
using namespace std::chrono_literals;
std::atomic saw_level = 0.;
std::atomic dt = 0.;
/// Check for errors
auto check_error = [] (auto&& function) {
try {
return function();
}
catch (const RtAudioError &error) {
error.printMessage();
std::exit(EXIT_FAILURE);
}
catch (const RtMidiError &error) {
error.printMessage();
std::exit(EXIT_FAILURE);
}
};
/// Process the incomming MIDI messages
void midi_in_callback(double time_stamp,
std::vector<std::uint8_t>* p_midi_message,
void* user_data ) {
auto &midi_message = *p_midi_message;
auto n_bytes = midi_message.size();
for (int i = 0; i < n_bytes; ++i)
std::cout << "Byte " << i << " = "
<< static_cast<int>(midi_message[i]) << ", ";
std::cout << "time stamp = " << time_stamp << std::endl;
if (midi_message[0] == 176 && midi_message[1] == 27)
// Use the left pedal value of an FCB1010 to change the sound
saw_level = (midi_message[2] - 64)/70.;
else if (midi_message[0] == 144 && midi_message[2] != 0) {
// Start the note
auto frequency = 440*std::pow(2., (midi_message[1] - 69)/12.);
dt = 2*frequency/48000;
}
else if (midi_message[0] == 128
|| (midi_message[0] == 144 && midi_message[2] == 0))
// Stop the note
dt = 0;
}
// 1 channel sawtooth wave generator.
int audio_callback(void *output_buffer, void *input_buffer,
unsigned int frame_size, double time_stamp,
RtAudioStreamStatus status, void *user_data) {
auto buffer = static_cast<double*>(output_buffer);
auto& last_value = *static_cast<double *>(user_data);
if (status)
std::cerr << "Stream underflow detected!" << std::endl;
for (auto i = 0; i < frame_size; ++i) {
// Add some clamping to the saw signal to change the sound
buffer[i] = last_value > saw_level ? 1. : last_value;
// Advance the phase
last_value += dt;
// The value is cyclic, between -1 and 1
if (last_value >= 1.0)
last_value -= 2.0;
}
return 0;
}
int main() {
std::cout << "RtMidi version " << RtMidi::getVersion() << std::endl;
/* Only from RtMidi 4.0.0...
std::cout << "RtMidi version " << RtMidi::getVersion()
<< "\nAPI availables:" << std::endl;
std::vector<RtMidi::Api> apis;
RtMidi::getCompiledApi(apis);
for (auto a : apis)
std::cout << '\t' << RtMidi::getApiName(a) << std::endl;
*/
// Create a MIDI input using Jack and a fancy client name
auto midi_in = check_error([] { return RtMidiIn { midi_api,
"muSYCLtest" }; });
auto n_ports = midi_in.getPortCount();
std::cout << "There are " << n_ports << " MIDI input sources available."
<< std::endl;
for (int i = 0; i < n_ports; ++i) {
auto port_name = midi_in.getPortName(i);
std::cout << " Input Port #" << i << ": " << port_name << '\n';
}
// Open the first port and give it a fancy name
check_error([&] { midi_in.openPort(midi_in_port, "testMIDIinput"); });
// Don't ignore sysex, timing, or active sensing messages
midi_in.ignoreTypes(false, false, false);
// Drain the message queue to avoid leftover MIDI messages
std::vector<std::uint8_t> message;
do {
// There is some race condition in RtMidi where the messages are
// not seen if there is not some sleep here
std::this_thread::sleep_for(1ms);
midi_in.getMessage(&message);
} while (!message.empty());
// Handle MIDI messages with this callback function
midi_in.setCallback(midi_in_callback, nullptr);
auto audio = check_error([] { return RtAudio { audio_api }; });
auto device = audio.getDefaultOutputDevice();
RtAudio::StreamParameters parameters;
parameters.deviceId = device;
parameters.nChannels = 1;
parameters.firstChannel = 0;
RtAudio::StreamOptions options;
options.streamName = "muSYCLtest";
auto sample_rate = audio.getDeviceInfo(device).preferredSampleRate;
auto frame_size = 256U; // 256 sample frames
double data {};
check_error([&] {
audio.openStream(¶meters, nullptr, RTAUDIO_FLOAT64,
sample_rate, &frame_size, audio_callback, &data, &options,
[] (RtAudioError::Type type,
const std::string &error_text) {
std::cerr << error_text << std::endl;
});
});
std::cout << "Sample rate: " << sample_rate
<< "\nSamples per frame: " << frame_size << std::endl;
// Start the sound generation
check_error([&] { audio.startStream(); });
std::cout << "\nReading MIDI input ... press <enter> to quit.\n";
char input;
std::cin.get(input);
return 0;
}
| 31.650888 | 79 | 0.627594 | keryell |
1783b817ce7ce681ea631e49cbfc4192b904d265 | 12,406 | hpp | C++ | include/System/Net/Http/Headers/HttpHeaders.hpp | darknight1050/BeatSaber-Quest-Codegen | a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032 | [
"Unlicense"
] | null | null | null | include/System/Net/Http/Headers/HttpHeaders.hpp | darknight1050/BeatSaber-Quest-Codegen | a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032 | [
"Unlicense"
] | null | null | null | include/System/Net/Http/Headers/HttpHeaders.hpp | darknight1050/BeatSaber-Quest-Codegen | a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032 | [
"Unlicense"
] | null | null | null | // Autogenerated from CppHeaderCreator
// Created by Sc2ad
// =========================================================================
#pragma once
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: System.Collections.Generic.IEnumerable`1
#include "System/Collections/Generic/IEnumerable_1.hpp"
// Including type: System.Collections.Generic.KeyValuePair`2
#include "System/Collections/Generic/KeyValuePair_2.hpp"
// Including type: System.Net.Http.Headers.HttpHeaderKind
#include "System/Net/Http/Headers/HttpHeaderKind.hpp"
// Including type: System.Nullable`1
#include "System/Nullable_1.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Begin forward declares
// Forward declaring namespace: System::Net::Http::Headers
namespace System::Net::Http::Headers {
// Forward declaring type: HeaderInfo
class HeaderInfo;
// Forward declaring type: HttpHeaderValueCollection`1<T>
template<typename T>
class HttpHeaderValueCollection_1;
}
// Forward declaring namespace: System::Collections::Generic
namespace System::Collections::Generic {
// Forward declaring type: Dictionary`2<TKey, TValue>
template<typename TKey, typename TValue>
class Dictionary_2;
// Forward declaring type: IEnumerator`1<T>
template<typename T>
class IEnumerator_1;
// Forward declaring type: List`1<T>
template<typename T>
class List_1;
}
// Forward declaring namespace: System::Collections
namespace System::Collections {
// Forward declaring type: IEnumerator
class IEnumerator;
}
// Forward declaring namespace: System
namespace System {
// Forward declaring type: Func`2<T, TResult>
template<typename T, typename TResult>
class Func_2;
}
// Completed forward declares
// Type namespace: System.Net.Http.Headers
namespace System::Net::Http::Headers {
// WARNING Size may be invalid!
// Autogenerated type: System.Net.Http.Headers.HttpHeaders
class HttpHeaders : public ::Il2CppObject/*, public System::Collections::Generic::IEnumerable_1<System::Collections::Generic::KeyValuePair_2<::Il2CppString*, System::Collections::Generic::IEnumerable_1<::Il2CppString*>*>>*/ {
public:
// Nested type: System::Net::Http::Headers::HttpHeaders::HeaderBucket
class HeaderBucket;
// Nested type: System::Net::Http::Headers::HttpHeaders::$GetEnumerator$d__19
class $GetEnumerator$d__19;
// private readonly System.Collections.Generic.Dictionary`2<System.String,System.Net.Http.Headers.HttpHeaders/HeaderBucket> headers
// Size: 0x8
// Offset: 0x10
System::Collections::Generic::Dictionary_2<::Il2CppString*, System::Net::Http::Headers::HttpHeaders::HeaderBucket*>* headers;
// Field size check
static_assert(sizeof(System::Collections::Generic::Dictionary_2<::Il2CppString*, System::Net::Http::Headers::HttpHeaders::HeaderBucket*>*) == 0x8);
// private readonly System.Net.Http.Headers.HttpHeaderKind HeaderKind
// Size: 0x4
// Offset: 0x18
System::Net::Http::Headers::HttpHeaderKind HeaderKind;
// Field size check
static_assert(sizeof(System::Net::Http::Headers::HttpHeaderKind) == 0x4);
// System.Nullable`1<System.Boolean> connectionclose
// Size: 0xFFFFFFFF
// Offset: 0x1C
System::Nullable_1<bool> connectionclose;
// System.Nullable`1<System.Boolean> transferEncodingChunked
// Size: 0xFFFFFFFF
// Offset: 0x1E
System::Nullable_1<bool> transferEncodingChunked;
// Creating value type constructor for type: HttpHeaders
HttpHeaders(System::Collections::Generic::Dictionary_2<::Il2CppString*, System::Net::Http::Headers::HttpHeaders::HeaderBucket*>* headers_ = {}, System::Net::Http::Headers::HttpHeaderKind HeaderKind_ = {}, System::Nullable_1<bool> connectionclose_ = {}, System::Nullable_1<bool> transferEncodingChunked_ = {}) noexcept : headers{headers_}, HeaderKind{HeaderKind_}, connectionclose{connectionclose_}, transferEncodingChunked{transferEncodingChunked_} {}
// Creating interface conversion operator: operator System::Collections::Generic::IEnumerable_1<System::Collections::Generic::KeyValuePair_2<::Il2CppString*, System::Collections::Generic::IEnumerable_1<::Il2CppString*>*>>
operator System::Collections::Generic::IEnumerable_1<System::Collections::Generic::KeyValuePair_2<::Il2CppString*, System::Collections::Generic::IEnumerable_1<::Il2CppString*>*>>() noexcept {
return *reinterpret_cast<System::Collections::Generic::IEnumerable_1<System::Collections::Generic::KeyValuePair_2<::Il2CppString*, System::Collections::Generic::IEnumerable_1<::Il2CppString*>*>>*>(this);
}
// Get static field: static private readonly System.Collections.Generic.Dictionary`2<System.String,System.Net.Http.Headers.HeaderInfo> known_headers
static System::Collections::Generic::Dictionary_2<::Il2CppString*, System::Net::Http::Headers::HeaderInfo*>* _get_known_headers();
// Set static field: static private readonly System.Collections.Generic.Dictionary`2<System.String,System.Net.Http.Headers.HeaderInfo> known_headers
static void _set_known_headers(System::Collections::Generic::Dictionary_2<::Il2CppString*, System::Net::Http::Headers::HeaderInfo*>* value);
// static private System.Void .cctor()
// Offset: 0x1578514
static void _cctor();
// System.Void .ctor(System.Net.Http.Headers.HttpHeaderKind headerKind)
// Offset: 0x1578314
template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary>
static HttpHeaders* New_ctor(System::Net::Http::Headers::HttpHeaderKind headerKind) {
static auto ___internal__logger = ::Logger::get().WithContext("System::Net::Http::Headers::HttpHeaders::.ctor");
return THROW_UNLESS((::il2cpp_utils::New<HttpHeaders*, creationType>(headerKind)));
}
// private System.Boolean AddInternal(System.String name, System.Collections.Generic.IEnumerable`1<System.String> values, System.Net.Http.Headers.HeaderInfo headerInfo, System.Boolean ignoreInvalid)
// Offset: 0x157A068
bool AddInternal(::Il2CppString* name, System::Collections::Generic::IEnumerable_1<::Il2CppString*>* values, System::Net::Http::Headers::HeaderInfo* headerInfo, bool ignoreInvalid);
// public System.Boolean TryAddWithoutValidation(System.String name, System.Collections.Generic.IEnumerable`1<System.String> values)
// Offset: 0x157A60C
bool TryAddWithoutValidation(::Il2CppString* name, System::Collections::Generic::IEnumerable_1<::Il2CppString*>* values);
// private System.Boolean TryCheckName(System.String name, out System.Net.Http.Headers.HeaderInfo headerInfo)
// Offset: 0x157A6E4
bool TryCheckName(::Il2CppString* name, System::Net::Http::Headers::HeaderInfo*& headerInfo);
// public System.Collections.Generic.IEnumerator`1<System.Collections.Generic.KeyValuePair`2<System.String,System.Collections.Generic.IEnumerable`1<System.String>>> GetEnumerator()
// Offset: 0x157A844
System::Collections::Generic::IEnumerator_1<System::Collections::Generic::KeyValuePair_2<::Il2CppString*, System::Collections::Generic::IEnumerable_1<::Il2CppString*>*>>* GetEnumerator();
// private System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
// Offset: 0x157A8E0
System::Collections::IEnumerator* System_Collections_IEnumerable_GetEnumerator();
// static System.String GetSingleHeaderString(System.String key, System.Collections.Generic.IEnumerable`1<System.String> values)
// Offset: 0x157A8E4
static ::Il2CppString* GetSingleHeaderString(::Il2CppString* key, System::Collections::Generic::IEnumerable_1<::Il2CppString*>* values);
// private System.Collections.Generic.List`1<System.String> GetAllHeaderValues(System.Net.Http.Headers.HttpHeaders/HeaderBucket bucket, System.Net.Http.Headers.HeaderInfo headerInfo)
// Offset: 0x157AF58
System::Collections::Generic::List_1<::Il2CppString*>* GetAllHeaderValues(System::Net::Http::Headers::HttpHeaders::HeaderBucket* bucket, System::Net::Http::Headers::HeaderInfo* headerInfo);
// static System.Net.Http.Headers.HttpHeaderKind GetKnownHeaderKind(System.String name)
// Offset: 0x157B1B8
static System::Net::Http::Headers::HttpHeaderKind GetKnownHeaderKind(::Il2CppString* name);
// T GetValue(System.String name)
// Offset: 0xFFFFFFFF
template<class T>
T GetValue(::Il2CppString* name) {
static auto ___internal__logger = ::Logger::get().WithContext("System::Net::Http::Headers::HttpHeaders::GetValue");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetValue", std::vector<Il2CppClass*>{::il2cpp_utils::il2cpp_type_check::il2cpp_no_arg_class<T>::get()}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(name)})));
static auto* ___generic__method = THROW_UNLESS(::il2cpp_utils::MakeGenericMethod(___internal__method, std::vector<Il2CppClass*>{::il2cpp_utils::il2cpp_type_check::il2cpp_no_arg_class<T>::get()}));
return ::il2cpp_utils::RunMethodThrow<T, false>(this, ___generic__method, name);
}
// System.Net.Http.Headers.HttpHeaderValueCollection`1<T> GetValues(System.String name)
// Offset: 0xFFFFFFFF
template<class T>
System::Net::Http::Headers::HttpHeaderValueCollection_1<T>* GetValues(::Il2CppString* name) {
static auto ___internal__logger = ::Logger::get().WithContext("System::Net::Http::Headers::HttpHeaders::GetValues");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetValues", std::vector<Il2CppClass*>{::il2cpp_utils::il2cpp_type_check::il2cpp_no_arg_class<T>::get()}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(name)})));
static auto* ___generic__method = THROW_UNLESS(::il2cpp_utils::MakeGenericMethod(___internal__method, std::vector<Il2CppClass*>{::il2cpp_utils::il2cpp_type_check::il2cpp_no_arg_class<T>::get()}));
return ::il2cpp_utils::RunMethodThrow<System::Net::Http::Headers::HttpHeaderValueCollection_1<T>*, false>(this, ___generic__method, name);
}
// System.Void SetValue(System.String name, T value, System.Func`2<System.Object,System.String> toStringConverter)
// Offset: 0xFFFFFFFF
template<class T>
void SetValue(::Il2CppString* name, T value, System::Func_2<::Il2CppObject*, ::Il2CppString*>* toStringConverter) {
static auto ___internal__logger = ::Logger::get().WithContext("System::Net::Http::Headers::HttpHeaders::SetValue");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetValue", std::vector<Il2CppClass*>{::il2cpp_utils::il2cpp_type_check::il2cpp_no_arg_class<T>::get()}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(name), ::il2cpp_utils::ExtractType(value), ::il2cpp_utils::ExtractType(toStringConverter)})));
static auto* ___generic__method = THROW_UNLESS(::il2cpp_utils::MakeGenericMethod(___internal__method, std::vector<Il2CppClass*>{::il2cpp_utils::il2cpp_type_check::il2cpp_no_arg_class<T>::get()}));
::il2cpp_utils::RunMethodThrow<void, false>(this, ___generic__method, name, value, toStringConverter);
}
// protected System.Void .ctor()
// Offset: 0x1579F80
// Implemented from: System.Object
// Base method: System.Void Object::.ctor()
template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary>
static HttpHeaders* New_ctor() {
static auto ___internal__logger = ::Logger::get().WithContext("System::Net::Http::Headers::HttpHeaders::.ctor");
return THROW_UNLESS((::il2cpp_utils::New<HttpHeaders*, creationType>()));
}
// public override System.String ToString()
// Offset: 0x157AC90
// Implemented from: System.Object
// Base method: System.String Object::ToString()
::Il2CppString* ToString();
}; // System.Net.Http.Headers.HttpHeaders
// WARNING Not writing size check since size may be invalid!
}
DEFINE_IL2CPP_ARG_TYPE(System::Net::Http::Headers::HttpHeaders*, "System.Net.Http.Headers", "HttpHeaders");
| 72.127907 | 456 | 0.740206 | darknight1050 |
17845c76a346480ea1cf7f56065a15be5ff2c786 | 12,435 | cpp | C++ | tests/posix/getdents/getdents.cpp | krzycz/pmemfile | a1b9897a90cd223e24c10c4a7558235986f0fad3 | [
"BSD-3-Clause"
] | null | null | null | tests/posix/getdents/getdents.cpp | krzycz/pmemfile | a1b9897a90cd223e24c10c4a7558235986f0fad3 | [
"BSD-3-Clause"
] | null | null | null | tests/posix/getdents/getdents.cpp | krzycz/pmemfile | a1b9897a90cd223e24c10c4a7558235986f0fad3 | [
"BSD-3-Clause"
] | null | null | null | /*
* Copyright 2016-2017, Intel Corporation
*
* 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 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
* 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.
*/
/*
* getdents.cpp -- unit test for pmemfile_getdents & pmemfile_getdents64
*/
#include "pmemfile_test.hpp"
class getdents : public pmemfile_test {
public:
getdents() : pmemfile_test()
{
}
};
static void
dump_linux_dirents(void *dirp, unsigned length)
{
char *buf = (char *)dirp;
for (unsigned i = 0; i < length;) {
long ino = *(long *)&buf[i];
T_OUT("d_ino.txt: 0x%016lx\n", ino);
T_OUT("d_ino.bin:");
for (unsigned j = 0; j < 8; ++j, ++i)
T_OUT(" 0x%02hhx", buf[i]);
T_OUT("\n");
long off = *(long *)&buf[i];
T_OUT("d_off.txt: 0x%016lx\n", off);
T_OUT("d_off.bin:");
for (unsigned j = 0; j < 8; ++j, ++i)
T_OUT(" 0x%02hhx", buf[i]);
T_OUT("\n");
short int reclen = *(short *)&buf[i];
T_OUT("d_reclen.txt: %hd\n", reclen);
T_OUT("d_reclen.bin:");
for (unsigned j = 0; j < 2; ++j, ++i)
T_OUT(" 0x%02hhx", buf[i]);
T_OUT("\n");
T_OUT("d_name.txt: \"%s\"\n", buf + i);
T_OUT("d_name.bin:");
for (int j = 0; j < reclen - 8 - 8 - 2; ++j, ++i)
T_OUT(" 0x%02hhx (%c)", buf[i],
isprint(buf[i]) ? buf[i] : '?');
T_OUT("\n");
T_OUT("-\n");
}
T_OUT("---\n");
}
static void
dump_linux_dirents64(void *dirp, unsigned length)
{
char *buf = (char *)dirp;
for (size_t i = 0; i < length;) {
long ino = *(long *)&buf[i];
T_OUT("d_ino.txt: 0x%016lx\n", ino);
T_OUT("d_ino.bin:");
for (int j = 0; j < 8; ++j, ++i)
T_OUT(" 0x%02hhx", buf[i]);
T_OUT("\n");
long off = *(long *)&buf[i];
T_OUT("d_off.txt: 0x%016lx\n", off);
T_OUT("d_off.bin:");
for (int j = 0; j < 8; ++j, ++i)
T_OUT(" 0x%02hhx", buf[i]);
T_OUT("\n");
short int reclen = *(short *)&buf[i];
T_OUT("d_reclen.txt: %hd\n", reclen);
T_OUT("d_reclen.bin:");
for (int j = 0; j < 2; ++j, ++i)
T_OUT(" 0x%02hhx", buf[i]);
T_OUT("\n");
char type = *(char *)&buf[i];
T_OUT("d_type.txt: %hhd\n", type);
T_OUT("d_type.bin:");
for (int j = 0; j < 1; ++j, ++i)
T_OUT(" 0x%02hhx", buf[i]);
T_OUT("\n");
T_OUT("d_name.txt: \"%s\"\n", buf + i);
T_OUT("d_name.bin:");
for (int j = 0; j < reclen - 8 - 8 - 2 - 1; ++j, ++i)
T_OUT(" 0x%02hhx (%c)", buf[i],
isprint(buf[i]) ? buf[i] : '?');
T_OUT("\n");
T_OUT("-\n");
}
T_OUT("---\n");
}
TEST_F(getdents, 1)
{
ASSERT_TRUE(test_pmemfile_create(pfp, "/file1", PMEMFILE_O_EXCL, 0644));
ASSERT_TRUE(test_pmemfile_create(pfp, "/file2with_long_name",
PMEMFILE_O_EXCL, 0644));
ASSERT_TRUE(test_pmemfile_create(
pfp, "/file3with_very_long_name"
"_1234567890_1234567890_1234567890_1234567890"
"_1234567890_1234567890_1234567890_1234567890"
"_1234567890_1234567890_1234567890_1234567890"
"_1234567890_1234567890_1234567890_1234567890"
"_1234567890_1234567890_1234567890_1234567890"
"_qwertyuiop",
PMEMFILE_O_EXCL, 0644));
ASSERT_TRUE(test_pmemfile_create(pfp, "/file4", PMEMFILE_O_EXCL, 0644));
PMEMfile *f = pmemfile_open(pfp, "/",
PMEMFILE_O_DIRECTORY | PMEMFILE_O_RDONLY);
ASSERT_NE(f, nullptr) << strerror(errno);
/* 4 entries in directory and '.' '..' */
pmemfile_off_t offset = pmemfile_lseek(pfp, f, 0, PMEMFILE_SEEK_END);
ASSERT_TRUE(offset == ((1LL << 32) + 4) || offset == INT64_MAX)
<< "offset is: " << offset;
ASSERT_EQ(pmemfile_lseek(pfp, f, 0, PMEMFILE_SEEK_SET), 0);
char buf[32758];
struct linux_dirent *dirents = (struct linux_dirent *)buf;
struct linux_dirent64 *dirents64 = (struct linux_dirent64 *)buf;
PMEMfile *regfile = pmemfile_open(pfp, "/file4", PMEMFILE_O_RDONLY);
errno = 0;
ASSERT_EQ(pmemfile_getdents(pfp, regfile, dirents, sizeof(buf)), -1);
EXPECT_EQ(errno, ENOTDIR);
pmemfile_close(pfp, regfile);
errno = 0;
ASSERT_EQ(pmemfile_getdents(pfp, f, NULL, sizeof(buf)), -1);
EXPECT_EQ(errno, EFAULT);
errno = 0;
ASSERT_EQ(pmemfile_getdents(pfp, NULL, dirents, sizeof(buf)), -1);
EXPECT_EQ(errno, EFAULT);
errno = 0;
ASSERT_EQ(pmemfile_getdents(NULL, f, dirents, sizeof(buf)), -1);
EXPECT_EQ(errno, EFAULT);
ASSERT_EQ(pmemfile_mkdir(pfp, "/dir1", 0755), 0);
PMEMfile *dir = pmemfile_open(pfp, "/dir1",
PMEMFILE_O_DIRECTORY | PMEMFILE_O_RDONLY);
ASSERT_NE(dir, nullptr) << strerror(errno);
errno = 0;
char *short_buf[1];
EXPECT_EQ(pmemfile_getdents(pfp, dir, (linux_dirent *)short_buf,
sizeof(short_buf)),
-1);
EXPECT_EQ(errno, EINVAL);
ASSERT_EQ(pmemfile_rmdir(pfp, "/dir1"), 0);
errno = 0;
EXPECT_EQ(pmemfile_getdents(pfp, dir, dirents, sizeof(buf)), -1);
EXPECT_EQ(errno, ENOENT);
pmemfile_close(pfp, dir);
int r = pmemfile_getdents(pfp, f, dirents, sizeof(buf));
ASSERT_GT(r, 0);
dump_linux_dirents(buf, (unsigned)r);
r = pmemfile_getdents(pfp, f, dirents, sizeof(buf));
ASSERT_EQ(r, 0);
pmemfile_off_t off = pmemfile_lseek(pfp, f, 0, PMEMFILE_SEEK_SET);
ASSERT_EQ(off, 0);
r = pmemfile_getdents64(pfp, f, dirents64, sizeof(buf));
ASSERT_GT(r, 0);
dump_linux_dirents64(buf, (unsigned)r);
r = pmemfile_getdents64(pfp, f, dirents64, sizeof(buf));
ASSERT_EQ(r, 0);
pmemfile_close(pfp, f);
ASSERT_EQ(pmemfile_unlink(pfp, "/file1"), 0);
ASSERT_EQ(pmemfile_unlink(pfp, "/file2with_long_name"), 0);
ASSERT_EQ(pmemfile_unlink(pfp,
"/file3with_very_long_name"
"_1234567890_1234567890_1234567890_1234567890"
"_1234567890_1234567890_1234567890_1234567890"
"_1234567890_1234567890_1234567890_1234567890"
"_1234567890_1234567890_1234567890_1234567890"
"_1234567890_1234567890_1234567890_1234567890"
"_qwertyuiop"),
0);
ASSERT_EQ(pmemfile_unlink(pfp, "/file4"), 0);
}
TEST_F(getdents, 2)
{
ASSERT_EQ(pmemfile_mkdir(pfp, "/dir1", 0755), 0);
PMEMfile *f = pmemfile_open(pfp, "/dir1",
PMEMFILE_O_DIRECTORY | PMEMFILE_O_RDONLY);
ASSERT_NE(f, nullptr) << strerror(errno);
char buf[32758];
struct linux_dirent *dirents = (struct linux_dirent *)buf;
struct linux_dirent64 *dirents64 = (struct linux_dirent64 *)buf;
int r = pmemfile_getdents(pfp, f, dirents, sizeof(buf));
ASSERT_GT(r, 0);
dump_linux_dirents(buf, (unsigned)r);
ASSERT_TRUE(test_pmemfile_create(pfp, "/dir1/file1", PMEMFILE_O_EXCL,
0644));
ASSERT_TRUE(test_pmemfile_create(pfp, "/dir1/file2", PMEMFILE_O_EXCL,
0644));
ASSERT_TRUE(test_pmemfile_create(pfp, "/dir1/file3", PMEMFILE_O_EXCL,
0644));
ASSERT_EQ(pmemfile_lseek(pfp, f, 0, PMEMFILE_SEEK_SET), 0);
r = pmemfile_getdents64(pfp, f, dirents64, sizeof(buf));
ASSERT_GT(r, 0);
dump_linux_dirents64(buf, (unsigned)r);
auto files = test_list_files(pfp, f, buf, (unsigned)r);
ASSERT_TRUE(test_compare_dirs(files, std::vector<pmemfile_ls>{
{040755, 2, 8192, "."},
{040777, 3, 8192, ".."},
{0100644, 1, 0, "file1"},
{0100644, 1, 0, "file2"},
{0100644, 1, 0, "file3"},
}));
pmemfile_close(pfp, f);
ASSERT_EQ(pmemfile_unlink(pfp, "/dir1/file1"), 0);
ASSERT_EQ(pmemfile_unlink(pfp, "/dir1/file2"), 0);
ASSERT_EQ(pmemfile_unlink(pfp, "/dir1/file3"), 0);
ASSERT_EQ(pmemfile_rmdir(pfp, "/dir1"), 0);
}
struct linux_dirent {
long ino;
off_t off;
unsigned short reclen;
char name[];
};
ssize_t
count_getdents_entries(PMEMfilepool *pfp, PMEMfile *dir)
{
char buf[32768];
int nread = -1;
linux_dirent *d;
ssize_t entries_found = 0;
while (nread != 0) {
nread = pmemfile_getdents(pfp, dir, (linux_dirent *)buf,
sizeof(buf));
if (nread == -1)
return -1;
for (int pos = 0; pos < nread;) {
d = (linux_dirent *)(buf + pos);
entries_found++;
pos += d->reclen;
}
}
return entries_found;
}
TEST_F(getdents, offset)
{
/* Create 50 files and 50 directories */
ssize_t file_dir_count = 50;
char path[1001];
PMEMfile *f = NULL;
ASSERT_TRUE(test_empty_dir(pfp, "/"));
memset(path, 0xff, sizeof(path));
for (ssize_t i = 0; i < file_dir_count; ++i) {
sprintf(path, "/file%04zu", i);
f = pmemfile_open(pfp, path, PMEMFILE_O_CREAT |
PMEMFILE_O_EXCL | PMEMFILE_O_WRONLY,
0644);
ASSERT_NE(f, nullptr) << strerror(errno);
pmemfile_close(pfp, f);
sprintf(path, "/dir%04zu", i);
ASSERT_EQ(pmemfile_mkdir(pfp, path, 0755), 0);
}
/* Open main directory */
f = pmemfile_open(pfp, "/", PMEMFILE_O_DIRECTORY | PMEMFILE_O_RDONLY);
ASSERT_NE(f, nullptr) << strerror(errno);
/*
* Verify that, when offset is different than 0, getdents will return
* some entries
*/
ASSERT_EQ(pmemfile_lseek(pfp, f, 1, PMEMFILE_SEEK_SET), 1);
ASSERT_GT(count_getdents_entries(pfp, f), 0);
/* Reset offset for getdents */
ASSERT_EQ(pmemfile_lseek(pfp, f, 0, PMEMFILE_SEEK_SET), 0);
/* Fill offsets vector */
std::vector<pmemfile_off_t> offsets;
offsets.push_back(0);
char buf[32768];
int nread = -1;
linux_dirent *d;
nread = -1;
while (nread != 0) {
nread = pmemfile_getdents(pfp, f, (linux_dirent *)buf,
sizeof(buf));
ASSERT_NE(nread, -1);
for (int pos = 0; pos < nread;) {
d = (linux_dirent *)(buf + pos);
offsets.push_back(d->off);
pos += d->reclen;
}
}
/*
* Check if lseek to end returned value is equal to
* last offset returned by getdents
*/
ASSERT_EQ(pmemfile_lseek(pfp, f, 0, PMEMFILE_SEEK_END), offsets.back());
offsets.push_back(INT64_MAX);
/*
* Run getdents with bigger offset and check if seeking with offset
* affects output from getdents - each getdents call should return
* one less entry, than previous one
*/
for (size_t i = 0; i < (size_t)file_dir_count * 2 + 2; i++) {
pmemfile_off_t offset =
pmemfile_lseek(pfp, f, offsets[i], PMEMFILE_SEEK_SET);
ASSERT_EQ(offset, offsets[i]);
ssize_t tofind = file_dir_count * 2 + 2 - (ssize_t)i;
ASSERT_EQ(count_getdents_entries(pfp, f), tofind);
}
/* Cleanup */
pmemfile_close(pfp, f);
for (ssize_t i = 0; i < file_dir_count; ++i) {
sprintf(path, "/file%04zu", i);
int ret = pmemfile_unlink(pfp, path);
ASSERT_EQ(ret, 0) << strerror(errno);
sprintf(path, "/dir%04zu", i);
ASSERT_EQ(pmemfile_rmdir(pfp, path), 0);
}
}
TEST_F(getdents, short_buffer)
{
PMEMfile *f = pmemfile_open(pfp, "/",
PMEMFILE_O_DIRECTORY | PMEMFILE_O_RDONLY);
ASSERT_NE(f, nullptr) << strerror(errno);
char buf[50];
for (int i = 0; i < 20; ++i) {
sprintf(buf, "/file%d", i);
ASSERT_TRUE(test_pmemfile_create(pfp, buf, 0, 0644));
}
struct linux_dirent *dirents = (struct linux_dirent *)buf;
int r = pmemfile_getdents(pfp, f, dirents, sizeof(buf));
ASSERT_GT(r, 0);
dump_linux_dirents(buf, (unsigned)r);
r = pmemfile_getdents(pfp, f, dirents, sizeof(buf));
ASSERT_GT(r, 0);
dump_linux_dirents(buf, (unsigned)r);
for (int i = 0; i < 20; ++i) {
sprintf(buf, "/file%d", i);
ASSERT_EQ(pmemfile_unlink(pfp, buf), 0);
}
pmemfile_close(pfp, f);
}
int
main(int argc, char *argv[])
{
START();
if (argc < 2) {
fprintf(stderr, "usage: %s global_path", argv[0]);
exit(1);
}
global_path = argv[1];
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
| 27.818792 | 74 | 0.663852 | krzycz |
17877985c8b81cb3ba56465f9a19c3ec7ab7893e | 2,923 | cpp | C++ | src/subcommand/panpos_main.cpp | mr-c/odgi | e6c702c607ff839c1f228d4940a26869d804f92a | [
"MIT"
] | null | null | null | src/subcommand/panpos_main.cpp | mr-c/odgi | e6c702c607ff839c1f228d4940a26869d804f92a | [
"MIT"
] | null | null | null | src/subcommand/panpos_main.cpp | mr-c/odgi | e6c702c607ff839c1f228d4940a26869d804f92a | [
"MIT"
] | null | null | null | #include "subcommand.hpp"
#include "args.hxx"
#include "algorithms/xp.hpp"
namespace odgi {
using namespace odgi::subcommand;
using namespace xp;
int main_panpos(int argc, char** argv) {
for (uint64_t i = 1; i < argc-1; ++i) {
argv[i] = argv[i+1];
}
const std::string prog_name = "odgi panpos";
argv[0] = (char*)prog_name.c_str();
--argc;
args::ArgumentParser parser("get the pangenome position of a given path and nucleotide position");
args::HelpFlag help(parser, "help", "display this help summary", {'h', "help"});
args::ValueFlag<std::string> dg_in_file(parser, "FILE", "load the index from this file", {'i', "idx"});
args::ValueFlag<std::string> path_name(parser, "PATH_NAME", "get the pangenome positon of this path", {'p', "path"});
args::ValueFlag<uint64_t> nuc_pos(parser, "NUC_POS", "get the pangenome position of this nucleotide position", {'n', "nuc_pos"});
try {
parser.ParseCLI(argc, argv);
} catch (args::Help) {
std::cout << parser;
return 0;
} catch (args::ParseError e) {
std::cerr << e.what() << std::endl;
std::cerr << parser;
return 1;
}
if (argc==1) {
std::cout << parser;
return 1;
}
if (!dg_in_file) {
std::cerr << "Please enter a file to read the index from." << std::endl;
exit(1);
}
if (!path_name) {
std::cerr << "Please enter a valid path name to extract the pangenome position from." << std::endl;
exit(1);
}
if (!nuc_pos) {
std::cerr << "Please enter a valid nucleotide position to extract the corresponding pangenome position from." << std::endl;
exit(1);
}
XP path_index;
std::ifstream in;
in.open(args::get(dg_in_file));
path_index.load(in);
in.close();
// we have a 0-based positioning
uint64_t nucleotide_pos = args::get(nuc_pos) - 1;
std::string p_name = args::get(path_name);
if (!path_index.has_path(p_name)) {
std::cerr << "The given path name " << p_name << " is not in the index." << std::endl;
exit(1);
}
if (!path_index.has_position(p_name, nucleotide_pos)) {
std::cerr << "The given path " << p_name << " with nucleotide position " << nuc_pos << " is not in the index." << std::endl;
exit(1);
}
size_t pangenome_pos = path_index.get_pangenome_pos(p_name, nucleotide_pos) + 1;
std::cout << pangenome_pos << std::endl;
return 0;
}
static Subcommand odgi_panpos("panpos",
"get the pangenome position for a given path and nucleotide position",
PIPELINE, 3, main_panpos);
}
| 34.797619 | 137 | 0.548067 | mr-c |
17879160c66cdaeb1fc0900083b9355dfd6d580c | 1,862 | hpp | C++ | src/ndnph/core/operators.hpp | Pesa/NDNph | 70b0b4ef90649cc923ab4bbbfbdb31efe027d4a8 | [
"0BSD"
] | 2 | 2020-03-06T02:07:21.000Z | 2021-12-29T04:53:58.000Z | src/ndnph/core/operators.hpp | Pesa/NDNph | 70b0b4ef90649cc923ab4bbbfbdb31efe027d4a8 | [
"0BSD"
] | null | null | null | src/ndnph/core/operators.hpp | Pesa/NDNph | 70b0b4ef90649cc923ab4bbbfbdb31efe027d4a8 | [
"0BSD"
] | 2 | 2020-02-26T20:31:07.000Z | 2021-04-22T18:27:19.000Z | #ifndef NDNPH_CORE_OPERATORS_HPP
#define NDNPH_CORE_OPERATORS_HPP
/** @brief Declare operator!= in terms of operator== */
#define NDNPH_DECLARE_NE(T, specifier) \
specifier bool operator!=(const T& lhs, const T& rhs) \
{ \
return !(lhs == rhs); \
}
/** @brief Declare operator>, operator<=, operator>= in terms of operator< */
#define NDNPH_DECLARE_GT_LE_GE(T, specifier) \
specifier bool operator>(const T& lhs, const T& rhs) \
{ \
return rhs < lhs; \
} \
specifier bool operator<=(const T& lhs, const T& rhs) \
{ \
return !(lhs > rhs); \
} \
specifier bool operator>=(const T& lhs, const T& rhs) \
{ \
return !(lhs < rhs); \
}
#endif // NDNPH_CORE_OPERATORS_HPP
| 68.962963 | 100 | 0.243287 | Pesa |
178c507178cd02e8052698a69397b7aedd4e417b | 18,805 | cpp | C++ | olp-cpp-sdk-dataservice-write/src/StreamLayerClientImpl.cpp | fermeise/here-data-sdk-cpp | e0ebd7bd74463fa3958eb0447b90227a4f322643 | [
"Apache-2.0"
] | null | null | null | olp-cpp-sdk-dataservice-write/src/StreamLayerClientImpl.cpp | fermeise/here-data-sdk-cpp | e0ebd7bd74463fa3958eb0447b90227a4f322643 | [
"Apache-2.0"
] | null | null | null | olp-cpp-sdk-dataservice-write/src/StreamLayerClientImpl.cpp | fermeise/here-data-sdk-cpp | e0ebd7bd74463fa3958eb0447b90227a4f322643 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright (C) 2019-2021 HERE Europe B.V.
*
* 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.
*
* SPDX-License-Identifier: Apache-2.0
* License-Filename: LICENSE
*/
#include "StreamLayerClientImpl.h"
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <olp/core/cache/KeyValueCache.h>
#include <olp/core/client/CancellationContext.h>
#include <olp/core/client/OlpClient.h>
#include <olp/core/client/PendingRequests.h>
#include <olp/core/client/TaskContext.h>
#include <olp/core/logging/Log.h>
#include <olp/core/thread/TaskScheduler.h>
#include <olp/dataservice/write/model/PublishDataRequest.h>
#include <olp/dataservice/write/model/PublishSdiiRequest.h>
#include "ApiClientLookup.h"
#include "generated/BlobApi.h"
#include "generated/ConfigApi.h"
#include "generated/IngestApi.h"
#include "generated/PublishApi.h"
// clang-format off
#include <generated/serializer/CatalogSerializer.h>
#include <generated/serializer/PublishDataRequestSerializer.h>
#include <generated/serializer/JsonSerializer.h>
// clang-format on
// clang-format off
#include <generated/parser/CatalogParser.h>
#include <generated/parser/PublishDataRequestParser.h>
#include "JsonResultParser.h"
// clang-format on
namespace olp {
namespace dataservice {
namespace write {
namespace {
constexpr auto kLogTag = "StreamLayerClientImpl";
constexpr int64_t kTwentyMib = 20971520; // 20 MiB
} // namespace
StreamLayerClientImpl::StreamLayerClientImpl(
client::HRN catalog, StreamLayerClientSettings client_settings,
client::OlpClientSettings settings)
: catalog_(catalog),
settings_(settings),
catalog_settings_(catalog, settings),
cache_(settings_.cache),
cache_mutex_(),
stream_client_settings_(std::move(client_settings)),
pending_requests_(std::make_shared<client::PendingRequests>()),
task_scheduler_(std::move(settings_.task_scheduler)) {}
StreamLayerClientImpl::~StreamLayerClientImpl() {
pending_requests_->CancelAllAndWait();
}
bool StreamLayerClientImpl::CancelPendingRequests() {
OLP_SDK_LOG_TRACE(kLogTag, "CancelPendingRequests");
return pending_requests_->CancelAll();
}
std::string StreamLayerClientImpl::GetUuidListKey() const {
static const std::string kStreamCachePostfix = "-stream-queue-cache";
const std::string uuid_list_key =
catalog_.ToCatalogHRNString() + kStreamCachePostfix;
return uuid_list_key;
}
size_t StreamLayerClientImpl::QueueSize() const {
std::lock_guard<std::mutex> lock(cache_mutex_);
const auto uuid_list_any =
cache_->Get(GetUuidListKey(), [](const std::string& s) { return s; });
std::string uuid_list = "";
if (!uuid_list_any.empty()) {
uuid_list = boost::any_cast<std::string>(uuid_list_any);
return std::count(uuid_list.cbegin(), uuid_list.cend(), ',');
}
return 0;
}
boost::optional<std::string> StreamLayerClientImpl::Queue(
const model::PublishDataRequest& request) {
if (!cache_) {
return boost::make_optional<std::string>(
"No cache provided to StreamLayerClient");
}
if (!request.GetData()) {
return boost::make_optional<std::string>(
"PublishDataRequest does not contain any Data");
}
if (request.GetLayerId().empty()) {
return boost::make_optional<std::string>(
"PublishDataRequest does not contain a Layer ID");
}
if (!(StreamLayerClientImpl::QueueSize() <
stream_client_settings_.maximum_requests)) {
return boost::make_optional<std::string>(
"Maximum number of requests has reached");
}
{
std::lock_guard<std::mutex> lock(cache_mutex_);
const auto publish_data_key = GenerateUuid();
cache_->Put(publish_data_key, request, [=]() {
return olp::serializer::serialize<model::PublishDataRequest>(request);
});
const auto uuid_list_any =
cache_->Get(GetUuidListKey(), [](const std::string& s) { return s; });
std::string uuid_list = "";
if (!uuid_list_any.empty()) {
uuid_list = boost::any_cast<std::string>(uuid_list_any);
}
uuid_list += publish_data_key + ",";
cache_->Put(GetUuidListKey(), uuid_list,
[&uuid_list]() { return uuid_list; });
}
return boost::none;
}
boost::optional<model::PublishDataRequest>
StreamLayerClientImpl::PopFromQueue() {
std::lock_guard<std::mutex> lock(cache_mutex_);
const auto uuid_list_any =
cache_->Get(GetUuidListKey(), [](const std::string& s) { return s; });
if (uuid_list_any.empty()) {
OLP_SDK_LOG_ERROR(kLogTag, "Unable to Restore UUID list from Cache");
return boost::none;
}
auto uuid_list = boost::any_cast<std::string>(uuid_list_any);
auto pos = uuid_list.find(",");
if (pos == std::string::npos) {
return boost::none;
}
const auto publish_data_key = uuid_list.substr(0, pos);
auto publish_data_any =
cache_->Get(publish_data_key, [](const std::string& s) {
return olp::parser::parse<model::PublishDataRequest>(s);
});
cache_->Remove(publish_data_key);
uuid_list.erase(0, pos + 1);
cache_->Put(GetUuidListKey(), uuid_list,
[&uuid_list]() { return uuid_list; });
if (publish_data_any.empty()) {
OLP_SDK_LOG_ERROR(kLogTag,
"Unable to Restore PublishData Request from Cache");
return boost::none;
}
return boost::any_cast<model::PublishDataRequest>(publish_data_any);
}
olp::client::CancellableFuture<StreamLayerClient::FlushResponse>
StreamLayerClientImpl::Flush(model::FlushRequest request) {
auto promise =
std::make_shared<std::promise<StreamLayerClient::FlushResponse>>();
auto cancel_token = Flush(
std::move(request), [promise](StreamLayerClient::FlushResponse response) {
promise->set_value(std::move(response));
});
return client::CancellableFuture<StreamLayerClient::FlushResponse>(
cancel_token, promise);
}
olp::client::CancellationToken StreamLayerClientImpl::Flush(
model::FlushRequest request, StreamLayerClient::FlushCallback callback) {
// Because TaskContext accepts the execution callbacks which return only
// ApiResponse object, we need to simulate the 'empty' response in order to
// be able to use Flush execution lambda in TaskContext.
struct EmptyFlushResponse {};
using EmptyFlushApiResponse =
client::ApiResponse<EmptyFlushResponse, client::ApiError>;
// this flag is required in order to protect the user from 2 `callback`
// invocation: one during execution phase and other when `Flush` is cancelled.
auto exec_started = std::make_shared<std::atomic_bool>(false);
auto task_context = client::TaskContext::Create(
[=](client::CancellationContext context) -> EmptyFlushApiResponse {
exec_started->exchange(true);
StreamLayerClient::FlushResponse responses;
const auto maximum_events_number = request.GetNumberOfRequestsToFlush();
if (maximum_events_number < 0) {
callback(std::move(responses));
return EmptyFlushApiResponse{};
}
int counter = 0;
while ((!maximum_events_number || counter < maximum_events_number) &&
(this->QueueSize() > 0) && !context.IsCancelled()) {
auto publish_request = this->PopFromQueue();
if (publish_request == boost::none) {
continue;
}
auto publish_response = PublishDataTask(*publish_request, context);
responses.emplace_back(std::move(publish_response));
// If cancelled queue back task
if (context.IsCancelled()) {
this->Queue(*publish_request);
break;
}
counter++;
}
OLP_SDK_LOG_INFO_F(kLogTag, "Flushed %d publish requests", counter);
callback(responses);
return EmptyFlushApiResponse{};
},
[=](EmptyFlushApiResponse /*response*/) {
// we don't need to notify user 2 times, cause we already invoke a
// callback in the execution function:
if (!exec_started->load()) {
callback(StreamLayerClient::FlushResponse{});
}
});
auto pending_requests = pending_requests_;
pending_requests->Insert(task_context);
thread::ExecuteOrSchedule(task_scheduler_, [=]() {
task_context.Execute();
pending_requests->Remove(task_context);
});
return task_context.CancelToken();
}
olp::client::CancellableFuture<PublishDataResponse>
StreamLayerClientImpl::PublishData(model::PublishDataRequest request) {
auto promise = std::make_shared<std::promise<PublishDataResponse>>();
auto cancel_token =
PublishData(std::move(request), [promise](PublishDataResponse response) {
promise->set_value(std::move(response));
});
return client::CancellableFuture<PublishDataResponse>(cancel_token, promise);
}
client::CancellationToken StreamLayerClientImpl::PublishData(
model::PublishDataRequest request, PublishDataCallback callback) {
if (!request.GetData()) {
callback(PublishDataResponse(client::ApiError(
client::ErrorCode::InvalidArgument, "Request's data is null.")));
return client::CancellationToken();
}
using std::placeholders::_1;
client::TaskContext task_context = olp::client::TaskContext::Create(
std::bind(&StreamLayerClientImpl::PublishDataTask, this, request, _1),
callback);
auto pending_requests = pending_requests_;
pending_requests->Insert(task_context);
thread::ExecuteOrSchedule(task_scheduler_, [=]() {
task_context.Execute();
pending_requests->Remove(task_context);
});
return task_context.CancelToken();
}
PublishDataResponse StreamLayerClientImpl::PublishDataTask(
model::PublishDataRequest request, client::CancellationContext context) {
const int64_t data_size = request.GetData()->size() * sizeof(unsigned char);
if (data_size <= kTwentyMib) {
return PublishDataLessThanTwentyMib(std::move(request), std::move(context));
} else {
return PublishDataGreaterThanTwentyMib(std::move(request),
std::move(context));
}
}
PublishDataResponse StreamLayerClientImpl::PublishDataLessThanTwentyMib(
model::PublishDataRequest request, client::CancellationContext context) {
OLP_SDK_LOG_TRACE_F(kLogTag,
"Started publishing data less than 20 MB, size=%zu B",
request.GetData()->size());
auto layer_settings_result = catalog_settings_.GetLayerSettings(
context, request.GetBillingTag(), request.GetLayerId());
if (!layer_settings_result.IsSuccessful()) {
return layer_settings_result.GetError();
}
const auto& layer_settings = layer_settings_result.GetResult();
if (layer_settings.content_type.empty()) {
return PublishDataResponse(client::ApiError(
client::ErrorCode::InvalidArgument,
"Unable to find the Layer ID=`" + request.GetLayerId() +
"` provided in the PublishDataRequest in the Catalog=" +
catalog_.ToString()));
}
auto ingest_api = ApiClientLookup::LookupApiClient(catalog_, context,
"ingest", "v1", settings_);
if (!ingest_api.IsSuccessful()) {
return PublishDataResponse(ingest_api.GetError());
}
auto ingest_api_client = ingest_api.GetResult();
auto ingest_data_response = IngestApi::IngestData(
ingest_api_client, request.GetLayerId(), layer_settings.content_type,
layer_settings.content_encoding, request.GetData(), request.GetTraceId(),
request.GetBillingTag(), request.GetChecksum(), context);
if (!ingest_data_response.IsSuccessful()) {
return ingest_data_response;
}
OLP_SDK_LOG_TRACE_F(
kLogTag,
"Successfully published data less than 20 MB, size=%zu B, trace_id=%s",
request.GetData()->size(),
ingest_data_response.GetResult().GetTraceID().c_str());
return ingest_data_response;
}
PublishDataResponse StreamLayerClientImpl::PublishDataGreaterThanTwentyMib(
model::PublishDataRequest request, client::CancellationContext context) {
OLP_SDK_LOG_TRACE_F(kLogTag,
"Started publishing data greater than 20MB, size=%zu B",
request.GetData()->size());
auto layer_settings_result = catalog_settings_.GetLayerSettings(
context, request.GetBillingTag(), request.GetLayerId());
if (!layer_settings_result.IsSuccessful()) {
return layer_settings_result.GetError();
}
const auto& layer_settings = layer_settings_result.GetResult();
if (layer_settings.content_type.empty()) {
return PublishDataResponse(client::ApiError(
client::ErrorCode::InvalidArgument,
"Unable to find the Layer ID=`" + request.GetLayerId() +
"` provided in the PublishDataRequest in the Catalog=" +
catalog_.ToString()));
}
// Init api clients for publications:
auto publish_client_response = ApiClientLookup::LookupApiClient(
catalog_, context, "publish", "v2", settings_);
if (!publish_client_response.IsSuccessful()) {
return PublishDataResponse(publish_client_response.GetError());
}
client::OlpClient publish_client = publish_client_response.MoveResult();
auto blob_client_response = ApiClientLookup::LookupApiClient(
catalog_, context, "blob", "v1", settings_);
if (!blob_client_response.IsSuccessful()) {
return PublishDataResponse(blob_client_response.GetError());
}
client::OlpClient blob_client = blob_client_response.MoveResult();
// 1. init publication:
model::Publication publication;
publication.SetLayerIds({request.GetLayerId()});
auto init_publicaion_response = PublishApi::InitPublication(
publish_client, publication, request.GetBillingTag(), context);
if (!init_publicaion_response.IsSuccessful()) {
return PublishDataResponse(init_publicaion_response.GetError());
}
if (!init_publicaion_response.GetResult().GetId()) {
return PublishDataResponse(
client::ApiError(client::ErrorCode::InvalidArgument,
"Response from server on InitPublication request "
"doesn't contain any publication"));
}
const std::string publication_id =
init_publicaion_response.GetResult().GetId().get();
// 2. Put blob API:
const auto data_handle = GenerateUuid();
auto put_blob_response = BlobApi::PutBlob(
blob_client, request.GetLayerId(), layer_settings.content_type,
layer_settings.content_encoding, data_handle, request.GetData(),
request.GetBillingTag(), context);
if (!put_blob_response.IsSuccessful()) {
return PublishDataResponse(put_blob_response.GetError());
}
// 3. Upload partition:
const auto partition_id =
request.GetTraceId() ? request.GetTraceId().value() : GenerateUuid();
model::PublishPartition publish_partition;
publish_partition.SetPartition(partition_id);
publish_partition.SetDataHandle(data_handle);
model::PublishPartitions partitions;
partitions.SetPartitions({publish_partition});
auto upload_partitions_response = PublishApi::UploadPartitions(
publish_client, partitions, publication_id, request.GetLayerId(),
request.GetBillingTag(), context);
if (!upload_partitions_response.IsSuccessful()) {
return PublishDataResponse(upload_partitions_response.GetError());
}
// 4. Sumbit publication:
auto submit_publication_response = PublishApi::SubmitPublication(
publish_client, publication_id, request.GetBillingTag(), context);
if (!submit_publication_response.IsSuccessful()) {
return PublishDataResponse(submit_publication_response.GetError());
}
// 5. final result on successful submit of publication:
model::ResponseOkSingle response_ok_single;
response_ok_single.SetTraceID(partition_id);
OLP_SDK_LOG_TRACE_F(
kLogTag,
"Successfully published data greater than 20 MB, size=%zu B, trace_id=%s",
request.GetData()->size(), partition_id.c_str());
return PublishDataResponse(response_ok_single);
}
client::CancellableFuture<PublishSdiiResponse>
StreamLayerClientImpl::PublishSdii(model::PublishSdiiRequest request) {
auto promise = std::make_shared<std::promise<PublishSdiiResponse>>();
auto cancel_token =
PublishSdii(std::move(request), [promise](PublishSdiiResponse response) {
promise->set_value(std::move(response));
});
return client::CancellableFuture<PublishSdiiResponse>(cancel_token, promise);
}
client::CancellationToken StreamLayerClientImpl::PublishSdii(
model::PublishSdiiRequest request, PublishSdiiCallback callback) {
using std::placeholders::_1;
auto context = olp::client::TaskContext::Create(
std::bind(&StreamLayerClientImpl::PublishSdiiTask, this,
std::move(request), _1),
callback);
auto pending_requests = pending_requests_;
pending_requests->Insert(context);
thread::ExecuteOrSchedule(task_scheduler_, [=]() {
context.Execute();
pending_requests->Remove(context);
});
return context.CancelToken();
}
PublishSdiiResponse StreamLayerClientImpl::PublishSdiiTask(
model::PublishSdiiRequest request,
olp::client::CancellationContext context) {
if (!request.GetSdiiMessageList()) {
return {{client::ErrorCode::InvalidArgument,
"Request sdii message list null."}};
}
if (request.GetLayerId().empty()) {
return {{client::ErrorCode::InvalidArgument, "Request layer id empty."}};
}
return IngestSdii(std::move(request), context);
}
PublishSdiiResponse StreamLayerClientImpl::IngestSdii(
model::PublishSdiiRequest request, client::CancellationContext context) {
auto api_response = ApiClientLookup::LookupApiClient(
catalog_, context, "ingest", "v1", settings_);
if (!api_response.IsSuccessful()) {
return api_response.GetError();
}
auto client = api_response.MoveResult();
return IngestApi::IngestSdii(client, request.GetLayerId(),
request.GetSdiiMessageList(),
request.GetTraceId(), request.GetBillingTag(),
request.GetChecksum(), context);
}
std::string StreamLayerClientImpl::GenerateUuid() const {
static boost::uuids::random_generator gen;
return boost::uuids::to_string(gen());
}
} // namespace write
} // namespace dataservice
} // namespace olp
| 35.548204 | 80 | 0.709279 | fermeise |
178d11f99a5ef3336e03d2f45e092b0edb54c4aa | 430 | hxx | C++ | inc/html5xx.d/Code.hxx | astrorigin/html5xx | cbaaeb232597a713630df7425752051036cf0cb2 | [
"MIT"
] | null | null | null | inc/html5xx.d/Code.hxx | astrorigin/html5xx | cbaaeb232597a713630df7425752051036cf0cb2 | [
"MIT"
] | null | null | null | inc/html5xx.d/Code.hxx | astrorigin/html5xx | cbaaeb232597a713630df7425752051036cf0cb2 | [
"MIT"
] | null | null | null | /*
*
*/
#ifndef _HTML5XX_CODE_HXX_
#define _HTML5XX_CODE_HXX_
#include "Element.hxx"
#include "TextElement.hxx"
using namespace std;
namespace html
{
class Code: public Element
{
public:
Code():
Element(Block, "code")
{}
Code( const string& text ):
Element(Block, "code")
{
put(new TextElement(text));
}
};
} // end namespace html
#endif // _HTML5XX_CODE_HXX_
// vi: set ai et sw=2 sts=2 ts=2 :
| 11.621622 | 34 | 0.646512 | astrorigin |
178ebadf3d45d24d8facc452f24a4115ddc2b6d9 | 823 | cpp | C++ | src/StreamUtil.cpp | gm-archive/Legacy-GM8Emulator | c0bb4bfd97583cfcd4d47e25b83366c4dbbe92f7 | [
"MIT"
] | 2 | 2020-05-03T04:43:17.000Z | 2022-03-27T14:59:34.000Z | src/StreamUtil.cpp | Adamcake/GM8Emulator | c0bb4bfd97583cfcd4d47e25b83366c4dbbe92f7 | [
"MIT"
] | null | null | null | src/StreamUtil.cpp | Adamcake/GM8Emulator | c0bb4bfd97583cfcd4d47e25b83366c4dbbe92f7 | [
"MIT"
] | 4 | 2020-05-02T19:40:32.000Z | 2021-12-12T00:47:45.000Z | #include "StreamUtil.hpp"
#include <stdlib.h>
#include <string.h>
unsigned int ReadDword(const unsigned char* pStream, unsigned int* pPos) {
unsigned int val = pStream[(*pPos)] + (pStream[(*pPos) + 1] << 8) + (pStream[(*pPos) + 2] << 16) + (pStream[(*pPos) + 3] << 24);
(*pPos) += 4;
return val;
}
double ReadDouble(const unsigned char* pStream, unsigned int* pPos) {
double val = *( double* )(pStream + (*pPos));
(*pPos) += 8;
return val;
}
char* ReadString(const unsigned char* pStream, unsigned int* pPos, unsigned int* pLen) {
unsigned int length = ReadDword(pStream, pPos);
char* str = ( char* )malloc(length + 1);
memcpy(str, (pStream + *pPos), length);
str[length] = '\0';
(*pPos) += length;
if (pLen != nullptr) {
(*pLen) = length;
}
return str;
}
| 29.392857 | 132 | 0.594168 | gm-archive |
178f4173e07e3ad1f892aba589908f1340714a25 | 2,553 | hpp | C++ | Mesh.hpp | fossabot/Veritas-1 | 57d8574f170bb65149f1f704d97b9eed13be5d91 | [
"MIT"
] | 7 | 2016-09-09T22:23:08.000Z | 2019-03-01T07:21:21.000Z | Mesh.hpp | fossabot/Veritas-1 | 57d8574f170bb65149f1f704d97b9eed13be5d91 | [
"MIT"
] | 2 | 2018-08-19T21:53:58.000Z | 2018-08-23T20:55:52.000Z | Mesh.hpp | fossabot/Veritas-1 | 57d8574f170bb65149f1f704d97b9eed13be5d91 | [
"MIT"
] | 1 | 2018-08-23T20:31:26.000Z | 2018-08-23T20:31:26.000Z | #ifndef __Mesh_hpp__
#define __Mesh_hpp__
class Mesh {
std::vector<level> hierarchy;
Settings &settings;
std::shared_ptr<EMFieldSolver> EMSolver;
std::shared_ptr<Rectangle> bc;
public:
int particleType;
std::vector<std::unique_ptr<Level>> levels;
Mesh(int particleType, Settings &settings);
void PushData(int val=1);
void Advance(double timeStep, int step);
void InterpolateRhoAndJToFinestMesh(std::vector<double> &charge, std::vector<double> &J);
void InterpolateEnergyToFinestMesh(std::vector<double> &energy);
void SetUpVlasovPoisson(int i);
void SetFieldSolver(const std::shared_ptr<EMFieldSolver> &solver);
void updateHierarchy(bool init=false);
bool static choose_second(const coords &lhs, const coords &rhs);
bool static choose_first(const coords &lhs, const coords &rhs);
int sgn(int &x);
void printRectangle(rect &r);
void printRectangle(rect &r, int level);
int countCells(const rect &span);
void isFlaggedInside(std::vector<coords> &flagged, std::vector<bool> &isInside, rect &r);
void getSigs(rect &rectangle, std::vector<coords> &flagged, std::vector<int> &sigX, std::vector<int> &sigP);
std::tuple<std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int> > computeSignatures(rect &rectangle, std::vector<coords> &flagged);
coords identifyInflection(rect &rectangle, std::tuple<std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int> > &signatures);
std::tuple<bool, int, int> hasHole(std::vector<int> &sig);
level splitRectangle(rect &rectangle, std::vector<coords> &flagged, const double &minEfficiency);
void getError(const int &lvl, bool init, std::vector<coords> &flaggedCells);
void interpRectanglesUp(level &identified, const int &lvl);
void mergeDownFlaggedData(const int &lvl, const rect &r, std::vector<coords> &foundCells);
void getExtrema(rect &extrema, const std::vector<coords> &flaggedCells);
void outputRectangleData(double tidx);
inline double getNe(double xp,double tempp0,double plasma_xl_bound,double plasma_xr_bound);
void promoteHierarchyToMesh(bool init);
void InterMeshDataTransfer(const std::vector<std::unique_ptr<Level>> &levels_n);
void PushBoundaryC();
};
#pragma omp declare simd simdlen(8)
inline double Mesh::getNe(double xp,double tempp0,double plasma_xl_bound,double plasma_xr_bound) {
double ne=0.0;
if ((xp > plasma_xl_bound)&&(xp < plasma_xr_bound)) {
ne = tempp0;
}
return ne;
}
#endif /* __Mesh_hpp__ */
| 48.169811 | 153 | 0.719154 | fossabot |
179024b13e96f04345bd225f8fbc24dc36f936e5 | 4,513 | cpp | C++ | pose_refinement/SA-LMPE/ba/openMVG/graph/triplet_finder_test.cpp | Aurelio93/satellite-pose-estimation | 46957a9bc9f204d468f8fe3150593b3db0f0726a | [
"MIT"
] | 90 | 2019-05-19T03:48:23.000Z | 2022-02-02T15:20:49.000Z | pose_refinement/SA-LMPE/ba/openMVG/graph/triplet_finder_test.cpp | Aurelio93/satellite-pose-estimation | 46957a9bc9f204d468f8fe3150593b3db0f0726a | [
"MIT"
] | 11 | 2019-05-22T07:45:46.000Z | 2021-05-20T01:48:26.000Z | pose_refinement/SA-LMPE/ba/openMVG/graph/triplet_finder_test.cpp | Aurelio93/satellite-pose-estimation | 46957a9bc9f204d468f8fe3150593b3db0f0726a | [
"MIT"
] | 18 | 2019-05-19T03:48:32.000Z | 2021-05-29T18:19:16.000Z | // This file is part of OpenMVG, an Open Multiple View Geometry C++ library.
// Copyright (c) 2012, 2013 Pierre MOULON.
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include "openMVG/graph/triplet_finder.hpp"
#include "CppUnitLite/TestHarness.h"
#include "testing/testing.h"
#include <iostream>
#include <vector>
using namespace openMVG::graph;
using Pairs = std::vector<std::pair<int,int>>;
TEST(TripletFinder, test_no_triplet) {
// a - b - c
const int a = 0, b = 1, c = 2;
const Pairs pairs = {{a, b}, {b, c}};
std::vector<Triplet> vec_triplets;
EXPECT_FALSE(ListTriplets(pairs, vec_triplets));
EXPECT_TRUE(vec_triplets.empty());
}
TEST(TripletFinder, test_one_triplet) {
{
//
// a_b
// |/
// c
const int a = 0, b = 1, c = 2;
const Pairs pairs = {{a, b}, {a, c}, {b, c}};
std::vector<Triplet> vec_triplets;
EXPECT_TRUE(ListTriplets(pairs, vec_triplets));
EXPECT_EQ(1, vec_triplets.size());
//Check the cycle values
EXPECT_EQ(0, vec_triplets[0].i);
EXPECT_EQ(1, vec_triplets[0].j);
EXPECT_EQ(2, vec_triplets[0].k);
}
{
//
// a_b__c
// |/
// d
const int a = 0, b = 1, c = 2, d = 3;
const Pairs pairs = {{a, b}, {b, c}, {b, d}, {c, d}};
std::vector<Triplet> vec_triplets;
EXPECT_TRUE(ListTriplets(pairs, vec_triplets));
EXPECT_EQ(1, vec_triplets.size());
//Check the cycle values
EXPECT_EQ(1,vec_triplets[0].i);
EXPECT_EQ(2,vec_triplets[0].j);
EXPECT_EQ(3,vec_triplets[0].k);
}
}
TEST(TripletFinder, test_two_triplet) {
{
//
// a__b
// |\ |
// | \|
// c--d
const int a = 0, b = 1, c = 2, d = 3;
const Pairs pairs = {{a, b}, {a, c}, {a, d}, {c, d}, {b,d}};
std::vector<Triplet> vec_triplets;
EXPECT_TRUE(ListTriplets(pairs, vec_triplets));
EXPECT_EQ(2, vec_triplets.size());
}
{
//
// a c
// |\ /|
// | b |
// |/ \|
// d e
const int a = 0, b = 1, c = 2, d = 3, e = 4;
const Pairs pairs = {{a, b}, {b,c}, {c,e}, {e,b}, {b,d}, {d,a}};
std::vector<Triplet> vec_triplets;
EXPECT_TRUE(ListTriplets(pairs, vec_triplets));
EXPECT_EQ(2, vec_triplets.size());
}
{
//
// a c
// |\ /|
// | b--f |
// |/ \|
// d e
const int a = 0, b = 1, c = 2, d = 3, e = 4, f = 5;
const Pairs pairs = {{a,b}, {b,f}, {f,c}, {c,e}, {e,f}, {f,b}, {b,d}, {d,a}};
std::vector<Triplet> vec_triplets;
EXPECT_TRUE(ListTriplets(pairs, vec_triplets));
EXPECT_EQ(2, vec_triplets.size());
}
}
TEST(TripletFinder, test_three_triplet) {
{
//
// a b
// |\ /|
// c-d-e
// |/
// f
const int a = 0, b = 1, c = 2, d = 3, e = 4, f = 5;
const Pairs pairs = { {a,c}, {a,d}, {c,d}, {c,f}, {f,d}, {d,b}, {b,e}, {e,d} };
std::vector<Triplet> vec_triplets;
EXPECT_TRUE(ListTriplets(pairs, vec_triplets));
EXPECT_EQ(3, vec_triplets.size());
}
{
//
// a b--g--h
// | \ / | \/
// | d--e | i
// | / \ |
// c f
const int a = 0, b = 1, c = 2, d = 3, e = 4, f = 5, g = 6, h = 7, i = 8;
const Pairs pairs = {
{a,c}, {a,d}, {d,c},
{d,e},
{e,b}, {e,f}, {b,f},
{b,g},
{g,h}, {h,i}, {i,g} };
std::vector<Triplet> vec_triplets;
EXPECT_TRUE(ListTriplets(pairs, vec_triplets));
EXPECT_EQ(3, vec_triplets.size());
}
{
//
// a---b
// |\ |\
// | \ | \
// | \| \
// c---d---e
//
const int a = 0, b = 1, c = 2, d = 3, e = 4;
const Pairs pairs = { {a,b}, {b,d}, {d,c}, {c,a}, {a,d}, {b,e}, {d,e} };
std::vector<Triplet> vec_triplets;
EXPECT_TRUE(ListTriplets(pairs, vec_triplets));
EXPECT_EQ(3, vec_triplets.size());
}
}
TEST(TripletFinder, test_for_triplet) {
{
//
// a__b
// |\/|
// |/\|
// c--d
const int a = 0, b = 1, c = 2, d = 3;
const Pairs pairs = { {a,b}, {a,c}, {a,d}, {c,d}, {b,d}, {c,b} };
std::vector<Triplet> vec_triplets;
EXPECT_TRUE(ListTriplets(pairs, vec_triplets));
EXPECT_EQ(4, vec_triplets.size());
}
}
/* ************************************************************************* */
int main() { TestResult tr; return TestRegistry::runAllTests(tr);}
/* ************************************************************************* */
| 23.38342 | 83 | 0.499003 | Aurelio93 |
1793237b51c5618f0590419a0982373f6b7ca7aa | 25 | cpp | C++ | Examples/Stopwatch/Precompile.cpp | malord/WndLib | 16541ea251229fcc282b0934ea7a39f2bc869681 | [
"Zlib"
] | 3 | 2018-09-03T15:18:03.000Z | 2022-03-26T21:04:25.000Z | Examples/Stopwatch/Precompile.cpp | malord/WndLib | 16541ea251229fcc282b0934ea7a39f2bc869681 | [
"Zlib"
] | null | null | null | Examples/Stopwatch/Precompile.cpp | malord/WndLib | 16541ea251229fcc282b0934ea7a39f2bc869681 | [
"Zlib"
] | null | null | null | #include "Precompile.h"
| 12.5 | 24 | 0.72 | malord |
17956c8d436b4db062a273254cb1a979205712e1 | 2,564 | hxx | C++ | vtkm/filter/ZFPDecompressor1D.hxx | yisyuanliou/VTK-m | cc483c8c2319a78b58b3ab849da8ca448e896220 | [
"BSD-3-Clause"
] | 1 | 2021-07-21T07:15:44.000Z | 2021-07-21T07:15:44.000Z | vtkm/filter/ZFPDecompressor1D.hxx | yisyuanliou/VTK-m | cc483c8c2319a78b58b3ab849da8ca448e896220 | [
"BSD-3-Clause"
] | null | null | null | vtkm/filter/ZFPDecompressor1D.hxx | yisyuanliou/VTK-m | cc483c8c2319a78b58b3ab849da8ca448e896220 | [
"BSD-3-Clause"
] | null | null | null | //============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtk_m_filter_ZFPDecompressor1D_hxx
#define vtk_m_filter_ZFPDecompressor1D_hxx
#include <vtkm/cont/CellSetStructured.h>
#include <vtkm/cont/DynamicCellSet.h>
#include <vtkm/cont/ErrorFilterExecution.h>
namespace vtkm
{
namespace filter
{
//-----------------------------------------------------------------------------
inline VTKM_CONT ZFPDecompressor1D::ZFPDecompressor1D()
: vtkm::filter::FilterField<ZFPDecompressor1D>()
{
}
//-----------------------------------------------------------------------------
template <typename T, typename StorageType, typename DerivedPolicy>
inline VTKM_CONT vtkm::cont::DataSet ZFPDecompressor1D::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<T, StorageType>&,
const vtkm::filter::FieldMetadata&,
const vtkm::filter::PolicyBase<DerivedPolicy>&)
{
VTKM_ASSERT(true);
vtkm::cont::DataSet ds;
return ds;
}
//-----------------------------------------------------------------------------
template <typename StorageType, typename DerivedPolicy>
inline VTKM_CONT vtkm::cont::DataSet ZFPDecompressor1D::DoExecute(
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Int64, StorageType>& field,
const vtkm::filter::FieldMetadata&,
const vtkm::filter::PolicyBase<DerivedPolicy>&)
{
vtkm::cont::ArrayHandle<vtkm::Float64> decompress;
decompressor.Decompress(field, decompress, rate, field.GetNumberOfValues());
vtkm::cont::DataSet dataset;
dataset.AddField(vtkm::cont::make_FieldPoint("decompressed", decompress));
return dataset;
}
//-----------------------------------------------------------------------------
template <typename T, typename StorageType, typename DerivedPolicy>
inline VTKM_CONT bool ZFPDecompressor1D::DoMapField(vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<T, StorageType>&,
const vtkm::filter::FieldMetadata&,
const vtkm::filter::PolicyBase<DerivedPolicy>&)
{
return false;
}
}
} // namespace vtkm::filter
#endif
| 37.15942 | 99 | 0.578783 | yisyuanliou |
17981d08659c133b730b6935bef4c8c6b968f02b | 10,451 | cpp | C++ | FFmpegServer/FFmpegScreenCaptureFromAndroid/src/Engine/InputManager.cpp | aalekhm/OpenFF | 9df23a21727f29a871f7239ccf15e3100ae9780e | [
"MIT"
] | null | null | null | FFmpegServer/FFmpegScreenCaptureFromAndroid/src/Engine/InputManager.cpp | aalekhm/OpenFF | 9df23a21727f29a871f7239ccf15e3100ae9780e | [
"MIT"
] | null | null | null | FFmpegServer/FFmpegScreenCaptureFromAndroid/src/Engine/InputManager.cpp | aalekhm/OpenFF | 9df23a21727f29a871f7239ccf15e3100ae9780e | [
"MIT"
] | null | null | null | #include "Engine/InputManager.h"
#include "GLFW/glfw3.h"
#include "Common/Defines.h"
#define ANDROID_KEYCODE_A 29
#define ANDROID_KEYCODE_0 7
#define ANDROID_KEY_CAPS_LOCK 1048576
#define ANDROID_KEY_NUM_LOCK 2097152
#define ANDROID_KEY_SCROLL_LOCK 4194304
#define ANDROID_KEYCODE_LEFT_BRACKET 71
#define ANDROID_KEYCODE_RIGHT_BRACKET 72
#define ANDROID_KEYCODE_BACKSLASH 73
#define ANDROID_KEYCODE_SEMICOLON 74
#define ANDROID_KEYCODE_APOSTROPHE 75
#define ANDROID_KEYCODE_COMMA 55
#define ANDROID_KEYCODE_PERIOD 56
#define ANDROID_KEYCODE_SLASH 76
#define ANDROID_KEYCODE_MINUS 69
#define ANDROID_KEYCODE_EQUALS 70
#define ANDROID_KEYCODE_DEL 67
#define ANDROID_KEYCODE_FORWARD_DEL 112
#define ANDROID_KEYCODE_STAR 17
#define ANDROID_KEYCODE_PLUS 81
#define ANDROID_KEYCODE_ENTER 66
#define ANDROID_KEYCODE_POWER 26
#define ANDROID_KEYCODE_SPACE 62
bool InputManager::isKeyPressed(int32_t iKey)
{
return m_KeyboardBits.test(iKey);
}
bool InputManager::isMousePressed(int32_t iKey)
{
return m_MouseBits.test(iKey);
}
void InputManager::getMousePos(double& xPos, double& yPos)
{
xPos = m_dMouseX;
yPos = m_dMouseY;
}
double InputManager::getMouseX()
{
return m_dMouseX;
}
double InputManager::getMouseY()
{
return m_dMouseY;
}
bool InputManager::isNumLock()
{
return m_AndroidMetaBits.test(21); // ANDROID_KEY_NUM_LOCK
}
int32_t InputManager::mapToAndroidKeyCode(int32_t iAsciiKeyCode)
{
int iOffset = 0;
if(iAsciiKeyCode >= 'A' && iAsciiKeyCode <= 'Z')
{
iOffset = 'A' - ANDROID_KEYCODE_A;
return (iAsciiKeyCode - iOffset);
}
if (iAsciiKeyCode >= '0' && iAsciiKeyCode <= '9')
{
iOffset = '0' - ANDROID_KEYCODE_0;
return (iAsciiKeyCode - iOffset);
}
if (iAsciiKeyCode == '[') return ANDROID_KEYCODE_LEFT_BRACKET;
if (iAsciiKeyCode == ']') return ANDROID_KEYCODE_RIGHT_BRACKET;
if (iAsciiKeyCode == '\\') return ANDROID_KEYCODE_BACKSLASH;
if (iAsciiKeyCode == ';') return ANDROID_KEYCODE_SEMICOLON;
if (iAsciiKeyCode == '\'') return ANDROID_KEYCODE_APOSTROPHE;
if (iAsciiKeyCode == ',') return ANDROID_KEYCODE_COMMA;
if (iAsciiKeyCode == '.') return ANDROID_KEYCODE_PERIOD;
if (iAsciiKeyCode == '/') return ANDROID_KEYCODE_SLASH;
if (iAsciiKeyCode == '-') return ANDROID_KEYCODE_MINUS;
if (iAsciiKeyCode == '=') return ANDROID_KEYCODE_EQUALS;
if (iAsciiKeyCode == GLFW_KEY_BACKSPACE) return ANDROID_KEYCODE_DEL;
if (iAsciiKeyCode == GLFW_KEY_DELETE) return ANDROID_KEYCODE_FORWARD_DEL;
if (iAsciiKeyCode == GLFW_KEY_KP_0) return isNumLock() ? ANDROID_KEYCODE_0 + 0 : -1;
if (iAsciiKeyCode == GLFW_KEY_KP_1) return isNumLock() ? ANDROID_KEYCODE_0 + 1 : -1;
if (iAsciiKeyCode == GLFW_KEY_KP_2) return isNumLock() ? ANDROID_KEYCODE_0 + 2 : -1;
if (iAsciiKeyCode == GLFW_KEY_KP_3) return isNumLock() ? ANDROID_KEYCODE_0 + 3 : -1;
if (iAsciiKeyCode == GLFW_KEY_KP_4) return isNumLock() ? ANDROID_KEYCODE_0 + 4 : -1;
if (iAsciiKeyCode == GLFW_KEY_KP_5) return isNumLock() ? ANDROID_KEYCODE_0 + 5 : -1;
if (iAsciiKeyCode == GLFW_KEY_KP_6) return isNumLock() ? ANDROID_KEYCODE_0 + 6 : -1;
if (iAsciiKeyCode == GLFW_KEY_KP_7) return isNumLock() ? ANDROID_KEYCODE_0 + 7 : -1;
if (iAsciiKeyCode == GLFW_KEY_KP_8) return isNumLock() ? ANDROID_KEYCODE_0 + 8 : -1;
if (iAsciiKeyCode == GLFW_KEY_KP_9) return isNumLock() ? ANDROID_KEYCODE_0 + 9 : -1;
if (iAsciiKeyCode == GLFW_KEY_KP_DECIMAL) return isNumLock() ? ANDROID_KEYCODE_PERIOD: ANDROID_KEYCODE_FORWARD_DEL;
if (iAsciiKeyCode == GLFW_KEY_KP_DIVIDE) return ANDROID_KEYCODE_SLASH;
if (iAsciiKeyCode == GLFW_KEY_KP_MULTIPLY) return ANDROID_KEYCODE_STAR;
if (iAsciiKeyCode == GLFW_KEY_KP_SUBTRACT) return ANDROID_KEYCODE_MINUS;
if (iAsciiKeyCode == GLFW_KEY_KP_ADD) return ANDROID_KEYCODE_PLUS;
if (iAsciiKeyCode == GLFW_KEY_KP_ENTER
||
iAsciiKeyCode == GLFW_KEY_ENTER) return ANDROID_KEYCODE_ENTER;
if (iAsciiKeyCode == GLFW_KEY_TAB) return ANDROID_KEYCODE_POWER;
if (iAsciiKeyCode == GLFW_KEY_SPACE) return ANDROID_KEYCODE_SPACE;
return -1;
}
bool InputManager::alterAndroidExtraMetaModifiers(bool bSet, int32_t iAsciiKeyCode)
{
int32_t iAndroidMetaKey = 0;
int32_t iBit = 0;
if (iAsciiKeyCode == GLFW_KEY_CAPS_LOCK)
{
iAndroidMetaKey = ANDROID_KEY_CAPS_LOCK;
iBit = 20;
}
if (iAsciiKeyCode == GLFW_KEY_SCROLL_LOCK)
{
iAndroidMetaKey = ANDROID_KEY_SCROLL_LOCK;
iBit = 22;
}
if (iAsciiKeyCode == GLFW_KEY_NUM_LOCK)
{
iAndroidMetaKey = ANDROID_KEY_NUM_LOCK;
iBit = 21;
}
if (bSet && iBit > 0)
{
bool bIsBitSet = m_AndroidMetaBits.test(iBit);
m_AndroidMetaBits.set(iBit, bIsBitSet ? 0 : 1);
return true;
}
return false;
}
bool InputManager::alterAndroidMetaModifiers(bool bSet, int32_t iAsciiKeyCode)
{
int32_t iAndroidMetaKey = 0;
int32_t iBit = 0;
if(NOT alterAndroidExtraMetaModifiers(bSet, iAsciiKeyCode))
{
if (iAsciiKeyCode == GLFW_KEY_LEFT_SHIFT)
{
iAndroidMetaKey = 64;
iBit = 6;
}
if (iAsciiKeyCode == GLFW_KEY_RIGHT_SHIFT)
{
iAndroidMetaKey = 128;
iBit = 7;
}
if (iAsciiKeyCode == GLFW_KEY_LEFT_CONTROL)
{
iAndroidMetaKey = 8192;
iBit = 13;
}
if (iAsciiKeyCode == GLFW_KEY_RIGHT_CONTROL)
{
iAndroidMetaKey = 16384;
iBit = 14;
}
if (iAsciiKeyCode == GLFW_KEY_LEFT_ALT)
{
iAndroidMetaKey = 16;
iBit = 4;
}
if (iAsciiKeyCode == GLFW_KEY_RIGHT_ALT)
{
iAndroidMetaKey = 32;
iBit = 5;
}
m_AndroidMetaBits.set(iBit, bSet ? 1 : 0);
//LOG_CONSOLE("B = " << iBit << " == " << (1 << iBit));
//LOG_CONSOLE("M = " << m_AndroidMetaBits << " == " << m_AndroidMetaBits.to_ulong());
}
return (iBit > 0);
}
void InputManager::onKeyPressed(uint32_t iKey)
{
m_KeyboardBits.set(iKey, 1);
for (auto fCallback : m_fKeyboardCallbackList)
{
(*fCallback)(GLFW_PRESS, iKey);
}
if (NOT alterAndroidMetaModifiers(true, iKey))
{
int32_t iAndroidKeyCode = mapToAndroidKeyCode(iKey);
for (auto fCallback : m_fAndroidKeyboardCallbackList)
{
(*fCallback)(GLFW_PRESS, iAndroidKeyCode, m_AndroidMetaBits.to_ulong());
}
}
// META_SHIFT_ON 1 (0x00000001)
//if(iKey == GLFW_KEY_LEFT_SHIFT)
// META_SHIFT_LEFT_ON 64 (0x00000040)
// 59
//if (iKey == GLFW_KEY_RIGHT_SHIFT)
// META_SHIFT_RIGHT_ON 128 (0x00000080)
// 60
//
//
// META_CTRL_ON 4096 (0x00001000)
//GLFW_KEY_LEFT_CONTROL
// META_CTRL_LEFT_ON 8192 (0x00002000)
// 113
//GLFW_KEY_RIGHT_CONTROL
// META_CTRL_RIGHT_ON 16384 (0x00004000)
// 114
//
// META_ALT_ON 2 (0x00000002)
//GLFW_KEY_LEFT_ALT
// META_ALT_LEFT_ON 16 (0x00000010)
//GLFW_KEY_RIGHT_ALT
// META_ALT_RIGHT_ON 32 (0x00000020)
//
//
// META_SYM_ON 4 (0x00000004)
//
// META_FUNCTION_ON 8 (0x00000008)
//
//
// //This mask is used to check whether one of the META meta keys is pressed.
// META_META_ON 65536 (0x00010000)
// META_META_RIGHT_ON 262144 (0x00040000)
// META_META_LEFT_ON 131072 (0x00020000)
//
// GLFW_KEY_CAPS_LOCK
// META_CAPS_LOCK_ON 1048576 (0x00100000)
//
// GLFW_KEY_SCROLL_LOCK
// META_SCROLL_LOCK_ON 4194304 (0x00400000)
//
// GLFW_KEY_NUM_LOCK
// META_NUM_LOCK_ON 2097152 (0x00200000)
//GLFW_KEY_LEFT_SUPER
//GLFW_KEY_RIGHT_SUPER
//
//GLFW_KEY_CAPS_LOCK
//GLFW_KEY_SCROLL_LOCK
//GLFW_KEY_NUM_LOCK
}
void InputManager::onKeyReleased(uint32_t iKey)
{
m_KeyboardBits.reset(iKey);
for (auto fCallback : m_fKeyboardCallbackList)
{
(*fCallback)(GLFW_RELEASE, iKey);
}
if (NOT alterAndroidMetaModifiers(false, iKey))
{
int32_t iAndroidKeyCode = mapToAndroidKeyCode(iKey);
for (auto fCallback : m_fAndroidKeyboardCallbackList)
{
(*fCallback)(GLFW_RELEASE, iAndroidKeyCode, m_AndroidMetaBits.to_ulong());
}
}
}
void InputManager::onMousePressed(uint32_t iKey)
{
m_MouseBits.set(iKey, 1);
for (auto fCallback : m_fMouseCallbackList)
{
(*fCallback)(GLFW_PRESS, iKey, m_dMouseX, m_dMouseY);
}
}
void InputManager::onMouseReleased(uint32_t iKey)
{
m_MouseBits.reset(iKey);
for (auto fCallback : m_fMouseCallbackList)
{
(*fCallback)(GLFW_RELEASE, iKey, m_dMouseX, m_dMouseY);
}
}
void InputManager::onMouseMoved(double xPos, double yPos)
{
m_dMouseX = xPos;
m_dMouseY = yPos;
for (auto fCallback : m_fMouseCallbackList)
{
(*fCallback)(GLFW_REPEAT, m_MouseBits.to_ulong(), m_dMouseX, m_dMouseY);
}
}
void InputManager::addMouseListener(MOUSE_FUNC_CALLBACK* fMouseCallback)
{
if (isMouseListenerInList(fMouseCallback) >= 0)
{
m_fMouseCallbackList.push_back(fMouseCallback);
}
}
void InputManager::removeMouseListener(MOUSE_FUNC_CALLBACK* fMouseCallback)
{
int32_t iPos = isMouseListenerInList(fMouseCallback);
if (iPos >= 0)
{
m_fMouseCallbackList.erase(m_fMouseCallbackList.begin() + iPos);
}
}
bool InputManager::isMouseListenerInList(MOUSE_FUNC_CALLBACK* fMouseCallback)
{
int32_t iPos = -1;
for (auto fCallback : m_fMouseCallbackList)
{
iPos++;
if (fCallback == fMouseCallback)
{
iPos;
}
}
return -1;
}
void InputManager::addKeyboardListener(KEY_FUNC_CALLBACK* fKeyboardCallback)
{
if (isKeyboardListenerInList(fKeyboardCallback) >= 0)
{
m_fKeyboardCallbackList.push_back(fKeyboardCallback);
}
}
void InputManager::removeKeyboardListener(KEY_FUNC_CALLBACK* fKeyboardCallback)
{
int32_t iPos = isKeyboardListenerInList(fKeyboardCallback);
if (iPos >= 0)
{
m_fKeyboardCallbackList.erase(m_fKeyboardCallbackList.begin() + iPos);
}
}
void InputManager::addAndroidKeyboardListener(ANDROID_KEY_FUNC_CALLBACK* fAndroidKeyboardCallback)
{
if (isAndroidKeyboardListenerInList(fAndroidKeyboardCallback) >= 0)
{
m_fAndroidKeyboardCallbackList.push_back(fAndroidKeyboardCallback);
}
}
void InputManager::removeAndroidKeyboardListener(ANDROID_KEY_FUNC_CALLBACK* fAndroidKeyboardCallback)
{
int32_t iPos = isAndroidKeyboardListenerInList(fAndroidKeyboardCallback);
if (iPos >= 0)
{
m_fAndroidKeyboardCallbackList.erase(m_fAndroidKeyboardCallbackList.begin() + iPos);
}
}
bool InputManager::isKeyboardListenerInList(KEY_FUNC_CALLBACK* fKeyboardCallback)
{
int32_t iPos = -1;
for (auto fCallback : m_fKeyboardCallbackList)
{
iPos++;
if (fCallback == fKeyboardCallback)
{
iPos;
}
}
return -1;
}
bool InputManager::isAndroidKeyboardListenerInList(ANDROID_KEY_FUNC_CALLBACK* fAndroidKeyboardCallback)
{
int32_t iPos = -1;
for (auto fCallback : m_fAndroidKeyboardCallbackList)
{
iPos++;
if (fCallback == fAndroidKeyboardCallback)
{
iPos;
}
}
return -1;
} | 24.883333 | 117 | 0.737633 | aalekhm |
1798defc82f233f79277bcdaabc40110541b0899 | 6,245 | cpp | C++ | GenericCardReaderFriend/GenericCardReaderFriend.cpp | 0xFireWolf/GenericCardReaderFriend | c835c62c81ff06c8c788096a24eb19bc4ff5e05d | [
"BSD-3-Clause"
] | 8 | 2021-07-26T04:20:50.000Z | 2022-01-14T11:11:47.000Z | GenericCardReaderFriend/GenericCardReaderFriend.cpp | 0xFireWolf/GenericCardReaderFriend | c835c62c81ff06c8c788096a24eb19bc4ff5e05d | [
"BSD-3-Clause"
] | 3 | 2021-07-30T00:44:49.000Z | 2021-12-03T13:40:34.000Z | GenericCardReaderFriend/GenericCardReaderFriend.cpp | 0xFireWolf/GenericCardReaderFriend | c835c62c81ff06c8c788096a24eb19bc4ff5e05d | [
"BSD-3-Clause"
] | 1 | 2022-01-18T13:26:35.000Z | 2022-01-18T13:26:35.000Z | //
// GenericCardReaderFriend.cpp
// GenericCardReaderFriend
//
// Created by FireWolf on 7/24/21.
//
#include <Headers/plugin_start.hpp>
#include <Headers/kern_api.hpp>
#include <Headers/kern_user.hpp>
//
// MARK: - Constants & Patches
//
static const char* kCardReaderReporterPath = "/System/Library/SystemProfiler/SPCardReaderReporter.spreporter";
static const size_t kCardReaderReporterPathLength = strlen(kCardReaderReporterPath);
// MARK: USB-based Card Reader
// Function: SPCardReaderReporter::updateDictionary()
// Find: IOServiceMatching("com_apple_driver_AppleUSBCardReaderSBC")
// Repl: IOServiceMatching("GenericUSBCardReaderController")
// Note: Patch the name of the controller class
static const uint8_t kAppleUSBCardReaderSBC[] =
{
0x63, 0x6F, 0x6D, // "com"
0x5F, // "_"
0x61, 0x70, 0x70, 0x6C, 0x65, // "apple"
0x5F, // "_"
0x64, 0x72, 0x69, 0x76, 0x65, 0x72, // "driver"
0x5F, // "_"
0x41, 0x70, 0x70, 0x6C, 0x65, // "Apple"
0x55, 0x53, 0x42, // "USB"
0x43, 0x61, 0x72, 0x64, // "Card"
0x52, 0x65, 0x61, 0x64, 0x65, 0x72, // "Reader"
0x53, 0x42, 0x43, // "SBC"
0x00 // "\0"
};
static const uint8_t kGenericUSBCardReaderController[] =
{
0x47, 0x65, 0x6e, 0x65, 0x72, 0x69, 0x63,
0x55, 0x53, 0x42,
0x43, 0x61, 0x72, 0x64,
0x52, 0x65, 0x61, 0x64, 0x65, 0x72,
0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
// Function: SPCardReaderReporter::updateDictionary()
// Find: IORegistryEntrySearchCFProperty(entry, "IOService", kCFBundleIdentifierKey, kCFAllocatorDefault, kIORegistryIterateRecursively)
// NSString isEqualToString("com.apple.driver.AppleUSBCardReader")
// Repl: NSString isEqualToString("science.firewolf.gcrf")
// Note: Patch the bundle identifier
static const uint8_t kAppleUCRBundleIdentifier[] =
{
0x63, 0x6F, 0x6D, // "com"
0x2E, // "."
0x61, 0x70, 0x70, 0x6C, 0x65, // "apple"
0x2E, // "."
0x64, 0x72, 0x69, 0x76, 0x65, 0x72, // "driver"
0x2E, // "."
0x41, 0x70, 0x70, 0x6C, 0x65, // "Apple"
0x55, 0x53, 0x42, // "USB"
0x43, 0x61, 0x72, 0x64, // "Card"
0x52, 0x65, 0x61, 0x64, 0x65, 0x72, // "Reader"
0x00 // "\0"
};
static const uint8_t kDummyUCRBundleIdentifier[] =
{
0x73, 0x63, 0x69, 0x65, 0x6E, 0x63, 0x65,
0x2E,
0x66, 0x69, 0x72, 0x65, 0x77, 0x6F, 0x6C, 0x66,
0x2E,
0x67, 0x63, 0x72, 0x66,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00,
};
//
// MARK: - Helper Functions
//
static inline bool matchReporterPath(const char* path)
{
return strncmp(path, kCardReaderReporterPath, kCardReaderReporterPathLength) == 0;
}
static void patchReporter(const void* data, vm_size_t size)
{
void* memory = const_cast<void*>(data);
SYSLOG_COND(UNLIKELY(KernelPatcher::findAndReplace(memory, size, kAppleUSBCardReaderSBC, kGenericUSBCardReaderController)), "GCRF", "Patched the USB controller name.");
SYSLOG_COND(UNLIKELY(KernelPatcher::findAndReplace(memory, size, kAppleUCRBundleIdentifier, kDummyUCRBundleIdentifier)), "GCRF", "Patched the USB bundle identifier.");
}
//
// MARK: - Routed Functions
//
// macOS Catalina and earlier
static boolean_t (*orgCSValidateRange)(vnode_t, memory_object_t, memory_object_offset_t, const void*, vm_size_t, unsigned int*) = nullptr;
static boolean_t wrapCSValidateRange(vnode_t vp, memory_object_t pager, memory_object_offset_t offset, const void* data, vm_size_t size, unsigned int* result)
{
char path[PATH_MAX];
int pathlen = PATH_MAX;
boolean_t retVal = (*orgCSValidateRange)(vp, pager, offset, data, size, result);
if (retVal && vn_getpath(vp, path, &pathlen) == 0 && matchReporterPath(path))
{
patchReporter(data, size);
}
return retVal;
}
// macOS Big Sur and later
static void (*orgCSValidatePage)(vnode_t, memory_object_t, memory_object_offset_t, const void*, int*, int*, int*) = nullptr;
static void wrapCSValidatePage(vnode_t vp, memory_object_t pager, memory_object_offset_t page_offset, const void* data, int* validated_p, int* tainted_p, int* nx_p)
{
char path[PATH_MAX];
int pathlen = PATH_MAX;
(*orgCSValidatePage)(vp, pager, page_offset, data, validated_p, tainted_p, nx_p);
if (vn_getpath(vp, path, &pathlen) == 0 && matchReporterPath(path))
{
patchReporter(data, PAGE_SIZE);
}
}
//
// MARK: - Boot Args
//
static const char *bootargOff[] =
{
"-gcrfoff"
};
static const char *bootargDebug[] =
{
"-gcrfdbg"
};
static const char *bootargBeta[] =
{
"-gcrfbeta"
};
//
// MARK: - Plugin Start Routine
//
static KernelPatcher::RouteRequest gRequestLegacy =
{
"_cs_validate_range",
wrapCSValidateRange,
orgCSValidateRange
};
static KernelPatcher::RouteRequest gRequestCurrent =
{
"_cs_validate_page",
wrapCSValidatePage,
orgCSValidatePage
};
static void start()
{
DBGLOG("GCRF", "Realtek card reader friend started.");
auto action = [](void*, KernelPatcher& patcher) -> void
{
KernelPatcher::RouteRequest* request = getKernelVersion() >= KernelVersion::BigSur ? &gRequestCurrent : &gRequestLegacy;
if (!patcher.routeMultipleLong(KernelPatcher::KernelID, request, 1))
{
SYSLOG("GCRF", "Failed to route the function.");
}
};
lilu.onPatcherLoadForce(action);
}
//
// MARK: - Plugin Configuration
//
PluginConfiguration ADDPR(config) =
{
xStringify(PRODUCT_NAME),
parseModuleVersion(xStringify(MODULE_VERSION)),
LiluAPI::AllowNormal,
bootargOff,
arrsize(bootargOff),
bootargDebug,
arrsize(bootargDebug),
bootargBeta,
arrsize(bootargBeta),
KernelVersion::ElCapitan,
KernelVersion::Monterey,
start
};
| 29.046512 | 172 | 0.63779 | 0xFireWolf |
17a2a53a5a1d802aa6a3cdaf70d9d47bd9b0b224 | 1,725 | hpp | C++ | src/integrator/host/util.hpp | ValeevGroup/GauXC | cbc377c191e1159540d8ed923338cb849ae090ee | [
"BSD-3-Clause-LBNL"
] | null | null | null | src/integrator/host/util.hpp | ValeevGroup/GauXC | cbc377c191e1159540d8ed923338cb849ae090ee | [
"BSD-3-Clause-LBNL"
] | null | null | null | src/integrator/host/util.hpp | ValeevGroup/GauXC | cbc377c191e1159540d8ed923338cb849ae090ee | [
"BSD-3-Clause-LBNL"
] | null | null | null | #pragma once
#include "blas.hpp"
#include <vector>
#include <tuple>
#include <cstdint>
namespace GauXC {
namespace detail {
template <typename _F1, typename _F2>
void submat_set(int32_t M, int32_t N, int32_t MSub,
int32_t NSub, _F1 *ABig, int32_t LDAB, _F2 *ASmall,
int32_t LDAS,
std::vector<std::pair<int32_t,int32_t>> &submat_map) {
(void)(M);
(void)(N);
(void)(MSub);
(void)(NSub);
int32_t i(0);
for( auto& iCut : submat_map ) {
int32_t deltaI = iCut.second - iCut.first;
int32_t j(0);
for( auto& jCut : submat_map ) {
int32_t deltaJ = jCut.second - jCut.first;
auto* ABig_use = ABig + iCut.first + jCut.first * LDAB;
auto* ASmall_use = ASmall + i + j * LDAS;
GauXC::blas::lacpy( 'A', deltaI, deltaJ, ABig_use, LDAB,
ASmall_use, LDAS );
j += deltaJ;
}
i += deltaI;
}
}
template <typename _F1, typename _F2>
void inc_by_submat(int32_t M, int32_t N, int32_t MSub,
int32_t NSub, _F1 *ABig, int32_t LDAB, _F2 *ASmall,
int32_t LDAS,
std::vector<std::pair<int32_t,int32_t>> &submat_map) {
(void)(M);
(void)(N);
(void)(MSub);
(void)(NSub);
int32_t i(0);
for( auto& iCut : submat_map ) {
int32_t deltaI = iCut.second - iCut.first;
int32_t j(0);
for( auto& jCut : submat_map ) {
int32_t deltaJ = jCut.second - jCut.first;
auto* ABig_use = ABig + iCut.first + jCut.first * LDAB;
auto* ASmall_use = ASmall + i + j * LDAS;
for( int32_t jj = 0; jj < deltaJ; ++jj )
for( int32_t ii = 0; ii < deltaI; ++ii )
ABig_use[ ii + jj * LDAB ] += ASmall_use[ ii + jj * LDAS ];
j += deltaJ;
}
i += deltaI;
}
}
}
}
| 21.296296 | 65 | 0.582029 | ValeevGroup |
17a3e9e75297b70532c4c69306614a7d6eb3a059 | 16,817 | cc | C++ | stratum/hal/lib/phal/fixed_layout_datasource_test.cc | aweimeow/stratum | c59318e43ddc1572c04f3e7b0d2a4d0e0c243ae4 | [
"Apache-2.0"
] | null | null | null | stratum/hal/lib/phal/fixed_layout_datasource_test.cc | aweimeow/stratum | c59318e43ddc1572c04f3e7b0d2a4d0e0c243ae4 | [
"Apache-2.0"
] | null | null | null | stratum/hal/lib/phal/fixed_layout_datasource_test.cc | aweimeow/stratum | c59318e43ddc1572c04f3e7b0d2a4d0e0c243ae4 | [
"Apache-2.0"
] | 1 | 2019-12-02T01:18:10.000Z | 2019-12-02T01:18:10.000Z | // Copyright 2018 Google LLC
// Copyright 2018-present Open Networking Foundation
//
// 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 "stratum/hal/lib/phal/fixed_layout_datasource.h"
#include <ctime>
#include "stratum/glue/status/status_test_util.h"
#include "stratum/hal/lib/phal/fixed_stringsource.h"
#include "stratum/hal/lib/phal/test/test.pb.h"
#include "stratum/hal/lib/phal/test_util.h"
#include "stratum/lib/test_utils/matchers.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/memory/memory.h"
namespace stratum {
namespace hal {
namespace phal {
namespace {
const std::string kTestBody{// NOLINT
0x01, 0x02, 0x03, 0x04, 0x01, 0x02,
0x00, 0xFF, 't', 'e', 's', 't',
0b11001100, 0x01, 0x02, 0x03};
TEST(FixedLayoutCreationTest, CanCreateLayoutWithAllFieldTypes) {
std::map<std::string, FixedLayoutField*> fields{
{"int32", new TypedField<int32>(0, 1)},
{"int64", new TypedField<int64>(1, 1)},
{"uint32", new TypedField<uint32>(2, 1)},
{"uint64", new TypedField<uint64>(3, 1)},
{"test_string", new TypedField<std::string>(4, 4)},
{"bit", new BitmapBooleanField(8, 0)},
{"enum", new EnumField(9, TopEnum_descriptor(), {{0, TopEnum::ZERO}})},
{"valid", new ValidationByteField(10, {0x01}, "invalid!")},
{"double", new FloatingField<double>(11, 1, true, 0.5)}};
auto stringsource = absl::make_unique<FixedStringSource>(kTestBody);
std::shared_ptr<FixedLayoutDataSource> datasource =
FixedLayoutDataSource::Make(std::move(stringsource), fields,
new NoCache());
EXPECT_TRUE(datasource != nullptr);
}
TEST(FixedLayoutCreationTest, UpdateFailsIfBufferTooSmall) {
std::map<std::string, FixedLayoutField*> fields = {
{"test_string", new TypedField<std::string>(4, 4)}};
auto stringsource = absl::make_unique<FixedStringSource>("short");
std::shared_ptr<FixedLayoutDataSource> datasource =
FixedLayoutDataSource::Make(std::move(stringsource), fields,
new NoCache());
EXPECT_FALSE(datasource->UpdateValues().ok());
}
class FixedLayoutTest : public ::testing::Test {
protected:
void SetUp() override {
stringsource_ = absl::make_unique<FixedStringSource>(kTestBody);
// Set the time zone to UTC.
tzname[0] = tzname[1] = const_cast<char*>("GMT");
timezone = 0;
daylight = 0;
setenv("TZ", "UTC", 1);
}
std::unique_ptr<StringSourceInterface> stringsource_;
std::shared_ptr<FixedLayoutDataSource> datasource_;
};
TEST_F(FixedLayoutTest, CanReadInt32Byte) {
std::map<std::string, FixedLayoutField*> fields = {
{"int32", new TypedField<int32>(0, 1)},
};
datasource_ = FixedLayoutDataSource::Make(std::move(stringsource_), fields,
new NoCache());
EXPECT_OK(datasource_->UpdateValues());
EXPECT_THAT(datasource_->GetAttribute("int32"),
IsOkAndContainsValue<int32>(1));
}
TEST_F(FixedLayoutTest, CanReadInt64Byte) {
std::map<std::string, FixedLayoutField*> fields = {
{"int64", new TypedField<int64>(1, 1)},
};
datasource_ = FixedLayoutDataSource::Make(std::move(stringsource_), fields,
new NoCache());
EXPECT_OK(datasource_->UpdateValues());
EXPECT_THAT(datasource_->GetAttribute("int64"),
IsOkAndContainsValue<int64>(2));
}
TEST_F(FixedLayoutTest, CanReadUInt32Byte) {
std::map<std::string, FixedLayoutField*> fields = {
{"uint32", new TypedField<uint32>(2, 1)},
};
datasource_ = FixedLayoutDataSource::Make(std::move(stringsource_), fields,
new NoCache());
EXPECT_OK(datasource_->UpdateValues());
EXPECT_THAT(datasource_->GetAttribute("uint32"),
IsOkAndContainsValue<uint32>(3));
}
TEST_F(FixedLayoutTest, CanReadUInt64Byte) {
std::map<std::string, FixedLayoutField*> fields = {
{"uint64", new TypedField<uint64>(3, 1)},
};
datasource_ = FixedLayoutDataSource::Make(std::move(stringsource_), fields,
new NoCache());
EXPECT_OK(datasource_->UpdateValues());
EXPECT_THAT(datasource_->GetAttribute("uint64"),
IsOkAndContainsValue<uint64>(4));
}
TEST_F(FixedLayoutTest, CanReadInt32MultiByte) {
std::map<std::string, FixedLayoutField*> fields = {
{"int32", new TypedField<int32>(4, 4)},
};
datasource_ = FixedLayoutDataSource::Make(std::move(stringsource_), fields,
new NoCache());
EXPECT_OK(datasource_->UpdateValues());
EXPECT_THAT(datasource_->GetAttribute("int32"),
IsOkAndContainsValue<int32>(0x010200FF));
}
TEST_F(FixedLayoutTest, CanReadLittleEndianInt32) {
std::map<std::string, FixedLayoutField*> fields = {
{"int32", new TypedField<int32>(4, 4, true)},
{"int24", new TypedField<int32>(4, 3, true)},
};
datasource_ = FixedLayoutDataSource::Make(std::move(stringsource_), fields,
new NoCache());
EXPECT_OK(datasource_->UpdateValues());
EXPECT_THAT(datasource_->GetAttribute("int32"),
IsOkAndContainsValue<int32>(0xFF000201));
EXPECT_THAT(datasource_->GetAttribute("int24"),
IsOkAndContainsValue<int32>(0x201));
}
TEST_F(FixedLayoutTest, CanReadStringField) {
std::map<std::string, FixedLayoutField*> fields = {
{"test_string", new TypedField<std::string>(8, 4)},
};
datasource_ = FixedLayoutDataSource::Make(std::move(stringsource_), fields,
new NoCache());
EXPECT_OK(datasource_->UpdateValues());
EXPECT_THAT(datasource_->GetAttribute("test_string"),
IsOkAndContainsValue<std::string>("test"));
}
TEST_F(FixedLayoutTest, CanReadLittleEndianStringField) {
std::map<std::string, FixedLayoutField*> fields = {
{"test_string", new TypedField<std::string>(8, 4, true)},
};
datasource_ = FixedLayoutDataSource::Make(std::move(stringsource_), fields,
new NoCache());
EXPECT_OK(datasource_->UpdateValues());
EXPECT_THAT(datasource_->GetAttribute("test_string"),
IsOkAndContainsValue<std::string>("tset"));
}
TEST_F(FixedLayoutTest, CanReadFloatByte) {
std::map<std::string, FixedLayoutField*> fields = {
{"float", new FloatingField<float>(0, 1, true, 1)},
};
datasource_ = FixedLayoutDataSource::Make(std::move(stringsource_), fields,
new NoCache());
EXPECT_OK(datasource_->UpdateValues());
EXPECT_THAT(datasource_->GetAttribute("float"),
IsOkAndContainsValue<float>(1));
}
TEST_F(FixedLayoutTest, CanReadScaledMultibyteFloat) {
std::map<std::string, FixedLayoutField*> fields = {
{"float", new FloatingField<float>(0, 2, true, 0.25)},
};
datasource_ = FixedLayoutDataSource::Make(std::move(stringsource_), fields,
new NoCache());
EXPECT_OK(datasource_->UpdateValues());
// 0x0102 = 258, and 258 / 4 = 64.5
EXPECT_THAT(datasource_->GetAttribute("float"),
IsOkAndContainsValue<float>(64.5));
}
TEST_F(FixedLayoutTest, CanReadScaledMultibyteDouble) {
std::map<std::string, FixedLayoutField*> fields = {
{"double", new FloatingField<double>(0, 2, true, 0.25)},
};
datasource_ = FixedLayoutDataSource::Make(std::move(stringsource_), fields,
new NoCache());
EXPECT_OK(datasource_->UpdateValues());
// 0x0102 = 258, and 258 / 4 = 64.5
EXPECT_THAT(datasource_->GetAttribute("double"),
IsOkAndContainsValue<double>(64.5));
}
TEST_F(FixedLayoutTest, CanReadCleanedStringField) {
std::string test_body{'t', 'e', 's', 't', 0x01, '!', ' ', ' '};
auto stringsource = absl::make_unique<FixedStringSource>(test_body);
std::map<std::string, FixedLayoutField*> fields = {
{"test_string", new CleanedStringField(0, 8)},
};
datasource_ = FixedLayoutDataSource::Make(std::move(stringsource), fields,
new NoCache());
EXPECT_OK(datasource_->UpdateValues());
EXPECT_THAT(datasource_->GetAttribute("test_string"),
IsOkAndContainsValue<std::string>("test*!"));
}
TEST_F(FixedLayoutTest, CanReadUnsignedBitField) {
std::map<std::string, FixedLayoutField*> fields = {
{"zero_bit", new UnsignedBitField(12, 5, 1)}, // bit 5 is 0
{"one_bit", new UnsignedBitField(12, 6, 1)}, // bit 6 is 1
{"multi_bit", new UnsignedBitField(12, 5, 2)}, // bits 6-5, i.e. 0x10
};
datasource_ = FixedLayoutDataSource::Make(std::move(stringsource_), fields,
new NoCache());
EXPECT_OK(datasource_->UpdateValues());
EXPECT_THAT(datasource_->GetAttribute("zero_bit"),
IsOkAndContainsValue<uint32>(0));
EXPECT_THAT(datasource_->GetAttribute("one_bit"),
IsOkAndContainsValue<uint32>(1));
EXPECT_THAT(datasource_->GetAttribute("multi_bit"),
IsOkAndContainsValue<uint32>(2));
}
TEST_F(FixedLayoutTest, CanReadBitmapBooleanField) {
std::map<std::string, FixedLayoutField*> fields = {
{"bit7", new BitmapBooleanField(12, 7)},
{"bit6", new BitmapBooleanField(12, 6)},
{"bit5", new BitmapBooleanField(12, 5)},
{"bit4", new BitmapBooleanField(12, 4)},
{"bit3", new BitmapBooleanField(12, 3)},
{"bit2", new BitmapBooleanField(12, 2)},
{"bit1", new BitmapBooleanField(12, 1)},
{"bit0", new BitmapBooleanField(12, 0)},
};
datasource_ = FixedLayoutDataSource::Make(std::move(stringsource_), fields,
new NoCache());
EXPECT_OK(datasource_->UpdateValues());
// Byte is 0b11001100.
EXPECT_THAT(datasource_->GetAttribute("bit7"),
IsOkAndContainsValue<bool>(true));
EXPECT_THAT(datasource_->GetAttribute("bit6"),
IsOkAndContainsValue<bool>(true));
EXPECT_THAT(datasource_->GetAttribute("bit5"),
IsOkAndContainsValue<bool>(false));
EXPECT_THAT(datasource_->GetAttribute("bit4"),
IsOkAndContainsValue<bool>(false));
EXPECT_THAT(datasource_->GetAttribute("bit3"),
IsOkAndContainsValue<bool>(true));
EXPECT_THAT(datasource_->GetAttribute("bit2"),
IsOkAndContainsValue<bool>(true));
EXPECT_THAT(datasource_->GetAttribute("bit1"),
IsOkAndContainsValue<bool>(false));
EXPECT_THAT(datasource_->GetAttribute("bit0"),
IsOkAndContainsValue<bool>(false));
}
TEST_F(FixedLayoutTest, CanCheckValidationByte) {
std::map<std::string, FixedLayoutField*> fields = {
{"validation", new ValidationByteField(0, {0x01}, "should be valid")}};
datasource_ = FixedLayoutDataSource::Make(std::move(stringsource_), fields,
new NoCache());
EXPECT_OK(datasource_->UpdateValues());
}
TEST_F(FixedLayoutTest, CanCheckValidationByteWithMultiplePossible) {
std::map<std::string, FixedLayoutField*> fields = {
{"validation", new ValidationByteField(2, {0x01, 0x02, 0x03, 0x04},
"should be valid")}};
datasource_ = FixedLayoutDataSource::Make(std::move(stringsource_), fields,
new NoCache());
EXPECT_OK(datasource_->UpdateValues());
}
TEST_F(FixedLayoutTest, ValidationByteCanFail) {
std::map<std::string, FixedLayoutField*> fields = {
{"validation",
new ValidationByteField(0, {0x02, 0x03, 0x04}, "error expected!")}};
datasource_ = FixedLayoutDataSource::Make(std::move(stringsource_), fields,
new NoCache());
EXPECT_FALSE(datasource_->UpdateValues().ok());
}
TEST_F(FixedLayoutTest, MultipleValidationBytesCanFail) {
std::map<std::string, FixedLayoutField*> fields = {
{"validation1",
new ValidationByteField(0, {0x01, 0x02, 0x03, 0x04}, "should be valid")},
{"validation2",
new ValidationByteField(1, {0x01, 0x02, 0x03, 0x04}, "should be valid")},
{"validation3",
new ValidationByteField(2, {0x01, 0x02, 0x04}, "error expected!")}};
datasource_ = FixedLayoutDataSource::Make(std::move(stringsource_), fields,
new NoCache());
EXPECT_FALSE(datasource_->UpdateValues().ok());
}
TEST_F(FixedLayoutTest, CanReadTimestampField) {
std::string test_body = "100107";
auto stringsource = absl::make_unique<FixedStringSource>(test_body);
std::map<std::string, FixedLayoutField*> fields = {
{"timestamp", new TimestampField(0, 6, "%y%m%d")}};
datasource_ = FixedLayoutDataSource::Make(std::move(stringsource), fields,
new NoCache());
ASSERT_OK(datasource_->UpdateValues());
EXPECT_THAT(datasource_->GetAttribute("timestamp"),
IsOkAndContainsValue<uint32>(1262822400));
}
TEST_F(FixedLayoutTest, CannotReadInvalidTimestampField) {
std::string test_body = "no timestamp here!";
auto stringsource = absl::make_unique<FixedStringSource>(test_body);
std::map<std::string, FixedLayoutField*> fields = {
{"timestamp", new TimestampField(0, 6, "%y%m%d")}};
datasource_ = FixedLayoutDataSource::Make(std::move(stringsource), fields,
new NoCache());
EXPECT_FALSE(datasource_->UpdateValues().ok());
}
TEST_F(FixedLayoutTest, CanReadEnumField) {
std::map<char, int> enum_map{{0, TopEnum::ZERO},
{1, TopEnum::ONE},
{2, TopEnum::TWO},
{3, TopEnum::THREE}};
std::map<std::string, FixedLayoutField*> fields = {
{"enum1", new EnumField(13, TopEnum_descriptor(), enum_map)},
{"enum2", new EnumField(14, TopEnum_descriptor(), enum_map)},
{"enum3", new EnumField(15, TopEnum_descriptor(), enum_map)}};
datasource_ = FixedLayoutDataSource::Make(std::move(stringsource_), fields,
new NoCache());
EXPECT_OK(datasource_->UpdateValues());
EXPECT_THAT(
datasource_->GetAttribute("enum1"),
IsOkAndContainsValue(TopEnum_descriptor()->FindValueByName("ONE")));
EXPECT_THAT(
datasource_->GetAttribute("enum2"),
IsOkAndContainsValue(TopEnum_descriptor()->FindValueByName("TWO")));
EXPECT_THAT(
datasource_->GetAttribute("enum3"),
IsOkAndContainsValue(TopEnum_descriptor()->FindValueByName("THREE")));
}
TEST(SingleFixedLayoutTest, CannotReadInvalidEnum) {
std::string test_body{0x01, 0x02, 0xAB};
std::map<char, int> enum_map{{0, TopEnum::ZERO},
{1, TopEnum::ONE},
{2, TopEnum::TWO},
{3, TopEnum::THREE}};
std::map<std::string, FixedLayoutField*> fields = {
{"enum1", new EnumField(0, TopEnum_descriptor(), enum_map)},
{"enum2", new EnumField(1, TopEnum_descriptor(), enum_map)},
{"enum3", new EnumField(2, TopEnum_descriptor(), enum_map)}};
auto stringsource = absl::make_unique<FixedStringSource>(test_body);
std::shared_ptr<FixedLayoutDataSource> datasource =
FixedLayoutDataSource::Make(std::move(stringsource), fields,
new NoCache());
EXPECT_FALSE(datasource->UpdateValues().ok());
}
TEST(SingleFixedLayoutTest, CanReadEnumFieldWithDefault) {
std::string test_body{0x01};
std::map<char, int> enum_map{
{0, TopEnum::ZERO},
};
std::map<std::string, FixedLayoutField*> fields = {
{"enum", new EnumField(0, TopEnum_descriptor(), enum_map, true,
TopEnum::TWO)} // Set TWO as default.
};
auto stringsource = absl::make_unique<FixedStringSource>(test_body);
std::shared_ptr<FixedLayoutDataSource> datasource =
FixedLayoutDataSource::Make(std::move(stringsource), fields,
new NoCache());
EXPECT_OK(datasource->UpdateValues());
EXPECT_THAT(
datasource->GetAttribute("enum"),
IsOkAndContainsValue(TopEnum_descriptor()->FindValueByName("TWO")));
}
} // namespace
} // namespace phal
} // namespace hal
} // namespace stratum
| 42.360202 | 80 | 0.640007 | aweimeow |
17a4237a6f3e854b2476d24f62f1781ea3e1b0aa | 1,116 | cpp | C++ | src/prod/src/Reliability/Failover/ra/FailoverUnitStates.cpp | gridgentoo/ServiceFabricAzure | c3e7a07617e852322d73e6cc9819d266146866a4 | [
"MIT"
] | 2,542 | 2018-03-14T21:56:12.000Z | 2019-05-06T01:18:20.000Z | src/prod/src/Reliability/Failover/ra/FailoverUnitStates.cpp | gridgentoo/ServiceFabricAzure | c3e7a07617e852322d73e6cc9819d266146866a4 | [
"MIT"
] | 994 | 2019-05-07T02:39:30.000Z | 2022-03-31T13:23:04.000Z | src/prod/src/Reliability/Failover/ra/FailoverUnitStates.cpp | gridgentoo/ServiceFabricAzure | c3e7a07617e852322d73e6cc9819d266146866a4 | [
"MIT"
] | 300 | 2018-03-14T21:57:17.000Z | 2019-05-06T20:07:00.000Z | // ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
#include "Ra.Stdafx.h"
using namespace Common;
using namespace Reliability::ReconfigurationAgentComponent;
namespace Reliability
{
namespace ReconfigurationAgentComponent
{
namespace FailoverUnitStates
{
void FailoverUnitStates::WriteToTextWriter(TextWriter & w, FailoverUnitStates::Enum const & val)
{
switch (val)
{
case Open:
w << L"Open"; return;
case Closed:
w << L"Closed"; return;
default:
Common::Assert::CodingError("Unknown FailoverUnit State {0}", static_cast<int>(val));
}
}
ENUM_STRUCTURED_TRACE(FailoverUnitStates, Open, LastValidEnum);
}
}
}
| 32.823529 | 109 | 0.500896 | gridgentoo |
17aab4c06e3ab6c477c576c73da8d91b2ad8e684 | 3,748 | cpp | C++ | src/misc/refsm.cpp | kavehshamsi/neos | 2ecfbd821c1cd53d1fecf1b51d25df8124955345 | [
"MIT"
] | null | null | null | src/misc/refsm.cpp | kavehshamsi/neos | 2ecfbd821c1cd53d1fecf1b51d25df8124955345 | [
"MIT"
] | null | null | null | src/misc/refsm.cpp | kavehshamsi/neos | 2ecfbd821c1cd53d1fecf1b51d25df8124955345 | [
"MIT"
] | null | null | null | /*
* refsm.cpp
*
* Created on: Jan 19, 2019
* Author: kaveh
*/
#include "refsm.h"
namespace re {
void refsm::extract_state_logic(const oidset& state_ffs) {
using namespace utl;
idset visited = to_hset(state_ffs);
idque Q;
for (auto ffid : state_ffs) {
id ffout = cir->gfanout(ffid);
sl_ffouts.insert(ffout);
id ffin = cir->gfanin0(ffid);
sl_ffins.insert(ffin);
std::cout << "sl ffin: " << cir->wname(ffin) << " ";
std::cout << "sl ffout: " << cir->wname(ffout) << "\n";
Q.push(ffid);
}
while (!Q.empty()) {
id curgid = utl::utldeque(Q);
for (auto wfanin : cir->gfanin(curgid)) {
id ginid = cir->wfanin0(wfanin);
if (ginid != -1) { // for non-input wires
if (_is_not_in(ginid, visited)) {
if (cir->isLatch(ginid)) {
std::cout << "found non-state dff in state-logic\n";
}
else {
sl_gates.insert(ginid);
Q.push(ginid);
}
}
}
else {
if (!cir->isInput(wfanin)) {
std::cout << "state-logic input signal " <<
cir->wname(wfanin) << " is not a primary input\n";
}
if (!cir->isConst(wfanin)) {
std::cout << "state logic input: " << cir->wname(wfanin) << "\n";
sl_pis.insert(wfanin);
}
}
sl_wires.insert(wfanin);
}
}
}
void refsm::enumerate_fsm(const oidset& state_ffs, int max_states) {
extract_state_logic(state_ffs);
sat_solver S, Sexp;
slitvec assumps;
id2litmap_t wlitmap;
for (auto sl_wid : sl_wires) {
create_variable(S, wlitmap, sl_wid);
}
for (auto sl_gid : sl_gates) {
add_gate_clause(S, cir->getcgate(sl_gid), wlitmap);
}
add_const_sat_anyway(*cir, S, wlitmap);
std::list<boolvec> state_Q;
boolvec cur_state;
for (auto sl_dffout : sl_ffouts) {
assumps.push_back(~wlitmap.at(sl_dffout)); // zero initialize
cur_state.push_back(0);
}
/*
state_t st;
st.state_val = cur_state;
fsm.statemap[cur_state] = st;*/
Sexp = S;
int step = 0;
while (step++ < max_states) {
if (Sexp.solve(assumps)) {
// extract input
std::cout << "x=";
for (auto sl_pi : sl_pis) {
std::cout << Sexp.get_value(wlitmap.at(sl_pi));
}
// print current state
std::cout << " : ";
for (auto b : cur_state) {
std::cout << b;
}
std::cout << " -> ";
// extract next state
slitvec ban_clause;
boolvec next_state_vec;
for (auto sl_ffin : sl_ffins) {
slit ns_lit = wlitmap.at(sl_ffin);
bool ns_val = Sexp.get_value(wlitmap.at(sl_ffin));
std::cout << ns_val;
next_state_vec.push_back(ns_val);
ban_clause.push_back(ns_val ? ~ns_lit : ns_lit);
}
Sexp.add_clause(ban_clause);
state_Q.push_front(next_state_vec);
/*state_t next_state_obj;
next_state_obj.state_val = next_state_vec;
fsm.statemap[next_state_vec] = next_state_obj;
fsm.statemap[cur_state].next_states.push_back(&fsm.statemap.at(next_state_vec));*/
/*for (auto& st : state_Q) {
std::cout << " { ";
for (auto b : st) {
std::cout << b;
}
std::cout << "}, ";
}*/
std::cout << "\n";
}
else {
if (state_Q.empty()) {
std::cout << "\ndone exploring!\n";
break;
}
slitvec ban_clause;
int i = 0;
for (auto sl_ffin : sl_ffins) {
slit ns_lit = wlitmap.at(sl_ffin);
bool ns_val = cur_state[i++];
ban_clause.push_back(ns_val ? ~ns_lit : ns_lit);
}
S.add_clause(ban_clause);
Sexp = S; // reset SAT solver
cur_state = state_Q.back();
state_Q.pop_back();
assumps.clear();
std::cout << "now exploring from : s=";
i = 0;
for (auto sl_dffout : sl_ffouts) {
bool state_val = cur_state[i++];
std::cout << state_val;
assumps.push_back(state_val ? wlitmap.at(sl_dffout):~wlitmap.at(sl_dffout));
}
std::cout << "\n";
}
}
}
} // namespace re
| 20.593407 | 85 | 0.604856 | kavehshamsi |
17b0ab779c9cba1d89aedb70329996f16cd5dd58 | 1,972 | cc | C++ | game-server/test/unit/tictactwo/test_place_piece_action.cc | Towerism/morphling | cdfcb5949ca23417b5c6df9046f3a1924ba74771 | [
"MIT"
] | 4 | 2017-05-04T01:53:14.000Z | 2017-05-09T05:55:57.000Z | game-server/test/unit/tictactwo/test_place_piece_action.cc | Towerism/morphling | cdfcb5949ca23417b5c6df9046f3a1924ba74771 | [
"MIT"
] | null | null | null | game-server/test/unit/tictactwo/test_place_piece_action.cc | Towerism/morphling | cdfcb5949ca23417b5c6df9046f3a1924ba74771 | [
"MIT"
] | null | null | null | #include <gtest/gtest.h>
#include <games/tictactwo/tictactwo_model.h>
#include <games/tictactwo/action_place_piece.h>
#include <games/tictactwo/tictactwo_player.h>
using namespace Morphling::Gamelogic::Tictactwo;
using Morphling::Gamelogic::Game_object;
class PlacePieceActionTests : public ::testing::Test {
public:
PlacePieceActionTests()
: piece_x(new Game_object('X')), player("playerone", piece_x), model({ 2, 2 }) {
model.set_player_one(&player);
}
Game_object* piece_x;
Tictactwo_player player;
Tictactwo_model model;
};
TEST_F(PlacePieceActionTests, LegalToPlaceInsideGrid) {
Action_place_piece action({ 2, 3 });
EXPECT_TRUE(action.is_legal(&model));
}
TEST_F(PlacePieceActionTests, IllegalToPlacePastOriginOfGrid) {
Action_place_piece action({ 1, 1 });
EXPECT_FALSE(action.is_legal(&model));
}
TEST_F(PlacePieceActionTests, IllegalToPlacePastEndOfGrid) {
Action_place_piece action({ 5, 5 });
EXPECT_FALSE(action.is_legal(&model));
}
TEST_F(PlacePieceActionTests, IllegalToPlacePastRightOfGrid) {
Action_place_piece action({ 5, 2 });
EXPECT_FALSE(action.is_legal(&model));
}
TEST_F(PlacePieceActionTests, IllegalToPlacePastLeftOfGrid) {
Action_place_piece action({ 2, 5 });
EXPECT_FALSE(action.is_legal(&model));
}
TEST_F(PlacePieceActionTests, IllegalToPlaceAboveGrid) {
Action_place_piece action({ 2, 1 });
EXPECT_FALSE(action.is_legal(&model));
}
TEST_F(PlacePieceActionTests, IllegalToPlaceBelowGrid) {
Action_place_piece action({ 2, 5 });
EXPECT_FALSE(action.is_legal(&model));
}
TEST_F(PlacePieceActionTests, PlacingPieceOccupiesTheSpace) {
Action_place_piece action({ 2, 3 });
action.execute(&model);
ASSERT_NE(nullptr, model.get_element({2, 3}));
EXPECT_TRUE(model.get_element({2, 3})->equals(piece_x));
}
TEST_F(PlacePieceActionTests, IllegalToPlaceOnOccupiedSpace) {
Action_place_piece action({ 2, 3 });
action.execute(&model);
EXPECT_FALSE(action.is_legal(&model));
}
| 24.345679 | 84 | 0.755071 | Towerism |
17b254b6d8b216b9f478aaa5e8f230e8b1c1d2b1 | 10,190 | cpp | C++ | Source/FlightSimulator/Private/System/FlightAutoPilotSystem.cpp | Lynnvon/FlightSimulator | 2dca6f8364b7f4972a248de3dbc3a711740f5ed4 | [
"MIT"
] | 1 | 2022-02-03T08:29:35.000Z | 2022-02-03T08:29:35.000Z | Source/FlightSimulator/Private/System/FlightAutoPilotSystem.cpp | Lynnvon/FlightSimulator | 2dca6f8364b7f4972a248de3dbc3a711740f5ed4 | [
"MIT"
] | null | null | null | Source/FlightSimulator/Private/System/FlightAutoPilotSystem.cpp | Lynnvon/FlightSimulator | 2dca6f8364b7f4972a248de3dbc3a711740f5ed4 | [
"MIT"
] | null | null | null | //MIT License
//
//Copyright(c) 2021 HaiLiang Feng
//
//QQ : 632865163
//Blog : https ://www.cnblogs.com/LynnVon/
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this softwareand 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 noticeand 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 "FlightAutoPilotSystem.h"
#include "GameFramework/Actor.h"
#include "Components/InputComponent.h"
UFlightAutoPilotSystem::UFlightAutoPilotSystem(const FObjectInitializer& ObjectInitializer) :Super(ObjectInitializer)
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
SetSystemName(FName("FlightAutoPilotSystem"));
SetTickSystemEnable(true);
Reset();
AttributeHold();
}
void UFlightAutoPilotSystem::BeginPlay()
{
Super::BeginPlay();
}
void UFlightAutoPilotSystem::BindKey()
{
if (GetOwner() && GetOwner()->InputComponent)
{
GetOwner()->InputComponent->BindAction(FName("SwitchAPOn"), EInputEvent::IE_Pressed, this, &UFlightAutoPilotSystem::SwitchSubsystemOn);
GetOwner()->InputComponent->BindAction(FName("SwitchAPOff"), EInputEvent::IE_Pressed, this, &UFlightAutoPilotSystem::SwitchSubsystemOff);
GetOwner()->InputComponent->BindAction(FName("ToggleAPOnoff"), EInputEvent::IE_Pressed, this, &UFlightAutoPilotSystem::ToggleSubsystemOnOff);
GetOwner()->InputComponent->BindAction(FName("Disengage"), EInputEvent::IE_Pressed, this, &UFlightAutoPilotSystem::Disengage);
GetOwner()->InputComponent->BindAction(FName("ToggleAPMode"), EInputEvent::IE_Pressed, this, &UFlightAutoPilotSystem::ToggleAPMode);
GetOwner()->InputComponent->BindAction(FName("WaypointFollowHold"), EInputEvent::IE_Pressed, this, &UFlightAutoPilotSystem::WaypointFollowHold);
GetOwner()->InputComponent->BindAction(FName("AttributeHold"), EInputEvent::IE_Pressed, this, &UFlightAutoPilotSystem::AttributeHold);
GetOwner()->InputComponent->BindAction(FName("BarometricAltitudeHold"), EInputEvent::IE_Pressed, this, &UFlightAutoPilotSystem::BarometricAltitudeHold);
GetOwner()->InputComponent->BindAction(FName("BarometricAltitude_HHold"), EInputEvent::IE_Pressed, this, &UFlightAutoPilotSystem::BarometricAltitude_HHold);
GetOwner()->InputComponent->BindAction(FName("RodioAltitudeHold"), EInputEvent::IE_Pressed, this, &UFlightAutoPilotSystem::RodioAltitudeHold);
GetOwner()->InputComponent->BindAction(FName("AltitudeAndSlopeHold"), EInputEvent::IE_Pressed, this, &UFlightAutoPilotSystem::AltitudeAndSlopeHold);
GetOwner()->InputComponent->BindAction(FName("LevelFlightHold"), EInputEvent::IE_Pressed, this, &UFlightAutoPilotSystem::LevelFlightHold);
}
}
void UFlightAutoPilotSystem::StartUp()
{
Super::StartUp();
GetFlightControlSystem()->set_autopilot_engage(1, true);
Hold();
}
void UFlightAutoPilotSystem::ShutDown()
{
Super::ShutDown();
GetFlightControlSystem()->set_autopilot_engage(1, false);
Reset();
}
void UFlightAutoPilotSystem::TickSystem()
{
Super::TickSystem();
//如果自动驾驶期间摇杆有输入 就退出自动驾驶
if (GetFlightControlSystem()->HasControlInput())
{
//Disengage();
ShutDown();
}
}
void UFlightAutoPilotSystem::Disengage()
{
Reset();
}
void UFlightAutoPilotSystem::WaypointFollowHold()
{
SetAPMode(EAutoPoilotMode::EAPM_WAYPOINTFOLLOW);
}
void UFlightAutoPilotSystem::AttributeHold()
{
SetAPMode(EAutoPoilotMode::EAPM_ATTRIBUTE);
}
void UFlightAutoPilotSystem::BarometricAltitudeHold()
{
SetAPMode(EAutoPoilotMode::EAPM_BAROMETRIC_ALTITUDE);
bNeedInput = true;
ConfirmInput = ConfirmInput.IsEmpty() ? FString("0500") : ConfirmInput;
}
void UFlightAutoPilotSystem::BarometricAltitude_HHold()
{
SetAPMode(EAutoPoilotMode::EAPM_BAROMETRIC_ALTITUDE_H);
bNeedInput = true;
ConfirmInput = ConfirmInput.IsEmpty() ? FString("0500") : ConfirmInput;
}
void UFlightAutoPilotSystem::RodioAltitudeHold()
{
SetAPMode(EAutoPoilotMode::EAPM_RADIO_ALTITUDE);
bNeedInput = true;
ConfirmInput = ConfirmInput.IsEmpty() ? FString("0500") : ConfirmInput;
}
void UFlightAutoPilotSystem::AltitudeAndSlopeHold()
{
SetAPMode(EAutoPoilotMode::EAPM_ALTITUDE_AND_SLOPE);
}
void UFlightAutoPilotSystem::LevelFlightHold()
{
SetAPMode(EAutoPoilotMode::EAPM_LEVEL);
}
void UFlightAutoPilotSystem::ToggleAPMode()
{
CHECK_FALSE_RETURN(GetIsSystemRunning());
switch (CurrentAPMode)
{
case EAutoPoilotMode::EAPM_ATTRIBUTE:
BarometricAltitudeHold();
break;
case EAutoPoilotMode::EAPM_BAROMETRIC_ALTITUDE:
AttributeHold();
break;
default:
AttributeHold();
break;
}
}
void UFlightAutoPilotSystem::Confirm()
{
CHECK_FALSE_RETURN(GetIsSystemRunning());
//有的模式需要输入 有的不需要
CHECK_FALSE_RETURN(bNeedInput);
bCanInput = !bCanInput;
if (bCanInput)
{
//开始输入
CurrentUFCPInput.Empty();
}
else
{
//结束输入
if (!CurrentUFCPInput.IsEmpty() && CurrentUFCPInput.Len() == 4)
{
ConfirmInput = CurrentUFCPInput;
switch (GetCurrentAPMode())
{
case EAutoPoilotMode::EAPM_ATTRIBUTE:
break;
case EAutoPoilotMode::EAPM_BAROMETRIC_ALTITUDE:
AltitudeNeedHold = FCString::Atod(*ConfirmInput);
break;
case EAutoPoilotMode::EAPM_BAROMETRIC_ALTITUDE_H:
AltitudeNeedHold = FCString::Atod(*ConfirmInput);
break;
case EAutoPoilotMode::EAPM_RADIO_ALTITUDE:
AltitudeNeedHold = FCString::Atod(*ConfirmInput);
break;
case EAutoPoilotMode::EAPM_ALTITUDE_AND_SLOPE:
break;
case EAutoPoilotMode::EAPM_LEVEL:
break;
case EAutoPoilotMode::EAPM_WAYPOINTFOLLOW:
break;
case EAutoPoilotMode::NONE:
break;
default:
checkNoEntry();
break;
}
Hold();
}
else
{
PRINTWARNING(TEXT("Current UFCP Input Occurs Error,Check Your Input"));
CurrentUFCPInput.Empty();
}
}
}
void UFlightAutoPilotSystem::UFCPInput(FString val)
{
CHECK_FALSE_RETURN(bCanInput);
//有的模式需要输入 有的不需要
CHECK_FALSE_RETURN(bNeedInput);
if (CurrentUFCPInput.Len() < 4)
{
CurrentUFCPInput.Append(val);
}
}
void UFlightAutoPilotSystem::HoldHeading(bool bHold)
{
if (bHold)
{
//保持
GetFlightControlSystem()->set_heading_select(HeadingNeedHold);
}
else
{
//不保持
}
}
void UFlightAutoPilotSystem::HoldSpeed(bool bHold)
{
if (bHold)
{
//保持
GetFlightControlSystem()->set_heading_select(SpeedNeedHold);
}
else
{
//不保持
}
}
void UFlightAutoPilotSystem::HoldAltitude(bool bHold)
{
if (bHold)
{
//保持
GetFlightControlSystem()->set_heading_select(AltitudeNeedHold);
}
else
{
//不保持
}
}
void UFlightAutoPilotSystem::HoldRadioAltitude(bool bHold)
{
if (bHold)
{
//保持
GetFlightControlSystem()->set_heading_select(AltitudeNeedHold);
}
}
void UFlightAutoPilotSystem::NavigateToNextWaypoint(bool bHold)
{
}
void UFlightAutoPilotSystem::Hold()
{
//具体自动驾驶实现
switch (GetCurrentAPMode())
{
case EAutoPoilotMode::EAPM_ATTRIBUTE:
HoldHeading(true);
HoldSpeed(true);
HoldAltitude(true);
HoldRadioAltitude(false);
NavigateToNextWaypoint(false);
break;
case EAutoPoilotMode::EAPM_BAROMETRIC_ALTITUDE:
HoldHeading(false);
HoldAltitude(true);
HoldRadioAltitude(false);
HoldSpeed(false);
NavigateToNextWaypoint(false);
break;
case EAutoPoilotMode::EAPM_BAROMETRIC_ALTITUDE_H:
break;
case EAutoPoilotMode::EAPM_RADIO_ALTITUDE:
HoldHeading(false);
HoldAltitude(false);
HoldSpeed(false);
NavigateToNextWaypoint(false);
HoldRadioAltitude(true);
break;
case EAutoPoilotMode::EAPM_ALTITUDE_AND_SLOPE:
break;
case EAutoPoilotMode::EAPM_LEVEL:
break;
case EAutoPoilotMode::EAPM_WAYPOINTFOLLOW:
HoldHeading(false);
HoldAltitude(false);
HoldRadioAltitude(false);
HoldSpeed(false);
NavigateToNextWaypoint(true);
break;
case EAutoPoilotMode::NONE:
break;
default:
checkNoEntry();
break;
}
}
void UFlightAutoPilotSystem::SetAPMode(EAutoPoilotMode mode)
{
CHECK_FALSE_RETURN(GetIsSystemRunning());
CHECK_TRUE_RETURN(CurrentAPMode == mode);
Reset();
InitHoldProperty();
CurrentAPMode = mode;
if (OnAutopoilotModeChange.IsBound())
{
OnAutopoilotModeChange.Broadcast(CurrentAPMode);
}
}
void UFlightAutoPilotSystem::Reset()
{
CurrentAPMode = EAutoPoilotMode::NONE;
bCanInput = false;
CurrentUFCPInput.Empty();
bNeedInput = false;
SpeedNeedHold = 0;
HeadingNeedHold = 0;
AltitudeNeedHold = 0;
HoldHeading(false);
HoldSpeed(false);
HoldAltitude(false);
HoldRadioAltitude(false);
NavigateToNextWaypoint(false);
}
void UFlightAutoPilotSystem::InitHoldProperty()
{
if (GetFlightPropertySystem())
{
SpeedNeedHold = GetFlightPropertySystem()->mach_number;
HeadingNeedHold = GetFlightPropertySystem()->euler_angles_v.Y;
AltitudeNeedHold = GetFlightPropertySystem()->altitude_agl;
}
}
| 26.957672 | 162 | 0.708047 | Lynnvon |
17b320ad26d6479e3150f76f73e193dda73b24aa | 9,660 | cpp | C++ | src/chatwindow/qmlchatwidget.cpp | nameisalreadytakenexception/PairStormIDE | 7c41dc91611f9a9db62c8c9ac0373e0fe33fec59 | [
"MIT"
] | 4 | 2019-07-23T13:00:58.000Z | 2021-09-24T19:03:01.000Z | src/chatwindow/qmlchatwidget.cpp | nameisalreadytakenexception/PairStormIDE | 7c41dc91611f9a9db62c8c9ac0373e0fe33fec59 | [
"MIT"
] | 4 | 2019-07-23T12:33:11.000Z | 2019-08-20T11:39:16.000Z | src/chatwindow/qmlchatwidget.cpp | nameisalreadytakenexception/PairStormIDE | 7c41dc91611f9a9db62c8c9ac0373e0fe33fec59 | [
"MIT"
] | 1 | 2019-11-02T15:07:13.000Z | 2019-11-02T15:07:13.000Z | #include "qmlchatwidget.h"
// ==========================================================================================
// ==========================================================================================
// CONSTRUCTOR
QmlChatWidget::QmlChatWidget()
{
// Set default user name
mUserName = QString();
QQuickView *tmpView = new QQuickView();
mpCurrentChatContext = tmpView->engine()->rootContext();
mpCurrentChatContext->setContextProperty("globalTheme", "white");
tmpView->setResizeMode(QQuickView::SizeRootObjectToView);
tmpView->setSource(QUrl("qrc:/chatdisabled.qml"));
mpCurrentQmlChatWidget = QWidget::createWindowContainer(tmpView, this);
mpCurrentQmlChatWidget->setContentsMargins(0, 0, 0, 0);
mpCurrentQmlChatWidget->setFocusPolicy(Qt::StrongFocus);
mpCurrentQmlChatWidget->setSizePolicy(QSizePolicy::Expanding,
QSizePolicy::Expanding);
mpCurrentChatLayout = new QBoxLayout(QBoxLayout::BottomToTop, this);
mpCurrentChatLayout->addWidget(mpCurrentQmlChatWidget);
mpCurrentChatLayout->setSpacing(0);
mpCurrentChatLayout->setMargin(0);
setLayout(mpCurrentChatLayout);
setMinimumSize(210, 400);
}
// ==========================================================================================
// ==========================================================================================
// ==========================================================================================
// DOCKER KEY PRESS EVENTS PROCESSOR
void QmlChatWidget::keyPressEvent(QKeyEvent *event)
{
// idle by now
event->key();
}
// ==========================================================================================
// ==========================================================================================
// ==========================================================================================
// CHAT CONFIGURATOR
void QmlChatWidget::configureOnLogin(const QString &userName)
{
if (mUserName != QString())
{
// Hold the damage & inform user that he/she can't log in second time
mpMessagesController->sendSystemMessage(SystemMessage::CanNotLogInTwiceMessage);
return;
}
mUserName = userName;
// Create & connect chat users controller
mpUsersController = new ChatUsersController(mUserName);
connect(mpUsersController, &ChatUsersController::userStateChangedConnected,
this, &QmlChatWidget::connectUserOnSwitchOn,
Qt::UniqueConnection);
connect(mpUsersController, &ChatUsersController::userStateChangedDisconnected,
this, &QmlChatWidget::disconnectUserOnSwitchOff,
Qt::UniqueConnection);
// Register chat users model & users controller in the QML
qmlRegisterType<ChatUsersModel>("PairStormChat", 1, 0, "UsersModel");
qmlRegisterUncreatableType<ChatUsersController>("PairStormChat", 1, 0, "UsersList",
"Users list can be created only in backend");
// Create & connect chat messages controller
mpMessagesController = new ChatMessagesController(userName);
mpMessagesController->sendSystemMessage(SystemMessage::GreetingsMessage);
connect(mpMessagesController, &ChatMessagesController::sendingMessage,
this, &QmlChatWidget::shareMessageOnSendingMessage,
Qt::UniqueConnection);
// Register chat messages model & messages controller in the QML
qmlRegisterType<ChatMessagesModel>("PairStormChat", 1, 0, "MessagesModel");
qmlRegisterUncreatableType<ChatMessagesController>("PairStormChat", 1, 0, "MessagesList",
"Messages list can be created only in backend");
QQuickView *tmpView = new QQuickView();
mpCurrentChatContext = tmpView->engine()->rootContext();
mpCurrentChatContext->setContextProperty("globalTheme", "white");
mpCurrentChatContext->setContextProperty("globalUserName", mUserName);
mpCurrentChatContext->setContextProperty("messagesList", mpMessagesController);
mpCurrentChatContext->setContextProperty("usersList", mpUsersController);
tmpView->setResizeMode(QQuickView::SizeRootObjectToView);
tmpView->setSource(QUrl("qrc:/chat.qml"));
mpCurrentChatLayout->removeWidget(mpCurrentQmlChatWidget);
mpCurrentQmlChatWidget->hide();
delete mpCurrentQmlChatWidget;
mpCurrentQmlChatWidget = QWidget::createWindowContainer(tmpView, this);
mpCurrentQmlChatWidget->setContentsMargins(0, 0, 0, 0);
mpCurrentQmlChatWidget->setFocusPolicy(Qt::StrongFocus);
mpCurrentQmlChatWidget->setSizePolicy(QSizePolicy::Expanding,
QSizePolicy::Expanding);
mpCurrentChatLayout->addWidget(mpCurrentQmlChatWidget);
}
// ==========================================================================================
// ==========================================================================================
// ==========================================================================================
// UPDATE ONLINE USERS IN CONTROLLER
void QmlChatWidget::updateOnlineUsers(const QStringList &onlineUsers)
{
if (mpMessagesController)
{
mpUsersController->updateOnlineUsers(onlineUsers);
}
}
// ==========================================================================================
// ==========================================================================================
// ==========================================================================================
// UPDATE CONNECTED USERS IN CONTROLLER
void QmlChatWidget::updateConnectedUsers(const QStringList &connectedUsers)
{
if (mpMessagesController)
{
mpUsersController->updateConnectedUsers(connectedUsers);
}
}
// ==========================================================================================
// ==========================================================================================
// ==========================================================================================
// APPEND NEW MESSAGE TO THE CHAT
void QmlChatWidget::appendMessage(const QString &messageAuthor,
const QString &messageBody)
{
// Here we IGNORE messageAuthor because it is solely NEEDED FOR BACK COMPATIBILITY
if (!mpMessagesController)
{
// Hold the damage if it is called before user has logged in
return;
}
ChatMessage newMessage;
newMessage.fromJsonQString(messageBody);
if (newMessage.empty())
{
// Hold the damage if json bearer string is broken
return;
}
mpMessagesController->appendMessage(newMessage);
}
// ==========================================================================================
// ==========================================================================================
// ==========================================================================================
// UPDATE CHAT THEME
void QmlChatWidget::updateTheme(const QString &themeName)
{
Theme newTheme = mThemes[themeName];
switch(newTheme)
{
case Theme::DefaultTheme:
mpCurrentChatContext->setContextProperty("globalTheme", "white");
break;
case Theme::WhiteTheme:
mpCurrentChatContext->setContextProperty("globalTheme", "white");
break;
case Theme::BlueTheme:
mpCurrentChatContext->setContextProperty("globalTheme", "blue");
break;
case Theme::DarkTheme:
mpCurrentChatContext->setContextProperty("globalTheme", "dark");
break;
}
}
// ==========================================================================================
// ==========================================================================================
// ==========================================================================================
// SHARE MESSAGE WHEN USER INVOKES SEND MESSAGE ACTION
void QmlChatWidget::shareMessageOnSendingMessage(const ChatMessage &message)
{
const QString messageString = message.toJsonQString();
emit messageSent(messageString);
}
// ==========================================================================================
// ==========================================================================================
// ==========================================================================================
// SEND CONNECT REQUEST WHEN USER TRUNS ON THE SWITCH
void QmlChatWidget::connectUserOnSwitchOn(const QString &userName)
{
emit startSharingRequested(userName);
}
// ==========================================================================================
// ==========================================================================================
// ==========================================================================================
// SEND DISCONNECT REQUEST WHEN USER TRUNS OFF THE SWITCH
void QmlChatWidget::disconnectUserOnSwitchOff(const QString &userName)
{
emit stopSharingRequested(userName);
}
| 48.542714 | 103 | 0.467391 | nameisalreadytakenexception |
17b9a6eb0767bb5d5cdccf0a0919975bae4686bf | 1,925 | cpp | C++ | Editor/DecalWindow.cpp | sadernalwis/WickedEngine | a1924cc97d36d0dac5e405f4197a9b1e982b2740 | [
"WTFPL",
"MIT"
] | 3,589 | 2015-06-20T23:08:26.000Z | 2022-03-31T13:45:07.000Z | Editor/DecalWindow.cpp | sadernalwis/WickedEngine | a1924cc97d36d0dac5e405f4197a9b1e982b2740 | [
"WTFPL",
"MIT"
] | 303 | 2015-11-23T18:23:59.000Z | 2022-03-31T09:31:03.000Z | Editor/DecalWindow.cpp | sadernalwis/WickedEngine | a1924cc97d36d0dac5e405f4197a9b1e982b2740 | [
"WTFPL",
"MIT"
] | 496 | 2015-06-22T18:14:06.000Z | 2022-03-30T21:53:21.000Z | #include "stdafx.h"
#include "DecalWindow.h"
#include "Editor.h"
using namespace wiECS;
using namespace wiScene;
void DecalWindow::Create(EditorComponent* editor)
{
wiWindow::Create("Decal Window");
SetSize(XMFLOAT2(400, 200));
float x = 200;
float y = 5;
float hei = 18;
float step = hei + 2;
placementCheckBox.Create("Decal Placement Enabled: ");
placementCheckBox.SetPos(XMFLOAT2(x, y += step));
placementCheckBox.SetSize(XMFLOAT2(hei, hei));
placementCheckBox.SetCheck(false);
placementCheckBox.SetTooltip("Enable decal placement. Use the left mouse button to place decals to the scene.");
AddWidget(&placementCheckBox);
y += step;
infoLabel.Create("");
infoLabel.SetText("Selecting decals will select the according material. Set decal properties (texture, color, etc.) in the Material window.");
infoLabel.SetSize(XMFLOAT2(400 - 20, 100));
infoLabel.SetPos(XMFLOAT2(10, y));
infoLabel.SetColor(wiColor::Transparent());
AddWidget(&infoLabel);
y += infoLabel.GetScale().y - step + 5;
decalNameField.Create("Decal Name");
decalNameField.SetPos(XMFLOAT2(10, y+=step));
decalNameField.SetSize(XMFLOAT2(300, hei));
decalNameField.OnInputAccepted([=](wiEventArgs args) {
NameComponent* name = wiScene::GetScene().names.GetComponent(entity);
if (name != nullptr)
{
*name = args.sValue;
editor->RefreshSceneGraphView();
}
});
AddWidget(&decalNameField);
Translate(XMFLOAT3(30, 30, 0));
SetVisible(false);
SetEntity(INVALID_ENTITY);
}
void DecalWindow::SetEntity(Entity entity)
{
this->entity = entity;
Scene& scene = wiScene::GetScene();
const DecalComponent* decal = scene.decals.GetComponent(entity);
if (decal != nullptr)
{
const NameComponent& name = *scene.names.GetComponent(entity);
decalNameField.SetValue(name.name);
decalNameField.SetEnabled(true);
}
else
{
decalNameField.SetValue("No decal selected");
decalNameField.SetEnabled(false);
}
}
| 25.328947 | 143 | 0.72987 | sadernalwis |
17c258aeb76260b826c40b51a791fe5d37712a86 | 2,555 | hpp | C++ | vm/builtin/methodtable.hpp | godfat/rubinius | d6a7a3323af0348800118ccd0b13fdf80adbbcef | [
"BSD-3-Clause"
] | 3 | 2015-02-02T01:21:27.000Z | 2016-04-29T22:30:01.000Z | vm/builtin/methodtable.hpp | gdoleczek/rubinius | d8b16a76ada3531791260779ee747d11b75aba0e | [
"BSD-3-Clause"
] | null | null | null | vm/builtin/methodtable.hpp | gdoleczek/rubinius | d8b16a76ada3531791260779ee747d11b75aba0e | [
"BSD-3-Clause"
] | 1 | 2018-03-04T03:19:02.000Z | 2018-03-04T03:19:02.000Z | #ifndef RBX_BUILTIN_METHODTABLE_HPP
#define RBX_BUILTIN_METHODTABLE_HPP
namespace rubinius {
class Tuple;
class Array;
class Executable;
class Symbol;
class MethodTableBucket : public Object {
public:
const static object_type type = MethodTableBucketType;
private:
Symbol* name_; // slot
Symbol* visibility_; // slot
Executable* method_; // slot
MethodTableBucket* next_; // slot
public:
attr_accessor(name, Symbol);
attr_accessor(visibility, Symbol);
attr_accessor(method, Executable);
attr_accessor(next, MethodTableBucket);
static MethodTableBucket* create(STATE, Symbol* name,
Executable* method, Symbol* visibility);
Object* append(STATE, MethodTableBucket *nxt);
bool private_p(STATE);
bool public_p(STATE);
bool protected_p(STATE);
bool undef_p(STATE);
class Info : public TypeInfo {
public:
BASIC_TYPEINFO(TypeInfo)
};
};
#define METHODTABLE_MIN_SIZE 16
class MethodTable : public Object {
public:
const static object_type type = MethodTableType;
private:
Tuple* values_; // slot
Integer* bins_; // slot
Integer* entries_; // slot
void redistribute(STATE, size_t size);
public:
/* accessors */
attr_accessor(values, Tuple);
attr_accessor(bins, Integer);
attr_accessor(entries, Integer);
/* interface */
static MethodTable* create(STATE, size_t sz = METHODTABLE_MIN_SIZE);
void setup(STATE, size_t sz);
// Rubinius.primitive :methodtable_allocate
static MethodTable* allocate(STATE, Object* self);
// Rubinius.primitive :methodtable_store
Object* store(STATE, GCToken gct, Symbol* name, Object* meth, Symbol* vis);
// Rubinius.primitive :methodtable_alias
Object* alias(STATE, GCToken gct, Symbol* name, Symbol* vis, Symbol* orig_name, Object* orig_method, Module* orig_mod);
// Rubinius.primitive :methodtable_duplicate
MethodTable* duplicate(STATE, GCToken gct);
MethodTableBucket* find_entry(STATE, Symbol* name);
MethodTableBucket* find_entry(Symbol* name);
// Rubinius.primitive :methodtable_lookup
MethodTableBucket* lookup(STATE, Symbol* name);
// Rubinius.primitive :methodtable_delete
Executable* remove(STATE, GCToken gct, Symbol* name);
// Rubinius.primitive :methodtable_has_name
Object* has_name(STATE, Symbol* name);
class Info : public TypeInfo {
public:
BASIC_TYPEINFO(TypeInfo)
virtual void show(STATE, Object* self, int level);
};
};
}
#endif
| 25.808081 | 123 | 0.697847 | godfat |
17c38b5ccc3e07ef4ec9e397f8b2bd0676396b53 | 1,582 | cpp | C++ | code/3rdParty/ogdf/src/ogdf/planarity/PlanRepLight.cpp | turbanoff/qvge | 53508adadb4ca566c011b2b41d432030a5fa5fac | [
"MIT"
] | 3 | 2021-09-14T08:11:37.000Z | 2022-03-04T15:42:07.000Z | code/3rdParty/ogdf/src/ogdf/planarity/PlanRepLight.cpp | turbanoff/qvge | 53508adadb4ca566c011b2b41d432030a5fa5fac | [
"MIT"
] | 2 | 2021-12-04T17:09:53.000Z | 2021-12-16T08:57:25.000Z | code/3rdParty/ogdf/src/ogdf/planarity/PlanRepLight.cpp | turbanoff/qvge | 53508adadb4ca566c011b2b41d432030a5fa5fac | [
"MIT"
] | 2 | 2021-06-22T08:21:54.000Z | 2021-07-07T06:57:22.000Z | /** \file
* \brief Implementation of class PlanRepLight.
*
* \author Carsten Gutwenger
*
* \par License:
* This file is part of the Open Graph Drawing Framework (OGDF).
*
* \par
* Copyright (C)<br>
* See README.md in the OGDF root directory for details.
*
* \par
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* Version 2 or 3 as published by the Free Software Foundation;
* see the file LICENSE.txt included in the packaging of this file
* for details.
*
* \par
* 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.
*
* \par
* You should have received a copy of the GNU General Public
* License along with this program; if not, see
* http://www.gnu.org/copyleft/gpl.html
*/
#include <ogdf/planarity/PlanRepLight.h>
namespace ogdf {
PlanRepLight::PlanRepLight(const PlanRep &pr)
: m_ccInfo(pr.ccInfo()), m_pr(pr), m_currentCC(-1), m_eAuxCopy(pr.original())
{
GraphCopy::createEmpty(pr.original());
}
void PlanRepLight::initCC(int cc)
{
if (m_currentCC >= 0)
{
for(int i = m_ccInfo.startNode(m_currentCC); i < m_ccInfo.stopNode(m_currentCC); ++i)
m_vCopy[m_ccInfo.v(i)] = nullptr;
for(int i = m_ccInfo.startEdge(m_currentCC); i < m_ccInfo.stopEdge(m_currentCC); ++i)
m_eCopy[m_ccInfo.e(i)].clear();
}
m_currentCC = cc;
initByCC(m_ccInfo, cc, m_eAuxCopy);
}
}
| 25.516129 | 87 | 0.710493 | turbanoff |
17c3fb4d93c740d3b21bf2cd910c97e87e934003 | 1,532 | cpp | C++ | src/vlcqt/core/ModuleDescription.cpp | a-pavlov/qtplayer | 10dfb7e1c8bac9cebb1925dd890b1d4b42d036f4 | [
"Apache-2.0"
] | null | null | null | src/vlcqt/core/ModuleDescription.cpp | a-pavlov/qtplayer | 10dfb7e1c8bac9cebb1925dd890b1d4b42d036f4 | [
"Apache-2.0"
] | null | null | null | src/vlcqt/core/ModuleDescription.cpp | a-pavlov/qtplayer | 10dfb7e1c8bac9cebb1925dd890b1d4b42d036f4 | [
"Apache-2.0"
] | null | null | null | /****************************************************************************
* VLC-Qt - Qt and libvlc connector library
* Copyright (C) 2015 Tadej Novak <tadej@tano.si>
*
* This 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 3 of the License, or
* (at your option) any later version.
*
* This 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 this library. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include "ModuleDescription.h"
VlcModuleDescription::VlcModuleDescription(Type type,
const QString &name)
: _type(type),
_name(name) {}
VlcModuleDescription::~VlcModuleDescription() {} // LCOV_EXCL_LINE
void VlcModuleDescription::setShortName(const QString &name)
{
if (_shortName != name) {
_shortName = name;
}
}
void VlcModuleDescription::setLongName(const QString &name)
{
if (_longName != name) {
_longName = name;
}
}
void VlcModuleDescription::setHelp(const QString &help)
{
if (_help != help) {
_help = help;
}
}
| 31.916667 | 78 | 0.626632 | a-pavlov |
17c67fb22995dad75c1e23509bf318b079adfcb0 | 16,235 | cpp | C++ | export/windows/cpp/obj/src/flixel/input/FlxPointer.cpp | TinyPlanetStudios/Project-Crash-Land | 365f196be4212602d32251566f26b53fb70693f6 | [
"MIT"
] | null | null | null | export/windows/cpp/obj/src/flixel/input/FlxPointer.cpp | TinyPlanetStudios/Project-Crash-Land | 365f196be4212602d32251566f26b53fb70693f6 | [
"MIT"
] | null | null | null | export/windows/cpp/obj/src/flixel/input/FlxPointer.cpp | TinyPlanetStudios/Project-Crash-Land | 365f196be4212602d32251566f26b53fb70693f6 | [
"MIT"
] | null | null | null | // Generated by Haxe 3.3.0
#include <hxcpp.h>
#ifndef INCLUDED_Std
#include <Std.h>
#endif
#ifndef INCLUDED_flixel_FlxBasic
#include <flixel/FlxBasic.h>
#endif
#ifndef INCLUDED_flixel_FlxCamera
#include <flixel/FlxCamera.h>
#endif
#ifndef INCLUDED_flixel_FlxG
#include <flixel/FlxG.h>
#endif
#ifndef INCLUDED_flixel_FlxObject
#include <flixel/FlxObject.h>
#endif
#ifndef INCLUDED_flixel_group_FlxTypedGroup
#include <flixel/group/FlxTypedGroup.h>
#endif
#ifndef INCLUDED_flixel_input_FlxPointer
#include <flixel/input/FlxPointer.h>
#endif
#ifndef INCLUDED_flixel_math_FlxPoint
#include <flixel/math/FlxPoint.h>
#endif
#ifndef INCLUDED_flixel_system_scaleModes_BaseScaleMode
#include <flixel/system/scaleModes/BaseScaleMode.h>
#endif
#ifndef INCLUDED_flixel_util_FlxPool_flixel_math_FlxPoint
#include <flixel/util/FlxPool_flixel_math_FlxPoint.h>
#endif
#ifndef INCLUDED_flixel_util_FlxPool_flixel_util_LabelValuePair
#include <flixel/util/FlxPool_flixel_util_LabelValuePair.h>
#endif
#ifndef INCLUDED_flixel_util_FlxStringUtil
#include <flixel/util/FlxStringUtil.h>
#endif
#ifndef INCLUDED_flixel_util_IFlxDestroyable
#include <flixel/util/IFlxDestroyable.h>
#endif
#ifndef INCLUDED_flixel_util_IFlxPool
#include <flixel/util/IFlxPool.h>
#endif
#ifndef INCLUDED_flixel_util_IFlxPooled
#include <flixel/util/IFlxPooled.h>
#endif
#ifndef INCLUDED_flixel_util_LabelValuePair
#include <flixel/util/LabelValuePair.h>
#endif
static const Bool _hx_array_data_0[] = {
0,
};
namespace flixel{
namespace input{
void FlxPointer_obj::__construct(){
HX_STACK_FRAME("flixel.input.FlxPointer","new",0x20c36c33,"flixel.input.FlxPointer.new","flixel/input/FlxPointer.hx",8,0xe6a2529b)
HX_STACK_THIS(this)
HXLINE( 17) this->_globalScreenY = (int)0;
HXLINE( 16) this->_globalScreenX = (int)0;
HXLINE( 14) this->screenY = (int)0;
HXLINE( 13) this->screenX = (int)0;
HXLINE( 11) this->y = (int)0;
HXLINE( 10) this->x = (int)0;
}
Dynamic FlxPointer_obj::__CreateEmpty() { return new FlxPointer_obj; }
hx::ObjectPtr< FlxPointer_obj > FlxPointer_obj::__new()
{
hx::ObjectPtr< FlxPointer_obj > _hx_result = new FlxPointer_obj();
_hx_result->__construct();
return _hx_result;
}
Dynamic FlxPointer_obj::__Create(hx::DynamicArray inArgs)
{
hx::ObjectPtr< FlxPointer_obj > _hx_result = new FlxPointer_obj();
_hx_result->__construct();
return _hx_result;
}
::flixel::math::FlxPoint FlxPointer_obj::getWorldPosition( ::flixel::FlxCamera Camera, ::flixel::math::FlxPoint point){
HX_STACK_FRAME("flixel.input.FlxPointer","getWorldPosition",0x52927af2,"flixel.input.FlxPointer.getWorldPosition","flixel/input/FlxPointer.hx",30,0xe6a2529b)
HX_STACK_THIS(this)
HX_STACK_ARG(Camera,"Camera")
HX_STACK_ARG(point,"point")
HXLINE( 31) Bool _hx_tmp = hx::IsNull( Camera );
HXDLIN( 31) if (_hx_tmp) {
HXLINE( 33) Camera = ::flixel::FlxG_obj::camera;
}
HXLINE( 35) Bool _hx_tmp1 = hx::IsNull( point );
HXDLIN( 35) if (_hx_tmp1) {
HXLINE( 37) HX_VARI_NAME( ::flixel::math::FlxPoint,point1,"point") = ::flixel::math::FlxPoint_obj::_pool->get()->set((int)0,(int)0);
HXDLIN( 37) point1->_inPool = false;
HXDLIN( 37) point = point1;
}
HXLINE( 39) HX_VARI( ::flixel::math::FlxPoint,screenPosition) = this->getScreenPosition(Camera,null());
HXLINE( 40) Float _hx_tmp2 = (screenPosition->x + Camera->scroll->x);
HXDLIN( 40) point->set_x(_hx_tmp2);
HXLINE( 41) Float _hx_tmp3 = (screenPosition->y + Camera->scroll->y);
HXDLIN( 41) point->set_y(_hx_tmp3);
HXLINE( 42) screenPosition->put();
HXLINE( 43) return point;
}
HX_DEFINE_DYNAMIC_FUNC2(FlxPointer_obj,getWorldPosition,return )
::flixel::math::FlxPoint FlxPointer_obj::getScreenPosition( ::flixel::FlxCamera Camera, ::flixel::math::FlxPoint point){
HX_STACK_FRAME("flixel.input.FlxPointer","getScreenPosition",0xae561a7e,"flixel.input.FlxPointer.getScreenPosition","flixel/input/FlxPointer.hx",55,0xe6a2529b)
HX_STACK_THIS(this)
HX_STACK_ARG(Camera,"Camera")
HX_STACK_ARG(point,"point")
HXLINE( 56) Bool _hx_tmp = hx::IsNull( Camera );
HXDLIN( 56) if (_hx_tmp) {
HXLINE( 58) Camera = ::flixel::FlxG_obj::camera;
}
HXLINE( 60) Bool _hx_tmp1 = hx::IsNull( point );
HXDLIN( 60) if (_hx_tmp1) {
HXLINE( 62) HX_VARI_NAME( ::flixel::math::FlxPoint,point1,"point") = ::flixel::math::FlxPoint_obj::_pool->get()->set((int)0,(int)0);
HXDLIN( 62) point1->_inPool = false;
HXDLIN( 62) point = point1;
}
HXLINE( 65) Float _hx_tmp2 = ((Float)((this->_globalScreenX - Camera->x) + ((((Float)0.5) * Camera->width) * (Camera->zoom - Camera->initialZoom))) / (Float)Camera->zoom);
HXDLIN( 65) point->set_x(_hx_tmp2);
HXLINE( 66) Float _hx_tmp3 = ((Float)((this->_globalScreenY - Camera->y) + ((((Float)0.5) * Camera->height) * (Camera->zoom - Camera->initialZoom))) / (Float)Camera->zoom);
HXDLIN( 66) point->set_y(_hx_tmp3);
HXLINE( 68) return point;
}
HX_DEFINE_DYNAMIC_FUNC2(FlxPointer_obj,getScreenPosition,return )
::flixel::math::FlxPoint FlxPointer_obj::getPosition( ::flixel::math::FlxPoint point){
HX_STACK_FRAME("flixel.input.FlxPointer","getPosition",0x9fea8a32,"flixel.input.FlxPointer.getPosition","flixel/input/FlxPointer.hx",75,0xe6a2529b)
HX_STACK_THIS(this)
HX_STACK_ARG(point,"point")
HXLINE( 76) Bool _hx_tmp = hx::IsNull( point );
HXDLIN( 76) if (_hx_tmp) {
HXLINE( 77) HX_VARI_NAME( ::flixel::math::FlxPoint,point1,"point") = ::flixel::math::FlxPoint_obj::_pool->get()->set((int)0,(int)0);
HXDLIN( 77) point1->_inPool = false;
HXDLIN( 77) point = point1;
}
HXLINE( 78) return point->set(this->x,this->y);
}
HX_DEFINE_DYNAMIC_FUNC1(FlxPointer_obj,getPosition,return )
Bool FlxPointer_obj::overlaps( ::flixel::FlxBasic ObjectOrGroup, ::flixel::FlxCamera Camera){
HX_STACK_FRAME("flixel.input.FlxPointer","overlaps",0xe0967a59,"flixel.input.FlxPointer.overlaps","flixel/input/FlxPointer.hx",92,0xe6a2529b)
HX_STACK_THIS(this)
HX_STACK_ARG(ObjectOrGroup,"ObjectOrGroup")
HX_STACK_ARG(Camera,"Camera")
HXLINE( 91) HX_VARI( ::flixel::input::FlxPointer,_gthis) = hx::ObjectPtr<OBJ_>(this);
HXLINE( 93) HX_VARI( ::Array< Bool >,result) = ::Array_obj< Bool >::fromData( _hx_array_data_0,1);
HXLINE( 95) HX_VARI( ::flixel::group::FlxTypedGroup,group) = ::flixel::group::FlxTypedGroup_obj::resolveGroup(ObjectOrGroup);
HXLINE( 96) Bool _hx_tmp = hx::IsNotNull( group );
HXDLIN( 96) if (_hx_tmp) {
HX_BEGIN_LOCAL_FUNC_S3(hx::LocalFunc,_hx_Closure_0, ::flixel::input::FlxPointer,_gthis, ::flixel::FlxCamera,Camera,::Array< Bool >,result) HXARGC(1)
void _hx_run( ::flixel::FlxBasic basic){
HX_STACK_FRAME("flixel.input.FlxPointer","overlaps",0xe0967a59,"flixel.input.FlxPointer.overlaps","flixel/input/FlxPointer.hx",100,0xe6a2529b)
HX_STACK_ARG(basic,"basic")
HXLINE( 100) Bool _hx_tmp1 = _gthis->overlaps(basic,Camera);
HXDLIN( 100) if (_hx_tmp1) {
HXLINE( 102) result[(int)0] = true;
HXLINE( 103) return;
}
}
HX_END_LOCAL_FUNC1((void))
HXLINE( 98) group->forEachExists( ::Dynamic(new _hx_Closure_0(_gthis,Camera,result)),null());
}
else {
HXLINE( 109) HX_VARI( ::flixel::math::FlxPoint,point) = this->getPosition(null());
HXLINE( 111) Bool _hx_tmp2 = ( ( ::flixel::FlxObject)(ObjectOrGroup) )->overlapsPoint(point,true,Camera);
HXDLIN( 111) result[(int)0] = _hx_tmp2;
HXLINE( 112) point->put();
}
HXLINE( 115) return result->__get((int)0);
}
HX_DEFINE_DYNAMIC_FUNC2(FlxPointer_obj,overlaps,return )
void FlxPointer_obj::setGlobalScreenPositionUnsafe(Float newX,Float newY){
HX_STACK_FRAME("flixel.input.FlxPointer","setGlobalScreenPositionUnsafe",0x8f7aed13,"flixel.input.FlxPointer.setGlobalScreenPositionUnsafe","flixel/input/FlxPointer.hx",123,0xe6a2529b)
HX_STACK_THIS(this)
HX_STACK_ARG(newX,"newX")
HX_STACK_ARG(newY,"newY")
HXLINE( 124) Float _hx_tmp = ((Float)newX / (Float)::flixel::FlxG_obj::scaleMode->scale->x);
HXDLIN( 124) this->_globalScreenX = ::Std_obj::_hx_int(_hx_tmp);
HXLINE( 125) Float _hx_tmp1 = ((Float)newY / (Float)::flixel::FlxG_obj::scaleMode->scale->y);
HXDLIN( 125) this->_globalScreenY = ::Std_obj::_hx_int(_hx_tmp1);
HXLINE( 127) this->updatePositions();
}
HX_DEFINE_DYNAMIC_FUNC2(FlxPointer_obj,setGlobalScreenPositionUnsafe,(void))
::String FlxPointer_obj::toString(){
HX_STACK_FRAME("flixel.input.FlxPointer","toString",0xd3da77f9,"flixel.input.FlxPointer.toString","flixel/input/FlxPointer.hx",132,0xe6a2529b)
HX_STACK_THIS(this)
HXLINE( 133) ::Dynamic value = this->x;
HXDLIN( 133) HX_VARI( ::flixel::util::LabelValuePair,_this) = ::flixel::util::LabelValuePair_obj::_pool->get();
HXDLIN( 133) _this->label = HX_("x",78,00,00,00);
HXDLIN( 133) _this->value = value;
HXLINE( 134) ::Dynamic value1 = this->y;
HXDLIN( 134) HX_VARI_NAME( ::flixel::util::LabelValuePair,_this1,"_this") = ::flixel::util::LabelValuePair_obj::_pool->get();
HXDLIN( 134) _this1->label = HX_("y",79,00,00,00);
HXDLIN( 134) _this1->value = value1;
HXLINE( 132) return ::flixel::util::FlxStringUtil_obj::getDebugString(::Array_obj< ::Dynamic>::__new(2)->init(0,_this)->init(1,_this1));
}
HX_DEFINE_DYNAMIC_FUNC0(FlxPointer_obj,toString,return )
void FlxPointer_obj::updatePositions(){
HX_STACK_FRAME("flixel.input.FlxPointer","updatePositions",0xb47050b4,"flixel.input.FlxPointer.updatePositions","flixel/input/FlxPointer.hx",142,0xe6a2529b)
HX_STACK_THIS(this)
HXLINE( 143) HX_VARI( ::flixel::math::FlxPoint,screenPosition) = this->getScreenPosition(null(),null());
HXLINE( 144) this->screenX = ::Std_obj::_hx_int(screenPosition->x);
HXLINE( 145) this->screenY = ::Std_obj::_hx_int(screenPosition->y);
HXLINE( 146) screenPosition->put();
HXLINE( 148) HX_VARI( ::flixel::math::FlxPoint,worldPosition) = this->getWorldPosition(null(),null());
HXLINE( 149) this->x = ::Std_obj::_hx_int(worldPosition->x);
HXLINE( 150) this->y = ::Std_obj::_hx_int(worldPosition->y);
HXLINE( 151) worldPosition->put();
}
HX_DEFINE_DYNAMIC_FUNC0(FlxPointer_obj,updatePositions,(void))
FlxPointer_obj::FlxPointer_obj()
{
}
hx::Val FlxPointer_obj::__Field(const ::String &inName,hx::PropertyAccess inCallProp)
{
switch(inName.length) {
case 1:
if (HX_FIELD_EQ(inName,"x") ) { return hx::Val( x); }
if (HX_FIELD_EQ(inName,"y") ) { return hx::Val( y); }
break;
case 7:
if (HX_FIELD_EQ(inName,"screenX") ) { return hx::Val( screenX); }
if (HX_FIELD_EQ(inName,"screenY") ) { return hx::Val( screenY); }
break;
case 8:
if (HX_FIELD_EQ(inName,"overlaps") ) { return hx::Val( overlaps_dyn()); }
if (HX_FIELD_EQ(inName,"toString") ) { return hx::Val( toString_dyn()); }
break;
case 11:
if (HX_FIELD_EQ(inName,"getPosition") ) { return hx::Val( getPosition_dyn()); }
break;
case 14:
if (HX_FIELD_EQ(inName,"_globalScreenX") ) { return hx::Val( _globalScreenX); }
if (HX_FIELD_EQ(inName,"_globalScreenY") ) { return hx::Val( _globalScreenY); }
break;
case 15:
if (HX_FIELD_EQ(inName,"updatePositions") ) { return hx::Val( updatePositions_dyn()); }
break;
case 16:
if (HX_FIELD_EQ(inName,"getWorldPosition") ) { return hx::Val( getWorldPosition_dyn()); }
break;
case 17:
if (HX_FIELD_EQ(inName,"getScreenPosition") ) { return hx::Val( getScreenPosition_dyn()); }
break;
case 29:
if (HX_FIELD_EQ(inName,"setGlobalScreenPositionUnsafe") ) { return hx::Val( setGlobalScreenPositionUnsafe_dyn()); }
}
return super::__Field(inName,inCallProp);
}
hx::Val FlxPointer_obj::__SetField(const ::String &inName,const hx::Val &inValue,hx::PropertyAccess inCallProp)
{
switch(inName.length) {
case 1:
if (HX_FIELD_EQ(inName,"x") ) { x=inValue.Cast< Int >(); return inValue; }
if (HX_FIELD_EQ(inName,"y") ) { y=inValue.Cast< Int >(); return inValue; }
break;
case 7:
if (HX_FIELD_EQ(inName,"screenX") ) { screenX=inValue.Cast< Int >(); return inValue; }
if (HX_FIELD_EQ(inName,"screenY") ) { screenY=inValue.Cast< Int >(); return inValue; }
break;
case 14:
if (HX_FIELD_EQ(inName,"_globalScreenX") ) { _globalScreenX=inValue.Cast< Int >(); return inValue; }
if (HX_FIELD_EQ(inName,"_globalScreenY") ) { _globalScreenY=inValue.Cast< Int >(); return inValue; }
}
return super::__SetField(inName,inValue,inCallProp);
}
void FlxPointer_obj::__GetFields(Array< ::String> &outFields)
{
outFields->push(HX_HCSTRING("x","\x78","\x00","\x00","\x00"));
outFields->push(HX_HCSTRING("y","\x79","\x00","\x00","\x00"));
outFields->push(HX_HCSTRING("screenX","\x6c","\xc3","\x36","\x2a"));
outFields->push(HX_HCSTRING("screenY","\x6d","\xc3","\x36","\x2a"));
outFields->push(HX_HCSTRING("_globalScreenX","\x8a","\xec","\xc1","\x8e"));
outFields->push(HX_HCSTRING("_globalScreenY","\x8b","\xec","\xc1","\x8e"));
super::__GetFields(outFields);
};
#if HXCPP_SCRIPTABLE
static hx::StorageInfo FlxPointer_obj_sMemberStorageInfo[] = {
{hx::fsInt,(int)offsetof(FlxPointer_obj,x),HX_HCSTRING("x","\x78","\x00","\x00","\x00")},
{hx::fsInt,(int)offsetof(FlxPointer_obj,y),HX_HCSTRING("y","\x79","\x00","\x00","\x00")},
{hx::fsInt,(int)offsetof(FlxPointer_obj,screenX),HX_HCSTRING("screenX","\x6c","\xc3","\x36","\x2a")},
{hx::fsInt,(int)offsetof(FlxPointer_obj,screenY),HX_HCSTRING("screenY","\x6d","\xc3","\x36","\x2a")},
{hx::fsInt,(int)offsetof(FlxPointer_obj,_globalScreenX),HX_HCSTRING("_globalScreenX","\x8a","\xec","\xc1","\x8e")},
{hx::fsInt,(int)offsetof(FlxPointer_obj,_globalScreenY),HX_HCSTRING("_globalScreenY","\x8b","\xec","\xc1","\x8e")},
{ hx::fsUnknown, 0, null()}
};
static hx::StaticInfo *FlxPointer_obj_sStaticStorageInfo = 0;
#endif
static ::String FlxPointer_obj_sMemberFields[] = {
HX_HCSTRING("x","\x78","\x00","\x00","\x00"),
HX_HCSTRING("y","\x79","\x00","\x00","\x00"),
HX_HCSTRING("screenX","\x6c","\xc3","\x36","\x2a"),
HX_HCSTRING("screenY","\x6d","\xc3","\x36","\x2a"),
HX_HCSTRING("_globalScreenX","\x8a","\xec","\xc1","\x8e"),
HX_HCSTRING("_globalScreenY","\x8b","\xec","\xc1","\x8e"),
HX_HCSTRING("getWorldPosition","\xa5","\x3e","\x0b","\xe6"),
HX_HCSTRING("getScreenPosition","\x6b","\x93","\x88","\x24"),
HX_HCSTRING("getPosition","\x5f","\x63","\xee","\xf0"),
HX_HCSTRING("overlaps","\x0c","\xd3","\x2a","\x45"),
HX_HCSTRING("setGlobalScreenPositionUnsafe","\x80","\x95","\xb5","\x56"),
HX_HCSTRING("toString","\xac","\xd0","\x6e","\x38"),
HX_HCSTRING("updatePositions","\x61","\xc4","\xdc","\x1f"),
::String(null()) };
static void FlxPointer_obj_sMarkStatics(HX_MARK_PARAMS) {
HX_MARK_MEMBER_NAME(FlxPointer_obj::__mClass,"__mClass");
};
#ifdef HXCPP_VISIT_ALLOCS
static void FlxPointer_obj_sVisitStatics(HX_VISIT_PARAMS) {
HX_VISIT_MEMBER_NAME(FlxPointer_obj::__mClass,"__mClass");
};
#endif
hx::Class FlxPointer_obj::__mClass;
void FlxPointer_obj::__register()
{
hx::Static(__mClass) = new hx::Class_obj();
__mClass->mName = HX_HCSTRING("flixel.input.FlxPointer","\xc1","\xd6","\x8e","\xc2");
__mClass->mSuper = &super::__SGetClass();
__mClass->mConstructEmpty = &__CreateEmpty;
__mClass->mConstructArgs = &__Create;
__mClass->mGetStaticField = &hx::Class_obj::GetNoStaticField;
__mClass->mSetStaticField = &hx::Class_obj::SetNoStaticField;
__mClass->mMarkFunc = FlxPointer_obj_sMarkStatics;
__mClass->mStatics = hx::Class_obj::dupFunctions(0 /* sStaticFields */);
__mClass->mMembers = hx::Class_obj::dupFunctions(FlxPointer_obj_sMemberFields);
__mClass->mCanCast = hx::TCanCast< FlxPointer_obj >;
#ifdef HXCPP_VISIT_ALLOCS
__mClass->mVisitFunc = FlxPointer_obj_sVisitStatics;
#endif
#ifdef HXCPP_SCRIPTABLE
__mClass->mMemberStorageInfo = FlxPointer_obj_sMemberStorageInfo;
#endif
#ifdef HXCPP_SCRIPTABLE
__mClass->mStaticStorageInfo = FlxPointer_obj_sStaticStorageInfo;
#endif
hx::_hx_RegisterClass(__mClass->mName, __mClass);
}
} // end namespace flixel
} // end namespace input
| 42.949735 | 197 | 0.698429 | TinyPlanetStudios |
17c6fa1fccbb51a85c36ec50a1cfaed05e5b9793 | 4,975 | cxx | C++ | src/Command.cxx | vlad-korneev/virgil-cli | 3077f9f8d0c474265a1888cac8dd65a89becff5a | [
"BSD-3-Clause"
] | 1 | 2019-03-28T16:47:29.000Z | 2019-03-28T16:47:29.000Z | src/Command.cxx | vlad-korneev/virgil-cli | 3077f9f8d0c474265a1888cac8dd65a89becff5a | [
"BSD-3-Clause"
] | null | null | null | src/Command.cxx | vlad-korneev/virgil-cli | 3077f9f8d0c474265a1888cac8dd65a89becff5a | [
"BSD-3-Clause"
] | null | null | null | /**
* Copyright (C) 2015-2017 Virgil Security Inc.
*
* Lead Maintainer: Virgil Security Inc. <support@virgilsecurity.com>
*
* 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 AUTHOR ''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 AUTHOR 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 <cli/command/Command.h>
#include <cli/error/ArgumentError.h>
#include <cli/error/ExitError.h>
#include <cli/api/Version.h>
#include <cli/io/Logger.h>
#include <cli/argument/ArgumentParseOptions.h>
#include <virgil/crypto/VirgilCryptoException.h>
#include <virgil/crypto/VirgilCryptoError.h>
#include <virgil/sdk/VirgilSdkException.h>
#include <iostream>
using cli::argument::ArgumentIO;
using cli::argument::ArgumentSource;
using cli::command::Command;
using cli::argument::ArgumentParseOptions;
using virgil::crypto::VirgilCryptoException;
using virgil::crypto::VirgilCryptoError;
using virgil::sdk::VirgilSdkException;
static std::string buildErrorMessage(const VirgilCryptoException& exception) {
if (exception.condition().category() == virgil::crypto::crypto_category()) {
switch(static_cast<VirgilCryptoError>(exception.condition().value())) {
case VirgilCryptoError::NotFoundPasswordRecipient:
return "Recipient password mismatch.";
case VirgilCryptoError::NotFoundKeyRecipient:
return "Recipient private key mismatch or alias mismatch.";
default:
break;
}
}
if (VLOG_IS_ON(1)) {
return exception.what();
} else {
return exception.condition().message();
}
}
static std::string buildErrorMessage(const VirgilSdkException& exception) {
std::string message(exception.what());
if (message.find("HTTP Code: 404") != std::string::npos) {
//TODO: Change this hot-fix when service will support informative message for this case.
return exception.condition().message() + " Requested entity is not found.";
} else {
return exception.what();
}
}
Command::Command(std::shared_ptr<argument::ArgumentIO> argumentIO) : argumentIO_(argumentIO) {
DCHECK(argumentIO_);
}
const char* Command::getName() const {
return doGetName();
}
const char* Command::getUsage() const {
return doGetUsage();
}
std::shared_ptr<ArgumentIO> Command::getArgumentIO() const {
return argumentIO_;
}
ArgumentParseOptions Command::getArgumentParseOptions() const {
return doGetArgumentParseOptions();
}
void Command::process() {
LOG(INFO) << "Start process command:" << getName();
try {
getArgumentIO()->configureUsage(getUsage(), getArgumentParseOptions());
doProcess();
} catch (const error::ArgumentShowUsageError&) {
showUsage();
} catch (const error::ArgumentShowVersionError&) {
showVersion();
} catch (const error::ArgumentRuntimeError& error) {
showUsage(error.what());
} catch (const VirgilCryptoException& exception) {
LOG(FATAL) << exception.what();
showUsage(buildErrorMessage(exception).c_str());
} catch (const VirgilSdkException& exception) {
LOG(FATAL) << exception.what();
showUsage(buildErrorMessage(exception).c_str());
}
}
void Command::showUsage(const char* errorMessage) const {
if (errorMessage != nullptr && strlen(errorMessage) != 0) {
ULOG(FATAL) << errorMessage;
if (VLOG_IS_ON(1)) {
std::cout << getUsage();
}
throw error::ExitFailure();
}
std::cout << getUsage();
}
void Command::showVersion() const {
std::cout << api::Version::cliVersion();
}
| 35.035211 | 96 | 0.697085 | vlad-korneev |
17cc76921f2b7b92731d820df3de35b410b1154f | 469 | cpp | C++ | LazyEngine/LazyEngine/src/LazyEngine/Renderer/RendererAPI.cpp | PhiliGuertler/ManifoldDMC | d9740e17ebadce0320f7cfb7dbb1cd728119a8ab | [
"MIT"
] | null | null | null | LazyEngine/LazyEngine/src/LazyEngine/Renderer/RendererAPI.cpp | PhiliGuertler/ManifoldDMC | d9740e17ebadce0320f7cfb7dbb1cd728119a8ab | [
"MIT"
] | null | null | null | LazyEngine/LazyEngine/src/LazyEngine/Renderer/RendererAPI.cpp | PhiliGuertler/ManifoldDMC | d9740e17ebadce0320f7cfb7dbb1cd728119a8ab | [
"MIT"
] | null | null | null | // ######################################################################### //
// ### RendererAPI.cpp ##################################################### //
// ### initializes static members of the class RendererAPI. ### //
// ######################################################################### //
#include "LazyEngine/gepch.h"
#include "RendererAPI.h"
namespace LazyEngine {
RendererAPI::API RendererAPI::s_API = RendererAPI::API::OpenGL;
} | 33.5 | 79 | 0.362473 | PhiliGuertler |
17ce14021a20cc1cd4702a68f4eb6754f2db815e | 1,929 | cpp | C++ | test/http/router.cpp | DoumanAsh/gomibako.cpp | 9bf49402a7d83e6d46c98737c0d1dffe14442e53 | [
"Apache-2.0"
] | null | null | null | test/http/router.cpp | DoumanAsh/gomibako.cpp | 9bf49402a7d83e6d46c98737c0d1dffe14442e53 | [
"Apache-2.0"
] | null | null | null | test/http/router.cpp | DoumanAsh/gomibako.cpp | 9bf49402a7d83e6d46c98737c0d1dffe14442e53 | [
"Apache-2.0"
] | null | null | null | #include "../../src/http/router.hpp"
#include <boost/test/unit_test.hpp>
void dummy_callback(http::Router::Context&&) {
}
BOOST_AUTO_TEST_CASE(should_match_root_route) {
const http::Router::Route route("/", dummy_callback);
auto result = route.match("/");
BOOST_REQUIRE(result.has_value());
BOOST_REQUIRE_EQUAL(result->size(), 0);
result = route.match("/some");
BOOST_REQUIRE_EQUAL(result.has_value(), false);
}
BOOST_AUTO_TEST_CASE(should_match_ip) {
const http::Router::Route route("/ip", dummy_callback);
auto result = route.match("/ip");
BOOST_REQUIRE(result.has_value());
BOOST_REQUIRE_EQUAL(result->size(), 0);
result = route.match("/ip/");
BOOST_REQUIRE(result.has_value());
BOOST_REQUIRE_EQUAL(result->size(), 0);
}
BOOST_AUTO_TEST_CASE(should_capture_comp) {
const http::Router::Route route("/:path", dummy_callback);
auto result = route.match("/");
BOOST_REQUIRE_EQUAL(result.has_value(), false);
result = route.match("/some");
BOOST_REQUIRE(result.has_value());
BOOST_REQUIRE_EQUAL(result->size(), 1);
BOOST_REQUIRE_EQUAL(result->at("path"), "some");
result = route.match("/some/");
BOOST_REQUIRE(result.has_value());
BOOST_REQUIRE_EQUAL(result->size(), 1);
BOOST_REQUIRE_EQUAL(result->at("path"), "some");
}
BOOST_AUTO_TEST_CASE(should_capture_multiple_comp) {
const http::Router::Route route("/:path/second/:third", dummy_callback);
auto result = route.match("/some/second/3");
BOOST_REQUIRE(result.has_value());
BOOST_REQUIRE_EQUAL(result->size(), 2);
BOOST_REQUIRE_EQUAL(result->at("path"), "some");
BOOST_REQUIRE_EQUAL(result->at("third"), "3");
result = route.match("/some/second/3/");
BOOST_REQUIRE(result.has_value());
BOOST_REQUIRE_EQUAL(result->size(), 2);
BOOST_REQUIRE_EQUAL(result->at("path"), "some");
BOOST_REQUIRE_EQUAL(result->at("third"), "3");
}
| 31.622951 | 76 | 0.682219 | DoumanAsh |
17cea83e12b8c504151851059f28752b903ae740 | 783 | cpp | C++ | net/rras/cm/customactions/cmsample/main.cpp | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | net/rras/cm/customactions/cmsample/main.cpp | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | net/rras/cm/customactions/cmsample/main.cpp | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | //+----------------------------------------------------------------------------
//
// File: main.cpp
//
// Module: CMSAMPLE.DLL
//
// Synopsis: Main entry point for cmsample.dll
//
// Copyright (c) 2000 Microsoft Corporation
//
//+----------------------------------------------------------------------------
#include <windows.h>
extern "C" BOOL WINAPI DllMain(
HINSTANCE hinstDLL, // handle to DLL module
DWORD fdwReason, // reason for calling function
LPVOID lpvReserved // reserved
)
{
if (fdwReason == DLL_PROCESS_ATTACH)
{
//
// Disable the DLL_THREAD_ATTACH notification calls.
//
if (DisableThreadLibraryCalls(hinstDLL) == 0)
{
return FALSE;
}
}
return TRUE;
} | 23.727273 | 80 | 0.464879 | npocmaka |
17cee722749d6a4f020bbc699f11f2fd76d934da | 627 | cpp | C++ | compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_path_test.cpp | mkinsner/llvm | 589d48844edb12cd357b3024248b93d64b6760bf | [
"Apache-2.0"
] | 2,338 | 2018-06-19T17:34:51.000Z | 2022-03-31T11:00:37.000Z | compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_path_test.cpp | mkinsner/llvm | 589d48844edb12cd357b3024248b93d64b6760bf | [
"Apache-2.0"
] | 3,740 | 2019-01-23T15:36:48.000Z | 2022-03-31T22:01:13.000Z | compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_path_test.cpp | mkinsner/llvm | 589d48844edb12cd357b3024248b93d64b6760bf | [
"Apache-2.0"
] | 500 | 2019-01-23T07:49:22.000Z | 2022-03-30T02:59:37.000Z | // Test __sanitizer_set_report_path and __sanitizer_get_report_path:
// RUN: %clangxx -O2 %s -o %t
// RUN: %run %t | FileCheck %s
#include <assert.h>
#include <sanitizer/common_interface_defs.h>
#include <stdio.h>
#include <string.h>
volatile int *null = 0;
int main(int argc, char **argv) {
char buff[1000];
sprintf(buff, "%s.report_path/report", argv[0]);
__sanitizer_set_report_path(buff);
assert(strncmp(buff, __sanitizer_get_report_path(), strlen(buff)) == 0);
printf("Path %s\n", __sanitizer_get_report_path());
}
// CHECK: Path {{.*}}Posix/Output/sanitizer_set_report_path_test.cpp.tmp.report_path/report.
| 29.857143 | 92 | 0.724083 | mkinsner |
17d0c2b0d93c008e0fddc20dc66a8b8026c1ac93 | 288 | cpp | C++ | ftpserver/src/Request.cpp | aminst/ftp-server | ca019e21b14cdf41346be3328640064b865b136f | [
"MIT"
] | 1 | 2021-04-09T14:32:51.000Z | 2021-04-09T14:32:51.000Z | ftpserver/src/Request.cpp | aminst/ftp-server | ca019e21b14cdf41346be3328640064b865b136f | [
"MIT"
] | null | null | null | ftpserver/src/Request.cpp | aminst/ftp-server | ca019e21b14cdf41346be3328640064b865b136f | [
"MIT"
] | 1 | 2021-04-09T14:32:53.000Z | 2021-04-09T14:32:53.000Z | #include "Request.hpp"
using namespace std;
Request::Request(const string& command, const vector<string>& arguments)
: command(command), arguments(arguments)
{
}
string Request::get_command()
{
return command;
}
vector<string> Request::get_arguments()
{
return arguments;
} | 16.941176 | 72 | 0.722222 | aminst |
17d27390577f04708684c1005726087fcc460077 | 1,015 | cpp | C++ | src/SceneManager.cpp | paolo-projects/TouchCPLib | ee37fcf0cdbce67dc3392ab5a65c6a2c4ab09303 | [
"BSD-2-Clause"
] | 2 | 2021-07-19T02:23:20.000Z | 2021-11-19T16:58:38.000Z | src/SceneManager.cpp | paolo-projects/TouchCPLib | ee37fcf0cdbce67dc3392ab5a65c6a2c4ab09303 | [
"BSD-2-Clause"
] | null | null | null | src/SceneManager.cpp | paolo-projects/TouchCPLib | ee37fcf0cdbce67dc3392ab5a65c6a2c4ab09303 | [
"BSD-2-Clause"
] | null | null | null | #include "TouchCP/SceneManager.h"
SceneManager::SceneManager()
{
}
void SceneManager::setCurrentScene(std::string sceneName)
{
if (registeredScenes.find(sceneName) != registeredScenes.end())
{
currentScene = registeredScenes[sceneName];
}
}
GraphicsScene *SceneManager::getCurrentScene()
{
return currentScene;
}
void SceneManager::registerScene(const std::string &sceneName, GraphicsScene *scene)
{
if (registeredScenes.find(sceneName) != registeredScenes.end())
{
registeredScenes.erase(sceneName);
}
registeredScenes.insert(std::make_pair(sceneName, scene));
}
void SceneManager::unregisterScene(const std::string &sceneName)
{
if (registeredScenes.find(sceneName) != registeredScenes.end())
{
registeredScenes.erase(sceneName);
}
}
void SceneManager::unregisterScene(GraphicsScene *scene)
{
for (auto it = registeredScenes.begin(); it != registeredScenes.end(); it++)
{
if (it->second == scene)
{
registeredScenes.erase(it);
break;
}
}
}
SceneManager::~SceneManager()
{
}
| 19.519231 | 84 | 0.734975 | paolo-projects |
17d3005c6c0d2bcb7425b889152603d21149318d | 3,339 | cpp | C++ | tests/validate_email_test.cpp | beached/validate_email | 2b08876ede9ad01ac43f1d0a7110d2150a9b5a72 | [
"MIT"
] | null | null | null | tests/validate_email_test.cpp | beached/validate_email | 2b08876ede9ad01ac43f1d0a7110d2150a9b5a72 | [
"MIT"
] | null | null | null | tests/validate_email_test.cpp | beached/validate_email | 2b08876ede9ad01ac43f1d0a7110d2150a9b5a72 | [
"MIT"
] | null | null | null | // The MIT License (MIT)
//
// Copyright (c) 2016-2018 Darrell Wright
//
// 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.
#define BOOST_TEST_MODULE validate_email
#include <iostream>
#include <daw/boost_test.h>
#include <daw/daw_string_view.h>
#include <daw/json/daw_json_link.h>
#include <daw/json/daw_json_link_file.h>
#include <daw/puny_coder/puny_coder.h>
#include "validate_email.h"
struct address_tests_t : public daw::json::daw_json_link<address_tests_t> {
struct address_test_t : public daw::json::daw_json_link<address_test_t> {
std::string email_address;
std::string comment;
static void json_link_map( ) {
link_json_string( "email_address", email_address );
link_json_string( "comment", comment );
}
}; // address_test_t
std::vector<address_test_t> tests;
static void json_link_map( ) {
link_json_object_array( "tests", tests );
}
}; // address_tests_t
struct puny_tests_t : public daw::json::daw_json_link<puny_tests_t> {
struct puny_test_t : public daw::json::daw_json_link<puny_test_t> {
std::string in;
std::string out;
static void json_link_map( ) {
link_json_string( "in", in );
link_json_string( "out", out );
}
}; // puny_test_t
std::vector<puny_test_t> tests;
static void json_link_map( ) {
link_json_object_array( "tests", tests );
}
}; // puny_tests_t
bool test_address( daw::string_view address ) {
std::cout << "Testing: " << address.data( );
std::cout << " Puny: " << daw::get_local_part( address ) << "@"
<< daw::to_puny_code( daw::get_domain_part( address ) ) << std::endl;
auto result = daw::is_email_address( address );
return result;
}
BOOST_AUTO_TEST_CASE( good_email_test ) {
std::cout << "\n\nGood email addresses\n";
auto config_data = daw::json::from_file<address_tests_t>( "../good_addresses.json" );
for( auto const &address : config_data.tests ) {
BOOST_REQUIRE_MESSAGE( test_address( address.email_address ), address.comment );
}
std::cout << std::endl;
}
BOOST_AUTO_TEST_CASE( bad_email_test ) {
std::cout << "\nBad email addresses\n";
auto config_data = daw::json::from_file<address_tests_t>( "../bad_addresses.json" );
for( auto const &address : config_data.tests ) {
BOOST_REQUIRE_MESSAGE( !test_address( address.email_address ), address.comment );
}
std::cout << "\n" << std::endl;
}
| 34.78125 | 86 | 0.727463 | beached |
17d4c1a25d08835961e57aacbabf18d04baf20ad | 9,972 | cpp | C++ | src/syllo/catkin_ws/src/syllo_blueview/src/syllo_blueview/Sonar.cpp | toremobjo/VideoRayROS | aa13a6d4f924fbcd7c2b0b2016a7b409b9272d63 | [
"MIT"
] | 6 | 2015-06-17T18:23:27.000Z | 2018-05-14T05:33:24.000Z | src/syllo/catkin_ws/src/syllo_blueview/src/syllo_blueview/Sonar.cpp | toremobjo/VideoRayROS | aa13a6d4f924fbcd7c2b0b2016a7b409b9272d63 | [
"MIT"
] | 1 | 2016-07-01T09:01:17.000Z | 2016-07-02T15:24:15.000Z | src/syllo/catkin_ws/src/syllo_blueview/src/syllo_blueview/Sonar.cpp | toremobjo/VideoRayROS | aa13a6d4f924fbcd7c2b0b2016a7b409b9272d63 | [
"MIT"
] | 10 | 2015-02-20T11:57:42.000Z | 2020-12-20T12:42:54.000Z | #include <iostream>
#include <stdio.h>
#include <unistd.h>
#include <fstream>
#include <syllo_blueview/Sonar.h>
#include <syllo_common/Utils.h>
#if ENABLE_SONAR == 1
#include <bvt_sdk.h>
#endif
using std::cout;
using std::endl;
Sonar::Sonar()
: initialized_(false), fn_(""), ip_addr_(""), logging_(false),
mode_(Sonar::net), data_mode_(Sonar::image), min_range_(0),
max_range_(40), color_map_(""), save_directory_("./")
{
}
Sonar::~Sonar()
{
#if ENABLE_SONAR == 1
if (cimg_) {
BVTColorImage_Destroy(cimg_);
}
if (img_) {
BVTMagImage_Destroy(img_);
}
if (mapper_) {
BVTColorMapper_Destroy(mapper_);
}
if (son_) {
BVTSonar_Destroy(son_);
}
// Close logging file
this->SonarLogEnable(false);
#endif
}
Sonar::Status_t Sonar::init()
{
#if ENABLE_SONAR == 1
logging_ = false;
cur_ping_ = 0;
son_ = BVTSonar_Create();
if (son_ == NULL ) {
printf("BVTSonar_Create: failed\n");
return Sonar::Failure;
}
int ret;
if (mode_ == Sonar::net) {
/////////////////////////////////////////
// Reading from physical sonar
/////////////////////////////////////////
// If the ip address string is set, try to manually connect
// to sonar first.
bool manual_sonar_found = false;
if (ip_addr_ != "" && ip_addr_ != "0.0.0.0") {
ret = BVTSonar_Open(son_, "NET", ip_addr_.c_str());
if( ret != 0 ) {
printf("Couldn't find sonar at defined IP address: %s",
ip_addr_.c_str());
} else {
manual_sonar_found = true;
}
}
if (!manual_sonar_found) {
//Create the discovery agent
BVTSonarDiscoveryAgent agent = BVTSonarDiscoveryAgent_Create();
if( agent == NULL ) {
printf("BVTSonarDiscoverAgent_Create: failed\n");
return Sonar::Failure;
}
// Kick off the discovery process
ret = BVTSonarDiscoveryAgent_Start(agent);
//Let the discovery process run for a short while (5 secs)
cout << "Searching for available sonars..." << endl;
sleep(5);
// See what we found
int numSonars = 0;
numSonars = BVTSonarDiscoveryAgent_GetSonarCount(agent);
char SonarIPAddress[20];
for(int i = 0; i < numSonars; i++) {
ret = BVTSonarDiscoveryAgent_GetSonarInfo(agent, i, &SonarIPAddress[0], 20);
printf("Found Sonar: %d, IP address: %s\n", i, SonarIPAddress);
}
if(numSonars == 0) {
printf("No Sonars Found\n");
return Sonar::Failure;
}
// Open the sonar
//ret = BVTSonar_Open(son_, "NET", "192.168.1.45");
ret = BVTSonar_Open(son_, "NET", SonarIPAddress);
if( ret != 0 ) {
printf("BVTSonar_Open: ret=%d\n", ret);
return Sonar::Failure;
}
}
} else {
/////////////////////////////////////////
// Reading from sonar file
/////////////////////////////////////////
// Open the sonar
ret = BVTSonar_Open(son_, "FILE", fn_.c_str());
if (ret != 0 ) {
printf("BVTSonar_Open: ret=%d\n", ret);
return Sonar::Failure;
}
}
// Make sure we have the right number of heads_
heads_ = -1;
heads_ = BVTSonar_GetHeadCount(son_);
printf("BVTSonar_GetHeadCount: %d\n", heads_);
// Get the first head
head_ = NULL;
ret = BVTSonar_GetHead(son_, 0, &head_);
if (ret != 0 ) {
// Some sonar heads start at 1
ret = BVTSonar_GetHead(son_, 1, &head_);
if (ret != 0) {
printf( "BVTSonar_GetHead: ret=%d\n", ret) ;
return Sonar::Failure;
}
}
// Check the ping count
pings_ = -1;
pings_ = BVTHead_GetPingCount(head_);
printf("BVTHead_GetPingCount: %d\n", pings_);
// Set the range window
this->set_range(min_range_, max_range_);
// Build a color mapper
mapper_ = BVTColorMapper_Create();
if (mapper_ == NULL) {
printf("BVTColorMapper_Create: failed\n");
return Sonar::Failure;
}
// Load the bone colormap
ret = BVTColorMapper_Load(mapper_, color_map_.c_str());
if(ret != 0) {
if (color_map_ == "") {
printf("Color map not set.\n");
}
printf("BVTColorMapper_Load: ret=%d\n", ret);
return Sonar::Failure;
}
initialized_ = true;
return Sonar::Success;
#else
return Sonar::Failure;
#endif
}
int Sonar::getNumPings()
{
return pings_;
}
int Sonar::getCurrentPingNum()
{
return cur_ping_;
}
void Sonar::setFrameNum(int num)
{
cur_ping_ = num;
}
int Sonar::reset()
{
cur_ping_ = 0;
return 0;
}
Sonar::Status_t Sonar::SonarLogEnable(bool enable)
{
// Whether enable is true or false, if we enter the function here,
// we should properly close the current file if currently logging
if (logging_ && son_logger_) {
BVTSonar_Destroy(son_logger_);
}
if (!enable) {
// If logging is disabled, exit.
logging_ = false;
return Sonar::Success;
}
son_logger_ = BVTSonar_Create();
if (son_logger_ == NULL) {
printf("BVTSonar_Create: failed\n");
return Sonar::Failure;
}
// Create the sonar file
cur_log_file_ = save_directory_ + "/" + syllo::get_time_string() + ".son";
int ret = BVTSonar_CreateFile(son_logger_, cur_log_file_.c_str(),
son_, "");
if (ret != 0) {
printf("BVTSonar_CreateFile: ret=%d\n", ret);
return Sonar::Failure;
}
// Get the first head of the file output
out_head_ = NULL ;
ret = BVTSonar_GetHead(son_logger_, 0, &out_head_);
if (ret != 0) {
printf("BVTSonar_GetHead: ret=%d\n" ,ret);
return Sonar::Failure;
}
logging_ = true;
return Sonar::Success;
}
Sonar::Status_t Sonar::getNextSonarImage(cv::Mat &image)
{
Status_t status = Sonar::Failure;
if (mode_ == Sonar::net) {
status = getSonarImage(image, -1);
} else if (cur_ping_ < pings_) {
status = getSonarImage(image, cur_ping_++);
} else {
status = Sonar::Failure;
}
return status;
}
Sonar::Status_t Sonar::getSonarImage(cv::Mat &image, int index)
{
#if ENABLE_SONAR == 1
if (!initialized_) {
cout << "Sonar wasn't initialized." << endl;
return Sonar::Failure;
}
BVTPing ping = NULL;
int ret = BVTHead_GetPing(head_, index, &ping);
if(ret != 0) {
printf("BVTHead_GetPing: ret=%d\n", ret);
return Sonar::Failure;
}
// Logging is enabled, write to file
if (logging_) {
ret = BVTHead_PutPing(out_head_, ping);
if (ret != 0) {
printf("BVTHead_PutPing: ret=%d\n", ret);
return Sonar::Failure;
}
}
ret = BVTPing_GetImage(ping, &img_);
//ret = BVTPing_GetImageXY(ping, &img_);
//ret = BVTPing_GetImageRTheta(ping, &img_);
if (ret != 0) {
printf("BVTPing_GetImage: ret=%d\n", ret);
return Sonar::Failure;
}
// Perform the colormapping
ret = BVTColorMapper_MapImage(mapper_, img_, &cimg_);
if (ret != 0) {
printf("BVTColorMapper_MapImage: ret=%d\n", ret);
return Sonar::Failure;
}
height_ = BVTColorImage_GetHeight(cimg_);
width_ = BVTColorImage_GetWidth(cimg_);
IplImage* sonarImg;
sonarImg = cvCreateImageHeader(cvSize(width_,height_), IPL_DEPTH_8U, 4);
// And set it's data
cvSetImageData(sonarImg, BVTColorImage_GetBits(cimg_), width_*4);
//cv::Mat tempImg(sonarImg);
//cv::Mat tempImg = sonarImg);
//image = sonarImg;
image = cv::cvarrToMat(sonarImg); // opencv3?
cvReleaseImageHeader(&sonarImg);
BVTPing_Destroy(ping);
return Sonar::Success;
#else
return Sonar::Failure;
#endif
}
int Sonar::width()
{
return width_;
}
int Sonar::height()
{
return height_;
}
void Sonar::set_mode(SonarMode_t mode)
{
mode_ = mode;
}
void Sonar::set_data_mode(DataMode_t data_mode)
{
data_mode_ = data_mode;
}
void Sonar::set_ip_addr(const std::string &ip_addr)
{
ip_addr_ = ip_addr;
}
void Sonar::set_input_son_filename(const std::string &fn)
{
fn_ = fn;
}
void Sonar::set_range(double min_range, double max_range)
{
min_range_ = min_range;
max_range_ = max_range;
if (min_range_ < 0 || min_range_ > max_range_ ) {
min_range = 0;
}
if (max_range_ < 0 || max_range_ <= min_range_+1) {
max_range_ = min_range_ + 2;
}
BVTHead_SetRange(head_, min_range_, max_range_);
}
void Sonar::set_min_range(double min_range)
{
this->set_range(min_range, max_range_);
}
void Sonar::set_max_range(double max_range)
{
this->set_range(min_range_, max_range);
}
void Sonar::set_color_map(const std::string &color_map)
{
color_map_ = color_map;
}
void Sonar::set_save_directory(const std::string &save_directory)
{
save_directory_ = save_directory;
}
const std::string& Sonar::current_sonar_file()
{
return cur_log_file_;
}
| 25.309645 | 96 | 0.5356 | toremobjo |
17d54356096393f228721efe594100ff244ad159 | 2,260 | cpp | C++ | Sources/Core/Components/Renderer.cpp | alelievr/LWGEngine | 655ed35350206401e20bc2fe6063574e1ede603f | [
"MIT"
] | 3 | 2019-09-05T12:49:14.000Z | 2020-06-08T00:13:49.000Z | Sources/Core/Components/Renderer.cpp | alelievr/LWGEngine | 655ed35350206401e20bc2fe6063574e1ede603f | [
"MIT"
] | 4 | 2018-12-16T15:39:19.000Z | 2019-03-23T20:29:26.000Z | Sources/Core/Components/Renderer.cpp | alelievr/LWGEngine | 655ed35350206401e20bc2fe6063574e1ede603f | [
"MIT"
] | 2 | 2020-06-08T00:13:55.000Z | 2021-12-12T10:10:20.000Z | #include "Renderer.hpp"
#include "Core/PrimitiveMeshFactory.hpp"
#include "Core/Hierarchy.hpp"
#include "Core/Rendering/RenderPipeline.hpp"
#include "Core/Vulkan/VulkanInstance.hpp"
#include "Utils/Vector.hpp"
#include "Core/Application.hpp"
#include "IncludeDeps.hpp"
#include GLM_INCLUDE
using namespace LWGC;
Renderer::Renderer(void)
{
_material = Material::Create();
}
Renderer::Renderer(Material * material)
{
_material = material;
}
Renderer::~Renderer(void)
{
vkDestroyBuffer(device, _uniformModelBuffer.buffer, nullptr);
vkFreeMemory(device, _uniformModelBuffer.memory, nullptr);
}
void Renderer::Initialize(void) noexcept
{
Component::Initialize();
_material->MarkAsReady();
Vk::CreateBuffer(
sizeof(LWGC_PerObject),
VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
_uniformModelBuffer.buffer,
_uniformModelBuffer.memory
);
_perRendererSet.AddBinding(0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, _uniformModelBuffer.buffer, sizeof(LWGC_PerObject));
}
void Renderer::Update(void) noexcept
{
// TODO: check for transform changes before to reupload the uniform datas
UpdateUniformData();
}
void Renderer::UpdateUniformData(void)
{
_perObject.model = transform->GetLocalToWorldMatrix();
// Transpose for HLSL
_perObject.model = glm::transpose(_perObject.model);
Vk::UploadToMemory(_uniformModelBuffer.memory, &_perObject, sizeof(_perObject));
}
Bounds Renderer::GetBounds(void) noexcept
{
return Bounds();
}
void Renderer::OnEnable() noexcept
{
Component::OnEnable();
_renderContextIndex = hierarchy->RegisterComponentInRenderContext(GetType(), this);
}
void Renderer::OnDisable() noexcept
{
Component::OnDisable();
hierarchy->UnregisterComponentInRenderContext(GetType(), _renderContextIndex);
}
void Renderer::RecordCommands(VkCommandBuffer cmd)
{
RecordDrawCommand(cmd);
}
Material * Renderer::GetMaterial(void) { return (this->_material); }
void Renderer::SetMaterial(Material * tmp) { this->_material = tmp; }
VkDescriptorSet Renderer::GetDescriptorSet(void) { return _perRendererSet.GetDescriptorSet(); }
std::ostream & operator<<(std::ostream & o, Renderer const & r)
{
o << "Renderer" << std::endl;
(void)r;
return (o);
}
| 23.541667 | 118 | 0.766814 | alelievr |
17d83130a9b4941b3ce231c2f58eb493f815ce45 | 2,600 | hh | C++ | KalmanTrack/KalPairConduit.hh | brownd1978/FastSim | 05f590d72d8e7f71856fd833114a38b84fc7fd48 | [
"Apache-2.0"
] | null | null | null | KalmanTrack/KalPairConduit.hh | brownd1978/FastSim | 05f590d72d8e7f71856fd833114a38b84fc7fd48 | [
"Apache-2.0"
] | null | null | null | KalmanTrack/KalPairConduit.hh | brownd1978/FastSim | 05f590d72d8e7f71856fd833114a38b84fc7fd48 | [
"Apache-2.0"
] | null | null | null | //--------------------------------------------------------------------------
// File and Version Information:
// $Id: KalPairConduit.hh,v 1.5 2001/10/17 14:55:17 steinke Exp $
//
// Description:
//
//
// Environment:
// Software developed for the BaBar Detector at the SLAC B-Factory.
//
// Author(s): Doug Roberts
//
//------------------------------------------------------------------------
#ifndef KALPAIRCONDUIT_HH
#define KALPAIRCONDUIT_HH
#include "BbrGeom/BbrDoubleErr.hh"
#include "BbrGeom/BbrVectorErr.hh"
#include "KalmanTrack/KalPairRep.hh"
#include "KalmanTrack/KalPairSite.hh"
#include "KalmanTrack/KalParams.hh"
// Class interface //
class KalPairConduit {
friend class KalPairRep;
friend class KalPairSite;
public:
enum repId {plusRep=0, minusRep};
KalPairConduit(const TrkDifPieceTraj& plusTraj ,
const TrkDifPieceTraj& minusTraj,
const BbrVectorErr& beamMom);
~KalPairConduit();
// bool updateConstraints();
bool converged() const {return _converged;}
int iterations() const {return _niter;}
BbrPointErr prodPoint() const {return _prodPoint;}
double prodPointChi2() const {return _prodPointChi2;}
protected:
private:
// Keep links to KalPairReps and KalPairSites
KalPairRep* _reps[2];
KalPairSite* _sites[2];
int _nreps;
int _nsites;
int _niter;
KalPairRep* otherPairRep(KalPairRep* rep);
BbrDoubleErr _plusFltLen;
BbrDoubleErr _minusFltLen;
BbrPointErr _prodPoint;
double _prodPointChi2;
bool _converged;
bool _needsUpdate;
// Beam momentum used in the constraint
BbrVectorErr _beamMom;
// Actual constraints to be used by KalPairSites
KalParams* _constraintPar[2];
KalParams* _inwardPar[2];
double _fltlens[2];
bool _siteLAM[2];
// Functions
void calcProdPoint();
bool updateConstraints();
TrkErrCode coordinateFit();
void killedBy(KalPairRep* thisRep);
int thisRepIndex(KalPairRep* thisRep);
int otherRepIndex(KalPairRep* thisRep);
int thisSiteIndex(KalPairSite* site);
void addRep(KalPairRep* newRep);
void addSite(KalPairSite* newSite, KalPairRep* rep);
double getFltLen(KalPairRep* thisRep);
double getFltLen(KalPairSite* thisSite);
double getFltChi2(KalPairRep* thisRep);
double getFltChi2(KalPairSite* thisSite);
KalParams getConstraint(KalPairRep* thisRep);
KalParams getConstraint(KalPairSite* thisSite);
bool checkLAM(KalPairSite* site);
void uploadParams(const KalParams& params, KalPairSite* site);
// Preempt
KalPairConduit& operator= (const KalPairConduit&);
KalPairConduit(const KalPairConduit &);
};
#endif
| 23.214286 | 76 | 0.696923 | brownd1978 |
17d8c6d7baf6ce70c546f7ea9ab809a75b0a8d74 | 128 | cpp | C++ | DaVinskky Engine/Source/R_Material.cpp | Vinskky/DaVinskky_Engine | a9d46847d72ad20287e415cc8fd63b6f875bba4e | [
"MIT"
] | null | null | null | DaVinskky Engine/Source/R_Material.cpp | Vinskky/DaVinskky_Engine | a9d46847d72ad20287e415cc8fd63b6f875bba4e | [
"MIT"
] | null | null | null | DaVinskky Engine/Source/R_Material.cpp | Vinskky/DaVinskky_Engine | a9d46847d72ad20287e415cc8fd63b6f875bba4e | [
"MIT"
] | null | null | null | #include "R_Material.h"
R_Material::R_Material()
{
diffuseColor = { 1.0f,1.0f, 1.0f, 1.0f };
}
R_Material::~R_Material()
{
}
| 11.636364 | 42 | 0.640625 | Vinskky |
17d9067465f290a1451c0c5f5672942feb9736e2 | 163 | hpp | C++ | modules/xfeatures2d/misc/python/pyopencv_xfeatures2d.hpp | Nondzu/opencv_contrib | 0b0616a25d4239ee81fda965818b49b721620f56 | [
"BSD-3-Clause"
] | 7,158 | 2016-07-04T22:19:27.000Z | 2022-03-31T07:54:32.000Z | modules/xfeatures2d/misc/python/pyopencv_xfeatures2d.hpp | Nondzu/opencv_contrib | 0b0616a25d4239ee81fda965818b49b721620f56 | [
"BSD-3-Clause"
] | 2,184 | 2016-07-05T12:04:14.000Z | 2022-03-30T19:10:12.000Z | modules/xfeatures2d/misc/python/pyopencv_xfeatures2d.hpp | Nondzu/opencv_contrib | 0b0616a25d4239ee81fda965818b49b721620f56 | [
"BSD-3-Clause"
] | 5,535 | 2016-07-06T12:01:10.000Z | 2022-03-31T03:13:24.000Z | #ifdef HAVE_OPENCV_XFEATURES2D
#include "opencv2/xfeatures2d.hpp"
using cv::xfeatures2d::DAISY;
typedef DAISY::NormalizationType DAISY_NormalizationType;
#endif
| 20.375 | 57 | 0.834356 | Nondzu |
17dd253005111da6fda99dbd7f56f74e22abdc44 | 4,477 | cc | C++ | src/traced/probes/filesystem/file_scanner.cc | jumeder/perfetto | df3ae5e6f975204d2f35aeed61cbbd0746151d8e | [
"Apache-2.0"
] | 933 | 2019-12-10T10:45:28.000Z | 2022-03-31T03:43:44.000Z | src/traced/probes/filesystem/file_scanner.cc | jumeder/perfetto | df3ae5e6f975204d2f35aeed61cbbd0746151d8e | [
"Apache-2.0"
] | 252 | 2019-12-10T16:13:57.000Z | 2022-03-31T09:56:46.000Z | src/traced/probes/filesystem/file_scanner.cc | jumeder/perfetto | df3ae5e6f975204d2f35aeed61cbbd0746151d8e | [
"Apache-2.0"
] | 153 | 2020-01-08T20:17:27.000Z | 2022-03-30T20:53:21.000Z | /*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "src/traced/probes/filesystem/file_scanner.h"
#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "protos/perfetto/trace/filesystem/inode_file_map.pbzero.h"
#include "src/traced/probes/filesystem/inode_file_data_source.h"
namespace perfetto {
namespace {
std::string JoinPaths(const std::string& one, const std::string& other) {
std::string result;
result.reserve(one.size() + other.size() + 1);
result += one;
if (!result.empty() && result.back() != '/')
result += '/';
result += other;
return result;
}
} // namespace
FileScanner::FileScanner(std::vector<std::string> root_directories,
Delegate* delegate,
uint32_t scan_interval_ms,
uint32_t scan_steps)
: delegate_(delegate),
scan_interval_ms_(scan_interval_ms),
scan_steps_(scan_steps),
queue_(std::move(root_directories)),
weak_factory_(this) {}
FileScanner::FileScanner(std::vector<std::string> root_directories,
Delegate* delegate)
: FileScanner(std::move(root_directories),
delegate,
0 /* scan_interval_ms */,
0 /* scan_steps */) {}
void FileScanner::Scan() {
while (!Done())
Step();
delegate_->OnInodeScanDone();
}
void FileScanner::Scan(base::TaskRunner* task_runner) {
PERFETTO_DCHECK(scan_interval_ms_ && scan_steps_);
Steps(scan_steps_);
if (Done())
return delegate_->OnInodeScanDone();
auto weak_this = weak_factory_.GetWeakPtr();
task_runner->PostDelayedTask(
[weak_this, task_runner] {
if (!weak_this)
return;
weak_this->Scan(task_runner);
},
scan_interval_ms_);
}
void FileScanner::NextDirectory() {
std::string directory = std::move(queue_.back());
queue_.pop_back();
current_dir_handle_.reset(opendir(directory.c_str()));
if (!current_dir_handle_) {
PERFETTO_DPLOG("opendir %s", directory.c_str());
current_directory_.clear();
return;
}
current_directory_ = std::move(directory);
struct stat buf;
if (fstat(dirfd(current_dir_handle_.get()), &buf) != 0) {
PERFETTO_DPLOG("fstat %s", current_directory_.c_str());
current_dir_handle_.reset();
current_directory_.clear();
return;
}
if (S_ISLNK(buf.st_mode)) {
current_dir_handle_.reset();
current_directory_.clear();
return;
}
current_block_device_id_ = buf.st_dev;
}
void FileScanner::Step() {
if (!current_dir_handle_) {
if (queue_.empty())
return;
NextDirectory();
}
if (!current_dir_handle_)
return;
struct dirent* entry = readdir(current_dir_handle_.get());
if (entry == nullptr) {
current_dir_handle_.reset();
return;
}
std::string filename = entry->d_name;
if (filename == "." || filename == "..")
return;
std::string filepath = JoinPaths(current_directory_, filename);
protos::pbzero::InodeFileMap_Entry_Type type =
protos::pbzero::InodeFileMap_Entry_Type_UNKNOWN;
// Readdir and stat not guaranteed to have directory info for all systems
if (entry->d_type == DT_DIR) {
// Continue iterating through files if current entry is a directory
queue_.emplace_back(filepath);
type = protos::pbzero::InodeFileMap_Entry_Type_DIRECTORY;
} else if (entry->d_type == DT_REG) {
type = protos::pbzero::InodeFileMap_Entry_Type_FILE;
}
if (!delegate_->OnInodeFound(current_block_device_id_, entry->d_ino, filepath,
type)) {
queue_.clear();
current_dir_handle_.reset();
}
}
void FileScanner::Steps(uint32_t n) {
for (uint32_t i = 0; i < n && !Done(); ++i)
Step();
}
bool FileScanner::Done() {
return !current_dir_handle_ && queue_.empty();
}
FileScanner::Delegate::~Delegate() = default;
} // namespace perfetto
| 28.335443 | 80 | 0.666294 | jumeder |
17dd6e476c2cbe0d6c47ae2173d658ae96817eb1 | 17,036 | cpp | C++ | src/frameworks/native/services/surfaceflinger/Scheduler/EventThread.cpp | dAck2cC2/m3e | 475b89b59d5022a94e00b636438b25e27e4eaab2 | [
"Apache-2.0"
] | null | null | null | src/frameworks/native/services/surfaceflinger/Scheduler/EventThread.cpp | dAck2cC2/m3e | 475b89b59d5022a94e00b636438b25e27e4eaab2 | [
"Apache-2.0"
] | null | null | null | src/frameworks/native/services/surfaceflinger/Scheduler/EventThread.cpp | dAck2cC2/m3e | 475b89b59d5022a94e00b636438b25e27e4eaab2 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
#include <pthread.h>
#include <sched.h>
#include <sys/types.h>
#include <chrono>
#include <cstdint>
#include <optional>
#include <type_traits>
#include <android-base/stringprintf.h>
#include <cutils/compiler.h>
#include <cutils/sched_policy.h>
#include <gui/DisplayEventReceiver.h>
#include <utils/Errors.h>
#include <utils/Trace.h>
#include "EventThread.h"
using namespace std::chrono_literals;
namespace android {
using base::StringAppendF;
using base::StringPrintf;
namespace {
auto vsyncPeriod(VSyncRequest request) {
return static_cast<std::underlying_type_t<VSyncRequest>>(request);
}
std::string toString(VSyncRequest request) {
switch (request) {
case VSyncRequest::None:
return "VSyncRequest::None";
case VSyncRequest::Single:
return "VSyncRequest::Single";
default:
return StringPrintf("VSyncRequest::Periodic{period=%d}", vsyncPeriod(request));
}
}
std::string toString(const EventThreadConnection& connection) {
return StringPrintf("Connection{%p, %s}", &connection,
toString(connection.vsyncRequest).c_str());
}
std::string toString(const DisplayEventReceiver::Event& event) {
switch (event.header.type) {
case DisplayEventReceiver::DISPLAY_EVENT_HOTPLUG:
return StringPrintf("Hotplug{displayId=%" ANDROID_PHYSICAL_DISPLAY_ID_FORMAT ", %s}",
event.header.displayId,
event.hotplug.connected ? "connected" : "disconnected");
case DisplayEventReceiver::DISPLAY_EVENT_VSYNC:
return StringPrintf("VSync{displayId=%" ANDROID_PHYSICAL_DISPLAY_ID_FORMAT
", count=%u}",
event.header.displayId, event.vsync.count);
case DisplayEventReceiver::DISPLAY_EVENT_CONFIG_CHANGED:
return StringPrintf("ConfigChanged{displayId=%" ANDROID_PHYSICAL_DISPLAY_ID_FORMAT
", configId=%u}",
event.header.displayId, event.config.configId);
default:
return "Event{}";
}
}
DisplayEventReceiver::Event makeHotplug(PhysicalDisplayId displayId, nsecs_t timestamp,
bool connected) {
DisplayEventReceiver::Event event;
event.header = {DisplayEventReceiver::DISPLAY_EVENT_HOTPLUG, displayId, timestamp};
event.hotplug.connected = connected;
return event;
}
DisplayEventReceiver::Event makeVSync(PhysicalDisplayId displayId, nsecs_t timestamp,
uint32_t count) {
DisplayEventReceiver::Event event;
event.header = {DisplayEventReceiver::DISPLAY_EVENT_VSYNC, displayId, timestamp};
event.vsync.count = count;
return event;
}
DisplayEventReceiver::Event makeConfigChanged(PhysicalDisplayId displayId, int32_t configId) {
DisplayEventReceiver::Event event;
event.header = {DisplayEventReceiver::DISPLAY_EVENT_CONFIG_CHANGED, displayId, systemTime()};
event.config.configId = configId;
return event;
}
} // namespace
EventThreadConnection::EventThreadConnection(EventThread* eventThread,
ResyncCallback resyncCallback,
ISurfaceComposer::ConfigChanged configChanged)
: resyncCallback(std::move(resyncCallback)),
configChanged(configChanged),
mEventThread(eventThread),
mChannel(gui::BitTube::DefaultSize) {}
EventThreadConnection::~EventThreadConnection() {
// do nothing here -- clean-up will happen automatically
// when the main thread wakes up
}
void EventThreadConnection::onFirstRef() {
// NOTE: mEventThread doesn't hold a strong reference on us
mEventThread->registerDisplayEventConnection(this);
}
status_t EventThreadConnection::stealReceiveChannel(gui::BitTube* outChannel) {
outChannel->setReceiveFd(mChannel.moveReceiveFd());
return NO_ERROR;
}
status_t EventThreadConnection::setVsyncRate(uint32_t rate) {
mEventThread->setVsyncRate(rate, this);
return NO_ERROR;
}
void EventThreadConnection::requestNextVsync() {
ATRACE_NAME("requestNextVsync");
mEventThread->requestNextVsync(this);
}
status_t EventThreadConnection::postEvent(const DisplayEventReceiver::Event& event) {
ssize_t size = DisplayEventReceiver::sendEvents(&mChannel, &event, 1);
return size < 0 ? status_t(size) : status_t(NO_ERROR);
}
// ---------------------------------------------------------------------------
EventThread::~EventThread() = default;
namespace impl {
EventThread::EventThread(std::unique_ptr<VSyncSource> src,
InterceptVSyncsCallback interceptVSyncsCallback, const char* threadName)
: EventThread(nullptr, std::move(src), std::move(interceptVSyncsCallback), threadName) {}
EventThread::EventThread(VSyncSource* src, InterceptVSyncsCallback interceptVSyncsCallback,
const char* threadName)
: EventThread(src, nullptr, std::move(interceptVSyncsCallback), threadName) {}
EventThread::EventThread(VSyncSource* src, std::unique_ptr<VSyncSource> uniqueSrc,
InterceptVSyncsCallback interceptVSyncsCallback, const char* threadName)
: mVSyncSource(src),
mVSyncSourceUnique(std::move(uniqueSrc)),
mInterceptVSyncsCallback(std::move(interceptVSyncsCallback)),
mThreadName(threadName) {
if (src == nullptr) {
mVSyncSource = mVSyncSourceUnique.get();
}
mVSyncSource->setCallback(this);
mThread = std::thread([this]() NO_THREAD_SAFETY_ANALYSIS {
std::unique_lock<std::mutex> lock(mMutex);
threadMain(lock);
});
#if 0 // M3E: no pthread_setname_np
pthread_setname_np(mThread.native_handle(), threadName);
pid_t tid = pthread_gettid_np(mThread.native_handle());
// Use SCHED_FIFO to minimize jitter
constexpr int EVENT_THREAD_PRIORITY = 2;
struct sched_param param = {0};
param.sched_priority = EVENT_THREAD_PRIORITY;
if (pthread_setschedparam(mThread.native_handle(), SCHED_FIFO, ¶m) != 0) {
ALOGE("Couldn't set SCHED_FIFO for EventThread");
}
set_sched_policy(tid, SP_FOREGROUND);
#endif // M3E
}
EventThread::~EventThread() {
mVSyncSource->setCallback(nullptr);
{
std::lock_guard<std::mutex> lock(mMutex);
mState = State::Quit;
mCondition.notify_all();
}
mThread.join();
}
void EventThread::setPhaseOffset(nsecs_t phaseOffset) {
std::lock_guard<std::mutex> lock(mMutex);
mVSyncSource->setPhaseOffset(phaseOffset);
}
sp<EventThreadConnection> EventThread::createEventConnection(
ResyncCallback resyncCallback, ISurfaceComposer::ConfigChanged configChanged) const {
return new EventThreadConnection(const_cast<EventThread*>(this), std::move(resyncCallback),
configChanged);
}
status_t EventThread::registerDisplayEventConnection(const sp<EventThreadConnection>& connection) {
std::lock_guard<std::mutex> lock(mMutex);
// this should never happen
auto it = std::find(mDisplayEventConnections.cbegin(),
mDisplayEventConnections.cend(), connection);
if (it != mDisplayEventConnections.cend()) {
ALOGW("DisplayEventConnection %p already exists", connection.get());
mCondition.notify_all();
return ALREADY_EXISTS;
}
mDisplayEventConnections.push_back(connection);
mCondition.notify_all();
return NO_ERROR;
}
void EventThread::removeDisplayEventConnectionLocked(const wp<EventThreadConnection>& connection) {
auto it = std::find(mDisplayEventConnections.cbegin(),
mDisplayEventConnections.cend(), connection);
if (it != mDisplayEventConnections.cend()) {
mDisplayEventConnections.erase(it);
}
}
void EventThread::setVsyncRate(uint32_t rate, const sp<EventThreadConnection>& connection) {
if (static_cast<std::underlying_type_t<VSyncRequest>>(rate) < 0) {
return;
}
std::lock_guard<std::mutex> lock(mMutex);
const auto request = rate == 0 ? VSyncRequest::None : static_cast<VSyncRequest>(rate);
if (connection->vsyncRequest != request) {
connection->vsyncRequest = request;
mCondition.notify_all();
}
}
void EventThread::requestNextVsync(const sp<EventThreadConnection>& connection) {
if (connection->resyncCallback) {
connection->resyncCallback();
}
std::lock_guard<std::mutex> lock(mMutex);
if (connection->vsyncRequest == VSyncRequest::None) {
connection->vsyncRequest = VSyncRequest::Single;
mCondition.notify_all();
}
}
void EventThread::onScreenReleased() {
std::lock_guard<std::mutex> lock(mMutex);
if (!mVSyncState || mVSyncState->synthetic) {
return;
}
mVSyncState->synthetic = true;
mCondition.notify_all();
}
void EventThread::onScreenAcquired() {
std::lock_guard<std::mutex> lock(mMutex);
if (!mVSyncState || !mVSyncState->synthetic) {
return;
}
mVSyncState->synthetic = false;
mCondition.notify_all();
}
void EventThread::onVSyncEvent(nsecs_t timestamp) {
std::lock_guard<std::mutex> lock(mMutex);
LOG_FATAL_IF(!mVSyncState, "M3E");
mPendingEvents.push_back(makeVSync(mVSyncState->displayId, timestamp, ++mVSyncState->count));
mCondition.notify_all();
}
void EventThread::onHotplugReceived(PhysicalDisplayId displayId, bool connected) {
std::lock_guard<std::mutex> lock(mMutex);
mPendingEvents.push_back(makeHotplug(displayId, systemTime(), connected));
mCondition.notify_all();
}
void EventThread::onConfigChanged(PhysicalDisplayId displayId, int32_t configId) {
std::lock_guard<std::mutex> lock(mMutex);
mPendingEvents.push_back(makeConfigChanged(displayId, configId));
mCondition.notify_all();
}
void EventThread::threadMain(std::unique_lock<std::mutex>& lock) {
DisplayEventConsumers consumers;
while (mState != State::Quit) {
std::optional<DisplayEventReceiver::Event> event;
// Determine next event to dispatch.
if (!mPendingEvents.empty()) {
event = mPendingEvents.front();
mPendingEvents.pop_front();
switch (event->header.type) {
case DisplayEventReceiver::DISPLAY_EVENT_HOTPLUG:
if (event->hotplug.connected && !mVSyncState) {
mVSyncState.emplace(event->header.displayId);
} else if (!event->hotplug.connected && mVSyncState &&
mVSyncState->displayId == event->header.displayId) {
mVSyncState.reset();
}
break;
case DisplayEventReceiver::DISPLAY_EVENT_VSYNC:
if (mInterceptVSyncsCallback) {
mInterceptVSyncsCallback(event->header.timestamp);
}
break;
}
}
bool vsyncRequested = false;
// Find connections that should consume this event.
auto it = mDisplayEventConnections.begin();
while (it != mDisplayEventConnections.end()) {
if (const auto connection = it->promote()) {
vsyncRequested |= connection->vsyncRequest != VSyncRequest::None;
if (event && shouldConsumeEvent(*event, connection)) {
consumers.push_back(connection);
}
++it;
} else {
it = mDisplayEventConnections.erase(it);
}
}
if (!consumers.empty()) {
dispatchEvent(*event, consumers);
consumers.clear();
}
State nextState;
if (mVSyncState && vsyncRequested) {
nextState = mVSyncState->synthetic ? State::SyntheticVSync : State::VSync;
} else {
ALOGW_IF(!mVSyncState, "Ignoring VSYNC request while display is disconnected");
nextState = State::Idle;
}
if (mState != nextState) {
if (mState == State::VSync) {
mVSyncSource->setVSyncEnabled(false);
} else if (nextState == State::VSync) {
mVSyncSource->setVSyncEnabled(true);
}
mState = nextState;
}
if (event) {
continue;
}
// Wait for event or client registration/request.
if (mState == State::Idle) {
mCondition.wait(lock);
} else {
// Generate a fake VSYNC after a long timeout in case the driver stalls. When the
// display is off, keep feeding clients at 60 Hz.
const auto timeout = mState == State::SyntheticVSync ? 16ms : 1000ms;
if (mCondition.wait_for(lock, timeout) == std::cv_status::timeout) {
ALOGW_IF(mState == State::VSync, "Faking VSYNC due to driver stall");
LOG_FATAL_IF(!mVSyncState, "M3E: MSVC");
mPendingEvents.push_back(makeVSync(mVSyncState->displayId,
systemTime(SYSTEM_TIME_MONOTONIC),
++mVSyncState->count));
}
}
}
}
bool EventThread::shouldConsumeEvent(const DisplayEventReceiver::Event& event,
const sp<EventThreadConnection>& connection) const {
switch (event.header.type) {
case DisplayEventReceiver::DISPLAY_EVENT_HOTPLUG:
return true;
case DisplayEventReceiver::DISPLAY_EVENT_CONFIG_CHANGED:
return connection->configChanged == ISurfaceComposer::eConfigChangedDispatch;
case DisplayEventReceiver::DISPLAY_EVENT_VSYNC:
switch (connection->vsyncRequest) {
case VSyncRequest::None:
return false;
case VSyncRequest::Single:
connection->vsyncRequest = VSyncRequest::None;
return true;
case VSyncRequest::Periodic:
return true;
default:
return event.vsync.count % vsyncPeriod(connection->vsyncRequest) == 0;
}
default:
return false;
}
}
void EventThread::dispatchEvent(const DisplayEventReceiver::Event& event,
const DisplayEventConsumers& consumers) {
for (const auto& consumer : consumers) {
switch (consumer->postEvent(event)) {
case NO_ERROR:
break;
case -EAGAIN:
// TODO: Try again if pipe is full.
ALOGW("Failed dispatching %s for %s", toString(event).c_str(),
toString(*consumer).c_str());
break;
default:
// Treat EPIPE and other errors as fatal.
removeDisplayEventConnectionLocked(consumer);
}
}
}
void EventThread::dump(std::string& result) const {
std::lock_guard<std::mutex> lock(mMutex);
StringAppendF(&result, "%s: state=%s VSyncState=", mThreadName, toCString(mState));
if (mVSyncState) {
StringAppendF(&result, "{displayId=%" ANDROID_PHYSICAL_DISPLAY_ID_FORMAT ", count=%u%s}\n",
mVSyncState->displayId, mVSyncState->count,
mVSyncState->synthetic ? ", synthetic" : "");
} else {
StringAppendF(&result, "none\n");
}
StringAppendF(&result, " pending events (count=%zu):\n", mPendingEvents.size());
for (const auto& event : mPendingEvents) {
StringAppendF(&result, " %s\n", toString(event).c_str());
}
StringAppendF(&result, " connections (count=%zu):\n", mDisplayEventConnections.size());
for (const auto& ptr : mDisplayEventConnections) {
if (const auto connection = ptr.promote()) {
StringAppendF(&result, " %s\n", toString(*connection).c_str());
}
}
}
const char* EventThread::toCString(State state) {
switch (state) {
case State::Idle:
return "Idle";
case State::Quit:
return "Quit";
case State::SyntheticVSync:
return "SyntheticVSync";
case State::VSync:
return "VSync";
}
}
} // namespace impl
} // namespace android
| 34.48583 | 99 | 0.632954 | dAck2cC2 |
17e47a7bf87c00fe256e3d912dc0b592b113a38d | 6,590 | cpp | C++ | emulator/src/tools/imgtool/imghd.cpp | rjw57/tiw-computer | 5ef1c79893165b8622d1114d81cd0cded58910f0 | [
"MIT"
] | 1 | 2022-01-15T21:38:38.000Z | 2022-01-15T21:38:38.000Z | emulator/src/tools/imgtool/imghd.cpp | rjw57/tiw-computer | 5ef1c79893165b8622d1114d81cd0cded58910f0 | [
"MIT"
] | null | null | null | emulator/src/tools/imgtool/imghd.cpp | rjw57/tiw-computer | 5ef1c79893165b8622d1114d81cd0cded58910f0 | [
"MIT"
] | null | null | null | // license:BSD-3-Clause
// copyright-holders:Nathan Woods, Raphael Nabet
/*
Code to interface the MESS image code with MAME's harddisk core.
We do not support diff files as it will involve some changes in the MESS
image code.
Raphael Nabet 2003
*/
#include "imgtool.h"
#include "harddisk.h"
#include "imghd.h"
static imgtoolerr_t map_chd_error(chd_error chderr)
{
imgtoolerr_t err;
switch(chderr)
{
case CHDERR_NONE:
err = IMGTOOLERR_SUCCESS;
break;
case CHDERR_OUT_OF_MEMORY:
err = IMGTOOLERR_OUTOFMEMORY;
break;
case CHDERR_FILE_NOT_WRITEABLE:
err = IMGTOOLERR_READONLY;
break;
case CHDERR_NOT_SUPPORTED:
err = IMGTOOLERR_UNIMPLEMENTED;
break;
default:
err = IMGTOOLERR_UNEXPECTED;
break;
}
return err;
}
/*
imghd_create()
Create a MAME HD image
*/
imgtoolerr_t imghd_create(imgtool::stream &stream, uint32_t hunksize, uint32_t cylinders, uint32_t heads, uint32_t sectors, uint32_t seclen)
{
imgtoolerr_t err = IMGTOOLERR_SUCCESS;
chd_file chd;
chd_error rc;
chd_codec_type compression[4] = { CHD_CODEC_NONE };
/* sanity check args */
if (hunksize >= 2048)
{
err = IMGTOOLERR_PARAMCORRUPT;
return err;
}
if (hunksize <= 0)
hunksize = 1024; /* default value */
/* bail if we are read only */
if (stream.is_read_only())
{
err = IMGTOOLERR_READONLY;
return err;
}
/* calculations */
const uint64_t logicalbytes = (uint64_t)cylinders * heads * sectors * seclen;
/* create the new hard drive */
rc = chd.create(*stream.core_file(), logicalbytes, hunksize, seclen, compression);
if (rc != CHDERR_NONE)
{
err = map_chd_error(rc);
return err;
}
/* open the new hard drive */
rc = chd.open(*stream.core_file());
if (rc != CHDERR_NONE)
{
err = map_chd_error(rc);
return err;
}
/* write the metadata */
const std::string metadata = string_format(HARD_DISK_METADATA_FORMAT, cylinders, heads, sectors, seclen);
err = (imgtoolerr_t)chd.write_metadata(HARD_DISK_METADATA_TAG, 0, metadata);
if (rc != CHDERR_NONE)
{
err = map_chd_error(rc);
return err;
}
/* alloc and zero buffer */
std::vector<uint8_t> cache;
cache.resize(hunksize);
memset(&cache[0], 0, hunksize);
/* zero out every hunk */
const int totalhunks = (logicalbytes + hunksize - 1) / hunksize;
for (int hunknum = 0; hunknum < totalhunks; hunknum++)
{
rc = chd.write_units(hunknum, &cache[0]);
if (rc)
{
err = IMGTOOLERR_WRITEERROR;
return err;
}
}
return err;
}
/*
imghd_open()
Open stream as a MAME HD image
*/
imgtoolerr_t imghd_open(imgtool::stream &stream, struct mess_hard_disk_file *hard_disk)
{
chd_error chderr;
imgtoolerr_t err = IMGTOOLERR_SUCCESS;
hard_disk->hard_disk = nullptr;
chderr = hard_disk->chd.open(*stream.core_file(), !stream.is_read_only());
if (chderr)
{
err = map_chd_error(chderr);
goto done;
}
hard_disk->hard_disk = hard_disk_open(&hard_disk->chd);
if (!hard_disk->hard_disk)
{
err = IMGTOOLERR_UNEXPECTED;
goto done;
}
hard_disk->stream = &stream;
done:
if (err)
imghd_close(hard_disk);
return err;
}
/*
imghd_close()
Close MAME HD image
*/
void imghd_close(struct mess_hard_disk_file *disk)
{
if (disk->hard_disk)
{
hard_disk_close(disk->hard_disk);
disk->hard_disk = nullptr;
}
if (disk->stream)
{
delete disk->stream;
disk->stream = nullptr;
}
}
/*
imghd_read()
Read sector(s) from MAME HD image
*/
imgtoolerr_t imghd_read(struct mess_hard_disk_file *disk, uint32_t lbasector, void *buffer)
{
uint32_t reply;
reply = hard_disk_read(disk->hard_disk, lbasector, buffer);
return (imgtoolerr_t)(reply ? IMGTOOLERR_SUCCESS : map_chd_error((chd_error)reply));
}
/*
imghd_write()
Write sector(s) from MAME HD image
*/
imgtoolerr_t imghd_write(struct mess_hard_disk_file *disk, uint32_t lbasector, const void *buffer)
{
uint32_t reply;
reply = hard_disk_write(disk->hard_disk, lbasector, buffer);
return (imgtoolerr_t)(reply ? IMGTOOLERR_SUCCESS : map_chd_error((chd_error)reply));
}
/*
imghd_get_header()
Return pointer to the header of MAME HD image
*/
const hard_disk_info *imghd_get_header(struct mess_hard_disk_file *disk)
{
const hard_disk_info *reply;
reply = hard_disk_get_info(disk->hard_disk);
return reply;
}
static imgtoolerr_t mess_hd_image_create(imgtool::image &image, imgtool::stream::ptr &&stream, util::option_resolution *createoptions);
enum
{
mess_hd_createopts_blocksize = 'B',
mess_hd_createopts_cylinders = 'C',
mess_hd_createopts_heads = 'D',
mess_hd_createopts_sectors = 'E',
mess_hd_createopts_seclen = 'F'
};
OPTION_GUIDE_START( mess_hd_create_optionguide )
OPTION_INT(mess_hd_createopts_blocksize, "blocksize", "Sectors Per Block" )
OPTION_INT(mess_hd_createopts_cylinders, "cylinders", "Cylinders" )
OPTION_INT(mess_hd_createopts_heads, "heads", "Heads" )
OPTION_INT(mess_hd_createopts_sectors, "sectors", "Total Sectors" )
OPTION_INT(mess_hd_createopts_seclen, "seclen", "Sector Bytes" )
OPTION_GUIDE_END
#define mess_hd_create_optionspecs "B[1]-2048;C1-[32]-65536;D1-[8]-64;E1-[128]-4096;F128/256/[512]/1024/2048/4096/8192/16384/32768/65536"
void hd_get_info(const imgtool_class *imgclass, uint32_t state, union imgtoolinfo *info)
{
switch(state)
{
case IMGTOOLINFO_STR_NAME: strcpy(info->s = imgtool_temp_str(), "mess_hd"); break;
case IMGTOOLINFO_STR_DESCRIPTION: strcpy(info->s = imgtool_temp_str(), "MESS hard disk image"); break;
case IMGTOOLINFO_STR_FILE_EXTENSIONS: strcpy(info->s = imgtool_temp_str(), "hd"); break;
case IMGTOOLINFO_PTR_CREATE: info->create = mess_hd_image_create; break;
case IMGTOOLINFO_PTR_CREATEIMAGE_OPTGUIDE: info->createimage_optguide = &mess_hd_create_optionguide; break;
case IMGTOOLINFO_STR_CREATEIMAGE_OPTSPEC: strcpy(info->s = imgtool_temp_str(), mess_hd_create_optionspecs); break;
}
}
static imgtoolerr_t mess_hd_image_create(imgtool::image &image, imgtool::stream::ptr &&stream, util::option_resolution *createoptions)
{
uint32_t blocksize, cylinders, heads, sectors, seclen;
/* read options */
blocksize = createoptions->lookup_int(mess_hd_createopts_blocksize);
cylinders = createoptions->lookup_int(mess_hd_createopts_cylinders);
heads = createoptions->lookup_int(mess_hd_createopts_heads);
sectors = createoptions->lookup_int(mess_hd_createopts_sectors);
seclen = createoptions->lookup_int(mess_hd_createopts_seclen);
return imghd_create(*stream.get(), blocksize, cylinders, heads, sectors, seclen);
}
| 24.227941 | 140 | 0.720941 | rjw57 |
17e6ceb112afc10d0d21a4724e4bd76d351e87aa | 9,988 | cpp | C++ | qbf_solve/main.cpp | appu226/FactorGraph | 26e4de8518874abf2696a167eaf3dbaede5930f8 | [
"MIT"
] | null | null | null | qbf_solve/main.cpp | appu226/FactorGraph | 26e4de8518874abf2696a167eaf3dbaede5930f8 | [
"MIT"
] | null | null | null | qbf_solve/main.cpp | appu226/FactorGraph | 26e4de8518874abf2696a167eaf3dbaede5930f8 | [
"MIT"
] | null | null | null | /*
Copyright 2019 Parakram Majumdar
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 <cstdio>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <memory>
#include <time.h>
#include <string>
#include <factor_graph/srt.h>
using namespace std;
#ifdef DEBUG
#define DBG(stmt) stmt
#else
#define DBG(stmt) (void)0
#endif
#ifdef DEBUGMAIN
#define DBGMAIN(stmt) stmt
#else
#define DBGMAIN(stmt) (void)0
#endif
bool contains(DdManager *d, bdd_ptr varDep, bdd_ptr block) {
bdd_ptr temp = bdd_cube_intersection(d, varDep, block);
if(bdd_is_one(d, temp))
{
bdd_free(d, temp);
return false;
}
bdd_free(d, temp);
return true;
}
bool QBF_Solve(char* filename) {
const int threshold = 1;
int start, end;
std::shared_ptr<SRT> t;
Quant* q;
CNF_vector* c;
bdd_ptr varDep,supp;
QBlock* qb;
SRTNode_Queue leaves;
SRTNode* curr;
CNF_vector* cv;
bool does_contain;
SRTNode* Lnew;
Vector_Int* ss;
DdManager* d;
SRTNode* root;
bdd_ptr cv_bdd;
bdd_ptr res,compand;
bdd_ptr block;
BDD_List* cv_bdd_list;
t = std::make_shared<SRT>();
DBG(cout<<"parsing..."<<endl);
t->parse_qdimacs_srt(filename);
d = t->SRT_getddm();
varDep = bdd_one(d);
q = t->SRT_vars();
c = t->SRT_clauses();
// clock_t big_init, big_final;
// clock_t init, final;
// double time_merge = 0, time_fg = 0, time_convert = 0, time_forall = 0;
// t->SRT_getroot()->split(197);
// t->SRT_getroot()->SRT_Then()->split(84);
// t->SRT_getroot()->SRT_Else()->split(84);
// big_init = clock();
DBGMAIN(cout<<"entering loop"<<endl);
while(!q->empty()) {
DBGMAIN(cout<<"new iteration"<<endl);
DBGMAIN(t->SRT_print());
qb = q->innermost();
start = qb->start;
end = qb->end;
DBGMAIN(cout<<"start = "<<start<<" end = "<<end<<endl);
// MERGING
// init=clock();
for(int v=start; v<end; v++)
t->SRT_merge(v,threshold);
// final=clock();
// time_merge += (double)(final-init) / ((double)CLOCKS_PER_SEC);
DBGMAIN(cout<<"computing varcube..."<<endl);
block = bdd_one(d);
for(int i=start;i<end; i++) {
bdd_ptr temp_var = bdd_new_var_with_index(d,i);
bdd_and_accumulate(d,&block,temp_var);
bdd_free(d,temp_var);
}
does_contain = contains(d, varDep,block);
if(qb->is_universal) {
DBGMAIN(cout<<"Universal Quantification"<<endl);
c->drop_vars(start,end);
if(does_contain) {
// FOR EACH LEAF, OPTIMIZE LATER BY TRAVERSING AND MAINTAINING A LIST OF LEAVES
leaves.push(t->SRT_getroot());
while(!leaves.empty()) {
curr = leaves.front();
leaves.pop();
assert(curr != NULL);
if(curr->is_leaf()) {
// init = clock();
curr->for_all_innermost(d,q);
curr->deduce();
// final=clock();
// time_forall += (double)(final-init) / ((double)CLOCKS_PER_SEC);
}
else {
leaves.push(curr->SRT_Then());
leaves.push(curr->SRT_Else());
}
}
}
// ELSE NOTHING TO DO, VARIABLES FROM GLOBAL CNF_VECTOR ALREADY DROPPED
}
else { // EXISTENTIAL QUANTIFICATION
DBGMAIN(cout<<"Existential Quantification"<<endl);
cv = c->filter_innermost(q);
/*
for(int cvs = 0; cvs < cv->clauses.size(); cvs ++)
{
DBG(cout<<"filtered clause ");
for(int cvscs = 0; cvscs < cv->clauses[cvs]->vars.size(); cvscs++)
DBG(cout<<cv->clauses[cvs]->vars[cvscs]<<" ");
DBG(cout<<endl);
}
*/
//cv_bdd = CNF_to_BDD(cv, d);
cv_bdd_list = CNF_to_BDD_List(cv, d);
DBGMAIN(cout<<"cv has "<<cv->clauses.size()<<" out of "<<c->clauses.size()<<" clauses"<<endl);
if (does_contain) {
DBGMAIN(cout<<"some leaf contains the vars..."<<endl);
// FOR EACH LEAF, OPTIMIZE LATER BY TRAVERSING AND MAINTAINING A LIST OF LEAVES
leaves.push(t->SRT_getroot());
while(!leaves.empty()) {
curr = leaves.front();
leaves.pop();
if(curr->is_leaf()) { // FOR EACH LEAF
curr->append(cv_bdd_list);
//FACTOR GRAPH
// init = clock();
//apply the split history of L to CV, add these clauses to L
factor_graph *fg = make_factor_graph(d, curr);
factor_graph_eliminate(fg, start, end, curr);
factor_graph_delete(fg);
curr->deduce();
// final=clock();
// time_fg += (double)(final-init) / ((double)CLOCKS_PER_SEC);
/*curr->join_bdds(d);
res = bdd_forsome(d,(*(curr->get_func()))[0],block);
bdd_free(d, (*(curr->get_func()))[0]);
(*(curr->get_func()))[0] = res;
*/
}
else {
leaves.push(curr->SRT_Then());
leaves.push(curr->SRT_Else());
}
}
}
else { // no leaves depend on V
DBGMAIN(cout<<"no leaf contains the vars..."<<endl);
Lnew = make_leaf(t->SRT_getddm(), cv);
// no leaf depends on V, form a global leaf from CV
//FACTOR GRAPH
// init = clock();
factor_graph *fg = make_factor_graph(d, Lnew);
factor_graph_eliminate(fg, start, end, Lnew);
factor_graph_delete(fg);
// final=clock();
// time_fg += (double)(final-init) / ((double)CLOCKS_PER_SEC);
// FOR EACH LEAF, OPTIMIZE LATER BY TRAVERSING AND MAINTAINING A LIST OF LEAVES
leaves.push(t->SRT_getroot());
while(!leaves.empty()) {
curr = leaves.front();
leaves.pop();
if(curr->is_leaf()) { // FOR EACH LEAF
curr->append(Lnew);
curr->deduce();
}
else {
leaves.push(curr->SRT_Then());
leaves.push(curr->SRT_Else());
}
}
}
ss = cv->support_set(); // CV.support_set
for(Vector_Int::iterator i = ss->begin(); i!=ss->end();) {
if((*i) >= start && (*i) < end)
i = ss->erase(i);
else
i++;
} // CV.support_set - V
// Now construct the bdd having these variables
if(!ss->empty())
{
supp = bdd_one(d);
for(int i=0;i<ss->size(); i++) {
bdd_ptr temp = bdd_new_var_with_index(d,(*ss)[i]);
bdd_and_accumulate(d,&supp,temp);
bdd_free(d, temp);
}
bdd_and_accumulate(d,&varDep,supp);
bdd_free(d, supp);
// mark variables coming from CV into T*/
}
}
DBGMAIN(printf("post removal : \n"));
DBGMAIN(t->SRT_print());
// MERGING
// init = clock();
for(int v=end-1; v>=start; v--) {
t->SRT_merge(v,threshold);
}
// final=clock();
// time_merge += (double)(final-init) / ((double)CLOCKS_PER_SEC);
// assert(t->SRT_getroot()->is_leaf());
// printf("SIZE OF FUNC ON ROOT: %d\n",t->SRT_getroot()->type.leaf.func->size());
// t->SRT_getroot()->type.leaf.print(d);
// assert(t->SRT_getroot()->type.leaf.check_func(d,bdd_or(d,bdd_new_var_with_index(d,1),bdd_new_var_with_index(d,2))));
q->remove_innermost();
DBGMAIN(printf("post merge : \n"));
DBGMAIN(t->SRT_print());
}
assert(t->SRT_getroot());
assert(t->SRT_getroot()->is_leaf());
// big_final = clock();
// cout<<"Time for Merging: "<<time_merge<<endl;
// cout<<"Time for Factor Graph: "<<time_fg<<endl;
// cout<<"Time for Forall: "<<time_forall<<endl;
// cout<<"Time for BDD-CNF Conversion: "<<time_convert<<endl;
// profile();
// cout<<"Total Time: "<<(double)(big_final-big_init)/((double)CLOCKS_PER_SEC)<<endl;
//assert(t->SRT_getroot()->get_func()->size()==1);
for(int g = 0; g < t->global_clauses->clauses.size(); g++)
{
assert(t->global_clauses->clauses[g]->vars.size() == 0);
return false;
}
for(int g = 0; g < t->SRT_getroot()->get_func()->size(); g++) // size == 1??
if( !bdd_is_one(t->SRT_getddm(), (*(t->SRT_getroot()->get_func())) [g] ) )
return false;
return true;
}
int main(int argc, char **argv) {
/*
int n;
printf("Enter number of variables: ");
scanf("%d",&n);
SRT* t = new SRT(n);
int option;
int mergevar;
int threshold;
while(true) {
printf("Select Option:\n");
printf("1. Print Tree\n");
printf("2. Split a node\n");
printf("3. Merge a node\n");
printf("4. Exit\n");
scanf("%d",&option);
std::string splitnode;
int var;
switch(option) {
case 1:
t->SRT_print();
break;
case 2:
printf("Enter the string for the node: ");
std::cin>>splitnode;
printf("Enter the variable: ");
scanf("%d",&var);
t->split(splitnode,var);
t->SRT_print();
break;
case 3:
printf("Enter the variable to merge on: ");
scanf("%d",&mergevar);
printf("Enter the threshold for merging: ");
scanf("%d",&threshold);
t->SRT_merge(mergevar,threshold);
t->SRT_print();
break;
case 4:
exit(0);
break;
default:
printf("Sorry, option unavailable\n");
}
}
return 0;*/
if(argc != 2)
{
cout<<"Usage : "<<endl<<"\t"<<argv[0]<<" <filename>"<<endl;
return 0;
}
bool res = QBF_Solve(argv[1]);
if(res)
cout<<"\t\t\t====================================\n"
<<"\t\t\t======== Result is TRUE ==========\n"
<<"\t\t\t===================================="
<<endl;
else
cout<<"\t\t\t====================================\n"
<<"\t\t\t======== Result is FALSE =========\n"
<<"\t\t\t===================================="
<<endl;
}
| 26.493369 | 124 | 0.604626 | appu226 |
17e73146a4c193de9587418a56a96588ee72f5ed | 17,823 | hpp | C++ | sparta/sparta/app/MultiDetailOptions.hpp | debjyoti0891/map | abdae67964420d7d36255dcbf83e4240a1ef4295 | [
"MIT"
] | 44 | 2019-12-13T06:39:13.000Z | 2022-03-29T23:09:28.000Z | sparta/sparta/app/MultiDetailOptions.hpp | debjyoti0891/map | abdae67964420d7d36255dcbf83e4240a1ef4295 | [
"MIT"
] | 222 | 2020-01-14T21:58:56.000Z | 2022-03-31T20:05:12.000Z | sparta/sparta/app/MultiDetailOptions.hpp | debjyoti0891/map | abdae67964420d7d36255dcbf83e4240a1ef4295 | [
"MIT"
] | 19 | 2020-01-03T19:03:22.000Z | 2022-01-09T08:36:20.000Z | // <MultiDetailOptions.hpp> -*- C++ -*-
/*!
* \file MultiDetailOptions.hpp
* \brief Wrapper for boost program_options option_description that allows
* multiple levels of detail
*/
#pragma once
#include <boost/program_options.hpp>
#include "sparta/sparta.hpp"
namespace po = boost::program_options;
namespace sparta {
namespace app {
/*!
* \brief Helper class for populating boost program options
*/
template <typename ArgT>
class named_value_type : public po::typed_value<ArgT>
{
unsigned min_;
unsigned max_;
std::string my_name_;
public:
/*!
* \brief Type of base class
*/
typedef po::typed_value<ArgT> base_t;
/*!
* \brief Constructor
*/
named_value_type(std::string const& name, ArgT* val) :
po::typed_value<ArgT>(val),
min_(0),
max_(1),
my_name_(name)
{ }
/*!
* \brief Constructor with min and max extents
*/
named_value_type(std::string const& name, ArgT* val, unsigned min, unsigned max) :
po::typed_value<ArgT>(val),
min_(min),
max_(max),
my_name_(name)
{ }
virtual ~named_value_type() {}
/*!
* \brief boost semantic for getting name of this option
*/
virtual std::string name() const override { return my_name_; }
named_value_type* min(unsigned min)
{
min_ = min;
return this;
}
named_value_type* max(unsigned max)
{
max_ = max;
return this;
}
named_value_type* multitoken()
{
base_t::multitoken();
return this;
}
/*!
* \brief boost semantic for specifying min tokens
*/
virtual unsigned min_tokens() const override { return min_; }
/*!
* \brief boost semantic for specifying max tokens
*/
virtual unsigned max_tokens() const override { return max_; }
/*!
* \brief Override parser
* \note Defined inline later because of dependency on named_value_parser
*/
virtual void xparse(boost::any& value_store,
const std::vector<std::basic_string<char>>& new_tokens) const override;
/*!
* \brief Call xparse on base class. This is available to named_value_parser
* for invoking the default parser when needed
*/
void xparse_base_(boost::any& value_store,
const std::vector<std::basic_string<char>>& new_tokens) const {
po::typed_value<ArgT>::xparse(value_store, new_tokens);
}
};
/*!
* \brief Parser helper for named_value_type
*/
template <typename ArgT>
class named_value_parser {
public:
/*!
* \brief Default implementation of parse_ - overridden in class template
* specializations
*
* Invokes the corresponding named_value_type's base_class' parser
*/
static void parse_(const named_value_type<ArgT>& nvt,
boost::any& value_store,
const std::vector<std::basic_string<char>>& new_tokens) {
nvt.xparse_base_(value_store, new_tokens);
}
};
template <class ArgT>
void named_value_type<ArgT>::xparse(boost::any& value_store,
const std::vector<std::basic_string<char>>& new_tokens) const {
// Invoked the appropriately typed named_value_parser
//std::cout << "parsing " << my_name_ << " : " << new_tokens << std::endl;
named_value_parser<ArgT>::parse_(*this, value_store, new_tokens);
}
/*!
* \brief named_value_parser specialization for uint64_t
*/
template <>
class named_value_parser<uint64_t> {
public:
static void parse_(const named_value_type<uint64_t>& nvt,
boost::any& value_store,
const std::vector<std::basic_string<char>>& new_tokens) {
(void) nvt;
size_t end_pos;
uint64_t val = utils::smartLexicalCast<uint64_t>(new_tokens.at(0), end_pos);
//std::cout << " got: " << val << std::endl;
value_store = val;
}
};
/*!
* \brief named_value_parser specialization for int64_t
*/
template <>
class named_value_parser<int64_t> {
public:
static void parse_(const named_value_type<int64_t>& nvt,
boost::any& value_store,
const std::vector<std::basic_string<char>>& new_tokens) {
(void) nvt;
size_t end_pos;
int64_t val = utils::smartLexicalCast<int64_t>(new_tokens.at(0), end_pos);
//std::cout << " got: " << val << std::endl;
value_store = val;
}
};
/*!
* \brief named_value_parser specialization for uint32_t
*/
template <>
class named_value_parser<uint32_t> {
public:
static void parse_(const named_value_type<uint32_t>& nvt,
boost::any& value_store,
const std::vector<std::basic_string<char>>& new_tokens) {
(void) nvt;
size_t end_pos;
uint32_t val = utils::smartLexicalCast<uint32_t>(new_tokens.at(0), end_pos);
//std::cout << " got: " << val << std::endl;
value_store = val;
}
};
/*!
* \brief named_value_parser specialization for int32_t
*/
template <>
class named_value_parser<int32_t> {
public:
static void parse_(const named_value_type<int32_t>& nvt,
boost::any& value_store,
const std::vector<std::basic_string<char>>& new_tokens) {
(void) nvt;
size_t end_pos;
int32_t val = utils::smartLexicalCast<int32_t>(new_tokens.at(0), end_pos);
//std::cout << " got: " << val << std::endl;
value_store = val;
}
};
/*!
* \brief named_value_parser specialization for uint16_t
*/
template <>
class named_value_parser<uint16_t> {
public:
static void parse_(const named_value_type<uint16_t>& nvt,
boost::any& value_store,
const std::vector<std::basic_string<char>>& new_tokens) {
(void) nvt;
size_t end_pos;
uint16_t val = utils::smartLexicalCast<uint16_t>(new_tokens.at(0), end_pos);
//std::cout << " got: " << val << std::endl;
value_store = val;
}
};
/*!
* \brief named_value_parser specialization for int16_t
*/
template <>
class named_value_parser<int16_t> {
public:
static void parse_(const named_value_type<int16_t>& nvt,
boost::any& value_store,
const std::vector<std::basic_string<char>>& new_tokens) {
(void) nvt;
size_t end_pos;
int16_t val = utils::smartLexicalCast<int16_t>(new_tokens.at(0), end_pos);
//std::cout << " got: " << val << std::endl;
value_store = val;
}
};
/*!
* \brief named_value_parser specialization for uint8_t
*/
template <>
class named_value_parser<uint8_t> {
public:
static void parse_(const named_value_type<uint8_t>& nvt,
boost::any& value_store,
const std::vector<std::basic_string<char>>& new_tokens) {
(void) nvt;
size_t end_pos;
uint8_t val = utils::smartLexicalCast<uint8_t>(new_tokens.at(0), end_pos);
//std::cout << " got: " << val << std::endl;
value_store = val;
}
};
/*!
* \brief named_value_parser specialization for int8_t
*/
template <>
class named_value_parser<int8_t> {
public:
static void parse_(const named_value_type<int8_t>& nvt,
boost::any& value_store,
const std::vector<std::basic_string<char>>& new_tokens) {
(void) nvt;
size_t end_pos;
int8_t val = utils::smartLexicalCast<int8_t>(new_tokens.at(0), end_pos);
//std::cout << " got: " << val << std::endl;
value_store = val;
}
};
/*!
* \brief Helper function for generating new named_value_type structs in the
* boost style
*/
template <typename ArgT>
inline named_value_type<ArgT>* named_value(std::string const& name, ArgT* val=nullptr) {
return new named_value_type<ArgT>(name, val);
}
template <typename ArgT>
inline named_value_type<ArgT>* named_value(std::string const& name, unsigned min, unsigned max, ArgT* val=nullptr) {
return new named_value_type<ArgT>(name, val, min, max);
}
/*!
* \brief Class for containing multiple levels of boost program options
*/
class MultiDetailOptions final
{
public:
typedef uint32_t level_t;
static const level_t VERBOSE = 0;
static const level_t BRIEF = 1;
/*!
* \brief Helper class for chained calls to add_options
*/
class OptAdder {
MultiDetailOptions& opts_;
public:
OptAdder(MultiDetailOptions& opts) :
opts_(opts)
{;}
/*!
* \brief Acts like calling MultiDetailOptions::add_options on the
* object that created this OptAdder.
*/
template <typename ...Args>
OptAdder& operator()(const char* name,
const char* verbose_desc,
const Args& ...args)
{
opts_.add_option_with_desc_level_(0, name, verbose_desc, args...);
return *this;
}
/*!
* \brief Acts like calling MultiDetailOptions::add_options on the
* object that created this OptAdder.
*/
template <typename ...Args>
OptAdder operator()(const char* name,
const boost::program_options::value_semantic* s,
const char* verbose_desc,
const Args& ...args)
{
opts_.add_option_with_desc_level_(0, name, s, verbose_desc, args...);
return *this;
}
};
/*!
* \brief Allow access to private adding methods
*/
friend class OptAdded;
/*!
* \brief Not copy-constructable
*/
MultiDetailOptions(const MultiDetailOptions&) = delete;
/*!
* \brief Not assignable
*/
MultiDetailOptions& operator=(const MultiDetailOptions&) = delete;
/*!
* \brief Not default-constructable
*/
MultiDetailOptions() = delete;
/*!
* \brief Construction with group nam
* \post Ensures that the VERBOSE options entry and BRIEF entries exist
*/
MultiDetailOptions(const std::string& name, uint32_t w=80, uint32_t hw=40) :
opt_adder_(*this),
name_(name)
{
descs_.emplace_back(new po::options_description(name_, w, hw));
descs_.emplace_back(new po::options_description(name_, w, hw));
sparta_assert(descs_.size() > VERBOSE);
sparta_assert(descs_.size() > BRIEF);
}
/*!
* \brief Gets the description object for a particular level if that level
* exists. If that level does not exist, returns the highest level less than
* \a level where options exist. Will never throw because VERBOSE is
* guaranteed to exist.
* Only VERBOSE and BRIEF levels are guaranteed to exist
* \note When actually parsing using these options, use the VERBOSE level
*/
const po::options_description& getOptionsLevelUpTo(level_t level) const {
if(level < descs_.size()){
return *descs_.at(level);
}else{
sparta_assert(descs_.size() > 0);
return *descs_.at(descs_.size() - 1);
}
}
/*!
* \brief Gets the description object for a particular level.
* Only VERBOSE and BRIEF levels are guaranteed to exist
* \note When actually parsing using these options, use the VERBOSE level
* \throws Exception if there is no options set at \a level
*/
const po::options_description& getOptionsLevel(level_t level) const {
return *descs_.at(level);
}
/*!
* \brief Gets the description object for the VERBOSE level
*/
const po::options_description& getVerboseOptions() const noexcept {
return *descs_.at(VERBOSE);
}
/*!
* \brief Returns the number of levels that have an options description
* which can be retrieved through getLevel
*/
size_t getNumLevels() const {
return descs_.size();
}
/*!
* \brief Add an option with NO value semantic and any number of
* descriptions. See the other add_options signature for details
*/
template <typename ...Args>
OptAdder& add_options(const char* name,
const char* verbose_desc,
const Args& ...args)
{
add_option_with_desc_level_(0, name, verbose_desc, args...);
return opt_adder_;
}
/*!
* \brief Add an option with a value semantic and any number of descriptions
* \tparam ...Args variadic argument container type. Automatically deduced
* by call signature
* \param name Name of the option to be interpreted by
* boost::program_options::options_description (e.g. "help,h").
* \param s Value semantic. Typically something generated by the helper
* sparta::app::named_value or boost::program_options::value<T>().
* \param verbose_desc Verbose description. All options have a required
* verbose description so they show up in verbose help (which is practically
* a man page) and can be appropriately parsed by boost
* \param ...args Additional const char* description arguments (like
* verbose_desc). Each additional argument is assigned to the next higher
* options level for this option (\a name). If no additional descriptions
* are given, this option will not have an entry when the options are
* printed for that level. Generally, each additional level becomes more
* brief.
* Example:
* \code
* // MultiDetailOptions opts("foo");
* opts.add_option("bar",
* "verbose description of bar",
* "brief bar desc")
* \endcode
*/
template <typename ...Args>
OptAdder& add_options(const char* name,
const boost::program_options::value_semantic* s,
const char* verbose_desc,
const Args& ...args)
{
add_option_with_desc_level_(0, name, s, verbose_desc, args...);
return opt_adder_;
}
/*!
* \brief Empty add_options shell allowing the start of chained calls
* (exists solely to mimic boost's syntax)
*
* Example:
* \code
* // MultiDetailOptions opts("foo");
* opts.add_option()("bar",
* "verbose description of bar",
* "brief bar desc")
* \endcode
*/
OptAdder& add_options()
{
return opt_adder_;
}
private:
/*!
* \brief Terminator for calls to add_option_with_desc_level_. Invoked when
* ...args is empty
*/
void add_option_with_desc_level_(size_t level,
const char* name)
{
(void) level;
(void) name;
}
/*!
* \brief Private recursive helper for handling variable argument calls to
* add_options. See the other signature for more details
*/
template <typename ...Args>
void add_option_with_desc_level_(size_t level,
const char* name,
const char* desc,
const Args& ...args) {
while(descs_.size() <= level){
descs_.emplace_back(new po::options_description(name_));
}
descs_.at(level)->add_options()
(name, desc);
// Recursively invoke until terminator overload of this func is reached
add_option_with_desc_level_(level+1, name, args...);
}
//// Terminator
//void add_option_with_desc_level_(size_t level,
// const char* name,
// const boost::program_options::value_semantic* s)
//{
// (void) level;
// (void) name;
// delete s; // Delete unused copy of value_semantic
//}
/*!
* \brief Private recursive helper for handling variable argument calls to
* add_options. Each description is added to the specified \a level and the
* rest are passed recursively to be added at the next level. Once
* \a ...args is empty, the non-templated terminator signature of this
* function is called
*/
template <typename ...Args>
void add_option_with_desc_level_(size_t level,
const char* name,
const boost::program_options::value_semantic* s,
const char* desc,
const Args& ...args) {
while(descs_.size() <= level){
descs_.emplace_back(new po::options_description(name_));
}
descs_.at(level)->add_options()
(name, s, desc);
// Recursively invoke until terminator overload of this func is reached
// Note that this invoked the OTHER signature with NO VALUE SEMANTIC.
// Boost frees these on destruction, so assigning the same pointer to
// multiple options will create a double-free segfault.
// The implication is that parsing must be done at the verbose level and
// higher levels will have no semantic information (e.g. arguments)
add_option_with_desc_level_(level+1, name, args...);
}
/*!
* \brief Option adder which is returned by add_options() to allow chained
* calls
*/
OptAdder opt_adder_;
/*!
* \brief Name of this set of options
*/
const std::string name_;
/*!
* \brief Vector of levels of boost program options option_description sets
*/
std::vector<std::unique_ptr<po::options_description>> descs_;
}; // class MultiDetailOptions
} // namespace app
} // namespace sparta
| 30.67642 | 116 | 0.601246 | debjyoti0891 |
17e732201aea8bb8e40ee4eedda7673b702fa26e | 19,132 | cpp | C++ | catkin_ws/src/pr2_controllers/pr2_calibration_controllers/src/wrist_calibration_controller.cpp | Camixxx/-noetic-pr2 | 9a2263bdb4a1b76c39ab5d62e7701baa2a117b7c | [
"MIT"
] | 4 | 2020-12-15T06:54:31.000Z | 2021-06-16T01:41:13.000Z | catkin_ws/src/pr2_controllers/pr2_calibration_controllers/src/wrist_calibration_controller.cpp | Camixxx/-noetic-pr2 | 9a2263bdb4a1b76c39ab5d62e7701baa2a117b7c | [
"MIT"
] | null | null | null | catkin_ws/src/pr2_controllers/pr2_calibration_controllers/src/wrist_calibration_controller.cpp | Camixxx/-noetic-pr2 | 9a2263bdb4a1b76c39ab5d62e7701baa2a117b7c | [
"MIT"
] | 2 | 2021-01-25T03:54:51.000Z | 2021-06-23T09:47:27.000Z | /*
* Copyright (c) 2008, Willow Garage, Inc.
* 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 the Willow Garage, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Author: Stuart Glaser
*/
#include "pr2_calibration_controllers/wrist_calibration_controller.h"
#include "pluginlib/class_list_macros.h"
PLUGINLIB_EXPORT_CLASS(controller::WristCalibrationController, pr2_controller_interface::Controller)
namespace controller {
WristCalibrationController::WristCalibrationController()
: robot_(NULL), last_publish_time_(0)
{
}
WristCalibrationController::~WristCalibrationController()
{
for (size_t i = 0; i < fake_as.size(); ++i)
delete fake_as[i];
for (size_t i = 0; i < fake_js.size(); ++i)
delete fake_js[i];
}
bool WristCalibrationController::init(pr2_mechanism_model::RobotState *robot,
ros::NodeHandle &n)
{
assert(robot);
node_ = n;
robot_ = robot;
// Joints
std::string roll_joint_name;
if (!node_.getParam("roll_joint", roll_joint_name))
{
ROS_ERROR("No roll joint given (namespace: %s)", node_.getNamespace().c_str());
return false;
}
if (!(roll_joint_ = robot->getJointState(roll_joint_name)))
{
ROS_ERROR("Could not find roll joint \"%s\" (namespace: %s)",
roll_joint_name.c_str(), node_.getNamespace().c_str());
return false;
}
if (!roll_joint_->joint_->calibration)
{
ROS_ERROR("Joint \"%s\" has no calibration reference position specified (namespace: %s)",
roll_joint_name.c_str(), node_.getNamespace().c_str());
return false;
}
std::string flex_joint_name;
if (!node_.getParam("flex_joint", flex_joint_name))
{
ROS_ERROR("No flex joint given (namespace: %s)", node_.getNamespace().c_str());
return false;
}
if (!(flex_joint_ = robot->getJointState(flex_joint_name)))
{
ROS_ERROR("Could not find flex joint \"%s\" (namespace: %s)",
flex_joint_name.c_str(), node_.getNamespace().c_str());
return false;
}
if (!flex_joint_->joint_->calibration)
{
ROS_ERROR("Joint \"%s\" has no calibration reference position specified (namespace: %s)",
flex_joint_name.c_str(), node_.getNamespace().c_str());
return false;
}
if (!node_.getParam("roll_velocity", roll_search_velocity_))
{
ROS_ERROR("No roll_velocity given (namespace: %s)", node_.getNamespace().c_str());
return false;
}
// check if calibration fields are supported by this controller
if (!roll_joint_->joint_->calibration->falling && !roll_joint_->joint_->calibration->rising){
ROS_ERROR("No rising or falling edge is specified for calibration of joint %s. Note that the reference_position is not used any more", roll_joint_name.c_str());
return false;
}
if (roll_joint_->joint_->calibration->falling && roll_joint_->joint_->calibration->rising && roll_joint_->joint_->type != urdf::Joint::CONTINUOUS){
ROS_ERROR("Both rising and falling edge are specified for non-continuous joint %s. This is not supported.", roll_joint_name.c_str());
return false;
}
if (roll_search_velocity_ < 0){
roll_search_velocity_ *= -1;
ROS_ERROR("Negative search velocity is not supported for joint %s. Making the search velocity positve.", roll_joint_name.c_str());
}
// sets reference position
if (roll_joint_->joint_->calibration->falling && roll_joint_->joint_->calibration->rising){
roll_joint_->reference_position_ = *(roll_joint_->joint_->calibration->rising);
}
else if (roll_joint_->joint_->calibration->falling){
roll_joint_->reference_position_ = *(roll_joint_->joint_->calibration->falling);
}
else if (roll_joint_->joint_->calibration->rising){
roll_joint_->reference_position_ = *(roll_joint_->joint_->calibration->rising);
}
if (!node_.getParam("flex_velocity", flex_search_velocity_))
{
ROS_ERROR("No flex_velocity given (namespace: %s)", node_.getNamespace().c_str());
return false;
}
// check if calibration fields are supported by this controller
if (!flex_joint_->joint_->calibration->falling && !flex_joint_->joint_->calibration->rising){
ROS_ERROR("No rising or falling edge is specified for calibration of joint %s. Note that the reference_position is not used any more", flex_joint_name.c_str());
return false;
}
if (flex_joint_->joint_->calibration->falling && flex_joint_->joint_->calibration->rising && flex_joint_->joint_->type != urdf::Joint::CONTINUOUS){
ROS_ERROR("Both rising and falling edge are specified for non-continuous joint %s. This is not supported.", flex_joint_name.c_str());
return false;
}
if (flex_search_velocity_ < 0){
flex_search_velocity_ *= -1;
ROS_ERROR("Negative search velocity is not supported for joint %s. Making the search velocity positve.", flex_joint_name.c_str());
}
// sets reference position
if (flex_joint_->joint_->calibration->falling && flex_joint_->joint_->calibration->rising){
flex_joint_->reference_position_ = *(flex_joint_->joint_->calibration->rising);
}
else if (flex_joint_->joint_->calibration->falling){
flex_joint_->reference_position_ = *(flex_joint_->joint_->calibration->falling);
}
else if (flex_joint_->joint_->calibration->rising){
flex_joint_->reference_position_ = *(flex_joint_->joint_->calibration->rising);
}
// Actuators
std::string actuator_l_name;
if (!node_.getParam("actuator_l", actuator_l_name))
{
ROS_ERROR("No actuator_l given (namespace: %s)", node_.getNamespace().c_str());
return false;
}
if (!(actuator_l_ = robot->model_->getActuator(actuator_l_name)))
{
ROS_ERROR("Could not find actuator \"%s\" (namespace: %s)",
actuator_l_name.c_str(), node_.getNamespace().c_str());
return false;
}
std::string actuator_r_name;
if (!node_.getParam("actuator_r", actuator_r_name))
{
ROS_ERROR("No actuator_r given (namespace: %s)", node_.getNamespace().c_str());
return false;
}
if (!(actuator_r_ = robot->model_->getActuator(actuator_r_name)))
{
ROS_ERROR("Could not find actuator \"%s\" (namespace: %s)",
actuator_r_name.c_str(), node_.getNamespace().c_str());
return false;
}
bool force_calibration = false;
node_.getParam("force_calibration", force_calibration);
roll_joint_->calibrated_ = false;
flex_joint_->calibrated_ = false;
state_ = INITIALIZED;
if (actuator_l_->state_.zero_offset_ != 0 && actuator_l_->state_.zero_offset_ != 0){
if (force_calibration)
{
ROS_INFO("Joints %s and %s are already calibrated but will be recalibrated. "
"Actuator %s was zeroed at %f and %s was zeroed at %f.",
flex_joint_name.c_str(), roll_joint_name.c_str(),
actuator_r_->name_.c_str(), actuator_r_->state_.zero_offset_,
actuator_l_->name_.c_str(), actuator_l_->state_.zero_offset_
);
}
else
{
ROS_INFO("Wrist joints %s and %s are already calibrated", flex_joint_name.c_str(), roll_joint_name.c_str());
flex_joint_->calibrated_ = true;
roll_joint_->calibrated_ = true;
state_ = CALIBRATED;
}
}
else{
ROS_INFO("Not both wrist joints %s and %s are are calibrated. Will re-calibrate both of them", flex_joint_name.c_str(), roll_joint_name.c_str());
}
// Transmission
std::string transmission_name;
if (!node_.getParam("transmission", transmission_name))
{
ROS_ERROR("No transmission given (namespace: %s)", node_.getNamespace().c_str());
return false;
}
if (!(transmission_ = robot->model_->getTransmission(transmission_name)))
{
ROS_ERROR("Could not find transmission \"%s\" (namespace: %s)",
transmission_name.c_str(), node_.getNamespace().c_str());
return false;
}
// Prepares the namespaces for the velocity controllers
XmlRpc::XmlRpcValue pid;
node_.getParam("pid", pid);
ros::NodeHandle roll_node(node_, "roll_velocity");
roll_node.setParam("type", std::string("JointVelocityController"));
roll_node.setParam("joint", roll_joint_name);
roll_node.setParam("pid", pid);
ros::NodeHandle flex_node(node_, "flex_velocity");
flex_node.setParam("type", std::string("JointVelocityController"));
flex_node.setParam("joint", flex_joint_name);
flex_node.setParam("pid", pid);
fake_as.push_back(new pr2_hardware_interface::Actuator);
fake_as.push_back(new pr2_hardware_interface::Actuator);
fake_js.push_back(new pr2_mechanism_model::JointState);
fake_js.push_back(new pr2_mechanism_model::JointState);
const int LEFT_MOTOR = pr2_mechanism_model::WristTransmission::LEFT_MOTOR;
const int RIGHT_MOTOR = pr2_mechanism_model::WristTransmission::RIGHT_MOTOR;
const int FLEX_JOINT = pr2_mechanism_model::WristTransmission::FLEX_JOINT;
const int ROLL_JOINT = pr2_mechanism_model::WristTransmission::ROLL_JOINT;
fake_js[FLEX_JOINT]->joint_ = flex_joint_->joint_;
fake_js[ROLL_JOINT]->joint_ = roll_joint_->joint_;
if (!vc_roll_.init(robot_, roll_node)) return false;
if (!vc_flex_.init(robot_, flex_node)) return false;
// advertise service to check calibration
is_calibrated_srv_ = node_.advertiseService("is_calibrated", &WristCalibrationController::isCalibrated, this);
// "Calibrated" topic
pub_calibrated_.reset(new realtime_tools::RealtimePublisher<std_msgs::Empty>(node_, "calibrated", 1));
return true;
}
void WristCalibrationController::starting()
{
state_ = INITIALIZED;
actuator_r_->state_.zero_offset_ = 0.0;
actuator_l_->state_.zero_offset_ = 0.0;
flex_joint_->calibrated_ = false;
roll_joint_->calibrated_ = false;
}
bool WristCalibrationController::isCalibrated(pr2_controllers_msgs::QueryCalibrationState::Request& req,
pr2_controllers_msgs::QueryCalibrationState::Response& resp)
{
ROS_DEBUG("Is calibrated service %d", state_ == CALIBRATED);
resp.is_calibrated = (state_ == CALIBRATED);
return true;
}
void WristCalibrationController::update()
{
// Flex optical switch is connected to actuator_l
// Roll optical switch is connected to actuator_r
switch(state_)
{
case INITIALIZED:
actuator_l_->state_.zero_offset_ = 0;
actuator_r_->state_.zero_offset_ = 0;
flex_joint_->calibrated_ = false;
roll_joint_->calibrated_ = false;
vc_flex_.setCommand(0);
vc_roll_.setCommand(0);
state_ = BEGINNING;
break;
case BEGINNING:
vc_roll_.setCommand(0);
// Because of the huge hysteresis on the wrist flex calibration sensor, we want to move towards the
// high side for a long period of time, regardless of which side we start on
countdown_ = 1000;
if (actuator_l_->state_.calibration_reading_)
state_ = MOVING_FLEX_TO_HIGH;
else
state_ = MOVING_FLEX_TO_HIGH;
break;
case MOVING_FLEX_TO_HIGH:
vc_flex_.setCommand(-flex_search_velocity_);
if (actuator_l_->state_.calibration_reading_)
{
if (--countdown_ <= 0)
state_ = MOVING_FLEX;
}
else
countdown_ = 1000;
break;
case MOVING_FLEX: {
// Calibrates across the falling edge in the positive joint direction.
vc_flex_.setCommand(flex_search_velocity_);
if (actuator_l_->state_.calibration_reading_ == false)
{
flex_switch_l_ = actuator_l_->state_.last_calibration_falling_edge_;
// But where was actuator_r at the transition? Unfortunately,
// actuator_r is not connected to the flex joint's optical
// switch, so we don't know directly. Instead, we estimate
// actuator_r's position based on the switch position of
// actuator_l.
double dl = actuator_l_->state_.position_ - prev_actuator_l_position_;
double dr = actuator_r_->state_.position_ - prev_actuator_r_position_;
double k = (flex_switch_l_ - prev_actuator_l_position_) / dl;
if (dl == 0)
{
// This might be a serious hardware failure, so we're going to break realtime.
ROS_WARN("Left actuator (flex joint) didn't move even though the calibration flag tripped. "
"This may indicate an encoder problem. (namespace: %s",
node_.getNamespace().c_str());
k = 0.5;
}
else if ( !(0 <= k && k <= 1) )
{
// This is really serious, so we're going to break realtime to report it.
ROS_ERROR("k = %.4lf is outside of [0,1]. This probably indicates a hardware failure "
"on the left actuator or the flex joint. dl = %.4lf, dr = %.4lf, prev = %.4lf. "
"Broke realtime to report (namespace: %s)",
k, dl, dr, prev_actuator_l_position_, node_.getNamespace().c_str());
state_ = INITIALIZED;
break;
}
flex_switch_r_ = k * dr + prev_actuator_r_position_;
//original_switch_state_ = actuator_r_->state_.calibration_reading_;
// Now we calibrate the roll joint
vc_flex_.setCommand(0);
if (actuator_r_->state_.calibration_reading_)
state_ = MOVING_ROLL_TO_LOW;
else
state_ = MOVING_ROLL;
}
break;
}
case MOVING_ROLL_TO_LOW:
vc_roll_.setCommand(roll_search_velocity_);
if (actuator_r_->state_.calibration_reading_ == false)
state_ = MOVING_ROLL;
break;
case MOVING_ROLL: {
// Calibrates across the rising edge in the positive joint direction.
vc_roll_.setCommand(roll_search_velocity_);
if (actuator_r_->state_.calibration_reading_)
{
roll_switch_r_ = actuator_r_->state_.last_calibration_rising_edge_;
// See corresponding comment above.
double dl = actuator_l_->state_.position_ - prev_actuator_l_position_;
double dr = actuator_r_->state_.position_ - prev_actuator_r_position_;
double k = (roll_switch_r_ - prev_actuator_r_position_) / dr;
if (dr == 0)
{
// This might be a serious hardware failure, so we're going to break realtime.
ROS_WARN("Right actuator (roll joint) didn't move even though the calibration flag tripped. "
"This may indicate an encoder problem. (namespace: %s",
node_.getNamespace().c_str());
k = 0.5;
}
else if ( !(0 <= k && k <= 1) )
{
// This is really serious, so we're going to break realtime to report it.
ROS_ERROR("k = %.4lf is outside of [0,1]. This probably indicates a hardware failure "
"on the right actuator or the roll joint. dl = %.4lf, dr = %.4lf, prev = %.4lf. "
"Broke realtime to report (namespace: %s)",
k, dl, dr, prev_actuator_r_position_, node_.getNamespace().c_str());
state_ = INITIALIZED;
break;
}
roll_switch_l_ = k * dl + prev_actuator_l_position_;
//----------------------------------------------------------------------
// Calibration computation
//----------------------------------------------------------------------
// At this point, we know the actuator positions when the
// optical switches were hit. Now we compute the actuator
// positions when the joints should be at 0.
const int LEFT_MOTOR = pr2_mechanism_model::WristTransmission::LEFT_MOTOR;
const int RIGHT_MOTOR = pr2_mechanism_model::WristTransmission::RIGHT_MOTOR;
const int FLEX_JOINT = pr2_mechanism_model::WristTransmission::FLEX_JOINT;
const int ROLL_JOINT = pr2_mechanism_model::WristTransmission::ROLL_JOINT;
// Finds the (uncalibrated) joint position where the flex optical switch triggers
fake_as[LEFT_MOTOR]->state_.position_ = flex_switch_l_;
fake_as[RIGHT_MOTOR]->state_.position_ = flex_switch_r_;
transmission_->propagatePosition(fake_as, fake_js);
double flex_joint_switch = fake_js[FLEX_JOINT]->position_;
// Finds the (uncalibrated) joint position where the roll optical switch triggers
fake_as[LEFT_MOTOR]->state_.position_ = roll_switch_l_;
fake_as[RIGHT_MOTOR]->state_.position_ = roll_switch_r_;
transmission_->propagatePosition(fake_as, fake_js);
double roll_joint_switch = fake_js[ROLL_JOINT]->position_;
// Finds the (uncalibrated) joint position at the desired zero
fake_js[FLEX_JOINT]->position_ = flex_joint_switch;
fake_js[ROLL_JOINT]->position_ = roll_joint_switch;
// Determines the actuator zero position from the desired joint zero positions
transmission_->propagatePositionBackwards(fake_js, fake_as);
if (std::isnan(fake_as[LEFT_MOTOR]->state_.position_) ||
std::isnan(fake_as[RIGHT_MOTOR]->state_.position_))
{
ROS_ERROR("Restarting calibration because a computed offset was NaN. If this happens "
"repeatedly it may indicate a hardware failure. (namespace: %s)",
node_.getNamespace().c_str());
state_ = INITIALIZED;
break;
}
actuator_l_->state_.zero_offset_ = fake_as[LEFT_MOTOR]->state_.position_;
actuator_r_->state_.zero_offset_ = fake_as[RIGHT_MOTOR]->state_.position_;
flex_joint_->calibrated_ = true;
roll_joint_->calibrated_ = true;
state_ = CALIBRATED;
vc_flex_.setCommand(0);
vc_roll_.setCommand(0);
}
break;
}
case CALIBRATED:
if (pub_calibrated_) {
if (last_publish_time_ + ros::Duration(0.5) < robot_->getTime()) {
assert(pub_calibrated_);
if (pub_calibrated_->trylock()) {
last_publish_time_ = robot_->getTime();
pub_calibrated_->unlockAndPublish();
}
}
}
break;
}
if (state_ != CALIBRATED)
{
vc_flex_.update();
vc_roll_.update();
}
prev_actuator_l_position_ = actuator_l_->state_.position_;
prev_actuator_r_position_ = actuator_r_->state_.position_;
}
}
| 38.650505 | 164 | 0.689369 | Camixxx |
17e7af81d392d433bb24ade2234e33c988c1466f | 328,494 | cc | C++ | schemas/cpp/openconfig/openconfig_wavelength_router/openconfig_wavelength_router.pb.cc | seilis/serialization-perf | 447cab4bfee66c8a86062b1b6169bddf81036a79 | [
"Apache-2.0"
] | null | null | null | schemas/cpp/openconfig/openconfig_wavelength_router/openconfig_wavelength_router.pb.cc | seilis/serialization-perf | 447cab4bfee66c8a86062b1b6169bddf81036a79 | [
"Apache-2.0"
] | 2 | 2018-05-10T22:57:40.000Z | 2018-05-16T10:14:23.000Z | schemas/cpp/openconfig/openconfig_wavelength_router/openconfig_wavelength_router.pb.cc | seilis/serialization-perf | 447cab4bfee66c8a86062b1b6169bddf81036a79 | [
"Apache-2.0"
] | 1 | 2018-05-09T03:03:01.000Z | 2018-05-09T03:03:01.000Z | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: openconfig/openconfig_wavelength_router/openconfig_wavelength_router.proto
#include "openconfig/openconfig_wavelength_router/openconfig_wavelength_router.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>
// This is a temporary google only hack
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
#include "third_party/protobuf/version.h"
#endif
// @@protoc_insertion_point(includes)
namespace openconfig {
namespace openconfig_wavelength_router {
class WavelengthRouter_MediaChannels_Channel_ConfigDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<WavelengthRouter_MediaChannels_Channel_Config>
_instance;
} _WavelengthRouter_MediaChannels_Channel_Config_default_instance_;
class WavelengthRouter_MediaChannels_Channel_Dest_ConfigDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<WavelengthRouter_MediaChannels_Channel_Dest_Config>
_instance;
} _WavelengthRouter_MediaChannels_Channel_Dest_Config_default_instance_;
class WavelengthRouter_MediaChannels_Channel_Dest_StateDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<WavelengthRouter_MediaChannels_Channel_Dest_State>
_instance;
} _WavelengthRouter_MediaChannels_Channel_Dest_State_default_instance_;
class WavelengthRouter_MediaChannels_Channel_DestDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<WavelengthRouter_MediaChannels_Channel_Dest>
_instance;
} _WavelengthRouter_MediaChannels_Channel_Dest_default_instance_;
class WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_ConfigDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config>
_instance;
} _WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config_default_instance_;
class WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_StateDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State>
_instance;
} _WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State_default_instance_;
class WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue>
_instance;
} _WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_default_instance_;
class WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKeyDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey>
_instance;
} _WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey_default_instance_;
class WavelengthRouter_MediaChannels_Channel_PsdDistributionDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<WavelengthRouter_MediaChannels_Channel_PsdDistribution>
_instance;
} _WavelengthRouter_MediaChannels_Channel_PsdDistribution_default_instance_;
class WavelengthRouter_MediaChannels_Channel_Source_ConfigDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<WavelengthRouter_MediaChannels_Channel_Source_Config>
_instance;
} _WavelengthRouter_MediaChannels_Channel_Source_Config_default_instance_;
class WavelengthRouter_MediaChannels_Channel_Source_StateDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<WavelengthRouter_MediaChannels_Channel_Source_State>
_instance;
} _WavelengthRouter_MediaChannels_Channel_Source_State_default_instance_;
class WavelengthRouter_MediaChannels_Channel_SourceDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<WavelengthRouter_MediaChannels_Channel_Source>
_instance;
} _WavelengthRouter_MediaChannels_Channel_Source_default_instance_;
class WavelengthRouter_MediaChannels_Channel_StateDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<WavelengthRouter_MediaChannels_Channel_State>
_instance;
} _WavelengthRouter_MediaChannels_Channel_State_default_instance_;
class WavelengthRouter_MediaChannels_ChannelDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<WavelengthRouter_MediaChannels_Channel>
_instance;
} _WavelengthRouter_MediaChannels_Channel_default_instance_;
class WavelengthRouter_MediaChannels_ChannelKeyDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<WavelengthRouter_MediaChannels_ChannelKey>
_instance;
} _WavelengthRouter_MediaChannels_ChannelKey_default_instance_;
class WavelengthRouter_MediaChannelsDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<WavelengthRouter_MediaChannels>
_instance;
} _WavelengthRouter_MediaChannels_default_instance_;
class WavelengthRouterDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<WavelengthRouter>
_instance;
} _WavelengthRouter_default_instance_;
} // namespace openconfig_wavelength_router
} // namespace openconfig
namespace protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto {
void InitDefaultsWavelengthRouter_MediaChannels_Channel_ConfigImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
protobuf_github_2ecom_2fopenconfig_2fygot_2fproto_2fywrapper_2fywrapper_2eproto::InitDefaultsUintValue();
protobuf_github_2ecom_2fopenconfig_2fygot_2fproto_2fywrapper_2fywrapper_2eproto::InitDefaultsStringValue();
{
void* ptr = &::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Config_default_instance_;
new (ptr) ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Config();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Config::InitAsDefaultInstance();
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_Config() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsWavelengthRouter_MediaChannels_Channel_ConfigImpl);
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_Dest_ConfigImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
protobuf_github_2ecom_2fopenconfig_2fygot_2fproto_2fywrapper_2fywrapper_2eproto::InitDefaultsStringValue();
{
void* ptr = &::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Dest_Config_default_instance_;
new (ptr) ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest_Config();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest_Config::InitAsDefaultInstance();
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_Dest_Config() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsWavelengthRouter_MediaChannels_Channel_Dest_ConfigImpl);
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_Dest_StateImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
protobuf_github_2ecom_2fopenconfig_2fygot_2fproto_2fywrapper_2fywrapper_2eproto::InitDefaultsStringValue();
{
void* ptr = &::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Dest_State_default_instance_;
new (ptr) ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest_State();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest_State::InitAsDefaultInstance();
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_Dest_State() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsWavelengthRouter_MediaChannels_Channel_Dest_StateImpl);
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_DestImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_Dest_Config();
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_Dest_State();
{
void* ptr = &::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Dest_default_instance_;
new (ptr) ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest::InitAsDefaultInstance();
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_Dest() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsWavelengthRouter_MediaChannels_Channel_DestImpl);
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_ConfigImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
protobuf_github_2ecom_2fopenconfig_2fygot_2fproto_2fywrapper_2fywrapper_2eproto::InitDefaultsUintValue();
protobuf_github_2ecom_2fopenconfig_2fygot_2fproto_2fywrapper_2fywrapper_2eproto::InitDefaultsBytesValue();
{
void* ptr = &::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config_default_instance_;
new (ptr) ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::InitAsDefaultInstance();
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_ConfigImpl);
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_StateImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
protobuf_github_2ecom_2fopenconfig_2fygot_2fproto_2fywrapper_2fywrapper_2eproto::InitDefaultsUintValue();
protobuf_github_2ecom_2fopenconfig_2fygot_2fproto_2fywrapper_2fywrapper_2eproto::InitDefaultsBytesValue();
{
void* ptr = &::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State_default_instance_;
new (ptr) ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::InitAsDefaultInstance();
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_StateImpl);
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config();
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State();
{
void* ptr = &::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_default_instance_;
new (ptr) ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::InitAsDefaultInstance();
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueImpl);
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKeyImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue();
{
void* ptr = &::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey_default_instance_;
new (ptr) ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::InitAsDefaultInstance();
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKeyImpl);
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistributionImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey();
{
void* ptr = &::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_PsdDistribution_default_instance_;
new (ptr) ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution::InitAsDefaultInstance();
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistributionImpl);
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_Source_ConfigImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
protobuf_github_2ecom_2fopenconfig_2fygot_2fproto_2fywrapper_2fywrapper_2eproto::InitDefaultsStringValue();
{
void* ptr = &::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Source_Config_default_instance_;
new (ptr) ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source_Config();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source_Config::InitAsDefaultInstance();
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_Source_Config() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsWavelengthRouter_MediaChannels_Channel_Source_ConfigImpl);
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_Source_StateImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
protobuf_github_2ecom_2fopenconfig_2fygot_2fproto_2fywrapper_2fywrapper_2eproto::InitDefaultsStringValue();
{
void* ptr = &::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Source_State_default_instance_;
new (ptr) ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source_State();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source_State::InitAsDefaultInstance();
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_Source_State() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsWavelengthRouter_MediaChannels_Channel_Source_StateImpl);
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_SourceImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_Source_Config();
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_Source_State();
{
void* ptr = &::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Source_default_instance_;
new (ptr) ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source::InitAsDefaultInstance();
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_Source() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsWavelengthRouter_MediaChannels_Channel_SourceImpl);
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_StateImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
protobuf_github_2ecom_2fopenconfig_2fygot_2fproto_2fywrapper_2fywrapper_2eproto::InitDefaultsUintValue();
protobuf_github_2ecom_2fopenconfig_2fygot_2fproto_2fywrapper_2fywrapper_2eproto::InitDefaultsStringValue();
{
void* ptr = &::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_State_default_instance_;
new (ptr) ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_State();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_State::InitAsDefaultInstance();
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel_State() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsWavelengthRouter_MediaChannels_Channel_StateImpl);
}
void InitDefaultsWavelengthRouter_MediaChannels_ChannelImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_Config();
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_Dest();
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution();
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_Source();
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_State();
{
void* ptr = &::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_default_instance_;
new (ptr) ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel::InitAsDefaultInstance();
}
void InitDefaultsWavelengthRouter_MediaChannels_Channel() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsWavelengthRouter_MediaChannels_ChannelImpl);
}
void InitDefaultsWavelengthRouter_MediaChannels_ChannelKeyImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel();
{
void* ptr = &::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_ChannelKey_default_instance_;
new (ptr) ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_ChannelKey();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_ChannelKey::InitAsDefaultInstance();
}
void InitDefaultsWavelengthRouter_MediaChannels_ChannelKey() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsWavelengthRouter_MediaChannels_ChannelKeyImpl);
}
void InitDefaultsWavelengthRouter_MediaChannelsImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_ChannelKey();
{
void* ptr = &::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_default_instance_;
new (ptr) ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels::InitAsDefaultInstance();
}
void InitDefaultsWavelengthRouter_MediaChannels() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsWavelengthRouter_MediaChannelsImpl);
}
void InitDefaultsWavelengthRouterImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels();
{
void* ptr = &::openconfig::openconfig_wavelength_router::_WavelengthRouter_default_instance_;
new (ptr) ::openconfig::openconfig_wavelength_router::WavelengthRouter();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::openconfig::openconfig_wavelength_router::WavelengthRouter::InitAsDefaultInstance();
}
void InitDefaultsWavelengthRouter() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsWavelengthRouterImpl);
}
::google::protobuf::Metadata file_level_metadata[17];
const ::google::protobuf::EnumDescriptor* file_level_enum_descriptors[1];
const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Config, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Config, admin_status_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Config, index_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Config, lower_frequency_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Config, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Config, upper_frequency_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest_Config, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest_Config, port_name_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest_State, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest_State, port_name_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest, config_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest, state_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config, lower_frequency_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config, psd_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config, upper_frequency_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State, lower_frequency_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State, psd_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State, upper_frequency_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue, config_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue, state_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey, lower_frequency_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey, upper_frequency_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey, psd_value_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution, psd_value_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source_Config, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source_Config, port_name_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source_State, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source_State, port_name_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source, config_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source, state_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_State, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_State, admin_status_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_State, index_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_State, lower_frequency_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_State, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_State, oper_status_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_State, upper_frequency_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel, config_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel, dest_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel, psd_distribution_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel, source_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel, state_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_ChannelKey, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_ChannelKey, index_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_ChannelKey, channel_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels, channel_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::openconfig::openconfig_wavelength_router::WavelengthRouter, media_channels_),
};
static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
{ 0, -1, sizeof(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Config)},
{ 10, -1, sizeof(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest_Config)},
{ 16, -1, sizeof(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest_State)},
{ 22, -1, sizeof(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest)},
{ 29, -1, sizeof(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config)},
{ 37, -1, sizeof(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State)},
{ 45, -1, sizeof(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue)},
{ 52, -1, sizeof(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey)},
{ 60, -1, sizeof(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution)},
{ 66, -1, sizeof(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source_Config)},
{ 72, -1, sizeof(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source_State)},
{ 78, -1, sizeof(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source)},
{ 85, -1, sizeof(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_State)},
{ 96, -1, sizeof(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel)},
{ 106, -1, sizeof(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_ChannelKey)},
{ 113, -1, sizeof(::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels)},
{ 119, -1, sizeof(::openconfig::openconfig_wavelength_router::WavelengthRouter)},
};
static ::google::protobuf::Message const * const file_default_instances[] = {
reinterpret_cast<const ::google::protobuf::Message*>(&::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Config_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Dest_Config_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Dest_State_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Dest_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_PsdDistribution_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Source_Config_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Source_State_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Source_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_State_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_ChannelKey_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::openconfig::openconfig_wavelength_router::_WavelengthRouter_default_instance_),
};
void protobuf_AssignDescriptors() {
AddDescriptors();
::google::protobuf::MessageFactory* factory = NULL;
AssignDescriptors(
"openconfig/openconfig_wavelength_router/openconfig_wavelength_router.proto", schemas, file_default_instances, TableStruct::offsets, factory,
file_level_metadata, file_level_enum_descriptors, NULL);
}
void protobuf_AssignDescriptorsOnce() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
}
void protobuf_RegisterTypes(const ::std::string&) GOOGLE_PROTOBUF_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 17);
}
void AddDescriptorsImpl() {
InitDefaults();
static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
"\nJopenconfig/openconfig_wavelength_route"
"r/openconfig_wavelength_router.proto\022\'op"
"enconfig.openconfig_wavelength_router\0328g"
"ithub.com/openconfig/ygot/proto/ywrapper"
"/ywrapper.proto\0320github.com/openconfig/y"
"got/proto/yext/yext.proto\032\034openconfig/en"
"ums/enums.proto\"\213.\n\020WavelengthRouter\022\210\001\n"
"\016media_channels\030\306\265\346< \001(\0132G.openconfig.op"
"enconfig_wavelength_router.WavelengthRou"
"ter.MediaChannelsB$\202A!/wavelength-router"
"/media-channels\032\353,\n\rMediaChannels\022\225\001\n\007ch"
"annel\030\322\217\376\377\001 \003(\0132R.openconfig.openconfig_"
"wavelength_router.WavelengthRouter.Media"
"Channels.ChannelKeyB,\202A)/wavelength-rout"
"er/media-channels/channel\032\215*\n\007Channel\022\237\001"
"\n\006config\030\223\233\271\303\001 \001(\0132V.openconfig.openconf"
"ig_wavelength_router.WavelengthRouter.Me"
"diaChannels.Channel.ConfigB3\202A0/waveleng"
"th-router/media-channels/channel/config\022"
"\230\001\n\004dest\030\345\324\264E \001(\0132T.openconfig.openconfi"
"g_wavelength_router.WavelengthRouter.Med"
"iaChannels.Channel.DestB1\202A./wavelength-"
"router/media-channels/channel/dest\022\273\001\n\020p"
"sd_distribution\030\335\367\215\027 \001(\0132_.openconfig.op"
"enconfig_wavelength_router.WavelengthRou"
"ter.MediaChannels.Channel.PsdDistributio"
"nB=\202A:/wavelength-router/media-channels/"
"channel/psd-distribution\022\236\001\n\006source\030\312\245\310u"
" \001(\0132V.openconfig.openconfig_wavelength_"
"router.WavelengthRouter.MediaChannels.Ch"
"annel.SourceB3\202A0/wavelength-router/medi"
"a-channels/channel/source\022\234\001\n\005state\030\364\330\354\313"
"\001 \001(\0132U.openconfig.openconfig_wavelength"
"_router.WavelengthRouter.MediaChannels.C"
"hannel.StateB2\202A//wavelength-router/medi"
"a-channels/channel/state\032\324\004\n\006Config\022\225\001\n\014"
"admin_status\030\212\320\321F \001(\0162:.openconfig.enums"
".OpenconfigWavelengthRouterAdminStateTyp"
"eB@\202A=/wavelength-router/media-channels/"
"channel/config/admin-status\022a\n\005index\030\342\362\337"
"\217\001 \001(\0132\023.ywrapper.UintValueB9\202A6/wavelen"
"gth-router/media-channels/channel/config"
"/index\022u\n\017lower_frequency\030\210\262\333\376\001 \001(\0132\023.yw"
"rapper.UintValueBC\202A@/wavelength-router/"
"media-channels/channel/config/lower-freq"
"uency\022a\n\004name\030\303\321\264\247\001 \001(\0132\025.ywrapper.Strin"
"gValueB8\202A5/wavelength-router/media-chan"
"nels/channel/config/name\022u\n\017upper_freque"
"ncy\030\207\340\374\315\001 \001(\0132\023.ywrapper.UintValueBC\202A@/"
"wavelength-router/media-channels/channel"
"/config/upper-frequency\032\317\004\n\004Dest\022\251\001\n\006con"
"fig\030\252\236\260\212\001 \001(\0132[.openconfig.openconfig_wa"
"velength_router.WavelengthRouter.MediaCh"
"annels.Channel.Dest.ConfigB8\202A5/waveleng"
"th-router/media-channels/channel/dest/co"
"nfig\022\245\001\n\005state\030\307\212\220\005 \001(\0132Z.openconfig.ope"
"nconfig_wavelength_router.WavelengthRout"
"er.MediaChannels.Channel.Dest.StateB7\202A4"
"/wavelength-router/media-channels/channe"
"l/dest/state\032y\n\006Config\022o\n\tport_name\030\270\205\360\013"
" \001(\0132\025.ywrapper.StringValueBB\202A\?/wavelen"
"gth-router/media-channels/channel/dest/c"
"onfig/port-name\032x\n\005State\022o\n\tport_name\030\255\244"
"\321\250\001 \001(\0132\025.ywrapper.StringValueBA\202A>/wave"
"length-router/media-channels/channel/des"
"t/state/port-name\032\325\016\n\017PsdDistribution\022\313\001"
"\n\tpsd_value\030\275\325\245\247\001 \003(\0132k.openconfig.openc"
"onfig_wavelength_router.WavelengthRouter"
".MediaChannels.Channel.PsdDistribution.P"
"sdValueKeyBG\202AD/wavelength-router/media-"
"channels/channel/psd-distribution/psd-va"
"lue\032\202\n\n\010PsdValue\022\322\001\n\006config\030\362\373\330C \001(\0132o.o"
"penconfig.openconfig_wavelength_router.W"
"avelengthRouter.MediaChannels.Channel.Ps"
"dDistribution.PsdValue.ConfigBN\202AK/wavel"
"ength-router/media-channels/channel/psd-"
"distribution/psd-value/config\022\317\001\n\005state\030"
"\357\325\223\t \001(\0132n.openconfig.openconfig_wavelen"
"gth_router.WavelengthRouter.MediaChannel"
"s.Channel.PsdDistribution.PsdValue.State"
"BM\202AJ/wavelength-router/media-channels/c"
"hannel/psd-distribution/psd-value/state\032"
"\247\003\n\006Config\022\217\001\n\017lower_frequency\030\255\216\2052 \001(\0132"
"\023.ywrapper.UintValueB^\202A[/wavelength-rou"
"ter/media-channels/channel/psd-distribut"
"ion/psd-value/config/lower-frequency\022x\n\003"
"psd\030\302\333\317\002 \001(\0132\024.ywrapper.BytesValueBR\202AO/"
"wavelength-router/media-channels/channel"
"/psd-distribution/psd-value/config/psd\022\220"
"\001\n\017upper_frequency\030\352\271\201\354\001 \001(\0132\023.ywrapper."
"UintValueB^\202A[/wavelength-router/media-c"
"hannels/channel/psd-distribution/psd-val"
"ue/config/upper-frequency\032\244\003\n\005State\022\216\001\n\017"
"lower_frequency\030\374\346\272J \001(\0132\023.ywrapper.Uint"
"ValueB]\202AZ/wavelength-router/media-chann"
"els/channel/psd-distribution/psd-value/s"
"tate/lower-frequency\022x\n\003psd\030\227\230\204\301\001 \001(\0132\024."
"ywrapper.BytesValueBQ\202AN/wavelength-rout"
"er/media-channels/channel/psd-distributi"
"on/psd-value/state/psd\022\217\001\n\017upper_frequen"
"cy\030\253\271\362\234\001 \001(\0132\023.ywrapper.UintValueB]\202AZ/w"
"avelength-router/media-channels/channel/"
"psd-distribution/psd-value/state/upper-f"
"requency\032\356\002\n\013PsdValueKey\022p\n\017lower_freque"
"ncy\030\001 \001(\004BW\202AT/wavelength-router/media-c"
"hannels/channel/psd-distribution/psd-val"
"ue/lower-frequency\022p\n\017upper_frequency\030\002 "
"\001(\004BW\202AT/wavelength-router/media-channel"
"s/channel/psd-distribution/psd-value/upp"
"er-frequency\022{\n\tpsd_value\030\003 \001(\0132h.openco"
"nfig.openconfig_wavelength_router.Wavele"
"ngthRouter.MediaChannels.Channel.PsdDist"
"ribution.PsdValue\032\335\004\n\006Source\022\255\001\n\006config\030"
"\233\251\342\350\001 \001(\0132].openconfig.openconfig_wavele"
"ngth_router.WavelengthRouter.MediaChanne"
"ls.Channel.Source.ConfigB:\202A7/wavelength"
"-router/media-channels/channel/source/co"
"nfig\022\251\001\n\005state\030\234\345\205T \001(\0132\\.openconfig.ope"
"nconfig_wavelength_router.WavelengthRout"
"er.MediaChannels.Channel.Source.StateB9\202"
"A6/wavelength-router/media-channels/chan"
"nel/source/state\032|\n\006Config\022r\n\tport_name\030"
"\331\346\202\255\001 \001(\0132\025.ywrapper.StringValueBD\202AA/wa"
"velength-router/media-channels/channel/s"
"ource/config/port-name\032y\n\005State\022p\n\tport_"
"name\030\212\370\331\004 \001(\0132\025.ywrapper.StringValueBC\202A"
"@/wavelength-router/media-channels/chann"
"el/source/state/port-name\032\345\006\n\005State\022\225\001\n\014"
"admin_status\030\263\326\341\230\001 \001(\0162:.openconfig.enum"
"s.OpenconfigWavelengthRouterAdminStateTy"
"peB\?\202A</wavelength-router/media-channels"
"/channel/state/admin-status\022_\n\005index\030\245\275\350"
"i \001(\0132\023.ywrapper.UintValueB8\202A5/waveleng"
"th-router/media-channels/channel/state/i"
"ndex\022s\n\017lower_frequency\030\277\273\331\035 \001(\0132\023.ywrap"
"per.UintValueBB\202A\?/wavelength-router/med"
"ia-channels/channel/state/lower-frequenc"
"y\022`\n\004name\030\226\372\340\211\001 \001(\0132\025.ywrapper.StringVal"
"ueB7\202A4/wavelength-router/media-channels"
"/channel/state/name\022\271\001\n\013oper_status\030\212\321\231\373"
"\001 \001(\0162`.openconfig.openconfig_wavelength"
"_router.WavelengthRouter.MediaChannels.C"
"hannel.State.OperStatusB>\202A;/wavelength-"
"router/media-channels/channel/state/oper"
"-status\022t\n\017upper_frequency\030\244\321\310\311\001 \001(\0132\023.y"
"wrapper.UintValueBB\202A\?/wavelength-router"
"/media-channels/channel/state/upper-freq"
"uency\"Z\n\nOperStatus\022\024\n\020OPERSTATUS_UNSET\020"
"\000\022\030\n\rOPERSTATUS_UP\020\001\032\005\202A\002UP\022\034\n\017OPERSTATU"
"S_DOWN\020\002\032\007\202A\004DOWN\032\261\001\n\nChannelKey\022A\n\005inde"
"x\030\001 \001(\004B2\202A//wavelength-router/media-cha"
"nnels/channel/index\022`\n\007channel\030\002 \001(\0132O.o"
"penconfig.openconfig_wavelength_router.W"
"avelengthRouter.MediaChannels.Channelb\006p"
"roto3"
};
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
descriptor, 6165);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"openconfig/openconfig_wavelength_router/openconfig_wavelength_router.proto", &protobuf_RegisterTypes);
::protobuf_github_2ecom_2fopenconfig_2fygot_2fproto_2fywrapper_2fywrapper_2eproto::AddDescriptors();
::protobuf_github_2ecom_2fopenconfig_2fygot_2fproto_2fyext_2fyext_2eproto::AddDescriptors();
::protobuf_openconfig_2fenums_2fenums_2eproto::AddDescriptors();
}
void AddDescriptors() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
StaticDescriptorInitializer() {
AddDescriptors();
}
} static_descriptor_initializer;
} // namespace protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto
namespace openconfig {
namespace openconfig_wavelength_router {
const ::google::protobuf::EnumDescriptor* WavelengthRouter_MediaChannels_Channel_State_OperStatus_descriptor() {
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_enum_descriptors[0];
}
bool WavelengthRouter_MediaChannels_Channel_State_OperStatus_IsValid(int value) {
switch (value) {
case 0:
case 1:
case 2:
return true;
default:
return false;
}
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const WavelengthRouter_MediaChannels_Channel_State_OperStatus WavelengthRouter_MediaChannels_Channel_State::OPERSTATUS_UNSET;
const WavelengthRouter_MediaChannels_Channel_State_OperStatus WavelengthRouter_MediaChannels_Channel_State::OPERSTATUS_UP;
const WavelengthRouter_MediaChannels_Channel_State_OperStatus WavelengthRouter_MediaChannels_Channel_State::OPERSTATUS_DOWN;
const WavelengthRouter_MediaChannels_Channel_State_OperStatus WavelengthRouter_MediaChannels_Channel_State::OperStatus_MIN;
const WavelengthRouter_MediaChannels_Channel_State_OperStatus WavelengthRouter_MediaChannels_Channel_State::OperStatus_MAX;
const int WavelengthRouter_MediaChannels_Channel_State::OperStatus_ARRAYSIZE;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
// ===================================================================
void WavelengthRouter_MediaChannels_Channel_Config::InitAsDefaultInstance() {
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Config_default_instance_._instance.get_mutable()->index_ = const_cast< ::ywrapper::UintValue*>(
::ywrapper::UintValue::internal_default_instance());
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Config_default_instance_._instance.get_mutable()->lower_frequency_ = const_cast< ::ywrapper::UintValue*>(
::ywrapper::UintValue::internal_default_instance());
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Config_default_instance_._instance.get_mutable()->name_ = const_cast< ::ywrapper::StringValue*>(
::ywrapper::StringValue::internal_default_instance());
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Config_default_instance_._instance.get_mutable()->upper_frequency_ = const_cast< ::ywrapper::UintValue*>(
::ywrapper::UintValue::internal_default_instance());
}
void WavelengthRouter_MediaChannels_Channel_Config::clear_index() {
if (GetArenaNoVirtual() == NULL && index_ != NULL) {
delete index_;
}
index_ = NULL;
}
void WavelengthRouter_MediaChannels_Channel_Config::clear_lower_frequency() {
if (GetArenaNoVirtual() == NULL && lower_frequency_ != NULL) {
delete lower_frequency_;
}
lower_frequency_ = NULL;
}
void WavelengthRouter_MediaChannels_Channel_Config::clear_name() {
if (GetArenaNoVirtual() == NULL && name_ != NULL) {
delete name_;
}
name_ = NULL;
}
void WavelengthRouter_MediaChannels_Channel_Config::clear_upper_frequency() {
if (GetArenaNoVirtual() == NULL && upper_frequency_ != NULL) {
delete upper_frequency_;
}
upper_frequency_ = NULL;
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int WavelengthRouter_MediaChannels_Channel_Config::kAdminStatusFieldNumber;
const int WavelengthRouter_MediaChannels_Channel_Config::kIndexFieldNumber;
const int WavelengthRouter_MediaChannels_Channel_Config::kLowerFrequencyFieldNumber;
const int WavelengthRouter_MediaChannels_Channel_Config::kNameFieldNumber;
const int WavelengthRouter_MediaChannels_Channel_Config::kUpperFrequencyFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
WavelengthRouter_MediaChannels_Channel_Config::WavelengthRouter_MediaChannels_Channel_Config()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_Config();
}
SharedCtor();
// @@protoc_insertion_point(constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config)
}
WavelengthRouter_MediaChannels_Channel_Config::WavelengthRouter_MediaChannels_Channel_Config(const WavelengthRouter_MediaChannels_Channel_Config& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from.has_index()) {
index_ = new ::ywrapper::UintValue(*from.index_);
} else {
index_ = NULL;
}
if (from.has_name()) {
name_ = new ::ywrapper::StringValue(*from.name_);
} else {
name_ = NULL;
}
if (from.has_upper_frequency()) {
upper_frequency_ = new ::ywrapper::UintValue(*from.upper_frequency_);
} else {
upper_frequency_ = NULL;
}
if (from.has_lower_frequency()) {
lower_frequency_ = new ::ywrapper::UintValue(*from.lower_frequency_);
} else {
lower_frequency_ = NULL;
}
admin_status_ = from.admin_status_;
// @@protoc_insertion_point(copy_constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config)
}
void WavelengthRouter_MediaChannels_Channel_Config::SharedCtor() {
::memset(&index_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&admin_status_) -
reinterpret_cast<char*>(&index_)) + sizeof(admin_status_));
_cached_size_ = 0;
}
WavelengthRouter_MediaChannels_Channel_Config::~WavelengthRouter_MediaChannels_Channel_Config() {
// @@protoc_insertion_point(destructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config)
SharedDtor();
}
void WavelengthRouter_MediaChannels_Channel_Config::SharedDtor() {
if (this != internal_default_instance()) delete index_;
if (this != internal_default_instance()) delete name_;
if (this != internal_default_instance()) delete upper_frequency_;
if (this != internal_default_instance()) delete lower_frequency_;
}
void WavelengthRouter_MediaChannels_Channel_Config::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* WavelengthRouter_MediaChannels_Channel_Config::descriptor() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const WavelengthRouter_MediaChannels_Channel_Config& WavelengthRouter_MediaChannels_Channel_Config::default_instance() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_Config();
return *internal_default_instance();
}
WavelengthRouter_MediaChannels_Channel_Config* WavelengthRouter_MediaChannels_Channel_Config::New(::google::protobuf::Arena* arena) const {
WavelengthRouter_MediaChannels_Channel_Config* n = new WavelengthRouter_MediaChannels_Channel_Config;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void WavelengthRouter_MediaChannels_Channel_Config::Clear() {
// @@protoc_insertion_point(message_clear_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == NULL && index_ != NULL) {
delete index_;
}
index_ = NULL;
if (GetArenaNoVirtual() == NULL && name_ != NULL) {
delete name_;
}
name_ = NULL;
if (GetArenaNoVirtual() == NULL && upper_frequency_ != NULL) {
delete upper_frequency_;
}
upper_frequency_ = NULL;
if (GetArenaNoVirtual() == NULL && lower_frequency_ != NULL) {
delete lower_frequency_;
}
lower_frequency_ = NULL;
admin_status_ = 0;
_internal_metadata_.Clear();
}
bool WavelengthRouter_MediaChannels_Channel_Config::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:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(4273391682u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// .openconfig.enums.OpenconfigWavelengthRouterAdminStateType admin_status = 148137994 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config/admin-status"];
case 148137994: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(80u /* 1185103952 & 0xFF */)) {
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
set_admin_status(static_cast< ::openconfig::enums::OpenconfigWavelengthRouterAdminStateType >(value));
} else {
goto handle_unusual;
}
break;
}
// .ywrapper.UintValue index = 301463906 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config/index"];
case 301463906: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u /* 2411711250 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_index()));
} else {
goto handle_unusual;
}
break;
}
// .ywrapper.StringValue name = 351086787 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config/name"];
case 351086787: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u /* 2808694298 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_name()));
} else {
goto handle_unusual;
}
break;
}
// .ywrapper.UintValue upper_frequency = 431960071 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config/upper-frequency"];
case 431960071: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(58u /* 3455680570 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_upper_frequency()));
} else {
goto handle_unusual;
}
break;
}
// .ywrapper.UintValue lower_frequency = 534173960 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config/lower-frequency"];
case 534173960: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(66u /* 4273391682 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_lower_frequency()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, _internal_metadata_.mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config)
return true;
failure:
// @@protoc_insertion_point(parse_failure:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config)
return false;
#undef DO_
}
void WavelengthRouter_MediaChannels_Channel_Config::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .openconfig.enums.OpenconfigWavelengthRouterAdminStateType admin_status = 148137994 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config/admin-status"];
if (this->admin_status() != 0) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
148137994, this->admin_status(), output);
}
// .ywrapper.UintValue index = 301463906 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config/index"];
if (this->has_index()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
301463906, *this->index_, output);
}
// .ywrapper.StringValue name = 351086787 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config/name"];
if (this->has_name()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
351086787, *this->name_, output);
}
// .ywrapper.UintValue upper_frequency = 431960071 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config/upper-frequency"];
if (this->has_upper_frequency()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
431960071, *this->upper_frequency_, output);
}
// .ywrapper.UintValue lower_frequency = 534173960 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config/lower-frequency"];
if (this->has_lower_frequency()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
534173960, *this->lower_frequency_, output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
}
// @@protoc_insertion_point(serialize_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config)
}
::google::protobuf::uint8* WavelengthRouter_MediaChannels_Channel_Config::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .openconfig.enums.OpenconfigWavelengthRouterAdminStateType admin_status = 148137994 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config/admin-status"];
if (this->admin_status() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
148137994, this->admin_status(), target);
}
// .ywrapper.UintValue index = 301463906 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config/index"];
if (this->has_index()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
301463906, *this->index_, deterministic, target);
}
// .ywrapper.StringValue name = 351086787 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config/name"];
if (this->has_name()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
351086787, *this->name_, deterministic, target);
}
// .ywrapper.UintValue upper_frequency = 431960071 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config/upper-frequency"];
if (this->has_upper_frequency()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
431960071, *this->upper_frequency_, deterministic, target);
}
// .ywrapper.UintValue lower_frequency = 534173960 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config/lower-frequency"];
if (this->has_lower_frequency()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
534173960, *this->lower_frequency_, deterministic, target);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
}
// @@protoc_insertion_point(serialize_to_array_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config)
return target;
}
size_t WavelengthRouter_MediaChannels_Channel_Config::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config)
size_t total_size = 0;
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
}
// .ywrapper.UintValue index = 301463906 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config/index"];
if (this->has_index()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->index_);
}
// .ywrapper.StringValue name = 351086787 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config/name"];
if (this->has_name()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->name_);
}
// .ywrapper.UintValue upper_frequency = 431960071 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config/upper-frequency"];
if (this->has_upper_frequency()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->upper_frequency_);
}
// .ywrapper.UintValue lower_frequency = 534173960 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config/lower-frequency"];
if (this->has_lower_frequency()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->lower_frequency_);
}
// .openconfig.enums.OpenconfigWavelengthRouterAdminStateType admin_status = 148137994 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config/admin-status"];
if (this->admin_status() != 0) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->admin_status());
}
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 WavelengthRouter_MediaChannels_Channel_Config::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config)
GOOGLE_DCHECK_NE(&from, this);
const WavelengthRouter_MediaChannels_Channel_Config* source =
::google::protobuf::internal::DynamicCastToGenerated<const WavelengthRouter_MediaChannels_Channel_Config>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config)
MergeFrom(*source);
}
}
void WavelengthRouter_MediaChannels_Channel_Config::MergeFrom(const WavelengthRouter_MediaChannels_Channel_Config& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_index()) {
mutable_index()->::ywrapper::UintValue::MergeFrom(from.index());
}
if (from.has_name()) {
mutable_name()->::ywrapper::StringValue::MergeFrom(from.name());
}
if (from.has_upper_frequency()) {
mutable_upper_frequency()->::ywrapper::UintValue::MergeFrom(from.upper_frequency());
}
if (from.has_lower_frequency()) {
mutable_lower_frequency()->::ywrapper::UintValue::MergeFrom(from.lower_frequency());
}
if (from.admin_status() != 0) {
set_admin_status(from.admin_status());
}
}
void WavelengthRouter_MediaChannels_Channel_Config::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void WavelengthRouter_MediaChannels_Channel_Config::CopyFrom(const WavelengthRouter_MediaChannels_Channel_Config& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool WavelengthRouter_MediaChannels_Channel_Config::IsInitialized() const {
return true;
}
void WavelengthRouter_MediaChannels_Channel_Config::Swap(WavelengthRouter_MediaChannels_Channel_Config* other) {
if (other == this) return;
InternalSwap(other);
}
void WavelengthRouter_MediaChannels_Channel_Config::InternalSwap(WavelengthRouter_MediaChannels_Channel_Config* other) {
using std::swap;
swap(index_, other->index_);
swap(name_, other->name_);
swap(upper_frequency_, other->upper_frequency_);
swap(lower_frequency_, other->lower_frequency_);
swap(admin_status_, other->admin_status_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata WavelengthRouter_MediaChannels_Channel_Config::GetMetadata() const {
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void WavelengthRouter_MediaChannels_Channel_Dest_Config::InitAsDefaultInstance() {
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Dest_Config_default_instance_._instance.get_mutable()->port_name_ = const_cast< ::ywrapper::StringValue*>(
::ywrapper::StringValue::internal_default_instance());
}
void WavelengthRouter_MediaChannels_Channel_Dest_Config::clear_port_name() {
if (GetArenaNoVirtual() == NULL && port_name_ != NULL) {
delete port_name_;
}
port_name_ = NULL;
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int WavelengthRouter_MediaChannels_Channel_Dest_Config::kPortNameFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
WavelengthRouter_MediaChannels_Channel_Dest_Config::WavelengthRouter_MediaChannels_Channel_Dest_Config()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_Dest_Config();
}
SharedCtor();
// @@protoc_insertion_point(constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config)
}
WavelengthRouter_MediaChannels_Channel_Dest_Config::WavelengthRouter_MediaChannels_Channel_Dest_Config(const WavelengthRouter_MediaChannels_Channel_Dest_Config& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from.has_port_name()) {
port_name_ = new ::ywrapper::StringValue(*from.port_name_);
} else {
port_name_ = NULL;
}
// @@protoc_insertion_point(copy_constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config)
}
void WavelengthRouter_MediaChannels_Channel_Dest_Config::SharedCtor() {
port_name_ = NULL;
_cached_size_ = 0;
}
WavelengthRouter_MediaChannels_Channel_Dest_Config::~WavelengthRouter_MediaChannels_Channel_Dest_Config() {
// @@protoc_insertion_point(destructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config)
SharedDtor();
}
void WavelengthRouter_MediaChannels_Channel_Dest_Config::SharedDtor() {
if (this != internal_default_instance()) delete port_name_;
}
void WavelengthRouter_MediaChannels_Channel_Dest_Config::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* WavelengthRouter_MediaChannels_Channel_Dest_Config::descriptor() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const WavelengthRouter_MediaChannels_Channel_Dest_Config& WavelengthRouter_MediaChannels_Channel_Dest_Config::default_instance() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_Dest_Config();
return *internal_default_instance();
}
WavelengthRouter_MediaChannels_Channel_Dest_Config* WavelengthRouter_MediaChannels_Channel_Dest_Config::New(::google::protobuf::Arena* arena) const {
WavelengthRouter_MediaChannels_Channel_Dest_Config* n = new WavelengthRouter_MediaChannels_Channel_Dest_Config;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void WavelengthRouter_MediaChannels_Channel_Dest_Config::Clear() {
// @@protoc_insertion_point(message_clear_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == NULL && port_name_ != NULL) {
delete port_name_;
}
port_name_ = NULL;
_internal_metadata_.Clear();
}
bool WavelengthRouter_MediaChannels_Channel_Dest_Config::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:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(199235010u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// .ywrapper.StringValue port_name = 24904376 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/dest/config/port-name"];
case 24904376: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(194u /* 199235010 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_port_name()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, _internal_metadata_.mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config)
return true;
failure:
// @@protoc_insertion_point(parse_failure:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config)
return false;
#undef DO_
}
void WavelengthRouter_MediaChannels_Channel_Dest_Config::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .ywrapper.StringValue port_name = 24904376 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/dest/config/port-name"];
if (this->has_port_name()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
24904376, *this->port_name_, output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
}
// @@protoc_insertion_point(serialize_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config)
}
::google::protobuf::uint8* WavelengthRouter_MediaChannels_Channel_Dest_Config::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .ywrapper.StringValue port_name = 24904376 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/dest/config/port-name"];
if (this->has_port_name()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
24904376, *this->port_name_, deterministic, target);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
}
// @@protoc_insertion_point(serialize_to_array_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config)
return target;
}
size_t WavelengthRouter_MediaChannels_Channel_Dest_Config::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config)
size_t total_size = 0;
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
}
// .ywrapper.StringValue port_name = 24904376 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/dest/config/port-name"];
if (this->has_port_name()) {
total_size += 4 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->port_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 WavelengthRouter_MediaChannels_Channel_Dest_Config::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config)
GOOGLE_DCHECK_NE(&from, this);
const WavelengthRouter_MediaChannels_Channel_Dest_Config* source =
::google::protobuf::internal::DynamicCastToGenerated<const WavelengthRouter_MediaChannels_Channel_Dest_Config>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config)
MergeFrom(*source);
}
}
void WavelengthRouter_MediaChannels_Channel_Dest_Config::MergeFrom(const WavelengthRouter_MediaChannels_Channel_Dest_Config& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_port_name()) {
mutable_port_name()->::ywrapper::StringValue::MergeFrom(from.port_name());
}
}
void WavelengthRouter_MediaChannels_Channel_Dest_Config::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void WavelengthRouter_MediaChannels_Channel_Dest_Config::CopyFrom(const WavelengthRouter_MediaChannels_Channel_Dest_Config& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool WavelengthRouter_MediaChannels_Channel_Dest_Config::IsInitialized() const {
return true;
}
void WavelengthRouter_MediaChannels_Channel_Dest_Config::Swap(WavelengthRouter_MediaChannels_Channel_Dest_Config* other) {
if (other == this) return;
InternalSwap(other);
}
void WavelengthRouter_MediaChannels_Channel_Dest_Config::InternalSwap(WavelengthRouter_MediaChannels_Channel_Dest_Config* other) {
using std::swap;
swap(port_name_, other->port_name_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata WavelengthRouter_MediaChannels_Channel_Dest_Config::GetMetadata() const {
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void WavelengthRouter_MediaChannels_Channel_Dest_State::InitAsDefaultInstance() {
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Dest_State_default_instance_._instance.get_mutable()->port_name_ = const_cast< ::ywrapper::StringValue*>(
::ywrapper::StringValue::internal_default_instance());
}
void WavelengthRouter_MediaChannels_Channel_Dest_State::clear_port_name() {
if (GetArenaNoVirtual() == NULL && port_name_ != NULL) {
delete port_name_;
}
port_name_ = NULL;
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int WavelengthRouter_MediaChannels_Channel_Dest_State::kPortNameFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
WavelengthRouter_MediaChannels_Channel_Dest_State::WavelengthRouter_MediaChannels_Channel_Dest_State()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_Dest_State();
}
SharedCtor();
// @@protoc_insertion_point(constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State)
}
WavelengthRouter_MediaChannels_Channel_Dest_State::WavelengthRouter_MediaChannels_Channel_Dest_State(const WavelengthRouter_MediaChannels_Channel_Dest_State& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from.has_port_name()) {
port_name_ = new ::ywrapper::StringValue(*from.port_name_);
} else {
port_name_ = NULL;
}
// @@protoc_insertion_point(copy_constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State)
}
void WavelengthRouter_MediaChannels_Channel_Dest_State::SharedCtor() {
port_name_ = NULL;
_cached_size_ = 0;
}
WavelengthRouter_MediaChannels_Channel_Dest_State::~WavelengthRouter_MediaChannels_Channel_Dest_State() {
// @@protoc_insertion_point(destructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State)
SharedDtor();
}
void WavelengthRouter_MediaChannels_Channel_Dest_State::SharedDtor() {
if (this != internal_default_instance()) delete port_name_;
}
void WavelengthRouter_MediaChannels_Channel_Dest_State::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* WavelengthRouter_MediaChannels_Channel_Dest_State::descriptor() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const WavelengthRouter_MediaChannels_Channel_Dest_State& WavelengthRouter_MediaChannels_Channel_Dest_State::default_instance() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_Dest_State();
return *internal_default_instance();
}
WavelengthRouter_MediaChannels_Channel_Dest_State* WavelengthRouter_MediaChannels_Channel_Dest_State::New(::google::protobuf::Arena* arena) const {
WavelengthRouter_MediaChannels_Channel_Dest_State* n = new WavelengthRouter_MediaChannels_Channel_Dest_State;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void WavelengthRouter_MediaChannels_Channel_Dest_State::Clear() {
// @@protoc_insertion_point(message_clear_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == NULL && port_name_ != NULL) {
delete port_name_;
}
port_name_ = NULL;
_internal_metadata_.Clear();
}
bool WavelengthRouter_MediaChannels_Channel_Dest_State::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:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(2829226346u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// .ywrapper.StringValue port_name = 353653293 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/dest/state/port-name"];
case 353653293: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(106u /* 2829226346 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_port_name()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, _internal_metadata_.mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State)
return true;
failure:
// @@protoc_insertion_point(parse_failure:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State)
return false;
#undef DO_
}
void WavelengthRouter_MediaChannels_Channel_Dest_State::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .ywrapper.StringValue port_name = 353653293 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/dest/state/port-name"];
if (this->has_port_name()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
353653293, *this->port_name_, output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
}
// @@protoc_insertion_point(serialize_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State)
}
::google::protobuf::uint8* WavelengthRouter_MediaChannels_Channel_Dest_State::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .ywrapper.StringValue port_name = 353653293 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/dest/state/port-name"];
if (this->has_port_name()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
353653293, *this->port_name_, deterministic, target);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
}
// @@protoc_insertion_point(serialize_to_array_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State)
return target;
}
size_t WavelengthRouter_MediaChannels_Channel_Dest_State::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State)
size_t total_size = 0;
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
}
// .ywrapper.StringValue port_name = 353653293 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/dest/state/port-name"];
if (this->has_port_name()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->port_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 WavelengthRouter_MediaChannels_Channel_Dest_State::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State)
GOOGLE_DCHECK_NE(&from, this);
const WavelengthRouter_MediaChannels_Channel_Dest_State* source =
::google::protobuf::internal::DynamicCastToGenerated<const WavelengthRouter_MediaChannels_Channel_Dest_State>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State)
MergeFrom(*source);
}
}
void WavelengthRouter_MediaChannels_Channel_Dest_State::MergeFrom(const WavelengthRouter_MediaChannels_Channel_Dest_State& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_port_name()) {
mutable_port_name()->::ywrapper::StringValue::MergeFrom(from.port_name());
}
}
void WavelengthRouter_MediaChannels_Channel_Dest_State::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void WavelengthRouter_MediaChannels_Channel_Dest_State::CopyFrom(const WavelengthRouter_MediaChannels_Channel_Dest_State& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool WavelengthRouter_MediaChannels_Channel_Dest_State::IsInitialized() const {
return true;
}
void WavelengthRouter_MediaChannels_Channel_Dest_State::Swap(WavelengthRouter_MediaChannels_Channel_Dest_State* other) {
if (other == this) return;
InternalSwap(other);
}
void WavelengthRouter_MediaChannels_Channel_Dest_State::InternalSwap(WavelengthRouter_MediaChannels_Channel_Dest_State* other) {
using std::swap;
swap(port_name_, other->port_name_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata WavelengthRouter_MediaChannels_Channel_Dest_State::GetMetadata() const {
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void WavelengthRouter_MediaChannels_Channel_Dest::InitAsDefaultInstance() {
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Dest_default_instance_._instance.get_mutable()->config_ = const_cast< ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest_Config*>(
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest_Config::internal_default_instance());
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Dest_default_instance_._instance.get_mutable()->state_ = const_cast< ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest_State*>(
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest_State::internal_default_instance());
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int WavelengthRouter_MediaChannels_Channel_Dest::kConfigFieldNumber;
const int WavelengthRouter_MediaChannels_Channel_Dest::kStateFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
WavelengthRouter_MediaChannels_Channel_Dest::WavelengthRouter_MediaChannels_Channel_Dest()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_Dest();
}
SharedCtor();
// @@protoc_insertion_point(constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest)
}
WavelengthRouter_MediaChannels_Channel_Dest::WavelengthRouter_MediaChannels_Channel_Dest(const WavelengthRouter_MediaChannels_Channel_Dest& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from.has_state()) {
state_ = new ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest_State(*from.state_);
} else {
state_ = NULL;
}
if (from.has_config()) {
config_ = new ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest_Config(*from.config_);
} else {
config_ = NULL;
}
// @@protoc_insertion_point(copy_constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest)
}
void WavelengthRouter_MediaChannels_Channel_Dest::SharedCtor() {
::memset(&state_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&config_) -
reinterpret_cast<char*>(&state_)) + sizeof(config_));
_cached_size_ = 0;
}
WavelengthRouter_MediaChannels_Channel_Dest::~WavelengthRouter_MediaChannels_Channel_Dest() {
// @@protoc_insertion_point(destructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest)
SharedDtor();
}
void WavelengthRouter_MediaChannels_Channel_Dest::SharedDtor() {
if (this != internal_default_instance()) delete state_;
if (this != internal_default_instance()) delete config_;
}
void WavelengthRouter_MediaChannels_Channel_Dest::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* WavelengthRouter_MediaChannels_Channel_Dest::descriptor() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const WavelengthRouter_MediaChannels_Channel_Dest& WavelengthRouter_MediaChannels_Channel_Dest::default_instance() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_Dest();
return *internal_default_instance();
}
WavelengthRouter_MediaChannels_Channel_Dest* WavelengthRouter_MediaChannels_Channel_Dest::New(::google::protobuf::Arena* arena) const {
WavelengthRouter_MediaChannels_Channel_Dest* n = new WavelengthRouter_MediaChannels_Channel_Dest;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void WavelengthRouter_MediaChannels_Channel_Dest::Clear() {
// @@protoc_insertion_point(message_clear_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == NULL && state_ != NULL) {
delete state_;
}
state_ = NULL;
if (GetArenaNoVirtual() == NULL && config_ != NULL) {
delete config_;
}
config_ = NULL;
_internal_metadata_.Clear();
}
bool WavelengthRouter_MediaChannels_Channel_Dest::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:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(2321578322u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State state = 10749255 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/dest/state"];
case 10749255: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(58u /* 85994042 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_state()));
} else {
goto handle_unusual;
}
break;
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config config = 290197290 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/dest/config"];
case 290197290: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(82u /* 2321578322 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_config()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, _internal_metadata_.mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest)
return true;
failure:
// @@protoc_insertion_point(parse_failure:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest)
return false;
#undef DO_
}
void WavelengthRouter_MediaChannels_Channel_Dest::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State state = 10749255 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/dest/state"];
if (this->has_state()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
10749255, *this->state_, output);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config config = 290197290 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/dest/config"];
if (this->has_config()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
290197290, *this->config_, output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
}
// @@protoc_insertion_point(serialize_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest)
}
::google::protobuf::uint8* WavelengthRouter_MediaChannels_Channel_Dest::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State state = 10749255 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/dest/state"];
if (this->has_state()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
10749255, *this->state_, deterministic, target);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config config = 290197290 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/dest/config"];
if (this->has_config()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
290197290, *this->config_, deterministic, target);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
}
// @@protoc_insertion_point(serialize_to_array_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest)
return target;
}
size_t WavelengthRouter_MediaChannels_Channel_Dest::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest)
size_t total_size = 0;
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.State state = 10749255 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/dest/state"];
if (this->has_state()) {
total_size += 4 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->state_);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest.Config config = 290197290 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/dest/config"];
if (this->has_config()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->config_);
}
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 WavelengthRouter_MediaChannels_Channel_Dest::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest)
GOOGLE_DCHECK_NE(&from, this);
const WavelengthRouter_MediaChannels_Channel_Dest* source =
::google::protobuf::internal::DynamicCastToGenerated<const WavelengthRouter_MediaChannels_Channel_Dest>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest)
MergeFrom(*source);
}
}
void WavelengthRouter_MediaChannels_Channel_Dest::MergeFrom(const WavelengthRouter_MediaChannels_Channel_Dest& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_state()) {
mutable_state()->::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest_State::MergeFrom(from.state());
}
if (from.has_config()) {
mutable_config()->::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest_Config::MergeFrom(from.config());
}
}
void WavelengthRouter_MediaChannels_Channel_Dest::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void WavelengthRouter_MediaChannels_Channel_Dest::CopyFrom(const WavelengthRouter_MediaChannels_Channel_Dest& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool WavelengthRouter_MediaChannels_Channel_Dest::IsInitialized() const {
return true;
}
void WavelengthRouter_MediaChannels_Channel_Dest::Swap(WavelengthRouter_MediaChannels_Channel_Dest* other) {
if (other == this) return;
InternalSwap(other);
}
void WavelengthRouter_MediaChannels_Channel_Dest::InternalSwap(WavelengthRouter_MediaChannels_Channel_Dest* other) {
using std::swap;
swap(state_, other->state_);
swap(config_, other->config_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata WavelengthRouter_MediaChannels_Channel_Dest::GetMetadata() const {
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::InitAsDefaultInstance() {
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config_default_instance_._instance.get_mutable()->lower_frequency_ = const_cast< ::ywrapper::UintValue*>(
::ywrapper::UintValue::internal_default_instance());
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config_default_instance_._instance.get_mutable()->psd_ = const_cast< ::ywrapper::BytesValue*>(
::ywrapper::BytesValue::internal_default_instance());
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config_default_instance_._instance.get_mutable()->upper_frequency_ = const_cast< ::ywrapper::UintValue*>(
::ywrapper::UintValue::internal_default_instance());
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::clear_lower_frequency() {
if (GetArenaNoVirtual() == NULL && lower_frequency_ != NULL) {
delete lower_frequency_;
}
lower_frequency_ = NULL;
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::clear_psd() {
if (GetArenaNoVirtual() == NULL && psd_ != NULL) {
delete psd_;
}
psd_ = NULL;
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::clear_upper_frequency() {
if (GetArenaNoVirtual() == NULL && upper_frequency_ != NULL) {
delete upper_frequency_;
}
upper_frequency_ = NULL;
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::kLowerFrequencyFieldNumber;
const int WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::kPsdFieldNumber;
const int WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::kUpperFrequencyFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config();
}
SharedCtor();
// @@protoc_insertion_point(constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config)
}
WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config(const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from.has_psd()) {
psd_ = new ::ywrapper::BytesValue(*from.psd_);
} else {
psd_ = NULL;
}
if (from.has_lower_frequency()) {
lower_frequency_ = new ::ywrapper::UintValue(*from.lower_frequency_);
} else {
lower_frequency_ = NULL;
}
if (from.has_upper_frequency()) {
upper_frequency_ = new ::ywrapper::UintValue(*from.upper_frequency_);
} else {
upper_frequency_ = NULL;
}
// @@protoc_insertion_point(copy_constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config)
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::SharedCtor() {
::memset(&psd_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&upper_frequency_) -
reinterpret_cast<char*>(&psd_)) + sizeof(upper_frequency_));
_cached_size_ = 0;
}
WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::~WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config() {
// @@protoc_insertion_point(destructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config)
SharedDtor();
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::SharedDtor() {
if (this != internal_default_instance()) delete psd_;
if (this != internal_default_instance()) delete lower_frequency_;
if (this != internal_default_instance()) delete upper_frequency_;
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::descriptor() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config& WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::default_instance() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config();
return *internal_default_instance();
}
WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config* WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::New(::google::protobuf::Arena* arena) const {
WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config* n = new WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::Clear() {
// @@protoc_insertion_point(message_clear_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == NULL && psd_ != NULL) {
delete psd_;
}
psd_ = NULL;
if (GetArenaNoVirtual() == NULL && lower_frequency_ != NULL) {
delete lower_frequency_;
}
lower_frequency_ = NULL;
if (GetArenaNoVirtual() == NULL && upper_frequency_ != NULL) {
delete upper_frequency_;
}
upper_frequency_ = NULL;
_internal_metadata_.Clear();
}
bool WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::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:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(3959613266u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// .ywrapper.BytesValue psd = 5500354 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/config/psd"];
case 5500354: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u /* 44002834 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_psd()));
} else {
goto handle_unusual;
}
break;
}
// .ywrapper.UintValue lower_frequency = 104941357 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/config/lower-frequency"];
case 104941357: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(106u /* 839530858 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_lower_frequency()));
} else {
goto handle_unusual;
}
break;
}
// .ywrapper.UintValue upper_frequency = 494951658 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/config/upper-frequency"];
case 494951658: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(82u /* 3959613266 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_upper_frequency()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, _internal_metadata_.mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config)
return true;
failure:
// @@protoc_insertion_point(parse_failure:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config)
return false;
#undef DO_
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .ywrapper.BytesValue psd = 5500354 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/config/psd"];
if (this->has_psd()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
5500354, *this->psd_, output);
}
// .ywrapper.UintValue lower_frequency = 104941357 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/config/lower-frequency"];
if (this->has_lower_frequency()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
104941357, *this->lower_frequency_, output);
}
// .ywrapper.UintValue upper_frequency = 494951658 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/config/upper-frequency"];
if (this->has_upper_frequency()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
494951658, *this->upper_frequency_, output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
}
// @@protoc_insertion_point(serialize_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config)
}
::google::protobuf::uint8* WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .ywrapper.BytesValue psd = 5500354 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/config/psd"];
if (this->has_psd()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
5500354, *this->psd_, deterministic, target);
}
// .ywrapper.UintValue lower_frequency = 104941357 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/config/lower-frequency"];
if (this->has_lower_frequency()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
104941357, *this->lower_frequency_, deterministic, target);
}
// .ywrapper.UintValue upper_frequency = 494951658 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/config/upper-frequency"];
if (this->has_upper_frequency()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
494951658, *this->upper_frequency_, deterministic, target);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
}
// @@protoc_insertion_point(serialize_to_array_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config)
return target;
}
size_t WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config)
size_t total_size = 0;
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
}
// .ywrapper.BytesValue psd = 5500354 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/config/psd"];
if (this->has_psd()) {
total_size += 4 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->psd_);
}
// .ywrapper.UintValue lower_frequency = 104941357 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/config/lower-frequency"];
if (this->has_lower_frequency()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->lower_frequency_);
}
// .ywrapper.UintValue upper_frequency = 494951658 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/config/upper-frequency"];
if (this->has_upper_frequency()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->upper_frequency_);
}
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 WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config)
GOOGLE_DCHECK_NE(&from, this);
const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config* source =
::google::protobuf::internal::DynamicCastToGenerated<const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config)
MergeFrom(*source);
}
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::MergeFrom(const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_psd()) {
mutable_psd()->::ywrapper::BytesValue::MergeFrom(from.psd());
}
if (from.has_lower_frequency()) {
mutable_lower_frequency()->::ywrapper::UintValue::MergeFrom(from.lower_frequency());
}
if (from.has_upper_frequency()) {
mutable_upper_frequency()->::ywrapper::UintValue::MergeFrom(from.upper_frequency());
}
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::CopyFrom(const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::IsInitialized() const {
return true;
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::Swap(WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config* other) {
if (other == this) return;
InternalSwap(other);
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::InternalSwap(WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config* other) {
using std::swap;
swap(psd_, other->psd_);
swap(lower_frequency_, other->lower_frequency_);
swap(upper_frequency_, other->upper_frequency_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::GetMetadata() const {
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::InitAsDefaultInstance() {
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State_default_instance_._instance.get_mutable()->lower_frequency_ = const_cast< ::ywrapper::UintValue*>(
::ywrapper::UintValue::internal_default_instance());
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State_default_instance_._instance.get_mutable()->psd_ = const_cast< ::ywrapper::BytesValue*>(
::ywrapper::BytesValue::internal_default_instance());
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State_default_instance_._instance.get_mutable()->upper_frequency_ = const_cast< ::ywrapper::UintValue*>(
::ywrapper::UintValue::internal_default_instance());
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::clear_lower_frequency() {
if (GetArenaNoVirtual() == NULL && lower_frequency_ != NULL) {
delete lower_frequency_;
}
lower_frequency_ = NULL;
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::clear_psd() {
if (GetArenaNoVirtual() == NULL && psd_ != NULL) {
delete psd_;
}
psd_ = NULL;
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::clear_upper_frequency() {
if (GetArenaNoVirtual() == NULL && upper_frequency_ != NULL) {
delete upper_frequency_;
}
upper_frequency_ = NULL;
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::kLowerFrequencyFieldNumber;
const int WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::kPsdFieldNumber;
const int WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::kUpperFrequencyFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State();
}
SharedCtor();
// @@protoc_insertion_point(constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State)
}
WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State(const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from.has_lower_frequency()) {
lower_frequency_ = new ::ywrapper::UintValue(*from.lower_frequency_);
} else {
lower_frequency_ = NULL;
}
if (from.has_upper_frequency()) {
upper_frequency_ = new ::ywrapper::UintValue(*from.upper_frequency_);
} else {
upper_frequency_ = NULL;
}
if (from.has_psd()) {
psd_ = new ::ywrapper::BytesValue(*from.psd_);
} else {
psd_ = NULL;
}
// @@protoc_insertion_point(copy_constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State)
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::SharedCtor() {
::memset(&lower_frequency_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&psd_) -
reinterpret_cast<char*>(&lower_frequency_)) + sizeof(psd_));
_cached_size_ = 0;
}
WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::~WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State() {
// @@protoc_insertion_point(destructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State)
SharedDtor();
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::SharedDtor() {
if (this != internal_default_instance()) delete lower_frequency_;
if (this != internal_default_instance()) delete upper_frequency_;
if (this != internal_default_instance()) delete psd_;
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::descriptor() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State& WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::default_instance() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State();
return *internal_default_instance();
}
WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State* WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::New(::google::protobuf::Arena* arena) const {
WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State* n = new WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::Clear() {
// @@protoc_insertion_point(message_clear_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == NULL && lower_frequency_ != NULL) {
delete lower_frequency_;
}
lower_frequency_ = NULL;
if (GetArenaNoVirtual() == NULL && upper_frequency_ != NULL) {
delete upper_frequency_;
}
upper_frequency_ = NULL;
if (GetArenaNoVirtual() == NULL && psd_ != NULL) {
delete psd_;
}
psd_ = NULL;
_internal_metadata_.Clear();
}
bool WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::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:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(3238551738u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// .ywrapper.UintValue lower_frequency = 156152700 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/state/lower-frequency"];
case 156152700: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(226u /* 1249221602 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_lower_frequency()));
} else {
goto handle_unusual;
}
break;
}
// .ywrapper.UintValue upper_frequency = 329030827 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/state/upper-frequency"];
case 329030827: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(90u /* 2632246618 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_upper_frequency()));
} else {
goto handle_unusual;
}
break;
}
// .ywrapper.BytesValue psd = 404818967 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/state/psd"];
case 404818967: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(186u /* 3238551738 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_psd()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, _internal_metadata_.mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State)
return true;
failure:
// @@protoc_insertion_point(parse_failure:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State)
return false;
#undef DO_
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .ywrapper.UintValue lower_frequency = 156152700 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/state/lower-frequency"];
if (this->has_lower_frequency()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
156152700, *this->lower_frequency_, output);
}
// .ywrapper.UintValue upper_frequency = 329030827 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/state/upper-frequency"];
if (this->has_upper_frequency()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
329030827, *this->upper_frequency_, output);
}
// .ywrapper.BytesValue psd = 404818967 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/state/psd"];
if (this->has_psd()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
404818967, *this->psd_, output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
}
// @@protoc_insertion_point(serialize_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State)
}
::google::protobuf::uint8* WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .ywrapper.UintValue lower_frequency = 156152700 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/state/lower-frequency"];
if (this->has_lower_frequency()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
156152700, *this->lower_frequency_, deterministic, target);
}
// .ywrapper.UintValue upper_frequency = 329030827 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/state/upper-frequency"];
if (this->has_upper_frequency()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
329030827, *this->upper_frequency_, deterministic, target);
}
// .ywrapper.BytesValue psd = 404818967 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/state/psd"];
if (this->has_psd()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
404818967, *this->psd_, deterministic, target);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
}
// @@protoc_insertion_point(serialize_to_array_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State)
return target;
}
size_t WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State)
size_t total_size = 0;
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
}
// .ywrapper.UintValue lower_frequency = 156152700 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/state/lower-frequency"];
if (this->has_lower_frequency()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->lower_frequency_);
}
// .ywrapper.UintValue upper_frequency = 329030827 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/state/upper-frequency"];
if (this->has_upper_frequency()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->upper_frequency_);
}
// .ywrapper.BytesValue psd = 404818967 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/state/psd"];
if (this->has_psd()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->psd_);
}
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 WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State)
GOOGLE_DCHECK_NE(&from, this);
const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State* source =
::google::protobuf::internal::DynamicCastToGenerated<const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State)
MergeFrom(*source);
}
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::MergeFrom(const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_lower_frequency()) {
mutable_lower_frequency()->::ywrapper::UintValue::MergeFrom(from.lower_frequency());
}
if (from.has_upper_frequency()) {
mutable_upper_frequency()->::ywrapper::UintValue::MergeFrom(from.upper_frequency());
}
if (from.has_psd()) {
mutable_psd()->::ywrapper::BytesValue::MergeFrom(from.psd());
}
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::CopyFrom(const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::IsInitialized() const {
return true;
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::Swap(WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State* other) {
if (other == this) return;
InternalSwap(other);
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::InternalSwap(WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State* other) {
using std::swap;
swap(lower_frequency_, other->lower_frequency_);
swap(upper_frequency_, other->upper_frequency_);
swap(psd_, other->psd_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::GetMetadata() const {
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::InitAsDefaultInstance() {
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_default_instance_._instance.get_mutable()->config_ = const_cast< ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config*>(
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::internal_default_instance());
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_default_instance_._instance.get_mutable()->state_ = const_cast< ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State*>(
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::internal_default_instance());
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::kConfigFieldNumber;
const int WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::kStateFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue();
}
SharedCtor();
// @@protoc_insertion_point(constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue)
}
WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue(const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from.has_state()) {
state_ = new ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State(*from.state_);
} else {
state_ = NULL;
}
if (from.has_config()) {
config_ = new ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config(*from.config_);
} else {
config_ = NULL;
}
// @@protoc_insertion_point(copy_constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue)
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::SharedCtor() {
::memset(&state_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&config_) -
reinterpret_cast<char*>(&state_)) + sizeof(config_));
_cached_size_ = 0;
}
WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::~WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue() {
// @@protoc_insertion_point(destructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue)
SharedDtor();
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::SharedDtor() {
if (this != internal_default_instance()) delete state_;
if (this != internal_default_instance()) delete config_;
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::descriptor() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue& WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::default_instance() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue();
return *internal_default_instance();
}
WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue* WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::New(::google::protobuf::Arena* arena) const {
WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue* n = new WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::Clear() {
// @@protoc_insertion_point(message_clear_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == NULL && state_ != NULL) {
delete state_;
}
state_ = NULL;
if (GetArenaNoVirtual() == NULL && config_ != NULL) {
delete config_;
}
config_ = NULL;
_internal_metadata_.Clear();
}
bool WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::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:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(1135734674u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State state = 19196655 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/state"];
case 19196655: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(122u /* 153573242 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_state()));
} else {
goto handle_unusual;
}
break;
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config config = 141966834 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/config"];
case 141966834: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(146u /* 1135734674 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_config()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, _internal_metadata_.mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue)
return true;
failure:
// @@protoc_insertion_point(parse_failure:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue)
return false;
#undef DO_
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State state = 19196655 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/state"];
if (this->has_state()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
19196655, *this->state_, output);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config config = 141966834 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/config"];
if (this->has_config()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
141966834, *this->config_, output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
}
// @@protoc_insertion_point(serialize_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue)
}
::google::protobuf::uint8* WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State state = 19196655 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/state"];
if (this->has_state()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
19196655, *this->state_, deterministic, target);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config config = 141966834 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/config"];
if (this->has_config()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
141966834, *this->config_, deterministic, target);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
}
// @@protoc_insertion_point(serialize_to_array_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue)
return target;
}
size_t WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue)
size_t total_size = 0;
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.State state = 19196655 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/state"];
if (this->has_state()) {
total_size += 4 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->state_);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue.Config config = 141966834 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/config"];
if (this->has_config()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->config_);
}
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 WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue)
GOOGLE_DCHECK_NE(&from, this);
const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue* source =
::google::protobuf::internal::DynamicCastToGenerated<const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue)
MergeFrom(*source);
}
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::MergeFrom(const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_state()) {
mutable_state()->::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_State::MergeFrom(from.state());
}
if (from.has_config()) {
mutable_config()->::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue_Config::MergeFrom(from.config());
}
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::CopyFrom(const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::IsInitialized() const {
return true;
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::Swap(WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue* other) {
if (other == this) return;
InternalSwap(other);
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::InternalSwap(WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue* other) {
using std::swap;
swap(state_, other->state_);
swap(config_, other->config_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::GetMetadata() const {
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::InitAsDefaultInstance() {
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey_default_instance_._instance.get_mutable()->psd_value_ = const_cast< ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue*>(
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::internal_default_instance());
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::kLowerFrequencyFieldNumber;
const int WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::kUpperFrequencyFieldNumber;
const int WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::kPsdValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey();
}
SharedCtor();
// @@protoc_insertion_point(constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey)
}
WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey(const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from.has_psd_value()) {
psd_value_ = new ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue(*from.psd_value_);
} else {
psd_value_ = NULL;
}
::memcpy(&lower_frequency_, &from.lower_frequency_,
static_cast<size_t>(reinterpret_cast<char*>(&upper_frequency_) -
reinterpret_cast<char*>(&lower_frequency_)) + sizeof(upper_frequency_));
// @@protoc_insertion_point(copy_constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey)
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::SharedCtor() {
::memset(&psd_value_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&upper_frequency_) -
reinterpret_cast<char*>(&psd_value_)) + sizeof(upper_frequency_));
_cached_size_ = 0;
}
WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::~WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey() {
// @@protoc_insertion_point(destructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey)
SharedDtor();
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::SharedDtor() {
if (this != internal_default_instance()) delete psd_value_;
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::descriptor() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey& WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::default_instance() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey();
return *internal_default_instance();
}
WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey* WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::New(::google::protobuf::Arena* arena) const {
WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey* n = new WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::Clear() {
// @@protoc_insertion_point(message_clear_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == NULL && psd_value_ != NULL) {
delete psd_value_;
}
psd_value_ = NULL;
::memset(&lower_frequency_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&upper_frequency_) -
reinterpret_cast<char*>(&lower_frequency_)) + sizeof(upper_frequency_));
_internal_metadata_.Clear();
}
bool WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::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:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// uint64 lower_frequency = 1 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/lower-frequency"];
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &lower_frequency_)));
} else {
goto handle_unusual;
}
break;
}
// uint64 upper_frequency = 2 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/upper-frequency"];
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &upper_frequency_)));
} else {
goto handle_unusual;
}
break;
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue psd_value = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_psd_value()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, _internal_metadata_.mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey)
return true;
failure:
// @@protoc_insertion_point(parse_failure:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey)
return false;
#undef DO_
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// uint64 lower_frequency = 1 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/lower-frequency"];
if (this->lower_frequency() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->lower_frequency(), output);
}
// uint64 upper_frequency = 2 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/upper-frequency"];
if (this->upper_frequency() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(2, this->upper_frequency(), output);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue psd_value = 3;
if (this->has_psd_value()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, *this->psd_value_, output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
}
// @@protoc_insertion_point(serialize_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey)
}
::google::protobuf::uint8* WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// uint64 lower_frequency = 1 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/lower-frequency"];
if (this->lower_frequency() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(1, this->lower_frequency(), target);
}
// uint64 upper_frequency = 2 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/upper-frequency"];
if (this->upper_frequency() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(2, this->upper_frequency(), target);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue psd_value = 3;
if (this->has_psd_value()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
3, *this->psd_value_, deterministic, target);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
}
// @@protoc_insertion_point(serialize_to_array_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey)
return target;
}
size_t WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey)
size_t total_size = 0;
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValue psd_value = 3;
if (this->has_psd_value()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->psd_value_);
}
// uint64 lower_frequency = 1 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/lower-frequency"];
if (this->lower_frequency() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->lower_frequency());
}
// uint64 upper_frequency = 2 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value/upper-frequency"];
if (this->upper_frequency() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->upper_frequency());
}
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 WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey)
GOOGLE_DCHECK_NE(&from, this);
const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey* source =
::google::protobuf::internal::DynamicCastToGenerated<const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey)
MergeFrom(*source);
}
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::MergeFrom(const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_psd_value()) {
mutable_psd_value()->::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValue::MergeFrom(from.psd_value());
}
if (from.lower_frequency() != 0) {
set_lower_frequency(from.lower_frequency());
}
if (from.upper_frequency() != 0) {
set_upper_frequency(from.upper_frequency());
}
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::CopyFrom(const WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::IsInitialized() const {
return true;
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::Swap(WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey* other) {
if (other == this) return;
InternalSwap(other);
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::InternalSwap(WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey* other) {
using std::swap;
swap(psd_value_, other->psd_value_);
swap(lower_frequency_, other->lower_frequency_);
swap(upper_frequency_, other->upper_frequency_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata WavelengthRouter_MediaChannels_Channel_PsdDistribution_PsdValueKey::GetMetadata() const {
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void WavelengthRouter_MediaChannels_Channel_PsdDistribution::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int WavelengthRouter_MediaChannels_Channel_PsdDistribution::kPsdValueFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
WavelengthRouter_MediaChannels_Channel_PsdDistribution::WavelengthRouter_MediaChannels_Channel_PsdDistribution()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution();
}
SharedCtor();
// @@protoc_insertion_point(constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution)
}
WavelengthRouter_MediaChannels_Channel_PsdDistribution::WavelengthRouter_MediaChannels_Channel_PsdDistribution(const WavelengthRouter_MediaChannels_Channel_PsdDistribution& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
psd_value_(from.psd_value_),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution)
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution::SharedCtor() {
_cached_size_ = 0;
}
WavelengthRouter_MediaChannels_Channel_PsdDistribution::~WavelengthRouter_MediaChannels_Channel_PsdDistribution() {
// @@protoc_insertion_point(destructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution)
SharedDtor();
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution::SharedDtor() {
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* WavelengthRouter_MediaChannels_Channel_PsdDistribution::descriptor() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const WavelengthRouter_MediaChannels_Channel_PsdDistribution& WavelengthRouter_MediaChannels_Channel_PsdDistribution::default_instance() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_PsdDistribution();
return *internal_default_instance();
}
WavelengthRouter_MediaChannels_Channel_PsdDistribution* WavelengthRouter_MediaChannels_Channel_PsdDistribution::New(::google::protobuf::Arena* arena) const {
WavelengthRouter_MediaChannels_Channel_PsdDistribution* n = new WavelengthRouter_MediaChannels_Channel_PsdDistribution;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution::Clear() {
// @@protoc_insertion_point(message_clear_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
psd_value_.Clear();
_internal_metadata_.Clear();
}
bool WavelengthRouter_MediaChannels_Channel_PsdDistribution::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:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(2806732266u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey psd_value = 350841533 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value"];
case 350841533: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(234u /* 2806732266 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_psd_value()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, _internal_metadata_.mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution)
return true;
failure:
// @@protoc_insertion_point(parse_failure:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution)
return false;
#undef DO_
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey psd_value = 350841533 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value"];
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->psd_value_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
350841533, this->psd_value(static_cast<int>(i)), output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
}
// @@protoc_insertion_point(serialize_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution)
}
::google::protobuf::uint8* WavelengthRouter_MediaChannels_Channel_PsdDistribution::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey psd_value = 350841533 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value"];
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->psd_value_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
350841533, this->psd_value(static_cast<int>(i)), deterministic, target);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
}
// @@protoc_insertion_point(serialize_to_array_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution)
return target;
}
size_t WavelengthRouter_MediaChannels_Channel_PsdDistribution::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution)
size_t total_size = 0;
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
}
// repeated .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution.PsdValueKey psd_value = 350841533 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution/psd-value"];
{
unsigned int count = static_cast<unsigned int>(this->psd_value_size());
total_size += 5UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSize(
this->psd_value(static_cast<int>(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 WavelengthRouter_MediaChannels_Channel_PsdDistribution::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution)
GOOGLE_DCHECK_NE(&from, this);
const WavelengthRouter_MediaChannels_Channel_PsdDistribution* source =
::google::protobuf::internal::DynamicCastToGenerated<const WavelengthRouter_MediaChannels_Channel_PsdDistribution>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution)
MergeFrom(*source);
}
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution::MergeFrom(const WavelengthRouter_MediaChannels_Channel_PsdDistribution& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
psd_value_.MergeFrom(from.psd_value_);
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution::CopyFrom(const WavelengthRouter_MediaChannels_Channel_PsdDistribution& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool WavelengthRouter_MediaChannels_Channel_PsdDistribution::IsInitialized() const {
return true;
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution::Swap(WavelengthRouter_MediaChannels_Channel_PsdDistribution* other) {
if (other == this) return;
InternalSwap(other);
}
void WavelengthRouter_MediaChannels_Channel_PsdDistribution::InternalSwap(WavelengthRouter_MediaChannels_Channel_PsdDistribution* other) {
using std::swap;
psd_value_.InternalSwap(&other->psd_value_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata WavelengthRouter_MediaChannels_Channel_PsdDistribution::GetMetadata() const {
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void WavelengthRouter_MediaChannels_Channel_Source_Config::InitAsDefaultInstance() {
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Source_Config_default_instance_._instance.get_mutable()->port_name_ = const_cast< ::ywrapper::StringValue*>(
::ywrapper::StringValue::internal_default_instance());
}
void WavelengthRouter_MediaChannels_Channel_Source_Config::clear_port_name() {
if (GetArenaNoVirtual() == NULL && port_name_ != NULL) {
delete port_name_;
}
port_name_ = NULL;
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int WavelengthRouter_MediaChannels_Channel_Source_Config::kPortNameFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
WavelengthRouter_MediaChannels_Channel_Source_Config::WavelengthRouter_MediaChannels_Channel_Source_Config()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_Source_Config();
}
SharedCtor();
// @@protoc_insertion_point(constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config)
}
WavelengthRouter_MediaChannels_Channel_Source_Config::WavelengthRouter_MediaChannels_Channel_Source_Config(const WavelengthRouter_MediaChannels_Channel_Source_Config& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from.has_port_name()) {
port_name_ = new ::ywrapper::StringValue(*from.port_name_);
} else {
port_name_ = NULL;
}
// @@protoc_insertion_point(copy_constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config)
}
void WavelengthRouter_MediaChannels_Channel_Source_Config::SharedCtor() {
port_name_ = NULL;
_cached_size_ = 0;
}
WavelengthRouter_MediaChannels_Channel_Source_Config::~WavelengthRouter_MediaChannels_Channel_Source_Config() {
// @@protoc_insertion_point(destructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config)
SharedDtor();
}
void WavelengthRouter_MediaChannels_Channel_Source_Config::SharedDtor() {
if (this != internal_default_instance()) delete port_name_;
}
void WavelengthRouter_MediaChannels_Channel_Source_Config::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* WavelengthRouter_MediaChannels_Channel_Source_Config::descriptor() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const WavelengthRouter_MediaChannels_Channel_Source_Config& WavelengthRouter_MediaChannels_Channel_Source_Config::default_instance() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_Source_Config();
return *internal_default_instance();
}
WavelengthRouter_MediaChannels_Channel_Source_Config* WavelengthRouter_MediaChannels_Channel_Source_Config::New(::google::protobuf::Arena* arena) const {
WavelengthRouter_MediaChannels_Channel_Source_Config* n = new WavelengthRouter_MediaChannels_Channel_Source_Config;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void WavelengthRouter_MediaChannels_Channel_Source_Config::Clear() {
// @@protoc_insertion_point(message_clear_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == NULL && port_name_ != NULL) {
delete port_name_;
}
port_name_ = NULL;
_internal_metadata_.Clear();
}
bool WavelengthRouter_MediaChannels_Channel_Source_Config::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:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(2902825674u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// .ywrapper.StringValue port_name = 362853209 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/source/config/port-name"];
case 362853209: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(202u /* 2902825674 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_port_name()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, _internal_metadata_.mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config)
return true;
failure:
// @@protoc_insertion_point(parse_failure:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config)
return false;
#undef DO_
}
void WavelengthRouter_MediaChannels_Channel_Source_Config::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .ywrapper.StringValue port_name = 362853209 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/source/config/port-name"];
if (this->has_port_name()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
362853209, *this->port_name_, output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
}
// @@protoc_insertion_point(serialize_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config)
}
::google::protobuf::uint8* WavelengthRouter_MediaChannels_Channel_Source_Config::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .ywrapper.StringValue port_name = 362853209 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/source/config/port-name"];
if (this->has_port_name()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
362853209, *this->port_name_, deterministic, target);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
}
// @@protoc_insertion_point(serialize_to_array_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config)
return target;
}
size_t WavelengthRouter_MediaChannels_Channel_Source_Config::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config)
size_t total_size = 0;
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
}
// .ywrapper.StringValue port_name = 362853209 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/source/config/port-name"];
if (this->has_port_name()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->port_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 WavelengthRouter_MediaChannels_Channel_Source_Config::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config)
GOOGLE_DCHECK_NE(&from, this);
const WavelengthRouter_MediaChannels_Channel_Source_Config* source =
::google::protobuf::internal::DynamicCastToGenerated<const WavelengthRouter_MediaChannels_Channel_Source_Config>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config)
MergeFrom(*source);
}
}
void WavelengthRouter_MediaChannels_Channel_Source_Config::MergeFrom(const WavelengthRouter_MediaChannels_Channel_Source_Config& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_port_name()) {
mutable_port_name()->::ywrapper::StringValue::MergeFrom(from.port_name());
}
}
void WavelengthRouter_MediaChannels_Channel_Source_Config::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void WavelengthRouter_MediaChannels_Channel_Source_Config::CopyFrom(const WavelengthRouter_MediaChannels_Channel_Source_Config& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool WavelengthRouter_MediaChannels_Channel_Source_Config::IsInitialized() const {
return true;
}
void WavelengthRouter_MediaChannels_Channel_Source_Config::Swap(WavelengthRouter_MediaChannels_Channel_Source_Config* other) {
if (other == this) return;
InternalSwap(other);
}
void WavelengthRouter_MediaChannels_Channel_Source_Config::InternalSwap(WavelengthRouter_MediaChannels_Channel_Source_Config* other) {
using std::swap;
swap(port_name_, other->port_name_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata WavelengthRouter_MediaChannels_Channel_Source_Config::GetMetadata() const {
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void WavelengthRouter_MediaChannels_Channel_Source_State::InitAsDefaultInstance() {
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Source_State_default_instance_._instance.get_mutable()->port_name_ = const_cast< ::ywrapper::StringValue*>(
::ywrapper::StringValue::internal_default_instance());
}
void WavelengthRouter_MediaChannels_Channel_Source_State::clear_port_name() {
if (GetArenaNoVirtual() == NULL && port_name_ != NULL) {
delete port_name_;
}
port_name_ = NULL;
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int WavelengthRouter_MediaChannels_Channel_Source_State::kPortNameFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
WavelengthRouter_MediaChannels_Channel_Source_State::WavelengthRouter_MediaChannels_Channel_Source_State()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_Source_State();
}
SharedCtor();
// @@protoc_insertion_point(constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State)
}
WavelengthRouter_MediaChannels_Channel_Source_State::WavelengthRouter_MediaChannels_Channel_Source_State(const WavelengthRouter_MediaChannels_Channel_Source_State& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from.has_port_name()) {
port_name_ = new ::ywrapper::StringValue(*from.port_name_);
} else {
port_name_ = NULL;
}
// @@protoc_insertion_point(copy_constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State)
}
void WavelengthRouter_MediaChannels_Channel_Source_State::SharedCtor() {
port_name_ = NULL;
_cached_size_ = 0;
}
WavelengthRouter_MediaChannels_Channel_Source_State::~WavelengthRouter_MediaChannels_Channel_Source_State() {
// @@protoc_insertion_point(destructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State)
SharedDtor();
}
void WavelengthRouter_MediaChannels_Channel_Source_State::SharedDtor() {
if (this != internal_default_instance()) delete port_name_;
}
void WavelengthRouter_MediaChannels_Channel_Source_State::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* WavelengthRouter_MediaChannels_Channel_Source_State::descriptor() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const WavelengthRouter_MediaChannels_Channel_Source_State& WavelengthRouter_MediaChannels_Channel_Source_State::default_instance() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_Source_State();
return *internal_default_instance();
}
WavelengthRouter_MediaChannels_Channel_Source_State* WavelengthRouter_MediaChannels_Channel_Source_State::New(::google::protobuf::Arena* arena) const {
WavelengthRouter_MediaChannels_Channel_Source_State* n = new WavelengthRouter_MediaChannels_Channel_Source_State;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void WavelengthRouter_MediaChannels_Channel_Source_State::Clear() {
// @@protoc_insertion_point(message_clear_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == NULL && port_name_ != NULL) {
delete port_name_;
}
port_name_ = NULL;
_internal_metadata_.Clear();
}
bool WavelengthRouter_MediaChannels_Channel_Source_State::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:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(78897234u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// .ywrapper.StringValue port_name = 9862154 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/source/state/port-name"];
case 9862154: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(82u /* 78897234 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_port_name()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, _internal_metadata_.mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State)
return true;
failure:
// @@protoc_insertion_point(parse_failure:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State)
return false;
#undef DO_
}
void WavelengthRouter_MediaChannels_Channel_Source_State::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .ywrapper.StringValue port_name = 9862154 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/source/state/port-name"];
if (this->has_port_name()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
9862154, *this->port_name_, output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
}
// @@protoc_insertion_point(serialize_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State)
}
::google::protobuf::uint8* WavelengthRouter_MediaChannels_Channel_Source_State::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .ywrapper.StringValue port_name = 9862154 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/source/state/port-name"];
if (this->has_port_name()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
9862154, *this->port_name_, deterministic, target);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
}
// @@protoc_insertion_point(serialize_to_array_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State)
return target;
}
size_t WavelengthRouter_MediaChannels_Channel_Source_State::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State)
size_t total_size = 0;
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
}
// .ywrapper.StringValue port_name = 9862154 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/source/state/port-name"];
if (this->has_port_name()) {
total_size += 4 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->port_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 WavelengthRouter_MediaChannels_Channel_Source_State::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State)
GOOGLE_DCHECK_NE(&from, this);
const WavelengthRouter_MediaChannels_Channel_Source_State* source =
::google::protobuf::internal::DynamicCastToGenerated<const WavelengthRouter_MediaChannels_Channel_Source_State>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State)
MergeFrom(*source);
}
}
void WavelengthRouter_MediaChannels_Channel_Source_State::MergeFrom(const WavelengthRouter_MediaChannels_Channel_Source_State& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_port_name()) {
mutable_port_name()->::ywrapper::StringValue::MergeFrom(from.port_name());
}
}
void WavelengthRouter_MediaChannels_Channel_Source_State::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void WavelengthRouter_MediaChannels_Channel_Source_State::CopyFrom(const WavelengthRouter_MediaChannels_Channel_Source_State& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool WavelengthRouter_MediaChannels_Channel_Source_State::IsInitialized() const {
return true;
}
void WavelengthRouter_MediaChannels_Channel_Source_State::Swap(WavelengthRouter_MediaChannels_Channel_Source_State* other) {
if (other == this) return;
InternalSwap(other);
}
void WavelengthRouter_MediaChannels_Channel_Source_State::InternalSwap(WavelengthRouter_MediaChannels_Channel_Source_State* other) {
using std::swap;
swap(port_name_, other->port_name_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata WavelengthRouter_MediaChannels_Channel_Source_State::GetMetadata() const {
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void WavelengthRouter_MediaChannels_Channel_Source::InitAsDefaultInstance() {
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Source_default_instance_._instance.get_mutable()->config_ = const_cast< ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source_Config*>(
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source_Config::internal_default_instance());
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_Source_default_instance_._instance.get_mutable()->state_ = const_cast< ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source_State*>(
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source_State::internal_default_instance());
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int WavelengthRouter_MediaChannels_Channel_Source::kConfigFieldNumber;
const int WavelengthRouter_MediaChannels_Channel_Source::kStateFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
WavelengthRouter_MediaChannels_Channel_Source::WavelengthRouter_MediaChannels_Channel_Source()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_Source();
}
SharedCtor();
// @@protoc_insertion_point(constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source)
}
WavelengthRouter_MediaChannels_Channel_Source::WavelengthRouter_MediaChannels_Channel_Source(const WavelengthRouter_MediaChannels_Channel_Source& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from.has_state()) {
state_ = new ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source_State(*from.state_);
} else {
state_ = NULL;
}
if (from.has_config()) {
config_ = new ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source_Config(*from.config_);
} else {
config_ = NULL;
}
// @@protoc_insertion_point(copy_constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source)
}
void WavelengthRouter_MediaChannels_Channel_Source::SharedCtor() {
::memset(&state_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&config_) -
reinterpret_cast<char*>(&state_)) + sizeof(config_));
_cached_size_ = 0;
}
WavelengthRouter_MediaChannels_Channel_Source::~WavelengthRouter_MediaChannels_Channel_Source() {
// @@protoc_insertion_point(destructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source)
SharedDtor();
}
void WavelengthRouter_MediaChannels_Channel_Source::SharedDtor() {
if (this != internal_default_instance()) delete state_;
if (this != internal_default_instance()) delete config_;
}
void WavelengthRouter_MediaChannels_Channel_Source::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* WavelengthRouter_MediaChannels_Channel_Source::descriptor() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const WavelengthRouter_MediaChannels_Channel_Source& WavelengthRouter_MediaChannels_Channel_Source::default_instance() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_Source();
return *internal_default_instance();
}
WavelengthRouter_MediaChannels_Channel_Source* WavelengthRouter_MediaChannels_Channel_Source::New(::google::protobuf::Arena* arena) const {
WavelengthRouter_MediaChannels_Channel_Source* n = new WavelengthRouter_MediaChannels_Channel_Source;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void WavelengthRouter_MediaChannels_Channel_Source::Clear() {
// @@protoc_insertion_point(message_clear_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == NULL && state_ != NULL) {
delete state_;
}
state_ = NULL;
if (GetArenaNoVirtual() == NULL && config_ != NULL) {
delete config_;
}
config_ = NULL;
_internal_metadata_.Clear();
}
bool WavelengthRouter_MediaChannels_Channel_Source::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:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(3905201370u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State state = 176255644 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/source/state"];
case 176255644: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(226u /* 1410045154 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_state()));
} else {
goto handle_unusual;
}
break;
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config config = 488150171 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/source/config"];
case 488150171: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(218u /* 3905201370 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_config()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, _internal_metadata_.mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source)
return true;
failure:
// @@protoc_insertion_point(parse_failure:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source)
return false;
#undef DO_
}
void WavelengthRouter_MediaChannels_Channel_Source::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State state = 176255644 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/source/state"];
if (this->has_state()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
176255644, *this->state_, output);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config config = 488150171 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/source/config"];
if (this->has_config()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
488150171, *this->config_, output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
}
// @@protoc_insertion_point(serialize_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source)
}
::google::protobuf::uint8* WavelengthRouter_MediaChannels_Channel_Source::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State state = 176255644 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/source/state"];
if (this->has_state()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
176255644, *this->state_, deterministic, target);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config config = 488150171 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/source/config"];
if (this->has_config()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
488150171, *this->config_, deterministic, target);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
}
// @@protoc_insertion_point(serialize_to_array_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source)
return target;
}
size_t WavelengthRouter_MediaChannels_Channel_Source::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source)
size_t total_size = 0;
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.State state = 176255644 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/source/state"];
if (this->has_state()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->state_);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source.Config config = 488150171 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/source/config"];
if (this->has_config()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->config_);
}
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 WavelengthRouter_MediaChannels_Channel_Source::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source)
GOOGLE_DCHECK_NE(&from, this);
const WavelengthRouter_MediaChannels_Channel_Source* source =
::google::protobuf::internal::DynamicCastToGenerated<const WavelengthRouter_MediaChannels_Channel_Source>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source)
MergeFrom(*source);
}
}
void WavelengthRouter_MediaChannels_Channel_Source::MergeFrom(const WavelengthRouter_MediaChannels_Channel_Source& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_state()) {
mutable_state()->::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source_State::MergeFrom(from.state());
}
if (from.has_config()) {
mutable_config()->::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source_Config::MergeFrom(from.config());
}
}
void WavelengthRouter_MediaChannels_Channel_Source::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void WavelengthRouter_MediaChannels_Channel_Source::CopyFrom(const WavelengthRouter_MediaChannels_Channel_Source& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool WavelengthRouter_MediaChannels_Channel_Source::IsInitialized() const {
return true;
}
void WavelengthRouter_MediaChannels_Channel_Source::Swap(WavelengthRouter_MediaChannels_Channel_Source* other) {
if (other == this) return;
InternalSwap(other);
}
void WavelengthRouter_MediaChannels_Channel_Source::InternalSwap(WavelengthRouter_MediaChannels_Channel_Source* other) {
using std::swap;
swap(state_, other->state_);
swap(config_, other->config_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata WavelengthRouter_MediaChannels_Channel_Source::GetMetadata() const {
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void WavelengthRouter_MediaChannels_Channel_State::InitAsDefaultInstance() {
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_State_default_instance_._instance.get_mutable()->index_ = const_cast< ::ywrapper::UintValue*>(
::ywrapper::UintValue::internal_default_instance());
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_State_default_instance_._instance.get_mutable()->lower_frequency_ = const_cast< ::ywrapper::UintValue*>(
::ywrapper::UintValue::internal_default_instance());
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_State_default_instance_._instance.get_mutable()->name_ = const_cast< ::ywrapper::StringValue*>(
::ywrapper::StringValue::internal_default_instance());
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_State_default_instance_._instance.get_mutable()->upper_frequency_ = const_cast< ::ywrapper::UintValue*>(
::ywrapper::UintValue::internal_default_instance());
}
void WavelengthRouter_MediaChannels_Channel_State::clear_index() {
if (GetArenaNoVirtual() == NULL && index_ != NULL) {
delete index_;
}
index_ = NULL;
}
void WavelengthRouter_MediaChannels_Channel_State::clear_lower_frequency() {
if (GetArenaNoVirtual() == NULL && lower_frequency_ != NULL) {
delete lower_frequency_;
}
lower_frequency_ = NULL;
}
void WavelengthRouter_MediaChannels_Channel_State::clear_name() {
if (GetArenaNoVirtual() == NULL && name_ != NULL) {
delete name_;
}
name_ = NULL;
}
void WavelengthRouter_MediaChannels_Channel_State::clear_upper_frequency() {
if (GetArenaNoVirtual() == NULL && upper_frequency_ != NULL) {
delete upper_frequency_;
}
upper_frequency_ = NULL;
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int WavelengthRouter_MediaChannels_Channel_State::kAdminStatusFieldNumber;
const int WavelengthRouter_MediaChannels_Channel_State::kIndexFieldNumber;
const int WavelengthRouter_MediaChannels_Channel_State::kLowerFrequencyFieldNumber;
const int WavelengthRouter_MediaChannels_Channel_State::kNameFieldNumber;
const int WavelengthRouter_MediaChannels_Channel_State::kOperStatusFieldNumber;
const int WavelengthRouter_MediaChannels_Channel_State::kUpperFrequencyFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
WavelengthRouter_MediaChannels_Channel_State::WavelengthRouter_MediaChannels_Channel_State()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_State();
}
SharedCtor();
// @@protoc_insertion_point(constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State)
}
WavelengthRouter_MediaChannels_Channel_State::WavelengthRouter_MediaChannels_Channel_State(const WavelengthRouter_MediaChannels_Channel_State& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from.has_lower_frequency()) {
lower_frequency_ = new ::ywrapper::UintValue(*from.lower_frequency_);
} else {
lower_frequency_ = NULL;
}
if (from.has_index()) {
index_ = new ::ywrapper::UintValue(*from.index_);
} else {
index_ = NULL;
}
if (from.has_name()) {
name_ = new ::ywrapper::StringValue(*from.name_);
} else {
name_ = NULL;
}
if (from.has_upper_frequency()) {
upper_frequency_ = new ::ywrapper::UintValue(*from.upper_frequency_);
} else {
upper_frequency_ = NULL;
}
::memcpy(&admin_status_, &from.admin_status_,
static_cast<size_t>(reinterpret_cast<char*>(&oper_status_) -
reinterpret_cast<char*>(&admin_status_)) + sizeof(oper_status_));
// @@protoc_insertion_point(copy_constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State)
}
void WavelengthRouter_MediaChannels_Channel_State::SharedCtor() {
::memset(&lower_frequency_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&oper_status_) -
reinterpret_cast<char*>(&lower_frequency_)) + sizeof(oper_status_));
_cached_size_ = 0;
}
WavelengthRouter_MediaChannels_Channel_State::~WavelengthRouter_MediaChannels_Channel_State() {
// @@protoc_insertion_point(destructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State)
SharedDtor();
}
void WavelengthRouter_MediaChannels_Channel_State::SharedDtor() {
if (this != internal_default_instance()) delete lower_frequency_;
if (this != internal_default_instance()) delete index_;
if (this != internal_default_instance()) delete name_;
if (this != internal_default_instance()) delete upper_frequency_;
}
void WavelengthRouter_MediaChannels_Channel_State::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* WavelengthRouter_MediaChannels_Channel_State::descriptor() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const WavelengthRouter_MediaChannels_Channel_State& WavelengthRouter_MediaChannels_Channel_State::default_instance() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel_State();
return *internal_default_instance();
}
WavelengthRouter_MediaChannels_Channel_State* WavelengthRouter_MediaChannels_Channel_State::New(::google::protobuf::Arena* arena) const {
WavelengthRouter_MediaChannels_Channel_State* n = new WavelengthRouter_MediaChannels_Channel_State;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void WavelengthRouter_MediaChannels_Channel_State::Clear() {
// @@protoc_insertion_point(message_clear_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == NULL && lower_frequency_ != NULL) {
delete lower_frequency_;
}
lower_frequency_ = NULL;
if (GetArenaNoVirtual() == NULL && index_ != NULL) {
delete index_;
}
index_ = NULL;
if (GetArenaNoVirtual() == NULL && name_ != NULL) {
delete name_;
}
name_ = NULL;
if (GetArenaNoVirtual() == NULL && upper_frequency_ != NULL) {
delete upper_frequency_;
}
upper_frequency_ = NULL;
::memset(&admin_status_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&oper_status_) -
reinterpret_cast<char*>(&admin_status_)) + sizeof(oper_status_));
_internal_metadata_.Clear();
}
bool WavelengthRouter_MediaChannels_Channel_State::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:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(4214441040u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// .ywrapper.UintValue lower_frequency = 62283199 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/lower-frequency"];
case 62283199: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(250u /* 498265594 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_lower_frequency()));
} else {
goto handle_unusual;
}
break;
}
// .ywrapper.UintValue index = 221912741 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/index"];
case 221912741: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(42u /* 1775301930 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_index()));
} else {
goto handle_unusual;
}
break;
}
// .ywrapper.StringValue name = 288898326 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/name"];
case 288898326: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(178u /* 2311186610 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_name()));
} else {
goto handle_unusual;
}
break;
}
// .openconfig.enums.OpenconfigWavelengthRouterAdminStateType admin_status = 320367411 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/admin-status"];
case 320367411: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(152u /* 2562939288 & 0xFF */)) {
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
set_admin_status(static_cast< ::openconfig::enums::OpenconfigWavelengthRouterAdminStateType >(value));
} else {
goto handle_unusual;
}
break;
}
// .ywrapper.UintValue upper_frequency = 422717604 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/upper-frequency"];
case 422717604: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(34u /* 3381740834 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_upper_frequency()));
} else {
goto handle_unusual;
}
break;
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State.OperStatus oper_status = 526805130 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/oper-status"];
case 526805130: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(80u /* 4214441040 & 0xFF */)) {
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
set_oper_status(static_cast< ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_State_OperStatus >(value));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, _internal_metadata_.mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State)
return true;
failure:
// @@protoc_insertion_point(parse_failure:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State)
return false;
#undef DO_
}
void WavelengthRouter_MediaChannels_Channel_State::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .ywrapper.UintValue lower_frequency = 62283199 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/lower-frequency"];
if (this->has_lower_frequency()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
62283199, *this->lower_frequency_, output);
}
// .ywrapper.UintValue index = 221912741 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/index"];
if (this->has_index()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
221912741, *this->index_, output);
}
// .ywrapper.StringValue name = 288898326 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/name"];
if (this->has_name()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
288898326, *this->name_, output);
}
// .openconfig.enums.OpenconfigWavelengthRouterAdminStateType admin_status = 320367411 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/admin-status"];
if (this->admin_status() != 0) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
320367411, this->admin_status(), output);
}
// .ywrapper.UintValue upper_frequency = 422717604 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/upper-frequency"];
if (this->has_upper_frequency()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
422717604, *this->upper_frequency_, output);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State.OperStatus oper_status = 526805130 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/oper-status"];
if (this->oper_status() != 0) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
526805130, this->oper_status(), output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
}
// @@protoc_insertion_point(serialize_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State)
}
::google::protobuf::uint8* WavelengthRouter_MediaChannels_Channel_State::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .ywrapper.UintValue lower_frequency = 62283199 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/lower-frequency"];
if (this->has_lower_frequency()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
62283199, *this->lower_frequency_, deterministic, target);
}
// .ywrapper.UintValue index = 221912741 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/index"];
if (this->has_index()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
221912741, *this->index_, deterministic, target);
}
// .ywrapper.StringValue name = 288898326 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/name"];
if (this->has_name()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
288898326, *this->name_, deterministic, target);
}
// .openconfig.enums.OpenconfigWavelengthRouterAdminStateType admin_status = 320367411 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/admin-status"];
if (this->admin_status() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
320367411, this->admin_status(), target);
}
// .ywrapper.UintValue upper_frequency = 422717604 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/upper-frequency"];
if (this->has_upper_frequency()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
422717604, *this->upper_frequency_, deterministic, target);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State.OperStatus oper_status = 526805130 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/oper-status"];
if (this->oper_status() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
526805130, this->oper_status(), target);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
}
// @@protoc_insertion_point(serialize_to_array_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State)
return target;
}
size_t WavelengthRouter_MediaChannels_Channel_State::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State)
size_t total_size = 0;
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
}
// .ywrapper.UintValue lower_frequency = 62283199 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/lower-frequency"];
if (this->has_lower_frequency()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->lower_frequency_);
}
// .ywrapper.UintValue index = 221912741 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/index"];
if (this->has_index()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->index_);
}
// .ywrapper.StringValue name = 288898326 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/name"];
if (this->has_name()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->name_);
}
// .ywrapper.UintValue upper_frequency = 422717604 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/upper-frequency"];
if (this->has_upper_frequency()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->upper_frequency_);
}
// .openconfig.enums.OpenconfigWavelengthRouterAdminStateType admin_status = 320367411 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/admin-status"];
if (this->admin_status() != 0) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->admin_status());
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State.OperStatus oper_status = 526805130 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state/oper-status"];
if (this->oper_status() != 0) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->oper_status());
}
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 WavelengthRouter_MediaChannels_Channel_State::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State)
GOOGLE_DCHECK_NE(&from, this);
const WavelengthRouter_MediaChannels_Channel_State* source =
::google::protobuf::internal::DynamicCastToGenerated<const WavelengthRouter_MediaChannels_Channel_State>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State)
MergeFrom(*source);
}
}
void WavelengthRouter_MediaChannels_Channel_State::MergeFrom(const WavelengthRouter_MediaChannels_Channel_State& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_lower_frequency()) {
mutable_lower_frequency()->::ywrapper::UintValue::MergeFrom(from.lower_frequency());
}
if (from.has_index()) {
mutable_index()->::ywrapper::UintValue::MergeFrom(from.index());
}
if (from.has_name()) {
mutable_name()->::ywrapper::StringValue::MergeFrom(from.name());
}
if (from.has_upper_frequency()) {
mutable_upper_frequency()->::ywrapper::UintValue::MergeFrom(from.upper_frequency());
}
if (from.admin_status() != 0) {
set_admin_status(from.admin_status());
}
if (from.oper_status() != 0) {
set_oper_status(from.oper_status());
}
}
void WavelengthRouter_MediaChannels_Channel_State::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void WavelengthRouter_MediaChannels_Channel_State::CopyFrom(const WavelengthRouter_MediaChannels_Channel_State& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool WavelengthRouter_MediaChannels_Channel_State::IsInitialized() const {
return true;
}
void WavelengthRouter_MediaChannels_Channel_State::Swap(WavelengthRouter_MediaChannels_Channel_State* other) {
if (other == this) return;
InternalSwap(other);
}
void WavelengthRouter_MediaChannels_Channel_State::InternalSwap(WavelengthRouter_MediaChannels_Channel_State* other) {
using std::swap;
swap(lower_frequency_, other->lower_frequency_);
swap(index_, other->index_);
swap(name_, other->name_);
swap(upper_frequency_, other->upper_frequency_);
swap(admin_status_, other->admin_status_);
swap(oper_status_, other->oper_status_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata WavelengthRouter_MediaChannels_Channel_State::GetMetadata() const {
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void WavelengthRouter_MediaChannels_Channel::InitAsDefaultInstance() {
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_default_instance_._instance.get_mutable()->config_ = const_cast< ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Config*>(
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Config::internal_default_instance());
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_default_instance_._instance.get_mutable()->dest_ = const_cast< ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest*>(
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest::internal_default_instance());
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_default_instance_._instance.get_mutable()->psd_distribution_ = const_cast< ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution*>(
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution::internal_default_instance());
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_default_instance_._instance.get_mutable()->source_ = const_cast< ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source*>(
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source::internal_default_instance());
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_Channel_default_instance_._instance.get_mutable()->state_ = const_cast< ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_State*>(
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_State::internal_default_instance());
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int WavelengthRouter_MediaChannels_Channel::kConfigFieldNumber;
const int WavelengthRouter_MediaChannels_Channel::kDestFieldNumber;
const int WavelengthRouter_MediaChannels_Channel::kPsdDistributionFieldNumber;
const int WavelengthRouter_MediaChannels_Channel::kSourceFieldNumber;
const int WavelengthRouter_MediaChannels_Channel::kStateFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
WavelengthRouter_MediaChannels_Channel::WavelengthRouter_MediaChannels_Channel()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel();
}
SharedCtor();
// @@protoc_insertion_point(constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel)
}
WavelengthRouter_MediaChannels_Channel::WavelengthRouter_MediaChannels_Channel(const WavelengthRouter_MediaChannels_Channel& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from.has_psd_distribution()) {
psd_distribution_ = new ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution(*from.psd_distribution_);
} else {
psd_distribution_ = NULL;
}
if (from.has_dest()) {
dest_ = new ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest(*from.dest_);
} else {
dest_ = NULL;
}
if (from.has_source()) {
source_ = new ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source(*from.source_);
} else {
source_ = NULL;
}
if (from.has_config()) {
config_ = new ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Config(*from.config_);
} else {
config_ = NULL;
}
if (from.has_state()) {
state_ = new ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_State(*from.state_);
} else {
state_ = NULL;
}
// @@protoc_insertion_point(copy_constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel)
}
void WavelengthRouter_MediaChannels_Channel::SharedCtor() {
::memset(&psd_distribution_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&state_) -
reinterpret_cast<char*>(&psd_distribution_)) + sizeof(state_));
_cached_size_ = 0;
}
WavelengthRouter_MediaChannels_Channel::~WavelengthRouter_MediaChannels_Channel() {
// @@protoc_insertion_point(destructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel)
SharedDtor();
}
void WavelengthRouter_MediaChannels_Channel::SharedDtor() {
if (this != internal_default_instance()) delete psd_distribution_;
if (this != internal_default_instance()) delete dest_;
if (this != internal_default_instance()) delete source_;
if (this != internal_default_instance()) delete config_;
if (this != internal_default_instance()) delete state_;
}
void WavelengthRouter_MediaChannels_Channel::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* WavelengthRouter_MediaChannels_Channel::descriptor() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const WavelengthRouter_MediaChannels_Channel& WavelengthRouter_MediaChannels_Channel::default_instance() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_Channel();
return *internal_default_instance();
}
WavelengthRouter_MediaChannels_Channel* WavelengthRouter_MediaChannels_Channel::New(::google::protobuf::Arena* arena) const {
WavelengthRouter_MediaChannels_Channel* n = new WavelengthRouter_MediaChannels_Channel;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void WavelengthRouter_MediaChannels_Channel::Clear() {
// @@protoc_insertion_point(message_clear_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == NULL && psd_distribution_ != NULL) {
delete psd_distribution_;
}
psd_distribution_ = NULL;
if (GetArenaNoVirtual() == NULL && dest_ != NULL) {
delete dest_;
}
dest_ = NULL;
if (GetArenaNoVirtual() == NULL && source_ != NULL) {
delete source_;
}
source_ = NULL;
if (GetArenaNoVirtual() == NULL && config_ != NULL) {
delete config_;
}
config_ = NULL;
if (GetArenaNoVirtual() == NULL && state_ != NULL) {
delete state_;
}
state_ = NULL;
_internal_metadata_.Clear();
}
bool WavelengthRouter_MediaChannels_Channel::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:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(3420021666u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution psd_distribution = 48462813 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution"];
case 48462813: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(234u /* 387702506 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_psd_distribution()));
} else {
goto handle_unusual;
}
break;
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest dest = 145566309 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/dest"];
case 145566309: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(42u /* 1164530474 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_dest()));
} else {
goto handle_unusual;
}
break;
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source source = 246551242 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/source"];
case 246551242: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(82u /* 1972409938 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_source()));
} else {
goto handle_unusual;
}
break;
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config config = 409882003 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config"];
case 409882003: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(154u /* 3279056026 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_config()));
} else {
goto handle_unusual;
}
break;
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State state = 427502708 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state"];
case 427502708: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(162u /* 3420021666 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_state()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, _internal_metadata_.mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel)
return true;
failure:
// @@protoc_insertion_point(parse_failure:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel)
return false;
#undef DO_
}
void WavelengthRouter_MediaChannels_Channel::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution psd_distribution = 48462813 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution"];
if (this->has_psd_distribution()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
48462813, *this->psd_distribution_, output);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest dest = 145566309 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/dest"];
if (this->has_dest()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
145566309, *this->dest_, output);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source source = 246551242 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/source"];
if (this->has_source()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
246551242, *this->source_, output);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config config = 409882003 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config"];
if (this->has_config()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
409882003, *this->config_, output);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State state = 427502708 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state"];
if (this->has_state()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
427502708, *this->state_, output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
}
// @@protoc_insertion_point(serialize_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel)
}
::google::protobuf::uint8* WavelengthRouter_MediaChannels_Channel::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution psd_distribution = 48462813 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution"];
if (this->has_psd_distribution()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
48462813, *this->psd_distribution_, deterministic, target);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest dest = 145566309 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/dest"];
if (this->has_dest()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
145566309, *this->dest_, deterministic, target);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source source = 246551242 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/source"];
if (this->has_source()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
246551242, *this->source_, deterministic, target);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config config = 409882003 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config"];
if (this->has_config()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
409882003, *this->config_, deterministic, target);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State state = 427502708 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state"];
if (this->has_state()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
427502708, *this->state_, deterministic, target);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
}
// @@protoc_insertion_point(serialize_to_array_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel)
return target;
}
size_t WavelengthRouter_MediaChannels_Channel::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel)
size_t total_size = 0;
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.PsdDistribution psd_distribution = 48462813 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/psd-distribution"];
if (this->has_psd_distribution()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->psd_distribution_);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Dest dest = 145566309 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/dest"];
if (this->has_dest()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->dest_);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Source source = 246551242 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/source"];
if (this->has_source()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->source_);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.Config config = 409882003 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/config"];
if (this->has_config()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->config_);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel.State state = 427502708 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/state"];
if (this->has_state()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->state_);
}
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 WavelengthRouter_MediaChannels_Channel::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel)
GOOGLE_DCHECK_NE(&from, this);
const WavelengthRouter_MediaChannels_Channel* source =
::google::protobuf::internal::DynamicCastToGenerated<const WavelengthRouter_MediaChannels_Channel>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel)
MergeFrom(*source);
}
}
void WavelengthRouter_MediaChannels_Channel::MergeFrom(const WavelengthRouter_MediaChannels_Channel& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_psd_distribution()) {
mutable_psd_distribution()->::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_PsdDistribution::MergeFrom(from.psd_distribution());
}
if (from.has_dest()) {
mutable_dest()->::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Dest::MergeFrom(from.dest());
}
if (from.has_source()) {
mutable_source()->::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Source::MergeFrom(from.source());
}
if (from.has_config()) {
mutable_config()->::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_Config::MergeFrom(from.config());
}
if (from.has_state()) {
mutable_state()->::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel_State::MergeFrom(from.state());
}
}
void WavelengthRouter_MediaChannels_Channel::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void WavelengthRouter_MediaChannels_Channel::CopyFrom(const WavelengthRouter_MediaChannels_Channel& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool WavelengthRouter_MediaChannels_Channel::IsInitialized() const {
return true;
}
void WavelengthRouter_MediaChannels_Channel::Swap(WavelengthRouter_MediaChannels_Channel* other) {
if (other == this) return;
InternalSwap(other);
}
void WavelengthRouter_MediaChannels_Channel::InternalSwap(WavelengthRouter_MediaChannels_Channel* other) {
using std::swap;
swap(psd_distribution_, other->psd_distribution_);
swap(dest_, other->dest_);
swap(source_, other->source_);
swap(config_, other->config_);
swap(state_, other->state_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata WavelengthRouter_MediaChannels_Channel::GetMetadata() const {
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void WavelengthRouter_MediaChannels_ChannelKey::InitAsDefaultInstance() {
::openconfig::openconfig_wavelength_router::_WavelengthRouter_MediaChannels_ChannelKey_default_instance_._instance.get_mutable()->channel_ = const_cast< ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel*>(
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel::internal_default_instance());
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int WavelengthRouter_MediaChannels_ChannelKey::kIndexFieldNumber;
const int WavelengthRouter_MediaChannels_ChannelKey::kChannelFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
WavelengthRouter_MediaChannels_ChannelKey::WavelengthRouter_MediaChannels_ChannelKey()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_ChannelKey();
}
SharedCtor();
// @@protoc_insertion_point(constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey)
}
WavelengthRouter_MediaChannels_ChannelKey::WavelengthRouter_MediaChannels_ChannelKey(const WavelengthRouter_MediaChannels_ChannelKey& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from.has_channel()) {
channel_ = new ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel(*from.channel_);
} else {
channel_ = NULL;
}
index_ = from.index_;
// @@protoc_insertion_point(copy_constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey)
}
void WavelengthRouter_MediaChannels_ChannelKey::SharedCtor() {
::memset(&channel_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&index_) -
reinterpret_cast<char*>(&channel_)) + sizeof(index_));
_cached_size_ = 0;
}
WavelengthRouter_MediaChannels_ChannelKey::~WavelengthRouter_MediaChannels_ChannelKey() {
// @@protoc_insertion_point(destructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey)
SharedDtor();
}
void WavelengthRouter_MediaChannels_ChannelKey::SharedDtor() {
if (this != internal_default_instance()) delete channel_;
}
void WavelengthRouter_MediaChannels_ChannelKey::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* WavelengthRouter_MediaChannels_ChannelKey::descriptor() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const WavelengthRouter_MediaChannels_ChannelKey& WavelengthRouter_MediaChannels_ChannelKey::default_instance() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels_ChannelKey();
return *internal_default_instance();
}
WavelengthRouter_MediaChannels_ChannelKey* WavelengthRouter_MediaChannels_ChannelKey::New(::google::protobuf::Arena* arena) const {
WavelengthRouter_MediaChannels_ChannelKey* n = new WavelengthRouter_MediaChannels_ChannelKey;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void WavelengthRouter_MediaChannels_ChannelKey::Clear() {
// @@protoc_insertion_point(message_clear_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == NULL && channel_ != NULL) {
delete channel_;
}
channel_ = NULL;
index_ = GOOGLE_ULONGLONG(0);
_internal_metadata_.Clear();
}
bool WavelengthRouter_MediaChannels_ChannelKey::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:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// uint64 index = 1 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/index"];
case 1: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
input, &index_)));
} else {
goto handle_unusual;
}
break;
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel channel = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_channel()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, _internal_metadata_.mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey)
return true;
failure:
// @@protoc_insertion_point(parse_failure:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey)
return false;
#undef DO_
}
void WavelengthRouter_MediaChannels_ChannelKey::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// uint64 index = 1 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/index"];
if (this->index() != 0) {
::google::protobuf::internal::WireFormatLite::WriteUInt64(1, this->index(), output);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel channel = 2;
if (this->has_channel()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, *this->channel_, output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
}
// @@protoc_insertion_point(serialize_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey)
}
::google::protobuf::uint8* WavelengthRouter_MediaChannels_ChannelKey::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// uint64 index = 1 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/index"];
if (this->index() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(1, this->index(), target);
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel channel = 2;
if (this->has_channel()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
2, *this->channel_, deterministic, target);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
}
// @@protoc_insertion_point(serialize_to_array_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey)
return target;
}
size_t WavelengthRouter_MediaChannels_ChannelKey::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey)
size_t total_size = 0;
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.Channel channel = 2;
if (this->has_channel()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->channel_);
}
// uint64 index = 1 [(.yext.schemapath) = "/wavelength-router/media-channels/channel/index"];
if (this->index() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt64Size(
this->index());
}
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 WavelengthRouter_MediaChannels_ChannelKey::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey)
GOOGLE_DCHECK_NE(&from, this);
const WavelengthRouter_MediaChannels_ChannelKey* source =
::google::protobuf::internal::DynamicCastToGenerated<const WavelengthRouter_MediaChannels_ChannelKey>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey)
MergeFrom(*source);
}
}
void WavelengthRouter_MediaChannels_ChannelKey::MergeFrom(const WavelengthRouter_MediaChannels_ChannelKey& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_channel()) {
mutable_channel()->::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels_Channel::MergeFrom(from.channel());
}
if (from.index() != 0) {
set_index(from.index());
}
}
void WavelengthRouter_MediaChannels_ChannelKey::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void WavelengthRouter_MediaChannels_ChannelKey::CopyFrom(const WavelengthRouter_MediaChannels_ChannelKey& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool WavelengthRouter_MediaChannels_ChannelKey::IsInitialized() const {
return true;
}
void WavelengthRouter_MediaChannels_ChannelKey::Swap(WavelengthRouter_MediaChannels_ChannelKey* other) {
if (other == this) return;
InternalSwap(other);
}
void WavelengthRouter_MediaChannels_ChannelKey::InternalSwap(WavelengthRouter_MediaChannels_ChannelKey* other) {
using std::swap;
swap(channel_, other->channel_);
swap(index_, other->index_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata WavelengthRouter_MediaChannels_ChannelKey::GetMetadata() const {
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void WavelengthRouter_MediaChannels::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int WavelengthRouter_MediaChannels::kChannelFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
WavelengthRouter_MediaChannels::WavelengthRouter_MediaChannels()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels();
}
SharedCtor();
// @@protoc_insertion_point(constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels)
}
WavelengthRouter_MediaChannels::WavelengthRouter_MediaChannels(const WavelengthRouter_MediaChannels& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
channel_(from.channel_),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels)
}
void WavelengthRouter_MediaChannels::SharedCtor() {
_cached_size_ = 0;
}
WavelengthRouter_MediaChannels::~WavelengthRouter_MediaChannels() {
// @@protoc_insertion_point(destructor:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels)
SharedDtor();
}
void WavelengthRouter_MediaChannels::SharedDtor() {
}
void WavelengthRouter_MediaChannels::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* WavelengthRouter_MediaChannels::descriptor() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const WavelengthRouter_MediaChannels& WavelengthRouter_MediaChannels::default_instance() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter_MediaChannels();
return *internal_default_instance();
}
WavelengthRouter_MediaChannels* WavelengthRouter_MediaChannels::New(::google::protobuf::Arena* arena) const {
WavelengthRouter_MediaChannels* n = new WavelengthRouter_MediaChannels;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void WavelengthRouter_MediaChannels::Clear() {
// @@protoc_insertion_point(message_clear_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
channel_.Clear();
_internal_metadata_.Clear();
}
bool WavelengthRouter_MediaChannels::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:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(4294721170u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey channel = 536840146 [(.yext.schemapath) = "/wavelength-router/media-channels/channel"];
case 536840146: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(146u /* 4294721170 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(input, add_channel()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, _internal_metadata_.mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels)
return true;
failure:
// @@protoc_insertion_point(parse_failure:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels)
return false;
#undef DO_
}
void WavelengthRouter_MediaChannels::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey channel = 536840146 [(.yext.schemapath) = "/wavelength-router/media-channels/channel"];
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->channel_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
536840146, this->channel(static_cast<int>(i)), output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
}
// @@protoc_insertion_point(serialize_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels)
}
::google::protobuf::uint8* WavelengthRouter_MediaChannels::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey channel = 536840146 [(.yext.schemapath) = "/wavelength-router/media-channels/channel"];
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->channel_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
536840146, this->channel(static_cast<int>(i)), deterministic, target);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
}
// @@protoc_insertion_point(serialize_to_array_end:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels)
return target;
}
size_t WavelengthRouter_MediaChannels::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels)
size_t total_size = 0;
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
}
// repeated .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels.ChannelKey channel = 536840146 [(.yext.schemapath) = "/wavelength-router/media-channels/channel"];
{
unsigned int count = static_cast<unsigned int>(this->channel_size());
total_size += 5UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSize(
this->channel(static_cast<int>(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 WavelengthRouter_MediaChannels::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels)
GOOGLE_DCHECK_NE(&from, this);
const WavelengthRouter_MediaChannels* source =
::google::protobuf::internal::DynamicCastToGenerated<const WavelengthRouter_MediaChannels>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels)
MergeFrom(*source);
}
}
void WavelengthRouter_MediaChannels::MergeFrom(const WavelengthRouter_MediaChannels& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
channel_.MergeFrom(from.channel_);
}
void WavelengthRouter_MediaChannels::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void WavelengthRouter_MediaChannels::CopyFrom(const WavelengthRouter_MediaChannels& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool WavelengthRouter_MediaChannels::IsInitialized() const {
return true;
}
void WavelengthRouter_MediaChannels::Swap(WavelengthRouter_MediaChannels* other) {
if (other == this) return;
InternalSwap(other);
}
void WavelengthRouter_MediaChannels::InternalSwap(WavelengthRouter_MediaChannels* other) {
using std::swap;
channel_.InternalSwap(&other->channel_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata WavelengthRouter_MediaChannels::GetMetadata() const {
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void WavelengthRouter::InitAsDefaultInstance() {
::openconfig::openconfig_wavelength_router::_WavelengthRouter_default_instance_._instance.get_mutable()->media_channels_ = const_cast< ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels*>(
::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels::internal_default_instance());
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int WavelengthRouter::kMediaChannelsFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
WavelengthRouter::WavelengthRouter()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter();
}
SharedCtor();
// @@protoc_insertion_point(constructor:openconfig.openconfig_wavelength_router.WavelengthRouter)
}
WavelengthRouter::WavelengthRouter(const WavelengthRouter& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
if (from.has_media_channels()) {
media_channels_ = new ::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels(*from.media_channels_);
} else {
media_channels_ = NULL;
}
// @@protoc_insertion_point(copy_constructor:openconfig.openconfig_wavelength_router.WavelengthRouter)
}
void WavelengthRouter::SharedCtor() {
media_channels_ = NULL;
_cached_size_ = 0;
}
WavelengthRouter::~WavelengthRouter() {
// @@protoc_insertion_point(destructor:openconfig.openconfig_wavelength_router.WavelengthRouter)
SharedDtor();
}
void WavelengthRouter::SharedDtor() {
if (this != internal_default_instance()) delete media_channels_;
}
void WavelengthRouter::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* WavelengthRouter::descriptor() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const WavelengthRouter& WavelengthRouter::default_instance() {
::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::InitDefaultsWavelengthRouter();
return *internal_default_instance();
}
WavelengthRouter* WavelengthRouter::New(::google::protobuf::Arena* arena) const {
WavelengthRouter* n = new WavelengthRouter;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void WavelengthRouter::Clear() {
// @@protoc_insertion_point(message_clear_start:openconfig.openconfig_wavelength_router.WavelengthRouter)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
if (GetArenaNoVirtual() == NULL && media_channels_ != NULL) {
delete media_channels_;
}
media_channels_ = NULL;
_internal_metadata_.Clear();
}
bool WavelengthRouter::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:openconfig.openconfig_wavelength_router.WavelengthRouter)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(1020057138u);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels media_channels = 127507142 [(.yext.schemapath) = "/wavelength-router/media-channels"];
case 127507142: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(50u /* 1020057138 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessage(
input, mutable_media_channels()));
} else {
goto handle_unusual;
}
break;
}
default: {
handle_unusual:
if (tag == 0) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, _internal_metadata_.mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:openconfig.openconfig_wavelength_router.WavelengthRouter)
return true;
failure:
// @@protoc_insertion_point(parse_failure:openconfig.openconfig_wavelength_router.WavelengthRouter)
return false;
#undef DO_
}
void WavelengthRouter::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:openconfig.openconfig_wavelength_router.WavelengthRouter)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels media_channels = 127507142 [(.yext.schemapath) = "/wavelength-router/media-channels"];
if (this->has_media_channels()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
127507142, *this->media_channels_, output);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), output);
}
// @@protoc_insertion_point(serialize_end:openconfig.openconfig_wavelength_router.WavelengthRouter)
}
::google::protobuf::uint8* WavelengthRouter::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:openconfig.openconfig_wavelength_router.WavelengthRouter)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels media_channels = 127507142 [(.yext.schemapath) = "/wavelength-router/media-channels"];
if (this->has_media_channels()) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
127507142, *this->media_channels_, deterministic, target);
}
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()), target);
}
// @@protoc_insertion_point(serialize_to_array_end:openconfig.openconfig_wavelength_router.WavelengthRouter)
return target;
}
size_t WavelengthRouter::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:openconfig.openconfig_wavelength_router.WavelengthRouter)
size_t total_size = 0;
if ((_internal_metadata_.have_unknown_fields() && ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
(::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()));
}
// .openconfig.openconfig_wavelength_router.WavelengthRouter.MediaChannels media_channels = 127507142 [(.yext.schemapath) = "/wavelength-router/media-channels"];
if (this->has_media_channels()) {
total_size += 5 +
::google::protobuf::internal::WireFormatLite::MessageSize(
*this->media_channels_);
}
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 WavelengthRouter::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter)
GOOGLE_DCHECK_NE(&from, this);
const WavelengthRouter* source =
::google::protobuf::internal::DynamicCastToGenerated<const WavelengthRouter>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:openconfig.openconfig_wavelength_router.WavelengthRouter)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:openconfig.openconfig_wavelength_router.WavelengthRouter)
MergeFrom(*source);
}
}
void WavelengthRouter::MergeFrom(const WavelengthRouter& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.has_media_channels()) {
mutable_media_channels()->::openconfig::openconfig_wavelength_router::WavelengthRouter_MediaChannels::MergeFrom(from.media_channels());
}
}
void WavelengthRouter::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void WavelengthRouter::CopyFrom(const WavelengthRouter& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:openconfig.openconfig_wavelength_router.WavelengthRouter)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool WavelengthRouter::IsInitialized() const {
return true;
}
void WavelengthRouter::Swap(WavelengthRouter* other) {
if (other == this) return;
InternalSwap(other);
}
void WavelengthRouter::InternalSwap(WavelengthRouter* other) {
using std::swap;
swap(media_channels_, other->media_channels_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata WavelengthRouter::GetMetadata() const {
protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_openconfig_2fopenconfig_5fwavelength_5frouter_2fopenconfig_5fwavelength_5frouter_2eproto::file_level_metadata[kIndexInFileMessages];
}
// @@protoc_insertion_point(namespace_scope)
} // namespace openconfig_wavelength_router
} // namespace openconfig
// @@protoc_insertion_point(global_scope)
| 52.042776 | 293 | 0.786437 | seilis |
17e86449354fcb0a386d2f97f00e77aaea52d18a | 9,311 | cxx | C++ | qaengine/src/ProjectTree.cxx | kit-transue/software-emancipation-discover | bec6f4ef404d72f361d91de954eae9a3bd669ce3 | [
"BSD-2-Clause"
] | 2 | 2015-11-24T03:31:12.000Z | 2015-11-24T16:01:57.000Z | qaengine/src/ProjectTree.cxx | radtek/software-emancipation-discover | bec6f4ef404d72f361d91de954eae9a3bd669ce3 | [
"BSD-2-Clause"
] | null | null | null | qaengine/src/ProjectTree.cxx | radtek/software-emancipation-discover | bec6f4ef404d72f361d91de954eae9a3bd669ce3 | [
"BSD-2-Clause"
] | 1 | 2019-05-19T02:26:08.000Z | 2019-05-19T02:26:08.000Z | /*************************************************************************
* Copyright (c) 2015, Synopsys, Inc. *
* 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. *
* *
* 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. *
*************************************************************************/
// ProjectTree.cpp: implementation of the ProjectTree class.
//
//////////////////////////////////////////////////////////////////////
#include "ProjectTree.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
ProjectTree::ProjectTree()
{
}
ProjectTree::~ProjectTree()
{
}
XMLTreeNode* ProjectTree::newTagNode(string tag) {
return new ProjectTreeNode(TagNode,tag);
}
XMLTreeNode* ProjectTree::newTextNode(string text) {
return new ProjectTreeNode(TextNode,text);
}
PropertiesMap* ProjectTree::getNodeProperties(string item, string queryId) {
string subproj = "";
PropertiesMap* properties = new PropertiesMap();
// Parsing the given project or file name to find the deepest
// project tree node which contains query parameters for this
// project or module
ProjectTreeNode* p = (ProjectTreeNode*)m_Root;
for(int i = 0; i<=item.length();i++) {
if(item[i]=='/' || item[i]=='\\' || i==item.length()) {
if(subproj.length()>0) {
ProjectTreeNode* n = (ProjectTreeNode*)p->getFirstChild();
while(n) {
if(n->getName()==subproj&&n->getAttributeValue("QueryId")=="") {
p=n;
break;
}
n=(ProjectTreeNode*)n->getNextSibling();
}
if(n==NULL) break;
}
subproj="";
continue;
}
subproj+=item[i];
}
// Going up the project tree collecting redefined properties on each
// level. Important! The upper level propery re-definition does not
// owerrride the lower level property definition.
do {
ProjectTreeNode* n = (ProjectTreeNode*)p->getFirstChild();
while(n) {
if(n->getAttributeValue("QueryId")==queryId) {
PropertiesMap* map = n->getAttributesMap();
PropertiesMap::iterator j = map->begin();
while(j!=map->end()) {
if((j->first!="QueryId") &&
(properties->find(j->first)==properties->end())) {
(*properties)[j->first] = j->second;
}
j++;
}
}
n=(ProjectTreeNode *)n->getNextSibling();
}
p = (ProjectTreeNode *)p->getParent();
} while(p!=NULL);
// All properties which are not defined in the project tree will
// be taken from the root as a default properties.
fillDefaultProperties(properties);
return properties;
}
PropertiesMap* ProjectTree::getFolderProperties(string item, string queryId) {
string subproj = "";
PropertiesMap* properties = new PropertiesMap();
// Parsing the given project or file name to find the deepest
// project tree node which contains query parameters for this
// project or module
ProjectTreeNode* p = (ProjectTreeNode*)m_Root;
for(int i = 0; i<=item.length();i++) {
if(item[i]=='/' || item[i]=='\\' || i==item.length()) {
if(subproj.length()>0) {
ProjectTreeNode* n = (ProjectTreeNode*)p->getFirstChild();
while(n) {
if(n->getName()==subproj&&n->getAttributeValue("FolderId")=="") {
p=n;
break;
}
n=(ProjectTreeNode*)n->getNextSibling();
}
if(n==NULL) break;
}
subproj="";
continue;
}
subproj+=item[i];
}
// Going up the project tree collecting redefined properties on each
// level. Important! The upper level propery re-definition does not
// owerrride the lower level property definition.
do {
ProjectTreeNode* n = (ProjectTreeNode*)p->getFirstChild();
while(n) {
if(n->getAttributeValue("FolderId")==queryId) {
PropertiesMap* map = n->getAttributesMap();
PropertiesMap::iterator j = map->begin();
while(j!=map->end()) {
if((j->first!="FolderId") &&
(properties->find(j->first)==properties->end())) {
string first = j->first;
string second = j->second;
(*properties)[j->first] = j->second;
}
j++;
}
}
n=(ProjectTreeNode *)n->getNextSibling();
}
p = (ProjectTreeNode *)p->getParent();
} while(p!=NULL);
// All properties which are not defined in the project tree will
// be taken from the root as a default properties.
fillDefaultProperties(properties);
return properties;
}
void ProjectTree::setNodeProperty(string query,string item,string key,string value) {
string subproj = "";
// Parsing the given project or file name to find the deepest
// project tree node which contains query parameters for this
// project or module
ProjectTreeNode* p = (ProjectTreeNode*)m_Root;
for(int i = 0; i<=item.length();i++) {
if(item[i]=='/' || item[i]=='\\' || i==item.length()) {
if(subproj.length()>0) {
ProjectTreeNode* n = (ProjectTreeNode*)p->getFirstChild();
while(n) {
if(n->getName()==subproj) {
p=n;
break;
}
n=(ProjectTreeNode*)n->getNextSibling();
}
if(n==NULL) {
// I will add code to check if our current key value
// is equal to the key value I am adding
ProjectTreeNode* newProj = new ProjectTreeNode(TagNode,subproj);
addChildLast(p,newProj);
p = newProj;
}
}
subproj="";
continue;
}
subproj+=item[i];
}
// Now p contains the pointer to the project or module
// to which we are adding the property;
ProjectTreeNode* n = (ProjectTreeNode*)p->getFirstChild();
while(n) {
if(n->getAttributeValue("QueryId")==query) {
n->setAttributeValue(key,value);
break;
}
n=(ProjectTreeNode *)n->getNextSibling();
}
if(n==NULL) {
ProjectTreeNode* queryRecord = new ProjectTreeNode(TagNode,"Query");
queryRecord->setAttributeValue(key,value);
queryRecord->setAttributeValue("QueryId",query);
queryRecord->setParent(p);
queryRecord->setNextSibling(p->getFirstChild());
p->setFirstChild(queryRecord);
}
}
void ProjectTree::setFolderProperty(string folder,string item,string key,string value) {
string subproj = "";
// Parsing the given project or file name to find the deepest
// project tree node which contains query parameters for this
// project or module
ProjectTreeNode* p = (ProjectTreeNode*)m_Root;
for(int i = 0; i<=item.length();i++) {
if(item[i]=='/' || item[i]=='\\' || i==item.length()) {
if(subproj.length()>0) {
ProjectTreeNode* n = (ProjectTreeNode*)p->getFirstChild();
while(n) {
if(n->getName()==subproj) {
p=n;
break;
}
n=(ProjectTreeNode*)n->getNextSibling();
}
if(n==NULL) {
// I will add code to check if our current key value
// is equal to the key value I am adding
ProjectTreeNode* newProj = new ProjectTreeNode(TagNode,subproj);
addChildLast(p,newProj);
p = newProj;
}
}
subproj="";
continue;
}
subproj+=item[i];
}
// Now p contains the pointer to the project or module
// to which we are adding the property;
ProjectTreeNode* n = (ProjectTreeNode*)p->getFirstChild();
while(n) {
if(n->getAttributeValue("FolderId")==folder) {
n->setAttributeValue(key,value);
break;
}
n=(ProjectTreeNode *)n->getNextSibling();
}
if(n==NULL) {
ProjectTreeNode* queryRecord = new ProjectTreeNode(TagNode,"Folder");
queryRecord->setAttributeValue(key,value);
queryRecord->setAttributeValue("FolderId",folder);
queryRecord->setParent(p);
queryRecord->setNextSibling(p->getFirstChild());
p->setFirstChild(queryRecord);
}
}
void ProjectTree::fillDefaultProperties(PropertiesMap *properties) {
}
| 32.785211 | 88 | 0.607776 | kit-transue |
17e9218806206e6aae538c12fca64896cedcb8cc | 9,288 | cpp | C++ | spin/spin.cpp | bradgrantham/viz | 8f15e80f6834e931be75552f9b68df26be032785 | [
"Apache-2.0"
] | 1 | 2020-04-01T12:55:07.000Z | 2020-04-01T12:55:07.000Z | spin/spin.cpp | bradgrantham/viz | 8f15e80f6834e931be75552f9b68df26be032785 | [
"Apache-2.0"
] | null | null | null | spin/spin.cpp | bradgrantham/viz | 8f15e80f6834e931be75552f9b68df26be032785 | [
"Apache-2.0"
] | 1 | 2019-10-11T23:55:42.000Z | 2019-10-11T23:55:42.000Z | //
// Copyright 2013-2014, Bradley A. Grantham
//
// 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 <cstdio>
#include <cstdlib>
#include <string>
#include <map>
#include <limits>
#include <algorithm>
#include <vector>
#include <unistd.h>
#include <chrono>
#define GLFW_INCLUDE_GLCOREARB
#include <GLFW/glfw3.h>
#include "vectormath.h"
#include "geometry.h"
#include "manipulator.h"
#include "drawable.h"
#include "loader.h"
using namespace std;
//------------------------------------------------------------------------
static bool gDrawWireframe = false;
static bool gStreamFrames = false;
static int gWindowWidth;
static int gWindowHeight;
static double gMotionReported = false;
static double gOldMouseX, gOldMouseY;
// XXX Allow these to be set by options
bool gVerbose = false;
// XXX Controller needs ability to set camera projection...
const float gFOV = 45; // XXX XXX also gFOV in DefaultController...
NodePtr gSceneRoot;
ControllerPtr gSceneController;
bool ExactlyEqual(const mat4f&m1, const mat4f&m2)
{
for(int i = 0; i < 16; i++)
if(m1[i] != m2[i])
return false;
return true;
}
void DrawScene(float now)
{
float nearClip, farClip;
/* XXX - need to create new box from all subordinate boxes */
nearClip = .1 ; // XXX - gSceneManip->m_translation[2] - gSceneManip->m_reference_size;
farClip = 1000 ; // XXX - gSceneManip->m_translation[2] + gSceneManip->m_reference_size;
// nearClip = std::max(nearClip, 0.1 * gSceneManip->m_reference_size);
// farClip = std::min(farClip, 2 * gSceneManip->m_reference_size);
// XXX Calculation of frustum matrix will move into a Node subclass
float frustumLeft, frustumRight, frustumBottom, frustumTop;
frustumTop = tanf(gFOV / 180.0 * 3.14159 / 2) * nearClip;
frustumBottom = -frustumTop;
frustumRight = frustumTop * gWindowWidth / gWindowHeight;
frustumLeft = -frustumRight;
mat4f tmp_projection = mat4f::frustum(frustumLeft, frustumRight, frustumBottom, frustumTop, nearClip, farClip);
Light light(vec4f(.577, .577, .577, 0), vec4f(1, 1, 1, 1));
vector<Light> lights;
lights.push_back(light);
Environment env(tmp_projection, mat4f::identity, lights);
DisplayList displaylist;
gSceneRoot->Visit(env, displaylist);
mat4f projection;
mat4f modelview;
bool loadMatrices = true;
GLuint program = 0;
for(auto it : displaylist) {
DisplayInfo displayinfo = it.first;
vector<DrawablePtr>& drawables = it.second;
EnvironmentUniforms& envu = displayinfo.envu;
if(program != displayinfo.program) {
glUseProgram(displayinfo.program);
loadMatrices = true;
// XXX Should be loaded from environment
glUniform4fv(envu.lightPosition, 1, lights[0].position.m_v);
glUniform4fv(envu.lightColor, 1, lights[0].color.m_v);
CheckOpenGL(__FILE__, __LINE__);
program = displayinfo.program;
}
if(loadMatrices || !ExactlyEqual(modelview, displayinfo.modelview)) {
mat4f modelview_normal = displayinfo.modelview;
// XXX might not invert every time
// XXX parallel normal matrix math path?
modelview_normal.transpose();
modelview_normal.invert();
glUniformMatrix4fv(envu.modelview, 1, GL_FALSE, displayinfo.modelview.m_v);
glUniformMatrix4fv(envu.modelviewNormal, 1, GL_FALSE, modelview_normal.m_v);
modelview = displayinfo.modelview;
}
if(loadMatrices || !ExactlyEqual(projection, displayinfo.projection)) {
glUniformMatrix4fv(envu.projection, 1, GL_FALSE, displayinfo.projection.m_v);
projection = displayinfo.projection;
}
loadMatrices = false;
for(auto drawable : drawables) {
drawable->Draw(now, gDrawWireframe);
}
}
}
void InitializeGL()
{
CheckOpenGL(__FILE__, __LINE__);
glClearColor(.25, .25, .25, 0);
glEnable(GL_DEPTH_TEST);
// glEnable(GL_CULL_FACE);
glDisable(GL_CULL_FACE);
CheckOpenGL(__FILE__, __LINE__);
}
void TeardownGL()
{
}
static void InitializeScene(NodePtr& gSceneRoot)
{
}
static void ErrorCallback(int error, const char* description)
{
fprintf(stderr, "GLFW: %s\n", description);
}
static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
{
if(action == GLFW_PRESS) {
switch(key) {
case 'W':
gDrawWireframe = !gDrawWireframe;
break;
default:
bool quit = gSceneController->Key(key, scancode, action, mods);
if(quit)
glfwSetWindowShouldClose(window, GL_TRUE);
break;
}
}
}
static void ResizeCallback(GLFWwindow *window, int x, int y)
{
glfwGetFramebufferSize(window, &gWindowWidth, &gWindowHeight);
glViewport(0, 0, gWindowWidth, gWindowHeight);
gSceneController->Resize(gWindowWidth, gWindowHeight);
}
static void ButtonCallback(GLFWwindow *window, int b, int action, int mods)
{
double x, y;
glfwGetCursorPos(window, &x, &y);
gOldMouseX = x;
gOldMouseY = y;
bool quit = gSceneController->Button(b, action, mods, x, y);
if(quit)
glfwSetWindowShouldClose(window, GL_TRUE);
}
static void MotionCallback(GLFWwindow *window, double x, double y)
{
// glfw/glfw#103
// If no motion has been reported yet, we catch the first motion
// reported and store the current location
if(!gMotionReported) {
gMotionReported = true;
gOldMouseX = x;
gOldMouseY = y;
}
double dx, dy;
dx = x - gOldMouseX;
dy = y - gOldMouseY;
gOldMouseX = x;
gOldMouseY = y;
bool quit = gSceneController->Motion(dx, dy);
if(quit)
glfwSetWindowShouldClose(window, GL_TRUE);
}
static void ScrollCallback(GLFWwindow *window, double dx, double dy)
{
bool quit = gSceneController->Scroll(dx, dy);
if(quit)
glfwSetWindowShouldClose(window, GL_TRUE);
}
GroupPtr gSceneGroup;
chrono::time_point<chrono::system_clock> gSceneStartTime;
chrono::time_point<chrono::system_clock> gScenePreviousTime;
static void DrawFrame(GLFWwindow *window)
{
CheckOpenGL(__FILE__, __LINE__);
chrono::time_point<chrono::system_clock> now =
chrono::system_clock::now();
chrono::duration<float> elapsed_seconds = now - gSceneStartTime;
float elapsed = elapsed_seconds.count();
gSceneController->Update(elapsed);
gScenePreviousTime = now;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
CheckOpenGL(__FILE__, __LINE__);
DrawScene(elapsed);
CheckOpenGL(__FILE__, __LINE__);
}
int main(int argc, char **argv)
{
const char *progname = argv[0];
if(argc < 2) {
fprintf(stderr, "usage: %s filename # e.g. \"%s 64gon.builtin\"\n", progname, progname);
exit(EXIT_FAILURE);
}
const char *scene_filename = argv[1];
GLFWwindow* window;
glfwSetErrorCallback(ErrorCallback);
if(!glfwInit())
exit(EXIT_FAILURE);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_SAMPLES, 4);
window = glfwCreateWindow(gWindowWidth = 512, gWindowHeight = 512, "Spin", NULL, NULL);
if (!window) {
glfwTerminate();
fprintf(stdout, "Couldn't open main window\n");
exit(EXIT_FAILURE);
}
glfwMakeContextCurrent(window);
InitializeGL();
bool success;
tie(success, gSceneRoot, gSceneController) = LoadScene(scene_filename);
if(!success) {
fprintf(stderr, "couldn't load scene from %s\n", scene_filename);
exit(EXIT_FAILURE);
}
InitializeScene(gSceneRoot);
if(gVerbose) {
printf("GL_RENDERER: %s\n", glGetString(GL_RENDERER));
printf("GL_VERSION: %s\n", glGetString(GL_VERSION));
}
gSceneController->Resize(gWindowWidth, gWindowHeight);
glfwSetKeyCallback(window, KeyCallback);
glfwSetMouseButtonCallback(window, ButtonCallback);
glfwSetCursorPosCallback(window, MotionCallback);
glfwSetScrollCallback(window, ScrollCallback);
glfwSetFramebufferSizeCallback(window, ResizeCallback);
glfwSetWindowRefreshCallback(window, DrawFrame);
gSceneStartTime = gScenePreviousTime = chrono::system_clock::now();
while (!glfwWindowShouldClose(window)) {
DrawFrame(window);
glfwSwapBuffers(window);
if(gStreamFrames)
glfwPollEvents();
else
glfwWaitEvents();
}
glfwTerminate();
}
| 28.317073 | 115 | 0.668174 | bradgrantham |
17ea0e717783a3bac97ac5a3d2659a1a71150428 | 16,003 | cpp | C++ | mozilla/gfx/layers/opengl/GrallocTextureHost.cpp | naver/webgraphics | 4f9b9aa6a13428b5872dd020eaf34ec77b33f240 | [
"MS-PL"
] | 5 | 2016-12-20T15:48:05.000Z | 2020-05-01T20:12:09.000Z | mozilla/gfx/layers/opengl/GrallocTextureHost.cpp | naver/webgraphics | 4f9b9aa6a13428b5872dd020eaf34ec77b33f240 | [
"MS-PL"
] | null | null | null | mozilla/gfx/layers/opengl/GrallocTextureHost.cpp | naver/webgraphics | 4f9b9aa6a13428b5872dd020eaf34ec77b33f240 | [
"MS-PL"
] | 2 | 2016-12-20T15:48:13.000Z | 2019-12-10T15:15:05.000Z | /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// * This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "base/process.h"
#include "GLContext.h"
#include "gfx2DGlue.h"
#include <ui/GraphicBuffer.h>
#include "GrallocImages.h" // for GrallocImage
#include "GLLibraryEGL.h" // for GLLibraryEGL
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/DataSurfaceHelpers.h"
#include "mozilla/layers/GrallocTextureHost.h"
#include "mozilla/layers/SharedBufferManagerParent.h"
#include "EGLImageHelpers.h"
#include "GLReadTexImageHelper.h"
namespace mozilla {
namespace layers {
using namespace android;
using namespace mozilla::gl;
static gfx::SurfaceFormat
SurfaceFormatForAndroidPixelFormat(android::PixelFormat aFormat,
TextureFlags aFlags)
{
bool swapRB = bool(aFlags & TextureFlags::RB_SWAPPED);
switch (aFormat) {
case android::PIXEL_FORMAT_BGRA_8888:
return swapRB ? gfx::SurfaceFormat::R8G8B8A8 : gfx::SurfaceFormat::B8G8R8A8;
case android::PIXEL_FORMAT_RGBA_8888:
return swapRB ? gfx::SurfaceFormat::B8G8R8A8 : gfx::SurfaceFormat::R8G8B8A8;
case android::PIXEL_FORMAT_RGBX_8888:
return swapRB ? gfx::SurfaceFormat::B8G8R8X8 : gfx::SurfaceFormat::R8G8B8X8;
case android::PIXEL_FORMAT_RGB_565:
return gfx::SurfaceFormat::R5G6B5_UINT16;
case HAL_PIXEL_FORMAT_YCbCr_422_SP:
case HAL_PIXEL_FORMAT_YCrCb_420_SP:
case HAL_PIXEL_FORMAT_YCbCr_422_I:
case GrallocImage::HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
case GrallocImage::HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
case HAL_PIXEL_FORMAT_YV12:
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
#endif
return gfx::SurfaceFormat::R8G8B8A8; // yup, use SurfaceFormat::R8G8B8A8 even though it's a YUV texture. This is an external texture.
default:
if (aFormat >= 0x100 && aFormat <= 0x1FF) {
// Reserved range for HAL specific formats.
return gfx::SurfaceFormat::R8G8B8A8;
} else {
// This is not super-unreachable, there's a bunch of hypothetical pixel
// formats we don't deal with.
// We only want to abort in debug builds here, since if we crash here
// we'll take down the compositor process and thus the phone. This seems
// like undesirable behaviour. We'd rather have a subtle artifact.
printf_stderr(" xxxxx unknow android format %i\n", (int)aFormat);
MOZ_ASSERT(false, "Unknown Android pixel format.");
return gfx::SurfaceFormat::UNKNOWN;
}
}
}
static GLenum
TextureTargetForAndroidPixelFormat(android::PixelFormat aFormat)
{
switch (aFormat) {
case HAL_PIXEL_FORMAT_YCbCr_422_SP:
case HAL_PIXEL_FORMAT_YCrCb_420_SP:
case HAL_PIXEL_FORMAT_YCbCr_422_I:
case GrallocImage::HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
case GrallocImage::HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
case HAL_PIXEL_FORMAT_YV12:
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
#endif
return LOCAL_GL_TEXTURE_EXTERNAL;
case android::PIXEL_FORMAT_BGRA_8888:
case android::PIXEL_FORMAT_RGBA_8888:
case android::PIXEL_FORMAT_RGBX_8888:
case android::PIXEL_FORMAT_RGB_565:
return LOCAL_GL_TEXTURE_2D;
default:
if (aFormat >= 0x100 && aFormat <= 0x1FF) {
// Reserved range for HAL specific formats.
return LOCAL_GL_TEXTURE_EXTERNAL;
} else {
// This is not super-unreachable, there's a bunch of hypothetical pixel
// formats we don't deal with.
// We only want to abort in debug builds here, since if we crash here
// we'll take down the compositor process and thus the phone. This seems
// like undesirable behaviour. We'd rather have a subtle artifact.
MOZ_ASSERT(false, "Unknown Android pixel format.");
return LOCAL_GL_TEXTURE_EXTERNAL;
}
}
}
GrallocTextureHostOGL::GrallocTextureHostOGL(TextureFlags aFlags,
const SurfaceDescriptorGralloc& aDescriptor)
: TextureHost(aFlags)
, mGrallocHandle(aDescriptor)
, mSize(0, 0)
, mCropSize(0, 0)
, mFormat(gfx::SurfaceFormat::UNKNOWN)
, mEGLImage(EGL_NO_IMAGE)
, mIsOpaque(aDescriptor.isOpaque())
{
android::GraphicBuffer* graphicBuffer = GetGraphicBufferFromDesc(mGrallocHandle).get();
MOZ_ASSERT(graphicBuffer);
if (graphicBuffer) {
mFormat =
SurfaceFormatForAndroidPixelFormat(graphicBuffer->getPixelFormat(),
aFlags & TextureFlags::RB_SWAPPED);
mSize = gfx::IntSize(graphicBuffer->getWidth(), graphicBuffer->getHeight());
mCropSize = mSize;
} else {
printf_stderr("gralloc buffer is nullptr\n");
}
}
GrallocTextureHostOGL::~GrallocTextureHostOGL()
{
DestroyEGLImage();
}
void
GrallocTextureHostOGL::SetCompositor(Compositor* aCompositor)
{
MOZ_ASSERT(aCompositor);
mCompositor = static_cast<CompositorOGL*>(aCompositor);
if (mGLTextureSource) {
mGLTextureSource->SetCompositor(mCompositor);
}
if (mCompositor && aCompositor != mCompositor) {
DestroyEGLImage();
}
}
bool
GrallocTextureHostOGL::Lock()
{
return IsValid();
}
void
GrallocTextureHostOGL::Unlock()
{
// Unlock is done internally by binding the texture to another gralloc buffer
}
bool
GrallocTextureHostOGL::IsValid() const
{
android::GraphicBuffer* graphicBuffer = GetGraphicBufferFromDesc(mGrallocHandle).get();
return graphicBuffer != nullptr;
}
gfx::SurfaceFormat
GrallocTextureHostOGL::GetFormat() const
{
return mFormat;
}
void
GrallocTextureHostOGL::DeallocateSharedData()
{
if (mGLTextureSource) {
mGLTextureSource = nullptr;
}
DestroyEGLImage();
if (mGrallocHandle.buffer().type() != MaybeMagicGrallocBufferHandle::Tnull_t) {
MaybeMagicGrallocBufferHandle handle = mGrallocHandle.buffer();
base::ProcessId owner;
if (handle.type() == MaybeMagicGrallocBufferHandle::TGrallocBufferRef) {
owner = handle.get_GrallocBufferRef().mOwner;
}
else {
owner = handle.get_MagicGrallocBufferHandle().mRef.mOwner;
}
SharedBufferManagerParent::DropGrallocBuffer(owner, mGrallocHandle);
}
}
void
GrallocTextureHostOGL::ForgetSharedData()
{
if (mGLTextureSource) {
mGLTextureSource = nullptr;
}
}
void
GrallocTextureHostOGL::DeallocateDeviceData()
{
if (mGLTextureSource) {
mGLTextureSource = nullptr;
}
DestroyEGLImage();
}
LayerRenderState
GrallocTextureHostOGL::GetRenderState()
{
android::GraphicBuffer* graphicBuffer = GetGraphicBufferFromDesc(mGrallocHandle).get();
if (graphicBuffer) {
LayerRenderStateFlags flags = LayerRenderStateFlags::LAYER_RENDER_STATE_DEFAULT;
if (mIsOpaque) {
flags |= LayerRenderStateFlags::OPAQUE;
}
if (mFlags & TextureFlags::ORIGIN_BOTTOM_LEFT) {
flags |= LayerRenderStateFlags::ORIGIN_BOTTOM_LEFT;
}
if (mFlags & TextureFlags::RB_SWAPPED) {
flags |= LayerRenderStateFlags::FORMAT_RB_SWAP;
}
return LayerRenderState(graphicBuffer,
mCropSize,
flags,
this);
}
return LayerRenderState();
}
already_AddRefed<gfx::DataSourceSurface>
GrallocTextureHostOGL::GetAsSurface() {
android::GraphicBuffer* graphicBuffer = GetGraphicBufferFromDesc(mGrallocHandle).get();
if (!graphicBuffer) {
return nullptr;
}
uint8_t* grallocData;
int32_t rv = graphicBuffer->lock(GRALLOC_USAGE_SW_READ_OFTEN, reinterpret_cast<void**>(&grallocData));
if (rv) {
return nullptr;
}
RefPtr<gfx::DataSourceSurface> grallocTempSurf =
gfx::Factory::CreateWrappingDataSourceSurface(grallocData,
graphicBuffer->getStride() * android::bytesPerPixel(graphicBuffer->getPixelFormat()),
GetSize(), GetFormat());
if (!grallocTempSurf) {
graphicBuffer->unlock();
return nullptr;
}
RefPtr<gfx::DataSourceSurface> surf = CreateDataSourceSurfaceByCloning(grallocTempSurf);
graphicBuffer->unlock();
return surf.forget();
}
void
GrallocTextureHostOGL::UnbindTextureSource()
{
// Clear the reference to the TextureSource (if any), because we know that
// another TextureHost is being bound to the TextureSource. This means that
// we will have to re-do gl->fEGLImageTargetTexture2D next time we go through
// BindTextureSource (otherwise we would have skipped it).
// Note that this doesn't "unlock" the gralloc buffer or force it to be
// detached, Although decreasing the refcount of the TextureSource may lead
// to the gl handle being destroyed, which would unlock the gralloc buffer.
// That said, this method is called before another TextureHost attaches to the
// TextureSource, which has the effect of unlocking the gralloc buffer. So when
// this is called we know we are going to be unlocked soon.
mGLTextureSource = nullptr;
}
GLenum GetTextureTarget(gl::GLContext* aGL, android::PixelFormat aFormat) {
MOZ_ASSERT(aGL);
if (aGL->Renderer() == gl::GLRenderer::SGX530 ||
aGL->Renderer() == gl::GLRenderer::SGX540) {
// SGX has a quirk that only TEXTURE_EXTERNAL works and any other value will
// result in black pixels when trying to draw from bound textures.
// Unfortunately, using TEXTURE_EXTERNAL on Adreno has a terrible effect on
// performance.
// See Bug 950050.
return LOCAL_GL_TEXTURE_EXTERNAL;
} else {
return TextureTargetForAndroidPixelFormat(aFormat);
}
}
void
GrallocTextureHostOGL::DestroyEGLImage()
{
// Only called when we want to get rid of the gralloc buffer, usually
// around the end of life of the TextureHost.
if (mEGLImage != EGL_NO_IMAGE && GetGLContext()) {
EGLImageDestroy(GetGLContext(), mEGLImage);
mEGLImage = EGL_NO_IMAGE;
}
}
void
GrallocTextureHostOGL::PrepareTextureSource(CompositableTextureSourceRef& aTextureSource)
{
// This happens during the layers transaction.
// All of the gralloc magic goes here. The only thing that happens externally
// and that is good to keep in mind is that when the TextureSource is deleted,
// it destroys its gl texture handle which is important for genlock.
// If this TextureHost's mGLTextureSource member is non-null, it means we are
// still bound to the TextureSource, in which case we can skip the driver
// overhead of binding the texture again (fEGLImageTargetTexture2D)
// As a result, if the TextureHost is used with several CompositableHosts,
// it will be bound to only one TextureSource, and we'll do the driver work
// only once, which is great. This means that all of the compositables that
// use this TextureHost will keep a reference to this TextureSource at least
// for the duration of this frame.
// If the compositable already has a TextureSource (the aTextureSource parameter),
// that is compatible and is not in use by several compositable, we try to
// attach to it. This has the effect of unlocking the previous TextureHost that
// we attached to the TextureSource (the previous frame)
// If the TextureSource used by the compositable is also used by other
// compositables (see NumCompositableRefs), we have to create a new TextureSource,
// because otherwise we would be modifying the content of every layer that uses
// the TextureSource in question, even thoug they don't use this TextureHost.
android::GraphicBuffer* graphicBuffer = GetGraphicBufferFromDesc(mGrallocHandle).get();
MOZ_ASSERT(graphicBuffer);
if (!graphicBuffer) {
mGLTextureSource = nullptr;
return;
}
if (mGLTextureSource && !mGLTextureSource->IsValid()) {
mGLTextureSource = nullptr;
}
if (mGLTextureSource) {
// We are already attached to a TextureSource, nothing to do except tell
// the compositable to use it.
aTextureSource = mGLTextureSource.get();
return;
}
gl::GLContext* gl = GetGLContext();
if (!gl || !gl->MakeCurrent()) {
mGLTextureSource = nullptr;
return;
}
if (mEGLImage == EGL_NO_IMAGE) {
gfx::IntSize cropSize(0, 0);
if (mCropSize != mSize) {
cropSize = mCropSize;
}
// Should only happen the first time.
mEGLImage = EGLImageCreateFromNativeBuffer(gl, graphicBuffer->getNativeBuffer(), cropSize);
}
GLenum textureTarget = GetTextureTarget(gl, graphicBuffer->getPixelFormat());
GLTextureSource* glSource = aTextureSource.get() ?
aTextureSource->AsSourceOGL()->AsGLTextureSource() : nullptr;
bool shouldCreateTextureSource = !glSource || !glSource->IsValid()
|| glSource->NumCompositableRefs() > 1
|| glSource->GetTextureTarget() != textureTarget;
if (shouldCreateTextureSource) {
GLuint textureHandle;
gl->fGenTextures(1, &textureHandle);
gl->fBindTexture(textureTarget, textureHandle);
gl->fTexParameteri(textureTarget, LOCAL_GL_TEXTURE_WRAP_T, LOCAL_GL_CLAMP_TO_EDGE);
gl->fTexParameteri(textureTarget, LOCAL_GL_TEXTURE_WRAP_S, LOCAL_GL_CLAMP_TO_EDGE);
gl->fEGLImageTargetTexture2D(textureTarget, mEGLImage);
mGLTextureSource = new GLTextureSource(mCompositor, textureHandle, textureTarget,
mSize, mFormat);
aTextureSource = mGLTextureSource.get();
} else {
gl->fBindTexture(textureTarget, glSource->GetTextureHandle());
gl->fEGLImageTargetTexture2D(textureTarget, mEGLImage);
glSource->SetSize(mSize);
glSource->SetFormat(mFormat);
mGLTextureSource = glSource;
}
}
void
GrallocTextureHostOGL::WaitAcquireFenceHandleSyncComplete()
{
if (!mAcquireFenceHandle.IsValid()) {
return;
}
RefPtr<FenceHandle::FdObj> fence = mAcquireFenceHandle.GetAndResetFdObj();
int fenceFd = fence->GetAndResetFd();
EGLint attribs[] = {
LOCAL_EGL_SYNC_NATIVE_FENCE_FD_ANDROID, fenceFd,
LOCAL_EGL_NONE
};
EGLSync sync = sEGLLibrary.fCreateSync(EGL_DISPLAY(),
LOCAL_EGL_SYNC_NATIVE_FENCE_ANDROID,
attribs);
if (!sync) {
NS_WARNING("failed to create native fence sync");
return;
}
// Wait sync complete with timeout.
// If a source of the fence becomes invalid because of error,
// fene complete is not signaled. See Bug 1061435.
EGLint status = sEGLLibrary.fClientWaitSync(EGL_DISPLAY(),
sync,
0,
400000000 /*400 msec*/);
if (status != LOCAL_EGL_CONDITION_SATISFIED) {
NS_ERROR("failed to wait native fence sync");
}
MOZ_ALWAYS_TRUE( sEGLLibrary.fDestroySync(EGL_DISPLAY(), sync) );
}
void
GrallocTextureHostOGL::SetCropRect(nsIntRect aCropRect)
{
MOZ_ASSERT(aCropRect.TopLeft() == IntPoint(0, 0));
MOZ_ASSERT(!aCropRect.IsEmpty());
MOZ_ASSERT(aCropRect.width <= mSize.width);
MOZ_ASSERT(aCropRect.height <= mSize.height);
gfx::IntSize cropSize(aCropRect.width, aCropRect.height);
if (mCropSize == cropSize) {
return;
}
mCropSize = cropSize;
mGLTextureSource = nullptr;
}
bool
GrallocTextureHostOGL::BindTextureSource(CompositableTextureSourceRef& aTextureSource)
{
// This happens at composition time.
// If mGLTextureSource is null it means PrepareTextureSource failed.
if (!mGLTextureSource) {
return false;
}
// If Prepare didn't fail, we expect our TextureSource to be the same as aTextureSource,
// otherwise it means something has fiddled with the TextureSource between Prepare and
// now.
MOZ_ASSERT(mGLTextureSource == aTextureSource);
aTextureSource = mGLTextureSource.get();
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
// Wait until it's ready.
WaitAcquireFenceHandleSyncComplete();
#endif
return true;
}
} // namepsace layers
} // namepsace mozilla
| 33.976645 | 137 | 0.711679 | naver |
17ee409ea0e51f14852a538d89cfe59cc9a194b1 | 348 | hpp | C++ | include/oxu/framework/threading/pipeline.hpp | oda404/oxu | 5df4755f796be976bed767cd889a2e71ed867f9b | [
"MIT"
] | null | null | null | include/oxu/framework/threading/pipeline.hpp | oda404/oxu | 5df4755f796be976bed767cd889a2e71ed867f9b | [
"MIT"
] | null | null | null | include/oxu/framework/threading/pipeline.hpp | oda404/oxu | 5df4755f796be976bed767cd889a2e71ed867f9b | [
"MIT"
] | null | null | null | #pragma once
#include<mutex>
#include<vector>
#include<oxu/framework/threading/request.hpp>
namespace oxu::framework::threading
{
class Pipeline
{
private:
std::vector<Request> pipeline;
std::mutex mtx;
public:
void makeRequest(Request request);
bool pollRequest(Request &targetRequest);
};
} | 17.4 | 49 | 0.655172 | oda404 |
17ef4969f04e393baccff657a51faa1eb4fe1ff4 | 1,646 | cc | C++ | src/mutex.cc | cjhoward92/lokker | 220977718fe6da4b19b86ae4e27c5547bdf586c8 | [
"MIT"
] | null | null | null | src/mutex.cc | cjhoward92/lokker | 220977718fe6da4b19b86ae4e27c5547bdf586c8 | [
"MIT"
] | null | null | null | src/mutex.cc | cjhoward92/lokker | 220977718fe6da4b19b86ae4e27c5547bdf586c8 | [
"MIT"
] | null | null | null | #include "mutex.h"
namespace Lokker {
LockWorker::LockWorker(Nan::Callback *callback, uv_mutex_t *mutex)
: AsyncWorker(callback) {
_mutex = mutex;
}
LockWorker::~LockWorker() {}
void LockWorker::Execute() {
uv_mutex_lock(_mutex);
}
void LockWorker::HandleOkCallback() {
Nan::HandleScope scope;
v8::Local<v8::Value> argv[2] = {
Nan::Null(),
Nan::Null()
};
callback->Call(2, argv, async_resource);
}
Mutex::Mutex() {
uv_mutex_init(&_mutex);
}
Mutex::~Mutex() {
uv_mutex_destroy(&_mutex);
}
NAN_METHOD(Mutex::New) {
if (!info.IsConstructCall()) {
return Nan::ThrowError("non-constructor invocation not supported");
}
Mutex *mut = new Mutex();
mut->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
NAN_METHOD(Mutex::Lock) {
Nan::Callback *callback = new Nan::Callback(info[0].As<v8::Function>());
Mutex *mut = ObjectWrap::Unwrap<Mutex>(info.Holder());
Nan::AsyncQueueWorker(new LockWorker(callback, &mut->_mutex));
}
NAN_METHOD(Mutex::Unlock) {
Mutex *mut = ObjectWrap::Unwrap<Mutex>(info.Holder());
uv_mutex_unlock(&mut->_mutex);
}
Nan::Persistent<v8::Function> Mutex::constructor;
void Mutex::Init(v8::Local<v8::Object> exports) {
v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
tpl->SetClassName(Nan::New("Mutex").ToLocalChecked());
tpl->InstanceTemplate()->SetInternalFieldCount(1);
SetPrototypeMethod(tpl, "lock", Lock);
SetPrototypeMethod(tpl, "unlock", Unlock);
constructor.Reset(Nan::GetFunction(tpl).ToLocalChecked());
exports->Set(Nan::New("Mutex").ToLocalChecked(),
Nan::GetFunction(tpl).ToLocalChecked());
}
} | 23.855072 | 76 | 0.684083 | cjhoward92 |
17f3a670537114c1e27c87fe7885a03faf04a9ed | 1,420 | cpp | C++ | 2667.cpp | jaemin2682/BAEKJOON_ONLINE_JUDGE | 0d5c6907baee61e1fabdbcd96ea473079a9475ed | [
"MIT"
] | null | null | null | 2667.cpp | jaemin2682/BAEKJOON_ONLINE_JUDGE | 0d5c6907baee61e1fabdbcd96ea473079a9475ed | [
"MIT"
] | null | null | null | 2667.cpp | jaemin2682/BAEKJOON_ONLINE_JUDGE | 0d5c6907baee61e1fabdbcd96ea473079a9475ed | [
"MIT"
] | null | null | null | #include <vector>
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
using namespace std;
int map[26][26];
bool visit[26][26];
int main() {
int n;
vector<pair<int, int>> dxy = { {1,0}, {-1,0}, {0,-1}, {0,1} };
string temp;
vector<string> store;
vector<int> answer;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> temp;
store.push_back(temp);
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
map[i][j] = store[i-1][j-1] - '0';
}
}
int cnt = 0;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
if (map[i][j] && !visit[i][j]) {
int num = 1;
cnt++;
map[i][j] = cnt;
queue<pair<int, int>> q;
q.push({ i,j });
visit[i][j] = true;
while (!q.empty()) {
int dx = q.front().first;
int dy = q.front().second;
q.pop();
for (int k = 0; k < 4; k++) {
int nx = dx + dxy[k].first;
int ny = dy + dxy[k].second;
if (map[nx][ny] && !visit[nx][ny] && nx > 0 && nx <= n && ny > 0 && ny <= n) {
visit[nx][ny] = true;
num++;
map[nx][ny] = cnt;
q.push({ nx, ny });
}
}
}
answer.push_back(num);
}
else visit[i][j] = true;
}
}
sort(answer.begin(), answer.end());
cout << cnt << endl;
for (int i = 0; i < answer.size(); i++) {
cout << answer[i] << endl;
}
return 0;
} | 21.515152 | 85 | 0.442254 | jaemin2682 |
17f4fd2aa42aba2bc2d5e442a303d1bc9d49005b | 7,579 | cpp | C++ | unittests/time/TimeTest.cpp | zavadovsky/stingraykit | 33e6587535325f08769bd8392381d70d4d316410 | [
"0BSD"
] | 24 | 2015-03-04T16:30:03.000Z | 2022-02-04T15:03:42.000Z | unittests/time/TimeTest.cpp | zavadovsky/stingraykit | 33e6587535325f08769bd8392381d70d4d316410 | [
"0BSD"
] | null | null | null | unittests/time/TimeTest.cpp | zavadovsky/stingraykit | 33e6587535325f08769bd8392381d70d4d316410 | [
"0BSD"
] | 7 | 2015-04-08T12:22:58.000Z | 2018-06-14T09:58:45.000Z | #include <gtest/gtest.h>
#include <stingraykit/string/StringUtils.h>
#include <stingraykit/time/Time.h>
using namespace stingray;
TEST(TimeTest, BrokenDownTime)
{
Time now = Time::Now();
{
BrokenDownTime bdt = now.BreakDown(TimeKind::Local);
Time reconstructed = Time::FromBrokenDownTime(bdt, TimeKind::Local);
ASSERT_EQ(now, reconstructed);
}
{
BrokenDownTime bdt = now.BreakDown(TimeKind::Utc);
Time reconstructed = Time::FromBrokenDownTime(bdt, TimeKind::Utc);
ASSERT_EQ(now, reconstructed);
}
}
TEST(TimeTest, TimeZone_FromString)
{
{
const auto timeZone = TimeZone::FromString("-05");
ASSERT_EQ(timeZone.GetMinutesFromUtc(), -300);
}
{
const auto timeZone = TimeZone::FromString("+03");
ASSERT_EQ(timeZone.GetMinutesFromUtc(), 180);
}
{
const auto timeZone = TimeZone::FromString("0400");
ASSERT_EQ(timeZone.GetMinutesFromUtc(), 240);
}
{
const auto timeZone = TimeZone::FromString("+0130");
ASSERT_EQ(timeZone.GetMinutesFromUtc(), 90);
}
{
const auto timeZone = TimeZone::FromString("-02:30");
ASSERT_EQ(timeZone.GetMinutesFromUtc(), -150);
}
}
TEST(TimeTest, FromWindowsFileTime)
{
{
const auto time = Time::FromWindowsFileTime(0);
ASSERT_EQ(time.GetMilliseconds(), -11644473600000);
}
{
const auto time = Time::FromWindowsFileTime(864003654321);
ASSERT_EQ(time.GetMilliseconds(), -11644383545679);
const auto bdt = time.BreakDown(TimeKind::Utc);
ASSERT_EQ(bdt.Year, 1601);
ASSERT_EQ(bdt.Month, 1);
ASSERT_EQ(bdt.MonthDay, 2);
ASSERT_EQ(bdt.Hours, 1);
ASSERT_EQ(bdt.Minutes, 0);
ASSERT_EQ(bdt.Seconds, 55);
ASSERT_EQ(bdt.Milliseconds, -679);
}
}
TEST(TimeTest, MjdDate)
{
#if 0
{
BrokenDownTime bdt = Time::MJDtoEpoch(0).BreakDown(TimeKind::Utc);
ASSERT_EQ(bdt.Year , 1858);
ASSERT_EQ(bdt.Month , 11);
ASSERT_EQ(bdt.MonthDay , 17);
ASSERT_EQ(bdt.Hours , 0);
ASSERT_EQ(bdt.Minutes , 0);
ASSERT_EQ(bdt.Seconds , 0);
ASSERT_EQ(bdt.Milliseconds , 0);
}
#endif
{
BrokenDownTime bdt = Time::MJDtoEpoch(57023).BreakDown(TimeKind::Utc); //2015-01-01
ASSERT_EQ(bdt.Year , 2015);
ASSERT_EQ(bdt.Month , 1);
ASSERT_EQ(bdt.MonthDay , 1);
ASSERT_EQ(bdt.Hours , 0);
ASSERT_EQ(bdt.Minutes , 0);
ASSERT_EQ(bdt.Seconds , 0);
ASSERT_EQ(bdt.Milliseconds , 0);
}
{
BrokenDownTime bdt = Time::MJDtoEpoch(60676).BreakDown(TimeKind::Utc); //2025-01-01
ASSERT_EQ(bdt.Year , 2025);
ASSERT_EQ(bdt.Month , 1);
ASSERT_EQ(bdt.MonthDay , 1);
ASSERT_EQ(bdt.Hours , 0);
ASSERT_EQ(bdt.Minutes , 0);
ASSERT_EQ(bdt.Seconds , 0);
ASSERT_EQ(bdt.Milliseconds , 0);
}
}
TEST(TimeTest, EpochDate)
{
{
BrokenDownTime bdt = Time::FromTimeT(1735689600).BreakDown(TimeKind::Utc); //2025-01-01
ASSERT_EQ(bdt.Year , 2025);
ASSERT_EQ(bdt.Month , 1);
ASSERT_EQ(bdt.MonthDay , 1);
ASSERT_EQ(bdt.Hours , 0);
ASSERT_EQ(bdt.Minutes , 0);
ASSERT_EQ(bdt.Seconds , 0);
ASSERT_EQ(bdt.Milliseconds , 0);
}
{
BrokenDownTime bdt = Time::FromTimeT(1420070400).BreakDown(TimeKind::Utc); //2015-01-01
ASSERT_EQ(bdt.Year , 2015);
ASSERT_EQ(bdt.Month , 1);
ASSERT_EQ(bdt.MonthDay , 1);
ASSERT_EQ(bdt.Hours , 0);
ASSERT_EQ(bdt.Minutes , 0);
ASSERT_EQ(bdt.Seconds , 0);
ASSERT_EQ(bdt.Milliseconds , 0);
}
}
TEST(TimeTest, DISABLED_ToIso8601_Zeroes)
{
const std::string sample = "0000-00-00T00:00:00Z";
const Time testee = TimeUtility::FromIso8601(sample);
const BrokenDownTime brokenDown = testee.BreakDown();
ASSERT_EQ(brokenDown.Year, 0);
ASSERT_EQ(brokenDown.Month, 0);
ASSERT_EQ(brokenDown.MonthDay, 0);
ASSERT_EQ(brokenDown.Hours, 0);
ASSERT_EQ(brokenDown.Minutes, 0);
ASSERT_EQ(brokenDown.Seconds, 0);
ASSERT_EQ(brokenDown.Milliseconds, 0);
}
TEST(TimeTest, ToIso8601_Common)
{
const std::string sample = "2000-09-21T12:45:05Z";
const Time testee = TimeUtility::FromIso8601(sample);
const BrokenDownTime brokenDown = testee.BreakDown();
ASSERT_EQ(brokenDown.Year, 2000);
ASSERT_EQ(brokenDown.Month, 9);
ASSERT_EQ(brokenDown.MonthDay, 21);
ASSERT_EQ(brokenDown.Hours, 12);
ASSERT_EQ(brokenDown.Minutes, 45);
ASSERT_EQ(brokenDown.Seconds, 5);
ASSERT_EQ(brokenDown.Milliseconds, 0);
}
TEST(TimeTest, ToIso8601_Lowercase)
{
const std::string sample = "2000-09-21t12:45:05z";
const Time testee = TimeUtility::FromIso8601(sample);
const BrokenDownTime brokenDown = testee.BreakDown();
ASSERT_EQ(brokenDown.Year, 2000);
ASSERT_EQ(brokenDown.Month, 9);
ASSERT_EQ(brokenDown.MonthDay, 21);
ASSERT_EQ(brokenDown.Hours, 12);
ASSERT_EQ(brokenDown.Minutes, 45);
ASSERT_EQ(brokenDown.Seconds, 5);
ASSERT_EQ(brokenDown.Milliseconds, 0);
}
TEST(TimeTest, ToIso8601_SecondFraction)
{
const std::string sample = "2000-09-21T12:45:05.0Z";
const Time testee = TimeUtility::FromIso8601(sample);
const BrokenDownTime brokenDown = testee.BreakDown();
ASSERT_EQ(brokenDown.Year, 2000);
ASSERT_EQ(brokenDown.Month, 9);
ASSERT_EQ(brokenDown.MonthDay, 21);
ASSERT_EQ(brokenDown.Hours, 12);
ASSERT_EQ(brokenDown.Minutes, 45);
ASSERT_EQ(brokenDown.Seconds, 5);
ASSERT_NEAR(brokenDown.Milliseconds, 0, 5);
}
TEST(TimeTest, Iso8601_SecondFractionDecade)
{
const std::string sample = "2000-09-21T12:45:05.8Z";
const Time testee = TimeUtility::FromIso8601(sample);
BrokenDownTime brokenDown = testee.BreakDown();
ASSERT_EQ(brokenDown.Year, 2000);
ASSERT_EQ(brokenDown.Month, 9);
ASSERT_EQ(brokenDown.MonthDay, 21);
ASSERT_EQ(brokenDown.Hours, 12);
ASSERT_EQ(brokenDown.Minutes, 45);
ASSERT_EQ(brokenDown.Seconds, 5);
ASSERT_NEAR(brokenDown.Milliseconds, 800, 5);
}
TEST(TimeTest, Iso8601_ZeroOffset)
{
const std::string sample = "2000-09-21T12:45:05+00:00";
const Time testee = TimeUtility::FromIso8601(sample);
const BrokenDownTime brokenDown = testee.BreakDown();
ASSERT_EQ(brokenDown.Year, 2000);
ASSERT_EQ(brokenDown.Month, 9);
ASSERT_EQ(brokenDown.MonthDay, 21);
ASSERT_EQ(brokenDown.Hours, 12);
ASSERT_EQ(brokenDown.Minutes, 45);
ASSERT_EQ(brokenDown.Seconds, 5);
ASSERT_EQ(brokenDown.Milliseconds, 0);
}
TEST(TimeTest, ToIso8601_PositiveOffset)
{
const std::string sample = "2000-09-21T12:45:05+13:53";
const Time testee = TimeUtility::FromIso8601(sample);
const BrokenDownTime brokenDown = testee.BreakDown();
ASSERT_EQ(brokenDown.Year, 2000);
ASSERT_EQ(brokenDown.Month, 9);
ASSERT_EQ(brokenDown.MonthDay, 20);
ASSERT_EQ(brokenDown.Hours, 22);
ASSERT_EQ(brokenDown.Minutes, 52);
ASSERT_EQ(brokenDown.Seconds, 5);
ASSERT_EQ(brokenDown.Milliseconds, 0);
}
TEST(TimeTest, ToIso8601_NegativeOffset)
{
const std::string sample = "2000-09-21T12:45:05-13:53";
const Time testee = TimeUtility::FromIso8601(sample);
const BrokenDownTime brokenDown = testee.BreakDown();
ASSERT_EQ(brokenDown.Year, 2000);
ASSERT_EQ(brokenDown.Month, 9);
ASSERT_EQ(brokenDown.MonthDay, 22);
ASSERT_EQ(brokenDown.Hours, 2);
ASSERT_EQ(brokenDown.Minutes, 38);
ASSERT_EQ(brokenDown.Seconds, 5);
ASSERT_EQ(brokenDown.Milliseconds, 0);
}
TEST(TimeTest, ToIso8601_DateOnly)
{
const std::string sample = "2000-09-21";
const Time testee = TimeUtility::FromIso8601(sample);
const BrokenDownTime brokenDown = testee.BreakDown();
ASSERT_EQ(brokenDown.Year, 2000);
ASSERT_EQ(brokenDown.Month, 9);
ASSERT_EQ(brokenDown.MonthDay, 21);
ASSERT_EQ(brokenDown.Hours, 0);
ASSERT_EQ(brokenDown.Minutes, 0);
ASSERT_EQ(brokenDown.Seconds, 0);
ASSERT_EQ(brokenDown.Milliseconds, 0);
}
TEST(TimeTest, ToIso8601_NoT_Failure)
{
const std::string sample = "2000-09-21.12:45:05Z";
ASSERT_ANY_THROW(TimeUtility::FromIso8601(sample));
}
| 27.067857 | 89 | 0.727273 | zavadovsky |
17f51d46015ebf633df199d9b6436d447422e454 | 2,760 | cpp | C++ | firmware/src/ssdp.cpp | chientung/smartplug | 3247b15f4c410f0d9d0c4904277ff428485ebbf0 | [
"MIT"
] | 27 | 2018-08-28T12:37:22.000Z | 2022-03-11T19:39:32.000Z | firmware/src/ssdp.cpp | chientung/smartplug | 3247b15f4c410f0d9d0c4904277ff428485ebbf0 | [
"MIT"
] | 33 | 2018-09-10T07:26:21.000Z | 2022-02-26T17:53:24.000Z | firmware/src/ssdp.cpp | chientung/smartplug | 3247b15f4c410f0d9d0c4904277ff428485ebbf0 | [
"MIT"
] | 4 | 2019-02-01T22:38:52.000Z | 2021-05-09T17:23:57.000Z | /////////////////////////////////////////////////////////////////////////////
/** @file
SSDP
\copyright Copyright (c) 2018 Chris Byrne. All rights reserved.
Licensed under the MIT License. Refer to LICENSE file in the project root. */
/////////////////////////////////////////////////////////////////////////////
#ifndef UNIT_TEST
//- includes
#include "ssdp.h"
#include <ESPAsyncWebServer.h>
/////////////////////////////////////////////////////////////////////////////
/// send response
bool SSDPExt::begin() {
SSDP.setSchemaURL("description.xml");
SSDP.setHTTPPort(80);
SSDP.setDeviceType("upnp:rootdevice");
SSDP.setName("SmartPlug");
SSDP.setSerialNumber("");
SSDP.setURL("/");
SSDP.setModelName("SmartPlug");
SSDP.setModelNumber("SmartPlug");
SSDP.setModelURL("http://www.github.com/adapt0/smartplug");
SSDP.setManufacturer("Manufacturer");
SSDP.setManufacturerURL("http://www.github.com/adapt0/smartplug");
return SSDP.begin();
}
/////////////////////////////////////////////////////////////////////////////
/// send response
void SSDPExt::sendResponse(AsyncWebServerRequest* request) {
auto* evil = reinterpret_cast<const SSDPExt*>(&SSDP);
evil->sendResponse_(request);
}
/// send response
void SSDPExt::sendResponse_(AsyncWebServerRequest* request) const {
// reimplement SSDPClass::schema for use with AsyncWebServerRequest
static const char SSDP_TEMPLATE[] =
"<?xml version=\"1.0\"?>"
"<root xmlns=\"urn:schemas-upnp-org:device-1-0\">"
"<specVersion>"
"<major>1</major>"
"<minor>0</minor>"
"</specVersion>"
"<URLBase>http://%u.%u.%u.%u:%u/</URLBase>" // WiFi.localIP(), _port
"<device>"
"<deviceType>%s</deviceType>"
"<friendlyName>%s</friendlyName>"
"<presentationURL>%s</presentationURL>"
"<serialNumber>%s</serialNumber>"
"<modelName>%s</modelName>"
"<modelNumber>%s</modelNumber>"
"<modelURL>%s</modelURL>"
"<manufacturer>%s</manufacturer>"
"<manufacturerURL>%s</manufacturerURL>"
"<UDN>uuid:%s</UDN>"
"</device>"
"</root>"
;
IPAddress ip = WiFi.localIP();
char buffer[sizeof(SSDP_TEMPLATE) + sizeof(SSDPClass)];
sprintf(buffer, SSDP_TEMPLATE,
ip[0], ip[1], ip[2], ip[3], _port,
_deviceType,
_friendlyName,
_presentationURL,
_serialNumber,
_modelName,
_modelNumber,
_modelURL,
_manufacturer,
_manufacturerURL,
_uuid
);
request->send(200, "text/xml", buffer);
}
#endif // UNIT_TEST
| 32.857143 | 80 | 0.526087 | chientung |
17f97826215f8c8426b976d3bbc54ea26551493d | 2,956 | cpp | C++ | Planet_Order/Planet_Order/main.cpp | NyteCore/Senior_School_Projects | 2a6e9e6bbdfaf62b8282e511bcf84fd9700ad949 | [
"MIT"
] | 2 | 2017-04-17T01:19:11.000Z | 2017-06-28T23:52:48.000Z | Planet_Order/Planet_Order/main.cpp | EdwaRen/Senior_School_Projects | 2a6e9e6bbdfaf62b8282e511bcf84fd9700ad949 | [
"MIT"
] | null | null | null | Planet_Order/Planet_Order/main.cpp | EdwaRen/Senior_School_Projects | 2a6e9e6bbdfaf62b8282e511bcf84fd9700ad949 | [
"MIT"
] | null | null | null | //
// main.cpp
// Planet_Order
//
// Created by - on 2016/12/19.
// Copyright © 2016 Eddie of The Ren. All rights reserved.
//
#include <iostream>
#include <cstring>
#include <cmath>
#include <string>
#include <ctime>
#include <sstream>
using namespace std;
string numPlanets[8];
void initializePlanets() {
numPlanets[0] = "Mercury";
numPlanets[1] = "Venus";
numPlanets[2] = "Earth";
numPlanets[3] = "Mars";
numPlanets[4] = "Jupiter";
numPlanets[5] = "Saturn";
numPlanets[6] = "Uranus";
numPlanets[7] = "Neptune";
}
void insertion_sort (string numPlanets[], int length){
int charPlanets[8];
charPlanets[0] = numPlanets[0].at(0);
charPlanets[1] = numPlanets[1].at(0);
charPlanets[2] = numPlanets[2].at(0);
charPlanets[3] = numPlanets[3].at(0);
charPlanets[4] = numPlanets[4].at(0);
charPlanets[5] = numPlanets[5].at(0);
charPlanets[6] = numPlanets[6].at(0);
charPlanets[7] = numPlanets[7].at(0);
cout << charPlanets[7] << endl;
int current;
string temp;
for (int i = 1; i < length; i++){
current = i;
while ((current > 0) && ( static_cast<int>(numPlanets[current].at(0)) < static_cast<int>(numPlanets[current-1].at(0)))){
temp = numPlanets[current];
numPlanets[current] = numPlanets[current-1];
numPlanets[current-1] = temp;
current--;
}
}
}
int median(double items[], int numItem) {
double median;
if ((numItem%2) == 1) {
median = items[numItem/2];
} else {
median = ((double)(items[(numItem/2)] + items[(numItem/2) -1]))/2.0;
}
//cout << "NumItem: " << numItem << " EvenOdd: " << (numItem/2) << " Nums: " << items[numItem/2] << ":" << items[(numItem/2)-1] << ":"<< items[3] << ":" << items[4]<< endl;
cout << "Median: " << median<<endl;
return median;
}
void insertion(double arr[], int length) {
int current, temp;
for (int i = 1; i < length; i++){
current = i;
while ((current > 0) && (arr[current] > arr[current-1])){
temp = arr[current];
arr[current] = arr[current-1];
arr[current-1] = temp;
current--;
}
}
}
int main(int argc, const char * argv[]) {
srand(static_cast<uint16_t>(time(0)));
initializePlanets();
insertion_sort(numPlanets, 8);
cout << "Sorted Planets: " ;
for (int x = 0; x<sizeof(numPlanets)/sizeof(*numPlanets); x++) {
cout << numPlanets[x] << " ";
}
cout << endl;
double numElements[7];
for (int x = 0; x< sizeof(numElements)/sizeof(numElements[0]); x++) {
numElements[x] = rand()%15;
}
insertion(numElements, 7);
for (int x = 0; x< sizeof(numElements)/sizeof(numElements[0]); x++) {
cout << numElements[x] << " ";
}
cout << endl;
median(numElements, 7);
cout << endl;
return 0;
}
| 24.840336 | 177 | 0.548376 | NyteCore |
17fb46216ac03b73627de54dcd6b36bd7fc3263c | 276 | cc | C++ | kythe/cxx/indexer/cxx/testdata/basic/macros_expand_transitive.cc | acidburn0zzz/kythe | 6cd4e9c81a1158de43ec783607a4d7edd9b7e4a0 | [
"Apache-2.0"
] | 1 | 2015-09-27T23:20:05.000Z | 2015-09-27T23:20:05.000Z | kythe/cxx/indexer/cxx/testdata/basic/macros_expand_transitive.cc | Acidburn0zzz/kythe | 6cd4e9c81a1158de43ec783607a4d7edd9b7e4a0 | [
"Apache-2.0"
] | 2 | 2021-05-20T23:02:03.000Z | 2021-09-28T05:46:10.000Z | kythe/cxx/indexer/cxx/testdata/basic/macros_expand_transitive.cc | acidburn0zzz/kythe | 6cd4e9c81a1158de43ec783607a4d7edd9b7e4a0 | [
"Apache-2.0"
] | null | null | null | // Tests that we record macro expansions only when they are at real locations.
//- @M0 defines M0
#define M0 int x;
//- @M1 defines M1
#define M1 M0
//- @M2 defines M2
#define M2 M1
//- @M2 ref/expands M2
//- @M2 ref/expands/transitive M1
//- @M2 ref/expands/transitive M0
M2
| 23 | 78 | 0.692029 | acidburn0zzz |
17fc90d62ac97936df4e0b3dfa69815aacb367ff | 5,439 | cpp | C++ | gen/blink/bindings/core/v8/V8HTMLDataListElement.cpp | gergul/MiniBlink | 7a11c52f141d54d5f8e1a9af31867cd120a2c3c4 | [
"Apache-2.0"
] | 8 | 2019-05-05T16:38:05.000Z | 2021-11-09T11:45:38.000Z | gen/blink/bindings/core/v8/V8HTMLDataListElement.cpp | gergul/MiniBlink | 7a11c52f141d54d5f8e1a9af31867cd120a2c3c4 | [
"Apache-2.0"
] | null | null | null | gen/blink/bindings/core/v8/V8HTMLDataListElement.cpp | gergul/MiniBlink | 7a11c52f141d54d5f8e1a9af31867cd120a2c3c4 | [
"Apache-2.0"
] | 4 | 2018-12-14T07:52:46.000Z | 2021-06-11T18:06:09.000Z | // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
#include "config.h"
#include "V8HTMLDataListElement.h"
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/V8DOMConfiguration.h"
#include "bindings/core/v8/V8HTMLCollection.h"
#include "bindings/core/v8/V8ObjectConstructor.h"
#include "core/dom/ClassCollection.h"
#include "core/dom/ContextFeatures.h"
#include "core/dom/Document.h"
#include "core/dom/TagCollection.h"
#include "core/html/HTMLCollection.h"
#include "core/html/HTMLDataListOptionsCollection.h"
#include "core/html/HTMLFormControlsCollection.h"
#include "core/html/HTMLTableRowsCollection.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/TraceEvent.h"
#include "wtf/GetPtr.h"
#include "wtf/RefPtr.h"
namespace blink {
// Suppress warning: global constructors, because struct WrapperTypeInfo is trivial
// and does not depend on another global objects.
#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wglobal-constructors"
#endif
const WrapperTypeInfo V8HTMLDataListElement::wrapperTypeInfo = { gin::kEmbedderBlink, V8HTMLDataListElement::domTemplate, V8HTMLDataListElement::refObject, V8HTMLDataListElement::derefObject, V8HTMLDataListElement::trace, 0, 0, V8HTMLDataListElement::preparePrototypeObject, V8HTMLDataListElement::installConditionallyEnabledProperties, "HTMLDataListElement", &V8HTMLElement::wrapperTypeInfo, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::NodeClassId, WrapperTypeInfo::InheritFromEventTarget, WrapperTypeInfo::Dependent, WrapperTypeInfo::WillBeGarbageCollectedObject };
#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
#pragma clang diagnostic pop
#endif
// This static member must be declared by DEFINE_WRAPPERTYPEINFO in HTMLDataListElement.h.
// For details, see the comment of DEFINE_WRAPPERTYPEINFO in
// bindings/core/v8/ScriptWrappable.h.
const WrapperTypeInfo& HTMLDataListElement::s_wrapperTypeInfo = V8HTMLDataListElement::wrapperTypeInfo;
namespace HTMLDataListElementV8Internal {
static void optionsAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info)
{
v8::Local<v8::Object> holder = info.Holder();
HTMLDataListElement* impl = V8HTMLDataListElement::toImpl(holder);
v8SetReturnValueFast(info, WTF::getPtr(impl->options()), impl);
}
static void optionsAttributeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
HTMLDataListElementV8Internal::optionsAttributeGetter(info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
} // namespace HTMLDataListElementV8Internal
static const V8DOMConfiguration::AccessorConfiguration V8HTMLDataListElementAccessors[] = {
{"options", HTMLDataListElementV8Internal::optionsAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder},
};
static void installV8HTMLDataListElementTemplate(v8::Local<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
{
functionTemplate->ReadOnlyPrototype();
v8::Local<v8::Signature> defaultSignature;
defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "HTMLDataListElement", V8HTMLElement::domTemplate(isolate), V8HTMLDataListElement::internalFieldCount,
0, 0,
V8HTMLDataListElementAccessors, WTF_ARRAY_LENGTH(V8HTMLDataListElementAccessors),
0, 0);
v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();
ALLOW_UNUSED_LOCAL(instanceTemplate);
v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();
ALLOW_UNUSED_LOCAL(prototypeTemplate);
// Custom toString template
functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
}
v8::Local<v8::FunctionTemplate> V8HTMLDataListElement::domTemplate(v8::Isolate* isolate)
{
return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8HTMLDataListElementTemplate);
}
bool V8HTMLDataListElement::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
{
return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
}
v8::Local<v8::Object> V8HTMLDataListElement::findInstanceInPrototypeChain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
{
return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
}
HTMLDataListElement* V8HTMLDataListElement::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value)
{
return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)) : 0;
}
void V8HTMLDataListElement::refObject(ScriptWrappable* scriptWrappable)
{
#if !ENABLE(OILPAN)
scriptWrappable->toImpl<HTMLDataListElement>()->ref();
#endif
}
void V8HTMLDataListElement::derefObject(ScriptWrappable* scriptWrappable)
{
#if !ENABLE(OILPAN)
scriptWrappable->toImpl<HTMLDataListElement>()->deref();
#endif
}
} // namespace blink
| 45.325 | 585 | 0.797941 | gergul |
17fd466e46149e08035629ea84e1fc5c92584f7c | 4,579 | cc | C++ | FW/src/lp/common/utilities/simple_circular_buffer.cc | thesofproject/converged-mpp | 8e6e13d57b58d1c4ea1793de46f92f9ff819a01d | [
"BSD-3-Clause"
] | null | null | null | FW/src/lp/common/utilities/simple_circular_buffer.cc | thesofproject/converged-mpp | 8e6e13d57b58d1c4ea1793de46f92f9ff819a01d | [
"BSD-3-Clause"
] | null | null | null | FW/src/lp/common/utilities/simple_circular_buffer.cc | thesofproject/converged-mpp | 8e6e13d57b58d1c4ea1793de46f92f9ff819a01d | [
"BSD-3-Clause"
] | 1 | 2021-12-08T09:43:25.000Z | 2021-12-08T09:43:25.000Z | // SPDX-License-Identifier: BSD-3-Clause
//
// Copyright(c) 2021 Intel Corporation. All rights reserved.
#include "simple_circular_buffer.h"
#include <xtensa/tie/xt_hifi3.h>
namespace dsp_fw
{
void copy_from_cb(uint8_t* out, size_t s_out, const uint8_t* in, size_t bytes)
{
size_t n_samples = bytes / 4;
const ae_int32x2* sin = reinterpret_cast<const ae_int32x2*> ( in );
ae_int32x2* sout = reinterpret_cast<ae_int32x2*> ( out );
ae_int32x2 vs;
if (!IS_ALIGNED(sin, 8))
{
AE_L32_XC(vs, reinterpret_cast<const ae_int32*> (sin), 4 );
AE_S32_L_IP(vs, reinterpret_cast<ae_int32*> (sout), 4 );
n_samples--;
}
ae_valign align_out = AE_ZALIGN64();
for (size_t i = 0; i < n_samples / 2; i++ )
{
AE_L32X2_XC( vs, sin, 8 );
AE_SA32X2_IP( vs, align_out, sout );
}
AE_SA64POS_FP( align_out, sout );
if ( n_samples % 2 )
{
AE_L32_XC(vs, reinterpret_cast<const ae_int32*> (sin), 0 );
AE_S32_L_IP(vs, reinterpret_cast<ae_int32*> (sout), 0 );
}
}
void copy_from_cb_(uint8_t* out, size_t s_out, const uint8_t* in, size_t n_samples)
{
const ae_int24x2* sin = reinterpret_cast<const ae_int24x2*> ( in );
ae_int24x2* sout = reinterpret_cast<ae_int24x2*> ( out );
ae_int24x2 vs;
ae_valign align_in;
ae_valign align_out = AE_ZALIGN64();
AE_LA24X2POS_PC( align_in, sin );
for (size_t i = 0; i < n_samples / 6; i++ )
{
AE_LA24X2_IC( vs, align_in, sin );
AE_SA24X2_IP( vs, align_out, sout );
}
size_t rest = n_samples % 6;
if ( rest )
{
AE_LA24X2_IC( vs, align_in, sin );
ae_int32 d32;
if ( rest >= 3 )
{
AE_SA24_IP( AE_MOVAD32_H( AE_MOVINT32X2_FROMINT24X2( vs ) ), align_out, sout );
d32 = AE_MOVAD32_L( AE_MOVINT32X2_FROMINT24X2( vs ) );
rest -= 3;
}
else
{
d32 = AE_MOVAD32_H( AE_MOVINT32X2_FROMINT24X2( vs ) );
}
AE_SA64POS_FP( align_out, sout );
if ( 0 == rest-- ) return;
out = reinterpret_cast<uint8_t*> ( sout );
*(out++) = static_cast<uint8_t> ( AE_MOVAD32_L( d32 ) );
if ( 0 == rest ) return;
*out = static_cast<uint8_t> ( AE_MOVAD32_L( AE_SRLA32( d32, 8 ) ) );
return;
}
AE_SA64POS_FP( align_out, sout );
}
ErrorCode RtCircularBuffer::PushDataFromCb(ByteArray* buffer)
{
kw_assert(buffer != NULL);
const size_t size = buffer->size();
if (ba_.size() < (data_in_buffer_ + size))
{
return ADSP_SUCCESS;
}
RETURN_EC_ON_FAIL(ba_.size() >= size, ADSP_OUT_OF_RESOURCES);
if (size <= (uint32_t)(ba_.data_end() - write_ptr_))
{
copy_from_cb(write_ptr_, ba_.size(), buffer->data(), size );
write_ptr_ += size;
}
else
{
uint32_t non_wrapped_size = (uint32_t)(ba_.data_end() - write_ptr_);
uint32_t reminder_size = size - non_wrapped_size;
copy_from_cb(write_ptr_, ba_.size(), buffer->data(), non_wrapped_size );
uint32_t c_beg = (uint32_t)AE_GETCBEGIN0();
uint32_t c_end = (uint32_t)AE_GETCEND0();
uint32_t b_beg = (uint32_t)buffer->data();
if ((b_beg + non_wrapped_size) < c_end)
{
copy_from_cb(ba_.data(), ba_.size(), buffer->data() + non_wrapped_size, reminder_size );
}
else
{
size_t delta = (b_beg + non_wrapped_size) - c_end;
uint8_t* new_begin = (uint8_t*)(c_beg + delta);
copy_from_cb(ba_.data(), ba_.size(), new_begin, reminder_size );
}
write_ptr_ = ba_.data() + reminder_size;
}
if (write_ptr_ == ba_.data_end())
{
write_ptr_ = ba_.data();
}
data_in_buffer_ += size;
if (data_in_buffer_ > ba_.size())
{
HALT_ON_ERROR(ADSP_CIRCULAR_BUFFER_OVERRUN);
return ADSP_SUCCESS;
}
return ADSP_SUCCESS;
}
ErrorCode RtCircularBuffer::ReadData(ByteArray* buffer, size_t size)
{
// buffer is not circular
// buffer is given
// uint8_t* rp = read_ptr_;
RETURN_EC_ON_FAIL(ba_.size() >= size, ADSP_OUT_OF_RESOURCES);
RETURN_EC_ON_FAIL(size <= data_in_buffer_, ADSP_CIRCULAR_BUFFER_UNDERRUN);
void* cached_c_beg = AE_GETCBEGIN0();
void* cached_c_end = AE_GETCEND0();
AE_SETCBEGIN0(ba_.data());
AE_SETCEND0(ba_.data_end());
copy_from_cb(buffer->data(), size, read_ptr(), size);
AE_SETCBEGIN0(cached_c_beg);
AE_SETCEND0(cached_c_end);
data_in_buffer_ -= size;
return ADSP_SUCCESS;
}
} //namespace dsp_fw
| 30.125 | 100 | 0.612798 | thesofproject |
aa004b7aeb515436363442d3e443913fa0641b60 | 7,014 | cpp | C++ | src/config.cpp | lms-org/lms | be5decd8e408bcefb82cbf9e0ee8f5deb04fd5a6 | [
"Apache-2.0"
] | 8 | 2016-09-20T20:54:56.000Z | 2020-11-08T23:18:45.000Z | src/config.cpp | lms-org/lms | be5decd8e408bcefb82cbf9e0ee8f5deb04fd5a6 | [
"Apache-2.0"
] | 41 | 2016-06-07T17:26:11.000Z | 2017-05-27T12:22:20.000Z | src/config.cpp | lms-org/lms | be5decd8e408bcefb82cbf9e0ee8f5deb04fd5a6 | [
"Apache-2.0"
] | 5 | 2016-10-19T15:04:45.000Z | 2020-11-08T23:18:57.000Z | #include <fstream>
#include <string>
#include <cstdlib>
#include <iostream>
#include <unordered_map>
#include <lms/config.h>
#include "internal/string.h"
namespace lms {
struct Config::Private {
std::unordered_map<std::string, std::string> properties;
template <typename T>
T get(const std::string &key, const T &defaultValue) const {
auto it = properties.find(key);
if (it == properties.end()) {
return defaultValue;
} else {
return internal::string_cast_to<T>(it->second);
}
}
template <typename T>
T get(const std::string &key) const{
T def;
return get(key,def);
}
template <typename T> void set(const std::string &key, const T &value) {
properties[key] = internal::string_cast_from<T>(value);
}
template <typename T>
std::vector<T> getArray(const std::string &key,
const std::vector<T> &defaultValue) const {
auto it = properties.find(key);
if (it == properties.end()) {
return defaultValue;
} else {
std::vector<T> result;
for (const auto &parts :
lms::internal::split(it->second, ',')) {
result.push_back(
internal::string_cast_to<T>(lms::internal::trim(parts)));
}
return result;
}
}
template <typename T>
std::vector<T> getArray(const std::string &key) const{
std::vector<T> def;
return getArray(key,def);
}
template <typename T>
void setArray(const std::string &key, const std::vector<T> &value) {
std::ostringstream oss;
for (auto it = value.begin(); it != value.end(); it++) {
if (it != value.begin()) {
oss << " ";
}
oss << internal::string_cast_from(*it);
}
properties[key] = oss.str();
}
};
Config::Config() : dptr(new Private) {}
Config::~Config() { delete dptr; }
Config::Config(const Config &other) : dptr(new Private(*other.dptr)) {}
void Config::load(std::istream &in) {
std::string line;
bool isMultiline = false;
std::string lineBuffer;
while (internal::safeGetline(in, line)) {
if (internal::trim(line).empty() || line[0] == '#') {
// ignore empty lines and comment lines
isMultiline = false;
} else {
bool isCurrentMultiline = line[line.size() - 1] == '\\';
std::string normalizedLine =
isCurrentMultiline ? line.erase(line.size() - 1) : line;
if (isMultiline) {
lineBuffer += normalizedLine;
} else {
lineBuffer = normalizedLine;
}
isMultiline = isCurrentMultiline;
}
if (!isMultiline) {
size_t index = lineBuffer.find_first_of('=');
if (index != std::string::npos) {
dfunc()
->properties[internal::trim(lineBuffer.substr(0, index))] =
internal::trim(lineBuffer.substr(index + 1));
}
}
}
}
bool Config::loadFromFile(const std::string &path) {
std::ifstream in(path);
if (!in.is_open()) {
return false;
}
load(in);
in.close();
return true;
}
bool Config::hasKey(const std::string &key) const {
return dfunc()->properties.count(key) == 1;
}
bool Config::empty() const { return dfunc()->properties.empty(); }
void Config::clear() { dfunc()->properties.clear(); }
// Template specializations get<T>
template <>
std::string Config::get<std::string>(const std::string &key,
const std::string &defaultValue) const {
return dfunc()->get(key, defaultValue);
}
template <>
int Config::get<int>(const std::string &key, const int &defaultValue) const {
return dfunc()->get(key, defaultValue);
}
template <>
float Config::get<float>(const std::string &key,
const float &defaultValue) const {
return dfunc()->get(key, defaultValue);
}
template<>
double Config::get<double>(const std::string &key,
const double &defaultValue) const {
return dfunc()->get(key, defaultValue);
}
template <>
bool Config::get<bool>(const std::string &key, const bool &defaultValue) const {
return dfunc()->get(key, defaultValue);
}
// Template specializations set<T>
template <>
void Config::set<std::string>(const std::string &key,
const std::string &value) {
dfunc()->set(key, value);
}
template <> void Config::set<int>(const std::string &key, const int &value) {
dfunc()->set(key, value);
}
template <>
void Config::set<float>(const std::string &key, const float &value) {
dfunc()->set(key, value);
}
template <> void Config::set<bool>(const std::string &key, const bool &value) {
dfunc()->set(key, value);
}
template <> void Config::set<double>(const std::string &key, const double &value) {
dfunc()->set(key, value);
}
// Template specializations getArray<T>
template <>
std::vector<std::string> Config::getArray<std::string>(
const std::string &key,
const std::vector<std::string> &defaultValue) const {
return dfunc()->getArray(key, defaultValue);
}
template <>
std::vector<int>
Config::getArray<int>(const std::string &key,
const std::vector<int> &defaultValue) const {
return dfunc()->getArray(key, defaultValue);
}
template <>
std::vector<float>
Config::getArray<float>(const std::string &key,
const std::vector<float> &defaultValue) const {
return dfunc()->getArray(key, defaultValue);
}
template <>
std::vector<bool>
Config::getArray<bool>(const std::string &key,
const std::vector<bool> &defaultValue) const {
return dfunc()->getArray(key, defaultValue);
}
template <>
std::vector<double>
Config::getArray<double>(const std::string &key,
const std::vector<double> &defaultValue) const {
return dfunc()->getArray(key, defaultValue);
}
// Template specializations setArray<T>
template <>
void Config::setArray<std::string>(const std::string &key,
const std::vector<std::string> &value) {
dfunc()->setArray(key, value);
}
template <>
void Config::setArray<int>(const std::string &key,
const std::vector<int> &value) {
dfunc()->setArray(key, value);
}
template <>
void Config::setArray<float>(const std::string &key,
const std::vector<float> &value) {
dfunc()->setArray(key, value);
}
template <>
void Config::setArray<bool>(const std::string &key,
const std::vector<bool> &value) {
dfunc()->setArray(key, value);
}
template <>
void Config::setArray<double>(const std::string &key,
const std::vector<double> &value) {
dfunc()->setArray(key, value);
}
} // namespace lms
| 27.72332 | 83 | 0.578129 | lms-org |
aa0254877277a5dd61902005bae3ed9af29d13e1 | 1,283 | cc | C++ | ash/system/network/unified_vpn_detailed_view_controller.cc | sarang-apps/darshan_browser | 173649bb8a7c656dc60784d19e7bb73e07c20daa | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | ash/system/network/unified_vpn_detailed_view_controller.cc | sarang-apps/darshan_browser | 173649bb8a7c656dc60784d19e7bb73e07c20daa | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | ash/system/network/unified_vpn_detailed_view_controller.cc | sarang-apps/darshan_browser | 173649bb8a7c656dc60784d19e7bb73e07c20daa | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 2 | 2021-01-05T23:43:46.000Z | 2021-01-07T23:36:34.000Z | // Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#include "ash/system/network/unified_vpn_detailed_view_controller.h"
#include "ash/session/session_controller_impl.h"
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/system/network/vpn_list_view.h"
#include "ash/system/tray/detailed_view_delegate.h"
#include "ui/base/l10n/l10n_util.h"
namespace ash {
UnifiedVPNDetailedViewController::UnifiedVPNDetailedViewController(
UnifiedSystemTrayController* tray_controller)
: detailed_view_delegate_(
std::make_unique<DetailedViewDelegate>(tray_controller)) {
}
UnifiedVPNDetailedViewController::~UnifiedVPNDetailedViewController() = default;
views::View* UnifiedVPNDetailedViewController::CreateView() {
DCHECK(!view_);
view_ =
new tray::VPNListView(detailed_view_delegate_.get(),
Shell::Get()->session_controller()->login_status());
view_->Init();
return view_;
}
base::string16 UnifiedVPNDetailedViewController::GetAccessibleName() const {
return l10n_util::GetStringUTF16(
IDS_ASH_QUICK_SETTINGS_BUBBLE_VPN_SETTINGS_ACCESSIBLE_DESCRIPTION);
}
} // namespace ash
| 32.897436 | 80 | 0.766952 | sarang-apps |
aa0525b1e304a5502a00df3c6058610aaa733929 | 1,373 | cpp | C++ | Problems/0322. Coin Change.cpp | KrKush23/LeetCode | 2a87420a65347a34fba333d46e1aa6224c629b7a | [
"MIT"
] | null | null | null | Problems/0322. Coin Change.cpp | KrKush23/LeetCode | 2a87420a65347a34fba333d46e1aa6224c629b7a | [
"MIT"
] | null | null | null | Problems/0322. Coin Change.cpp | KrKush23/LeetCode | 2a87420a65347a34fba333d46e1aa6224c629b7a | [
"MIT"
] | null | null | null | class Solution {
public:
int coinChange(vector<int>& coins, int amount) {
int n = coins.size();
// 1D MATRIX APPROACH ==========================
vector<int> dp(amount+1, amount+1);
dp[0]=0; //0 ways to make 0 amount
for(int i=1; i<=amount; i++){
for(int j=0; j<n; j++){
if(coins[j] <= i) //if coins is applicable
// min of exclusion and inclusion
dp[i] = min(dp[i], 1+ dp[i - coins[j]]);
}
}
return dp[amount] > amount ? -1:dp[amount];
// 2D MATRIX APPROACH ==========================
// vector<vector<int>> dp(n+1, vector<int>(amount+1,amount+1));
// // i=0 -> coin = 0 already initialised with amount+1
// for(int i=1; i<=n; i++){
// for(int j=0; j<=amount; j++){
// if(j==0) //amount = 0
// dp[i][j] = 0;
// else if(coins[i-1] > j) //coin val > amount
// dp[i][j] = dp[i-1][j]; //copy last coin's dp
// else
// //min of inclusion and exclusion
// dp[i][j] = min(1+ dp[i][j-coins[i-1]], dp[i-1][j]);
// }
// }
// return dp[n][amount] > amount ? -1:dp[n][amount];
}
};
| 35.205128 | 74 | 0.388201 | KrKush23 |
aa06077527bf6d1a837a7a4879fcedc3e4b7cb1a | 505 | cpp | C++ | codes/TC_2020/FALL/3.cpp | pikaninja/collection-of-chessbot-codes | a56e5e4e38c293ecddd2ce4b0b922723ca833089 | [
"MIT"
] | null | null | null | codes/TC_2020/FALL/3.cpp | pikaninja/collection-of-chessbot-codes | a56e5e4e38c293ecddd2ce4b0b922723ca833089 | [
"MIT"
] | null | null | null | codes/TC_2020/FALL/3.cpp | pikaninja/collection-of-chessbot-codes | a56e5e4e38c293ecddd2ce4b0b922723ca833089 | [
"MIT"
] | null | null | null | //miles
#include <iostream>
#include <string>
using namespace std;
int main() {
string s;
getline(cin,s);
string x = "";
for(int i = 0; i < s.length(); i++){
x+=s[i];
if(x == "LLL"){
cout << "A";
x = "";
}else if(x == "SSL"){
cout << "T";
x = "";
}else if(x == "SLL"){
cout << "G";
x = "";
}else if(x == "SLS"){
cout << "C";
x = "";
}
}
}
| 18.035714 | 40 | 0.320792 | pikaninja |
aa08cba3638129d6eda29d3a00238ff7717930d2 | 17,368 | hpp | C++ | libraries/chain/include/graphene/chain/protocol/types.hpp | cyvasia/cyva | e98b26abfe8e96d0e1470626b0a525d44f9372a9 | [
"MIT"
] | null | null | null | libraries/chain/include/graphene/chain/protocol/types.hpp | cyvasia/cyva | e98b26abfe8e96d0e1470626b0a525d44f9372a9 | [
"MIT"
] | null | null | null | libraries/chain/include/graphene/chain/protocol/types.hpp | cyvasia/cyva | e98b26abfe8e96d0e1470626b0a525d44f9372a9 | [
"MIT"
] | null | null | null | /* (c) 2018 CYVA. For details refer to LICENSE */
/*
* Copyright (c) 2015 Cryptonomex, Inc., and contributors.
*
* The MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#pragma once
#include <fc/container/flat_fwd.hpp>
#include <fc/io/varint.hpp>
#include <fc/io/enum_type.hpp>
#include <fc/crypto/sha224.hpp>
#include <fc/crypto/elliptic.hpp>
#include <fc/reflect/reflect.hpp>
#include <fc/reflect/variant.hpp>
#include <fc/optional.hpp>
#include <fc/safe.hpp>
#include <fc/container/flat.hpp>
#include <fc/string.hpp>
#include <fc/io/raw.hpp>
#include <fc/uint128.hpp>
#include <fc/static_variant.hpp>
#include <fc/smart_ref_fwd.hpp>
#include <fc/crypto/base58.hpp>
#include <fc/crypto/ripemd160.hpp>
#include <cyva/encrypt/crypto_types.hpp>
#include <memory>
#include <vector>
#include <deque>
#include <cstdint>
#include <graphene/db/object_id.hpp>
#include <graphene/chain/protocol/config.hpp>
namespace graphene { namespace chain {
using namespace graphene::db;
using std::map;
using std::vector;
using std::unordered_map;
using std::string;
using std::deque;
using std::shared_ptr;
using std::weak_ptr;
using std::unique_ptr;
using std::set;
using std::pair;
using std::enable_shared_from_this;
using std::tie;
using std::make_pair;
using fc::smart_ref;
using fc::variant_object;
using fc::variant;
using fc::enum_type;
using fc::optional;
using fc::unsigned_int;
using fc::signed_int;
using fc::time_point_sec;
using fc::time_point;
using fc::safe;
using fc::flat_map;
using fc::flat_set;
using fc::static_variant;
using fc::ecc::range_proof_type;
using fc::ecc::range_proof_info;
using fc::ecc::commitment_type;
struct void_t{};
typedef fc::ecc::private_key private_key_type;
typedef fc::sha256 chain_id_type;
typedef cyva::encrypt::CustodyData custody_data_type;
typedef cyva::encrypt::CustodyProof custody_proof_type;
typedef cyva::encrypt::DIntegerString bigint_type;
typedef cyva::encrypt::CiphertextString ciphertext_type;
typedef cyva::encrypt::DeliveryProofString delivery_proof_type;
enum reserved_spaces
{
relative_protocol_ids = 0,
protocol_ids = 1,
implementation_ids = 2
};
inline bool is_relative( object_id_type o ){ return o.space() == 0; }
/**
* List all object types from all namespaces here so they can
* be easily reflected and displayed in debug output. If a 3rd party
* wants to extend the core code then they will have to change the
* packed_object::type field from enum_type to uint16 to avoid
* warnings when converting packed_objects to/from json.
*/
enum object_type
{
null_object_type,
base_object_type,
account_object_type,
asset_object_type,
miner_object_type,
custom_object_type,
proposal_object_type,
operation_history_object_type,
withdraw_permission_object_type,
vesting_balance_object_type,
OBJECT_TYPE_COUNT ///< Sentry value which contains the number of different object types
};
enum impl_object_type
{
impl_global_property_object_type,
impl_dynamic_global_property_object_type,
impl_reserved0_object_type, // formerly index_meta_object_type, TODO: delete me
impl_asset_dynamic_data_type,
impl_account_balance_object_type,
impl_account_statistics_object_type,
impl_transaction_object_type,
impl_block_summary_object_type,
impl_account_transaction_history_object_type,
impl_chain_property_object_type,
impl_miner_schedule_object_type,
impl_budget_record_object_type,
impl_transaction_detail_object_type,
impl_blinded_balance_object_type,
impl_confidential_tx_object_type
};
//typedef fc::unsigned_int object_id_type;
//typedef uint64_t object_id_type;
class account_object;
class committee_member_object;
class miner_object;
class asset_object;
class custom_object;
class proposal_object;
class operation_history_object;
class vesting_balance_object;
typedef object_id< protocol_ids, account_object_type, account_object> account_id_type;
typedef object_id< protocol_ids, asset_object_type, asset_object> asset_id_type;
typedef object_id< protocol_ids, miner_object_type, miner_object> miner_id_type;
typedef object_id< protocol_ids, custom_object_type, custom_object> custom_id_type;
typedef object_id< protocol_ids, proposal_object_type, proposal_object> proposal_id_type;
typedef object_id< protocol_ids, operation_history_object_type, operation_history_object> operation_history_id_type;
typedef object_id< protocol_ids, vesting_balance_object_type, vesting_balance_object> vesting_balance_id_type;
// implementation types
class global_property_object;
class dynamic_global_property_object;
class asset_dynamic_data_object;
class account_balance_object;
class account_statistics_object;
class transaction_object;
class block_summary_object;
class account_transaction_history_object;
class chain_property_object;
class miner_schedule_object;
class budget_record_object;
class transaction_detail_object;
class blinded_balance_object;
typedef object_id< implementation_ids, impl_global_property_object_type, global_property_object> global_property_id_type;
typedef object_id< implementation_ids, impl_dynamic_global_property_object_type, dynamic_global_property_object> dynamic_global_property_id_type;
typedef object_id< implementation_ids, impl_asset_dynamic_data_type, asset_dynamic_data_object> asset_dynamic_data_id_type;
typedef object_id< implementation_ids, impl_account_balance_object_type, account_balance_object> account_balance_id_type;
typedef object_id< implementation_ids, impl_account_statistics_object_type,account_statistics_object> account_statistics_id_type;
typedef object_id< implementation_ids, impl_transaction_object_type, transaction_object> transaction_obj_id_type;
typedef object_id< implementation_ids, impl_block_summary_object_type, block_summary_object> block_summary_id_type;
typedef object_id< implementation_ids,
impl_account_transaction_history_object_type,
account_transaction_history_object> account_transaction_history_id_type;
typedef object_id< implementation_ids, impl_chain_property_object_type, chain_property_object> chain_property_id_type;
typedef object_id< implementation_ids, impl_miner_schedule_object_type, miner_schedule_object> miner_schedule_id_type;
typedef object_id< implementation_ids, impl_budget_record_object_type, budget_record_object > budget_record_id_type;
typedef object_id< implementation_ids, impl_transaction_detail_object_type, transaction_detail_object > transaction_detail_id_type;
typedef object_id< implementation_ids, impl_blinded_balance_object_type, blinded_balance_object > blinded_balance_id_type;
typedef fc::array<char, GRAPHENE_MAX_ASSET_SYMBOL_LENGTH> symbol_type;
typedef fc::ripemd160 block_id_type;
typedef fc::ripemd160 checksum_type;
typedef fc::ripemd160 transaction_id_type;
typedef fc::sha256 digest_type;
typedef fc::ecc::compact_signature signature_type;
typedef safe<int64_t> share_type;
typedef uint16_t weight_type;
struct public_key_type
{
struct binary_key
{
binary_key() {}
uint32_t check = 0;
fc::ecc::public_key_data data;
};
fc::ecc::public_key_data key_data;
public_key_type();
public_key_type( const fc::ecc::public_key_data& data );
public_key_type( const fc::ecc::public_key& pubkey );
explicit public_key_type( const std::string& base58str );
operator fc::ecc::public_key_data() const;
operator fc::ecc::public_key() const;
explicit operator std::string() const;
friend bool operator == ( const public_key_type& p1, const fc::ecc::public_key& p2);
friend bool operator == ( const public_key_type& p1, const public_key_type& p2);
friend bool operator != ( const public_key_type& p1, const public_key_type& p2);
// TODO: This is temporary for testing
bool is_valid_v1( const std::string& base58str );
static std::string from_nums(std::string str, bool even = false)
{
binary_key k;
k.data.data[0] = even ? 0x02 : 0x03;
str = str.substr(0, 32);
auto sz = str.length( );
auto offset = 1 + 32 - sz;
memcpy(&k.data.data[offset], str.data( ), sz);
k.check = fc::ripemd160::hash(k.data.data, k.data.size( ))._hash[0];
auto data = fc::raw::pack(k);
return std::string(GRAPHENE_ADDRESS_PREFIX) + fc::to_base58(data.data( ), data.size( ));
}
};
inline bool operator < ( const public_key_type& a, const public_key_type& b )
{
int i=0;
while (i<33 )
{
if(a.key_data.at(i) < b.key_data.at(i) )
return true;
if(a.key_data.at(i) > b.key_data.at(i) )
return false;
i++;
}
return false;
}
struct extended_public_key_type
{
struct binary_key
{
binary_key() {}
uint32_t check = 0;
fc::ecc::extended_key_data data;
};
fc::ecc::extended_key_data key_data;
extended_public_key_type();
extended_public_key_type( const fc::ecc::extended_key_data& data );
extended_public_key_type( const fc::ecc::extended_public_key& extpubkey );
explicit extended_public_key_type( const std::string& base58str );
operator fc::ecc::extended_public_key() const;
explicit operator std::string() const;
friend bool operator == ( const extended_public_key_type& p1, const fc::ecc::extended_public_key& p2);
friend bool operator == ( const extended_public_key_type& p1, const extended_public_key_type& p2);
friend bool operator != ( const extended_public_key_type& p1, const extended_public_key_type& p2);
};
struct extended_private_key_type
{
struct binary_key
{
binary_key() {}
uint32_t check = 0;
fc::ecc::extended_key_data data;
};
fc::ecc::extended_key_data key_data;
extended_private_key_type();
extended_private_key_type( const fc::ecc::extended_key_data& data );
extended_private_key_type( const fc::ecc::extended_private_key& extprivkey );
explicit extended_private_key_type( const std::string& base58str );
operator fc::ecc::extended_private_key() const;
explicit operator std::string() const;
friend bool operator == ( const extended_private_key_type& p1, const fc::ecc::extended_private_key& p2);
friend bool operator == ( const extended_private_key_type& p1, const extended_private_key_type& p2);
friend bool operator != ( const extended_private_key_type& p1, const extended_private_key_type& p2);
};
} } // graphene::chain
namespace fc
{
void to_variant( const graphene::chain::public_key_type& var, fc::variant& vo );
void from_variant( const fc::variant& var, graphene::chain::public_key_type& vo );
void to_variant( const graphene::chain::extended_public_key_type& var, fc::variant& vo );
void from_variant( const fc::variant& var, graphene::chain::extended_public_key_type& vo );
void to_variant( const graphene::chain::extended_private_key_type& var, fc::variant& vo );
void from_variant( const fc::variant& var, graphene::chain::extended_private_key_type& vo );
}
FC_REFLECT( graphene::chain::public_key_type, (key_data) )
FC_REFLECT( graphene::chain::public_key_type::binary_key, (data)(check) )
FC_REFLECT( graphene::chain::extended_public_key_type, (key_data) )
FC_REFLECT( graphene::chain::extended_public_key_type::binary_key, (check)(data) )
FC_REFLECT( graphene::chain::extended_private_key_type, (key_data) )
FC_REFLECT( graphene::chain::extended_private_key_type::binary_key, (check)(data) )
FC_REFLECT_ENUM( graphene::chain::object_type,
(null_object_type)
(base_object_type)
(account_object_type)
(asset_object_type)
(miner_object_type)
(custom_object_type)
(proposal_object_type)
(operation_history_object_type)
(withdraw_permission_object_type)
(vesting_balance_object_type)
(OBJECT_TYPE_COUNT)
)
FC_REFLECT_ENUM( graphene::chain::impl_object_type,
(impl_global_property_object_type)
(impl_dynamic_global_property_object_type)
(impl_reserved0_object_type)
(impl_asset_dynamic_data_type)
(impl_account_balance_object_type)
(impl_account_statistics_object_type)
(impl_transaction_object_type)
(impl_block_summary_object_type)
(impl_account_transaction_history_object_type)
(impl_chain_property_object_type)
(impl_miner_schedule_object_type)
(impl_budget_record_object_type)
(impl_transaction_detail_object_type)
(impl_blinded_balance_object_type)
(impl_confidential_tx_object_type)
)
FC_REFLECT_TYPENAME( graphene::chain::share_type )
FC_REFLECT_TYPENAME( graphene::chain::account_id_type )
FC_REFLECT_TYPENAME( graphene::chain::asset_id_type )
FC_REFLECT_TYPENAME( graphene::chain::miner_id_type )
FC_REFLECT_TYPENAME( graphene::chain::custom_id_type )
FC_REFLECT_TYPENAME( graphene::chain::proposal_id_type )
FC_REFLECT_TYPENAME( graphene::chain::operation_history_id_type )
FC_REFLECT_TYPENAME( graphene::chain::vesting_balance_id_type )
FC_REFLECT_TYPENAME( graphene::chain::global_property_id_type )
FC_REFLECT_TYPENAME( graphene::chain::dynamic_global_property_id_type )
FC_REFLECT_TYPENAME( graphene::chain::asset_dynamic_data_id_type )
FC_REFLECT_TYPENAME( graphene::chain::account_balance_id_type )
FC_REFLECT_TYPENAME( graphene::chain::account_statistics_id_type )
FC_REFLECT_TYPENAME( graphene::chain::transaction_obj_id_type )
FC_REFLECT_TYPENAME( graphene::chain::block_summary_id_type )
FC_REFLECT_TYPENAME( graphene::chain::account_transaction_history_id_type )
FC_REFLECT_TYPENAME( graphene::chain::budget_record_id_type )
FC_REFLECT_TYPENAME( graphene::chain::transaction_detail_id_type )
FC_REFLECT_TYPENAME( graphene::chain::blinded_balance_id_type )
FC_REFLECT_EMPTY( graphene::chain::void_t )
| 46.814016 | 152 | 0.661389 | cyvasia |
aa0a7b16813bd572ada4de1cb17fdf969caf0638 | 227 | cpp | C++ | slides/assets/physics_engines/snippets/cryengine.cpp | dodocloud/aph-tutorials | 85a3d1db0bb4d6add3156f07bde5f597dca34123 | [
"MIT"
] | null | null | null | slides/assets/physics_engines/snippets/cryengine.cpp | dodocloud/aph-tutorials | 85a3d1db0bb4d6add3156f07bde5f597dca34123 | [
"MIT"
] | null | null | null | slides/assets/physics_engines/snippets/cryengine.cpp | dodocloud/aph-tutorials | 85a3d1db0bb4d6add3156f07bde5f597dca34123 | [
"MIT"
] | 1 | 2022-01-17T20:55:02.000Z | 2022-01-17T20:55:02.000Z | if (min(min(min(body.M,ibody_inv.x),ibody_inv.y),ibody_inv.z)<0) {
body.M = body.Minv = 0;
body.Ibody_inv.zero(); body.Ibody.zero();
} else {
body.P = (body.v=v)*body.M;
body.L = body.q*(body.Ibody*(!body.q*(body.w=w)));
} | 32.428571 | 66 | 0.621145 | dodocloud |
aa0ad9ad4dd219b99636017624cb712976491fa0 | 4,581 | hpp | C++ | include/huffman/huff_pc_ss.hpp | kurpicz/pwm | 7e0837d0e3da6cf7b63e80b04a75a61b73b91779 | [
"BSD-2-Clause"
] | 14 | 2017-02-27T10:15:50.000Z | 2021-12-06T18:36:53.000Z | include/huffman/huff_pc_ss.hpp | kurpicz/pwm | 7e0837d0e3da6cf7b63e80b04a75a61b73b91779 | [
"BSD-2-Clause"
] | 5 | 2017-04-21T16:05:10.000Z | 2019-03-26T07:08:47.000Z | include/huffman/huff_pc_ss.hpp | kurpicz/pwm | 7e0837d0e3da6cf7b63e80b04a75a61b73b91779 | [
"BSD-2-Clause"
] | 3 | 2018-10-31T14:12:59.000Z | 2021-03-09T15:37:50.000Z | /*******************************************************************************
* include/huffman/huff_pc.hpp
*
* Copyright (C) 2018 Marvin Löbel <loebel.marvin@gmail.com>
*
* All rights reserved. Published under the BSD-2 license in the LICENSE file.
******************************************************************************/
#pragma once
#include <cstddef>
#include <cstdint>
#include <iostream>
#include "huffman/huff_building_blocks.hpp"
#include "huffman/huff_codes.hpp"
template <typename AlphabetType, typename ContextType, typename HuffCodes>
void huff_pc_ss(AlphabetType const* text,
uint64_t const size,
uint64_t const levels,
HuffCodes const& codes,
ContextType& ctx,
span<uint64_t const> const) {
auto& bv = ctx.bv();
// While calculating the histogram, we also compute the first level
huff_scan_text_compute_first_level_bv_and_full_hist(text, size, bv, ctx,
codes);
for (uint64_t level = levels - 1; level > ContextType::MAX_UPPER_LEVELS;
--level) {
auto&& borders = ctx.lower_borders_at_level(level);
auto&& hist = ctx.hist_at_level(level);
if (borders.size() > 0) {
borders[0] = 0;
}
uint64_t containing_prev_block = 0;
for (uint64_t pos = 1; pos < ctx.hist_size(level); ++pos) {
// This is only required if we compute matrices
[[maybe_unused]] auto const prev_block = ctx.rho(level, pos - 1);
auto const this_block = ctx.rho(level, pos);
if (hist.count(this_block) > 0) {
borders[this_block] = borders[containing_prev_block] +
hist[containing_prev_block];
containing_prev_block = this_block;
}
// NB: The above calulcation produces _wrong_ border offsets
// for huffman codes that are one-shorter than the current level.
//
// Since those codes will not be used in the loop below, this does not
// produce wrong or out-of-bound accesses.
if (ContextType::compute_rho) {
ctx.set_rho(level - 1, pos - 1, prev_block >> 1);
}
}
// The number of 0s is the position of the first 1 in the previous level
if constexpr (ContextType::compute_zeros) {
ctx.zeros()[level - 1] = borders[1];
}
}
for (uint64_t level = std::min(levels - 1, ContextType::MAX_UPPER_LEVELS);
level > 0; --level) {
auto&& borders = ctx.upper_borders_at_level(level);
auto&& hist = ctx.hist_at_level(level);
borders[0] = 0;
uint64_t containing_prev_block = 0;
for (uint64_t pos = 1; pos < ctx.hist_size(level); ++pos) {
// This is only required if we compute matrices
[[maybe_unused]] auto const prev_block = ctx.rho(level, pos - 1);
auto const this_block = ctx.rho(level, pos);
if (hist.count(this_block) > 0) {
borders[this_block] = borders[containing_prev_block] +
hist[containing_prev_block];
containing_prev_block = this_block;
}
// NB: The above calulcation produces _wrong_ border offsets
// for huffman codes that are one-shorter than the current level.
//
// Since those codes will not be used in the loop below, this does not
// produce wrong or out-of-bound accesses.
if (ContextType::compute_rho) {
ctx.set_rho(level - 1, pos - 1, prev_block >> 1);
}
}
// The number of 0s is the position of the first 1 in the previous level
if constexpr (ContextType::compute_zeros) {
ctx.zeros()[level - 1] = borders[1];
}
}
for (uint64_t i = 0; i < size; ++i) {
const code_pair cp = codes.encode_symbol(text[i]);
for (uint64_t level = cp.code_length() - 1;
level > ContextType::MAX_UPPER_LEVELS; --level) {
auto&& borders = ctx.lower_borders_at_level(level);
auto const [prefix, bit] = cp.prefix_bit(level);
uint64_t const pos = borders[prefix]++;
uint64_t const word_pos = 63ULL - (pos & 63ULL);
bv[level][pos >> 6] |= (bit << word_pos);
}
for (uint64_t level = std::min(cp.code_length() - 1,
ContextType::MAX_UPPER_LEVELS);
level > 0; --level) {
auto&& borders = ctx.upper_borders_at_level(level);
auto const [prefix, bit] = cp.prefix_bit(level);
uint64_t const pos = borders[prefix]++;
uint64_t const word_pos = 63ULL - (pos & 63ULL);
bv[level][pos >> 6] |= (bit << word_pos);
}
}
}
/******************************************************************************/
| 36.943548 | 80 | 0.591356 | kurpicz |
aa0d16b316f39f58a5dab58ad876890c8a9ff8fb | 260 | cpp | C++ | Game_PC/src/Butterfly.cpp | neuroprod/omniBotProto | 5abf1b5a9846ba093325af7a86ee2d7b8cbe12e6 | [
"MIT"
] | 46 | 2017-03-03T20:34:23.000Z | 2021-11-07T02:37:44.000Z | Game_PC/src/Butterfly.cpp | neuroprod/omniBotProto | 5abf1b5a9846ba093325af7a86ee2d7b8cbe12e6 | [
"MIT"
] | null | null | null | Game_PC/src/Butterfly.cpp | neuroprod/omniBotProto | 5abf1b5a9846ba093325af7a86ee2d7b8cbe12e6 | [
"MIT"
] | 18 | 2017-04-27T09:40:47.000Z | 2021-12-06T05:38:48.000Z | //
// Butterfly.cpp
// Game_PC
//
// Created by Kris Temmerman on 03/10/2017.
//
//
#include "Butterfly.hpp"
using namespace ci;
using namespace ci::app;
using namespace std;
ButterflyRef Butterfly::create()
{
return make_shared<Butterfly>();
}
| 11.304348 | 44 | 0.673077 | neuroprod |
aa0d4c62fb4fbeea8276640c7d4a8f8b991cfdec | 307,905 | cpp | C++ | multimedia/dshow/mfvideo/mswebdvd/msdvd.cpp | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | multimedia/dshow/mfvideo/mswebdvd/msdvd.cpp | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | multimedia/dshow/mfvideo/mswebdvd/msdvd.cpp | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | /*************************************************************************/
/* Copyright (C) 1999 Microsoft Corporation */
/* File: msdvd.cpp */
/* Description: Implementation of CMSWebDVD. */
/* Author: David Janecek */
/*************************************************************************/
#include "stdafx.h"
#include "MSDVD.h"
#include "resource.h"
#include <mpconfig.h>
#include <il21dec.h> // line 21 decoder
#include <commctrl.h>
#include "ThunkProc.h"
#include "ddrawobj.h"
#include "stdio.h"
/*************************************************************************/
/* Local constants and defines */
/*************************************************************************/
const DWORD cdwDVDCtrlFlags = DVD_CMD_FLAG_Block| DVD_CMD_FLAG_Flush;
const DWORD cdwMaxFP_DOMWait = 30000; // 30sec for FP_DOM passing should be OK
const LONG cgStateTimeout = 0; // wait till the state transition occurs
// modify if needed
const LONG cgDVD_MIN_SUBPICTURE = 0;
const LONG cgDVD_MAX_SUBPICTURE = 31;
const LONG cgDVD_ALT_SUBPICTURE = 63;
const LONG cgDVD_MIN_ANGLE = 0;
const LONG cgDVD_MAX_ANGLE = 9;
const double cgdNormalSpeed = 1.00;
const LONG cgDVDMAX_TITLE_COUNT = 99;
const LONG cgDVDMIN_TITLE_COUNT = 1;
const LONG cgDVDMAX_CHAPTER_COUNT = 999;
const LONG cgDVDMIN_CHAPTER_COUNT = 1;
const LONG cgTIME_STRING_LEN = 2;
const LONG cgMAX_DELIMITER_LEN = 4;
const LONG cgDVD_TIME_STR_LEN = (3*cgMAX_DELIMITER_LEN)+(4*cgTIME_STRING_LEN) + 1 /*NULL Terminator*/;
const LONG cgVOLUME_MAX = 0;
const LONG cgVOLUME_MIN = -10000;
const LONG cgBALANCE_MIN = -10000;
const LONG cgBALANCE_MAX = 10000;
const WORD cgWAVE_VOLUME_MIN = 0;
const WORD cgWAVE_VOLUME_MAX = 0xffff;
const DWORD cdwTimeout = 10; //100
const LONG cgnStepTimeout = 100;
#define EC_DVD_PLAYING (EC_DVDBASE + 0xFE)
#define EC_DVD_PAUSED (EC_DVDBASE + 0xFF)
#define E_NO_IDVD2_PRESENT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFF0)
#define E_REGION_CHANGE_FAIL MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFF1)
#define E_NO_DVD_VOLUME MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFF3)
#define E_REGION_CHANGE_NOT_COMPLETED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFF4)
#define E_NO_SOUND_STREAM MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFF5)
#define E_NO_VIDEO_STREAM MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFF6)
#define E_NO_OVERLAY MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFF7)
#define E_NO_USABLE_OVERLAY MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFF8)
#define E_NO_DECODER MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFF9)
#define E_NO_CAPTURE_SUPPORT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFFA)
#define DVD_ERROR_NoSubpictureStream 99
#if WINVER < 0x0500
typedef struct tagCURSORINFO
{
DWORD cbSize;
DWORD flags;
HCURSOR hCursor;
POINT ptScreenPos;
} CURSORINFO, *PCURSORINFO, *LPCURSORINFO;
#define CURSOR_SHOWING 0x00000001
static BOOL (WINAPI *pfnGetCursorInfo)(PCURSORINFO);
typedef BOOL (WINAPI *PFNGETCURSORINFOHANDLE)(PCURSORINFO);
HRESULT CallGetCursorInfo(PCURSORINFO pci)
{
HRESULT hr = E_FAIL;
HINSTANCE hinstDll = ::LoadLibrary(TEXT("USER32.DLL"));
if (hinstDll)
{
pfnGetCursorInfo = (PFNGETCURSORINFOHANDLE)GetProcAddress(hinstDll, "GetCursorInfo");
if (pfnGetCursorInfo)
{
hr = pfnGetCursorInfo(pci);
}
FreeLibrary(hinstDll);
}
return hr;
}
#endif
GUID IID_IAMSpecifyDDrawConnectionDevice = {
0xc5265dba,0x3de3,0x4919,{0x94,0x0b,0x5a,0xc6,0x61,0xc8,0x2e,0xf4}};
extern CComModule _Module;
/*************************************************************************/
/* Global Helper Functions */
/*************************************************************************/
// helper function for converting a captured YUV image to RGB
// and saving to file.
extern HRESULT GDIConvertImageAndSave(YUV_IMAGE *lpImage, RECT *prc, HWND hwnd);
extern HRESULT ConvertImageAndSave(YUV_IMAGE *lpImage, RECT *prc, HWND hwnd);
// Helper function to calcuate max common denominator
long MCD(long i, long j) {
if (i == j)
return i;
else if (i>j) {
if (i%j == 0)
return j;
else
return MCD(i%j, j);
}
else {
if (j%i == 0)
return i;
else
return MCD(j%i, i);
}
}
/////////////////////////////////////////////////////////////////////////////
// CMSWebDVD
/*************************************************************************/
/* General initialization methods */
/*************************************************************************/
/*************************************************************************/
/* Function: CMSWebDVD */
/*************************************************************************/
CMSWebDVD::CMSWebDVD(){
Init();
}/* end of function CMSWebDVD */
/*************************************************************************/
/* Function: ~CMSWebDVD */
/*************************************************************************/
CMSWebDVD::~CMSWebDVD(){
// if we haven't been rendered or already been cleaned up
if (!m_fInitialized){
return;
}/* end of if statement */
Stop();
Cleanup();
Init();
ATLTRACE(TEXT("Inside the MSWEBDVD DESTRUCTOR!!\n"));
}/* end of function ~CMSWebDVD */
/*************************************************************************/
/* Function: Init */
/*************************************************************************/
VOID CMSWebDVD::Init(){
#if 1 // switch this to have the windowless case to be the deafult handling case
m_bWindowOnly = TRUE; // turn on and off window only implementation
m_fUseDDrawDirect = false;
#else
m_bWindowOnly = FALSE;
m_fUseDDrawDirect = true;
#endif
m_lChapter = m_lTitle = 1;
m_lChapterCount = NO_STOP;
m_clrColorKey = UNDEFINED_COLORKEY_COLOR;
m_nReadyState = READYSTATE_LOADING;
m_bMute = FALSE;
m_lLastVolume = 0;
m_fEnableResetOnStop = FALSE; // TRUE
m_clrBackColor = DEFAULT_BACK_COLOR; // off black used as a default key value to avoid flashing
#if 1
m_nTTMaxWidth = 200;
m_hWndTip = NULL;
m_bTTCreated = FALSE;
#endif
m_fInitialized = false;
m_hFPDOMEvent = NULL;
m_fDisableAutoMouseProcessing = false;
m_bEjected = false;
m_fStillOn = false;
m_nCursorType = dvdCursor_Arrow;
m_pClipRect = NULL;
m_bMouseDown = FALSE;
m_hCursor = ::LoadCursor(NULL, MAKEINTRESOURCE(OCR_ARROW_DEFAULT));
m_dZoomRatio = 1;
m_hWndOuter = NULL;
::ZeroMemory(&m_rcOldPos, sizeof(RECT));
m_hTimerId = NULL;
m_fResetSpeed = true;
m_DVDFilterState = dvdState_Undefined;
m_lKaraokeAudioPresentationMode = 0;
m_dwTTInitalDelay = 10;
m_dwTTReshowDelay = 2;
m_dwTTAutopopDelay = 10000;
m_pDDrawDVD = NULL;
m_dwNumDevices = 0;
m_lpInfo = NULL;
m_lpCurMonitor = NULL;
m_MonitorWarn = FALSE;
::ZeroMemory(&m_ClipRectDown, sizeof(RECT));
m_fStepComplete = false;
m_bFireUpdateOverlay = FALSE;
m_dwAspectX = 1;
m_dwAspectY = 1;
m_dwVideoWidth = 1;
m_dwVideoHeight =1;
// default overlay stretch factor x1000
m_dwOvMaxStretch = 32000;
m_bFireNoSubpictureStream = FALSE;
// flags for caching decoder flags
m_fBackWardsFlagInitialized = false;
m_fCanStepBackwards = false;
}/* end of function Init */
/*************************************************************************/
/* Function: Cleanup */
/* Description: Releases all the interfaces. */
/*************************************************************************/
VOID CMSWebDVD::Cleanup(){
m_mediaHandler.Close();
if (m_pME){
m_pME->SetNotifyWindow(NULL, WM_DVDPLAY_EVENT, 0) ;
m_pME.Release() ;
}/* end of if statement */
if(NULL != m_hTimerId){
::KillTimer(NULL, m_hTimerId);
}/* end of if statement */
if(NULL != m_hFPDOMEvent){
::CloseHandle(m_hFPDOMEvent);
m_hFPDOMEvent = NULL;
}/* end of if statement */
m_pAudio.Release();
m_pMediaSink.Release();
m_pDvdInfo2.Release();
m_pDvdCtl2.Release();
m_pMC.Release();
m_pVideoFrameStep.Release();
m_pGB.Release();
m_pDvdGB.Release();
m_pDDEX.Release();
m_pDvdAdmin.Release();
if (m_hCursor != NULL) {
::DestroyCursor(m_hCursor);
}/* end of if statement */
if(NULL != m_pDDrawDVD){
delete m_pDDrawDVD;
m_pDDrawDVD = NULL;
}/* end of if statement */
if(NULL != m_lpInfo){
::CoTaskMemFree(m_lpInfo);
m_lpInfo = NULL;
}/* end of if statement */
::ZeroMemory(&m_rcOldPos, sizeof(RECT));
}/* end of function Cleanup */
/*************************************************************************/
/* "ActiveX" methods needed to support our interfaces */
/*************************************************************************/
/*************************************************************************/
/* Function: OnDraw */
/* Description: Just Draws the rectangular background. */
/*************************************************************************/
HRESULT CMSWebDVD::OnDraw(ATL_DRAWINFO& di){
try {
if(!m_bWndLess && m_fInitialized){
// have to draw background only if in windowless mode or if we are not rendered yet
// Get the active movie window
HWND hwnd = ::GetWindow(m_hWnd, GW_CHILD);
if (!::IsWindow(hwnd)){
return S_OK;
}/* end of if statement */
if(::IsWindowVisible(hwnd)){
return S_OK;
}/* end of if statement */
}/* end of if statement */
HDC hdc = di.hdcDraw;
// Not used for now
// bool fHandled = true;
// Paint backcolor first
COLORREF clr;
::OleTranslateColor(m_clrBackColor, NULL, &clr);
RECT rcClient = *(RECT*)di.prcBounds;
HBRUSH hbrush = ::CreateSolidBrush(clr);
if(NULL != hbrush){
HBRUSH oldBrush = (HBRUSH)::SelectObject(hdc, hbrush);
::Rectangle(hdc, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
//ATLTRACE(TEXT("BackColor, %d %d %d %d\n"), rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
::SelectObject(hdc, oldBrush);
::DeleteObject(hbrush);
hbrush = NULL;
}/* end of if statement */
// Paint color key in the video area
if(NULL == m_pDDrawDVD){
return(S_OK);
}/* end of if statement */
if(SUCCEEDED(AdjustDestRC())){
RECT rcVideo = m_rcPosAspectRatioAjusted;
rcVideo.left = rcClient.left+(RECTWIDTH(&rcClient)-RECTWIDTH(&rcVideo))/2;
rcVideo.top = rcClient.top+(RECTHEIGHT(&rcClient)-RECTHEIGHT(&rcVideo))/2;
rcVideo.right = rcVideo.left + RECTWIDTH(&rcVideo);
rcVideo.bottom = rcVideo.top + RECTHEIGHT(&rcVideo);
m_clrColorKey = m_pDDrawDVD->GetColorKey();
#if 1
hbrush = ::CreateSolidBrush(::GetNearestColor(hdc, m_clrColorKey));
#else
m_pDDrawDVD->CreateDIBBrush(m_clrColorKey, &hbrush);
#endif
if(NULL != hbrush){
HBRUSH oldBrush = (HBRUSH)::SelectObject(hdc, hbrush);
::Rectangle(hdc, rcVideo.left, rcVideo.top, rcVideo.right, rcVideo.bottom);
//ATLTRACE(TEXT("ColorKey, %d %d %d %d\n"), rcVideo.left, rcVideo.top, rcVideo.right, rcVideo.bottom);
::SelectObject(hdc, oldBrush);
::DeleteObject(hbrush);
hbrush = NULL;
}/* end of if statement */
}/* end of if statement */
// in case we have a multimon we need to draw our warning
HandleMultiMonPaint(hdc);
}/* end of try statement statement */
catch(...){
return(0);
}/* end of catch statement */
return(1);
}/* end of function OnDraw */
#ifdef _WMP
/*************************************************************************/
/* Function: InPlaceActivate */
/* Description: Modified InPlaceActivate so WMP can startup. */
/*************************************************************************/
HRESULT CMSWebDVD::InPlaceActivate(LONG iVerb, const RECT* /*prcPosRect*/){
HRESULT hr;
if (m_spClientSite == NULL)
return S_OK;
CComPtr<IOleInPlaceObject> pIPO;
ControlQueryInterface(IID_IOleInPlaceObject, (void**)&pIPO);
ATLASSERT(pIPO != NULL);
if (!m_bNegotiatedWnd)
{
if (!m_bWindowOnly)
// Try for windowless site
hr = m_spClientSite->QueryInterface(IID_IOleInPlaceSiteWindowless, (void **)&m_spInPlaceSite);
if (m_spInPlaceSite)
{
m_bInPlaceSiteEx = TRUE;
// CanWindowlessActivate returns S_OK or S_FALSE
if ( m_spInPlaceSite->CanWindowlessActivate() == S_OK )
{
m_bWndLess = TRUE;
m_bWasOnceWindowless = TRUE;
}
else
{
m_bWndLess = FALSE;
}
}
else
{
m_spClientSite->QueryInterface(IID_IOleInPlaceSiteEx, (void **)&m_spInPlaceSite);
if (m_spInPlaceSite)
m_bInPlaceSiteEx = TRUE;
else
hr = m_spClientSite->QueryInterface(IID_IOleInPlaceSite, (void **)&m_spInPlaceSite);
}
}
ATLASSERT(m_spInPlaceSite);
if (!m_spInPlaceSite)
return E_FAIL;
m_bNegotiatedWnd = TRUE;
if (!m_bInPlaceActive)
{
BOOL bNoRedraw = FALSE;
if (m_bWndLess)
m_spInPlaceSite->OnInPlaceActivateEx(&bNoRedraw, ACTIVATE_WINDOWLESS);
else
{
if (m_bInPlaceSiteEx)
m_spInPlaceSite->OnInPlaceActivateEx(&bNoRedraw, 0);
else
{
hr = m_spInPlaceSite->CanInPlaceActivate();
// CanInPlaceActivate returns S_FALSE or S_OK
if (FAILED(hr))
return hr;
if ( hr != S_OK )
{
// CanInPlaceActivate returned S_FALSE.
return( E_FAIL );
}
m_spInPlaceSite->OnInPlaceActivate();
}
}
}
m_bInPlaceActive = TRUE;
// get location in the parent window,
// as well as some information about the parent
//
OLEINPLACEFRAMEINFO frameInfo;
RECT rcPos, rcClip;
CComPtr<IOleInPlaceFrame> spInPlaceFrame;
CComPtr<IOleInPlaceUIWindow> spInPlaceUIWindow;
frameInfo.cb = sizeof(OLEINPLACEFRAMEINFO);
HWND hwndParent;
// DJ - GetParentHWND per MNnovak
if (SUCCEEDED( GetParentHWND(&hwndParent) ))
{
m_spInPlaceSite->GetWindowContext(&spInPlaceFrame,
&spInPlaceUIWindow, &rcPos, &rcClip, &frameInfo);
if (!m_bWndLess)
{
if (m_hWndCD)
{
::ShowWindow(m_hWndCD, SW_SHOW);
if (!::IsChild(m_hWndCD, ::GetFocus()))
::SetFocus(m_hWndCD);
}
else
{
HWND h = CreateControlWindow(hwndParent, rcPos);
ATLASSERT(h != NULL); // will assert if creation failed
ATLASSERT(h == m_hWndCD);
h; // avoid unused warning
}
}
pIPO->SetObjectRects(&rcPos, &rcClip);
}
CComPtr<IOleInPlaceActiveObject> spActiveObject;
ControlQueryInterface(IID_IOleInPlaceActiveObject, (void**)&spActiveObject);
// Gone active by now, take care of UIACTIVATE
if (DoesVerbUIActivate(iVerb))
{
if (!m_bUIActive)
{
m_bUIActive = TRUE;
hr = m_spInPlaceSite->OnUIActivate();
if (FAILED(hr))
return hr;
SetControlFocus(TRUE);
// set ourselves up in the host.
//
if (spActiveObject)
{
if (spInPlaceFrame)
spInPlaceFrame->SetActiveObject(spActiveObject, NULL);
if (spInPlaceUIWindow)
spInPlaceUIWindow->SetActiveObject(spActiveObject, NULL);
}
if (spInPlaceFrame)
spInPlaceFrame->SetBorderSpace(NULL);
if (spInPlaceUIWindow)
spInPlaceUIWindow->SetBorderSpace(NULL);
}
}
m_spClientSite->ShowObject();
return S_OK;
}/* end of function InPlaceActivate */
#endif
/*************************************************************************/
/* Function: InterfaceSupportsErrorInfo */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::InterfaceSupportsErrorInfo(REFIID riid){
static const IID* arr[] = {
&IID_IMSWebDVD,
};
for (int i=0; i<sizeof(arr)/sizeof(arr[0]); i++){
if (InlineIsEqualGUID(*arr[i], riid))
return S_OK;
}/* end of for loop */
return S_FALSE;
}/* end of function InterfaceSupportsErrorInfo */
/*************************************************************************/
/* Function: OnSize */
/*************************************************************************/
LRESULT CMSWebDVD::OnSize(UINT uMsg, WPARAM /* wParam */,
LPARAM lParam, BOOL& bHandled){
#ifdef _DEBUG
if (WM_SIZING == uMsg) {
//ATLTRACE(TEXT("WM_SIZING\n"));
}
#endif
if(m_pDvdGB == NULL){
return(0);
}/* end of if statement */
if (m_bWndLess || m_fUseDDrawDirect){
OnResize();
}
else {
IVideoWindow* pVW;
HRESULT hr = m_pDvdGB->GetDvdInterface(IID_IVideoWindow, (LPVOID *)&pVW) ;
if (SUCCEEDED(hr)){
LONG nWidth = LOWORD(lParam); // width of client area
LONG nHeight = HIWORD(lParam); // height of client area
hr = pVW->SetWindowPosition(0, 0, nWidth, nHeight);
pVW->Release();
}/* end of if statement */
}/* end of if statement */
bHandled = TRUE;
return(0);
}/* end of function OnSize */
/*************************************************************************/
/* Function: OnResize */
/* Description: Handles the resizing and moving in windowless case. */
/*************************************************************************/
HRESULT CMSWebDVD::OnResize(){
HRESULT hr = S_FALSE;
if (m_bWndLess || m_fUseDDrawDirect){
RECT rc;
hr = GetClientRectInScreen(&rc);
if(FAILED(hr)){
return(hr);
}/* end of if statement */
if(m_pDDEX){
hr = m_pDDEX->SetDrawParameters(m_pClipRect, &rc);
//ATLTRACE(TEXT("SetDrawParameters\n"));
}/* end of if statement */
HandleMultiMonMove();
}/* end of if statement */
return(hr);
}/* end of function OnResize */
/*************************************************************************/
/* Function: OnErase */
/* Description: Skip the erasing to avoid flickers. */
/*************************************************************************/
LRESULT CMSWebDVD::OnErase(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled){
bHandled = TRUE;
return 1;
}/* end of function OnErase */
/*************************************************************************/
/* Function: OnCreate */
/* Description: Sets our state to complete so we can proceed in */
/* in initialization. */
/*************************************************************************/
LRESULT CMSWebDVD::OnCreate(UINT /* uMsg */, WPARAM /* wParam */,
LPARAM lParam, BOOL& bHandled){
return(0);
}/* end of function OnCreate */
/*************************************************************************/
/* Function: OnDestroy */
/* Description: Sets our state to complete so we can proceed in */
/* in initialization. */
/*************************************************************************/
LRESULT CMSWebDVD::OnDestroy(UINT /* uMsg */, WPARAM /* wParam */,
LPARAM lParam, BOOL& bHandled){
// if we haven't been rendered
if (!m_fInitialized){
return 0;
}/* end of if statement */
Stop();
Cleanup();
Init();
return(0);
}/* end of function OnCreate */
/*************************************************************************/
/* Function: GetInterfaceSafetyOptions */
/* Description: For support of security model in IE */
/* This control is safe since it does not write to HD. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::GetInterfaceSafetyOptions(REFIID riid,
DWORD* pdwSupportedOptions,
DWORD* pdwEnabledOptions){
HRESULT hr = S_OK;
*pdwSupportedOptions = INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA;
*pdwEnabledOptions = *pdwSupportedOptions;
return(hr);
}/* end of function GetInterfaceSafetyOptions */
/*************************************************************************/
/* Function: SetInterfaceSafetyOptions */
/* Description: For support of security model in IE */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::SetInterfaceSafetyOptions(REFIID riid,
DWORD /* dwSupportedOptions */,
DWORD /* pdwEnabledOptions */){
return (S_OK);
}/* end of function SetInterfaceSafetyOptions */
/*************************************************************************/
/* Function: SetObjectRects */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::SetObjectRects(LPCRECT prcPos,LPCRECT prcClip){
#if 0
ATLTRACE(TEXT("Resizing control prcPos->left = %d, prcPos.right = %d, prcPos.bottom =%d, prcPos.top = %d\n"),
prcPos->left, prcPos->right, prcPos->bottom, prcPos->top);
ATLTRACE(TEXT("Resizing control Clip prcClip->left = %d, prcClip.right = %d, prcClip.bottom =%d, prcClip.top = %d\n"),
prcClip->left, prcClip->right, prcClip->bottom, prcClip->top);
#endif
HRESULT hr = IOleInPlaceObjectWindowlessImpl<CMSWebDVD>::SetObjectRects(prcPos,prcClip);
if(FAILED(hr)){
return(hr);
}/* end of if statement */
if(!::IsWindow(m_hWnd)){
hr = OnResize(); // need to update DDraw destination rectangle
}/* end of if statement */
return(hr);
}/* end of function SetObjectRects */
/*************************************************************************/
/* Function: GetParentHWND */
/* Description: Gets the parent window HWND where we are operating. */
/*************************************************************************/
HRESULT CMSWebDVD::GetParentHWND(HWND* pWnd){
HRESULT hr = S_OK;
IOleClientSite *pClientSite;
IOleContainer *pContainer;
IOleObject *pObject;
hr = GetClientSite(&pClientSite);
if(FAILED(hr)){
return(hr);
}/* end of if statement */
IOleWindow *pOleWindow;
do {
hr = pClientSite->QueryInterface(IID_IOleWindow, (LPVOID *) &pOleWindow);
if(FAILED(hr)){
return(hr);
}/* end of if statement */
hr = pOleWindow->GetWindow((HWND*)pWnd);
pOleWindow->Release();
// if pClientSite is windowless, go get its container
if (FAILED(hr)) {
HRESULT hrTemp = pClientSite->GetContainer(&pContainer);
if(FAILED(hrTemp)){
return(hrTemp);
}/* end of if statement */
pClientSite->Release();
hrTemp = pContainer->QueryInterface(IID_IOleObject, (LPVOID*)&pObject);
if(FAILED(hrTemp)){
return(hrTemp);
}/* end of if statement */
pContainer->Release();
hrTemp = pObject->GetClientSite(&pClientSite);
if(FAILED(hrTemp)){
return(hrTemp);
}/* end of if statement */
}
} while (FAILED(hr));
pClientSite->Release();
return(hr);
}/* end of function GetParentHWND */
/*************************************************************************/
/* Function: SetReadyState */
/* Description: Sets ready state and fires event if it needs to be fired */
/*************************************************************************/
HRESULT CMSWebDVD::SetReadyState(LONG lReadyState){
HRESULT hr = S_OK;
bool bFireEvent = (lReadyState != m_nReadyState);
#ifdef _DEBUG
if(m_nFreezeEvents > 0){
::Sleep(10);
ATLTRACE("Container not expecting events at the moment");
}/* end of is statement */
#endif
if(bFireEvent){
put_ReadyState(lReadyState);
Fire_ReadyStateChange(lReadyState);
}
else {
// set the variable
m_nReadyState = lReadyState;
}/* end of if statement */
return(hr);
}/* end of function SetReadyState */
/*************************************************************************/
/* DVD methods to do with supporting DVD Playback */
/*************************************************************************/
/*************************************************************************/
/* Function: Render */
/* Description: Builds Graph. */
/* lRender not used in curent implemetation, but might be used in the */
/* future to denote different mode of initializations. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::Render(long lRender){
USES_CONVERSION;
HRESULT hr = S_OK;
try {
//throw(E_NO_DECODER);
if(m_fInitialized && ((dvdRender_Reinitialize & lRender) != dvdRender_Reinitialize)){
ATLTRACE(TEXT("Graph was already initialized\n"));
throw(S_FALSE);
}/* end of if statement */
Cleanup(); // release all the interfaces so we start from ground up
//Init(); // initialize the variables
m_fInitialized = false; // set the flag that we are not initialized in
// case if something goes wrong
// create an event that lets us know we are past FP_DOM
m_hFPDOMEvent = ::CreateEvent(NULL, TRUE, FALSE, NULL);
ATLASSERT(m_hFPDOMEvent);
hr = ::CoCreateInstance(CLSID_DvdGraphBuilder, NULL, CLSCTX_INPROC,
IID_IDvdGraphBuilder, (LPVOID *)&m_pDvdGB) ;
if (FAILED(hr) || !m_pDvdGB){
#ifdef _DEBUG
::MessageBox(::GetFocus(), TEXT("DirectShow DVD software not installed properly.\nPress OK to end the app."),
TEXT("Error"), MB_OK | MB_ICONSTOP) ;
#endif
throw(hr);
}/* end of if statement */
/* Force NonExclMode (in other words: use Overlay Mixer and NOT VMR) */
GUID IID_IDDrawNonExclModeVideo = {0xec70205c,0x45a3,0x4400,{0xa3,0x65,0xc4,0x47,0x65,0x78,0x45,0xc7}};
// Set DDraw object and surface on DVD graph builder before starting to build graph
hr = m_pDvdGB->GetDvdInterface(IID_IDDrawNonExclModeVideo, (LPVOID *)&m_pDDEX) ;
if (FAILED(hr) || !m_pDDEX){
ATLTRACE(TEXT("ERROR: IDvdGB::GetDvdInterface(IDDrawExclModeVideo) \n"));
ATLTRACE(TEXT("The QDVD.DLL does not support IDvdInfo2 or IID_IDvdControl2, please update QDVD.DLL\n"));
throw(E_NO_IDVD2_PRESENT);
}/* end of if statement */
if (m_bWndLess || m_fUseDDrawDirect){
hr = SetupDDraw();
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = m_pDDrawDVD->HasOverlay();
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
if(S_FALSE == hr){
throw(E_NO_OVERLAY);
}/* end of if statement */
hr = m_pDDrawDVD->HasAvailableOverlay();
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = m_pDDrawDVD->GetOverlayMaxStretch(&m_dwOvMaxStretch);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
if(S_FALSE == hr){
throw(E_NO_USABLE_OVERLAY);
}/* end of if statement */
hr = m_pDDEX->SetDDrawObject(m_pDDrawDVD->GetDDrawObj());
if (FAILED(hr)){
ATLTRACE(TEXT("ERROR: IDDrawExclModeVideo::SetDDrawObject()"));
m_pDDEX.Release() ; // release before returning
throw(hr);
}/* end of if statement */
hr = m_pDDEX->SetDDrawSurface(m_pDDrawDVD->GetDDrawSurf()); // have to set the surface if NOT the IDDExcl complains
if (FAILED(hr)){
m_pDDEX.Release() ; // release before returning
throw(hr);
}/* end of if statement */
//OnResize(); // set the DDRAW RECTS, we are doing it in the thread
#if 1
hr = m_pDDEX->SetCallbackInterface(m_pDDrawDVD->GetCallbackInterface(), 0) ;
if (FAILED(hr))
{
throw(hr);
}/* end of it statement */
#endif
}/* end of if statement */
DWORD dwRenderFlag = AM_DVD_HWDEC_PREFER; // use the hardware if possible
AM_DVD_RENDERSTATUS amDvdStatus;
//Completes building a filter graph according to user specifications for
// playing back a default DVD-Video volume
hr = m_pDvdGB->RenderDvdVideoVolume(NULL, dwRenderFlag, &amDvdStatus);
if (FAILED(hr)){
#ifdef _DEBUG
TCHAR strError[1000];
AMGetErrorText(hr, strError, sizeof(strError)) ;
::MessageBox(::GetFocus(), strError, TEXT("Error"), MB_OK) ;
#endif
if(VFW_E_DVD_DECNOTENOUGH == hr){
throw(E_NO_DECODER);
}/* end of if statement */
throw(hr);
}/* end of if statement */
HRESULT hrTmp = m_pDvdGB->GetDvdInterface(IID_IDvdControl2, (LPVOID *)&m_pDvdCtl2) ;
if(FAILED(hrTmp)){
ATLTRACE(TEXT("The QDVD.DLL does not support IDvdInfo2 or IID_IDvdControl2, please update QDVD.DLL\n"));
throw(E_NO_IDVD2_PRESENT);
}/* end of if statement */
if (hr == S_FALSE){ // if partial success
if((dvdRender_Error_On_Missing_Drive & lRender) && amDvdStatus.bDvdVolInvalid || amDvdStatus.bDvdVolUnknown){
#if 0
TCHAR filename[MAX_PATH];
if (OpenIFOFile(::GetDesktopWindow(), filename)){
USES_CONVERSION;
if(!m_pDvdCtl2){
throw (E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdCtl2->SetDVDDirectory(T2W(filename));
}
else{
hr = E_NO_DVD_VOLUME;
}/* end of if statement */
#else
hr = E_NO_DVD_VOLUME;
#endif
if(FAILED(hr)){
throw(E_NO_DVD_VOLUME);
}/* end of if statement */
}/* end of if statement */
// improve your own error handling
if(amDvdStatus.bNoLine21Out != NULL){ // we do not care about the caption
#ifdef _DEBUG
if (::MessageBox(::GetFocus(), TEXT(" Line 21 has failed Do you still want to continue?"), TEXT("Warning"), MB_YESNO) == IDNO){
throw(E_FAIL);
}/* end of if statement */
#endif
}/* end of if statement */
if((amDvdStatus.iNumStreamsFailed > 0) && ((amDvdStatus.dwFailedStreamsFlag & AM_DVD_STREAM_VIDEO) == AM_DVD_STREAM_VIDEO)){
throw(E_NO_VIDEO_STREAM);
}/* end of if statement */
// handeling this below
if((amDvdStatus.iNumStreamsFailed > 0) && ((amDvdStatus.dwFailedStreamsFlag & AM_DVD_STREAM_SUBPIC) == AM_DVD_STREAM_SUBPIC)){
#if 0
TCHAR strBuffer1[MAX_PATH];
if(!::LoadString(_Module.m_hInstResource, IDS_E_NO_SUBPICT_STREAM, strBuffer1, MAX_PATH)){
throw(E_UNEXPECTED);
}/* end of if statement */
TCHAR strBuffer2[MAX_PATH];
if(!::LoadString(_Module.m_hInstResource, IDS_WARNING, strBuffer2, MAX_PATH)){
throw(E_UNEXPECTED);
}/* end of if statement */
::MessageBox(::GetFocus(), strBuffer1, strBuffer2, MB_OK);
#else
// Will bubble up the error to the app
m_bFireNoSubpictureStream = TRUE;
#endif
}/* end of if statement */
}/* end of if statement */
// Now get all the interfaces to playback the DVD-Video volume
hr = m_pDvdGB->GetFiltergraph(&m_pGB) ;
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = m_pGB->QueryInterface(IID_IMediaControl, (LPVOID *)&m_pMC) ;
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = m_pGB->QueryInterface(IID_IVideoFrameStep, (LPVOID *)&m_pVideoFrameStep);
if(FAILED(hr)){
// do not bail out, since frame stepping is not that important
ATLTRACE(TEXT("Frame stepping QI failed"));
ATLASSERT(FALSE);
}/* end of if statement */
hr = m_pGB->QueryInterface(IID_IMediaEventEx, (LPVOID *)&m_pME) ;
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
IVideoWindow* pVW = NULL;
if (!m_bWndLess){
//
// Also set up the event notification so that the main window gets
// informed about all that we care about during playback.
//
// HAVE THREAD !!!
INT iCount = 0;
while(m_hWnd == NULL){
if(iCount >10) break;
::Sleep(100);
iCount ++;
}/* end of while loop */
if(m_hWnd == NULL){
ATLTRACE(TEXT("Window is not active as of yet\n returning with E_PENDING\n"));
hr = E_PENDING;
throw(hr);
}/* end of if statement */
hr = m_pME->SetNotifyWindow((OAHWND) m_hWnd, WM_DVDPLAY_EVENT, 0);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
if(!m_fUseDDrawDirect){
hr = m_pDvdGB->GetDvdInterface(IID_IVideoWindow, (LPVOID *)&pVW) ;
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = pVW->put_MessageDrain((OAHWND)m_hWnd); // get our mouse messages over
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
}/* end of if statement */
}
else {
// create the timer which will keep us updated
m_hTimerId = ::SetTimer(NULL, 0, cdwTimeout, GetTimerProc());
}/* end of if statement */
hr = m_pDvdGB->GetDvdInterface(IID_IDvdInfo2, (LPVOID *)&m_pDvdInfo2) ;
if(FAILED(hr)){
ATLTRACE(TEXT("The QDVD.DLL does not support IDvdInfo2 or IID_IDvdControl2, please update QDVD.DLL\n"));
throw(E_NO_IDVD2_PRESENT);
}/* end of if statement */
hr = SetupAudio();
if(FAILED(hr)){
#if 1
throw(E_NO_SOUND_STREAM);
#else
TCHAR strBuffer1[MAX_PATH];
if(!::LoadString(_Module.m_hInstResource, IDS_E_NO_SOUND_STREAM, strBuffer1, MAX_PATH)){
throw(E_UNEXPECTED);
}/* end of if statement */
TCHAR strBuffer2[MAX_PATH];
if(!::LoadString(_Module.m_hInstResource, IDS_WARNING, strBuffer2, MAX_PATH)){
throw(E_UNEXPECTED);
}/* end of if statement */
::MessageBox(::GetFocus(), strBuffer1, strBuffer2, MB_OK);
#endif
}/* end of if statement */
hr = SetupEventNotifySink();
#ifdef _DEBUG
if(FAILED(hr)){
ATLTRACE(TEXT("Failed to setup event notify sink\n"));
}/* end of if statement */
#endif
if (!m_bWndLess && !m_fUseDDrawDirect){
// set the window position and style
hr = pVW->put_Owner((OAHWND)m_hWnd);
RECT rc;
::GetWindowRect(m_hWnd, &rc);
hr = pVW->SetWindowPosition(0, 0, WIDTH(&rc), HEIGHT(&rc));
LONG lStyle = GetWindowLong(GWL_STYLE);
hr = pVW->put_WindowStyle(lStyle);
lStyle = GetWindowLong(GWL_EXSTYLE);
hr = pVW->put_WindowStyleEx(lStyle);
pVW->Release();
}/* end of if statement */
bool fSetColorKey = false; // flag so we do not duplicate code, and simplify logic
// case when windowless and color key is not defined
// then in that case get the color key from the OV mixer
if(m_bWndLess || m_fUseDDrawDirect){
COLORREF clr;
hrTmp = GetColorKey(&clr);
if(FAILED(hrTmp)){
#ifdef _DEBUG
::MessageBox(::GetFocus(), TEXT("failed to get color key"), TEXT("error"), MB_OK);
#endif
throw(hrTmp);
}/* end of if statement */
if((m_clrColorKey & UNDEFINED_COLORKEY_COLOR) == UNDEFINED_COLORKEY_COLOR) {
m_clrColorKey = clr;
}/* end of if statement */
else if (clr != m_clrColorKey) {
fSetColorKey = true;
}
}/* end of if statement */
// case when color key is defined
// if windowless set the background color at the same time
if(fSetColorKey){
hrTmp = put_ColorKey(m_clrColorKey);
#ifdef _DEBUG
if(FAILED(hrTmp)){
::MessageBox(::GetFocus(), TEXT("failed to set color key"), TEXT("error"), MB_OK);
throw(E_FAIL);
}/* end of if statement */
#endif
}/* end of if statement */
m_fInitialized = true;
// turn off the closed caption. it is turned on by default
// this code should be in the DVDNav!
put_CCActive(VARIANT_FALSE);
// Create the DVD administrator and set player level
m_pDvdAdmin = new CComObject<CMSDVDAdm>;
//m_pDvdAdmin.AddRef();
if(!m_pDvdAdmin){
return E_UNEXPECTED;
}
RestoreDefaultSettings();
// disc eject and insert handler
BSTR bstrRoot;
hr = get_DVDDirectory(&bstrRoot);
if (SUCCEEDED(hr)) {
TCHAR *szRoot;
szRoot = OLE2T(bstrRoot);
m_mediaHandler.SetDrive(szRoot[0] );
m_mediaHandler.SetDVD(this);
m_mediaHandler.Open();
}
hr = m_pDvdCtl2->SetOption( DVD_HMSF_TimeCodeEvents, TRUE);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function Render */
/*************************************************************************/
/* Function: Play */
/* Description: Puts the DVDNav in the run mode. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::Play(){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pMC){
throw(E_UNEXPECTED);
}/* end of if statement */
if(!m_pDvdCtl2 ){
throw(E_UNEXPECTED);
}/* end of if statement */
OAFilterState state;
hr = m_pMC->GetState(cgStateTimeout, &state);
m_DVDFilterState = (DVDFilterState) state; // save the state so we can restore it if an API fails
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
bool bFireEvent = false; // fire event only when we change the state
if(state != dvdState_Running){
bFireEvent = true;
// disable the stop in case CTRL+ALT+DEL
if(state == dvdState_Stopped){
if(FALSE == m_fEnableResetOnStop){
hr = m_pDvdCtl2->SetOption(DVD_ResetOnStop, FALSE);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
}/* end of if statement */
}/* end of if statement */
hr = m_pMC->Run(); // put it into running state just in case we are not in the running
// state
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
}/* end of if statement */
if(bFireEvent && m_pMediaSink){
m_pMediaSink->Notify(EC_DVD_PLAYING, 0, 0);
}/* end of if statement */
// not collect hr
#ifdef _DEBUG
if(m_fStillOn){
ATLTRACE(TEXT("Not reseting the speed to 1.0 \n"));
}/* end of if statement */
#endif
if(false == m_fStillOn && true == m_fResetSpeed){
// if we are in the still do not reset the speed
m_pDvdCtl2->PlayForwards(cgdNormalSpeed,0,0);
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function Play */
/*************************************************************************/
/* Function: Pause */
/* Description: Pauses the filter graph just only in the case when stat */
/* would not indicate that it was paused. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::Pause(){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pMC){
throw(E_UNEXPECTED);
}/* end of if statement */
OAFilterState state;
hr = m_pMC->GetState(cgStateTimeout, &state);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
bool bFireEvent = false; // fire event only when we change the state
if(state != dvdState_Paused){
bFireEvent = true;
hr = m_pMC->Pause(); // put it into running state just in case we are not in the running
// state
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
}/* end of if statement */
#if 1
// Fired our own paused event
if(bFireEvent && m_pMediaSink){
m_pMediaSink->Notify(EC_DVD_PAUSED, 0, 0);
}/* end of if statement */
#endif
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function Pause */
/*************************************************************************/
/* Function: Stop */
/* Description: Stops the filter graph if the state does not indicate */
/* it was stopped. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::Stop(){
HRESULT hr = S_OK;
try {
if(!m_pMC){
throw(E_UNEXPECTED);
}/* end of if statement */
if(!m_pDvdCtl2){
return(E_UNEXPECTED);
}/* end of if statement */
OAFilterState state;
hr = m_pMC->GetState(cgStateTimeout, &state);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
if(state != dvdState_Stopped){
if(FALSE == m_fEnableResetOnStop){
hr = m_pDvdCtl2->SetOption(DVD_ResetOnStop, TRUE);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
}/* end of if statement */
hr = m_pMC->Stop(); // put it into running state just in case we are not in the running
// state
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function Stop */
/*************************************************************************/
/* Function: OnDVDEvent */
/* Description: Handles the DVD events */
/*************************************************************************/
LRESULT CMSWebDVD::OnDVDEvent(UINT /* uMsg */, WPARAM wParam, LPARAM lParam, BOOL& bHandled){
if (m_bFireUpdateOverlay == TRUE) {
if (m_fInitialized) {
m_bFireUpdateOverlay = FALSE;
Fire_UpdateOverlay();
}
}
LONG lEvent ;
LONG_PTR lParam1, lParam2 ;
if (m_bFireNoSubpictureStream) {
m_bFireNoSubpictureStream = FALSE;
lEvent = EC_DVD_ERROR;
lParam1 = DVD_ERROR_NoSubpictureStream;
lParam2 = 0;
VARIANT varLParam1;
VARIANT varLParam2;
#ifdef _WIN64
varLParam1.llVal = lParam1;
varLParam1.vt = VT_I8;
varLParam2.llVal = lParam2;
varLParam2.vt = VT_I8;
#else
varLParam1.lVal = lParam1;
varLParam1.vt = VT_I4;
varLParam2.lVal = lParam2;
varLParam2.vt = VT_I4;
#endif
// fire the event now after we have processed it internally
Fire_DVDNotify(lEvent, varLParam1, varLParam2);
}
bHandled = TRUE;
//
// Because the message mode for IMediaEvent may not be set before
// we get the first event it's important to read all the events
// pending when we get a window message to say there are events pending.
// GetEvent() returns E_ABORT when no more event is left.
//
while (m_pME && SUCCEEDED(m_pME->GetEvent(&lEvent, &lParam1, &lParam2, 0))){
switch (lEvent){
//
// First the DVD error events
//
case EC_DVD_ERROR:
switch (lParam1){
case DVD_ERROR_Unexpected:
#ifdef _DEBUG
::MessageBox(::GetFocus(),
TEXT("An unexpected error (possibly incorrectly authored content)")
TEXT("\nwas encountered.")
TEXT("\nCan't playback this DVD-Video disc."),
TEXT("Error"), MB_OK | MB_ICONINFORMATION) ;
#endif
//m_pMC->Stop() ;
break ;
case DVD_ERROR_CopyProtectFail:
#ifdef _DEBUG
::MessageBox(::GetFocus(),
TEXT("Key exchange for DVD copy protection failed.")
TEXT("\nCan't playback this DVD-Video disc."),
TEXT("Error"), MB_OK | MB_ICONINFORMATION) ;
#endif
//m_pMC->Stop() ;
break ;
case DVD_ERROR_InvalidDVD1_0Disc:
#ifdef _DEBUG
::MessageBox(::GetFocus(),
TEXT("This DVD-Video disc is incorrectly authored for v1.0 of the spec.")
TEXT("\nCan't playback this disc."),
TEXT("Error"), MB_OK | MB_ICONINFORMATION) ;
#endif
//m_pMC->Stop() ;
break ;
case DVD_ERROR_InvalidDiscRegion:
#ifdef _DEBUG
::MessageBox(::GetFocus(),
TEXT("This DVD-Video disc cannot be played, because it is not")
TEXT("\nauthored to play in the current system region.")
TEXT("\nThe region mismatch may be fixed by changing the")
TEXT("\nsystem region (with DVDRgn.exe)."),
TEXT("Error"), MB_OK | MB_ICONINFORMATION) ;
#endif
Stop();
// fire the region change dialog
RegionChange();
break ;
case DVD_ERROR_LowParentalLevel:
#ifdef _DEBUG
::MessageBox(::GetFocus(),
TEXT("Player parental level is set lower than the lowest parental")
TEXT("\nlevel available in this DVD-Video content.")
TEXT("\nCannot playback this DVD-Video disc."),
TEXT("Error"), MB_OK | MB_ICONINFORMATION) ;
#endif
//m_pMC->Stop() ;
break ;
case DVD_ERROR_MacrovisionFail:
#ifdef _DEBUG
::MessageBox(::GetFocus(),
TEXT("This DVD-Video content is protected by Macrovision.")
TEXT("\nThe system does not satisfy Macrovision requirement.")
TEXT("\nCan't continue playing this disc."),
TEXT("Error"), MB_OK | MB_ICONINFORMATION) ;
#endif
//m_pMC->Stop() ;
break ;
case DVD_ERROR_IncompatibleSystemAndDecoderRegions:
#ifdef _DEBUG
::MessageBox(::GetFocus(),
TEXT("No DVD-Video disc can be played on this system, because ")
TEXT("\nthe system region does not match the decoder region.")
TEXT("\nPlease contact the manufacturer of this system."),
TEXT("Error"), MB_OK | MB_ICONINFORMATION) ;
#endif
//m_pMC->Stop() ;
break ;
case DVD_ERROR_IncompatibleDiscAndDecoderRegions:
#ifdef _DEBUG
::MessageBox(::GetFocus(),
TEXT("This DVD-Video disc cannot be played on this system, because it is")
TEXT("\nnot authored to be played in the installed decoder's region."),
TEXT("Error"), MB_OK | MB_ICONINFORMATION) ;
#endif
//m_pMC->Stop() ;
break ;
}/* end of switch case */
break ;
//
// Next the normal DVD related events
//
case EC_DVD_VALID_UOPS_CHANGE:
{
VALID_UOP_SOMTHING_OR_OTHER validUOPs = (DWORD) lParam1;
if (validUOPs&UOP_FLAG_Play_Title_Or_AtTime) {
Fire_PlayAtTimeInTitle(VARIANT_FALSE);
Fire_PlayAtTime(VARIANT_FALSE);
}
else {
Fire_PlayAtTimeInTitle(VARIANT_TRUE);
Fire_PlayAtTime(VARIANT_TRUE);
}
if (validUOPs&UOP_FLAG_Play_Chapter) {
Fire_PlayChapterInTitle(VARIANT_FALSE);
Fire_PlayChapter(VARIANT_FALSE);
}
else {
Fire_PlayChapterInTitle(VARIANT_TRUE);
Fire_PlayChapter(VARIANT_TRUE);
}
if (validUOPs&UOP_FLAG_Play_Title){
Fire_PlayTitle(VARIANT_FALSE);
}
else {
Fire_PlayTitle(VARIANT_TRUE);
}
if (validUOPs&UOP_FLAG_Stop)
Fire_Stop(VARIANT_FALSE);
else
Fire_Stop(VARIANT_TRUE);
if (validUOPs&UOP_FLAG_ReturnFromSubMenu)
Fire_ReturnFromSubmenu(VARIANT_FALSE);
else
Fire_ReturnFromSubmenu(VARIANT_TRUE);
if (validUOPs&UOP_FLAG_Play_Chapter_Or_AtTime) {
Fire_PlayAtTimeInTitle(VARIANT_FALSE);
Fire_PlayChapterInTitle(VARIANT_FALSE);
}
else {
Fire_PlayAtTimeInTitle(VARIANT_TRUE);
Fire_PlayChapterInTitle(VARIANT_TRUE);
}
if (validUOPs&UOP_FLAG_PlayPrev_Or_Replay_Chapter){
Fire_PlayPrevChapter(VARIANT_FALSE);
Fire_ReplayChapter(VARIANT_FALSE);
}
else {
Fire_PlayPrevChapter(VARIANT_TRUE);
Fire_ReplayChapter(VARIANT_TRUE);
}/* end of if statement */
if (validUOPs&UOP_FLAG_PlayNext_Chapter)
Fire_PlayNextChapter(VARIANT_FALSE);
else
Fire_PlayNextChapter(VARIANT_TRUE);
if (validUOPs&UOP_FLAG_Play_Forwards)
Fire_PlayForwards(VARIANT_FALSE);
else
Fire_PlayForwards(VARIANT_TRUE);
if (validUOPs&UOP_FLAG_Play_Backwards)
Fire_PlayBackwards(VARIANT_FALSE);
else
Fire_PlayBackwards(VARIANT_TRUE);
if (validUOPs&UOP_FLAG_ShowMenu_Title)
Fire_ShowMenu(dvdMenu_Title, VARIANT_FALSE);
else
Fire_ShowMenu(dvdMenu_Title, VARIANT_TRUE);
if (validUOPs&UOP_FLAG_ShowMenu_Root)
Fire_ShowMenu(dvdMenu_Root, VARIANT_FALSE);
else
Fire_ShowMenu(dvdMenu_Root, VARIANT_TRUE);
//TODO: Add the event for specific menus
if (validUOPs&UOP_FLAG_ShowMenu_SubPic)
Fire_ShowMenu(dvdMenu_Subpicture, VARIANT_FALSE);
else
Fire_ShowMenu(dvdMenu_Subpicture, VARIANT_TRUE);
if (validUOPs&UOP_FLAG_ShowMenu_Audio)
Fire_ShowMenu(dvdMenu_Audio, VARIANT_FALSE);
else
Fire_ShowMenu(dvdMenu_Audio, VARIANT_TRUE);
if (validUOPs&UOP_FLAG_ShowMenu_Angle)
Fire_ShowMenu(dvdMenu_Angle, VARIANT_FALSE);
else
Fire_ShowMenu(dvdMenu_Angle, VARIANT_TRUE);
if (validUOPs&UOP_FLAG_ShowMenu_Chapter)
Fire_ShowMenu(dvdMenu_Chapter, VARIANT_FALSE);
else
Fire_ShowMenu(dvdMenu_Chapter, VARIANT_TRUE);
if (validUOPs&UOP_FLAG_Resume)
Fire_Resume(VARIANT_FALSE);
else
Fire_Resume(VARIANT_TRUE);
if (validUOPs&UOP_FLAG_Select_Or_Activate_Button)
Fire_SelectOrActivatButton(VARIANT_FALSE);
else
Fire_SelectOrActivatButton(VARIANT_TRUE);
if (validUOPs&UOP_FLAG_Still_Off)
Fire_StillOff(VARIANT_FALSE);
else
Fire_StillOff(VARIANT_TRUE);
if (validUOPs&UOP_FLAG_Pause_On)
Fire_PauseOn(VARIANT_FALSE);
else
Fire_PauseOn(VARIANT_TRUE);
if (validUOPs&UOP_FLAG_Select_Audio_Stream)
Fire_ChangeCurrentAudioStream(VARIANT_FALSE);
else
Fire_ChangeCurrentAudioStream(VARIANT_TRUE);
if (validUOPs&UOP_FLAG_Select_SubPic_Stream)
Fire_ChangeCurrentSubpictureStream(VARIANT_FALSE);
else
Fire_ChangeCurrentSubpictureStream(VARIANT_TRUE);
if (validUOPs&UOP_FLAG_Select_Angle)
Fire_ChangeCurrentAngle(VARIANT_FALSE);
else
Fire_ChangeCurrentAngle(VARIANT_TRUE);
/*
if (validUOPs&UOP_FLAG_Karaoke_Audio_Pres_Mode_Change)
;
if (validUOPs&UOP_FLAG_Video_Pres_Mode_Change)
;
*/
}
break;
case EC_DVD_STILL_ON:
m_fStillOn = true;
break ;
case EC_DVD_STILL_OFF:
m_fStillOn = false;
break ;
case EC_DVD_DOMAIN_CHANGE:
switch (lParam1){
case DVD_DOMAIN_FirstPlay: // = 1
//case DVD_DOMAIN_VideoManagerMenu: // = 2
if(m_hFPDOMEvent){
// whenever we enter FP Domain we reset
::ResetEvent(m_hFPDOMEvent);
}
else {
ATLTRACE(TEXT("No event initialized bug!!"));
ATLASSERT(FALSE);
}/* end of if statement */
break;
case DVD_DOMAIN_Stop: // = 5
case DVD_DOMAIN_VideoManagerMenu: // = 2
case DVD_DOMAIN_VideoTitleSetMenu: // = 3
case DVD_DOMAIN_Title: // = 4
default:
if(m_hFPDOMEvent){
// whenever we get out of the FP Dom Set our state
::SetEvent(m_hFPDOMEvent);
}
else {
ATLTRACE(TEXT("No event initialized bug!!"));
ATLASSERT(FALSE);
}/* end of if statement */
break;
}/* end of switch case */
break ;
case EC_DVD_BUTTON_CHANGE:
break;
case EC_DVD_TITLE_CHANGE:
break ;
case EC_DVD_CHAPTER_START:
break ;
case EC_DVD_CURRENT_TIME:
//ATLTRACE(TEXT("Time event \n"));
break;
/**************
DVD_TIMECODE *pTime = (DVD_TIMECODE *) &lParam1 ;
wsprintf(m_achTimeText, TEXT("Current Time is %d%d:%d%d:%d%d"),
pTime->Hours10, pTime->Hours1,
pTime->Minutes10, pTime->Minutes1,
pTime->Seconds10, pTime->Seconds1) ;
InvalidateRect(m_hWnd, NULL, TRUE) ;
************************/
case EC_DVD_CURRENT_HMSF_TIME:
//ATLTRACE(TEXT("New Time event \n"));
break;
//
// Then the general DirectShow related events
//
case EC_COMPLETE:
case EC_DVD_PLAYBACK_STOPPED:
Stop() ; // DShow doesn't stop on end; we should do that
break;
// fall through now...
case EC_USERABORT:
case EC_ERRORABORT:
case EC_FULLSCREEN_LOST:
//TO DO: Implement StopFullScreen() ; // we must get out of fullscreen mode now
break ;
case EC_DVD_DISC_EJECTED:
m_bEjected = true;
break;
case EC_DVD_DISC_INSERTED:
m_bEjected = false;
break;
case EC_STEP_COMPLETE:
m_fStepComplete = true;
break;
default:
break ;
}/* end of switch case */
// update for win64 since DShow uses now LONGLONG
VARIANT varLParam1;
VARIANT varLParam2;
#ifdef _WIN64
varLParam1.llVal = lParam1;
varLParam1.vt = VT_I8;
varLParam2.llVal = lParam2;
varLParam2.vt = VT_I8;
#else
varLParam1.lVal = lParam1;
varLParam1.vt = VT_I4;
varLParam2.lVal = lParam2;
varLParam2.vt = VT_I4;
#endif
// fire the event now after we have processed it internally
Fire_DVDNotify(lEvent, varLParam1, varLParam2);
//
// Remember to free the event params
//
m_pME->FreeEventParams(lEvent, lParam1, lParam2) ;
}/* end of while loop */
return 0 ;
}/* end of function OnDVDEvent */
/*************************************************************************/
/* Function: OnButtonDown */
/* Description: Selects the button. */
/*************************************************************************/
LRESULT CMSWebDVD::OnButtonDown(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled){
try {
if(!m_fInitialized){
return(0);
}/* end of if statement */
m_bMouseDown = TRUE;
RECT rc;
HWND hwnd;
if(m_bWndLess){
HRESULT hr = GetParentHWND(&hwnd);
if(FAILED(hr)){
return(hr);
}/* end of if statement */
rc = m_rcPos;
}
else {
hwnd = m_hWnd;
::GetClientRect(hwnd, &rc);
}/* end of if statement */
if(::IsWindow(hwnd)){
::MapWindowPoints(hwnd, ::GetDesktopWindow(), (LPPOINT)&rc, 2);
}/* end of if statement */
::ClipCursor(&rc);
m_LastMouse.x = GET_X_LPARAM(lParam);
m_LastMouse.y = GET_Y_LPARAM(lParam);
if (m_pClipRect)
m_ClipRectDown = *m_pClipRect;
m_LastMouseDown = m_LastMouse;
if(!m_fDisableAutoMouseProcessing){
SelectAtPosition(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
}/* end of if statement */
}/* end of try statement */
catch(...){
}/* end of if statement */
bHandled = true;
return 0;
}/* end of function OnButtonDown */
/*************************************************************************/
/* Function: OnButtonUp */
/* Description: Activates the button. The problem is that when we move */
/* away from a button while holding left button down over some other */
/* button then the button we are under gets activated. What should happen*/
/* is that no button gets activated. */
/*************************************************************************/
LRESULT CMSWebDVD::OnButtonUp(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled){
try {
if(!m_fInitialized){
return(0);
}/* end of if statement */
m_bMouseDown = FALSE;
::ClipCursor(NULL);
if(!m_fDisableAutoMouseProcessing && m_nCursorType == dvdCursor_Arrow){
ActivateAtPosition(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
}
else if(m_nCursorType == dvdCursor_ZoomIn ||
m_nCursorType == dvdCursor_ZoomOut) {
// Compute new clipping top left corner
long x = GET_X_LPARAM(lParam);
long y = GET_Y_LPARAM(lParam);
POINT CenterPoint = {x, y};
if (m_bWndLess) {
RECT rc = {m_rcPos.left, m_rcPos.top, m_rcPos.right, m_rcPos.bottom};
HWND hwnd;
HRESULT hr = GetParentHWND(&hwnd);
if(FAILED(hr)){
return(hr);
}/* end of if statement */
if(::IsWindow(hwnd)){
::MapWindowPoints(hwnd, ::GetDesktopWindow(), &CenterPoint, 1);
::MapWindowPoints(hwnd, ::GetDesktopWindow(), (LPPOINT)&rc, 2);
}/* end of if statement */
x = CenterPoint.x - rc.left;
y = CenterPoint.y - rc.top;
}
CComPtr<IDVDRect> pDvdClipRect;
HRESULT hr = GetClipVideoRect(&pDvdClipRect);
if (FAILED(hr))
throw(hr);
// Get current clipping width and height
long clipWidth, clipHeight;
pDvdClipRect->get_Width(&clipWidth);
pDvdClipRect->get_Height(&clipHeight);
// Get current clipping top left corner
long clipX, clipY;
pDvdClipRect->get_x(&clipX);
pDvdClipRect->get_y(&clipY);
long newClipCenterX = x*clipWidth/RECTWIDTH(&m_rcPos) + clipX;
long newClipCenterY = y*clipHeight/RECTHEIGHT(&m_rcPos) + clipY;
if (m_nCursorType == dvdCursor_ZoomIn) {
Zoom(newClipCenterX, newClipCenterY, 2.0);
}
else if (m_nCursorType == dvdCursor_ZoomOut) {
Zoom(newClipCenterX, newClipCenterY, 0.5);
}/* end of if statement */
}
}/* end of try statement */
catch(...){
}/* end of if statement */
bHandled = true;
return 0;
}/* end of function OnButtonUp */
/*************************************************************************/
/* Function: OnMouseMove */
/* Description: Selects the button. */
/*************************************************************************/
LRESULT CMSWebDVD::OnMouseMove(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled){
try {
if(!m_fInitialized){
return(0);
}/* end of if statement */
if(!m_fDisableAutoMouseProcessing && m_nCursorType == dvdCursor_Arrow){
SelectAtPosition(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
}
else if (m_bMouseDown && m_nCursorType == dvdCursor_Hand) {
CComPtr<IDVDRect> pDvdClipRect;
CComPtr<IDVDRect> pDvdRect;
HRESULT hr = GetVideoSize(&pDvdRect);
if (FAILED(hr))
throw(hr);
hr = GetClipVideoRect(&pDvdClipRect);
if (FAILED(hr))
throw(hr);
// Get video width and height
long videoWidth, videoHeight;
pDvdRect->get_Width(&videoWidth);
pDvdRect->get_Height(&videoHeight);
// Get clipping width and height;
long clipWidth, clipHeight;
pDvdClipRect->get_Width(&clipWidth);
pDvdClipRect->get_Height(&clipHeight);
if (!m_bWndLess) {
AdjustDestRC();
}/* end of if statement */
double scaleFactorX = clipWidth/(double)RECTWIDTH(&m_rcPosAspectRatioAjusted);
double scaleFactorY = clipHeight/(double)RECTHEIGHT(&m_rcPosAspectRatioAjusted);
long xAdjustment = (long) ((GET_X_LPARAM(lParam) - m_LastMouseDown.x)*scaleFactorX);
long yAdjustment = (long) ((GET_Y_LPARAM(lParam) - m_LastMouseDown.y)*scaleFactorY);
RECT clipRect = m_ClipRectDown;
::OffsetRect(&clipRect, -xAdjustment, -yAdjustment);
if (clipRect.left<0)
::OffsetRect(&clipRect, -clipRect.left, 0);
if (clipRect.top<0)
::OffsetRect(&clipRect, 0, -clipRect.top);
if (clipRect.right>videoWidth)
::OffsetRect(&clipRect, videoWidth-clipRect.right, 0);
if (clipRect.bottom>videoHeight)
::OffsetRect(&clipRect, 0, videoHeight-clipRect.bottom);
//ATLTRACE(TEXT("SetClipVideoRect %d %d %d %d\n"),
// m_pClipRect->left, m_pClipRect->top, m_pClipRect->right, m_pClipRect->bottom);
pDvdClipRect->put_x(clipRect.left);
pDvdClipRect->put_y(clipRect.top);
hr = SetClipVideoRect(pDvdClipRect);
if (FAILED(hr))
throw(hr);
m_LastMouse.x = GET_X_LPARAM(lParam);
m_LastMouse.y = GET_Y_LPARAM(lParam);
}/* end of if statement */
}/* end of try statement */
catch(...){
}/* end of if statement */
bHandled = true;
return 0;
}/* end of function OnMouseMove */
/*************************************************************/
/* Function: OnSetCursor */
/* Description: Sets the cursor to what we want overwrite */
/* the default window proc. */
/*************************************************************/
LRESULT CMSWebDVD::OnSetCursor(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled){
//ATLTRACE(TEXT("CMSWebDVD::OnSetCursor\n"));
if (m_hCursor && m_nCursorType != dvdCursor_None){
::SetCursor(m_hCursor);
//ATLTRACE(TEXT("Actually setting the cursor OnSetCursor\n"));
return(TRUE);
}/* end of if statement */
bHandled = FALSE;
return 0;
}/* end of function OnSetCursor */
/*************************************************************************/
/* Function: get_TitlesAvailable */
/* Description: Gets the number of titles. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_TitlesAvailable(long *pVal){
HRESULT hr = S_OK;
try {
if(NULL == pVal){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
ULONG NumOfVol;
ULONG ThisVolNum;
DVD_DISC_SIDE Side;
ULONG TitleCount;
hr = m_pDvdInfo2->GetDVDVolumeInfo(&NumOfVol, &ThisVolNum, &Side, &TitleCount);
*pVal = (LONG) TitleCount;
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_TitlesAvailable */
/*************************************************************************/
/* Function: GetNumberChapterOfChapters */
/* Description: Returns the number of chapters in title. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::GetNumberOfChapters(long lTitle, long *pVal){
HRESULT hr = S_OK;
try {
if(NULL == pVal){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdInfo2->GetNumberOfChapters(lTitle, (ULONG*)pVal);
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function GetNumberChapterOfChapters */
/*************************************************************************/
/* Function: get_FullScreenMode */
/* Description: Gets the current fullscreen mode. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_FullScreenMode(VARIANT_BOOL *pfFullScreenMode){
//TODO: handle the other cases when not having IVideoWindow
HRESULT hr = S_OK;
try {
if(NULL == pfFullScreenMode){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
IVideoWindow* pVW;
if(!m_pDvdGB){
return(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdGB->GetDvdInterface(IID_IVideoWindow, (LPVOID *)&pVW) ;
if (SUCCEEDED(hr) && pVW != NULL){
long lMode;
hr = pVW->get_FullScreenMode(&lMode);
if(SUCCEEDED(hr)){
*pfFullScreenMode = ((lMode == OAFALSE) ? VARIANT_FALSE : VARIANT_TRUE);
}/* end of if statement */
pVW->Release();
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_FullScreenMode */
/*************************************************************************/
/* Function: put_FullScreenMode */
/* Description: Sets the full screen mode. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::put_FullScreenMode(VARIANT_BOOL fFullScreenMode){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
IVideoWindow* pVW;
if(!m_pDvdGB){
return(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdGB->GetDvdInterface(IID_IVideoWindow, (LPVOID *)&pVW) ;
if (SUCCEEDED(hr) && pVW != NULL){
hr = pVW->put_FullScreenMode(fFullScreenMode);
pVW->Release();
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function put_FullScreenMode */
/*************************************************************************/
/* Function: SetDDrawExcl */
/* Descirption: Sets up Overlays Mixer DDraw interface. That way we avoid*/
/* drawing using IVideo Window and the control, can be windowless. */
/*************************************************************************/
HRESULT CMSWebDVD::SetDDrawExcl(){
HRESULT hr = S_OK;
HWND hwndBrowser = NULL;
hr = GetParentHWND(&hwndBrowser);
if(FAILED(hr)){
return(hr);
}/* end of if statement */
if(hwndBrowser == NULL){
hr = E_POINTER;
return(E_POINTER);
}/* end of if statement */
HDC hDC = ::GetWindowDC(hwndBrowser);
if(hDC == NULL){
hr = E_UNEXPECTED;
return(hr);
}/* end of if statement */
LPDIRECTDRAW pDDraw = NULL;
hr = DirectDrawCreate(NULL, &pDDraw, NULL);
if(FAILED(hr)){
::ReleaseDC(hwndBrowser, hDC);
return(hr);
}/* end of if statement */
LPDIRECTDRAW4 pDDraw4 = NULL;
hr = pDDraw->QueryInterface(IID_IDirectDraw4, (LPVOID*)&pDDraw4);
pDDraw->Release();
if(FAILED(hr)){
::ReleaseDC(hwndBrowser, hDC);
return(hr);
}/* end of if statement */
LPDIRECTDRAWSURFACE4 pDDS4 = NULL;
pDDraw4->GetSurfaceFromDC(hDC, &pDDS4);
pDDraw4->Release();
::ReleaseDC(hwndBrowser, hDC);
if(FAILED(hr)){
return(hr);
}/* end of if statement */
LPDIRECTDRAW4 pDDrawIE = NULL;
hr = pDDS4->GetDDInterface((LPVOID*)&pDDrawIE);
pDDS4->Release();
pDDrawIE->Release();
return HandleError(hr);
}/* end of function SetDDrawExcl */
/*************************************************************************/
/* Function: PlayBackwards */
/* Description: Rewind, set to play state to start with. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::PlayBackwards(double dSpeed, VARIANT_BOOL fDoNotReset){
HRESULT hr = S_OK;
try {
if(VARIANT_FALSE != fDoNotReset){
m_fResetSpeed = false;
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE_AND_PLAY
m_fResetSpeed = true;
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
RETRY_IF_IN_FPDOM(m_pDvdCtl2->PlayBackwards(dSpeed,0,0));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function BackwardScan */
/*************************************************************************/
/* Function: PlayForwards */
/* Description: Set DVD in fast forward mode. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::PlayForwards(double dSpeed, VARIANT_BOOL fDoNotReset){
HRESULT hr = S_OK;
try {
if(VARIANT_FALSE != fDoNotReset){
m_fResetSpeed = false;
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE_AND_PLAY
m_fResetSpeed = true;
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
RETRY_IF_IN_FPDOM(m_pDvdCtl2->PlayForwards(dSpeed,0,0));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function PlayForwards */
/*************************************************************************/
/* Function: Resume */
/* Description: Resume from menu. We put our self in play state, just */
/* in the case we were not in it. This might lead to some unexpected */
/* behavior in case when we stopped and the tried to hit this button */
/* but I think in this case might be appropriate as well. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::Resume(){
HRESULT hr = S_OK;
try {
hr = Play(); // put in the play mode
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdCtl2->Resume(cdwDVDCtrlFlags, 0);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function Resume */
/*************************************************************************/
/* Function: ShowMenu */
/* Description: Invokes specific menu call. */
/* We set our selfs to play mode so we can execute this in case we were */
/* paused or stopped. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::ShowMenu(DVDMenuIDConstants MenuID){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE_AND_PLAY
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
RETRY_IF_IN_FPDOM(m_pDvdCtl2->ShowMenu((tagDVD_MENU_ID)MenuID, cdwDVDCtrlFlags, 0)); //!!keep in sync, or this cast will not work
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function MenuCall */
/*************************************************************************/
/* Function: get_PlayState */
/* Description: Needs to be expanded for DVD, using their base APIs, */
/* get DVD specific states as well. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_PlayState(DVDFilterState *pFilterState){
HRESULT hr = S_OK;
try {
if (NULL == pFilterState){
throw(E_POINTER);
}/* end of if statement */
if(!m_fInitialized){
*pFilterState = dvdState_Unitialized;
return(hr);
}/* end of if statement */
if(!m_pMC){
throw(E_UNEXPECTED);
}/* end of if statement */
OAFilterState fs;
hr = m_pMC->GetState(cgStateTimeout, &fs);
*pFilterState = (DVDFilterState)fs; // !!keep in sync, or this cast will not work
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of get_PlayState */
/*************************************************************************/
/* Function: SelectUpperButton */
/* Description: Selects the upper button on DVD Menu. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::SelectUpperButton(){
HRESULT hr = S_OK;
try {
hr = Play(); // put in the play mode
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdCtl2->SelectRelativeButton(DVD_Relative_Upper);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function SelectUpperButton */
/*************************************************************************/
/* Function: SelectLowerButton */
/* Description: Selects the lower button on DVD Menu. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::SelectLowerButton(){
HRESULT hr = S_OK;
try {
hr = Play(); // put in the play mode
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdCtl2->SelectRelativeButton(DVD_Relative_Lower);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function SelectLowerButton */
/*************************************************************************/
/* Function: SelectLeftButton */
/* Description: Selects the left button on DVD Menu. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::SelectLeftButton(){
HRESULT hr = S_OK;
try {
hr = Play(); // put in the play mode
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdCtl2->SelectRelativeButton(DVD_Relative_Left);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function SelectLeftButton */
/*************************************************************************/
/* Function: SelectRightButton */
/* Description: Selects the right button on DVD Menu. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::SelectRightButton(){
HRESULT hr = S_OK;
try {
hr = Play(); // put in the play mode
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdCtl2->SelectRelativeButton(DVD_Relative_Right);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function SelectRightButton */
/*************************************************************************/
/* Function: ActivateButton */
/* Description: Activates the selected button on DVD Menu. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::ActivateButton(){
HRESULT hr = S_OK;
try {
hr = Play(); // put in the play mode
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdCtl2->ActivateButton();
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function ActivateButton */
/*************************************************************************/
/* Function: SelectAndActivateButton */
/* Description: Selects and activates the specific button. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::SelectAndActivateButton(long lButton){
HRESULT hr = S_OK;
try {
hr = Play(); // put in the play mode
if(FAILED(hr)){
throw(hr);
}
if(lButton < 0){
throw(E_INVALIDARG);
}
if( !m_pDvdCtl2){
throw(E_UNEXPECTED);
}
hr = m_pDvdCtl2->SelectAndActivateButton((ULONG)lButton);
}
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}
return HandleError(hr);
}/* end of function SelectAndActivateButton */
/*************************************************************************/
/* Function: PlayNextChapter */
/* Description: Goes to next chapter */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::PlayNextChapter(){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE_AND_PLAY
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
RETRY_IF_IN_FPDOM(m_pDvdCtl2->PlayNextChapter(cdwDVDCtrlFlags, 0));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function PlayNextChapter */
/*************************************************************************/
/* Function: PlayPrevChapter */
/* Description: Goes to previous chapter */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::PlayPrevChapter(){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE_AND_PLAY
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
RETRY_IF_IN_FPDOM(m_pDvdCtl2->PlayPrevChapter(cdwDVDCtrlFlags, 0));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function PlayPrevChapter */
/*************************************************************************/
/* Function: ReplayChapter */
/* Description: Halts playback and restarts the playback of current */
/* program inside PGC. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::ReplayChapter(){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE_AND_PLAY
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
RETRY_IF_IN_FPDOM(m_pDvdCtl2->ReplayChapter(cdwDVDCtrlFlags, 0));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function ReplayChapter */
/*************************************************************************/
/* Function: Return */
/* Description: Used in menu to return into prevoius menu. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::ReturnFromSubmenu(){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE_AND_PLAY
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
RETRY_IF_IN_FPDOM(m_pDvdCtl2->ReturnFromSubmenu(cdwDVDCtrlFlags, 0));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function Return */
/*************************************************************************/
/* Function: PlayChapter */
/* Description: Does chapter search. Waits for FP_DOM to pass and initi */
/* lizes the graph as the other smar routines. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::PlayChapter(LONG lChapter){
HRESULT hr = S_OK;
try {
if(lChapter < 0){
throw(E_INVALIDARG);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE_AND_PLAY
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
RETRY_IF_IN_FPDOM(m_pDvdCtl2->PlayChapter(lChapter, cdwDVDCtrlFlags, 0));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function PlayChapter */
/*************************************************************************/
/* Function: GetAudioLanguage */
/* Description: Returns audio language associated with a stream. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::GetAudioLanguage(LONG lStream, VARIANT_BOOL fFormat, BSTR *strAudioLang){
HRESULT hr = S_OK;
LPTSTR pszString = NULL;
try {
if(NULL == strAudioLang){
throw(E_POINTER);
}/* end of if statement */
if(lStream < 0){
throw(E_INVALIDARG);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
USES_CONVERSION;
LCID lcid;
hr = m_pDvdInfo2->GetAudioLanguage(lStream, &lcid);
if (SUCCEEDED( hr )){
// count up the streams for the same LCID like English 2
pszString = m_LangID.GetLangFromLangID((WORD)PRIMARYLANGID(LANGIDFROMLCID(lcid)));
if (pszString == NULL) {
pszString = new TCHAR[MAX_PATH];
TCHAR strBuffer[MAX_PATH];
if(!::LoadString(_Module.m_hInstResource, IDS_AUDIOTRACK, strBuffer, MAX_PATH)){
delete[] pszString;
throw(E_UNEXPECTED);
}/* end of if statement */
StringCchPrintf(pszString, MAX_PATH, strBuffer, lStream);
}/* end of if statement */
DVD_AudioAttributes attr;
if(SUCCEEDED(m_pDvdInfo2->GetAudioAttributes(lStream, &attr))){
// If want audio format param is set
if (fFormat != VARIANT_FALSE) {
switch(attr.AudioFormat){
case DVD_AudioFormat_AC3: AppendString(pszString, IDS_DOLBY, MAX_PATH ); break;
case DVD_AudioFormat_MPEG1: AppendString(pszString, IDS_MPEG1, MAX_PATH ); break;
case DVD_AudioFormat_MPEG1_DRC: AppendString(pszString, IDS_MPEG1, MAX_PATH ); break;
case DVD_AudioFormat_MPEG2: AppendString(pszString, IDS_MPEG2, MAX_PATH ); break;
case DVD_AudioFormat_MPEG2_DRC: AppendString(pszString, IDS_MPEG2, MAX_PATH); break;
case DVD_AudioFormat_LPCM: AppendString(pszString, IDS_LPCM, MAX_PATH ); break;
case DVD_AudioFormat_DTS: AppendString(pszString, IDS_DTS, MAX_PATH ); break;
case DVD_AudioFormat_SDDS: AppendString(pszString, IDS_SDDS, MAX_PATH ); break;
}/* end of switch statement */
}
switch(attr.LanguageExtension){
case DVD_AUD_EXT_NotSpecified:
case DVD_AUD_EXT_Captions: break; // do not add anything
case DVD_AUD_EXT_VisuallyImpaired: AppendString(pszString, IDS_AUDIO_VISUALLY_IMPAIRED, MAX_PATH ); break;
case DVD_AUD_EXT_DirectorComments1: AppendString(pszString, IDS_AUDIO_DIRC1, MAX_PATH ); break;
case DVD_AUD_EXT_DirectorComments2: AppendString(pszString, IDS_AUDIO_DIRC2, MAX_PATH ); break;
}/* end of switch statement */
}/* end of if statement */
*strAudioLang = ::SysAllocString( T2W(pszString) );
delete[] pszString;
pszString = NULL;
}
else {
*strAudioLang = ::SysAllocString( L"");
// hr used to be not failed and return nothing
if(SUCCEEDED(hr)) // remove this after gets fixed in DVDNav
hr = E_FAIL;
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
if (pszString) {
delete[] pszString;
pszString = NULL;
}
hr = hrTmp;
}/* end of catch statement */
catch(...){
if (pszString) {
delete[] pszString;
pszString = NULL;
}
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function GetAudioLanguage */
/*************************************************************************/
/* Function: StillOff */
/* Description: Turns the still off, what that can be used for is a */
/* mistery to me. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::StillOff(){
if(!m_pDvdCtl2){
return E_UNEXPECTED;
}/* end of if statement */
return HandleError(m_pDvdCtl2->StillOff());
}/* end of function StillOff */
/*************************************************************************/
/* Function: PlayTitle */
/* Description: If fails waits for FP_DOM to pass and tries later. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::PlayTitle(LONG lTitle){
HRESULT hr = S_OK;
try {
if(0 > lTitle){
throw(E_INVALIDARG);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE_AND_PLAY
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
long lNumTitles = 0;
hr = get_TitlesAvailable(&lNumTitles);
if(FAILED(hr)){
throw hr;
}
if(lTitle > lNumTitles){
throw E_INVALIDARG;
}
RETRY_IF_IN_FPDOM(m_pDvdCtl2->PlayTitle(lTitle, cdwDVDCtrlFlags, 0));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function PlayTitle */
/*************************************************************************/
/* Function: GetSubpictureLanguage */
/* Description: Gets subpicture language. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::GetSubpictureLanguage(LONG lStream, BSTR* strSubpictLang){
HRESULT hr = S_OK;
LPTSTR pszString = NULL;
try {
if(NULL == strSubpictLang){
throw(E_POINTER);
}/* end of if statement */
if(0 > lStream){
throw(E_INVALIDARG);
}/* end of if statement */
if((lStream > cgDVD_MAX_SUBPICTURE
&& lStream != cgDVD_ALT_SUBPICTURE)){
throw(E_INVALIDARG);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
LCID lcid;
hr = m_pDvdInfo2->GetSubpictureLanguage(lStream, &lcid);
if (SUCCEEDED( hr )){
pszString = m_LangID.GetLangFromLangID((WORD)PRIMARYLANGID(LANGIDFROMLCID(lcid)));
if (pszString == NULL) {
pszString = new TCHAR[MAX_PATH];
TCHAR strBuffer[MAX_PATH];
if(!::LoadString(_Module.m_hInstResource, IDS_SUBPICTURETRACK, strBuffer, MAX_PATH)){
delete[] pszString;
throw(E_UNEXPECTED);
}/* end of if statement */
StringCchPrintf(pszString, MAX_PATH, strBuffer, lStream);
}/* end of if statement */
#if 0
DVD_SubpictureATR attr;
if(SUCCEEDED(m_pDvdInfo2->GetSubpictureAttributes(lStream, &attr))){
switch(attr){
case DVD_SP_EXT_NotSpecified:
case DVD_SP_EXT_Caption_Normal: break;
case DVD_SP_EXT_Caption_Big: AppendString(pszString, IDS_CAPTION_BIG, MAX_PATH ); break;
case DVD_SP_EXT_Caption_Children: AppendString(pszString, IDS_CAPTION_CHILDREN, MAX_PATH ); break;
case DVD_SP_EXT_CC_Normal: AppendString(pszString, IDS_CLOSED_CAPTION, MAX_PATH ); break;
case DVD_SP_EXT_CC_Big: AppendString(pszString, IDS_CLOSED_CAPTION_BIG, MAX_PATH ); break;
case DVD_SP_EXT_CC_Children: AppendString(pszString, IDS_CLOSED_CAPTION_CHILDREN, MAX_PATH ); break;
case DVD_SP_EXT_Forced: AppendString(pszString, IDS_CLOSED_CAPTION_FORCED, MAX_PATH ); break;
case DVD_SP_EXT_DirectorComments_Normal: AppendString(pszString, IDS_DIRS_COMMNETS, MAX_PATH ); break;
case DVD_SP_EXT_DirectorComments_Big: AppendString(pszString, IDS_DIRS_COMMNETS_BIG, MAX_PATH ); break;
case DVD_SP_EXT_DirectorComments_Children: AppendString(pszString, IDS_DIRS_COMMNETS_CHILDREN, MAX_PATH ); break;
}/* end of switch statement */
#endif
USES_CONVERSION;
*strSubpictLang = ::SysAllocString( T2W(pszString) );
delete[] pszString;
pszString = NULL;
}
else {
*strSubpictLang = ::SysAllocString( L"");
// hr used to be not failed and return nothing
if(SUCCEEDED(hr)) // remove this after gets fixed in DVDNav
hr = E_FAIL;
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
if (pszString) {
delete[] pszString;
pszString = NULL;
}
hr = hrTmp;
}/* end of catch statement */
catch(...){
if (pszString) {
delete[] pszString;
pszString = NULL;
}
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function GetSubpictureLanguage */
/*************************************************************************/
/* Function: PlayChapterInTitle */
/* Description: Plays from the specified chapter without stopping */
/* THIS NEEDS TO BE ENHANCED !!! Current implementation and queing */
/* into the message loop is insufficient!!! TODO. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::PlayChapterInTitle(LONG lTitle, LONG lChapter){
HRESULT hr = S_OK;
try {
if ((lTitle > cgDVDMAX_TITLE_COUNT) || (lTitle < cgDVDMIN_TITLE_COUNT)){
throw(E_INVALIDARG);
}/* end of if statement */
if ((lChapter > cgDVDMAX_CHAPTER_COUNT) || (lChapter < cgDVDMIN_CHAPTER_COUNT)){
throw(E_INVALIDARG);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE_AND_PLAY
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
RETRY_IF_IN_FPDOM(m_pDvdCtl2->PlayChapterInTitle(lTitle, lChapter, cdwDVDCtrlFlags, 0));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function PlayChapterInTitle */
/*************************************************************************/
/* Function: PlayChapterAutoStop */
/* Description: Plays set ammount of chapters. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::PlayChaptersAutoStop(LONG lTitle, LONG lChapter,
LONG lChapterCount){
HRESULT hr = S_OK;
try {
if ((lTitle > cgDVDMAX_TITLE_COUNT) || (lTitle < cgDVDMIN_TITLE_COUNT)){
throw(E_INVALIDARG);
}/* end of if statement */
if ((lChapter > cgDVDMAX_CHAPTER_COUNT) || (lChapter < cgDVDMIN_CHAPTER_COUNT)){
throw(E_INVALIDARG);
}/* end of if statement */
if ((lChapterCount > cgDVDMAX_CHAPTER_COUNT) || (lChapterCount < cgDVDMIN_CHAPTER_COUNT)){
throw(E_INVALIDARG);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE_AND_PLAY
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
RETRY_IF_IN_FPDOM(m_pDvdCtl2->PlayChaptersAutoStop(lTitle, lChapter, lChapterCount, cdwDVDCtrlFlags, 0));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function PlayChaptersAutoStop */
/*************************************************************************/
/* Function: PlayPeriodInTitleAutoStop */
/* Description: Time plays, converts from hh:mm:ss:ff format */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::PlayPeriodInTitleAutoStop(long lTitle,
BSTR strStartTime, BSTR strEndTime){
HRESULT hr = S_OK;
try {
if(NULL == strStartTime){
throw(E_POINTER);
}/* end of if statement */
if(NULL == strEndTime){
throw(E_POINTER);
}/* end of if statement */
DVD_HMSF_TIMECODE tcStartTimeCode;
hr = Bstr2DVDTime(&tcStartTimeCode, &strStartTime);
if(FAILED(hr)){
throw (hr);
}
DVD_HMSF_TIMECODE tcEndTimeCode;
Bstr2DVDTime(&tcEndTimeCode, &strEndTime);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE_AND_PLAY
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
RETRY_IF_IN_FPDOM(m_pDvdCtl2->PlayPeriodInTitleAutoStop(lTitle, &tcStartTimeCode,
&tcEndTimeCode, cdwDVDCtrlFlags, 0));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function PlayPeriodInTitleAutoStop */
/*************************************************************************/
/* Function: PlayAtTimeInTitle */
/* Description: Time plays, converts from hh:mm:ss:ff format */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::PlayAtTimeInTitle(long lTitle, BSTR strTime){
HRESULT hr = S_OK;
try {
if(NULL == strTime){
throw(E_POINTER);
}/* end of if statement */
DVD_HMSF_TIMECODE tcTimeCode;
hr = Bstr2DVDTime(&tcTimeCode, &strTime);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE_AND_PLAY
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
RETRY_IF_IN_FPDOM(m_pDvdCtl2->PlayAtTimeInTitle(lTitle, &tcTimeCode, cdwDVDCtrlFlags, 0));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function PlayAtTimeInTitle */
/*************************************************************************/
/* Function: PlayAtTime */
/* Description: TimeSearch, converts from hh:mm:ss:ff format */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::PlayAtTime(BSTR strTime){
HRESULT hr = S_OK;
try {
if(NULL == strTime){
throw(E_POINTER);
}/* end of if statement */
DVD_HMSF_TIMECODE tcTimeCode;
Bstr2DVDTime(&tcTimeCode, &strTime);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE_AND_PLAY
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
RETRY_IF_IN_FPDOM(m_pDvdCtl2->PlayAtTime( &tcTimeCode, cdwDVDCtrlFlags, 0));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function PlayAtTime */
/*************************************************************************/
/* Function: get_CurrentTitle */
/* Description: Gets current title. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_CurrentTitle(long *pVal){
HRESULT hr = S_OK;
try {
if(NULL == pVal){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
DVD_PLAYBACK_LOCATION2 dvdLocation;
RETRY_IF_IN_FPDOM(m_pDvdInfo2->GetCurrentLocation(&dvdLocation));
if(SUCCEEDED(hr)){
*pVal = dvdLocation.TitleNum;
}
else {
*pVal = 0;
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_CurrentTitle */
/*************************************************************************/
/* Function: get_CurrentChapter */
/* Description: Gets current chapter */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_CurrentChapter(long *pVal){
HRESULT hr = S_OK;
try {
if(NULL == pVal){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
DVD_PLAYBACK_LOCATION2 dvdLocation;
RETRY_IF_IN_FPDOM(m_pDvdInfo2->GetCurrentLocation(&dvdLocation));
if(SUCCEEDED(hr)){
*pVal = dvdLocation.ChapterNum;
}
else {
*pVal = 0;
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_CurrentChapter */
/*************************************************************************/
/* Function: get_FramesPerSecond */
/* Description: Gets number of frames per second. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_FramesPerSecond(long *pVal){
HRESULT hr = S_OK;
try {
if(NULL == pVal){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
DVD_PLAYBACK_LOCATION2 dvdLocation;
hr = m_pDvdInfo2->GetCurrentLocation(&dvdLocation);
// we handle right now only 25 and 30 fps at the moment
if( dvdLocation.TimeCodeFlags & DVD_TC_FLAG_25fps ) {
*pVal = 25;
} else if( dvdLocation.TimeCodeFlags & DVD_TC_FLAG_30fps ) {
*pVal = 30;
} else {
// unknown
*pVal = 0;
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_FramesPerSecond */
/*************************************************************************/
/* Function: get_CurrentTime */
/* Description: Gets current time. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_CurrentTime(BSTR *pVal){
HRESULT hr = S_OK;
try {
if(NULL == pVal){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
DVD_PLAYBACK_LOCATION2 dvdLocation;
hr = m_pDvdInfo2->GetCurrentLocation(&dvdLocation);
DVDTime2bstr(&(dvdLocation.TimeCode), pVal);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_CurrentTime */
/*************************************************************************/
/* Function: get_DVDDirectory */
/* Description: Gets the root of the DVD drive. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_DVDDirectory(BSTR *pVal){
HRESULT hr = S_OK;
try {
if(NULL == pVal){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
WCHAR szRoot[MAX_PATH];
ULONG ulActual;
hr = m_pDvdInfo2->GetDVDDirectory(szRoot, MAX_PATH, &ulActual);
*pVal = ::SysAllocString(szRoot);
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_DVDDirectory */
/*************************************************************************/
/* Function: put_DVDDirectory */
/* Description: Sets the root for DVD control. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::put_DVDDirectory(BSTR bstrRoot){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdCtl2){
throw (E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdCtl2->SetDVDDirectory(bstrRoot);
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function put_DVDDirectory */
/*************************************************************************/
/* Function: get_CurrentDomain */
/* Description: gets current DVD domain. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_CurrentDomain(long *plDomain){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
if(NULL == plDomain){
throw(E_POINTER);
}/* end of if statememt */
hr = m_pDvdInfo2->GetCurrentDomain((DVD_DOMAIN *)plDomain);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_CurrentDomain */
/*************************************************************************/
/* Function: get_CurrentDiscSide */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_CurrentDiscSide(long *plDiscSide){
HRESULT hr = S_OK;
try {
if(NULL == plDiscSide){
throw(E_POINTER);
}/* end of if statement */
ULONG ulNumOfVol;
ULONG ulThisVolNum;
DVD_DISC_SIDE discSide;
ULONG ulNumOfTitles;
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdInfo2->GetDVDVolumeInfo( &ulNumOfVol,
&ulThisVolNum,
&discSide,
&ulNumOfTitles);
*plDiscSide = discSide;
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_CurrentDiscSide */
/*************************************************************************/
/* Function: get_CurrentVolume */
/* Description: Gets current volume. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_CurrentVolume(long *plVolume){
HRESULT hr = S_OK;
try {
if(NULL == plVolume){
throw(E_POINTER);
}/* end of if statement */
ULONG ulNumOfVol;
DVD_DISC_SIDE discSide;
ULONG ulNumOfTitles;
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdInfo2->GetDVDVolumeInfo( &ulNumOfVol,
(ULONG*)plVolume,
&discSide,
&ulNumOfTitles);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_CurrentVolume */
/*************************************************************************/
/* Function: get_VolumesAvailable */
/* Description: Gets total number of volumes available. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_VolumesAvailable(long *plNumOfVol){
HRESULT hr = S_OK;
try {
if(NULL == plNumOfVol){
throw(E_POINTER);
}/* end of if statement */
ULONG ulThisVolNum;
DVD_DISC_SIDE discSide;
ULONG ulNumOfTitles;
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdInfo2->GetDVDVolumeInfo( (ULONG*)plNumOfVol,
&ulThisVolNum,
&discSide,
&ulNumOfTitles);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_VolumesAvailable */
/*************************************************************************/
/* Function: get_CurrentSubpictureStream */
/* Description: Gets the current subpicture stream. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_CurrentSubpictureStream(long *plSubpictureStream){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
ULONG ulStreamsAvailable = 0L;
BOOL bIsDisabled = TRUE;
RETRY_IF_IN_FPDOM(m_pDvdInfo2->GetCurrentSubpicture(&ulStreamsAvailable, (ULONG*)plSubpictureStream, &bIsDisabled ));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_CurrentSubpictureStream */
/*************************************************************************/
/* Function: put_CurrentSubpictureStream */
/* Description: Sets the current subpicture stream. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::put_CurrentSubpictureStream(long lSubpictureStream){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
if( lSubpictureStream < cgDVD_MIN_SUBPICTURE
|| (lSubpictureStream > cgDVD_MAX_SUBPICTURE
&& lSubpictureStream != cgDVD_ALT_SUBPICTURE)){
throw(E_INVALIDARG);
}/* end of if statement */
RETRY_IF_IN_FPDOM(m_pDvdCtl2->SelectSubpictureStream(lSubpictureStream,0,0));
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
// now enabled the subpicture stream if it is not enabled
ULONG ulStraemsAvial = 0L, ulCurrentStrean = 0L;
BOOL fDisabled = TRUE;
hr = m_pDvdInfo2->GetCurrentSubpicture(&ulStraemsAvial, &ulCurrentStrean, &fDisabled);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
if(TRUE == fDisabled){
hr = m_pDvdCtl2->SetSubpictureState(TRUE,0,0); //turn it on
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function put_CurrentSubpictureStream */
/*************************************************************************/
/* Function: get_SubpictureOn */
/* Description: Gets the current subpicture status On or Off */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_SubpictureOn(VARIANT_BOOL *pfDisplay){
HRESULT hr = S_OK;
try {
if(NULL == pfDisplay){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
ULONG ulSubpictureStream = 0L, ulStreamsAvailable = 0L;
BOOL fDisabled = TRUE;
RETRY_IF_IN_FPDOM(m_pDvdInfo2->GetCurrentSubpicture(&ulStreamsAvailable, &ulSubpictureStream, &fDisabled))
if(SUCCEEDED(hr)){
*pfDisplay = fDisabled == FALSE ? VARIANT_TRUE : VARIANT_FALSE; // compensate for -1 true in OLE
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_SubpictureOn */
/*************************************************************************/
/* Function: put_SubpictureOn */
/* Description: Turns the subpicture On or Off */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::put_SubpictureOn(VARIANT_BOOL fDisplay){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
ULONG ulSubpictureStream = 0L, ulStreamsAvailable = 0L;
BOOL bIsDisabled = TRUE;
RETRY_IF_IN_FPDOM(m_pDvdInfo2->GetCurrentSubpicture(&ulStreamsAvailable, &ulSubpictureStream, &bIsDisabled ));
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
BOOL bDisplay = fDisplay == VARIANT_FALSE ? FALSE : TRUE; // compensate for -1 true in OLE
hr = m_pDvdCtl2->SetSubpictureState(bDisplay,0,0);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function put_SubpictureOn */
/*************************************************************************/
/* Function: get_SubpictureStreamsAvailable */
/* Description: gets the number of streams available. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_SubpictureStreamsAvailable(long *plStreamsAvailable){
HRESULT hr = S_OK;
try {
if (NULL == plStreamsAvailable){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
ULONG ulSubpictureStream = 0L;
*plStreamsAvailable = 0L;
BOOL bIsDisabled = TRUE;
RETRY_IF_IN_FPDOM(m_pDvdInfo2->GetCurrentSubpicture((ULONG*)plStreamsAvailable, &ulSubpictureStream, &bIsDisabled));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_SubpictureStreamsAvailable */
/*************************************************************************/
/* Function: get_TotalTitleTime */
/* Description: Gets total time in the title. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_TotalTitleTime(BSTR *pTime){
HRESULT hr = S_OK;
try {
if(NULL == pTime){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
DVD_HMSF_TIMECODE tcTime;
ULONG ulFlags; // contains 30fps/25fps
hr = m_pDvdInfo2->GetTotalTitleTime(&tcTime, &ulFlags);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = DVDTime2bstr(&tcTime, pTime);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_TotalTitleTime */
/*************************************************************************/
/* Function: get_CurrentCCService */
/* Description: Gets current closed caption service. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_CurrentCCService(long *plService){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdGB){
throw(E_UNEXPECTED);
}/* end of if statement */
if(NULL == plService){
throw(E_POINTER);
}/* end of if statement */
CComPtr<IAMLine21Decoder> pLine21Dec;
hr = m_pDvdGB->GetDvdInterface(IID_IAMLine21Decoder, (LPVOID *)&pLine21Dec);
if (FAILED(hr)){
throw(hr);
}/* end of if statement */
AM_LINE21_CCSERVICE Service;
RETRY_IF_IN_FPDOM(pLine21Dec->GetCurrentService(&Service));
if (FAILED(hr)){
throw(hr);
}/* end of if statement */
*plService = (ULONG)Service;
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_CurrentCCService */
/*************************************************************************/
/* Function: put_CurrentCCService */
/* Description: Sets current closed caption service. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::put_CurrentCCService(long lService){
HRESULT hr = S_OK;
try {
if(lService < 0){
throw(E_INVALIDARG);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdGB){
throw(E_UNEXPECTED);
}/* end of if statement */
CComPtr<IAMLine21Decoder> pLine21Dec;
hr = m_pDvdGB->GetDvdInterface(IID_IAMLine21Decoder, (LPVOID *)&pLine21Dec);
if (FAILED(hr)){
throw(hr);
}/* end of if statement */
RETRY_IF_IN_FPDOM(pLine21Dec->SetCurrentService((AM_LINE21_CCSERVICE)lService));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function put_CurrentCCService */
/*************************************************************************/
/* Function: get_CurrentButton */
/* Description: Gets currently selected button. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_CurrentButton(long *plCurrentButton){
HRESULT hr = S_OK;
try {
if(NULL == plCurrentButton){
throw(E_POINTER);
}/* end of if statement */
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
ULONG ulNumButtons = 0L;
*plCurrentButton = 0;
hr = m_pDvdInfo2->GetCurrentButton(&ulNumButtons, (ULONG*)plCurrentButton);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_CurrentButton */
/*************************************************************************/
/* Function: get_ButtonsAvailable */
/* Description: Gets the count of the available buttons. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_ButtonsAvailable(long *plNumButtons){
HRESULT hr = S_OK;
try {
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
ULONG ulCurrentButton = 0L;
hr = m_pDvdInfo2->GetCurrentButton((ULONG*)plNumButtons, &ulCurrentButton);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_ButtonsAvailable */
/*************************************************************************/
/* Function: get_CCActive */
/* Description: Gets the state of the closed caption service. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_CCActive(VARIANT_BOOL *fState){
HRESULT hr = S_OK;
try {
if(NULL == fState ){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdGB){
throw(E_UNEXPECTED);
}/* end of if statement */
CComPtr<IAMLine21Decoder> pLine21Dec;
hr = m_pDvdGB->GetDvdInterface(IID_IAMLine21Decoder, (LPVOID *)&pLine21Dec);
if (FAILED(hr)){
throw(hr);
}/* end of if statement */
AM_LINE21_CCSTATE State;
RETRY_IF_IN_FPDOM(pLine21Dec->GetServiceState(&State));
if (FAILED(hr)){
throw(hr);
}/* end of if statement */
if(AM_L21_CCSTATE_On == State){
*fState = VARIANT_TRUE; // OLE TRUE
}
else {
*fState = VARIANT_FALSE;
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_CCActive */
/*************************************************************************/
/* Function: put_CCActive */
/* Description: Sets the ccActive state */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::put_CCActive(VARIANT_BOOL fState){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdGB){
throw(E_UNEXPECTED);
}/* end of if statement */
CComPtr<IAMLine21Decoder> pLine21Dec;
hr = m_pDvdGB->GetDvdInterface(IID_IAMLine21Decoder, (LPVOID *)&pLine21Dec);
if (FAILED(hr)){
throw(hr);
}/* end of if statement */
AM_LINE21_CCSTATE ccState = (fState == VARIANT_FALSE ? AM_L21_CCSTATE_Off: AM_L21_CCSTATE_On);
RETRY_IF_IN_FPDOM(pLine21Dec->SetServiceState(ccState));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function put_CCActive */
/*************************************************************************/
/* Function: get_CurrentAngle */
/* Description: Gets current angle. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_CurrentAngle(long *plAngle){
HRESULT hr = S_OK;
try {
if(NULL == plAngle){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
ULONG ulAnglesAvailable = 0;
RETRY_IF_IN_FPDOM(m_pDvdInfo2->GetCurrentAngle(&ulAnglesAvailable, (ULONG*)plAngle));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_CurrentAngle */
/*************************************************************************/
/* Function: put_CurrentAngle */
/* Description: Sets the current angle (different DVD angle track.) */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::put_CurrentAngle(long lAngle){
HRESULT hr = S_OK;
try {
if( lAngle < cgDVD_MIN_ANGLE || lAngle > cgDVD_MAX_ANGLE ){
throw(E_INVALIDARG);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE_AND_PLAY
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
RETRY_IF_IN_FPDOM(m_pDvdCtl2->SelectAngle(lAngle,0,0));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function put_CurrentAngle */
/*************************************************************************/
/* Function: get_AnglesAvailable */
/* Description: Gets the number of angles available. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_AnglesAvailable(long *plAnglesAvailable){
HRESULT hr = S_OK;
try {
if(NULL == plAnglesAvailable){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
ULONG ulCurrentAngle = 0;
RETRY_IF_IN_FPDOM(m_pDvdInfo2->GetCurrentAngle((ULONG*)plAnglesAvailable, &ulCurrentAngle));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_AnglesAvailable */
/*************************************************************************/
/* Function: get_AudioStreamsAvailable */
/* Description: Gets number of available Audio Streams */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_AudioStreamsAvailable(long *plNumAudioStreams){
HRESULT hr = S_OK;
try {
if(NULL == plNumAudioStreams){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
ULONG ulCurrentStream;
RETRY_IF_IN_FPDOM(m_pDvdInfo2->GetCurrentAudio((ULONG*)plNumAudioStreams, &ulCurrentStream));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_AudioStreamsAvailable */
/*************************************************************************/
/* Function: get_CurrentAudioStream */
/* Description: Gets current audio stream. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_CurrentAudioStream(long *plCurrentStream){
HRESULT hr = S_OK;
try {
if(NULL == plCurrentStream){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
ULONG ulNumAudioStreams;
RETRY_IF_IN_FPDOM(m_pDvdInfo2->GetCurrentAudio(&ulNumAudioStreams, (ULONG*)plCurrentStream ));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_CurrentAudioStream */
/*************************************************************************/
/* Function: put_CurrentAudioStream */
/* Description: Changes the current audio stream. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::put_CurrentAudioStream(long lAudioStream){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
RETRY_IF_IN_FPDOM(m_pDvdCtl2->SelectAudioStream(lAudioStream,0,0));
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function put_CurrentAudioStream */
/*************************************************************************/
/* Function: get_ColorKey */
/* Description: Gets the current color key. Goes to the dshow if we have */
/* a graph otherwise just gets the cached color key. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_ColorKey(long *pClr){
HRESULT hr = S_OK;
try {
if( NULL == pClr ){
throw(E_POINTER);
}/* end of if statement */
*pClr = 0; // cleanup the variable
COLORREF clr;
::ZeroMemory(&clr, sizeof(COLORREF));
hr = GetColorKey(&clr); // we get COLORREF HERE and CANNOT be palette index
HWND hwnd = ::GetDesktopWindow();
HDC hdc = ::GetWindowDC(hwnd);
if(NULL == hdc){
throw(E_UNEXPECTED);
}/* end of if statement */
clr = ::GetNearestColor(hdc, clr);
::ReleaseDC(hwnd, hdc);
// handles only case when getting RGB BACK, which is taken care of in the GetColorKey function
*pClr = ((OLE_COLOR)(((BYTE)(GetBValue(clr))|((WORD)((BYTE)(GetGValue(clr)))<<8))|(((DWORD)(BYTE)(GetRValue(clr)))<<16)));
if(FAILED(hr)){
if(false == m_fInitialized){
*pClr = ((OLE_COLOR)(((BYTE)(GetBValue(m_clrColorKey))|((WORD)((BYTE)(GetGValue(m_clrColorKey)))<<8))|(((DWORD)(BYTE)(GetRValue(m_clrColorKey)))<<16))); // give them our default value
throw(S_FALSE); // we are not initialized yet, so probably we are called from property bag
}/* end of if statement */
throw(hr);
}/* end of if statement */
m_clrColorKey = clr; // cache up the value
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_ColorKey */
/*************************************************************************/
/* Function: put_ColorKey */
/* Description: Sets the color key. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::put_ColorKey(long clr){
HRESULT hr = S_OK;
try {
#if 1
HWND hwnd = ::GetDesktopWindow();
HDC hdc = ::GetWindowDC(hwnd);
if(NULL == hdc){
throw(E_UNEXPECTED);
}/* end of if statement */
if((::GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE) == RC_PALETTE){
clr = MAGENTA_COLOR_KEY;
}/* end of if statement */
::ReleaseDC(hwnd, hdc);
#endif
BYTE r = ((BYTE)((clr)>>16));
BYTE g = (BYTE)(((WORD)(clr)) >> 8);
BYTE b = ((BYTE)(clr));
COLORREF clrColorKey = RGB(r, g, b); // convert to color ref
hr = SetColorKey(clrColorKey);
if(FAILED(hr)){
if(false == m_fInitialized){
m_clrColorKey = clrColorKey; // cache up the value for later
hr = S_FALSE;
}/* end of if statement */
throw(hr);
}/* end of if statement */
#if 1
hr = GetColorKey(&m_clrColorKey);
#endif
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function put_ColorKey */
/*************************************************************************/
/* Function: put_BackColor */
/* Description: Put back color is sinonymous to ColorKey when in the */
/* windowless mode. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::put_BackColor(VARIANT clrBackColor){
HRESULT hr = S_OK;
try {
VARIANT dest;
VariantInit(&dest);
hr = VariantChangeTypeEx(&dest, &clrBackColor, 0, 0, VT_COLOR);
if (FAILED(hr))
throw hr;
hr = CStockPropImpl<CMSWebDVD, IMSWebDVD,
&IID_IMSWebDVD, &LIBID_MSWEBDVDLib>::put_BackColor(dest.lVal);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function put_BackColor */
/*************************************************************************/
/* Function: get_BackColor */
/* Description: Put back color is sinonymous to ColorKey when in the */
/* windowless mode. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_BackColor(VARIANT* pclrBackColor){
HRESULT hr = S_OK;
try {
if ( NULL == pclrBackColor) {
throw (E_POINTER);
}
OLE_COLOR clrColor;
hr = CStockPropImpl<CMSWebDVD, IMSWebDVD,
&IID_IMSWebDVD, &LIBID_MSWEBDVDLib>::get_BackColor(&clrColor);
if (FAILED(hr))
throw(hr);
VariantInit(pclrBackColor);
pclrBackColor->vt = VT_COLOR;
pclrBackColor->lVal = clrColor;
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_BackColor */
/*************************************************************************/
/* Function: get_ReadyState */
/* Description: Put back color is sinonymous to ColorKey when in the */
/* windowless mode. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_ReadyState(LONG *pVal){
HRESULT hr = S_OK;
try {
if (NULL == pVal) {
throw (E_POINTER);
}
hr = CStockPropImpl<CMSWebDVD, IMSWebDVD,
&IID_IMSWebDVD, &LIBID_MSWEBDVDLib>::get_ReadyState(pVal);
if (FAILED(hr))
throw(hr);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_ReadyState */
/*************************************************************************/
/* Function: UOPValid */
/* Description: Tells if UOP is valid or not, valid means the feature is */
/* turned on. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::UOPValid(long lUOP, VARIANT_BOOL *pfValid){
HRESULT hr = S_OK;
try {
if (NULL == pfValid){
throw(E_POINTER);
}/* end of if statement */
if ((lUOP > 24) || (lUOP < 0)){
throw(E_INVALIDARG);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if( !m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
ULONG ulUOPS = 0;
hr = m_pDvdInfo2->GetCurrentUOPS(&ulUOPS);
*pfValid = ulUOPS & (1 << lUOP) ? VARIANT_FALSE : VARIANT_TRUE;
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function UOPValid */
/*************************************************************************/
/* Function: GetGPRM */
/* Description: Gets the GPRM at specified index */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::GetGPRM(long lIndex, short *psGPRM){
HRESULT hr = E_FAIL;
try {
if (NULL == psGPRM){
throw(E_POINTER);
}/* end of if statement */
GPRMARRAY gprm;
int iArraySize = sizeof(GPRMARRAY)/sizeof(gprm[0]);
if(0 > lIndex || iArraySize <= lIndex){
return(E_INVALIDARG);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdInfo2->GetAllGPRMs(&gprm);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
*psGPRM = gprm[lIndex];
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function GetGPRM */
/*************************************************************************/
/* Function: GetDVDTextNumberOfLanguages */
/* Description: Retrieves the number of languages available. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::GetDVDTextNumberOfLanguages(long *plNumOfLangs){
HRESULT hr = S_OK;
try {
if (NULL == plNumOfLangs){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if( !m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
ULONG ulNumOfLangs;
RETRY_IF_IN_FPDOM(m_pDvdInfo2->GetDVDTextNumberOfLanguages(&ulNumOfLangs));
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
*plNumOfLangs = ulNumOfLangs;
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function GetDVDTextNumberOfLanguages */
/*************************************************************************/
/* Function: GetDVDTextNumberOfStrings */
/* Description: Gets the number of strings in the partical language. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::GetDVDTextNumberOfStrings(long lLangIndex, long *plNumOfStrings){
HRESULT hr = S_OK;
try {
if (NULL == plNumOfStrings){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if( !m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
LCID wLangCode;
ULONG uNumOfStings;
DVD_TextCharSet charSet;
RETRY_IF_IN_FPDOM(m_pDvdInfo2->GetDVDTextLanguageInfo(lLangIndex, &uNumOfStings, &wLangCode, &charSet));
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
*plNumOfStrings = uNumOfStings;
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function GetDVDTextNumberOfStrings */
/*************************************************************/
/* Name: GetDVDTextLanguageLCID
/* Description: Get the LCID of an index of the DVD texts
/*************************************************************/
STDMETHODIMP CMSWebDVD::GetDVDTextLanguageLCID(long lLangIndex, long *lcid)
{
HRESULT hr = S_OK;
try {
if (NULL == lcid){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if( !m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
LCID wLangCode;
ULONG uNumOfStings;
DVD_TextCharSet charSet;
RETRY_IF_IN_FPDOM(m_pDvdInfo2->GetDVDTextLanguageInfo(lLangIndex, &uNumOfStings, &wLangCode, &charSet));
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
*lcid = wLangCode;
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function GetDVDTextLanguageLCID */
/*************************************************************************/
/* Function: GetDVDtextString */
/* Description: Gets the DVD Text string at specific location. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::GetDVDTextString(long lLangIndex, long lStringIndex, BSTR *pstrText){
HRESULT hr = S_OK;
try {
if (NULL == pstrText){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if( !m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
ULONG ulSize;
DVD_TextStringType type;
RETRY_IF_IN_FPDOM(m_pDvdInfo2->GetDVDTextStringAsUnicode(lLangIndex, lStringIndex, NULL, 0, &ulSize, &type));
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
if (ulSize == 0) {
*pstrText = ::SysAllocString(L"");
}
else {
// got the length so lets allocate a buffer of that size
WCHAR* wstrBuff = new WCHAR[ulSize];
ULONG ulActualSize;
hr = m_pDvdInfo2->GetDVDTextStringAsUnicode(lLangIndex, lStringIndex, wstrBuff, ulSize, &ulActualSize, &type);
ATLASSERT(ulActualSize == ulSize);
if(FAILED(hr)){
delete [] wstrBuff;
throw(hr);
}/* end of if statement */
*pstrText = ::SysAllocString(wstrBuff);
delete [] wstrBuff;
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function GetDVDtextString */
/*************************************************************************/
/* Function: GetDVDTextStringType */
/* Description: Gets the type of the string at the specified location. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::GetDVDTextStringType(long lLangIndex, long lStringIndex, DVDTextStringType *pType){
HRESULT hr = S_OK;
try {
if (NULL == pType){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if( !m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
ULONG ulTheSize;
DVD_TextStringType type;
RETRY_IF_IN_FPDOM(m_pDvdInfo2->GetDVDTextStringAsUnicode(lLangIndex, lStringIndex, NULL, 0, &ulTheSize, &type));
if(SUCCEEDED(hr)){
*pType = (DVDTextStringType) type;
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function GetDVDTextStringType */
/*************************************************************************/
/* Function: GetSPRM */
/* Description: Gets SPRM at the specific index. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::GetSPRM(long lIndex, short *psSPRM){
HRESULT hr = E_FAIL;
try {
if (NULL == psSPRM){
throw(E_POINTER);
}/* end of if statement */
SPRMARRAY sprm;
int iArraySize = sizeof(SPRMARRAY)/sizeof(sprm[0]);
if(0 > lIndex || iArraySize <= lIndex){
return(E_INVALIDARG);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdInfo2->GetAllSPRMs(&sprm);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
*psSPRM = sprm[lIndex];
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function GetSPRM */
/*************************************************************************/
/* Function: get_DVDUniqueID */
/* Description: Gets the UNIQUE ID that identifies the string. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_DVDUniqueID(BSTR *pStrID){
HRESULT hr = E_FAIL;
try {
// TODO: Be able to get m_pDvdInfo2 without initializing the graph
if (NULL == pStrID){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
ULONGLONG ullUniqueID;
hr = m_pDvdInfo2->GetDiscID(NULL, &ullUniqueID);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
//TODO: Get rid of the STDLIB call!!
// taken out of WMP
// Script can't handle a 64 bit value so convert it to a string.
// Doc's say _ui64tow returns 33 bytes (chars?) max.
// we'll use double that just in case...
//
WCHAR wszBuffer[66];
_ui64tow( ullUniqueID, wszBuffer, 10);
*pStrID = SysAllocString(wszBuffer);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_DVDUniqueID */
/*************************************************************************/
/* Function: get_EnableResetOnStop */
/* Description: Gets the flag. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_EnableResetOnStop(VARIANT_BOOL *pVal){
HRESULT hr = S_OK;
try {
if(NULL == pVal){
throw(E_POINTER);
}/* end of if statement */
*pVal = m_fEnableResetOnStop ? VARIANT_TRUE: VARIANT_FALSE;
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_EnableResetOnStop */
/*************************************************************************/
/* Function: put_EnableResetOnStop */
/* Description: Sets the flag. The flag is used only on stop and play. */
/* Transitions. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::put_EnableResetOnStop(VARIANT_BOOL newVal){
HRESULT hr = S_OK;
try {
BOOL fEnable = (VARIANT_FALSE == newVal) ? FALSE: TRUE;
BOOL fEnableOld = m_fEnableResetOnStop;
m_fEnableResetOnStop = fEnable;
if(!m_pDvdCtl2){
throw(S_FALSE); // we might not have initialized graph as of yet, but will
// defer this to play state
}/* end of if statement */
hr = m_pDvdCtl2->SetOption(DVD_ResetOnStop, fEnable);
if(FAILED(hr)){
m_fEnableResetOnStop = fEnableOld; // restore the old state
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function put_EnableResetOnStop */
/*************************************************************************/
/* Function: get_Mute */
/* Description: Gets the mute state. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_Mute(VARIANT_BOOL *pfMute){
HRESULT hr = S_OK;
try {
if(NULL == pfMute){
throw(E_POINTER);
}/* end of if statement */
*pfMute = m_bMute ? VARIANT_TRUE: VARIANT_FALSE;
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_Mute */
/*************************************************************************/
/* Function: DShowToWaveV */
/*************************************************************************/
inline DShowToWaveV(long x){
FLOAT fy = (((FLOAT)x + (-cgVOLUME_MIN)) / (-cgVOLUME_MIN)) * cgWAVE_VOLUME_MAX;
return((WORD)fy);
}/* end of function DShowToWaveV */
/*************************************************************************/
/* Function: WaveToDShowV */
/*************************************************************************/
inline LONG WaveToDShowV(WORD y){
FLOAT fx = ((FLOAT)y * (-cgVOLUME_MIN)) / cgWAVE_VOLUME_MAX + cgVOLUME_MIN;
return((LONG)fx);
}/* end of function WaveToDShowV */
/*************************************************************************/
/* Function: MixerSetVolume */
/*************************************************************************/
HRESULT MixerSetVolume(DWORD dwVolume){
WORD wVolume = (WORD)(0xffff & dwVolume);
HRESULT hr = S_OK;
HMIXER hmx = NULL;
UINT cMixer = ::mixerGetNumDevs();
if (cMixer <= 0) {
return E_FAIL;
}
BOOL bVolControlFound = FALSE;
DWORD dwVolControlID = 0;
for (UINT i=0; i<cMixer; i++) {
if(::mixerOpen(&hmx, i, 0, 0, 0) != MMSYSERR_NOERROR){
// Can't open device, try next device
continue;
}/* end of if statement */
MIXERLINE mxl;
::ZeroMemory(&mxl, sizeof(MIXERLINE));
mxl.cbStruct = sizeof(MIXERLINE);
mxl.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_SPEAKERS;
if(::mixerGetLineInfo((HMIXEROBJ)hmx, &mxl, MIXER_GETLINEINFOF_COMPONENTTYPE) != MMSYSERR_NOERROR){
// Can't find a audio line to adjust the speakers, try next device
::mixerClose(hmx);
continue;
}
MIXERLINECONTROLS mxlc;
::ZeroMemory(&mxlc, sizeof(MIXERLINECONTROLS));
mxlc.cbStruct = sizeof(MIXERLINECONTROLS);
mxlc.dwLineID = mxl.dwLineID;
mxlc.dwControlType = MIXERCONTROL_CONTROLTYPE_VOLUME;
mxlc.cControls = 1;
MIXERCONTROL mxc;
::ZeroMemory(&mxc, sizeof(MIXERCONTROL));
mxc.cbStruct = sizeof(MIXERCONTROL);
mxlc.cbmxctrl = sizeof(MIXERCONTROL);
mxlc.pamxctrl = &mxc;
if(::mixerGetLineControls((HMIXEROBJ) hmx, &mxlc, MIXER_GETLINECONTROLSF_ONEBYTYPE) != MMSYSERR_NOERROR){
// Can't get volume control on the audio line, try next device
::mixerClose(hmx);
continue;
}
if(cgWAVE_VOLUME_MAX != mxc.Bounds.dwMaximum){
ATLASSERT(FALSE); // improve algorith to take different max and min
::mixerClose(hmx);
hr = E_FAIL;
return(hr);
}/* end of if statement */
if(cgWAVE_VOLUME_MIN != mxc.Bounds.dwMinimum){
ATLASSERT(FALSE); // improve algorith to take different max and min
::mixerClose(hmx);
hr = E_FAIL;
return(hr);
}/* end of if statement */
// Volume control found, break out loop
bVolControlFound = TRUE;
dwVolControlID = mxc.dwControlID;
break;
}/*end of for loop*/
if (!bVolControlFound)
return E_FAIL;
MIXERCONTROLDETAILS mxcd;
MIXERCONTROLDETAILS_SIGNED volStruct;
::ZeroMemory(&mxcd, sizeof(MIXERCONTROLDETAILS));
mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS);
mxcd.cbDetails = sizeof(MIXERCONTROLDETAILS_SIGNED);
mxcd.dwControlID = dwVolControlID;
mxcd.paDetails = &volStruct;
volStruct.lValue = wVolume;
mxcd.cChannels = 1;
if(::mixerSetControlDetails((HMIXEROBJ) hmx, &mxcd, MIXER_SETCONTROLDETAILSF_VALUE) != MMSYSERR_NOERROR){
::mixerClose(hmx);
hr = E_FAIL;
return(hr);
}/* end of if statement */
::mixerClose(hmx);
return(hr);
}/* end of fucntion MixerSetVolume */
/*************************************************************************/
/* Function: MixerGetVolume */
/*************************************************************************/
HRESULT MixerGetVolume(DWORD& dwVolume){
HRESULT hr = S_OK;
HMIXER hmx = NULL;
UINT cMixer = ::mixerGetNumDevs();
if (cMixer <= 0) {
return E_FAIL;
}
BOOL bVolControlFound = FALSE;
DWORD dwVolControlID = 0;
for (UINT i=0; i<cMixer; i++) {
if(::mixerOpen(&hmx, i, 0, 0, 0) != MMSYSERR_NOERROR){
// Can't open device, try next device
continue;
}/* end of if statement */
MIXERLINE mxl;
::ZeroMemory(&mxl, sizeof(MIXERLINE));
mxl.cbStruct = sizeof(MIXERLINE);
mxl.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_SPEAKERS;
if(::mixerGetLineInfo((HMIXEROBJ)hmx, &mxl, MIXER_GETLINEINFOF_COMPONENTTYPE) != MMSYSERR_NOERROR){
// Can't find a audio line to adjust the speakers, try next device
::mixerClose(hmx);
continue;
}
MIXERLINECONTROLS mxlc;
::ZeroMemory(&mxlc, sizeof(MIXERLINECONTROLS));
mxlc.cbStruct = sizeof(MIXERLINECONTROLS);
mxlc.dwLineID = mxl.dwLineID;
mxlc.dwControlType = MIXERCONTROL_CONTROLTYPE_VOLUME;
mxlc.cControls = 1;
MIXERCONTROL mxc;
::ZeroMemory(&mxc, sizeof(MIXERCONTROL));
mxc.cbStruct = sizeof(MIXERCONTROL);
mxlc.cbmxctrl = sizeof(MIXERCONTROL);
mxlc.pamxctrl = &mxc;
if(::mixerGetLineControls((HMIXEROBJ) hmx, &mxlc, MIXER_GETLINECONTROLSF_ONEBYTYPE) != MMSYSERR_NOERROR){
// Can't get volume control on the audio line, try next device
::mixerClose(hmx);
continue;
}
if(cgWAVE_VOLUME_MAX != mxc.Bounds.dwMaximum){
ATLASSERT(FALSE); // improve algorith to take different max and min
::mixerClose(hmx);
hr = E_FAIL;
return(hr);
}/* end of if statement */
if(cgWAVE_VOLUME_MIN != mxc.Bounds.dwMinimum){
ATLASSERT(FALSE); // improve algorith to take different max and min
::mixerClose(hmx);
hr = E_FAIL;
return(hr);
}/* end of if statement */
// Volume control found, break out loop
bVolControlFound = TRUE;
dwVolControlID = mxc.dwControlID;
break;
}/*end of for loop*/
if (!bVolControlFound)
return E_FAIL;
MIXERCONTROLDETAILS mxcd;
MIXERCONTROLDETAILS_SIGNED volStruct;
::ZeroMemory(&mxcd, sizeof(MIXERCONTROLDETAILS));
mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS);
mxcd.cbDetails = sizeof(MIXERCONTROLDETAILS_SIGNED);
mxcd.dwControlID = dwVolControlID;
mxcd.paDetails = &volStruct;
mxcd.cChannels = 1;
if(::mixerGetControlDetails((HMIXEROBJ) hmx, &mxcd, MIXER_GETCONTROLDETAILSF_VALUE) != MMSYSERR_NOERROR){
::mixerClose(hmx);
hr = E_FAIL;
return(hr);
}/* end of if statement */
// the volStruct.lValue gets initialize via call to mixerGetControlDetails with mxcd.paDetails = &volStruct;
dwVolume = volStruct.lValue;
::mixerClose(hmx);
return(hr);
}/* end of function MixerGetVolume */
/*************************************************************************/
/* Function: get_IntVolume */
/*************************************************************************/
HRESULT CMSWebDVD::get_IntVolume(LONG* plVolume){
HRESULT hr = S_OK;
if(m_pAudio){
hr = m_pAudio->get_Volume(plVolume); // get the volume
}
else {
DWORD dwVolume;
hr = MixerGetVolume(dwVolume);
if(FAILED(hr)){
return(hr);
}/* end of if statement */
*plVolume = WaveToDShowV(LOWORD(dwVolume));
}/* end of if statememt */
return(hr);
}/* end of function get_VolumeHelper */
/*************************************************************************/
/* Function: put_IntVolume */
/*************************************************************************/
HRESULT CMSWebDVD::put_IntVolume(long lVolume){
HRESULT hr = S_OK;
if(m_pAudio){
hr = m_pAudio->put_Volume(lVolume);
}
else {
WORD wVolume = WORD(DShowToWaveV(lVolume));
// set left and right volume same for now
DWORD dwVolume;
dwVolume = ((DWORD)(((WORD)(wVolume)) | ((DWORD)((WORD)(wVolume))) << 16));
hr = MixerSetVolume(dwVolume);
}/* end of if statement */
return(hr);
}/* end of function put_IntVolume */
/*************************************************************************/
/* Function: put_Mute */
/* Description: Gets the mute state. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::put_Mute(VARIANT_BOOL newVal){
HRESULT hr = E_FAIL;
try {
if(VARIANT_FALSE == newVal){
// case when we are unmutting
LONG lVolume;
if(TRUE != m_bMute){
hr = get_IntVolume(&lVolume); // get the volume
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
if(cgVOLUME_MIN != lVolume){
// OK we are not really muted, so
// send little displesure the app
throw(S_FALSE);
}/* end of if statement */
// otherwise proceed normally and sync our flag
}/* end of if statement */
hr = put_IntVolume(m_lLastVolume);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
m_bMute = FALSE; // reset our flag, that we are muted
}
else {
// case when we are mutting
LONG lVolume;
hr = get_IntVolume(&lVolume); // get the volume
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
m_lLastVolume = lVolume; // store the volume for when we are unmutting
hr = put_IntVolume(cgVOLUME_MIN);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
m_bMute = TRUE; // set the mute flage
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function put_Mute */
/*************************************************************************/
/* Function: get_Volume */
/* Description: Gets the volume. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_Volume(long *plVolume){
HRESULT hr = E_FAIL;
try {
if(NULL == plVolume){
throw(E_POINTER);
}/* end of if statement */
if(FALSE == m_bMute){
hr = get_IntVolume(plVolume);
}
else {
// we are in mute state so save the volume for "unmuting"
*plVolume = m_lLastVolume;
hr = S_FALSE; // indicate we are sort of unhappy
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_Volume */
/*************************************************************************/
/* Function: put_Volume */
/* Description: Sets the volume. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::put_Volume(long lVolume){
HRESULT hr = E_FAIL;
try {
// cgVOLUME_MIN is max and cgVOLUME_MAX is min by value
if(cgVOLUME_MIN > lVolume || cgVOLUME_MAX < lVolume){
throw(E_INVALIDARG);
}/* end of if statement */
if(TRUE == m_bMute){
// unmute we are setting volume
m_bMute = FALSE;
}/* end of if statement */
hr = put_IntVolume(lVolume);
// this statement might be taken out but might prevent some error scenarious
// when things are not working right.
if(SUCCEEDED(hr)){
m_lLastVolume = lVolume; // cash up the volume
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function put_Volume */
/*************************************************************************/
/* Function: get_Balance */
/* Description: Gets the balance. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_Balance(long *plBalance){
HRESULT hr = E_FAIL;
try {
if(NULL == plBalance){
throw(E_POINTER);
}/* end of if statement */
if(!m_pAudio){
throw(E_NOTIMPL);
}/* end of if statement */
hr = m_pAudio->get_Balance(plBalance);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_Balance */
/*************************************************************************/
/* Function: put_Balance */
/* Description: Sets the balance. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::put_Balance(long lBalance){
HRESULT hr = E_FAIL;
try {
if(cgBALANCE_MIN > lBalance || cgBALANCE_MAX < lBalance){
throw(E_INVALIDARG);
}/* end of if statement */
if(!m_pAudio){
throw(E_NOTIMPL);
}/* end of if statement */
hr = m_pAudio->put_Balance(lBalance);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function put_Balance */
#if 1 // USE TOOLTIPS
/*************************************************************************/
/* Function: OnMouseToolTip */
/* Description: Check if we were captured/pushed the do not do much, */
/* otherwise do the hit detection and see if we are in static or hower */
/* state. */
/*************************************************************************/
LRESULT CMSWebDVD::OnMouseToolTip(UINT msg, WPARAM wParam, LPARAM lParam, BOOL& bHandled){
bHandled = FALSE;
if (!m_hWndTip){
return 0;
}/* end of if statement */
MSG mssg;
HWND hwnd;
HRESULT hr = GetUsableWindow(&hwnd);
if(FAILED(hr)){
return(1);
}/* end of if statement */
if(!m_bWndLess){
HWND hwndTmp = hwnd;
// Get the active movie window
hwnd = ::GetWindow(hwndTmp, GW_CHILD);
if (!::IsWindow(hwnd)){
return S_FALSE;
}/* end of if statement */
}/* end of if statement */
mssg.hwnd = hwnd;
ATLASSERT(mssg.hwnd);
mssg.message = msg;
mssg.wParam = wParam;
mssg.lParam = lParam;
::SendMessage(m_hWndTip, TTM_RELAYEVENT, 0, (LPARAM) &mssg);
return 0;
}/* end of function OnMouseToolTip */
/*************************************************************/
/* Name: get_ToolTip */
/* Description: create a tool tip for the button */
/*************************************************************/
STDMETHODIMP CMSWebDVD::get_ToolTip(BSTR *pVal){
HRESULT hr = S_OK;
try {
if (NULL == pVal) {
throw (E_POINTER);
} /* end of if statment */
*pVal = m_bstrToolTip.Copy();
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_ToolTip */
/*************************************************************/
/* Name: put_ToolTip */
/* Description: create a tool tip for the button */
/* Cache the tooltip string if there is no window available */
/*************************************************************/
STDMETHODIMP CMSWebDVD::put_ToolTip(BSTR newVal){
HRESULT hr = S_OK;
try {
if(NULL == newVal){
throw(E_POINTER);
}/* end of if statement */
m_bstrToolTip = newVal;
hr = CreateToolTip();
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function put_ToolTip */
/*************************************************************************/
/* Function: GetUsableWindow */
/* Description: Gets the window. If we are windowless we pass */
/* down the parent container window, which is really in a sense parent. */
/*************************************************************************/
HRESULT CMSWebDVD::GetUsableWindow(HWND* pWnd){
HRESULT hr = S_OK;
if(NULL == pWnd){
hr = E_POINTER;
return(hr);
}/* end of if statement */
*pWnd = NULL;
HWND hwnd; // temp
if(m_bWndLess){
hr = GetParentHWND(&hwnd);
if(FAILED(hr)){
return(hr);
}/* end of if statement */
}
else {
hwnd = m_hWnd;
}/* end of if statement */
if(::IsWindow(hwnd)){
*pWnd = hwnd;
hr = S_OK;
}
else {
hr = E_UNEXPECTED;
}/* end of if statement */
return(hr);
}/* end of function GetUsableWindow */
/*************************************************************************/
/* Function: GetUsableWindow */
/* Description: Gets the window. If we are windowless we pass */
/* down the parent container window, which is really in a sense parent. */
/*************************************************************************/
HRESULT CMSWebDVD::GetClientRectInScreen(RECT* prc){
HRESULT hr = S_OK;
if(NULL == prc){
hr = E_POINTER;
return(hr);
}/* end of if statement */
*prc = m_rcPos; //{m_rcPos.left, m_rcPos.top, m_rcPos.right, m_rcPos.bottom};
HWND hwnd;
hr = GetUsableWindow(&hwnd);
if(FAILED(hr)){
return(hr);
}/* end of if statement */
::MapWindowPoints(hwnd, ::GetDesktopWindow(), (LPPOINT)prc, 2);
return(hr);
}/* end of function GetClientRectInScreen */
/*************************************************************/
/* Name: CreateToolTip
/* Description: create a tool tip for the button
/*************************************************************/
HRESULT CMSWebDVD::CreateToolTip(void){
HWND hwnd;
HRESULT hr = GetUsableWindow(&hwnd);
if(FAILED(hr)){
return(hr);
}/* end of if statement */
if(!m_bWndLess){
HWND hwndTmp = hwnd;
// Get the active movie window
hwnd = ::GetWindow(hwndTmp, GW_CHILD);
if (!::IsWindow(hwnd)){
return S_FALSE;
}/* end of if statement */
}/* end of if statement */
USES_CONVERSION;
// If tool tip is to be created for the first time
if (m_hWndTip == (HWND) NULL) {
// Ensure that the common control DLL is loaded, and create
// a tooltip control.
InitCommonControls();
m_hWndTip = CreateWindow(TOOLTIPS_CLASS, (LPTSTR) NULL, TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
hwnd, (HMENU) NULL, _Module.GetModuleInstance(), NULL);
}
if (m_hWndTip == (HWND) NULL)
return S_FALSE;
TOOLINFO ti; // tool information
ti.cbSize = sizeof(TOOLINFO);
ti.uFlags = 0;
ti.hwnd = hwnd;
ti.hinst = _Module.GetModuleInstance();
ti.uId = (UINT) 0;
ti.lpszText = OLE2T(m_bstrToolTip);
// if the button is a windowed control, the tool tip is added to
// the button's own window, and the tool tip area should just be
// the client rect of the window
if (hwnd == m_hWnd)
::GetClientRect(hwnd, &ti.rect);
// otherwise the tool tip is added to the closet windowed parent of
// the button, and the tool tip area should be the relative postion
// of the button in the parent window
else {
ti.rect.left = m_rcPos.left;
ti.rect.top = m_rcPos.top;
ti.rect.right = m_rcPos.right;
ti.rect.bottom = m_rcPos.bottom;
}
if (!SendMessage(m_hWndTip, TTM_ADDTOOL, 0,
(LPARAM) (LPTOOLINFO) &ti))
return S_FALSE;
// Set initial delay time
put_ToolTipMaxWidth(m_nTTMaxWidth);
VARIANT varTemp;
VariantInit(&varTemp);
#ifdef _WIN64
varTemp.vt = VT_I8;
#define VARTEMP_VAL (varTemp.llVal)
#else
varTemp.vt = VT_I4;
#define VARTEMP_VAL (varTemp.lVal)
#endif
VARTEMP_VAL = m_dwTTAutopopDelay;
SetDelayTime(TTDT_AUTOPOP, varTemp);
VARTEMP_VAL = m_dwTTInitalDelay;
SetDelayTime(TTDT_INITIAL, varTemp);
VARTEMP_VAL = m_dwTTReshowDelay;
SetDelayTime(TTDT_RESHOW, varTemp);
#undef VARTEMP_VAL
return S_OK;
}/* end of function CreateToolTip */
/*************************************************************************/
/* Function: get_ToolTipMaxWidth */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_ToolTipMaxWidth(long *pVal){
HRESULT hr = S_OK;
try {
if (NULL == pVal) {
throw E_POINTER;
} /* end of if statement */
if (NULL != m_hWndTip){
// Return value is width in pixels. Safe to cast to 32-bit.
m_nTTMaxWidth = (LONG)::SendMessage(m_hWndTip, TTM_GETMAXTIPWIDTH, 0, 0);
}/* end of if statement */
*pVal = m_nTTMaxWidth;
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_ToolTipMaxWidth */
/*************************************************************************/
/* Function: put_ToolTipMaxWidth */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::put_ToolTipMaxWidth(long newVal){
HRESULT hr = S_OK;
try {
if (newVal <= 0) {
throw E_INVALIDARG;
} /* end of if statement */
m_nTTMaxWidth = newVal;
if (m_hWndTip){
::SendMessage(m_hWndTip, TTM_SETMAXTIPWIDTH, 0, (LPARAM)(INT) newVal);
}/* end of if statement */
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function put_ToolTipMaxWidth */
/*************************************************************/
/* Name: GetDelayTime
/* Description: Get the length of time a pointer must remain
/* stationary within a tool's bounding rectangle before the
/* tooltip window appears
/* delayTypes: TTDT_RESHOW 1
/* TTDT_AUTOPOP 2
/* TTDT_INITIAL 3
/*************************************************************/
STDMETHODIMP CMSWebDVD::GetDelayTime(long delayType, VARIANT *pVal){
HRESULT hr = S_OK;
LRESULT lDelay = 0; //BUGBUG: Is this a good initialization value?
try {
if (NULL == pVal) {
throw E_POINTER;
} /* end of if statement */
if (delayType>TTDT_INITIAL || delayType<TTDT_RESHOW) {
throw E_INVALIDARG;
} /* end of if statement */
if (m_hWndTip) {
lDelay = SendMessage(m_hWndTip, TTM_GETDELAYTIME,
(WPARAM) (DWORD) delayType, 0);
}
// else return cached values
else {
switch (delayType) {
case TTDT_AUTOPOP:
lDelay = m_dwTTAutopopDelay;
break;
case TTDT_INITIAL:
lDelay = m_dwTTInitalDelay;
break;
case TTDT_RESHOW:
lDelay = m_dwTTReshowDelay;
break;
}
} /* end of if statement */
/*
* Copy the delay to the VARIANT return variable.
* BUGBUG: If pVal was a properly initialized variant, we should
* call VariantClear to free any pointers. If it wasn't initialized
* VariantInit is the right thing to call instead. I prefer a leak
* to a crash so I'll use VariantInit below
*/
VariantInit(pVal);
#ifdef _WIN64
pVal->vt = VT_I8;
pVal->llVal = lDelay;
#else
pVal->vt = VT_I4;
pVal->lVal = lDelay;
#endif
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function GetDelayTime */
/*************************************************************/
/* Name: SetDelayTime
/* Description: Set the length of time a pointer must remain
/* stationary within a tool's bounding rectangle before the
/* tooltip window appears
/* delayTypes: TTDT_AUTOMATIC 0
/* TTDT_RESHOW 1
/* TTDT_AUTOPOP 2
/* TTDT_INITIAL 3
/*************************************************************/
STDMETHODIMP CMSWebDVD::SetDelayTime(long delayType, VARIANT newVal){
HRESULT hr = S_OK;
LPARAM lNewDelay = 0;
try {
if (delayType>TTDT_INITIAL || delayType<TTDT_AUTOMATIC) {
throw E_INVALIDARG;
} /* end of if statement */
VARIANT dest;
VariantInit(&dest);
#ifdef _WIN64
hr = VariantChangeTypeEx(&dest, &newVal, 0, 0, VT_I8);
if (FAILED(hr))
throw hr;
lNewDelay = dest.llVal;
#else
hr = VariantChangeTypeEx(&dest, &newVal, 0, 0, VT_I4);
if (FAILED(hr))
throw hr;
lNewDelay = dest.lVal;
#endif
if (lNewDelay < 0) {
throw E_INVALIDARG;
} /* end of if statement */
if (m_hWndTip) {
if (!SendMessage(m_hWndTip, TTM_SETDELAYTIME,
(WPARAM) (DWORD) delayType,
lNewDelay))
return S_FALSE;
}
// cache these values
switch (delayType) {
case TTDT_AUTOPOP:
m_dwTTAutopopDelay = lNewDelay;
break;
case TTDT_INITIAL:
m_dwTTInitalDelay = lNewDelay;
break;
case TTDT_RESHOW:
m_dwTTReshowDelay = lNewDelay;
break;
case TTDT_AUTOMATIC:
m_dwTTInitalDelay = lNewDelay;
m_dwTTAutopopDelay = lNewDelay*10;
m_dwTTReshowDelay = lNewDelay/5;
break;
} /* end of switch statement */
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function SetDelayTime */
#endif
/*************************************************************************/
/* Function: ProcessEvents */
/* Description: Triggers the message, which checks if the messagess are */
/* ready. */
/*************************************************************************/
HRESULT CMSWebDVD::ProcessEvents(){
HRESULT hr = S_OK;
try {
// see if we have lost the DDraw Surf on in Windowless MODE
if((m_pDDrawDVD) && (!::IsWindow(m_hWnd))){
LPDIRECTDRAWSURFACE pDDPrimary = m_pDDrawDVD->GetDDrawSurf();
if (pDDPrimary && (pDDPrimary->IsLost() == DDERR_SURFACELOST)){
if (pDDPrimary->Restore() == DD_OK){
RestoreSurfaces();
}/* end of if statement */
}/* end of if statement */
}/* end of if statement */
// process the DVD event
LRESULT lRes;
ProcessWindowMessage(NULL, WM_DVDPLAY_EVENT, 0, 0, lRes);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return hr;
}/* end of function ProcessEvents */
/*************************************************************************/
/* Function: get_WindowlessActivation */
/* Description: Gets if we we tried to be windowless activated or not. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_WindowlessActivation(VARIANT_BOOL *pVal){
HRESULT hr = S_OK;
try {
if(NULL == pVal){
throw(E_POINTER);
}/* end of if statement */
BOOL fUserMode = FALSE;
GetAmbientUserMode(fUserMode);
if(READYSTATE_COMPLETE == m_nReadyState && fUserMode){
// case when we are up and running
*pVal = m_bWndLess == FALSE ? VARIANT_FALSE: VARIANT_TRUE;
}
else {
*pVal = m_bWindowOnly == TRUE ? VARIANT_FALSE: VARIANT_TRUE;
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_WindowlessActivation */
/*************************************************************************/
/* Function: put_WindowlessActivation */
/* Description: This sets the windowless mode, should be set from the */
/* property bag. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::put_WindowlessActivation(VARIANT_BOOL newVal){
HRESULT hr = S_OK;
try {
if(VARIANT_FALSE == newVal){
m_bWindowOnly = TRUE;
m_fUseDDrawDirect = false;
}
else {
m_bWindowOnly = FALSE;
m_fUseDDrawDirect = true;
}/* end of if statement */
// TODO: This function should fail after we inplace activated !!
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function put_WindowlessActivation */
/*************************************************************************/
/* Function: get_DisableAutoMouseProcessing */
/* Description: Gets the current state of the mouse processing code. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_DisableAutoMouseProcessing(VARIANT_BOOL *pVal){
HRESULT hr = S_OK;
try {
if(NULL == pVal){
throw(E_POINTER);
}/* end of if statement */
*pVal = m_fDisableAutoMouseProcessing;
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_DisableAutoMouseProcessing */
/*************************************************************************/
/* Function: put_DisableAutoMouseProcessing */
/* Description: Gets the state of the mouse processing. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::put_DisableAutoMouseProcessing(VARIANT_BOOL newVal){
HRESULT hr = S_OK;
try {
m_fDisableAutoMouseProcessing = VARIANT_FALSE == newVal ? false : true;
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function put_DisableAutoMouseProcessing */
/*************************************************************************/
/* Function: ActivateAtPosition */
/* Description: Activates a button at selected position. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::ActivateAtPosition(long xPos, long yPos){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
POINT pt = {xPos, yPos};
hr = TransformToWndwls(pt);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = m_pDvdCtl2->ActivateAtPosition(pt);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function ActivateAtPosition */
/*************************************************************************/
/* Function: SelectAtPosition */
/* Description: Selects a button at selected position. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::SelectAtPosition(long xPos, long yPos){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
POINT pt = {xPos, yPos};
hr = TransformToWndwls(pt);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = m_pDvdCtl2->SelectAtPosition(pt);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function SelectAtPosition */
/*************************************************************************/
/* Function: GetButtonAtPosition */
/* Description: Gets the button number associated with a position. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::GetButtonAtPosition(long xPos, long yPos,
long *plButton)
{
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE;
if(!plButton){
throw E_POINTER;
}
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
POINT pt = {xPos, yPos};
hr = TransformToWndwls(pt);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
ULONG ulButton;
hr = m_pDvdInfo2->GetButtonAtPosition(pt, &ulButton);
if(SUCCEEDED(hr)){
*plButton = ulButton;
}
else {
plButton = 0;
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function GetButtonAtPosition */
/*************************************************************************/
/* Function: GetButtonRect */
/* Description: Gets an button rect associated with a button ID. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::GetButtonRect(long lButton, IDVDRect** ppRect){
// no support in MS DVDNav
return HandleError(E_NOTIMPL);
}/* end of function GetButtonRect */
/*************************************************************************/
/* Function: GetDVDScreenInMouseCoordinates */
/* Description: Gets the mouse coordinate screen. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::GetDVDScreenInMouseCoordinates(IDVDRect **ppRect){
// no support in MS DVDNav
return HandleError(E_NOTIMPL);
}/* end of function GetDVDScreenInMouseCoordinates */
/*************************************************************************/
/* Function: SetDVDScreenInMouseCoordinates */
/* Description: Sets the screen in mouse coordinates. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::SetDVDScreenInMouseCoordinates(IDVDRect *pRect){
// no support in MS DVDNav
return HandleError(E_NOTIMPL);
}/* end of function SetDVDScreenInMouseCoordinates */
/*************************************************************************/
/* Function: GetClipVideoRect */
/* Description: Gets the source rect that is being used. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::GetClipVideoRect(IDVDRect **ppRect){
HRESULT hr = S_OK;
IBasicVideo* pIVid = NULL;
try {
if(NULL == ppRect){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
// If windowless and m_pDvdClipRect hasn't been yet,
// then the clipping size is the default video size
if (m_bWndLess && !m_pClipRect) {
return GetVideoSize(ppRect);
}
long lLeft=0, lTop=0, lWidth=0, lHeight=0;
hr = ::CoCreateInstance(CLSID_DVDRect, NULL, CLSCTX_INPROC, IID_IDVDRect, (LPVOID*) ppRect);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
IDVDRect* pIRect = *ppRect; // just to make the code esier to read
// Windowed case, it'll be cached in m_rcvdClipRect
if (m_bWndLess) {
// get it from cached m_pDvdClipRect
hr = pIRect->put_x(m_pClipRect->left);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = pIRect->put_y(m_pClipRect->top);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = pIRect->put_Width(RECTWIDTH(m_pClipRect));
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = pIRect->put_Height(RECTHEIGHT(m_pClipRect));
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
}
// Windowed case, get it from IBasicVideo
else {
hr = TraverseForInterface(IID_IBasicVideo, (LPVOID*) &pIVid);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = pIVid->GetSourcePosition(&lLeft, &lTop, &lWidth, &lHeight);
pIVid->Release();
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = pIRect->put_x(lLeft);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = pIRect->put_y(lTop);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = pIRect->put_Width(lWidth);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = pIRect->put_Height(lHeight);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
}
}/* end of try statement */
catch(HRESULT hrTmp){
if(NULL != pIVid){
pIVid->Release();
pIVid = NULL;
}/* end of if statement */
hr = hrTmp;
}/* end of catch statement */
catch(...){
if(NULL != pIVid){
pIVid->Release();
pIVid = NULL;
}/* end of if statement */
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function GetClipVideoRect */
/*************************************************************************/
/* Function: GetVideoSize */
/* Description: Gets the video, size. 0, 0 for origin for now. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::GetVideoSize(IDVDRect **ppRect){
HRESULT hr = S_OK;
IBasicVideo* pIVid = NULL;
try {
if(NULL == ppRect){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
// Windowless case
if(m_bWndLess){
if(!m_pDDEX){
throw(E_UNEXPECTED);
}/* end of if statement */
DWORD dwVideoWidth, dwVideoHeight, dwAspectX, dwAspectY;
hr = m_pDDEX->GetNativeVideoProps(&dwVideoWidth, &dwVideoHeight, &dwAspectX, &dwAspectY);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
m_dwVideoWidth = dwVideoWidth;
m_dwVideoHeight = dwVideoWidth*3/4;
//m_dwVideoHeight = dwVideoHeight;
m_dwAspectX = dwAspectX;
m_dwAspectY = dwAspectY;
//ATLTRACE(TEXT("GetNativeVideoProps %d %d %d %d\n"), dwVideoWidth, dwVideoHeight, dwAspectX, dwAspectY);
}
// Windowed case, get it from IBasicVideo
else {
hr = TraverseForInterface(IID_IBasicVideo, (LPVOID*) &pIVid);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = pIVid->GetVideoSize((LONG*)&m_dwVideoWidth, (LONG*)&m_dwVideoHeight);
pIVid->Release();
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
}/* end of if statement */
hr = ::CoCreateInstance(CLSID_DVDRect, NULL, CLSCTX_INPROC, IID_IDVDRect, (LPVOID*) ppRect);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
IDVDRect* pIRect = *ppRect; // just to make the code esier to read
hr = pIRect->put_Width(m_dwVideoWidth);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = pIRect->put_Height(m_dwVideoHeight);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
if(NULL != pIVid){
pIVid->Release();
pIVid = NULL;
}/* end of if statement */
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
if(NULL != pIVid){
pIVid->Release();
pIVid = NULL;
}/* end of if statement */
}/* end of catch statement */
return HandleError(hr);
}/* end of function GetVideoSize */
/*************************************************************/
/* Name: AdjustDestRC
/* Description: Adjust dest RC to the right aspect ratio
/*************************************************************/
HRESULT CMSWebDVD::AdjustDestRC(){
if(!m_fInitialized){
return(E_FAIL);
}/* end of if statement */
m_rcPosAspectRatioAjusted = m_rcPos;
RECT rc = m_rcPos;
//ATLTRACE(TEXT("Dest Rect %d %d %d %d\n"), rc.left, rc.top, rc.right, rc.bottom);
long width = RECTWIDTH(&rc);
long height = RECTHEIGHT(&rc);
// Make sure we get the right aspect ratio
CComPtr<IDVDRect> pDvdRect;
HRESULT hr = GetVideoSize(&pDvdRect);
if (FAILED(hr))
return hr;
double aspectRatio = m_dwAspectX/(double)m_dwAspectY;
long adjustedHeight, adjustedWidth;
adjustedHeight = long (width / aspectRatio);
if (adjustedHeight<=height) {
rc.top += (height-adjustedHeight)/2;
rc.bottom = rc.top + adjustedHeight;
}
else {
adjustedWidth = long (height * aspectRatio);
rc.left += (width - adjustedWidth)/2;
rc.right = rc.left + adjustedWidth;
}
//ATLTRACE(TEXT("Ajusted Dest Rect %d %d %d %d\n"), rc.left, rc.top, rc.right, rc.bottom);
m_rcPosAspectRatioAjusted = rc;
return S_OK;
}
/*************************************************************************/
/* Function: SetClipVideoRect */
/* Description: Set a video source rect. TODO: Might want to handle */
/* preserving aspect ratio. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::SetClipVideoRect(IDVDRect *pIRect){
HRESULT hr = S_OK;
IBasicVideo* pIVid = NULL;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
long lLeft = 0, lTop = 0, lWidth = 0, lHeight = 0;
if(NULL == pIRect){
if (m_pClipRect) {
delete m_pClipRect;
m_pClipRect = NULL;
} /* end of if statement */
}
else {
hr = pIRect->get_x(&lLeft);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = pIRect->get_y(&lTop);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = pIRect->get_Width(&lWidth);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = pIRect->get_Height(&lHeight);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
}
CComPtr<IDVDRect> pDvdRect;
hr = GetVideoSize(&pDvdRect);
if (FAILED(hr))
throw(hr);
// Get video width and height
long videoWidth, videoHeight;
pDvdRect->get_Width(&videoWidth);
pDvdRect->get_Height(&videoHeight);
if (lLeft < 0 || lLeft >= videoWidth || lTop < 0 || lTop >= videoHeight){
throw(E_INVALIDARG);
}/* end of if statement */
if (lLeft+lWidth > videoWidth || lTop+lHeight > videoHeight){
throw(E_INVALIDARG);
}/* end of if statement */
// Windowless case
if (m_bWndLess) {
#if 0
hr = AdjustDestRC();
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
RECT rc = m_rcPosAspectRatioAjusted;
if (!pIRect)
rc = m_rcPos;
#else
RECT rc = m_rcPos;
#endif
HWND hwnd;
hr = GetUsableWindow(&hwnd);
if(FAILED(hr)){
return(hr);
}/* end of if statement */
::MapWindowPoints(hwnd, ::GetDesktopWindow(), (LPPOINT)&rc, 2);
//ATLTRACE(TEXT("Ajusted Dest Rect %d %d %d %d\n"), rc.left, rc.top, rc.right, rc.bottom);
if(m_pDDEX){
if (pIRect) {
if (!m_pClipRect)
m_pClipRect = new RECT;
m_pClipRect->left = lLeft;
m_pClipRect->top = lTop;
m_pClipRect->right = lLeft+lWidth;
m_pClipRect->bottom = lTop + lHeight;
hr = m_pDDEX->SetDrawParameters(m_pClipRect, &rc);
}
else {
hr = m_pDDEX->SetDrawParameters(NULL, &rc);
}
}/* end of if statement */
}/* end of if statement */
// Windowed case, set it via IBasicVideo
else {
hr = TraverseForInterface(IID_IBasicVideo, (LPVOID*) &pIVid);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
if (pIRect) {
if (!m_pClipRect)
m_pClipRect = new RECT;
m_pClipRect->left = lLeft;
m_pClipRect->top = lTop;
m_pClipRect->right = lLeft+lWidth;
m_pClipRect->bottom = lTop + lHeight;
hr = pIVid->SetSourcePosition(lLeft, lTop, lWidth, lHeight);
}
else {
hr = pIVid->SetDefaultSourcePosition();
}
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
//hr = pIVid->SetDestinationPosition(m_rcPos.left, m_rcPos.top, WIDTH(&m_rcPos), HEIGHT(&m_rcPos));
pIVid->Release();
pIVid = NULL;
#if 0
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
#endif
}
}
catch(HRESULT hrTmp){
if(NULL != pIVid){
pIVid->Release();
pIVid = NULL;
}/* end of if statement */
hr = hrTmp;
}/* end of catch statement */
catch(...){
if(NULL != pIVid){
pIVid->Release();
pIVid = NULL;
}/* end of if statement */
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function SetClipVideoRect */
/*************************************************************************/
/* Function: get_DVDAdm */
/* Description: Returns DVD admin interface. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_DVDAdm(IDispatch **pVal){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if (m_pDvdAdmin){
hr = m_pDvdAdmin->QueryInterface(IID_IDispatch, (LPVOID*)pVal);
}
else {
*pVal = NULL;
throw(E_FAIL);
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_DVDAdm */
/*************************************************************************/
/* Function: GetPlayerParentalLevel */
/* Description: Gets the player parental level. *
/*************************************************************************/
STDMETHODIMP CMSWebDVD::GetPlayerParentalLevel(long *plParentalLevel){
HRESULT hr = S_OK;
try {
if(NULL == plParentalLevel){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
ULONG ulLevel;
BYTE bCountryCode[2];
hr = m_pDvdInfo2->GetPlayerParentalLevel(&ulLevel, bCountryCode);
if(SUCCEEDED(hr)){
*plParentalLevel = ulLevel;
}
else {
*plParentalLevel = 0;
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function GetPlayerParentalLevel */
/*************************************************************************/
/* Function: GetPlayerParentalCountry */
/* Description: Gets the player parental country. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::GetPlayerParentalCountry(long *plCountryCode){
HRESULT hr = S_OK;
try {
if(NULL == plCountryCode){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
BYTE bCountryCode[2];
ULONG ulLevel;
hr = m_pDvdInfo2->GetPlayerParentalLevel(&ulLevel, bCountryCode);
if(SUCCEEDED(hr)){
*plCountryCode = bCountryCode[0]<<8 | bCountryCode[1];
}
else {
*plCountryCode = 0;
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function GetPlayerParentalCountry */
/*************************************************************************/
/* Function: GetTitleParentalLevels */
/* Description: Gets the parental level associated with a specific title.*/
/*************************************************************************/
STDMETHODIMP CMSWebDVD::GetTitleParentalLevels(long lTitle, long *plParentalLevels){
HRESULT hr = S_OK;
try {
if(NULL == plParentalLevels){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
ULONG ulLevel;
hr = m_pDvdInfo2->GetTitleParentalLevels(lTitle, &ulLevel);
if(SUCCEEDED(hr)){
*plParentalLevels = ulLevel;
}
else {
*plParentalLevels = 0;
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function GetTitleParentalLevels */
/*************************************************************************/
/* Function: SelectParentalLevel */
/* Description: Selects the parental level. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::SelectParentalLevel(long lParentalLevel, BSTR strUserName, BSTR strPassword){
HRESULT hr = S_OK;
try {
if (lParentalLevel != LEVEL_DISABLED &&
(lParentalLevel < LEVEL_G || lParentalLevel > LEVEL_ADULT)) {
throw (E_INVALIDARG);
} /* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
// Confirm password first
VARIANT_BOOL temp;
hr = m_pDvdAdmin->_ConfirmPassword(NULL, strPassword, &temp);
if (temp == VARIANT_FALSE)
throw (E_ACCESSDENIED);
hr = SelectParentalLevel(lParentalLevel);
}
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}
return HandleError(hr);
}
/*************************************************************************/
/* Function: SelectParentalLevel */
/* Description: Selects the parental level. */
/*************************************************************************/
HRESULT CMSWebDVD::SelectParentalLevel(long lParentalLevel){
HRESULT hr = S_OK;
try {
//INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdCtl2->SelectParentalLevel(lParentalLevel);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return (hr);
}/* end of function SelectParentalLevel */
/*************************************************************************/
/* Function: SelectParentalCountry */
/* Description: Selects Parental Country. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::SelectParentalCountry(long lCountry, BSTR strUserName, BSTR strPassword){
HRESULT hr = S_OK;
try {
if(lCountry < 0 && lCountry > 0xffff){
throw(E_INVALIDARG);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
// Confirm password first
VARIANT_BOOL temp;
hr = m_pDvdAdmin->_ConfirmPassword(NULL, strPassword, &temp);
if (temp == VARIANT_FALSE)
throw (E_ACCESSDENIED);
hr = SelectParentalCountry(lCountry);
}
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}
return HandleError(hr);
}
/*************************************************************************/
/* Function: SelectParentalCountry */
/* Description: Selects Parental Country. */
/*************************************************************************/
HRESULT CMSWebDVD::SelectParentalCountry(long lCountry){
HRESULT hr = S_OK;
try {
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
BYTE bCountryCode[2];
bCountryCode[0] = BYTE(lCountry>>8);
bCountryCode[1] = BYTE(lCountry);
hr = m_pDvdCtl2->SelectParentalCountry(bCountryCode);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return (hr);
}/* end of function SelectParentalCountry */
/*************************************************************************/
/* Function: put_NotifyParentalLevelChange */
/* Description: Sets the flag if to notify when parental level change */
/* notification is required on the fly. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::NotifyParentalLevelChange(VARIANT_BOOL fNotify){
HRESULT hr = S_OK;
try {
//TODO: Add IE parantal level control
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdCtl2->SetOption(DVD_NotifyParentalLevelChange,
VARIANT_FALSE == fNotify? FALSE : TRUE);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function NotifyParentalLevelChange */
/*************************************************************************/
/* Function: AcceptParentalLevelChange */
/* Description: Accepts the temprary parental level change that is */
/* done on the fly. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::AcceptParentalLevelChange(VARIANT_BOOL fAccept, BSTR strUserName, BSTR strPassword){
VARIANT_BOOL fRight;
HRESULT hr = m_pDvdAdmin->_ConfirmPassword(NULL, strPassword, &fRight);
// if password is wrong and want to accept, no
if (fAccept != VARIANT_FALSE && fRight == VARIANT_FALSE)
return E_ACCESSDENIED;
try {
// should not make sense to do initialization here, since this should
// be a response to a callback
//INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdCtl2->AcceptParentalLevelChange(VARIANT_FALSE == fAccept? FALSE : TRUE);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function AcceptParentalLevelChange */
/*************************************************************/
/* Name: Eject */
/* Description: Stop DVD playback and eject DVD from drive */
/* Inserts the disk as well. */
/*************************************************************/
STDMETHODIMP CMSWebDVD::Eject(){
HRESULT hr = S_OK;
try {
USES_CONVERSION;
DWORD dwHandle;
BSTR root;
hr = get_DVDDirectory(&root);
if (FAILED(hr))
throw (hr);
LPTSTR szDriveLetter = OLE2T(root);
::SysFreeString(root);
if(m_bEjected == false){
if(szDriveLetter[0] == 0){
throw(S_FALSE);
}/* end of if statement */
DWORD dwErr;
dwHandle = OpenCdRom(szDriveLetter[0], &dwErr);
if (dwErr != MMSYSERR_NOERROR){
throw(S_FALSE);
}/* end of if statement */
EjectCdRom(dwHandle);
}
else{
//do uneject
DWORD dwErr;
dwHandle = OpenCdRom(szDriveLetter[0], &dwErr);
if (dwErr != MMSYSERR_NOERROR){
throw(S_FALSE);
}/* end of if statement */
UnEjectCdRom(dwHandle);
}/* end of if statement */
CloseCdRom(dwHandle);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function Eject */
/*************************************************************************/
/* Function: SetGPRM */
/* Description: Sets a GPRM at index. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::SetGPRM(long lIndex, short sValue){
HRESULT hr = S_OK;
try {
if(lIndex < 0){
throw(E_INVALIDARG);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdCtl2->SetGPRM(lIndex, sValue, cdwDVDCtrlFlags, 0);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function SetGPRM */
/*************************************************************************/
/* Function: Capture */
/* Capture a image from DVD stream, convert it to RGB, and save it */
/* to file. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::Capture(){
HWND hwnd = NULL;
HRESULT hr = S_OK;
YUV_IMAGE *lpImage = NULL;
try {
hr = GetUsableWindow(&hwnd);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(::IsWindow(m_hWnd)){
throw(E_NO_CAPTURE_SUPPORT);
}/* end of if statement */
if(!m_pDDEX){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDDEX->IsImageCaptureSupported();
if(S_FALSE == hr){
throw(E_FORMAT_NOT_SUPPORTED);
}/* end of if statement */
hr = m_pDDEX->GetCurrentImage(&lpImage);
if (SUCCEEDED(hr))
{
#if 0
// use the GDI version first, it should work when GDI+ is installed (Millennium)
// otherwise use the standalone version
// 12.04.00 GDI+ interfaces have changed and the function needs to be rewritten
// look at this for blackcomb maybe for now just do the non-GDI+ function
hr = GDIConvertImageAndSave(lpImage, m_pClipRect, hwnd);
if(FAILED(hr))
#endif
{
hr = ConvertImageAndSave(lpImage, m_pClipRect, hwnd);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
}
}
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
if(lpImage){
CoTaskMemFree(lpImage);
}
return HandleError(hr);
}/* end of function Capture */
/*************************************************************/
/* Name: get_CursorType */
/* Description: Return cursor type over video */
/*************************************************************/
STDMETHODIMP CMSWebDVD::get_CursorType(DVDCursorType *pVal){
HRESULT hr = S_OK;
try {
if(NULL == pVal){
throw(E_POINTER);
}/* end of if statement */
*pVal = m_nCursorType;
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function get_CursorType */
/*************************************************************/
/* Name: put_CursorType */
/* Description: Set cursor type over video */
/*************************************************************/
STDMETHODIMP CMSWebDVD::put_CursorType(DVDCursorType newVal){
HRESULT hr = S_OK;
try {
if (newVal<dvdCursor_None || newVal>dvdCursor_Hand) {
throw (E_INVALIDARG);
} /* end of if statement */
m_nCursorType = newVal;
if (m_hCursor)
::DestroyCursor(m_hCursor);
switch(m_nCursorType) {
case dvdCursor_ZoomIn:
case dvdCursor_ZoomOut:
m_hCursor = ::LoadCursor(_Module.GetModuleInstance(), MAKEINTRESOURCE(IDC_ZOOMIN));
break;
case dvdCursor_Hand:
m_hCursor = ::LoadCursor(_Module.GetModuleInstance(), MAKEINTRESOURCE(IDC_HAND));
break;
case dvdCursor_Arrow:
default:
//#define OCR_ARROW_DEFAULT 100
// need special cursor, we we do not have color key around it
//m_hCursor = (HCURSOR) ::LoadImage((HINSTANCE) NULL,
// MAKEINTRESOURCE(OCR_ARROW_DEFAULT),
// IMAGE_CURSOR,0,0,0);
m_hCursor = ::LoadCursor(NULL, MAKEINTRESOURCE(OCR_ARROW_DEFAULT));
break;
}
if (m_hCursor)
::SetCursor(m_hCursor);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function put_CursorType */
/*************************************************************/
/* Name: Zoom
/* Description: Zoom in at (x, y) in original video
/* enlarge or decrease video size by zoomRatio
/* if zoomRatio > 1 zoom in
/* if zoomRatio = 1
/* if zoomRatio < 1 zoom out
/* if zoomRatio <= 0 invalid
/*************************************************************/
STDMETHODIMP CMSWebDVD::Zoom(long x, long y, double zoomRatio){
HRESULT hr = S_OK;
try {
if (zoomRatio< 0){
throw(E_INVALIDARG);
}/* end of if statement */
// Can't go beyond 1.0
if (m_dZoomRatio <= 1.0) {
if (zoomRatio <= 1.0) {
m_dZoomRatio = 1.0;
throw(hr);
}
m_dZoomRatio = 1.0;
}
// Can't go beyond the max stretch factor
if (m_dZoomRatio*zoomRatio > m_dwOvMaxStretch/1000.0)
throw hr;
m_dZoomRatio *= zoomRatio;
// Can't go beyond 1.0
if (m_dZoomRatio <= 1.0)
m_dZoomRatio = 1.0;
CComPtr<IDVDRect> pDvdRect;
hr = GetVideoSize(&pDvdRect);
if (FAILED(hr))
throw(hr);
if(1.0 == m_dZoomRatio){
hr = SetClipVideoRect(NULL);
put_CursorType(dvdCursor_Arrow);
throw(hr);
}/* end of if statement */
// Get video width and height
long videoWidth, videoHeight;
pDvdRect->get_Width(&videoWidth);
pDvdRect->get_Height(&videoHeight);
if (x < 0 || x >= videoWidth || y < 0 || y >= videoHeight){
throw(E_INVALIDARG);
}/* end of if statement */
// Compute new clipping width and height
long mcd = MCD(m_dwVideoWidth, m_dwVideoHeight);
long videoX = m_dwVideoWidth/mcd;
long videoY = m_dwVideoHeight/mcd;
long newClipHeight = (long) (videoHeight/m_dZoomRatio);
newClipHeight /= videoY;
newClipHeight *= videoY;
if (newClipHeight < 1) newClipHeight = 1;
long newClipWidth = (long) (newClipHeight*videoX/videoY);
if (newClipWidth < 1) newClipWidth = 1;
// Can't go beyong native video size
if (newClipWidth>videoWidth)
newClipWidth = videoWidth;
if (newClipHeight>videoHeight)
newClipHeight = videoHeight;
if (newClipWidth == videoWidth && newClipHeight == videoHeight) {
put_CursorType(dvdCursor_Arrow);
}
else {
put_CursorType(dvdCursor_Hand);
}
long newClipX = x - newClipWidth/2;
long newClipY = y - newClipHeight/2;
// Can't go outsize the native video rect
if (newClipX < 0)
newClipX = 0;
else if (newClipX + newClipWidth > videoWidth)
newClipX = videoWidth - newClipWidth;
if (newClipY < 0)
newClipY = 0;
else if (newClipY + newClipHeight > videoHeight)
newClipY = videoHeight - newClipHeight;
CComPtr<IDVDRect> pDvdClipRect;
hr = GetClipVideoRect(&pDvdClipRect);
if (FAILED(hr))
throw(hr);
pDvdClipRect->put_x(newClipX);
pDvdClipRect->put_y(newClipY);
pDvdClipRect->put_Width(newClipWidth);
pDvdClipRect->put_Height(newClipHeight);
hr = SetClipVideoRect(pDvdClipRect);
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function Zoom */
/*************************************************************************/
/* Function: RegionChange */
/* Description:Changes the region code. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::RegionChange(){
USES_CONVERSION;
HRESULT hr = S_OK;
typedef BOOL (APIENTRY *DVDPPLAUNCHER) (HWND HWnd, CHAR DriveLetter);
try {
HWND parentWnd = NULL;
HRESULT hrTmp = GetParentHWND(&parentWnd);
if (SUCCEEDED(hrTmp) && (NULL != parentWnd)) {
// take the container out of the top-most mode
::SetWindowPos(parentWnd, HWND_NOTOPMOST, 0, 0, 0, 0,
SWP_NOREDRAW|SWP_NOMOVE|SWP_NOSIZE);
}
BOOL regionChanged = FALSE;
OSVERSIONINFO ver;
ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
::GetVersionEx(&ver);
if (ver.dwPlatformId==VER_PLATFORM_WIN32_NT) {
HINSTANCE dllInstance;
DVDPPLAUNCHER dvdPPLauncher;
TCHAR szCmdLine[MAX_PATH], szDriveLetter[4];
LPSTR szDriveLetterA;
//
// tell the user why we are showing the dvd region property page
//
// DVDMessageBox(m_hWnd, IDS_REGION_CHANGE_PROMPT);
hr = getDVDDriveLetter(szDriveLetter);
if(FAILED(hr)){
hr = E_UNEXPECTED;
throw(hr);
}/* end of if statement */
szDriveLetterA = T2A(szDriveLetter);
GetSystemDirectory(szCmdLine, MAX_PATH);
StringCchCat(szCmdLine, sizeof(szCmdLine) / sizeof(szCmdLine), _T("\\storprop.dll"));
dllInstance = LoadLibrary (szCmdLine);
if (dllInstance) {
dvdPPLauncher = (DVDPPLAUNCHER) GetProcAddress(
dllInstance,
"DvdLauncher");
if (dvdPPLauncher) {
regionChanged = dvdPPLauncher(this->m_hWnd,
szDriveLetterA[0]);
}
FreeLibrary(dllInstance);
}
}
else {
#if 0 // need to check for win9x or winnt
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
//Get path of \windows\dvdrgn.exe and command line string
TCHAR szCmdLine[MAX_PATH], szDriveLetter[4];
hr = getDVDDriveLetter(szDriveLetter);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
GetWindowsDirectory(szCmdLine, MAX_PATH);
StringCchCat(szCmdLine, sizeof(szCmdLine) / sizeof(szCmdLine[0]), _T("\\dvdrgn.exe "));
TCHAR strModuleName[MAX_PATH];
lstrcpyn(strModuleName, szCmdLine, sizeof(strModuleName) / sizeof(strModuleName[0]));
TCHAR csTmp[2]; ::ZeroMemory(csTmp, sizeof(TCHAR)* 2);
csTmp[0] = szDriveLetter[0];
StringCchCat(szCmdLine, sizeof(szCmdLine) / sizeof(szCmdLine[0]), csTmp);
//Prepare and execuate dvdrgn.exe
STARTUPINFO StartupInfo;
PROCESS_INFORMATION ProcessInfo;
StartupInfo.cb = sizeof(StartupInfo);
StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow = SW_SHOW;
StartupInfo.lpReserved = NULL;
StartupInfo.lpDesktop = NULL;
StartupInfo.lpTitle = NULL;
StartupInfo.cbReserved2 = 0;
StartupInfo.lpReserved2 = NULL;
if( ::CreateProcess(strModuleName, szCmdLine, NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS,
NULL, NULL, &StartupInfo, &ProcessInfo) ){
//Wait dvdrgn.exe finishes.
WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
DWORD dwRet = 1;
BOOL bRet = GetExitCodeProcess(ProcessInfo.hProcess, &dwRet);
if(dwRet == 0){
//User changed the region successfully
regionChanged = TRUE;
}
else{
throw(E_REGION_CHANGE_NOT_COMPLETED);
}
}/* end of if statement */
#endif
}/* end of if statement */
if (regionChanged) {
// start playing again
hr = Play();
}
else {
throw(E_REGION_CHANGE_FAIL);
}/* end of if statement */
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function RegionChange */
/*************************************************************************/
/* Function: getDVDDriveLetter */
/* Description: Gets the first three characters that denote the DVD-ROM */
/*************************************************************************/
HRESULT CMSWebDVD::getDVDDriveLetter(TCHAR* lpDrive) {
HRESULT hr = E_FAIL;
if(!m_pDvdInfo2){
hr = E_UNEXPECTED;
return(hr);
}/* end of if statement */
WCHAR szRoot[MAX_PATH];
ULONG ulActual;
hr = m_pDvdInfo2->GetDVDDirectory(szRoot, MAX_PATH, &ulActual);
if(FAILED(hr)){
return(hr);
}/* end of if statement */
USES_CONVERSION;
lstrcpyn(lpDrive, OLE2T(szRoot), 3);
if(::GetDriveType(&lpDrive[0]) == DRIVE_CDROM){
return(hr);
}
else {
//possibly root=c: or drive in hard disc
hr = E_FAIL;
return(hr);
}/* end of if statement */
// does not seem to make sense to loop to figure out the drive letter
#if 0
DWORD totChrs = GetLogicalDriveStrings(MAX_PATH, szTemp); //get all drives
ptr = szTemp;
for(DWORD i = 0; i < totChrs; i+=4) //look at these drives one by one
{
if(GetDriveType(ptr) == DRIVE_CDROM) //look only CD-ROM and see if it has a disc
{
TCHAR achDVDFilePath1[MAX_PATH], achDVDFilePath2[MAX_PATH];
lstrcpyn(achDVDFilePath1, ptr, 4);
lstrcpyn(achDVDFilePath2, ptr, 4);
lstrcat(achDVDFilePath1, _T("Video_ts\\Video_ts.ifo"));
lstrcat(achDVDFilePath2, _T("Video_ts\\Vts_01_0.ifo"));
if( ((CDvdplayApp*) AfxGetApp())->DoesFileExist(achDVDFilePath1) &&
((CDvdplayApp*) AfxGetApp())->DoesFileExist(achDVDFilePath2) )
{
lstrcpyn(lpDrive, ptr, 3);
return(hr); //Return the first found drive which has a valid DVD disc
}
}
ptr += 4;
}
#endif
return(hr);
}/* end of function getDVDDriveLetter */
/*************************************************************/
/* Name: SelectDefaultAudioLanguage
/* Description:
/*************************************************************/
STDMETHODIMP CMSWebDVD::SelectDefaultAudioLanguage(long lang, long ext){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdCtl2 || !m_pDvdAdmin){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdCtl2->SelectDefaultAudioLanguage(lang, (DVD_AUDIO_LANG_EXT)ext);
if (FAILED(hr))
throw(hr);
// Save it with DVDAdmin
//hr = m_pDvdAdmin->put_DefaultAudioLCID(lang);
//if (FAILED(hr))
// throw(hr);
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}
/*************************************************************/
/* Name: SelectDefaultSubpictureLanguage
/* Description:
/*************************************************************/
STDMETHODIMP CMSWebDVD::SelectDefaultSubpictureLanguage(long lang, DVDSPExt ext){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdCtl2 || !m_pDvdAdmin){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdCtl2->SelectDefaultSubpictureLanguage(lang, (DVD_SUBPICTURE_LANG_EXT)ext);
if (FAILED(hr))
throw(hr);
// Save it with DVDAdmin
//hr = m_pDvdAdmin->put_DefaultSubpictureLCID(lang);
//if (FAILED(hr))
// throw(hr);
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}
/*************************************************************/
/* Name: put_DefaultMenuLanguage
/* Description:
/*************************************************************/
STDMETHODIMP CMSWebDVD::put_DefaultMenuLanguage(long lang){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdCtl2 || !m_pDvdAdmin){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdCtl2->SelectDefaultMenuLanguage(lang);
if (FAILED(hr))
throw(hr);
// Save it with DVDAdmin
//hr = m_pDvdAdmin->put_DefaultMenuLCID(lang);
//if (FAILED(hr))
// throw(hr);
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}
/*************************************************************************/
/* Function: get_PreferredSubpictureStream */
/* Description: Gets current audio stream. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::get_PreferredSubpictureStream(long *plPreferredStream){
HRESULT hr = S_OK;
try {
if (NULL == plPreferredStream){
throw(E_POINTER);
}/* end of if statement */
LCID langDefaultSP;
m_pDvdAdmin->get_DefaultSubpictureLCID((long*)&langDefaultSP);
// if none has been set
if (langDefaultSP == (LCID) -1) {
*plPreferredStream = 0;
return hr;
} /* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
USES_CONVERSION;
LCID lcid = 0;
ULONG ulNumAudioStreams = 0;
ULONG ulCurrentStream = 0;
BOOL fDisabled = TRUE;
RETRY_IF_IN_FPDOM(m_pDvdInfo2->GetCurrentSubpicture(&ulNumAudioStreams, &ulCurrentStream, &fDisabled));
*plPreferredStream = 0;
for (ULONG i = 0; i<ulNumAudioStreams; i++) {
hr = m_pDvdInfo2->GetSubpictureLanguage(i, &lcid);
if (SUCCEEDED( hr ) && lcid){
if (lcid == langDefaultSP) {
*plPreferredStream = i;
}
}
}
}
catch(HRESULT hrTmp){
return hrTmp;
}/* end of catch statement */
catch(...){
return E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}
/*************************************************************/
/* Name: get_AspectRatio
/* Description:
/*************************************************************/
STDMETHODIMP CMSWebDVD::get_AspectRatio(double *pVal)
{
HRESULT hr = S_OK;
// Make sure we get the right aspect ratio
try {
if (NULL == pVal){
throw(E_POINTER);
}/* end of if statement */
CComPtr<IDVDRect> pDvdRect;
hr = GetVideoSize(&pDvdRect);
if (FAILED(hr))
throw(hr);
//ATLTRACE(TEXT("get_AspectRatio, %d %d \n"), m_dwAspectX, m_dwAspectY);
*pVal = (m_dwAspectX*1.0)/m_dwAspectY;
}
catch(HRESULT hrTmp){
return hrTmp;
}/* end of catch statement */
catch(...){
return E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}
/*************************************************************************/
/* Function: CanStep */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::CanStep(VARIANT_BOOL fBackwards, VARIANT_BOOL *pfCan){
HRESULT hr = S_OK;
try {
if (NULL == pfCan){
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
*pfCan = VARIANT_FALSE;
// Can't step if still is on
if (m_fStillOn == true) {
throw (hr);
}/* end of if statement */
if(!m_pVideoFrameStep){
throw(E_UNEXPECTED);
}/* end of if statement */
if(VARIANT_FALSE != fBackwards){
if(S_OK != CanStepBackwards()){
// we cannot step on decodors that do not provide smooth backward playback
//*pfCan = VARIANT_FALSE; already set above so do not have to do that any more
hr = S_OK;
throw(hr);
}/* end of if statement */
}/* end of if statement */
hr = m_pVideoFrameStep->CanStep(1L, NULL);
if(S_OK == hr){
*pfCan = VARIANT_TRUE;
}/* end of if statement */
hr = S_OK;
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function CanStep */
/*************************************************************************/
/* Function: Step */
/* Description: Steps forwards or backwords. Mutes un umutes sound if */
/* necessary. */
/*************************************************************************/
STDMETHODIMP CMSWebDVD::Step(long lStep){
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
if(lStep < 0){
// going backwards so check if we can do it
if(S_OK != CanStepBackwards()){
hr = E_FAIL; // aperently we cannot on this decoder
throw(hr);
}/* end of if statement */
}/* end of if statement */
if(!m_pVideoFrameStep){
throw(E_UNEXPECTED);
}/* end of if statement */
bool fUnMute = false;
if(FALSE == m_bMute){
hr = put_Mute(VARIANT_TRUE);
if (SUCCEEDED(hr)){
fUnMute = true;
}/* end of if statement */
}/* end if if statement */
ProcessEvents(); // cleanup the message queu
m_fStepComplete = false;
hr = m_pVideoFrameStep->Step(lStep, NULL);
if(SUCCEEDED(hr)){
HRESULT hrTmp = hr;
hr = E_FAIL;
for(INT i = 0; i < cgnStepTimeout; i++){
// now wait for EC_STEP_COMPLETE flag
ProcessEvents();
if(m_fStepComplete){
hr = hrTmp;
break;
}/* end of if statement */
::Sleep(cdwTimeout);
}/* end of for loop */
}/* end of if statement */
if(fUnMute){
hr = put_Mute(VARIANT_FALSE);
if (FAILED(hr)){
throw(hr);
}/* end of if statement */
}/* end if if statement */
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function Step */
/*************************************************************/
/* Function: CanStepBackwards */
/* Description: Checks if the decoder can step backwqards */
/* cashesh the variable. */
/* Returns S_OK if can, S_FALSE otherwise */
/*************************************************************/
HRESULT CMSWebDVD::CanStepBackwards(){
HRESULT hr = S_OK;
if(m_fBackWardsFlagInitialized){
// pulling out the result from the cache
return (m_fCanStepBackwards ? S_OK : S_FALSE);
}/* end of if statement */
DVD_DECODER_CAPS dvdCaps;
::ZeroMemory(&dvdCaps, sizeof(DVD_DECODER_CAPS));
dvdCaps.dwSize = sizeof(DVD_DECODER_CAPS);
hr = m_pDvdInfo2->GetDecoderCaps(&dvdCaps);
if(FAILED(hr)){
return(hr);
}/* end of if statement */
//dvdCaps.dBwdMaxRateVideo is zero if decoder does not support smooth reverse
// playback that means it will not support reverse stepping mechanism as well
if(0 == dvdCaps.dBwdMaxRateVideo){
// we cannot step on decodors that do not provide smooth backward playback
m_fBackWardsFlagInitialized = true;
m_fCanStepBackwards = false;
hr = S_FALSE;
return(hr);
}/* end of if statement */
m_fBackWardsFlagInitialized = true;
m_fCanStepBackwards = true;
hr = S_OK;
return(hr);
}/* end of function CanStepBackwards */
/*************************************************************/
/* Name: GetKaraokeChannelAssignment
/* Description:
/*************************************************************/
STDMETHODIMP CMSWebDVD::GetKaraokeChannelAssignment(long lStream, long *lChannelAssignment)
{
HRESULT hr = S_OK;
try {
if(!lChannelAssignment){
return E_POINTER;
}
if(lStream < 0){
throw(E_INVALIDARG);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
DVD_KaraokeAttributes attrib;
RETRY_IF_IN_FPDOM(m_pDvdInfo2->GetKaraokeAttributes(lStream, &attrib));
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
*lChannelAssignment = (long)attrib.ChannelAssignment;
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}
/*************************************************************/
/* Name: GetKaraokeChannelContent
/* Description:
/*************************************************************/
STDMETHODIMP CMSWebDVD::GetKaraokeChannelContent(long lStream, long lChan, long *lContent)
{
HRESULT hr = S_OK;
try {
if(!lContent){
return E_POINTER;
}
if(lStream < 0){
throw(E_INVALIDARG);
}/* end of if statement */
if (lChan >=8 ) {
throw(E_INVALIDARG);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
DVD_KaraokeAttributes attrib;
RETRY_IF_IN_FPDOM(m_pDvdInfo2->GetKaraokeAttributes(lStream, &attrib));
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
*lContent = (long)attrib.wChannelContents[lChan];
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}
/*************************************************************/
/* Name: get_KaraokeAudioPresentationMode
/* Description:
/*************************************************************/
STDMETHODIMP CMSWebDVD::get_KaraokeAudioPresentationMode(long *pVal)
{
HRESULT hr = S_OK;
try {
if (NULL == pVal) {
throw (E_POINTER);
} /* end of if statement */
*pVal = m_lKaraokeAudioPresentationMode;
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}
/*************************************************************/
/* Name: put_KaraokeAudioPresentationMode
/* Description:
/*************************************************************/
STDMETHODIMP CMSWebDVD::put_KaraokeAudioPresentationMode(long newVal)
{
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdCtl2){
throw(E_UNEXPECTED);
}/* end of if statement */
RETRY_IF_IN_FPDOM(m_pDvdCtl2->SelectKaraokeAudioPresentationMode((ULONG)newVal));
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
// Cache the value
m_lKaraokeAudioPresentationMode = newVal;
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}
/*************************************************************/
/* Name: get_DefaultAudioLanguage
/* Description:
/*************************************************************/
STDMETHODIMP CMSWebDVD::get_DefaultAudioLanguage(long *lang)
{
HRESULT hr = S_OK;
try {
if(NULL == lang){
throw (E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw (E_UNEXPECTED);
}/* end of if statement */
long ext;
hr = m_pDvdInfo2->GetDefaultAudioLanguage((LCID*)lang, (DVD_AUDIO_LANG_EXT*)&ext);
if (FAILED(hr))
throw(hr);
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}
/*************************************************************/
/* Name: get_DefaultAudioLanguageExt
/* Description:
/*************************************************************/
STDMETHODIMP CMSWebDVD::get_DefaultAudioLanguageExt(long *ext)
{
HRESULT hr = S_OK;
try {
if(NULL == ext){
throw (E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw (E_UNEXPECTED);
}/* end of if statement */
long lang;
hr = m_pDvdInfo2->GetDefaultAudioLanguage((LCID*)&lang, (DVD_AUDIO_LANG_EXT*)ext);
if (FAILED(hr))
throw(hr);
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}
/*************************************************************/
/* Name: get_DefaultSubpictureLanguage
/* Description:
/*************************************************************/
STDMETHODIMP CMSWebDVD::get_DefaultSubpictureLanguage(long *lang)
{
HRESULT hr = S_OK;
try {
if(NULL == lang){
throw (E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw (E_UNEXPECTED);
}/* end of if statement */
long ext;
hr = m_pDvdInfo2->GetDefaultSubpictureLanguage((LCID*)lang, (DVD_SUBPICTURE_LANG_EXT*)&ext);
if (FAILED(hr))
throw(hr);
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}
/*************************************************************/
/* Name: get_DefaultSubpictureLanguageExt
/* Description:
/*************************************************************/
STDMETHODIMP CMSWebDVD::get_DefaultSubpictureLanguageExt(DVDSPExt *ext)
{
HRESULT hr = S_OK;
try {
if(NULL == ext){
throw (E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw (E_UNEXPECTED);
}/* end of if statement */
long lang;
hr = m_pDvdInfo2->GetDefaultSubpictureLanguage((LCID*)&lang, (DVD_SUBPICTURE_LANG_EXT*)ext);
if (FAILED(hr))
throw(hr);
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}
/*************************************************************/
/* Name: get_DefaultMenuLanguage
/* Description:
/*************************************************************/
STDMETHODIMP CMSWebDVD::get_DefaultMenuLanguage(long *lang)
{
HRESULT hr = S_OK;
try {
if(NULL == lang){
throw (E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw (E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdInfo2->GetDefaultMenuLanguage((LCID*)lang);
if (FAILED(hr))
throw(hr);
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}
/*************************************************************/
/* Name: RestoreDefaultSettings
/* Description:
/*************************************************************/
HRESULT CMSWebDVD::RestoreDefaultSettings()
{
HRESULT hr = S_OK;
try {
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdAdmin){
throw (E_UNEXPECTED);
}/* end of if statement */
if(!m_pDvdInfo2){
throw (E_UNEXPECTED);
}/* end of if statement */
// get the curent domain
DVD_DOMAIN domain;
hr = m_pDvdInfo2->GetCurrentDomain(&domain);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
// Have to be in the stop domain
if(DVD_DOMAIN_Stop != domain)
throw (VFW_E_DVD_INVALIDDOMAIN);
long level;
hr = m_pDvdAdmin->GetParentalLevel(&level);
if (SUCCEEDED(hr))
SelectParentalLevel(level);
LCID audioLCID;
LCID subpictureLCID;
LCID menuLCID;
hr = m_pDvdAdmin->get_DefaultAudioLCID((long*)&audioLCID);
if (SUCCEEDED(hr))
SelectDefaultAudioLanguage(audioLCID, 0);
hr = m_pDvdAdmin->get_DefaultSubpictureLCID((long*)&subpictureLCID);
if (SUCCEEDED(hr))
SelectDefaultSubpictureLanguage(subpictureLCID, dvdSPExt_NotSpecified);
hr = m_pDvdAdmin->get_DefaultMenuLCID((long*)&menuLCID);
if (SUCCEEDED(hr))
put_DefaultMenuLanguage(menuLCID);
}
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}
/*************************************************************************/
/* DVD Helper Methods, used by the default interface */
/*************************************************************************/
/*************************************************************************/
/* Function: GetColorKey */
/* Description: Gets a colorkey via RGB filled COLORREF or palette index.*/
/* Helper function. */
/*************************************************************************/
HRESULT CMSWebDVD::GetColorKey(COLORREF* pClr)
{
HRESULT hr = S_OK;
if(m_pDvdGB == NULL)
return(E_FAIL);
CComPtr<IMixerPinConfig2> pMixerPinConfig;
hr = m_pDvdGB->GetDvdInterface(IID_IMixerPinConfig2, (LPVOID *) &pMixerPinConfig);
if(FAILED(hr))
return(hr);
COLORKEY ck;
DWORD dwColor;
hr = pMixerPinConfig->GetColorKey(&ck, &dwColor); // get the color key
if(FAILED(hr))
return(hr);
HWND hwnd = ::GetDesktopWindow();
HDC hdc = ::GetWindowDC(hwnd);
if(NULL == hdc){
return(E_UNEXPECTED);
}/* end of if statement */
BOOL bPalette = (RC_PALETTE == (RC_PALETTE & GetDeviceCaps( hdc, RASTERCAPS )));
if ((ck.KeyType & CK_INDEX)&& bPalette) {
PALETTEENTRY PaletteEntry;
UINT nTmp = GetSystemPaletteEntries( hdc, ck.PaletteIndex, 1, &PaletteEntry );
if ( nTmp == 1 )
{
*pClr = RGB( PaletteEntry.peRed, PaletteEntry.peGreen, PaletteEntry.peBlue );
}
}
else if (ck.KeyType & CK_RGB)
{
*pClr = ck.HighColorValue; // set the RGB color
}
::ReleaseDC(hwnd, hdc);
return(hr);
}/* end of function GetColorKey */
/*************************************************************************/
/* Function: SetColorKey */
/* Description: Sets a colorkey via RGB filled COLORREF. */
/* Helper function. */
/*************************************************************************/
HRESULT CMSWebDVD::SetColorKey(COLORREF clr){
HRESULT hr = S_OK;
if(m_pDvdGB == NULL)
return(E_FAIL);
CComPtr<IMixerPinConfig2> pMixerPinConfig;
hr = m_pDvdGB->GetDvdInterface(IID_IMixerPinConfig2, (LPVOID *) &pMixerPinConfig);
if( SUCCEEDED( hr )){
COLORKEY ck;
HWND hwnd = ::GetDesktopWindow();
HDC hdc = ::GetWindowDC(hwnd);
if(NULL == hdc){
return(E_UNEXPECTED);
}/* end of if statement */
if((::GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE) == RC_PALETTE)
{
ck.KeyType = CK_INDEX|CK_RGB; // have an index to the palette
ck.PaletteIndex = 253;
PALETTEENTRY PaletteEntry;
UINT nTmp = GetSystemPaletteEntries( hdc, ck.PaletteIndex, 1, &PaletteEntry );
if ( nTmp == 1 )
{
ck.LowColorValue = ck.HighColorValue = RGB( PaletteEntry.peRed, PaletteEntry.peGreen, PaletteEntry.peBlue );
}
}
else
{
ck.KeyType = CK_RGB;
ck.LowColorValue = clr;
ck.HighColorValue = clr;
}/* end of if statement */
hr = pMixerPinConfig->SetColorKey(&ck);
::ReleaseDC(hwnd, hdc);
}/* end of if statement */
return hr;
}/* end of function SetColorKey */
/*************************************************************************/
/* Function: TwoDigitToByte */
/*************************************************************************/
static BYTE TwoDigitToByte( const WCHAR* pTwoDigit ){
int tens = int(pTwoDigit[0] - L'0');
return BYTE( (pTwoDigit[1] - L'0') + tens*10);
}/* end of function TwoDigitToByte */
/*************************************************************************/
/* Function: Bstr2DVDTime */
/* Description: Converts a DVD Time info from BSTR into a TIMECODE. */
/*************************************************************************/
HRESULT CMSWebDVD::Bstr2DVDTime(DVD_HMSF_TIMECODE *ptrTimeCode, const BSTR *pbstrTime){
if(NULL == pbstrTime || NULL == ptrTimeCode){
return E_INVALIDARG;
}/* end of if statement */
::ZeroMemory(ptrTimeCode, sizeof(DVD_HMSF_TIMECODE));
WCHAR *pszTime = *pbstrTime;
ULONG lStringLength = wcslen(pszTime);
if(0 == lStringLength){
return E_INVALIDARG;
}/* end of if statement */
TCHAR tszTimeSep[5];
::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, tszTimeSep, 5);
// If the string is two long, it is seconds only
if(lStringLength == 2){
ptrTimeCode->bSeconds = TwoDigitToByte( &pszTime[0] );
return S_OK;
}
// Otherwise it is a normal time code of the format
// 43:32:21:10
// Where the ':' can be replaced with a localized string of upto 4 char in len
// There is a possible error case where the length of the delimeter is different
// then the current delimeter
if(lStringLength >= (4*cgTIME_STRING_LEN)+(3 * _tcslen(tszTimeSep))){ // longest string nnxnnxnnxnn e.g. 43:23:21:10
// where n is a number and
// x is a time delimeter usually ':', but can be any string upto 4 char in len)
ptrTimeCode->bFrames = TwoDigitToByte( &pszTime[(3*cgTIME_STRING_LEN)+(3*_tcslen(tszTimeSep))]);
}
if(lStringLength >= (3*cgTIME_STRING_LEN)+(2 * _tcslen(tszTimeSep))) { // string nnxnnxnn e.g. 43:23:21
ptrTimeCode->bSeconds = TwoDigitToByte( &pszTime[(2*cgTIME_STRING_LEN)+(2*_tcslen(tszTimeSep))] );
}
if(lStringLength >= (2*cgTIME_STRING_LEN)+(1 * _tcslen(tszTimeSep))) { // string nnxnn e.g. 43:23
ptrTimeCode->bMinutes = TwoDigitToByte( &pszTime[(1*cgTIME_STRING_LEN)+(1*_tcslen(tszTimeSep))] );
}
if(lStringLength >= (cgTIME_STRING_LEN)) { // string nn e.g. 43
ptrTimeCode->bHours = TwoDigitToByte( &pszTime[0] );
}
return (S_OK);
}/* end of function bstr2DVDTime */
/*************************************************************************/
/* Function: DVDTime2bstr */
/* Description: Converts a DVD Time info from ULONG into a BSTR. */
/*************************************************************************/
HRESULT CMSWebDVD::DVDTime2bstr( const DVD_HMSF_TIMECODE *pTimeCode, BSTR *pbstrTime){
if(NULL == pTimeCode || NULL == pbstrTime)
return E_INVALIDARG;
USES_CONVERSION;
TCHAR tszTime[cgDVD_TIME_STR_LEN];
TCHAR tszTimeSep[5];
::ZeroMemory(tszTime, sizeof(TCHAR)*cgDVD_TIME_STR_LEN);
::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, tszTimeSep, 5);
StringCchPrintf( tszTime, sizeof(tszTime) / sizeof(tszTime[0]), TEXT("%02lu%s%02lu%s%02lu%s%02lu"),
pTimeCode->bHours, tszTimeSep,
pTimeCode->bMinutes, tszTimeSep,
pTimeCode->bSeconds, tszTimeSep,
pTimeCode->bFrames );
*pbstrTime = SysAllocString(T2OLE(tszTime));
return (S_OK);
}/* end of function DVDTime2bstr */
/*************************************************************************/
/* Function: SetupAudio */
/* Description: Initialize the audio interface. */
/*************************************************************************/
HRESULT CMSWebDVD::SetupAudio(){
HRESULT hr = E_FAIL;
try {
#if 0 // Using
if(!m_pDvdGB){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdGB->GetDvdInterface(IID_IBasicAudio, (LPVOID*) &m_pAudio) ;
if(FAILED(hr)){
ATLTRACE(TEXT("The QDVD.DLL does not support IID_IBasicAudio please update QDVD.DLL\n"));
throw(hr);
}/* end of if statement */
#else
hr = TraverseForInterface(IID_IBasicAudio, (LPVOID*) &m_pAudio);
if(FAILED(hr)){
// might be a HW decoder
HMIXER hmx = NULL;
if(::mixerOpen(&hmx, 0, 0, 0, 0) != MMSYSERR_NOERROR){
hr = E_FAIL;
return(hr);
}/* end of if statement */
::mixerClose(hmx);
hr = S_OK;
}/* end of if statement */
#endif
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return hr;
}/* end of function SetupAudio */
/*************************************************************************/
/* Function: TraverseForInterface */
/* Description: Goes through the interface list and finds a desired one. */
/*************************************************************************/
HRESULT CMSWebDVD::TraverseForInterface(REFIID iid, LPVOID* ppvObject){
HRESULT hr = E_FAIL;
try {
// take care and release any interface before passing
// it over otherwise we leak
if(!m_pDvdGB){
throw(E_UNEXPECTED);
}/* end of if statement */
IGraphBuilder *pFilterGraph;
hr = m_pDvdGB->GetFiltergraph(&pFilterGraph);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
CComPtr<IBaseFilter> pFilter;
CComPtr<IEnumFilters> pEnum;
hr = pFilterGraph->EnumFilters(&pEnum);
pFilterGraph->Release();
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = E_FAIL; // set the hr to E_FAIL in case we do not find the IBasicAudio
while(pEnum->Next(1, &pFilter, NULL) == S_OK){
HRESULT hrTmp = pFilter->QueryInterface(iid, ppvObject);
pFilter.Release();
if(SUCCEEDED(hrTmp)){
ATLASSERT(*ppvObject);
// found our audio time to break
if(*ppvObject == NULL){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = hrTmp; // set the hr to SUCCEED
break;
}/* end of if statement */
}/* end of while loop */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return hr;
}/* end of function TraverseForInterface */
/*************************************************************************/
/* Function: SetupEventNotifySink */
/* Description: Gets the event notify sink interface. */
/*************************************************************************/
HRESULT CMSWebDVD::SetupEventNotifySink(){
HRESULT hr = E_FAIL;
try {
if(m_pMediaSink){
m_pMediaSink.Release();
}/* end of if statement */
if(!m_pDvdGB){
throw(E_UNEXPECTED);
}/* end of if statement */
IGraphBuilder *pFilterGraph;
hr = m_pDvdGB->GetFiltergraph(&pFilterGraph);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
hr = pFilterGraph->QueryInterface(IID_IMediaEventSink, (void**)&m_pMediaSink);
pFilterGraph->Release();
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return hr;
}/* end of function SetupEventNotifySink */
/*************************************************************************/
/* Function: OnPostVerbInPlaceActivate */
/* Description: Creates the in place active object. */
/*************************************************************************/
HRESULT CMSWebDVD::OnPostVerbInPlaceActivate(){
SetReadyState(READYSTATE_COMPLETE);
return(S_OK);
}/* end of function OnPostVerbInPlaceActivate */
/*************************************************************************/
/* Function: RenderGraphIfNeeded */
/* Description: Initializes graph if it needs to be. */
/*************************************************************************/
HRESULT CMSWebDVD::RenderGraphIfNeeded(){
HRESULT hr = S_OK;
try {
m_DVDFilterState = dvdState_Undefined; // just a flag set so we can restore
// graph state if the API fails
if(!m_fInitialized){
hr = Render(); // render the graph
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return(hr);
}/* end of function RenderGraphIfNeeded */
/*************************************************************************/
/* Function: PassFP_DOM */
/* Description: Gets into title domain, past fp domain. */
/*************************************************************************/
HRESULT CMSWebDVD::PassFP_DOM(){
HRESULT hr = S_OK;
try {
// get the curent domain
DVD_DOMAIN domain;
//INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
hr = m_pDvdInfo2->GetCurrentDomain(&domain);
if(FAILED(hr)){
throw(hr);
}/* end of if statement */
if(DVD_DOMAIN_FirstPlay == domain /* || DVD_DOMAIN_VideoManagerMenu == domain */){
// if the domain is FP_DOM wait a specified timeout
if(NULL == m_hFPDOMEvent){
ATLTRACE(TEXT("The handle should have been already set \n"));
throw(E_UNEXPECTED);
}/* end of if statement */
if(WAIT_OBJECT_0 == ::WaitForSingleObject(m_hFPDOMEvent, cdwMaxFP_DOMWait)){
hr = S_OK;
}
else {
hr = E_FAIL;
}/* end of if statement */
}
else {
hr = E_FAIL; // we were not originally in FP_DOM so it should have worked
// there is a potential for raice condition, when we issue the command
// the command failed due to that we were not in FP_DOM, but after the execution
// it has changed before we got a chance to look it up
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return(hr);
}/* end of function PassFP_DOM */
/*************************************************************/
/* Name: OpenCdRom */
/* Description: Open CDRom and return the device ID */
/*************************************************************/
DWORD CMSWebDVD::OpenCdRom(TCHAR chDrive, LPDWORD lpdwErrCode){
MCI_OPEN_PARMS mciOpen;
TCHAR szElementName[4];
TCHAR szAliasName[32];
DWORD dwFlags;
DWORD dwAliasCount = GetCurrentTime();
DWORD dwRet;
ZeroMemory( &mciOpen, sizeof(mciOpen) );
mciOpen.lpstrDeviceType = (LPTSTR)MCI_DEVTYPE_CD_AUDIO;
StringCchPrintf( szElementName, sizeof(szElementName) / sizeof(szElementName[0]), TEXT("%c:"), chDrive );
StringCchPrintf( szAliasName, sizeof(szAliasName) / sizeof(szAliasName[0]), TEXT("SJE%lu:"), dwAliasCount );
mciOpen.lpstrAlias = szAliasName;
mciOpen.lpstrDeviceType = (LPTSTR)MCI_DEVTYPE_CD_AUDIO;
mciOpen.lpstrElementName = szElementName;
dwFlags = MCI_OPEN_ELEMENT | MCI_OPEN_ALIAS |
MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID | MCI_WAIT;
// send mci command
dwRet = mciSendCommand(0, MCI_OPEN, dwFlags, reinterpret_cast<DWORD_PTR>(&mciOpen));
if ( dwRet != MMSYSERR_NOERROR )
mciOpen.wDeviceID = 0;
if (lpdwErrCode != NULL)
*lpdwErrCode = dwRet;
return mciOpen.wDeviceID;
}/* end of function OpenCdRom */
/*************************************************************/
/* Name: CloseCdRom */
/* Description: Close device handle for CDRom */
/*************************************************************/
HRESULT CMSWebDVD::CloseCdRom(DWORD DevHandle){
MCI_OPEN_PARMS mciOpen;
ZeroMemory( &mciOpen, sizeof(mciOpen) );
MCIERROR theMciErr = mciSendCommand( DevHandle, MCI_CLOSE, 0L, reinterpret_cast<DWORD_PTR>(&mciOpen) );
HRESULT hr = theMciErr ? E_FAIL : S_OK; // zero for success
return (hr);
}/* end of function CloseCdRom */
/*************************************************************/
/* Name: EjectCdRom */
/* Description: Open device door for CDRom */
/*************************************************************/
HRESULT CMSWebDVD::EjectCdRom(DWORD DevHandle){
MCI_OPEN_PARMS mciOpen;
ZeroMemory( &mciOpen, sizeof(mciOpen) );
MCIERROR theMciErr = mciSendCommand( DevHandle, MCI_SET, MCI_SET_DOOR_OPEN, reinterpret_cast<DWORD_PTR>(&mciOpen) );
HRESULT hr = theMciErr ? E_FAIL : S_OK; // zero for success
return (hr);
}/* end of function EjectCdRom */
/*************************************************************/
/* Name: UnEjectCdRom */
/* Description: Close device door for CDRom */
/*************************************************************/
HRESULT CMSWebDVD::UnEjectCdRom(DWORD DevHandle){
MCI_OPEN_PARMS mciOpen;
ZeroMemory( &mciOpen, sizeof(mciOpen) );
MCIERROR theMciErr = mciSendCommand( DevHandle, MCI_SET, MCI_SET_DOOR_CLOSED, reinterpret_cast<DWORD_PTR>(&mciOpen) );
HRESULT hr = theMciErr ? E_FAIL : S_OK; // zero for success
return (hr);
}/* end of function UnEjectCdRom */
/*************************************************************************/
/* Function: SetupDDraw */
/* Description: Creates DDrawObject and Surface */
/*************************************************************************/
HRESULT CMSWebDVD::SetupDDraw(){
HRESULT hr = E_UNEXPECTED;
HWND hwnd;
hr = GetUsableWindow(&hwnd);
if(FAILED(hr)){
return(hr);
}/* end of if statement */
IAMSpecifyDDrawConnectionDevice* pSDDC;
hr = m_pDDEX->QueryInterface(IID_IAMSpecifyDDrawConnectionDevice, (LPVOID *)&pSDDC);
if (FAILED(hr)){
return(hr);
}/* end of if statement */
AMDDRAWGUID amGUID;
hr = pSDDC->GetDDrawGUID(&amGUID);
if (FAILED(hr)){
pSDDC->Release();
return(hr);
}/* end of if statement */
hr = pSDDC->GetDDrawGUIDs(&m_dwNumDevices, &m_lpInfo);
pSDDC->Release();
if(FAILED(hr)){
return(hr);
}/* end of if statement */
UpdateCurrentMonitor(&amGUID);
m_pDDrawDVD = new CDDrawDVD(this);
if(NULL == m_pDDrawDVD){
return(E_OUTOFMEMORY);
}
hr = m_pDDrawDVD->SetupDDraw(&amGUID, hwnd);
return(hr);
}/* end of function SetupDDraw */
/*************************************************************************/
/* Function: TransformToWndwls */
/* Description: Transforms the coordinates to screen onse. */
/*************************************************************************/
HRESULT CMSWebDVD::TransformToWndwls(POINT& pt){
HRESULT hr = S_FALSE;
// we are windowless we need to map the points to screen coordinates
if(m_bWndLess){
HWND hwnd = NULL;
hr = GetParentHWND(&hwnd);
if(FAILED(hr)){
return(hr);
}/* end of if statement */
if(!::IsWindow(hwnd)){
hr = E_UNEXPECTED;
return(hr);
}/* end of if statement */
#ifdef _DEBUG
// POINT ptOld = pt;
#endif
::MapWindowPoints(hwnd, ::GetDesktopWindow(), &pt, 1);
hr = S_OK;
#ifdef _DEBUG
// ATLTRACE(TEXT("Mouse Client:x= %d, y = %d, Screen: x=%d, y= %d\n"),ptOld.x, ptOld.y, pt.x, pt.y);
#endif
}/* end of if statement */
return(hr);
}/* end of function TransformToWndwls */
/*************************************************************************/
/* Function: RestoreGraphState */
/* Description: Restores the graph state. Used when API fails. */
/*************************************************************************/
HRESULT CMSWebDVD::RestoreGraphState(){
HRESULT hr = S_OK;
switch(m_DVDFilterState){
case dvdState_Undefined:
case dvdState_Running: // do not do anything
break;
case dvdState_Unitialized:
case dvdState_Stopped: hr = Stop(); break;
case dvdState_Paused: hr = Pause();
}/* end of switch statement */
return(hr);
}/* end of if statement */
/*************************************************************************/
/* Function: AppendString */
/* Description: Appends a string to an existing one. */
/*************************************************************************/
HRESULT CMSWebDVD::AppendString(TCHAR* strDest, INT strID, LONG dwLen){
TCHAR strBuffer[MAX_PATH];
if(!::LoadString(_Module.m_hInstResource, strID, strBuffer, MAX_PATH)){
return(E_UNEXPECTED);
}/* end of if statement */
StringCchCat(strDest, dwLen, strBuffer);
return(S_OK);
}/* end of function AppendString */
/*************************************************************************/
/* Function: HandleError */
/* Description: Gets Error Descriptio, so we can suppor IError Info. */
/*************************************************************************/
HRESULT CMSWebDVD::HandleError(HRESULT hr){
try {
if(FAILED(hr)){
switch(hr){
case E_REGION_CHANGE_FAIL: Error(IDS_REGION_CHANGE_FAIL); return (hr);
case E_NO_IDVD2_PRESENT: Error(IDS_EDVD2INT); return (hr);
case E_FORMAT_NOT_SUPPORTED: Error(IDS_FORMAT_NOT_SUPPORTED); return (hr);
case E_NO_DVD_VOLUME: Error(IDS_E_NO_DVD_VOLUME); return (hr);
case E_REGION_CHANGE_NOT_COMPLETED: Error(IDS_E_REGION_CHANGE_NOT_COMPLETED); return(hr);
case E_NO_SOUND_STREAM: Error(IDS_E_NO_SOUND_STREAM); return(hr);
case E_NO_VIDEO_STREAM: Error(IDS_E_NO_VIDEO_STREAM); return(hr);
case E_NO_OVERLAY: Error(IDS_E_NO_OVERLAY); return(hr);
case E_NO_USABLE_OVERLAY: Error(IDS_E_NO_USABLE_OVERLAY); return(hr);
case E_NO_DECODER: Error(IDS_E_NO_DECODER); return(hr);
case E_NO_CAPTURE_SUPPORT: Error(IDS_E_NO_CAPTURE_SUPPORT); return(hr);
}/* end of switch statement */
// Ensure that the string is Null Terminated
TCHAR strError[MAX_ERROR_TEXT_LEN+1];
ZeroMemory(strError, MAX_ERROR_TEXT_LEN+1);
if(AMGetErrorText(hr , strError , MAX_ERROR_TEXT_LEN)){
USES_CONVERSION;
Error(T2W(strError));
}
else {
ATLTRACE(TEXT("Unhandled Error Code \n")); // please add it
ATLASSERT(FALSE);
}/* end of if statement */
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
// keep the hr same
}/* end of catch statement */
return (hr);
}/* end of function HandleError */
/*************************************************************/
/* Name: get_ShowCursor */
/*************************************************************/
STDMETHODIMP CMSWebDVD::get_ShowCursor(VARIANT_BOOL* pfShow)
{
HRESULT hr = S_OK;
try {
if(NULL == pfShow){
throw(E_POINTER);
}/* end of if statement */
CURSORINFO pci;
::ZeroMemory(&pci, sizeof(CURSORINFO));
pci.cbSize = sizeof(CURSORINFO);
#if WINVER >= 0x0500
if(!::GetCursorInfo(&pci)){
#else
if(!CallGetCursorInfo(&pci)){
#endif
throw(E_FAIL);
}/* end of if statement */
*pfShow = (pci.flags == CURSOR_SHOWING) ? VARIANT_TRUE:VARIANT_FALSE;
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return (hr);
}/* end of function get_ShowCursor */
/*************************************************************/
/* Name: put_ShowCursor */
/* Description: Shows the cursor or hides it. */
/*************************************************************/
STDMETHODIMP CMSWebDVD::put_ShowCursor(VARIANT_BOOL fShow){
HRESULT hr = S_OK;
try {
BOOL bTemp = (fShow==VARIANT_FALSE) ? FALSE:TRUE;
if (bTemp)
// Call ShowCursor(TRUE) until new counter is >= 0
while (::ShowCursor(bTemp) < 0);
else
// Call ShowCursor(FALSE) until new counter is < 0
while (::ShowCursor(bTemp) >= 0);
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return (hr);
}/* end of function put_ShowCursor */
/*************************************************************/
/* Name: GetLangFromLangID */
/*************************************************************/
STDMETHODIMP CMSWebDVD::GetLangFromLangID(long langID, BSTR* lang){
HRESULT hr = S_OK;
try {
if (lang == NULL) {
throw(E_POINTER);
}/* end of if statement */
USES_CONVERSION;
if((unsigned long)langID > (WORD)langID){
throw(E_INVALIDARG);
}
LPTSTR pszString = m_LangID.GetLangFromLangID((WORD)langID);
if (pszString) {
*lang = ::SysAllocString(T2OLE(pszString));
}
else {
*lang = ::SysAllocString( L"");
throw(E_INVALIDARG);
}/* end of if statement */
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}/* end of function GetLangFromLangID */
/*************************************************************/
/* Name: IsAudioStreamEnabled
/* Description:
/*************************************************************/
STDMETHODIMP CMSWebDVD::IsAudioStreamEnabled(long lStream, VARIANT_BOOL *fEnabled)
{
HRESULT hr = S_OK;
try {
if(lStream < 0){
throw(E_INVALIDARG);
}/* end of if statement */
if (fEnabled == NULL) {
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
BOOL temp;
hr = m_pDvdInfo2->IsAudioStreamEnabled(lStream, &temp);
if (FAILED(hr))
throw hr;
*fEnabled = temp==FALSE? VARIANT_FALSE:VARIANT_TRUE;
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}
/*************************************************************/
/* Name: IsSubpictureStreamEnabled
/* Description:
/*************************************************************/
STDMETHODIMP CMSWebDVD::IsSubpictureStreamEnabled(long lStream, VARIANT_BOOL *fEnabled)
{
HRESULT hr = S_OK;
try {
if(lStream < 0){
throw(E_INVALIDARG);
}/* end of if statement */
if (fEnabled == NULL) {
throw(E_POINTER);
}/* end of if statement */
INITIALIZE_GRAPH_IF_NEEDS_TO_BE
if(!m_pDvdInfo2){
throw(E_UNEXPECTED);
}/* end of if statement */
BOOL temp;
hr = m_pDvdInfo2->IsSubpictureStreamEnabled(lStream, &temp);
if (FAILED(hr))
throw hr;
*fEnabled = temp==FALSE? VARIANT_FALSE:VARIANT_TRUE;
}/* end of try statement */
catch(HRESULT hrTmp){
hr = hrTmp;
}/* end of catch statement */
catch(...){
hr = E_UNEXPECTED;
}/* end of catch statement */
return HandleError(hr);
}
/*************************************************************/
/* Name: DVDTimeCode2bstr
/* Description:
/*************************************************************/
STDMETHODIMP CMSWebDVD::DVDTimeCode2bstr(long timeCode, BSTR *pTimeStr)
{
return DVDTime2bstr((DVD_HMSF_TIMECODE*)&timeCode, pTimeStr);
}
/*************************************************************/
/* Name: UpdateOverlay
/* Description:
/*************************************************************/
HRESULT CMSWebDVD::UpdateOverlay()
{
RECT rc;
HWND hwnd;
if(m_bWndLess){
HRESULT hr = GetParentHWND(&hwnd);
if(FAILED(hr)){
return(hr);
}/* end of if statement */
rc = m_rcPos;
}
else {
hwnd = m_hWnd;
::GetClientRect(hwnd, &rc);
}/* end of if statement */
::InvalidateRect(hwnd, &rc, FALSE);
m_bFireUpdateOverlay = TRUE;
return S_OK;
}
HRESULT CMSWebDVD::SetClientSite(IOleClientSite *pClientSite){
if(!!pClientSite){
HRESULT hr = IsSafeSite(pClientSite);
if(FAILED(hr)){
return hr;
}
}
return IOleObjectImpl<CMSWebDVD>::SetClientSite(pClientSite);
}
/*************************************************************************/
/* End of file: msdvd.cpp */
/*************************************************************************/
| 30.839844 | 200 | 0.467014 | npocmaka |
aa10887002b21c22c61dc722e288c1d02bcc1e0e | 8,978 | cpp | C++ | tephra/src/tephra/descriptor.cpp | cvbn127/captal-engine | 93a5f428b4cee810b529b7c9a9b3bf6504c8f32f | [
"MIT"
] | 78 | 2021-11-02T13:55:43.000Z | 2022-02-25T09:37:22.000Z | tephra/src/tephra/descriptor.cpp | cvbn127/captal-engine | 93a5f428b4cee810b529b7c9a9b3bf6504c8f32f | [
"MIT"
] | null | null | null | tephra/src/tephra/descriptor.cpp | cvbn127/captal-engine | 93a5f428b4cee810b529b7c9a9b3bf6504c8f32f | [
"MIT"
] | 6 | 2021-11-03T06:56:22.000Z | 2022-01-13T19:11:29.000Z | //MIT License
//
//Copyright (c) 2021 Alexy Pellegrini
//
//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 "descriptor.hpp"
#include <cassert>
#include <captal_foundation/stack_allocator.hpp>
#include "vulkan/vulkan_functions.hpp"
#include "renderer.hpp"
#include "buffer.hpp"
#include "texture.hpp"
using namespace tph::vulkan::functions;
namespace tph
{
descriptor_set_layout::descriptor_set_layout(renderer& renderer, std::span<const descriptor_set_layout_binding> bindings)
{
stack_memory_pool<1024 * 2> pool{};
auto native_bindings{make_stack_vector<VkDescriptorSetLayoutBinding>(pool)};
native_bindings.reserve(std::size(bindings));
for(auto&& binding : bindings)
{
VkDescriptorSetLayoutBinding native_binding{};
native_binding.stageFlags = static_cast<VkShaderStageFlags>(binding.stages);
native_binding.binding = binding.binding;
native_binding.descriptorType = static_cast<VkDescriptorType>(binding.type);
native_binding.descriptorCount = binding.count;
native_bindings.emplace_back(native_binding);
}
m_layout = vulkan::descriptor_set_layout{underlying_cast<VkDevice>(renderer), native_bindings};
}
void set_object_name(renderer& renderer, const descriptor_set_layout& object, const std::string& name)
{
VkDebugUtilsObjectNameInfoEXT info{};
info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
info.objectType = VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT;
info.objectHandle = reinterpret_cast<std::uint64_t>(underlying_cast<VkDescriptorSetLayout>(object));
info.pObjectName = std::data(name);
if(auto result{vkSetDebugUtilsObjectNameEXT(underlying_cast<VkDevice>(renderer), &info)}; result != VK_SUCCESS)
throw vulkan::error{result};
}
descriptor_pool::descriptor_pool(renderer& renderer, std::span<const descriptor_pool_size> sizes, std::optional<std::uint32_t> max_sets)
{
stack_memory_pool<1024> pool{};
auto native_sizes{make_stack_vector<VkDescriptorPoolSize>(pool)};
native_sizes.reserve(std::size(sizes));
for(auto&& size : sizes)
{
auto& native_size{native_sizes.emplace_back()};
native_size.type = static_cast<VkDescriptorType>(size.type);
native_size.descriptorCount = size.count;
}
if(!max_sets.has_value())
{
std::uint32_t total_size{};
for(auto&& size : sizes)
{
total_size += size.count;
}
max_sets = total_size;
}
m_descriptor_pool = vulkan::descriptor_pool{underlying_cast<VkDevice>(renderer), native_sizes, *max_sets};
}
void set_object_name(renderer& renderer, const descriptor_pool& object, const std::string& name)
{
VkDebugUtilsObjectNameInfoEXT info{};
info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
info.objectType = VK_OBJECT_TYPE_DESCRIPTOR_POOL;
info.objectHandle = reinterpret_cast<std::uint64_t>(underlying_cast<VkDescriptorPool>(object));
info.pObjectName = std::data(name);
if(auto result{vkSetDebugUtilsObjectNameEXT(underlying_cast<VkDevice>(renderer), &info)}; result != VK_SUCCESS)
throw vulkan::error{result};
}
descriptor_set::descriptor_set(renderer& renderer, descriptor_pool& pool, descriptor_set_layout& layout)
:m_descriptor_set{underlying_cast<VkDevice>(renderer), underlying_cast<VkDescriptorPool>(pool), underlying_cast<VkDescriptorSetLayout>(layout)}
{
}
void set_object_name(renderer& renderer, const descriptor_set& object, const std::string& name)
{
VkDebugUtilsObjectNameInfoEXT info{};
info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
info.objectType = VK_OBJECT_TYPE_DESCRIPTOR_SET;
info.objectHandle = reinterpret_cast<std::uint64_t>(underlying_cast<VkDescriptorSet>(object));
info.pObjectName = std::data(name);
if(auto result{vkSetDebugUtilsObjectNameEXT(underlying_cast<VkDevice>(renderer), &info)}; result != VK_SUCCESS)
throw vulkan::error{result};
}
void write_descriptors(renderer& renderer, std::span<const descriptor_write> writes)
{
update_descriptors(renderer, writes, std::span<const descriptor_copy>{});
}
void copy_descriptors(renderer& renderer, std::span<const descriptor_copy> copies)
{
update_descriptors(renderer, std::span<const descriptor_write>{}, copies);
}
void update_descriptors(renderer& renderer, std::span<const descriptor_write> writes, std::span<const descriptor_copy> copies)
{
std::size_t image_count{};
std::size_t buffer_count{};
for(auto&& write : writes)
{
assert(!std::holds_alternative<std::monostate>(write.info) && "tph::write_descriptors contains undefined write target.");
if(std::holds_alternative<descriptor_texture_info>(write.info))
{
++image_count;
}
else if(std::holds_alternative<descriptor_buffer_info>(write.info))
{
++buffer_count;
}
}
stack_memory_pool<1024 * 4> pool{};
auto native_images{make_stack_vector<VkDescriptorImageInfo>(pool)};
native_images.reserve(image_count);
auto buffers_image{make_stack_vector<VkDescriptorBufferInfo>(pool)};
buffers_image.reserve(buffer_count);
auto native_writes{make_stack_vector<VkWriteDescriptorSet>(pool)};
native_writes.reserve(std::size(writes));
for(auto&& write : writes)
{
VkWriteDescriptorSet native_write{};
native_write.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
native_write.dstSet = underlying_cast<VkDescriptorSet>(write.descriptor_set.get());
native_write.dstBinding = write.binding;
native_write.dstArrayElement = write.array_index;
native_write.descriptorType = static_cast<VkDescriptorType>(write.type);
native_write.descriptorCount = 1;
if(std::holds_alternative<descriptor_texture_info>(write.info))
{
auto& write_info{std::get<descriptor_texture_info>(write.info)};
VkDescriptorImageInfo image_info{};
image_info.sampler = write_info.sampler ? underlying_cast<VkSampler>(*write_info.sampler) : VkSampler{};
image_info.imageView = write_info.texture_view ? underlying_cast<VkImageView>(*write_info.texture_view) : VkImageView{};
image_info.imageLayout = static_cast<VkImageLayout>(write_info.layout);
native_write.pImageInfo = &native_images.emplace_back(image_info);
}
else if(std::holds_alternative<descriptor_buffer_info>(write.info))
{
auto& write_info{std::get<descriptor_buffer_info>(write.info)};
VkDescriptorBufferInfo buffer_info{};
buffer_info.buffer = underlying_cast<VkBuffer>(write_info.buffer.get());
buffer_info.offset = write_info.offset;
buffer_info.range = write_info.size;
native_write.pBufferInfo = &buffers_image.emplace_back(buffer_info);
}
native_writes.emplace_back(native_write);
}
auto native_copies{make_stack_vector<VkCopyDescriptorSet>(pool)};
native_copies.reserve(std::size(copies));
for(auto&& copy : copies)
{
VkCopyDescriptorSet& native_copy{native_copies.emplace_back()};
native_copy.sType = VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET;
native_copy.srcSet = underlying_cast<VkDescriptorSet>(copy.source_set.get());
native_copy.srcBinding = copy.source_binding;
native_copy.srcArrayElement = copy.source_array_index;
native_copy.dstSet = underlying_cast<VkDescriptorSet>(copy.destination_set.get());
native_copy.dstBinding = copy.destination_binding;
native_copy.dstArrayElement = copy.destination_array_index;
native_copy.descriptorCount = copy.count;
}
vkUpdateDescriptorSets(underlying_cast<VkDevice>(renderer), static_cast<std::uint32_t>(std::size(native_writes)), std::data(native_writes), static_cast<std::uint32_t>(std::size(native_copies)), std::data(native_copies));
}
}
| 39.725664 | 224 | 0.736578 | cvbn127 |
aa132577a8e6faf802fbec6bda6ceaa95dea65bd | 9,152 | cpp | C++ | src/hostif/profiles/wifi/Device_WiFi_SSID.cpp | rdkcmf/rdk-tr69hostif | 5d9042b968eca933481e111e352828402732ec26 | [
"Apache-2.0"
] | 3 | 2018-11-23T05:08:54.000Z | 2019-10-18T12:52:38.000Z | src/hostif/profiles/wifi/Device_WiFi_SSID.cpp | rdkcmf/rdk-tr69hostif | 5d9042b968eca933481e111e352828402732ec26 | [
"Apache-2.0"
] | null | null | null | src/hostif/profiles/wifi/Device_WiFi_SSID.cpp | rdkcmf/rdk-tr69hostif | 5d9042b968eca933481e111e352828402732ec26 | [
"Apache-2.0"
] | 1 | 2018-08-16T19:15:22.000Z | 2018-08-16T19:15:22.000Z | /*
* If not stated otherwise in this file or this component's Licenses.txt file the
* following copyright and licenses apply:
*
* Copyright 2018 RDK Management
*
* 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.
*/
/**
* @file Device_WiFi_SSID.cpp
*
* @brief Device_WiFi_SSID API Implementation.
*
* This is the implementation of the WiFi API.
*
* @par Document
*/
/** @addtogroup TR-069 WiFi Implementation
* This is the implementation of the Device Public API.
* @{
*/
/*****************************************************************************
* STANDARD INCLUDE FILES
*****************************************************************************/
#include <cstddef>
#include "safec_lib.h"
#ifdef USE_WIFI_PROFILE
#include "Device_WiFi_SSID.h"
extern "C" {
/* #include "c_only_header.h"*/
#include "wifi_common_hal.h"
#include "wifiSrvMgrIarmIf.h"
};
static time_t firstExTime = 0;
GHashTable* hostIf_WiFi_SSID::ifHash = NULL;
hostIf_WiFi_SSID* hostIf_WiFi_SSID::getInstance(int dev_id)
{
static hostIf_WiFi_SSID* pRet = NULL;
if(ifHash)
{
pRet = (hostIf_WiFi_SSID *)g_hash_table_lookup(ifHash,(gpointer) dev_id);
}
else
{
ifHash = g_hash_table_new(NULL,NULL);
}
if(!pRet)
{
try {
pRet = new hostIf_WiFi_SSID(dev_id);
} catch(int e)
{
RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"Caught exception, not able create hostIf_WiFi_SSID instance..\n");
}
g_hash_table_insert(ifHash, (gpointer)dev_id, pRet);
}
return pRet;
}
GList* hostIf_WiFi_SSID::getAllInstances()
{
if(ifHash)
return g_hash_table_get_keys(ifHash);
return NULL;
}
void hostIf_WiFi_SSID::closeInstance(hostIf_WiFi_SSID *pDev)
{
if(pDev)
{
g_hash_table_remove(ifHash, (gconstpointer)pDev->dev_id);
delete pDev;
}
}
void hostIf_WiFi_SSID::closeAllInstances()
{
if(ifHash)
{
GList* tmp_list = g_hash_table_get_values (ifHash);
while(tmp_list)
{
hostIf_WiFi_SSID* pDev = (hostIf_WiFi_SSID *)tmp_list->data;
tmp_list = tmp_list->next;
closeInstance(pDev);
}
}
}
hostIf_WiFi_SSID::hostIf_WiFi_SSID(int dev_id):
enable(false),
LastChange(0)
{
memset(status,0 , sizeof(status)); //CID:103996 - OVERRUN
memset(alias, 0, sizeof(alias)); //CID:103531 - OVERRUN
memset(name,0, sizeof(name));
memset(LowerLayers,0, sizeof(LowerLayers));
memset(BSSID,0, sizeof(BSSID));
memset(MACAddress,0, sizeof(MACAddress));
memset(SSID,0, sizeof(SSID)); //CID:103108 - OVERRUN
}
int hostIf_WiFi_SSID::get_Device_WiFi_SSID_Fields(int ssidIndex)
{
errno_t rc = -1;
IARM_Result_t retVal = IARM_RESULT_SUCCESS;
IARM_BUS_WiFi_DiagsPropParam_t param = {0};
int ret;
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Entering..\n", __FUNCTION__, __FILE__);
hostIf_WiFi_SSID *pDev = hostIf_WiFi_SSID::getInstance(dev_id);
if (pDev)
{
retVal = IARM_Bus_Call(IARM_BUS_NM_SRV_MGR_NAME, IARM_BUS_WIFI_MGR_API_getSSIDProps, (void *)¶m, sizeof(param));
if (IARM_RESULT_SUCCESS != retVal)
{
RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%s] IARM BUS CALL failed with : %d.\n", __FILE__, __FUNCTION__, retVal);
return NOK;
}
rc=strcpy_s(name,sizeof(name),param.data.ssid.params.name);
if(rc!=EOK)
{
ERR_CHK(rc);
}
rc=strcpy_s(BSSID,sizeof(BSSID),param.data.ssid.params.bssid);
if(rc!=EOK)
{
ERR_CHK(rc);
}
rc=strcpy_s(MACAddress,sizeof(MACAddress),param.data.ssid.params.macaddr);
if(rc!=EOK)
{
ERR_CHK(rc);
}
rc=strcpy_s(SSID,sizeof(SSID),param.data.ssid.params.ssid);
if(rc!=EOK)
{
ERR_CHK(rc);
}
rc=strcpy_s(status,sizeof(status),param.data.ssid.params.status);
if(rc!=EOK)
{
ERR_CHK(rc);
}
enable=param.data.ssid.params.enable;
firstExTime = time (NULL);
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Exiting..\n", __FUNCTION__, __FILE__);
return OK;
}
else
{
RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%s]Error! Unable to connect to wifi instance\n", __FILE__, __FUNCTION__);
return NOK;
}
}
void hostIf_WiFi_SSID::checkWifiSSIDFetch(int ssidIndex)
{
int ret = NOK;
time_t currExTime = time (NULL);
if ((currExTime - firstExTime ) > QUERY_INTERVAL)
{
ret = get_Device_WiFi_SSID_Fields(ssidIndex);
if( OK != ret)
{
RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%s] Failed to fetch : %d.\n", __FILE__, __FUNCTION__, ret);
}
}
}
int hostIf_WiFi_SSID::get_Device_WiFi_SSID_Enable(HOSTIF_MsgData_t *stMsgData )
{
int ssidIndex=1;
int ret=OK;
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Entering..\n", __FUNCTION__, __FILE__);
checkWifiSSIDFetch(ssidIndex);
put_boolean(stMsgData->paramValue, enable);
stMsgData->paramtype = hostIf_BooleanType;
stMsgData->paramLen=1;
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Exiting..\n", __FUNCTION__, __FILE__);
return ret;
}
int hostIf_WiFi_SSID::set_Device_WiFi_SSID_Enable(HOSTIF_MsgData_t *stMsgData )
{
return OK;
}
int hostIf_WiFi_SSID::get_Device_WiFi_SSID_Status(HOSTIF_MsgData_t *stMsgData )
{
char ssidStatus[32] = "Down";
int ret = OK;
int ssidIndex=1;
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Entering..\n", __FUNCTION__, __FILE__);
checkWifiSSIDFetch(ssidIndex);
stMsgData->paramtype = hostIf_StringType;
stMsgData->paramLen = strlen(status);
snprintf(stMsgData->paramValue, TR69HOSTIFMGR_MAX_PARAM_LEN, status);
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Exiting..\n", __FUNCTION__, __FILE__);
return ret;
}
int hostIf_WiFi_SSID::get_Device_WiFi_SSID_Alias(HOSTIF_MsgData_t *stMsgData )
{
return OK;
}
int hostIf_WiFi_SSID::set_Device_WiFi_SSID_Alias(HOSTIF_MsgData_t *stMsgData )
{
return OK;
}
int hostIf_WiFi_SSID::get_Device_WiFi_SSID_Name(HOSTIF_MsgData_t *stMsgData )
{
int ssidIndex=1;
int ret=OK;
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Entering..\n", __FUNCTION__, __FILE__);
checkWifiSSIDFetch(ssidIndex);
snprintf(stMsgData->paramValue, TR69HOSTIFMGR_MAX_PARAM_LEN, name);
stMsgData->paramtype = hostIf_StringType;
stMsgData->paramLen = strlen(name);
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Exiting..\n", __FUNCTION__, __FILE__);
return OK;
}
int hostIf_WiFi_SSID::get_Device_WiFi_SSID_LastChange(HOSTIF_MsgData_t *stMsgData )
{
return OK;
}
int hostIf_WiFi_SSID::get_Device_WiFi_SSID_LowerLayers(HOSTIF_MsgData_t *stMsgData )
{
return OK;
}
int hostIf_WiFi_SSID::set_Device_WiFi_SSID_LowerLayers(HOSTIF_MsgData_t *stMsgData )
{
return OK;
}
int hostIf_WiFi_SSID::hostIf_WiFi_SSID::get_Device_WiFi_SSID_BSSID(HOSTIF_MsgData_t *stMsgData )
{
int ssidIndex=1;
int ret=OK;
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Entering..\n", __FUNCTION__, __FILE__);
checkWifiSSIDFetch(ssidIndex);
snprintf(stMsgData->paramValue, TR69HOSTIFMGR_MAX_PARAM_LEN, BSSID);
stMsgData->paramtype = hostIf_StringType;
stMsgData->paramLen = strlen(BSSID);
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Exiting..\n", __FUNCTION__, __FILE__);
return ret;
}
int hostIf_WiFi_SSID::hostIf_WiFi_SSID::get_Device_WiFi_SSID_MACAddress(HOSTIF_MsgData_t *stMsgData )
{
int ssidIndex=1;
int ret=OK;
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Entering..\n", __FUNCTION__, __FILE__);
checkWifiSSIDFetch(ssidIndex);
snprintf(stMsgData->paramValue, TR69HOSTIFMGR_MAX_PARAM_LEN, MACAddress);
stMsgData->paramtype = hostIf_StringType;
stMsgData->paramLen = strlen(MACAddress);
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Exiting..\n", __FUNCTION__, __FILE__);
return ret;
}
int hostIf_WiFi_SSID::get_Device_WiFi_SSID_SSID(HOSTIF_MsgData_t *stMsgData )
{
int ssidIndex=1;
int ret=OK;
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Entering..\n", __FUNCTION__, __FILE__);
checkWifiSSIDFetch(ssidIndex);
snprintf(stMsgData->paramValue,TR69HOSTIFMGR_MAX_PARAM_LEN, SSID);
stMsgData->paramtype = hostIf_StringType;
stMsgData->paramLen = strlen(SSID);
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Exiting..\n", __FUNCTION__, __FILE__);
return ret;
}
int hostIf_WiFi_SSID::set_Device_WiFi_SSID_SSID(HOSTIF_MsgData_t *stMsgData )
{
return OK;
}
#endif /* #ifdef USE_WIFI_PROFILE */
| 29.239617 | 127 | 0.677666 | rdkcmf |
aa140d8024c54daa834e452b3a9845ee7125d670 | 915 | cpp | C++ | src/gui/RealityUI/qtDesignerPlugins/ReMathTextureEditorPlugin.cpp | danielbui78/reality | 7ecd01b71f28e581becfe5093fab3ddcd6d9b2c1 | [
"BSD-3-Clause"
] | 2 | 2021-12-25T17:24:03.000Z | 2022-03-14T05:07:51.000Z | src/gui/RealityUI/qtDesignerPlugins/ReMathTextureEditorPlugin.cpp | danielbui78/reality | 7ecd01b71f28e581becfe5093fab3ddcd6d9b2c1 | [
"BSD-3-Clause"
] | null | null | null | src/gui/RealityUI/qtDesignerPlugins/ReMathTextureEditorPlugin.cpp | danielbui78/reality | 7ecd01b71f28e581becfe5093fab3ddcd6d9b2c1 | [
"BSD-3-Clause"
] | 2 | 2021-12-10T05:33:04.000Z | 2021-12-10T16:38:54.000Z | /**
* Qt Designer plugin.
*/
#include <QtPlugin>
#include "ReMathTextureEditorPlugin.h"
#include "../ReMathTextureEditor.h"
ReMathTextureEditorPlugin::ReMathTextureEditorPlugin(QObject* parent) : QObject(parent) {
}
QString ReMathTextureEditorPlugin::name() const { return "ReMathTextureEditor"; }
QString ReMathTextureEditorPlugin::includeFile() const { return "ReMathTextureEditor.h"; }
QString ReMathTextureEditorPlugin::group() const { return "Reality"; }
QIcon ReMathTextureEditorPlugin::icon() const { return QIcon(); }
QString ReMathTextureEditorPlugin::toolTip() const { return "Editor for the Math Texture"; }
QString ReMathTextureEditorPlugin::whatsThis() const { return toolTip(); }
bool ReMathTextureEditorPlugin::isContainer() const { return false; }
QWidget* ReMathTextureEditorPlugin::createWidget(QWidget* parent) {
return new ReMathTextureEditor(parent);
}
| 36.6 | 96 | 0.755191 | danielbui78 |
aa161be2462c7a8c44da4dea05e7a89d936a2797 | 18,329 | cpp | C++ | code/steps/source/basic/device_id.cpp | changgang/steps | 9b8ea474581885129d1c1a1c3ad40bc8058a7e0a | [
"MIT"
] | 29 | 2019-10-30T07:04:10.000Z | 2022-02-22T06:34:32.000Z | code/steps/source/basic/device_id.cpp | changgang/steps | 9b8ea474581885129d1c1a1c3ad40bc8058a7e0a | [
"MIT"
] | 1 | 2021-09-25T15:29:59.000Z | 2022-01-05T14:04:18.000Z | code/steps/source/basic/device_id.cpp | changgang/steps | 9b8ea474581885129d1c1a1c3ad40bc8058a7e0a | [
"MIT"
] | 8 | 2019-12-20T16:13:46.000Z | 2022-03-20T14:58:23.000Z | #include "header/basic/device_id.h"
#include "header/basic/exception.h"
#include "header/basic/utility.h"
#include <istream>
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
DEVICE_ID::DEVICE_ID()
{
clear();
}
DEVICE_ID::DEVICE_ID(const DEVICE_ID& did)
{
clear();
set_device_type(did.get_device_type());
set_device_terminal(did.get_device_terminal());
set_device_name_index(did.get_device_name_index());
set_device_identifier_index(did.get_device_identifier_index());
}
DEVICE_ID::~DEVICE_ID()
{
}
void DEVICE_ID::enable_allow_terminal()
{
allow_terminal = true;
allow_name = false;
}
void DEVICE_ID::enable_allow_name()
{
allow_name = true;
allow_terminal = false;
allow_identifier = false;
}
void DEVICE_ID::enable_allow_identifier()
{
if(allow_terminal)
allow_identifier = true;
}
void DEVICE_ID::disable_allow_identifier()
{
allow_identifier = false;
}
void DEVICE_ID::initialize_minimum_maximum_terminal_count()
{
set_minimum_allowed_terminal_count(0);
set_maximum_allowed_terminal_count(0);
}
void DEVICE_ID::set_minimum_allowed_terminal_count(unsigned int n)
{
minimum_terminal_count = n;
}
void DEVICE_ID::set_maximum_allowed_terminal_count(unsigned int n)
{
maximum_terminal_count = n;
}
void DEVICE_ID::set_device_type(STEPS_DEVICE_TYPE device_type)
{
clear();
set_device_type_and_allowed_terminal_count(device_type);
}
void DEVICE_ID::set_device_type_and_allowed_terminal_count(STEPS_DEVICE_TYPE device_type)
{
/*
device type code:
0: invalid
<=1000: terminal + identifier
1001~2000: name
9999: general
*/
if(device_type==STEPS_BUS ||
device_type==STEPS_GENERATOR ||
device_type==STEPS_WT_GENERATOR ||
device_type==STEPS_PV_UNIT ||
device_type==STEPS_ENERGY_STORAGE ||
device_type==STEPS_LOAD ||
device_type==STEPS_FIXED_SHUNT ||
device_type==STEPS_SWITCHED_SHUNT ||
device_type==STEPS_EQUIVALENT_DEVICE)
{
enable_allow_terminal();
this->device_type = device_type;
set_minimum_allowed_terminal_count(1);
set_maximum_allowed_terminal_count(1);
if(device_type == STEPS_BUS)
disable_allow_identifier();
else
enable_allow_identifier();
return;
}
if(device_type==STEPS_LINE ||
device_type==STEPS_HVDC ||
device_type==STEPS_VSC_HVDC ||
device_type==STEPS_FACTS)
{
enable_allow_terminal();
enable_allow_identifier();
this->device_type = device_type;
set_minimum_allowed_terminal_count(2);
set_maximum_allowed_terminal_count(2);
return;
}
if(device_type==STEPS_TRANSFORMER)
{
enable_allow_terminal();
enable_allow_identifier();
this->device_type = device_type;
set_minimum_allowed_terminal_count(2);
set_maximum_allowed_terminal_count(3);
return;
}
if(device_type==STEPS_MULTI_DC)
{
enable_allow_terminal();
enable_allow_identifier();
this->device_type = device_type;
set_minimum_allowed_terminal_count(3);
set_maximum_allowed_terminal_count(100);
return;
}
if(device_type==STEPS_LCC_HVDC)
{
enable_allow_name();
disable_allow_identifier();
this->device_type = device_type;
set_minimum_allowed_terminal_count(0);
set_maximum_allowed_terminal_count(0);
return;
}
if(device_type==STEPS_GENERAL_DEVICE)
{
enable_allow_terminal();
enable_allow_identifier();
this->device_type = device_type;
set_minimum_allowed_terminal_count(0);
set_maximum_allowed_terminal_count(100);
return;
}
ostringstream osstream;
osstream<<"Device type '"<<device_type<<"' is not supported when building DEVICE_ID object."<<endl
<<"Allowed device types are: "<<endl
<<"GENERATOR, WT GENERATOR, PV UNIT, ENERGY STORAGE, LOAD, FIXED SHUNT, SWITCHED SHUNT"<<endl
<<"LINE, TRANSFORMER, HVDC, VSC HVDC, FACTS, LCC HVDC, MULTI DC, EQUIVALENT DEVICE, and GENERAL DEVICE."<<endl
<<"Device type will be set as blank, and \"NONE\" will be returned if get_device_type() is called.";
show_information_with_leading_time_stamp_with_default_toolkit(osstream);
device_type = STEPS_INVALID_DEVICE;
}
void DEVICE_ID::set_device_terminal(const TERMINAL& term)
{
if(allow_terminal)
{
if(is_given_terminal_acceptable(term))
this->terminal = term;
else
{
ostringstream osstream;
osstream<<"Invalid terminal is provided for setting DEVICE_ID object. nothing is changed."<<endl
<<"Possible device type is "<<get_device_type()<<"."<<endl
<<"Given terminal is: "<<term.convert2string()<<".";
show_information_with_leading_time_stamp_with_default_toolkit(osstream);
}
}
}
bool DEVICE_ID::is_given_terminal_acceptable(const TERMINAL& term)
{
unsigned int n_terminal = term.get_bus_count();
if(n_terminal>=get_minimum_allowed_terminal_count() and
n_terminal<=get_maximum_allowed_terminal_count())
return true;
else
return false;
}
/*
void DEVICE_ID::set_device_identifier(string identifier)
{
if(allow_identifier)
{
identifier = trim_string(identifier);
add_string_to_str_int_map(identifier);
this->device_identifier_index = get_index_of_string(identifier);
}
else
this->device_identifier_index = get_index_of_string("");
}
void DEVICE_ID::set_device_name(string name)
{
if(allow_name)
{
name = trim_string(name);
add_string_to_str_int_map(name);
this->device_name_index = get_index_of_string(name);
}
else
this->device_name_index = get_index_of_string("");
}
*/
void DEVICE_ID::set_device_identifier_index(unsigned int index){
if(allow_identifier)
{
this->device_identifier_index = index;
}
}
void DEVICE_ID::set_device_name_index(unsigned int index)
{
if(allow_name)
{
this->device_name_index = index;
}
}
STEPS_DEVICE_TYPE DEVICE_ID::get_device_type() const
{
return device_type;
}
TERMINAL DEVICE_ID::get_device_terminal() const
{
return terminal;
}
string DEVICE_ID::get_device_identifier() const
{
if(allow_identifier)
return get_string_of_index(device_identifier_index);
else
return "";
}
string DEVICE_ID::get_device_name() const
{
if(allow_name)
return get_string_of_index(device_name_index);
else
return "";
}
unsigned int DEVICE_ID::get_device_identifier_index() const
{
return device_identifier_index;
}
unsigned int DEVICE_ID::get_device_name_index() const
{
return device_name_index;
}
unsigned int DEVICE_ID::get_minimum_allowed_terminal_count() const
{
return minimum_terminal_count;
}
unsigned int DEVICE_ID::get_maximum_allowed_terminal_count() const
{
return maximum_terminal_count;
}
string DEVICE_ID::get_compound_device_name() const
{
string comp_device_name = "INVALID DEVICE (possible of type "+num2str(get_device_type())+")";
if(is_valid())
{
STEPS_DEVICE_TYPE device_type = get_device_type();
string device_type_str = device_type2string(device_type);
string ident = get_device_identifier();
string device_name = get_device_name();
TERMINAL term = get_device_terminal();
vector<unsigned int> buses = term.get_buses();
unsigned int bus_count = term.get_bus_count();
if(device_type==STEPS_BUS)
{
comp_device_name = device_type_str+" "+num2str(buses[0]);
return comp_device_name;
}
if(device_type==STEPS_LINE or device_type==STEPS_HVDC or device_type==STEPS_VSC_HVDC)
{
if(ident=="")
comp_device_name = device_type_str + " ";
else
comp_device_name = device_type_str + " "+ident+" ";
comp_device_name += "LINKING BUS "+num2str(buses[0])+" AND "+num2str(buses[1]);
return comp_device_name;
}
if(device_type==STEPS_TRANSFORMER)
{
if(ident=="")
comp_device_name = device_type_str + " ";
else
comp_device_name = device_type_str + " "+ident+" ";
if(bus_count==2)
comp_device_name += "LINKING BUS "+num2str(buses[0])+" AND "+num2str(buses[1]);
else
comp_device_name += "LINKING BUS "+num2str(buses[0])+" "+num2str(buses[1])+" AND "+num2str(buses[2]);
return comp_device_name;
}
if(device_type==STEPS_GENERATOR or device_type==STEPS_WT_GENERATOR or device_type==STEPS_PV_UNIT or
device_type==STEPS_ENERGY_STORAGE or device_type==STEPS_LOAD or device_type==STEPS_FIXED_SHUNT or
device_type==STEPS_SWITCHED_SHUNT or device_type==STEPS_EQUIVALENT_DEVICE)
{
if(ident=="")
comp_device_name = device_type_str + " ";
else
comp_device_name = device_type_str + " "+ident+" ";
comp_device_name += "AT BUS "+num2str(buses[0]);
return comp_device_name;
}
if(device_type==STEPS_LCC_HVDC)
{
if(device_name=="")
comp_device_name = device_type_str + " INVALID";
else
comp_device_name = device_type_str + " "+device_name;
return comp_device_name;
}
if(device_type==STEPS_GENERAL_DEVICE)
{
if(ident=="")
comp_device_name = device_type_str + " ";
else
comp_device_name = device_type_str + " "+ident+" ";
switch(bus_count)
{
case 0:
comp_device_name += " AT SUPER CONTROL CENTER";
break;
case 1:
comp_device_name += " AT BUS "+num2str(buses[0]);
break;
default:
comp_device_name += " LINKING BUSES ("+num2str(buses[0]);
for(unsigned int i=1; i<bus_count; ++i)
comp_device_name += ", "+num2str(buses[i]);
comp_device_name += ")";
break;
}
return comp_device_name;
}
return comp_device_name;
}
else
return comp_device_name;
}
bool DEVICE_ID::is_valid() const
{
if(device_type==STEPS_INVALID_DEVICE or (is_name_allowed() and device_name_index != 0) or (is_terminal_allowed() and terminal.get_bus_count()!=0))
return true;
else
return false;
}
bool DEVICE_ID::is_name_allowed() const
{
return allow_name;
}
bool DEVICE_ID::is_terminal_allowed() const
{
return allow_terminal;
}
bool DEVICE_ID::is_identifier_allowed() const
{
return allow_identifier;
}
void DEVICE_ID::clear()
{
device_type = STEPS_INVALID_DEVICE;
device_identifier_index = 0;
device_name_index = 0;
terminal.clear();
initialize_minimum_maximum_terminal_count();
allow_identifier = false;
allow_name = false;
}
DEVICE_ID& DEVICE_ID::operator= (const DEVICE_ID& device_id)
{
if(this==(&device_id)) return *this;
set_device_type(device_id.get_device_type());
set_device_terminal(device_id.get_device_terminal());
set_device_identifier_index(device_id.get_device_identifier_index());
set_device_name_index(device_id.get_device_name_index());
return (*this);
}
bool DEVICE_ID::operator< (const DEVICE_ID& device_id) const
{
if(this->get_device_type() == device_id.get_device_type())
{
if(allow_name)
{
if(this->get_device_name()<device_id.get_device_name())
return true;
else
return false;
}
else
{
TERMINAL this_terminal = this->get_device_terminal();
TERMINAL to_compare_terminal = device_id.get_device_terminal();
vector<unsigned int> this_buses = this_terminal.get_buses();
vector<unsigned int> to_compare_buses = to_compare_terminal.get_buses();
unsigned int this_size = this_buses.size();
unsigned int to_compare_size = to_compare_buses.size();
unsigned int max_size = max(this_size, to_compare_size);
this_buses.resize(max_size, 0);
to_compare_buses.resize(max_size, 0);
int compare_sign = 0;
for(unsigned int i=0; compare_sign==0 and i!=max_size; ++i)
compare_sign = (int)this_buses[i]-(int)to_compare_buses[i];
if(compare_sign!=0)
return compare_sign<0;
else
{
if(allow_identifier)
{
string this_identifier = this->get_device_identifier();
string to_compare_identifier = device_id.get_device_identifier();
compare_sign = (this_identifier<to_compare_identifier?-1:(this_identifier>to_compare_identifier?1:0));
return compare_sign<0;
}
else
return false;
}
}
}
else// of different types, no comparison
return false;
}
bool DEVICE_ID::operator==(const DEVICE_ID& device_id) const
{
if(this->get_device_type()==device_id.get_device_type())
{
if((*this)<device_id or device_id<(*this))
return false;
else
return true;
}
else
return false;
}
bool DEVICE_ID::operator!=(const DEVICE_ID& device_id) const
{
if(this->get_device_type()==device_id.get_device_type())
return not((*this)==device_id);
else
return false;
}
DEVICE_ID get_bus_device_id(unsigned int bus_number)
{
DEVICE_ID did;
did.set_device_type(STEPS_BUS);
TERMINAL terminal;
terminal.append_bus(bus_number);
did.set_device_terminal(terminal);
return did;
}
DEVICE_ID get_generator_device_id(unsigned int bus, const string& identifier)
{
DEVICE_ID did;
did.set_device_type(STEPS_GENERATOR);
TERMINAL terminal;
terminal.append_bus(bus);
did.set_device_terminal(terminal);
did.set_device_identifier_index(get_index_of_string(identifier));
return did;
}
DEVICE_ID get_wt_generator_device_id(unsigned int bus, const string& identifier)
{
DEVICE_ID did;
did.set_device_type(STEPS_WT_GENERATOR);
TERMINAL terminal;
terminal.append_bus(bus);
did.set_device_terminal(terminal);
did.set_device_identifier_index(get_index_of_string(identifier));
return did;
}
DEVICE_ID get_pv_unit_device_id(unsigned int bus, const string& identifier)
{
DEVICE_ID did;
did.set_device_type(STEPS_PV_UNIT);
TERMINAL terminal;
terminal.append_bus(bus);
did.set_device_terminal(terminal);
did.set_device_identifier_index(get_index_of_string(identifier));
return did;
}
DEVICE_ID get_energy_storage_device_id(unsigned int bus, const string& identifier)
{
DEVICE_ID did;
did.set_device_type(STEPS_ENERGY_STORAGE);
TERMINAL terminal;
terminal.append_bus(bus);
did.set_device_terminal(terminal);
did.set_device_identifier_index(get_index_of_string(identifier));
return did;
}
DEVICE_ID get_load_device_id(unsigned int bus, const string& identifier)
{
DEVICE_ID did;
did.set_device_type(STEPS_LOAD);
TERMINAL terminal;
terminal.append_bus(bus);
did.set_device_terminal(terminal);
did.set_device_identifier_index(get_index_of_string(identifier));
return did;
}
DEVICE_ID get_fixed_shunt_device_id(unsigned int bus, const string& identifier)
{
DEVICE_ID did;
did.set_device_type(STEPS_FIXED_SHUNT);
TERMINAL terminal;
terminal.append_bus(bus);
did.set_device_terminal(terminal);
did.set_device_identifier_index(get_index_of_string(identifier));
return did;
}
DEVICE_ID get_line_device_id(unsigned int ibus, unsigned int jbus, const string& identifier)
{
DEVICE_ID did;
did.set_device_type(STEPS_LINE);
TERMINAL terminal;
terminal.append_bus(ibus);
terminal.append_bus(jbus);
did.set_device_terminal(terminal);
did.set_device_identifier_index(get_index_of_string(identifier));
return did;
}
DEVICE_ID get_hvdc_device_id(unsigned int ibus, unsigned int jbus, const string& identifier)
{
DEVICE_ID did;
did.set_device_type(STEPS_HVDC);
TERMINAL terminal;
terminal.append_bus(ibus);
terminal.append_bus(jbus);
did.set_device_terminal(terminal);
did.set_device_identifier_index(get_index_of_string(identifier));
return did;
}
DEVICE_ID get_transformer_device_id(unsigned int ibus, unsigned int jbus, unsigned int kbus, const string& identifier)
{
DEVICE_ID did;
did.set_device_type(STEPS_TRANSFORMER);
TERMINAL terminal;
terminal.append_bus(ibus);
terminal.append_bus(jbus);
terminal.append_bus(kbus);
did.set_device_terminal(terminal);
did.set_device_identifier_index(get_index_of_string(identifier));
return did;
}
DEVICE_ID get_equivalent_device_id(unsigned int bus, const string& identifier)
{
DEVICE_ID did;
did.set_device_type(STEPS_EQUIVALENT_DEVICE);
TERMINAL terminal;
terminal.append_bus(bus);
did.set_device_terminal(terminal);
did.set_device_identifier_index(get_index_of_string(identifier));
return did;
}
DEVICE_ID get_lcc_hvdc_device_id(const string& name)
{
DEVICE_ID did;
did.set_device_type(STEPS_LCC_HVDC);
did.set_device_name_index(get_index_of_string(name));
return did;
}
DEVICE_ID get_general_device_id(const vector<unsigned int>& bus, const string& identifier)
{
DEVICE_ID did;
did.set_device_type(STEPS_GENERAL_DEVICE);
TERMINAL terminal;
unsigned int n = bus.size();
for(unsigned int i=0; i<n; ++i)
terminal.append_bus(bus[i]);
did.set_device_terminal(terminal);
did.set_device_identifier_index(get_index_of_string(identifier));
return did;
}
| 26.146933 | 150 | 0.663102 | changgang |
aa1a411584f5d23e498cdda72490e27d8fe6dcc2 | 5,402 | cpp | C++ | server/nhocr/nhocr-0.21/makedic/makedic.cpp | el-hoshino/HandwrAIter | b9fcc0db975bac615e6331d2a8147b596dd11028 | [
"MIT"
] | 17 | 2017-04-11T19:54:05.000Z | 2022-01-31T21:04:05.000Z | server/nhocr/nhocr-0.21/makedic/makedic.cpp | el-hoshino/HandwrAIter | b9fcc0db975bac615e6331d2a8147b596dd11028 | [
"MIT"
] | null | null | null | server/nhocr/nhocr-0.21/makedic/makedic.cpp | el-hoshino/HandwrAIter | b9fcc0db975bac615e6331d2a8147b596dd11028 | [
"MIT"
] | 3 | 2017-05-11T16:57:31.000Z | 2019-01-28T13:53:39.000Z | /*--------------------------------------------------------------
Make character dictionary makedic v1.1
(C) 2005-2010 Hideaki Goto (see accompanying LICENSE file)
Written by H.Goto, Dec. 2005
Revised by H.Goto, Feb. 2010
--------------------------------------------------------------*/
//#define Use_DEfeature
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "utypes.h"
#include "ufilep.h"
#include "siplib.h"
#include "ocrbase.h"
#include "feature_PLOVE.h"
#ifdef Use_DEfeature
#include "feature_DEF.h"
#endif
static int sw_help = 0;
static int sw_verbose = 0;
static int sw_dim = FVECDIM_PLM;
static int n_cat = 0;
static int n_set = 1;
/*----------------------------------------------
Save dictionary
----------------------------------------------*/
static int save_dic(RecBase *Rec, char *dicfile){
FILE *fp;
int cid;
if ( NULL == (fp = fopen(dicfile,"wb")) ){
fprintf(stderr,"Failed to open \"%s\" for output.\n",dicfile);
return(-1);
}
for ( cid=0 ; cid<n_cat ; cid++ ){
if ( Rec->dic[cid].write_vector(fp) ){
fprintf(stderr,"Failed to write data to \"%s\".\n",dicfile);
fclose(fp);
return(3);
}
}
if ( fclose(fp) ){
fprintf(stderr,"Failed to write data to \"%s\".\n",dicfile);
return(3);
}
return(0);
}
/*----------------------------------------------
Load the first vector file
----------------------------------------------*/
static int load_vec(RecBase *Rec, char *vecfile, int dim){
FILE *fp;
int cid;
struct stat statinfo;
if ( stat(vecfile,&statinfo) ){
fprintf(stderr,"Failed to load vector file \"%s\".\n",vecfile);
return(-1);
}
n_cat = statinfo.st_size / sizeof(double) / dim;
if ( n_cat <= 0 ){
fprintf(stderr,"Vector file \"%s\" is too short.\n",vecfile);
return(-1);
}
if ( Rec->alloc(n_cat, dim, 1) ){
fprintf(stderr,"Failed to load vector file \"%s\".\n",vecfile);
return(-1);
}
if ( NULL == (fp = fopen(vecfile,"rb")) ){
fprintf(stderr,"Failed to load vector file \"%s\".\n",vecfile);
return(-1);
}
for ( cid=0 ; cid<n_cat ; cid++ ){
if ( Rec->dic[cid].read_vector(fp) ){
fprintf(stderr,"Failed to load vector file \"%s\".\n",vecfile);
fclose(fp);
return(-1);
}
}
fclose(fp);
if ( sw_verbose ){
fprintf(stderr,"%d categories found.\n",n_cat);
}
return(0);
}
/*----------------------------------------------
Add another vector file
----------------------------------------------*/
static int add_vec(RecBase *Rec, char *vecfile){
FILE *fp;
int cid;
FeatureVector vec(Rec->dic[0].dim);
if ( NULL == (fp = fopen(vecfile,"rb")) ){
fprintf(stderr,"Failed to load vector file \"%s\".\n",vecfile);
return(-1);
}
for ( cid=0 ; cid<n_cat ; cid++ ){
// if ( Rec->dic[cid].read_vector(fp) ){
if ( vec.read_vector(fp) ){
fprintf(stderr,"Failed to load vector file \"%s\".\n",vecfile);
fclose(fp);
return(-1);
}
Rec->dic[cid] += vec;
}
fclose(fp);
n_set++;
return(0);
}
/*----------------------------------------------
Main routine
----------------------------------------------*/
int main(int ac, char **av){
char *outfile = NULL;
char *infile = NULL;
int i,k, cid;
int rcode;
RecBase Rec;
int sw_err = 0;
for ( k=1 ; k<ac ; k++ ){
if ( 0 == strcmp(av[k],"-h") ){ sw_help = 1; continue; }
if ( 0 == strcmp(av[k],"-v") ){ sw_verbose = 1; continue; }
if ( 0 == strcmp(av[k],"-dim") ){
if ( ++k >= ac ){ sw_err = 1; break; }
sw_dim = atoi(av[k]);
if ( sw_dim < 1 ){ sw_err = 1; break; }
continue;
}
if ( 0 == strcmp(av[k],"-F") ){
if ( ++k >= ac ){ sw_err = 1; break; }
#ifdef Use_DEfeature
if ( 0 == strcmp(av[k],"DEF") ){ sw_dim = FVECDIM_DEF; continue; }
if ( 0 == strcmp(av[k],"DEFOL") ){ sw_dim = FVECDIM_DEFOL; continue; }
#endif
if ( 0 == strcmp(av[k],"P-LOVE") ){ sw_dim = FVECDIM_PLOVE; continue; }
if ( 0 == strcmp(av[k],"PLOVE") ){ sw_dim = FVECDIM_PLOVE; continue; }
if ( 0 == strcmp(av[k],"P-LM") ){ sw_dim = FVECDIM_PLM; continue; }
if ( 0 == strcmp(av[k],"PLM") ){ sw_dim = FVECDIM_PLM; continue; }
sw_err = 1; break;
}
if ( 0 == strcmp(av[k],"-o") ){
if ( ++k >= ac ){ sw_err = 1; break; }
outfile = av[k];
continue;
}
if ( infile == NULL ){ infile = av[k]; break; }
}
if ( sw_err || sw_help || outfile == NULL || infile == NULL ){
fputs("Make character dictionary\n",stderr);
fputs("makedic v1.1 Copyright (C) 2005-2010 Hideaki Goto\n",stderr);
fputs("usage: makedic [options] -o out_dic_file vec_file1 vec_file2 ...\n",stderr);
#ifdef Use_DEfeature
fputs(" -F type : feature type PLOVE/PLM(default)/DEF/DEFOL\n",stderr);
#else
fputs(" -F type : feature type PLOVE/PLM(default)\n",stderr);
#endif
fprintf(stderr," -dim N : dimension of feature vector (default:%d)\n",FVECDIM_PLM);
fputs(" -v : verbose mode\n",stderr);
return(1);
}
rcode = load_vec(&Rec, infile, sw_dim);
if ( rcode ) return(rcode);
for ( k++ ; k<ac ; k++ ){
rcode = add_vec(&Rec, av[k]);
if ( rcode ) return(rcode);
}
if ( sw_verbose ){
fprintf(stderr,"%d sets loaded.\n",n_set);
}
/* normalization */
for ( cid=0 ; cid<Rec.n_cat ; cid++ ){
for ( i=0 ; i<Rec.dic[cid].dim ; i++ ){
Rec.dic[cid].e[i] /= (double)n_set;
}
}
save_dic(&Rec, outfile);
return(rcode);
}
| 24.554545 | 93 | 0.536283 | el-hoshino |
aa1b4109529396fafd9f19b1a4013a43f7788b31 | 2,413 | cpp | C++ | Code/Editor/EditorPreferencesPageExperimentalLighting.cpp | cypherdotXd/o3de | bb90c4ddfe2d495e9c00ebf1e2650c6d603a5676 | [
"Apache-2.0",
"MIT"
] | 11 | 2021-07-08T09:58:26.000Z | 2022-03-17T17:59:26.000Z | Code/Editor/EditorPreferencesPageExperimentalLighting.cpp | RoddieKieley/o3de | e804fd2a4241b039a42d9fa54eaae17dc94a7a92 | [
"Apache-2.0",
"MIT"
] | 29 | 2021-07-06T19:33:52.000Z | 2022-03-22T10:27:49.000Z | Code/Editor/EditorPreferencesPageExperimentalLighting.cpp | RoddieKieley/o3de | e804fd2a4241b039a42d9fa54eaae17dc94a7a92 | [
"Apache-2.0",
"MIT"
] | 4 | 2021-07-06T19:24:43.000Z | 2022-03-31T12:42:27.000Z | /*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "EditorDefs.h"
#include "EditorPreferencesPageExperimentalLighting.h"
// AzCore
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzQtComponents/Components/StyleManager.h>
// Editor
#include "Settings.h"
void CEditorPreferencesPage_ExperimentalLighting::Reflect(AZ::SerializeContext& serialize)
{
serialize.Class<Options>()
->Version(1)
->Field("TotalIlluminationEnabled", &Options::m_totalIlluminationEnabled);
serialize.Class<CEditorPreferencesPage_ExperimentalLighting>()
->Version(1)
->Field("Options", &CEditorPreferencesPage_ExperimentalLighting::m_options);
AZ::EditContext* editContext = serialize.GetEditContext();
if (editContext)
{
editContext->Class<Options>("Options", "")
->DataElement(AZ::Edit::UIHandlers::CheckBox, &Options::m_totalIlluminationEnabled, "Total Illumination", "Enable Total Illumination");
editContext->Class<CEditorPreferencesPage_ExperimentalLighting>("Experimental Features Preferences", "Experimental Features Preferences")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ_CRC("PropertyVisibility_ShowChildrenOnly", 0xef428f20))
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ExperimentalLighting::m_options, "Options", "Experimental Features Options");
}
}
CEditorPreferencesPage_ExperimentalLighting::CEditorPreferencesPage_ExperimentalLighting()
{
InitializeSettings();
m_icon = QIcon(":/res/Experimental.svg");
}
const char* CEditorPreferencesPage_ExperimentalLighting::GetTitle()
{
return "Experimental Features";
}
QIcon& CEditorPreferencesPage_ExperimentalLighting::GetIcon()
{
return m_icon;
}
void CEditorPreferencesPage_ExperimentalLighting::OnApply()
{
gSettings.sExperimentalFeaturesSettings.bTotalIlluminationEnabled = m_options.m_totalIlluminationEnabled;
}
void CEditorPreferencesPage_ExperimentalLighting::InitializeSettings()
{
m_options.m_totalIlluminationEnabled = gSettings.sExperimentalFeaturesSettings.bTotalIlluminationEnabled;
}
| 33.985915 | 158 | 0.766266 | cypherdotXd |
aa1ba6daa0399115d30241c8191bf9a23df07db1 | 358 | hpp | C++ | src/sdm/core/states.hpp | SDMStudio/sdms | 43a86973081ffd86c091aed69b332f0087f59361 | [
"MIT"
] | null | null | null | src/sdm/core/states.hpp | SDMStudio/sdms | 43a86973081ffd86c091aed69b332f0087f59361 | [
"MIT"
] | null | null | null | src/sdm/core/states.hpp | SDMStudio/sdms | 43a86973081ffd86c091aed69b332f0087f59361 | [
"MIT"
] | null | null | null | #pragma once
#include <sdm/types.hpp>
#include <sdm/core/state/state.hpp>
// #include <sdm/core/state/history.hpp>
// #include <sdm/core/state/beliefs.hpp>
// #include <sdm/core/state/occupancy_state.hpp>
#include <sdm/core/state/serial_state.hpp>
// #include <sdm/core/state/serial_belief_state.hpp>
// #include <sdm/core/state/serial_occupancy_state.hpp>
| 32.545455 | 55 | 0.751397 | SDMStudio |
aa1ba7dd1119eda20123b694f8f6eca5b22b2ff8 | 975 | hpp | C++ | soccer/planning/primitives/CreatePath.hpp | kasohrab/robocup-software | 73c92878baf960844b5a4b34c72804093f1ea459 | [
"Apache-2.0"
] | null | null | null | soccer/planning/primitives/CreatePath.hpp | kasohrab/robocup-software | 73c92878baf960844b5a4b34c72804093f1ea459 | [
"Apache-2.0"
] | null | null | null | soccer/planning/primitives/CreatePath.hpp | kasohrab/robocup-software | 73c92878baf960844b5a4b34c72804093f1ea459 | [
"Apache-2.0"
] | null | null | null | #pragma once
#include "planning/MotionConstraints.hpp"
#include "planning/Trajectory.hpp"
#include "planning/primitives/PathSmoothing.hpp"
namespace Planning::CreatePath {
/**
* Generate a smooth path from start to goal avoiding obstacles.
*/
Trajectory rrt(const LinearMotionInstant& start,
const LinearMotionInstant& goal,
const MotionConstraints& motionConstraints, RJ::Time startTime,
const Geometry2d::ShapeSet& static_obstacles,
const std::vector<DynamicObstacle>& dynamic_obstacles = {},
const std::vector<Geometry2d::Point>& biasWaypoints = {});
/**
* Generate a smooth path from start to goal disregarding obstacles.
*/
Trajectory simple(
const LinearMotionInstant& start, const LinearMotionInstant& goal,
const MotionConstraints& motionConstraints, RJ::Time startTime,
const std::vector<Geometry2d::Point>& intermediatePoints = {});
} // namespace Planning::CreatePath | 36.111111 | 78 | 0.716923 | kasohrab |
aa1bd97bad21f9758c45d2133b1946e519884a97 | 1,257 | cc | C++ | PTA/PAT_A/Cpp11/A1116_AC.cc | StrayDragon/OJ-Solutions | b31b11c01507544aded2302923da080b39cf2ba8 | [
"MIT"
] | 1 | 2019-05-13T10:09:55.000Z | 2019-05-13T10:09:55.000Z | PTA/PAT_A/Cpp11/A1116_AC.cc | StrayDragon/OJ-Solutions | b31b11c01507544aded2302923da080b39cf2ba8 | [
"MIT"
] | null | null | null | PTA/PAT_A/Cpp11/A1116_AC.cc | StrayDragon/OJ-Solutions | b31b11c01507544aded2302923da080b39cf2ba8 | [
"MIT"
] | null | null | null | // ---
// id : 1116
// title : Come on! Let's C
// difficulty : Easy
// score : 20
// tag : TODO
// keyword : TODO
// status : AC
// from : PAT (Advanced Level) Practice
// ---
#include <cmath>
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
bool is_prime(int n) {
if (n <= 1)
return false;
int bound = (int)std::sqrt(1.0 * n);
for (int i = 2; i <= bound; ++i)
if (n % i == 0)
return false;
return true;
}
int main() {
unordered_map<int, string> awarddict;
unordered_map<int, bool> checkeddict;
int n;
cin >> n;
for (int id, i = 1; i <= n; i++) {
cin >> id;
if (i == 1) {
awarddict[id] = "Mystery Award";
} else {
if (is_prime(i)) {
awarddict[id] = "Minion";
} else {
awarddict[id] = "Chocolate";
}
}
}
int k;
cin >> k;
for (int id; k--;) {
cin >> id;
printf("%04d: ", id);
if (awarddict.find(id) != awarddict.end()) {
if (checkeddict.find(id) != checkeddict.end()) {
cout << "Checked\n";
} else {
checkeddict[id] = true;
cout << awarddict[id] << '\n';
}
} else {
cout << "Are you kidding?\n";
}
}
return 0;
}
| 19.338462 | 54 | 0.491647 | StrayDragon |
aa1ca194799da5f6ac0412ee67c983b93dd2dc1a | 134,676 | cpp | C++ | src/GMinstrument/SynthBass2_samples.cpp | manicken/teensy4polysynth2 | 24d8064551b0d7f2c1a128884d6cf876b86b7a69 | [
"MIT"
] | 1 | 2022-03-16T07:02:00.000Z | 2022-03-16T07:02:00.000Z | src/GMinstrument/SynthBass2_samples.cpp | manicken/teensy4polysynth2 | 24d8064551b0d7f2c1a128884d6cf876b86b7a69 | [
"MIT"
] | null | null | null | src/GMinstrument/SynthBass2_samples.cpp | manicken/teensy4polysynth2 | 24d8064551b0d7f2c1a128884d6cf876b86b7a69 | [
"MIT"
] | null | null | null | #include "SynthBass2_samples.h"
static const PROGMEM uint32_t sample_0_SynthBass2_SYBS233[4992] = {
0xff930000,0xfd0cfec1,0xfa2ffba5,0xf070f6ab,0xe948ea97,0xef7aebdc,0xf6b1f468,0xede3f3f6,
0xda68e3ea,0xcd6fd224,0xcb86cb87,0xca6dcbbf,0xc57ec7cd,0xc89bc5b5,0xd2bdcdd8,0xd8a8d65c,
0xdac2d994,0xdfd7dcd6,0xe86ee3a3,0xf212ed96,0xf5b1f4d0,0xf39cf4eb,0xf38df2e7,0xf91ef5b1,
0x0067fcfa,0x03670291,0x029f033c,0x02d2024d,0x064c0439,0x0a66087a,0x0c560bbd,0x0c3e0c66,
0x0c900c36,0x0e860d60,0x10b60fb8,0x11b2115c,0x11bf11c1,0x120311cd,0x12f4126b,0x14031384,
0x14ad1468,0x14c014ca,0x14e014cd,0x15401507,0x15c61578,0x162f161b,0x15f21614,0x159315b7,
0x155e157e,0x15251537,0x14f3150d,0x14bb14e0,0x14311480,0x134e13cc,0x12c412ed,0x12d712c6,
0x129612dc,0x119d1223,0x10c01119,0x10431083,0x0ff41017,0x0f740fb4,0x0ede0f35,0x0e4e0e88,
0x0e1c0e43,0x0d580dbb,0x0cb70d0a,0x0c9a0c97,0x0c4a0c88,0x0b6d0be0,0x0aef0b19,0x0a840ac7,
0x09ee0a2e,0x099a09c2,0x094b096f,0x089c090a,0x07ec0829,0x07af07c7,0x07af07ab,0x0737078a,
0x060906af,0x050e0566,0x051e0514,0x04fd0504,0x043a04bf,0x032603b1,0x02a502ba,0x02b902b0,
0x028602bb,0x01e50230,0x01060168,0x00b500e5,0x000a0054,0xffe9fff6,0xffaaffe2,0xfea7ff34,
0xfe0cfe43,0xfe2efdfe,0xfea0fe81,0xfd9afe4a,0xfcbcfcfe,0xfd17fcd9,0xfd93fd55,0xfd81fda6,
0xfca4fd26,0xfc1dfc27,0xfcb5fc81,0xfc41fc7b,0xfbcffc28,0xfab3fb2e,0xfa63fa89,0xfab9fa61,
0xfb32fb21,0xfa94fafd,0xf98ef9f8,0xf976f97e,0xf94bf93b,0xf9f7f9ca,0xf852f93e,0xf857f809,
0xf82ff887,0xf7bff7b6,0xf8def852,0xf802f8b2,0xf743f771,0xf771f75e,0xf734f757,0xf6d5f71c,
0xf62cf666,0xf6acf657,0xf669f6c6,0xf523f5b3,0xf5d0f53d,0xf56bf5fe,0xf482f4a4,0xf59cf50e,
0xf523f5a8,0xf3d7f46b,0xf319f36f,0xf2f7f2e5,0xf405f360,0xf41bf458,0xf22af355,0xf0dbf120,
0xf2c9f188,0xf48cf401,0xf2cdf40f,0xf061f159,0xf0baf028,0xf2bcf1b1,0xf3baf38c,0xf225f327,
0xf064f113,0xf0fdf070,0xf25ef1b2,0xf2e4f2cc,0xf257f2b0,0xf185f1ec,0xf0fbf129,0xf174f119,
0xf1f2f1c6,0xf22df1ff,0xf28bf267,0xf26df28d,0xf1c5f21f,0xf1b2f190,0xf27ef21e,0xf1dcf273,
0xef91f0c0,0xeec9eecc,0xf0faef8d,0xf32ef275,0xf14ef2c2,0xed32ef3d,0xeb7aebd0,0xed14ec0c,
0xeec6ee23,0xee03eea7,0xec23ed0e,0xead0eb63,0xe8f2ea0e,0xe476e6e6,0xdf29e1b3,0xdbc8dd13,
0xdb42db40,0xdbbedb8e,0xda3cdb3b,0xd82ad95e,0xd5bed6ed,0xd488d4fc,0xd3a0d42d,0xd2cbd32e,
0xd2dbd2b6,0xd2ded301,0xd0e6d227,0xcbbbceca,0xc339c7dd,0xb805bdc9,0xad7bb273,0xa558a915,
0x9f6ba236,0x99759c85,0x91d895e2,0x89168d6f,0x83d984fb,0x840f8422,0x84338434,0x8453844d,
0x846f8468,0x848d8485,0x84a984a3,0x84c984c0,0x84e584dc,0x84fe84fd,0x860a8546,0x87b186db,
0x89108854,0x8aef8a00,0x8cff8bd8,0x8f988e52,0x924190dd,0x94a59397,0x96f695b6,0x99019829,
0x9aa699bb,0x9d009bc4,0xa0029e6d,0xa426a1ef,0xa8d0a686,0xad9eab33,0xb2dbb045,0xb7f9b568,
0xbd90bac6,0xc22cc004,0xc70fc48d,0xcb8bc960,0xcfaecd93,0xd396d1a6,0xd80ad5ba,0xdc5fda3d,
0xe01bde2c,0xe4f0e272,0xe996e753,0xee27ebdb,0xf18cf021,0xf47df2ec,0xf8b8f69f,0xfc59faa2,
0x002bfe29,0x0428025a,0x077205c8,0x0b4c0951,0x0e670d0d,0x10eb0f89,0x13601253,0x13de13cd,
0x14951404,0x160b1561,0x16ab166e,0x170116e8,0x169416d6,0x16d6168c,0x17ae1749,0x189e1817,
0x197d192a,0x19121963,0x196f18f7,0x1b391a5e,0x1b721b8b,0x1b7c1b4e,0x1c871c02,0x1cd31cbe,
0x1d8d1cff,0x1f001e5a,0x1f5c1f5c,0x1f1a1f2a,0x20211f69,0x216120eb,0x21a92186,0x223c21e0,
0x22f822a9,0x23842336,0x246423ec,0x250d24cc,0x25192519,0x25982536,0x26852620,0x270126c1,
0x27a72746,0x28552811,0x284a285f,0x28822852,0x295228db,0x29f429bf,0x29c529ef,0x29d329bb,
0x2aa52a24,0x2b962b34,0x2b4d2ba1,0x2a992ad8,0x2b8c2add,0x2c732c36,0x2b5c2c2b,0x293b2a38,
0x291128d8,0x2a082999,0x29d32a22,0x280f2916,0x264e2704,0x26602620,0x270626b7,0x27192732,
0x25d4269f,0x249b2501,0x251d24ba,0x25982572,0x25332583,0x241c24b0,0x237223a8,0x23642371,
0x22cd2327,0x222f226f,0x220d2212,0x215521de,0x1ffd209e,0x1f391f7d,0x200c1f61,0x21a720f0,
0x216121d7,0x1f28204d,0x1ee31e99,0x21581fe1,0x240222e8,0x23d32448,0x22b82327,0x236b22ba,
0x25f0249a,0x275826f0,0x264b2713,0x24b82554,0x25df24e9,0x28442728,0x29402900,0x28872908,
0x276f27ec,0x27e82763,0x2a4528f4,0x2d102bba,0x2ebb2e19,0x2fad2f2c,0x308a3037,0x311430b8,
0x327131a7,0x34673356,0x378235be,0x3b6a396f,0x3f5b3d61,0x42754125,0x44154366,0x457a44c6,
0x477a4661,0x4ac64904,0x4e9f4cbe,0x52a650a1,0x56115481,0x58c05779,0x5afb59ee,0x5d5f5c0e,
0x609b5edb,0x6418625a,0x67ab65d3,0x6a836950,0x6b506b21,0x6b186b47,0x69ce6a9c,0x684468ed,
0x67f867f2,0x67da67fa,0x67a567a8,0x67496798,0x65af6694,0x63b264b8,0x60d16260,0x5e185f49,
0x5d395d9c,0x5c125cbc,0x5b5d5baa,0x5a715b18,0x5838598e,0x555356cd,0x50c75352,0x4a374da0,
0x421f466b,0x373b3cef,0x2a5d30c7,0x1c9a23a2,0x0e65156a,0x00cc0797,0xf380f9f8,0xe7c0ed82,
0xdbe8e1fe,0xd07dd5f3,0xc873cc03,0xc26ec575,0xbca2bf67,0xb902ba81,0xb683b7c7,0xb384b503,
0xb1dfb26e,0xb0f4b17c,0xaf1eb00e,0xadfeae5c,0xae01adf7,0xada8addd,0xae2fadb8,0xafdaaf02,
0xb075b06b,0xb014b038,0xb0feb064,0xb1d9b19a,0xb18fb1d9,0xb0dcb133,0xb07db095,0xb0d6b084,
0xb2b3b18e,0xb542b403,0xb74eb657,0xb9f0b878,0xbd64bb9a,0xc126bf46,0xc495c2f4,0xc78ac61b,
0xca20c8cf,0xcd0ecb82,0xd0d3cedc,0xd44ed2a1,0xd7acd5e8,0xdac7d949,0xde02dc56,0xe13ddfb6,
0xe3bae292,0xe63be4eb,0xe95de7da,0xec3bead3,0xef12eda4,0xf209f090,0xf565f3b6,0xf8a7f714,
0xfba5fa13,0xff14fd49,0x022200d2,0x034c02da,0x047403c3,0x0605053c,0x074a06c5,0x073b0773,
0x067a06d0,0x06da067a,0x07ca0761,0x07bf07eb,0x07110767,0x06b106d1,0x06e606b9,0x0729071d,
0x069a06f2,0x061f0644,0x0681063c,0x072006d5,0x06ce072e,0x056e0619,0x050a0512,0x056f052f,
0x05eb05b7,0x057e05dc,0x046604e7,0x0415041c,0x046c0436,0x0452048a,0x031603c0,0x028302a5,
0x024d0273,0x01d0020d,0x018c0199,0x01c2019f,0x01fc01ee,0x018c01e5,0x00560104,0xffc4ffce,
0x0114003f,0x01ef01be,0x00b60186,0xff01ffb4,0xff64fedd,0x0186006a,0x02490231,0x00de01c1,
0xff7bfff3,0x0051ff94,0x0278016c,0x02ea030b,0x010d021f,0xff8a000b,0xfff2ff82,0x01c400c8,
0x02b0028b,0x01690238,0x004300b5,0x004a0023,0x014b00b3,0x027e01fa,0x02690298,0x0236023a,
0x02aa025d,0x037a030b,0x045e03fa,0x0444047b,0x03bd03ed,0x03e303c1,0x04880422,0x05bf051d,
0x0664063e,0x05fb0640,0x058405c0,0x04f2053e,0x051c04da,0x066c05ad,0x07ec073d,0x08ae0870,
0x089408b4,0x082d0864,0x08110812,0x0885082c,0x0a000926,0x0bb60ae0,0x0cc70c5e,0x0ce10cf2,
0x0c140c97,0x0aec0b71,0x0a8d0aa4,0x0a910a88,0x0b640ac6,0x0d250c47,0x0e1c0dd2,0x0db00e05,
0x0cdf0d3d,0x0bf50c7b,0x0b0d0b5d,0x0bde0b2f,0x0de60ce9,0x0f1d0e9a,0x100e0f98,0x1062105e,
0x0fdf1030,0x0fdc0fa4,0x11b3109e,0x13c712d6,0x15ae14af,0x17c016c8,0x19001887,0x19b01960,
0x1ac11a28,0x1c061b60,0x1dc51cc4,0x21361f32,0x263d23a2,0x2a3a2865,0x2d532bc8,0x30502ece,
0x336231c8,0x36c63500,0x3a123887,0x3cfe3b98,0x40063e82,0x4300418b,0x46064486,0x487d4769,
0x4a0e495b,0x4b074aa3,0x4b544b3b,0x4bdb4b7c,0x4d4b4c80,0x4f244e34,0x50d85009,0x5256519b,
0x5410531e,0x561a5520,0x575356e2,0x574d5769,0x562056de,0x533354d4,0x4fc75172,0x4b3f4da2,
0x44504816,0x3a5a3fc2,0x2dc0343d,0x208c273a,0x11ed1975,0x033b0a9d,0xf572fc2d,0xe98aef41,
0xdf23e43d,0xd592da3b,0xcdbcd169,0xc75fca69,0xc1efc48a,0xbd5ebf81,0xb9c8bb7f,0xb631b801,
0xb2a9b45e,0xb001b12d,0xaec6af35,0xae95ae94,0xae85ae99,0xae2dae63,0xae1cae11,0xaed6ae75,
0xae96aefb,0xac8dadba,0xaa9aab76,0xa95ca9e7,0xa8b0a8f4,0xa872a882,0xa863a85f,0xa916a886,
0xab33a9fd,0xadb7ac7a,0xafd1aec8,0xb235b0ed,0xb5a4b3c2,0xb97fb795,0xbc97bb1f,0xbf6ebdf9,
0xc2bac102,0xc679c484,0xca0dc859,0xcc83cb6c,0xcedfcd94,0xd240d07f,0xd56fd3ed,0xd7f9d6cc,
0xda2dd91a,0xdcbfdb5c,0xe02dde6b,0xe38be1f1,0xe70ce52d,0xeb57e91a,0xef7fed79,0xf2a4f131,
0xf4e1f3cd,0xf7a0f612,0xfb47f969,0xfe03fce4,0xfecbfe9b,0xfec3fec7,0xffabff02,0x01e000c2,
0x030f02b8,0x023102da,0x00ef016b,0x01980104,0x03990290,0x04e50478,0x044104cb,0x03210397,
0x036e030f,0x04e2041a,0x05d50582,0x056d05c1,0x04d9050f,0x053204e5,0x067005b6,0x07cc073a,
0x07cf07ff,0x06d1075d,0x06540669,0x070e0692,0x07f0078e,0x082c081b,0x07de0815,0x074a0789,
0x077c0741,0x083707d9,0x08a00875,0x08be08b4,0x08ca08cb,0x088908ae,0x0899086f,0x09750903,
0x099f09b4,0x092d0963,0x095f0929,0x099c098e,0x09730987,0x09ad097e,0x09dc09dd,0x093c09a1,
0x08c208e8,0x091408d9,0x093d0944,0x09220928,0x091c092d,0x082008c1,0x06f2076f,0x06f606d2,
0x0777073b,0x07e707af,0x0813080b,0x079707f0,0x0670070f,0x057a05e3,0x055d054d,0x05fc059a,
0x06c90660,0x07830736,0x074a0794,0x05fd06ac,0x050b056b,0x04a504c9,0x04e904b2,0x056f052c,
0x060705af,0x06be066a,0x06a206d5,0x05a50639,0x047b0506,0x040c0419,0x05190461,0x0700060b,
0x083f07c8,0x08590867,0x07dc0823,0x07490793,0x06b406ff,0x067a0677,0x074b06c8,0x088c07f1,
0x097e091b,0x09a309b1,0x08f0095d,0x07eb086d,0x0740077b,0x077f073d,0x085107e2,0x091108b9,
0x09640944,0x0964096d,0x0926094b,0x08f108fe,0x095f090c,0x0a7309e3,0x0b400ae9,0x0c140b99,
0x0da40cd0,0x0f2d0e73,0x103d0fc4,0x10d4109a,0x111710fa,0x11c5114d,0x1346126f,0x153f1436,
0x179a1658,0x1a5b18ea,0x1cf61ba6,0x1f8a1e3a,0x228220f4,0x25c72425,0x28832737,0x2b2d29d1,
0x2ee32cec,0x33253101,0x3756354f,0x3aa53938,0x3cba3bd7,0x3e873d98,0x40243f6a,0x413f40b7,
0x425e41c7,0x43d14305,0x459e44ad,0x47614687,0x48f7482f,0x4ac849d6,0x4cf34bd9,0x4eff4e02,
0x508d4fd1,0x51d95133,0x5363528c,0x55195439,0x55d65591,0x558055d1,0x540654ea,0x515152d1,
0x4cfc4f6c,0x45e549e6,0x3ccc41ab,0x321137a9,0x25972c19,0x17841ebc,0x0a031090,0xff030423,
0xf592fa2b,0xec0df0dc,0xe200e704,0xd8aedd17,0xd10dd497,0xcaaecdc5,0xc4e5c7b5,0xc04dc25e,
0xbd99bec2,0xbb90bca0,0xb931ba6e,0xb6fcb7fc,0xb5d3b649,0xb54eb591,0xb40fb4eb,0xb11db2b9,
0xade1af53,0xac88ace7,0xac3eac62,0xaa7aab92,0xa779a8e5,0xa5a7a64d,0xa626a596,0xa883a734,
0xaaaea9be,0xabb2ab42,0xad25ac38,0xb058ae85,0xb498b273,0xb888b6a3,0xbbc9ba31,0xbe8ebd38,
0xc1e0c01b,0xc628c401,0xc99cc822,0xcb3aca9b,0xccfdcbff,0xcfe0ce58,0xd305d16a,0xd694d4c2,
0xd9fdd866,0xdcdddb67,0xe012de4a,0xe43ce206,0xe89ee66f,0xec61ea8e,0xefd3edff,0xf35ff1a0,
0xf6eaf530,0xfa81f8bf,0xfd7afc2e,0xff0dfe74,0x0004ff99,0x014700ad,0x02a301fc,0x03fc0359,
0x04e90485,0x0554052c,0x055d055d,0x05940564,0x065c05ec,0x072006c4,0x07970765,0x07dc07bc,
0x082707ff,0x08870857,0x091508c5,0x09a70969,0x09da09d6,0x09da09d5,0x0a4409fe,0x0ae10a98,
0x0b2e0b14,0x0b110b2d,0x0ab00ae3,0x0a730a88,0x0aa10a7d,0x0b270ae0,0x0bb00b71,0x0c100be5,
0x0c470c37,0x0bda0c24,0x0b260b77,0x0b410b11,0x0c660bbb,0x0da50d12,0x0dfd0dfa,0x0d620dbd,
0x0ceb0d12,0x0cf80ce5,0x0d350d0a,0x0dc10d6e,0x0e540e0f,0x0e870e77,0x0e6e0e86,0x0db30e27,
0x0c990d22,0x0c360c49,0x0d0c0c80,0x0e780dc9,0x0f3e0efd,0x0f2d0f4f,0x0e4e0ed8,0x0d1c0da9,
0x0c860cb4,0x0c990c80,0x0d330cd0,0x0e5b0dc0,0x0f1c0edc,0x0edc0f15,0x0e340e8b,0x0d6b0dd1,
0x0cd20d0c,0x0d000cd2,0x0e040d71,0x0f570eb8,0x0fe20fc8,0x0f470fb5,0x0e310ec6,0x0d7d0dc2,
0x0db80d80,0x0ec80e31,0x101b0f6f,0x111710b2,0x1136113f,0x10cf1102,0x10a910ab,0x10ef10c2,
0x1141111e,0x1167115a,0x119c1177,0x125e11eb,0x137f12f5,0x142113f0,0x13e0141b,0x136813a6,
0x13331342,0x1362134b,0x137b1376,0x1373137b,0x138c137e,0x13d813b1,0x13fc13f7,0x139d13d4,
0x13421365,0x13421336,0x1388135e,0x141113c3,0x150e1487,0x164415b3,0x170c16bc,0x175c1743,
0x17411755,0x17521737,0x1807179a,0x190e1886,0x1a6119a3,0x1c231b38,0x1daf1cf9,0x1e9b1e32,
0x1fba1f21,0x218c209a,0x240222c0,0x26a62556,0x294a280c,0x2c4e2abe,0x30172e0e,0x34603230,
0x37aa3627,0x39f238cf,0x3c4b3af7,0x3eb43d79,0x40a63fbf,0x41d34163,0x4245421a,0x42ea4285,
0x444d439e,0x454f44f9,0x45c2458c,0x46dd4625,0x490d47df,0x4b354a30,0x4ca34bf7,0x4dcb4d35,
0x4f324e72,0x515b502f,0x543752da,0x563a5572,0x570a56c0,0x57c75755,0x58b1584a,0x58d758f7,
0x56ab57f8,0x5217548a,0x4c3f4f36,0x46244940,0x3f1442c2,0x35833aa3,0x299f2fc7,0x1d4b2376,
0x122e1796,0x085f0d30,0xff3203e0,0xf60bfaa3,0xed14f179,0xe55fe8f5,0xdf64e22b,0xda9adce9,
0xd614d846,0xd1ead3e9,0xce91d022,0xcbcbcd23,0xc8f8ca5f,0xc5a6c75f,0xc1efc3d7,0xbe54c01e,
0xbb5abcd5,0xb86bb9ec,0xb55bb70b,0xb230b3c0,0xaf82b0c0,0xad9dae6c,0xaca8ad0d,0xaca1ac8c,
0xad3cacca,0xae8dadc8,0xb07faf72,0xb31ab1bd,0xb625b4a9,0xb934b7b0,0xbc00ba99,0xbe90bd50,
0xc0eabfbf,0xc375c227,0xc618c4b8,0xc885c75b,0xca9dc99b,0xccebcbb2,0xcfd6ce4b,0xd2c5d155,
0xd5bed442,0xd91bd768,0xdcbddaec,0xe089de9a,0xe467e298,0xe818e645,0xeba6e9cb,0xef20ed65,
0xf22df0b7,0xf4e4f394,0xf75bf618,0xf991f87c,0xfb63fa91,0xfca8fc1d,0xfd8dfd21,0xfe55fde7,
0xff5dfecf,0x007dffed,0x012800e8,0x015e014f,0x01890175,0x01cd01ac,0x021f01f6,0x02b00260,
0x03990316,0x049a041d,0x051304ef,0x04ad04f3,0x04080455,0x03d703dd,0x04650408,0x054004cd,
0x060605b3,0x0626062d,0x058a05e9,0x04b3051f,0x04210454,0x0442041a,0x04f50491,0x05ba0558,
0x062305fd,0x06010626,0x057a05c9,0x04cb0522,0x04750489,0x04c20483,0x0584051f,0x063905e9,
0x0670066e,0x05d9063e,0x04d9055b,0x03f70460,0x037b03a5,0x03bc037f,0x048c0421,0x051f04eb,
0x04e10517,0x03e90471,0x02e8035e,0x02770299,0x02b10288,0x031a02ea,0x03340331,0x03060320,
0x028e02de,0x01a70222,0x00f70139,0x00c800d6,0x00a200bb,0x009b009c,0x00b400aa,0x00a800b7,
0x00520086,0xffda0015,0xff59ff9b,0xfefdff1e,0xfefafef0,0xff2dff1a,0xff75ff4e,0x000fffb9,
0x00c4007a,0x00df00eb,0x007700bd,0xffdd0021,0xff9dffab,0xffefffb9,0x009a0046,0x00f600cb,
0x01710123,0x026101e4,0x02e902bf,0x027e02cd,0x01ca021f,0x01b301a1,0x024e01ee,0x02f802aa,
0x03470334,0x03130337,0x02af02de,0x024d027f,0x01da0216,0x0170019f,0x015d0154,0x01c00188,
0x022d01ff,0x023c023e,0x020c0222,0x0227020a,0x02b60268,0x033f0303,0x036f035b,0x038d0374,
0x044403d9,0x057804d3,0x064505f1,0x06590662,0x0649064d,0x06e10672,0x08410773,0x0a140930,
0x0bb60af7,0x0d2d0c77,0x0f0f0dee,0x11cc1052,0x151d137d,0x184816bb,0x1b2e19a9,0x1e031c86,
0x21501fbd,0x249b230a,0x26ed25d4,0x283f27a8,0x294828da,0x2add29fe,0x2cbb2bb7,0x2e262d8e,
0x2ed42ea5,0x2f632f1a,0x30412fab,0x319730dc,0x3384328b,0x35d734a1,0x38533700,0x3af4399e,
0x3d9f3c5c,0x3fcb3ec2,0x418440ac,0x4347426f,0x455f443d,0x47514651,0x48f1483a,0x4a0b499b,
0x4a2e4a34,0x48f2499e,0x467947ff,0x42c644d6,0x3db9405c,0x36d13a7e,0x2dca32a6,0x23bf28f3,
0x194d1e58,0x0f3c141d,0x060d0aa5,0xfd6701bd,0xf520f917,0xed0af0fb,0xe588e94c,0xdeede21d,
0xd94adbec,0xd48ad6c7,0xd03ad277,0xcbd5ce1e,0xc6f7c962,0xc1d0c45b,0xbc76bf3a,0xb76eba13,
0xb24cb4c0,0xad2eafa4,0xa86aaad6,0xa3fca63e,0xa056a1eb,0x9d739ea0,0x9c219cb7,0x9c6f9c29,
0x9dac9ce0,0x9f6a9e7b,0xa1a0a089,0xa462a2ee,0xa75ca5d0,0xaa5fa8e7,0xad85abf4,0xb080aef5,
0xb36fb200,0xb63eb4ea,0xb8bfb781,0xbb2eb9ec,0xbdcfbc7c,0xc101bf66,0xc464c2ab,0xc78bc5f8,
0xca9bc91c,0xcdd2cc43,0xd187cf80,0xd5f1d39a,0xdaa4d859,0xdee5dce6,0xe25fe0b4,0xe4f8e39e,
0xe797e64e,0xead0e934,0xee25ec74,0xf100ef9b,0xf349f242,0xf553f468,0xf696f60a,0xf72df6eb,
0xf7c3f770,0xf8c7f839,0xfa39f970,0xfbcefb03,0xfd04fc7d,0xfd58fd46,0xfd32fd4a,0xfd3bfd23,
0xfdc7fd6b,0xfee8fe4a,0x003dff92,0x014e00da,0x01ce019d,0x01ce01e7,0x01480197,0x00bc00f4,
0x00ef00bd,0x01d80157,0x02f80266,0x03c80370,0x03fb03f8,0x03a203d9,0x03440369,0x0344033a,
0x0383035f,0x03e303ab,0x046e042a,0x050504c1,0x0534052a,0x04fb0523,0x04c404d6,0x04e304c7,
0x05170504,0x050a051c,0x04df04ef,0x04f604e1,0x05600529,0x05ac0592,0x057405a3,0x05060538,
0x04f404eb,0x05440515,0x05860568,0x05760585,0x0545055d,0x0515052c,0x04d304f9,0x047904aa,
0x0426044c,0x04190418,0x04590430,0x04730471,0x04280463,0x038903d8,0x02ef0337,0x029702c0,
0x026a027a,0x028f0270,0x033102d0,0x040e039f,0x049c0466,0x047c04a6,0x03b10425,0x02e7033f,
0x02e302c7,0x0391032a,0x046d0405,0x04ea04b9,0x04ff04fe,0x04fb04f7,0x05460515,0x059e0575,
0x05a705af,0x05980598,0x060105bd,0x06cf0666,0x07480723,0x0707073e,0x066506b4,0x062d0635,
0x069f0656,0x071906eb,0x06d70715,0x06090677,0x057505ac,0x05760567,0x05b2059f,0x058505aa,
0x05230554,0x051c050a,0x05a50550,0x06560600,0x069d068a,0x069606a1,0x069f0692,0x06e006bc,
0x074e0716,0x07e0078f,0x08930837,0x093d08ec,0x09ad097f,0x0a0f09d5,0x0ade0a64,0x0c500b7d,
0x0e670d53,0x10960f77,0x12cb11b4,0x154913f6,0x180516a9,0x1aeb1972,0x1d9f1c4f,0x20791f02,
0x237c21ee,0x26b7252d,0x29772820,0x2b822aa5,0x2cc02c29,0x2d8e2d31,0x2e972e05,0x2faf2f1d,
0x30f6305a,0x31ca316a,0x32463212,0x32bd326d,0x33d43334,0x35da34ba,0x3857371b,0x3aca3997,
0x3ccc3bda,0x3ea13db7,0x408f3f92,0x42bb419d,0x452e43eb,0x48074689,0x4af74983,0x4dac4c69,
0x4f5d4ea1,0x50084fdd,0x4f694fd9,0x4dc84ebf,0x4b4f4ca2,0x47584995,0x419944ac,0x39fe3e02,
0x312135b1,0x27c82c67,0x1f212361,0x17471b19,0x0fea1394,0x08bd0c48,0x019b052f,0xfa93fe0b,
0xf3ddf71e,0xee2df0e3,0xe96eebb4,0xe531e757,0xe05ce2e3,0xd9cddd57,0xd230d60b,0xcaaace5e,
0xc3f9c739,0xbddcc0c4,0xb832bb1d,0xb26bb53a,0xad26afbe,0xa8faaacd,0xa68ca798,0xa5b8a5fd,
0xa5c4a5a5,0xa6b3a628,0xa7f8a752,0xa95fa8a6,0xaacaaa0d,0xaccaabb1,0xafa6ae1f,0xb30eb153,
0xb629b4b3,0xb853b760,0xb98db900,0xbaceba21,0xbd07bbbd,0xc088beaa,0xc4c0c297,0xc8c1c6c9,
0xcc66caa5,0xcf60cdf4,0xd23dd0ca,0xd57dd3c0,0xd961d75e,0xde12db9f,0xe2e4e085,0xe731e520,
0xea6ce8f3,0xeccaebb4,0xeebcedc4,0xf0b5efbe,0xf2d8f1ba,0xf581f41f,0xf861f6f3,0xfabcf9ac,
0xfbfefb83,0xfc2efc2f,0xfc20fc1d,0xfcaefc4b,0xfdfcfd45,0xff83fec3,0x00cc002c,0x01ba0148,
0x025d0212,0x02b10293,0x02ce02bd,0x030202e4,0x037a032c,0x045203e1,0x054204cb,0x05d8059b,
0x06270607,0x06550643,0x065d065d,0x06470651,0x065f0649,0x06d60691,0x07810725,0x081807d6,
0x082d0832,0x07b30800,0x0721075f,0x07200710,0x07990752,0x081407de,0x08430830,0x084f0848,
0x08690857,0x086b0872,0x080a0845,0x076507b7,0x071e0729,0x07aa0747,0x08990827,0x08e608de,
0x084108b3,0x073007b1,0x06a706d1,0x06d606aa,0x07330708,0x07370742,0x06f30717,0x06c506dd,
0x067906a7,0x05b20628,0x04760515,0x039903f0,0x03a5037f,0x045803f7,0x04c9049f,0x049004bf,
0x03ff0446,0x03a803c8,0x03a903a4,0x03aa03ab,0x03850395,0x037c0377,0x03ab0395,0x03c503bb,
0x03e103d8,0x040903f2,0x04590432,0x049a0479,0x04c604b2,0x04f504d9,0x0556051e,0x05ac0588,
0x05cc05bf,0x05ee05dd,0x0659061b,0x06f206a8,0x07600733,0x07490762,0x06dc0718,0x067406a0,
0x0652065f,0x0643064b,0x06270637,0x0609061b,0x05d605f1,0x05be05c1,0x05f005cf,0x0625060f,
0x061f062d,0x05cd05fc,0x0564059a,0x0523053b,0x056b0532,0x061405c4,0x06760656,0x06570671,
0x0607062c,0x061d05fd,0x06dc0669,0x07de075d,0x08920849,0x091008ce,0x09d70967,0x0b100a63,
0x0cbc0bd3,0x0ea60db3,0x10900f97,0x129b118f,0x14fb13bd,0x17b01653,0x1a591910,0x1cc01b8c,
0x1f821e12,0x226620f8,0x251923cf,0x27282639,0x287c27d9,0x29b32913,0x2ad42a4a,0x2bde2b5c,
0x2cb42c51,0x2d332d03,0x2d8b2d5d,0x2e0f2dca,0x2ebf2e62,0x2fbc2f33,0x314b306f,0x3370324c,
0x35ec34af,0x3807370a,0x39c238ef,0x3b893a9f,0x3df03ca3,0x41273f77,0x44b442ea,0x48284680,
0x4acc499f,0x4c704bbe,0x4d144ce8,0x4cb84cff,0x4b7e4c3b,0x49404a82,0x45cf47ae,0x40f34396,
0x3a1f3dc4,0x31d5361c,0x29142d6d,0x212024ef,0x1a721da7,0x1447175d,0x0e0c1132,0x079f0add,
0x015d0470,0xfbb6fe6a,0xf6aef922,0xf1cef43f,0xec7aef44,0xe5bae957,0xdd1ee193,0xd3d5d87e,
0xcad7cf36,0xc371c6eb,0xbd47c041,0xb744ba46,0xb1c3b47a,0xac14aef2,0xa73ca971,0xa404a56f,
0xa2a0a315,0xa361a2c1,0xa555a447,0xa789a67a,0xa8dca861,0xa90fa908,0xa94ea91e,0xaaa6a9c7,
0xadababfa,0xb17baf8b,0xb4e3b348,0xb744b633,0xb8ccb817,0xba5bb989,0xbc84bb56,0xbfb4bdfa,
0xc3f5c1b3,0xc8b1c655,0xcd37cafb,0xd109cf40,0xd409d29c,0xd6ebd56c,0xda30d886,0xddbedbeb,
0xe18ddfa9,0xe4eee34d,0xe810e687,0xeae2e98b,0xed0cec0a,0xeea8edeb,0xefc8ef41,0xf103f058,
0xf2c4f1d2,0xf4c3f3c8,0xf65cf5a8,0xf708f6c9,0xf74ef728,0xf7e3f789,0xf8e3f859,0xf9e7f96a,
0xfa92fa49,0xfb1dfad3,0xfc06fb86,0xfd4dfca5,0xfe34fdd4,0xfe6bfe64,0xfe46fe59,0xfe6cfe47,
0xff23feb8,0x0014ff9e,0x00da008c,0x0130010f,0x014f0145,0x01300147,0x00ef010f,0x00e000de,
0x014b0106,0x021e01ac,0x030f0298,0x03bc0378,0x03c203d4,0x0342038f,0x028202e0,0x020a0235,
0x0249020e,0x034202bf,0x042c03c4,0x0489046c,0x0464047d,0x0415043c,0x03c703f0,0x0370039d,
0x03130340,0x030302f8,0x03790334,0x041303cc,0x0436043b,0x03c4040e,0x03040367,0x024a02a5,
0x01d10205,0x018901a8,0x015b0175,0x01380148,0x0127012d,0x011a0127,0x00df0106,0x008c00b5,
0x003d0067,0x000b0024,0xffc5ffed,0xff89ffa1,0xff8eff84,0xffb2ffa4,0xffbaffb7,0xff9bffae,
0xff69ff83,0xff5aff5b,0xff9fff6a,0x0032ffe5,0x009b0076,0x009c00a7,0x007e008a,0x00aa0085,
0x013800e8,0x01bf0185,0x01f101e2,0x01e401f1,0x01b901d2,0x015d0197,0x00cf011d,0x002e0082,
0xfff60000,0x0059000c,0x011b00be,0x0197016b,0x017f01a3,0x00f00140,0x0049009f,0xffd7ffff,
0xffbfffc4,0xffcaffc2,0xffd3ffd4,0xffafffca,0xff51ff85,0xfedeff16,0xfebcfec3,0xfeeefecd,
0xff68ff24,0x0011ffbd,0x00da007b,0x018f0136,0x025d01f0,0x034602cf,0x042d03bc,0x053704a5,
0x06b105e6,0x08710789,0x0a750969,0x0c8a0b88,0x0e510d78,0x10110f2e,0x120410ff,0x147c132d,
0x174915db,0x1a1c18b4,0x1d331b9e,0x203e1ec2,0x22c82190,0x249523ca,0x2595252f,0x265625ea,
0x277126dd,0x28a3280b,0x299f2930,0x2a0f29ea,0x2a052a0d,0x2a0629fe,0x2a302a12,0x2af12a7b,
0x2c7b2b9d,0x2ec42d8b,0x3153300e,0x33983285,0x3581348f,0x37a33683,0x3a8238f5,0x3e1a3c3e,
0x41d53ffe,0x45334399,0x47ce469d,0x497848c0,0x4a2649f9,0x499d4a04,0x48394908,0x46064737,
0x42be448e,0x3dd94089,0x36c43a93,0x2e8232a6,0x26e12a88,0x20cc239b,0x1c441e65,0x180c1a34,
0x131615b0,0x0d071033,0x063609ad,0xff3802b8,0xf8affbe6,0xf280f594,0xebeaef54,0xe3dee81a,
0xd9cadf13,0xcf2fd478,0xc486c9d1,0xbbacbfb8,0xb56eb852,0xb085b2e0,0xacb5ae74,0xa8e2aae9,
0xa50ca6ce,0xa28da3a9,0xa157a1c0,0xa1f9a171,0xa3a2a2bd,0xa5caa4a5,0xa7e6a6ee,0xa940a8ab,
0xaa34a9c0,0xab24aa9a,0xad0eabf0,0xb013ae77,0xb3b1b1dd,0xb72db57b,0xba22b8b9,0xbd05bb8b,
0xc058be9c,0xc431c230,0xc88fc652,0xccf6cad2,0xd0f1cef4,0xd4fbd2f7,0xd8ded6ed,0xdce0dadc,
0xe0b9deda,0xe3c6e258,0xe675e527,0xe8e3e7b0,0xeb73ea25,0xee0eecc6,0xf030ef32,0xf219f121,
0xf3f5f30e,0xf58bf4ce,0xf68af621,0xf708f6d5,0xf79ef747,0xf8cff820,0xfaaef9ac,0xfcb8fbbe,
0xfe06fd81,0xfe5dfe4a,0xfe4bfe59,0xfe57fe47,0xfec8fe80,0xffa9ff2b,0x00f7004b,0x025a01ab,
0x034f02eb,0x03570374,0x02990307,0x01dc022f,0x01c401b7,0x02780205,0x03c20313,0x05020470,
0x05940563,0x05640595,0x04bb0519,0x03f80455,0x038903b1,0x03cb0393,0x049d0425,0x0586051b,
0x05fb05d8,0x05d705f8,0x057505a7,0x0524054a,0x04d704fd,0x04a704b6,0x04c704ab,0x053504fb,
0x05b6057c,0x05d405d9,0x055205a7,0x049904f1,0x04380453,0x0452043d,0x04920471,0x04c704aa,
0x04c404cf,0x046504a1,0x03d4041d,0x035b0390,0x03240332,0x03370322,0x03800359,0x03b203a4,
0x038403a5,0x03130352,0x027b02c8,0x01f20234,0x01b701c5,0x020e01d0,0x02d3026b,0x0399033c,
0x03fd03df,0x03d503f8,0x03590399,0x03070323,0x03570314,0x043e03bd,0x054304c6,0x05d905a5,
0x05c005e3,0x053e0586,0x04b104f3,0x04430474,0x040d041c,0x045c0420,0x052704b7,0x05e00593,
0x05ec0605,0x054405a8,0x048504da,0x04510455,0x04b40474,0x051a04f3,0x04ff0521,0x047504c3,
0x03e10426,0x0357039f,0x02b60309,0x0204025d,0x019e01c2,0x01a00194,0x01e701c4,0x020c0204,
0x01ec0200,0x01e501dc,0x02440201,0x031702a2,0x042b0395,0x058e04d5,0x0709064c,0x085907bf,
0x093308d8,0x09a4096e,0x0a6d09f7,0x0bd50b0a,0x0de60ccc,0x10230f04,0x12331130,0x1454133d,
0x16761567,0x18b01790,0x1b0b19d8,0x1d951c4a,0x20661ef2,0x235f21e9,0x25ea24b3,0x27b426ec,
0x28aa284c,0x290128da,0x29522926,0x29b22981,0x2a1529e6,0x2a232a2d,0x29a529ee,0x291d2958,
0x290e2900,0x29f5295f,0x2bcd2ac9,0x2e2c2cf1,0x30b62f74,0x331531eb,0x35503434,0x3792366f,
0x3a4c38d8,0x3dde3bfb,0x41f13fdd,0x45d843f9,0x48c3477a,0x4a2c49ab,0x4a324a53,0x494149cf,
0x47da489c,0x45d746f6,0x42e7447d,0x3ece4104,0x39443c35,0x32ce3615,0x2c712f90,0x26f42994,
0x22692494,0x1e53205a,0x19eb1c3b,0x143f1745,0x0d3210e2,0x05030933,0xfcc500d3,0xf4cef8d0,
0xec82f0b7,0xe332e80b,0xd89dde10,0xce4bd347,0xc4d6c987,0xbcacc073,0xb698b979,0xb17bb3ea,
0xadbdaf69,0xab16ac63,0xa8cba9d1,0xa755a7fa,0xa648a6b6,0xa651a626,0xa734a6b6,0xa864a7c6,
0xa995a905,0xaabeaa1f,0xac72ab82,0xaed4ad8d,0xb1cab03a,0xb4d7b358,0xb78fb643,0xba1ab8d4,
0xbcfebb7b,0xc095beaa,0xc51cc2c5,0xca0fc78d,0xcf24cca1,0xd3a7d184,0xd6ffd572,0xd9b9d866,
0xdc31daf5,0xdf2bdd90,0xe2fae0ff,0xe6dfe4f5,0xea4ee8ac,0xec9ceba0,0xedcfed4c,0xee6bee2d,
0xef19eeb3,0xf0a4efba,0xf356f1df,0xf66cf4e1,0xf8f7f7d5,0xfa25f9c1,0xfa11fa39,0xf9a8f9da,
0xf9c7f9a0,0xfaddfa31,0xfcbdfbb8,0xfeebfdd8,0x00beffea,0x01800143,0x01390174,0x008a00e6,
0x0004002d,0x0084001f,0x01b7010c,0x0323026f,0x043103bf,0x04a10482,0x045b0498,0x03aa0406,
0x0322035a,0x033e0317,0x0400038f,0x050e0484,0x05cc0580,0x05cc05e4,0x05230584,0x047604c6,
0x043a0448,0x046a0446,0x04cd049a,0x052b04fe,0x0568054f,0x0554056b,0x04c5051e,0x03d80454,
0x031a0367,0x032002fe,0x03e50373,0x04b4045a,0x04c404db,0x04090479,0x03010382,0x02410290,
0x02040215,0x02280211,0x0280024e,0x02ee02b6,0x03130313,0x028602e8,0x013101ee,0xff950059,
0xfec3ff0c,0xfef2fec0,0xffc7ff54,0x0098003c,0x00d800c7,0x00be00d4,0x006c0096,0x00110034,
0xffdafff1,0xfffcffdb,0x009a0041,0x012500e3,0x01760157,0x0170017c,0x0149015c,0x0129013c,
0x01250124,0x014c0133,0x01a30173,0x020a01dc,0x02320229,0x02200231,0x021f0216,0x02570234,
0x02bb0287,0x030b02e7,0x030c0314,0x02c802f4,0x027b029e,0x022c024f,0x01df0202,0x01a401bc,
0x016e018c,0x011d0143,0x00c700f6,0x0076009f,0xfff90036,0xff79ffbc,0xfefeff39,0xfebbfed7,
0xfeecfec0,0xffb9ff40,0x00ea004f,0x01ea016e,0x029e024a,0x033602e9,0x03f00384,0x050e0475,
0x065105b2,0x077206e5,0x08a20807,0x09d50939,0x0b290a79,0x0ca50be7,0x0e360d65,0x0ff70f11,
0x11e610e9,0x143012fc,0x16ad1571,0x190a17de,0x1b6b1a34,0x1e151cba,0x20bc1f6a,0x232f2205,
0x24eb2427,0x260d258e,0x26a5266b,0x26b626be,0x2674269c,0x25ea2638,0x25442596,0x24b524fa,
0x24552480,0x242d243c,0x2471243e,0x257824da,0x2753264b,0x29aa2879,0x2c052add,0x2e2c2d1b,
0x305b2f3d,0x32ef3193,0x3613346f,0x39d937e6,0x3db53bcc,0x41283f81,0x43b44296,0x450e4485,
0x455a4553,0x44de4531,0x43e5446e,0x426a433c,0x401a4168,0x3c8f3e89,0x379e3a38,0x320634d0,
0x2cab2f4b,0x27ef2a3f,0x237f25b7,0x1ebc212c,0x19511c21,0x12ef163b,0x0ba60f6b,0x036307ae,
0xfa81fee5,0xf16af612,0xe753ec7c,0xdc94e20b,0xd18dd707,0xc74acc25,0xbf56c31a,0xb8e9bbe7,
0xb443b66c,0xb022b232,0xac33ae21,0xa8baaa6a,0xa5bda720,0xa41aa4b7,0xa416a3e2,0xa59ea4b0,
0xa7c6a6b2,0xa94fa8ac,0xa9dca9b1,0xa9fca9e7,0xaae1aa41,0xad68abf3,0xb15baf39,0xb60fb3ae,
0xba92b866,0xbe65bc95,0xc195c00d,0xc452c2f4,0xc792c5d1,0xcbd4c990,0xd0f5ce4d,0xd644d3a7,
0xda7ed897,0xdd51dc0c,0xdf1ede57,0xe097dfd4,0xe298e182,0xe535e3d4,0xe84be6b8,0xeb83e9ed,
0xee35ecf4,0xeff1ef37,0xf0bbf070,0xf10af0e1,0xf1e2f15b,0xf39ef2a2,0xf602f4c4,0xf82ef730,
0xf97ff8f5,0xfa2af9e1,0xfa9dfa65,0xfb13fad7,0xfba2fb55,0xfc53fbf5,0xfd4dfcc1,0xfea2fdf3,
0xffe5ff53,0x0092005a,0x00720094,0xffff002d,0xfffaffec,0x009d0034,0x01970110,0x029a021c,
0x0366030a,0x03c903a2,0x039f03c3,0x0316035f,0x02a702d3,0x02b60299,0x035a02f7,0x045203d0,
0x051e04c5,0x054b054a,0x04c6051e,0x03bf044c,0x02d50339,0x029d029d,0x033f02db,0x042b03b9,
0x04e50490,0x052c0519,0x04ee051a,0x044904a5,0x036903df,0x02ba0302,0x02b3029b,0x036202fa,
0x044103d9,0x049f0486,0x04480488,0x036103e1,0x024102d1,0x015801c2,0x00e5010e,0x00ee00dc,
0x014f0117,0x01d60195,0x02210209,0x020a021f,0x01b501e2,0x01660188,0x012e0147,0x010f0117,
0x0138011b,0x01940161,0x01e801c2,0x01fc01fc,0x01d101ee,0x018101ac,0x01580163,0x01940168,
0x020101c8,0x02580235,0x0265026b,0x02520261,0x02600251,0x029b027b,0x02d602ba,0x030902f2,
0x03390323,0x034f034a,0x0316033f,0x027702d0,0x01a60210,0x010c014e,0x00e700eb,0x011c00fd,
0x0131012f,0x00ec011d,0x003300a0,0xff52ffc3,0xfe84fee1,0xfe0afe39,0xfe01fdf7,0xfe58fe1e,
0xfed2fe92,0xff2eff03,0xff6fff4e,0xffb4ff91,0x001cffdf,0x00e3007a,0x01f20160,0x03470298,
0x04a303fa,0x05e80548,0x06f7067a,0x07b7075e,0x088a0817,0x09b50915,0x0b460a71,0x0d4e0c3f,
0x0f770e64,0x118a1082,0x137f1286,0x156f146f,0x17ab1688,0x1a0718d8,0x1ca81b4e,0x1f8f1e18,
0x223620f7,0x243e2353,0x253724e2,0x25292547,0x24b324ee,0x24442479,0x2401241d,0x23c823e5,
0x237423a4,0x230f2347,0x229522d2,0x222f2257,0x22452220,0x234a22a8,0x254c242d,0x27eb2690,
0x2a912944,0x2cff2bca,0x2f652e2c,0x320330a6,0x3505337a,0x386836a8,0x3c143a3e,0x3fa43de1,
0x42c14147,0x44db43f4,0x45eb457c,0x461a461a,0x45a245ed,0x447d452c,0x42154378,0x3e1f4049,
0x38ed3ba1,0x3388362d,0x2eba3111,0x2a7c2c8b,0x2666287a,0x21852417,0x1b641ea2,0x13c317c0,
0x0ae80f73,0x01660637,0xf7b7fc7d,0xeeaef32c,0xe534ea08,0xdb7ee05a,0xd182d68b,0xc75dcc62,
0xbf39c2f5,0xb8cabbdc,0xb43eb637,0xb126b2a4,0xae39afaa,0xabcfacf3,0xa968aaa5,0xa763a844,
0xa658a6c4,0xa65da62b,0xa7dda6f1,0xaa3fa903,0xacd2ab8a,0xaf0eadfd,0xb0fbb004,0xb342b20c,
0xb631b4a4,0xb9ecb7f2,0xbe31bc07,0xc2a2c064,0xc728c4e6,0xcb40c94f,0xceddcd11,0xd24ad0a0,
0xd56ad3dd,0xd8c0d70d,0xdc48da86,0xdfbbddff,0xe32ce184,0xe5ede4a5,0xe806e70c,0xe9a7e8e1,
0xeb1eea5d,0xecfaebfd,0xef15ee07,0xf148f028,0xf396f26c,0xf5baf4b7,0xf762f6a3,0xf852f7f3,
0xf8b8f88d,0xf934f8ed,0xfa33f99f,0xfbcefaec,0xfdb6fcc9,0xff1efe81,0xffd9ff8e,0xfffffffd,
0xffdefff4,0xffd9ffd3,0x004efff9,0x017400d2,0x0314023d,0x048c03e7,0x052704fa,0x04d3051a,
0x03f5046c,0x03330384,0x03230310,0x04020377,0x056304ab,0x06a50616,0x0735070d,0x06d90728,
0x05af0657,0x045e04fc,0x03a103e4,0x03e303a5,0x04e20453,0x0609057a,0x06cf067e,0x06f306f7,
0x066c06c6,0x056305f1,0x046c04da,0x040c0422,0x046d0425,0x053c04d5,0x05d30596,0x05a505d6,
0x04eb0557,0x04050478,0x033f0398,0x02e40306,0x030702e6,0x03670338,0x03a80392,0x038d03a5,
0x03240361,0x029802de,0x0231025f,0x0225021f,0x02580237,0x0299027a,0x02b202af,0x027d02a6,
0x01f90241,0x017f01b5,0x0170016c,0x01d80199,0x0280022d,0x030802ce,0x0312031c,0x02ab02e8,
0x02270263,0x01fe0200,0x02670222,0x033002c3,0x040303a2,0x04800451,0x049d049b,0x043b047a,
0x037503e0,0x02b1030b,0x02620278,0x02b2027a,0x031c02eb,0x03270331,0x029502ec,0x01ae0221,
0x00ee0147,0x007b00ac,0x001c0043,0xffe60002,0xffcbffcf,0xffd4ffcd,0xffc1ffd3,0xff5eff9b,
0xfed8ff18,0xfe98fea9,0xfee0fead,0xff8cff31,0x0056ffed,0x00f300b0,0x017f0137,0x021801cc,
0x02c6026b,0x03aa032b,0x04ee0443,0x067105aa,0x07f00738,0x0904088a,0x09d4096d,0x0ac50a47,
0x0c0e0b56,0x0de30ce8,0x0ff40ee5,0x1239110f,0x14a8136e,0x16e115d0,0x18d717df,0x1a8f19be,
0x1c361b5b,0x1e1f1d24,0x200b1f1b,0x21a520e8,0x22a72246,0x22c222cf,0x2244228f,0x217821e1,
0x20b12113,0x20012057,0x1f541fae,0x1ea81efc,0x1e301e61,0x1e371e1e,0x1ef31e7b,0x205a1f94,
0x22442145,0x24822362,0x26d625a7,0x29342804,0x2b902a5c,0x2e672ce9,0x31fe301c,0x365a3416,
0x3b0438b6,0x3f4d3d3f,0x42a9411e,0x44cc43dd,0x45f8457c,0x4650463f,0x45e0462e,0x44a54562,
0x425943a4,0x3ed940bf,0x3a3a3caa,0x350d37a5,0x2ff93282,0x2b112d7b,0x266f28c4,0x213523f5,
0x1ae91e38,0x13101737,0x09d40e8e,0xfff904f5,0xf5cafae5,0xec2bf0e4,0xe24ce753,0xd8afdd59,
0xcfded442,0xc74ccb89,0xc013c372,0xb9e3bcf5,0xb47fb6fb,0xb08fb26d,0xad4caece,0xab01ac01,
0xa961aa2d,0xa843a8b5,0xa833a821,0xa8bca864,0xa9e7a940,0xab77aaa5,0xad84ac61,0xb045aed0,
0xb394b1dd,0xb758b56d,0xbb06b93f,0xbe54bcb0,0xc185bff0,0xc4cdc31e,0xc8a1c6a7,0xccd1cab2,
0xd115ceed,0xd572d350,0xd8f9d757,0xdbb2da6e,0xdda4dcbf,0xdf24de64,0xe11ce006,0xe3c0e25b,
0xe6f6e548,0xea41e8a4,0xecf5ebb4,0xeec0edf6,0xef95ef48,0xefecefbe,0xf0c3f03e,0xf27bf17e,
0xf4ebf3a2,0xf769f635,0xf922f867,0xf9e3f9a0,0xf9f0f9f7,0xf9bbf9cf,0xf9f8f9c4,0xfaf1fa5c,
0xfcbafbbe,0xfed5fdca,0x0083ffbe,0x01440107,0x011d0148,0x007f00d0,0x001a0036,0x0076002e,
0x017400e0,0x02d10220,0x040d0380,0x049f0473,0x045c0495,0x039b0402,0x02ea0338,0x02c902c5,
0x035402fc,0x043c03c7,0x04fe04ab,0x05540535,0x054a0558,0x04fd0529,0x049804c9,0x0450046a,
0x0458044a,0x04bb0484,0x051504ee,0x05060522,0x047204cb,0x03b70412,0x034b0370,0x0364034a,
0x03b5038c,0x03e503d7,0x03c403dd,0x037003a1,0x0303033b,0x028a02c6,0x02290252,0x0224021c,
0x02860249,0x02f802c5,0x02f8030c,0x024802b7,0x013301c0,0x004100b0,0xffe6fffa,0x0011fff1,
0x00970052,0x011c00d6,0x017d0151,0x018e0191,0x012e016e,0x009700e0,0x001d004e,0x002d0013,
0x00aa006d,0x014900f6,0x01e9019f,0x024e0226,0x0266026a,0x0225024d,0x01c501f5,0x0181019d,
0x0166016e,0x014f015b,0x013e0144,0x01380139,0x01330137,0x01120126,0x00b600e8,0x001b0073,
0xff9cffdd,0xff32ff5d,0xfefaff11,0xfed7fee6,0xfedcfed5,0xfee6fee2,0xfee5fee5,0xfeeafee4,
0xfeeefeec,0xfedafee4,0xfeaffec8,0xfe8cfe9c,0xfe83fe80,0xfee1fea4,0xffbdff41,0x00fb005b,
0x021f018f,0x032a02ab,0x0414039d,0x050e048b,0x0638059e,0x075606c6,0x088a07ea,0x09db092c,
0x0b5e0a95,0x0d100c32,0x0eac0de1,0x104a0f7c,0x11cb1110,0x135a1289,0x1529143f,0x16f51613,
0x18b617d6,0x1a88199a,0x1c731b7b,0x1e4b1d62,0x1fc81f1b,0x209b2041,0x20ea20d3,0x20aa20da,
0x2001205e,0x1f151f93,0x1dfb1e8c,0x1cdb1d68,0x1bdd1c55,0x1b161b71,0x1a9b1ad1,0x1a9a1a83,
0x1b5a1add,0x1cd81c04,0x1edb1dd0,0x20ff1fed,0x2326220f,0x258e2450,0x286d26ea,0x2c062a20,
0x30582e19,0x353532bb,0x3a0c37ab,0x3e523c4d,0x41a1401b,0x43b442ce,0x44c64454,0x44ff44fd,
0x447944ce,0x432643ed,0x40aa4210,0x3cf63ef2,0x38683ac4,0x336035ea,0x2e5130de,0x291d2bc0,
0x23a82670,0x1da220c3,0x16f21a5a,0x0f63134c,0x06e40b3d,0xfdd40271,0xf43ef924,0xea56ef3c,
0xe068e571,0xd673db4d,0xcdc6d1fa,0xc61bc9c8,0xbfeec2ca,0xbb37bd7f,0xb6edb8ff,0xb347b50c,
0xafa9b176,0xac91ae06,0xaa8bab64,0xa9f1aa07,0xab14aa52,0xad34ac18,0xaf8aae60,0xb193b0a2,
0xb347b26f,0xb534b42e,0xb7bfb65e,0xbb33b95a,0xbf6dbd41,0xc3ddc1a0,0xc831c615,0xcbcaca17,
0xceb5cd51,0xd141cff8,0xd3e1d287,0xd72ed570,0xdae3d902,0xde9cdcc5,0xe1e1e050,0xe461e33d,
0xe632e558,0xe798e6f0,0xe8f3e83e,0xeab2e9c4,0xecf9ebc9,0xef78ee37,0xf1c7f0b1,0xf361f2ad,
0xf459f3f0,0xf500f4af,0xf5c0f553,0xf6daf644,0xf81ff777,0xf982f8ca,0xfaedfa34,0xfc3dfb9c,
0xfd2ffcc1,0xfdb4fd7f,0xfdf7fdd4,0xfe6cfe24,0xff55fed5,0x0081ffe5,0x016c0107,0x01e701b8,
0x020601ff,0x02050204,0x02110209,0x02460224,0x02ab0272,0x034c02f8,0x03f803a4,0x04520430,
0x0453045a,0x042b0443,0x04140416,0x0443041e,0x04bf0479,0x054f050a,0x05ac0588,0x059005af,
0x04fe0554,0x0442049d,0x03c903f9,0x03c803b9,0x041d03ea,0x04a1045d,0x052304e7,0x0558054d,
0x05130547,0x045104bf,0x037303df,0x02fc0323,0x032e0300,0x03cb0375,0x04760426,0x04d104b3,
0x04b204d4,0x040b046c,0x03190399,0x0226029b,0x018401c4,0x016c0166,0x01cf0194,0x025f0219,
0x02c70299,0x02e702e0,0x02b502d6,0x023a027f,0x01bd01f7,0x01840191,0x01b5018f,0x022801ea,
0x02b1026e,0x031a02ee,0x032e032e,0x03180323,0x02f30308,0x02cb02e1,0x029002b0,0x024f026e,
0x022d0235,0x0230022c,0x023d0237,0x022f023f,0x01fd0212,0x01bf01e1,0x0170019c,0x00fd013d,
0x006200b8,0xffd3000b,0xff8dff9f,0xffadff8e,0x0001ffdc,0x005e002e,0x00640064,0x0011003d,
0xff99ffda,0xff0dff53,0xfeacfed7,0xfe95fe91,0xfed7fead,0xff53ff0e,0xffe4ff9c,0x0087002d,
0x012500d4,0x01d00177,0x0290022a,0x03a20311,0x04e1043b,0x06560596,0x07e9071e,0x0941089e,
0x0a6309d4,0x0b660ae7,0x0c710be3,0x0dab0d08,0x0f1d0e62,0x10a30fdd,0x12251167,0x139512da,
0x15161456,0x16a515dd,0x18231764,0x19d818f4,0x1baf1ac3,0x1d791c9f,0x1ec91e30,0x1f471f27,
0x1ef81f35,0x1e301ea0,0x1d261dad,0x1c0e1c9c,0x1afa1b85,0x19ee1a6c,0x19071973,0x1839189f,
0x17ab17e7,0x17861783,0x182b17bb,0x19aa18d6,0x1bde1ab2,0x1e671d18,0x212d1fc4,0x245a22b2,
0x27df2613,0x2bc729c4,0x30072de0,0x347e3238,0x38fd36c4,0x3d0b3b17,0x406c3ed7,0x42d641c3,
0x445543b1,0x450644ce,0x447544e8,0x427c43a9,0x3ee240e3,0x3a313c9d,0x353337af,0x306032be,
0x2bf82e1d,0x27a129d5,0x22c9254e,0x1cf8200a,0x15c61987,0x0d7111c1,0x043408e3,0xfad3ff81,
0xf1a6f63c,0xe859ecf8,0xdfc6e404,0xd6e5db5f,0xce90d29e,0xc713caba,0xc070c3a6,0xbb6ebdba,
0xb74db94e,0xb409b585,0xb1aab2cf,0xafc0b0a0,0xaeb5af16,0xae68ae76,0xaf0bae94,0xb0b6afc7,
0xb304b1cb,0xb5b2b459,0xb845b704,0xbaddb990,0xbd91bc31,0xc089bf01,0xc3dec22b,0xc741c58f,
0xcaddc904,0xce90ccbb,0xd226d061,0xd5a0d3eb,0xd8aad738,0xdb4cda04,0xddd6dc9c,0xe04bdf0b,
0xe2e3e192,0xe57de439,0xe7c9e6ad,0xe9d8e8de,0xeb7eeab5,0xed03ec3d,0xee88edc7,0xeff7ef42,
0xf17bf0b0,0xf336f253,0xf501f419,0xf694f5d5,0xf7adf733,0xf866f812,0xf905f8ba,0xf9eaf96c,
0xfb3cfa8b,0xfcb7fbfe,0xfe04fd66,0xff05fe93,0xff95ff5d,0xffcaffba,0xffc5ffcb,0xffe2ffc9,
0x00810019,0x017f00f3,0x029d0214,0x035a030c,0x0398038b,0x035c0382,0x02f90329,0x02c302d1,
0x030e02d2,0x03c70360,0x04ac0439,0x056c0517,0x05a6059d,0x0538057e,0x045d04d4,0x038f03ef,
0x03260349,0x033f0322,0x03bd0375,0x046b0414,0x04f604bc,0x050d0514,0x048904da,0x03b80422,
0x03040357,0x02be02d1,0x02ea02cd,0x03410313,0x03840368,0x039a0397,0x03730391,0x03080346,
0x027102bd,0x01ee022d,0x018f01ba,0x01530169,0x0137013f,0x0123012c,0x0113011c,0x010e0110,
0x010c010f,0x00ff010a,0x00e800f4,0x00c600db,0x009f00b5,0x00710086,0x0071006b,0x00aa008a,
0x012000e2,0x0196015e,0x01dc01c5,0x01c501dd,0x01510196,0x00c6010a,0x006c008d,0x005d005a,
0x009c007b,0x00f400c4,0x0135011a,0x01480148,0x01050138,0x006100c2,0xffaffffd,0xff4aff6d,
0xff54ff40,0xff99ff71,0xffdcffbe,0xffeeffec,0xffe6ffee,0xffcaffdb,0xff9bffb6,0xff44ff76,
0xfee4ff10,0xfebafec7,0xfec4feba,0xfee6fed5,0xfeedfeed,0xfef1feee,0xff21ff03,0xff84ff4c,
0x001effcc,0x00de0084,0x01b50147,0x02c50237,0x03e80357,0x05190478,0x066105bd,0x07c70711,
0x093c0882,0x0a7c09ea,0x0b5d0af4,0x0c170bbb,0x0ccb0c6c,0x0dc50d3a,0x0ef40e59,0x10490f99,
0x11d51104,0x138512ae,0x1538145f,0x16c31605,0x181a1774,0x195618b8,0x1a9a19f8,0x1bba1b2e,
0x1c9e1c38,0x1cfd1cde,0x1caf1ce6,0x1be51c5b,0x1aa31b52,0x192c19f1,0x17931863,0x15f716c2,
0x148c1537,0x139613fd,0x1363135f,0x13fc1395,0x15701499,0x177d166a,0x19ef18ab,0x1c9c1b41,
0x1f5c1df3,0x225e20ce,0x25e8240d,0x2a3427f6,0x2f2b2ca1,0x347031c9,0x3983370d,0x3dac3bb9,
0x40d33f60,0x42cf41f7,0x43a1435b,0x438143b1,0x423e4303,0x40064142,0x3cc23e8d,0x38a63ac7,
0x34373675,0x2f9331eb,0x2afe2d41,0x265028b3,0x211723c7,0x1afd1e2f,0x138c176c,0x0b5a0f87,
0x026806f6,0xf952fdd0,0xf020f4c2,0xe685eb60,0xdda8e1f2,0xd50cd961,0xcd14d0e2,0xc642c99d,
0xbfebc304,0xbafebd35,0xb749b916,0xb460b5a8,0xb2abb374,0xb156b1ee,0xb0f4b101,0xb156b11b,
0xb238b1b3,0xb392b2dc,0xb523b44f,0xb750b623,0xb9f6b896,0xbd31bb7d,0xc0c3bef9,0xc453c28f,
0xc7b5c607,0xcab1c944,0xcd8ccc13,0xd089cf0a,0xd39cd208,0xd706d544,0xda91d8d3,0xddb4dc2b,
0xe067df25,0xe253e177,0xe3d3e31a,0xe559e490,0xe710e62d,0xe930e814,0xeb7aea59,0xedafec99,
0xef83eea8,0xf0adf02f,0xf186f11b,0xf27af1f6,0xf3c8f30e,0xf588f4a3,0xf75cf679,0xf8e9f82f,
0xfa0af98e,0xfab6fa6e,0xfb19faee,0xfb72fb42,0xfbfbfba6,0xfcf9fc6e,0xfe46fd9a,0xff84feea,
0x007e000b,0x00f700cc,0x010f010c,0x010e010e,0x01280112,0x018d0151,0x023f01de,0x0304029f,
0x03a5035a,0x03ef03d7,0x03eb03f4,0x03c203dc,0x039503a4,0x039a0397,0x03b803a3,0x03e203cc,
0x041003fa,0x043e0424,0x045a0451,0x045d045e,0x044b0451,0x04480444,0x0458044d,0x04620464,
0x043b0454,0x03e40410,0x039b03bb,0x038a0388,0x03b3039c,0x03d403c9,0x03c803d5,0x038303ac,
0x0326035a,0x02bd02f4,0x024e0282,0x01f9021e,0x01f001e8,0x0232020a,0x02850260,0x02870291,
0x0221025f,0x017e01d0,0x00f20131,0x00ad00c4,0x00ae00a5,0x00f300ca,0x015c0125,0x01d4019b,
0x021001fc,0x01ea0209,0x017301b3,0x00f3012f,0x008d00b7,0x005e006f,0x005c0056,0x00910071,
0x00cc00af,0x00fc00ea,0x00f400fd,0x00bd00dc,0x0076009a,0x00120043,0xffc3ffec,0xff9affa5,
0xffa1ff99,0xffdcffbc,0x001e0001,0x004a0034,0x0029003d,0xffec0012,0xff99ffc5,0xff3dff6d,
0xfefbff15,0xfee8feea,0xfefbfeec,0xff35ff14,0xff8eff62,0xffecffbf,0x0027000f,0x005c003d,
0x007b006a,0x00ab0091,0x014300e7,0x024f01be,0x03a302f1,0x051a045e,0x068205d4,0x07c40723,
0x08ea085b,0x09d80967,0x0a9c0a42,0x0b4c0af4,0x0c050ba2,0x0cff0c78,0x0e240d90,0x0f6d0ec4,
0x10c3101b,0x11fc1162,0x1344129b,0x148f13ef,0x15cc152b,0x170d1670,0x186417b6,0x19c11914,
0x1b151a74,0x1c041b9b,0x1c731c4d,0x1c4b1c73,0x1b891bfe,0x1a401af1,0x188f1971,0x16b617a7,
0x14ea15ca,0x13671419,0x125312cc,0x11cf1200,0x11fc11cc,0x12ea1259,0x148913a5,0x16a5158e,
0x190a17ce,0x1bb21a52,0x1ea91d20,0x22212053,0x26332419,0x2ad3286c,0x2fd92d4f,0x34e03264,
0x39873746,0x3d383b83,0x3fed3eaf,0x418d40e2,0x421e41f3,0x41c9420e,0x406a4140,0x3de93f4b,
0x3a733c4f,0x363f3869,0x31d93411,0x2d542f9d,0x28b52b08,0x23c3264d,0x1e4f211b,0x18391b60,
0x112614d7,0x09640d52,0x00f2054e,0xf7defc6b,0xee78f33b,0xe4bfe99f,0xdb97dffa,0xd399d789,
0xcc92cfda,0xc73bc9c1,0xc2a7c4d4,0xbef4c0ab,0xbbf5bd73,0xb909ba72,0xb6c3b7d2,0xb504b5c9,
0xb47fb490,0xb543b4c0,0xb6dcb5f7,0xb904b7e9,0xbb3eba25,0xbd84bc5c,0xbfdebeb5,0xc263c111,
0xc54ec3d4,0xc877c6da,0xcbeaca2c,0xcf5ecdad,0xd274d0ee,0xd558d3f0,0xd7e4d6a1,0xda7ad927,
0xdd22dbcf,0xdfaede6d,0xe22fe0f3,0xe45ae353,0xe639e553,0xe7d4e711,0xe92fe88a,0xea80e9cf,
0xec07eb3a,0xedceece0,0xefc5eeca,0xf193f0b1,0xf301f257,0xf426f39d,0xf50bf49a,0xf5f8f57f,
0xf6ddf66a,0xf7c0f74f,0xf8bbf839,0xf9d7f943,0xfafafa6a,0xfbfafb7f,0xfcb9fc63,0xfd46fd02,
0xfde3fd90,0xfea3fe40,0xff6eff0d,0x000bffc7,0x008a0052,0x00de00b7,0x01270102,0x0170014b,
0x01b60194,0x020201d9,0x02600230,0x02af028b,0x02d902c8,0x02d502db,0x02c902ce,0x02cf02c8,
0x031002e6,0x03790341,0x03f103b5,0x04450421,0x04510452,0x040d0439,0x03ab03dc,0x036e038a,
0x03520358,0x036b0358,0x03ab0385,0x040403d7,0x04300422,0x0411042d,0x039303dc,0x02ef033f,
0x027502a5,0x024f0259,0x0273025a,0x02c00295,0x031902f0,0x033f0331,0x0323033b,0x02b202f4,
0x0222026f,0x018b01d4,0x013c0159,0x01390133,0x01760150,0x01cd019d,0x021d01f8,0x02380231,
0x020c022d,0x01a601dc,0x012e0169,0x00d300fc,0x009600b0,0x00820085,0x008b0086,0x00a20094,
0x00bc00ae,0x00db00ce,0x00d300dd,0x009b00be,0x00420076,0xfffa0014,0xffdbffe6,0xffdeffd7,
0xfff5ffeb,0x00150002,0x00410029,0x00420053,0x00050029,0xff94ffd4,0xff10ff50,0xfeb5fedc,
0xfeadfea8,0xfee3fec1,0xff34ff08,0xff86ff5e,0xffbdffa5,0xffceffcc,0xffc3ffcc,0xffafffba,
0xffc2ffb2,0x000cffe2,0x00ac0055,0x016d0107,0x025501dd,0x036302de,0x046403e3,0x056604e3,
0x066205e5,0x074b06d6,0x084107c8,0x092e08b8,0x0a03099c,0x0ad30a68,0x0b9a0b38,0x0c780c09,
0x0d7a0cf7,0x0e960e05,0x0fb60f27,0x10cc1047,0x11e31154,0x130d1276,0x143713a1,0x156914d2,
0x16b01608,0x17fc1755,0x190e1890,0x19a01969,0x198119a9,0x18b6192f,0x176a181a,0x15cc16a3,
0x13fd14e5,0x123b131a,0x10b41170,0x0f8e1015,0x0ede0f29,0x0ea40eab,0x0f1b0ecb,0x10490f98,
0x1234112a,0x14a81360,0x17811604,0x1ac21914,0x1e6b1c85,0x2281206a,0x26e424aa,0x2b88292d,
0x30442de5,0x34e7329b,0x391e3716,0x3c9d3b02,0x3f323e07,0x40f24032,0x419c4167,0x4108417b,
0x3f11403e,0x3b993d7c,0x37473982,0x329d34f7,0x2e033047,0x29a92bcf,0x2543277b,0x208e22f8,
0x1b1b1df6,0x149817ff,0x0d0310f3,0x048108c8,0xfbc4002f,0xf2c5f748,0xea1fee66,0xe1c5e5e5,
0xd9afdda1,0xd2d4d621,0xcca4cfa3,0xc78fc9f1,0xc34dc55c,0xbfafc16e,0xbcf7be3a,0xbab6bbc8,
0xb917b9c9,0xb835b892,0xb80eb805,0xb8e7b859,0xba8db9a9,0xbcd3bba4,0xbf6abe1c,0xc1ffc0b4,
0xc4b3c354,0xc753c600,0xca1dc8b2,0xcceccb88,0xcfbece53,0xd2b4d134,0xd593d426,0xd86ad6fd,
0xdb1dd9d0,0xdd86dc57,0xdfafdea7,0xe1b1e0b8,0xe395e2a2,0xe587e48d,0xe76be67b,0xe93de859,
0xeaeaea1c,0xec6debae,0xedebed2e,0xef59eea9,0xf0b5f008,0xf214f162,0xf37ff2cb,0xf4f1f43b,
0xf634f59c,0xf72ef6b9,0xf7fdf79c,0xf8bdf860,0xf9a1f929,0xfabefa2c,0xfbe5fb4f,0xfd00fc75,
0xfdf9fd82,0xfeb0fe5d,0xff1dfef1,0xff60ff44,0xff9eff7a,0x0013ffd4,0x00cd0074,0x0181012b,
0x01fa01c8,0x02360225,0x0235023c,0x020c021e,0x02060204,0x023a021a,0x02b10270,0x034f02f9,
0x03dd0399,0x04350416,0x0430043d,0x03e90410,0x038a03b9,0x03430364,0x032b032f,0x03440332,
0x038d0363,0x03d703b4,0x03f303ef,0x03c103e1,0x035c0393,0x02f8032c,0x02ad02cb,0x02820293,
0x026b027a,0x02620267,0x0273026b,0x0280027b,0x027f0281,0x026b0276,0x024a025e,0x0215022f,
0x01cc01f2,0x018401a6,0x013d015f,0x01080123,0x00f700fc,0x00f700f5,0x00f600f7,0x00ec00f5,
0x00bd00da,0x006b009a,0xfff6002c,0xffa4ffc9,0xff7aff87,0xff84ff77,0xffb3ff9a,0xffddffc9,
0xffdfffe6,0xffbaffcf,0xff79ff95,0xff44ff59,0xff3cff3b,0xff53ff42,0xff81ff69,0xffbaffa1,
0xffebffda,0xffeafff1,0xffaeffd2,0xff5aff84,0xff25ff3b,0xff14ff1a,0xff18ff12,0xff22ff1c,
0xff33ff29,0xff62ff48,0xff9fff7f,0xffdfffc3,0xfffcffef,0x000c0001,0x0034001c,0x007f005a,
0x00b6009f,0x00ec00d2,0x0135010e,0x01a90168,0x024c01f6,0x030a02a9,0x03cc036e,0x0496042d,
0x05720502,0x064b05df,0x073506bc,0x082707ac,0x092e08a3,0x0a4409bb,0x0b320abf,0x0bf10b96,
0x0c910c43,0x0d230cda,0x0dd70d7a,0x0e9b0e36,0x0f850f0b,0x10ab1014,0x11eb114a,0x133e1296,
0x147013df,0x157014f0,0x164815e0,0x16eb169d,0x174b1722,0x1746175a,0x16ce171b,0x15e11668,
0x14961542,0x131513d9,0x116c1244,0x0fc9109b,0x0e390efe,0x0ced0d86,0x0c400c80,0x0c510c30,
0x0d450cad,0x0f110e14,0x11911040,0x14941305,0x17de1630,0x1b48198d,0x1ede1d0c,0x22bb20be,
0x271624e1,0x2bc52962,0x30b52e37,0x3582332b,0x39cd37bd,0x3d5e3bad,0x3fcb3eb6,0x411e409a,
0x41154147,0x3fbd408f,0x3d463ea7,0x399e3b94,0x354e377b,0x30b8330a,0x2c092e5b,0x277f29c5,
0x22cf252f,0x1dd52064,0x18051b0c,0x114d14c5,0x09cc0da8,0x016d05ae,0xf91bfd3e,0xf061f4cb,
0xe7f5ec0a,0xe035e40d,0xd8c0dc6a,0xd290d575,0xccf6cfc2,0xc801ca51,0xc409c5f8,0xc08dc234,
0xbe0fbf26,0xbc55bd29,0xbb34bba4,0xbb13bb0a,0xbb94bb3e,0xbccdbc1c,0xbe69bd94,0xc056bf4e,
0xc2a4c172,0xc539c3e7,0xc82dc6a8,0xcb27c9b1,0xce10cc9a,0xd0b7cf6f,0xd30dd1e6,0xd561d435,
0xd7b1d68e,0xda1cd8da,0xdcc5db6e,0xdf59de14,0xe1cee09b,0xe3e9e2ec,0xe589e4c3,0xe703e64b,
0xe85ce7b0,0xe9dde916,0xeb99eab2,0xed5cec7b,0xef24ee41,0xf0a9eff2,0xf1def148,0xf2ecf268,
0xf3faf372,0xf535f48e,0xf69bf5e6,0xf7f5f74a,0xf931f898,0xfa35f9bb,0xfaf4fa9c,0xfb95fb4b,
0xfc21fbdc,0xfcd5fc74,0xfdbafd42,0xfea5fe34,0xff8bff1d,0x002dffe9,0x009c0073,0x00ce00bc,
0x00ea00de,0x011000fd,0x015f0134,0x01da0198,0x026d0221,0x02ee02b2,0x03480321,0x0387036c,
0x03aa0399,0x03c903b7,0x03e503d9,0x03f703f3,0x03fc03fb,0x03fb03fc,0x040603fd,0x04090409,
0x04050406,0x04030401,0x04080403,0x04150410,0x04040412,0x03cb03eb,0x036f03a1,0x0331034b,
0x032a0328,0x034e0339,0x03750367,0x038b0387,0x0389038d,0x036a037d,0x03330356,0x02ec0311,
0x02a002c0,0x0286028a,0x02930286,0x02a2029b,0x027b0296,0x0216024f,0x018f01d4,0x010e014b,
0x00a500d6,0x0059007a,0x00260035,0x002d0022,0x00620044,0x00760071,0x006a0072,0x001d0045,
0xffe70004,0xffabffc7,0xff7bff94,0xff65ff6b,0xff6fff66,0xff92ff7c,0xffb5ffa6,0xffcdffc4,
0xffd5ffd3,0xffc4ffd1,0xff94ffaf,0xff4cff71,0xff0aff29,0xfee8fef5,0xfef2fee6,0xff1dff04,
0xff56ff3a,0xff8eff71,0xffbfffa6,0xffe2ffd2,0xfff2ffea,0xfffffffa,0x00170006,0x00440025,
0x00890066,0x00e700b5,0x0151011a,0x01a90181,0x01f601d2,0x02360219,0x027d0256,0x02fc02b2,
0x03bb0359,0x04a4042b,0x05b20529,0x06c7063c,0x07e60757,0x08f80874,0x09db096d,0x0a960a42,
0x0b270ae4,0x0bba0b6f,0x0c5b0c08,0x0d0a0cad,0x0ddd0d6c,0x0ec00e52,0x0fbd0f37,0x10d21042,
0x11d9115b,0x12cb1254,0x139c1335,0x145c13f9,0x150f14b6,0x158c1551,0x15b315aa,0x158f15af,
0x14f51551,0x13f41481,0x12861348,0x10d911b7,0x0f090ff7,0x0d540e27,0x0bf10c98,0x0b0d0b6f,
0x0adc0adc,0x0b720b0a,0x0cea0c12,0x0f1b0ded,0x11ca1060,0x14d21347,0x18081669,0x1b7919b9,
0x1f221d45,0x23212118,0x279f2555,0x2c5329f5,0x31332ebe,0x35c8338e,0x39c537d8,0x3cec3b74,
0x3eea3e19,0x3fc13f77,0x3f553fba,0x3d8a3e96,0x3a943c37,0x368d38b5,0x31eb3445,0x2d172f8b,
0x281e2a9d,0x233325ac,0x1e1720aa,0x18e21b84,0x13361620,0x0d02102a,0x063309af,0xfe830280,
0xf68afa83,0xee30f274,0xe5cae9e6,0xde1ce1ee,0xd6f8da70,0xd112d3c8,0xcc75ceb2,0xc891ca5d,
0xc5d0c720,0xc350c487,0xc152c238,0xbfe0c094,0xbed8bf3d,0xbec8beb1,0xbf73bf06,0xc0eac010,
0xc2dcc1df,0xc515c3f1,0xc77fc647,0xc9f5c8b9,0xcca1cb48,0xcf4dcdff,0xd1e9d094,0xd48fd346,
0xd6ebd5c3,0xd921d808,0xdb2bda2e,0xdd12dc1b,0xdf2ede1b,0xe15ae043,0xe39ce277,0xe5cde4b7,
0xe7b1e6c8,0xe95fe88c,0xeab9ea17,0xebd4eb48,0xecfbec67,0xee45ed9e,0xefc6eefd,0xf16af095,
0xf2f4f232,0xf467f3b6,0xf5a8f50c,0xf6c1f634,0xf7ccf748,0xf8aef842,0xf97ef916,0xfa40f9db,
0xfb0afaa3,0xfbddfb75,0xfc9ffc40,0xfd46fcf6,0xfde3fd92,0xfe8ffe37,0xff40fee9,0xffe2ff9a,
0x0061001b,0x00b70095,0x00fc00db,0x01360117,0x017c0159,0x01c5019e,0x022401f1,0x028d0257,
0x02e402bf,0x03180306,0x03280326,0x031f0321,0x03140319,0x0324031a,0x03440333,0x0368035b,
0x037c0373,0x035f0371,0x03260344,0x02e40303,0x02b502ca,0x029502a0,0x02910290,0x02af029b,
0x02e602c9,0x030b02fa,0x0302030c,0x02c302e8,0x0272029d,0x023a0250,0x021e0227,0x021a0215,
0x022c021f,0x02400235,0x02390242,0x020f022a,0x01b401e6,0x012b0170,0x009500dd,0x000c0055,
0xffbfffe6,0xff96ffaa,0xff8fff8e,0xffa3ff96,0xffb3ffad,0xffb1ffb6,0xff99ffa5,0xff81ff8d,
0xff60ff6f,0xff44ff53,0xff2eff38,0xff1cff24,0xff1aff1b,0xff2dff22,0xff54ff40,0xff6aff62,
0xff6cff6d,0xff5dff68,0xff4cff50,0xff44ff46,0xff45ff43,0xff59ff4c,0xff7eff69,0xffb7ff9a,
0xfff6ffdb,0x0017000a,0x002b0026,0x0034002e,0x005d003f,0x008a006f,0x00d300aa,0x012300fb,
0x016f014c,0x01ab0190,0x01d001c0,0x01e601df,0x01fa01ee,0x02150205,0x02520230,0x02ae027a,
0x032e02e4,0x03d8037c,0x049b0438,0x05750505,0x066005eb,0x075106da,0x084107cb,0x092a08b5,
0x09f00993,0x0a960a47,0x0b240adf,0x0ba90b64,0x0c330bea,0x0ccc0c80,0x0d7b0d21,0x0e3c0ddd,
0x0ef60e9a,0x0fb90f55,0x107f1020,0x112c10d6,0x11db1185,0x12821231,0x132012d5,0x1384135b,
0x13881395,0x13071358,0x121a129b,0x10cb117a,0x0f3c100a,0x0d940e67,0x0bf80cc0,0x0a990b3c,
0x099f0a0e,0x092c0956,0x095c092d,0x0a4809ba,0x0bf00b01,0x0e4a0d08,0x11260fa4,0x146a12ba,
0x1808162f,0x1bf319f2,0x20291e07,0x2490224e,0x293126d9,0x2de82b94,0x32853039,0x36d134b9,
0x3a7b38bd,0x3d5f3c07,0x3f5c3e87,0x40083fd9,0x3f503fde,0x3ce03e4b,0x391a3b22,0x344936c9,
0x2f0231a9,0x29b92c58,0x249b2721,0x1fc32228,0x1aea1d5e,0x15e71867,0x1067133e,0x0a300d5d,
0x035706dc,0xfbaeff99,0xf38ef797,0xeba6efa3,0xe3a8e79b,0xdc61dfec,0xd5d9d8ff,0xd058d2ef,
0xcc45ce2d,0xc8f0ca80,0xc68bc79f,0xc4b3c599,0xc34ac3ec,0xc260c2c9,0xc1e1c216,0xc1f6c1d2,
0xc2afc23b,0xc40bc349,0xc5f7c4f0,0xc832c70e,0xcab6c96e,0xcd4dcc00,0xcfecce9d,0xd27ad138,
0xd4c7d3a7,0xd6f0d5e0,0xd8f3d7f7,0xdaf3d9f4,0xdcf1dbf3,0xdee1ddf0,0xe0c0dfcb,0xe2a0e1b7,
0xe47ae38b,0xe661e56d,0xe841e755,0xea03e925,0xeb9aead6,0xed01ec51,0xee50edad,0xef9aeef6,
0xf0cbf037,0xf20bf169,0xf351f2aa,0xf4baf405,0xf624f572,0xf75cf6c7,0xf852f7de,0xf913f8ba,
0xf9bff969,0xfa79fa19,0xfb4bfae5,0xfc1bfbaf,0xfceffc87,0xfdbafd53,0xfe70fe1b,0xff06fec1,
0xff82ff46,0xfffcffbf,0x00a50051,0x014e00f8,0x01e0019e,0x024e021d,0x0282026e,0x0295028f,
0x02910293,0x02a30295,0x02d702bd,0x032902fa,0x0392035c,0x03ea03c0,0x04190408,0x040b041a,
0x03d803f5,0x039703b8,0x035c0375,0x03380346,0x03330330,0x03540342,0x03870370,0x03a20397,
0x03a003a4,0x038f0395,0x03750383,0x0360036b,0x03480356,0x03220336,0x02fa030a,0x02e002ea,
0x02c102cf,0x029a02b1,0x02720287,0x0240025d,0x01fc0220,0x01a501d1,0x01380171,0x00ca00ff,
0x00630095,0x00070029,0xffd4ffee,0xffb6ffc2,0xffa6ffae,0xff93ff9e,0xff72ff83,0xff4eff61,
0xff34ff41,0xff2eff2e,0xff3cff34,0xff54ff4b,0xff5aff5a,0xff4aff58,0xff22ff36,0xfefbff0c,
0xfee6feed,0xfeedfee3,0xff13fefc,0xff4cff2b,0xff95ff6f,0xffdcffba,0x000afff7,0x00210017,
0x002e0027,0x00620042,0x00890074,0x00bd00a2,0x00f200d4,0x01230106,0x01660141,0x01b4018e,
0x01f501d7,0x02260211,0x024d0239,0x02730260,0x02970287,0x02b102a7,0x02bf02b5,0x02ee02d1,
0x033c030b,0x03b50371,0x044b03fc,0x04f9049c,0x05c70558,0x0699062e,0x07730703,0x084c07e2,
0x092908b9,0x0a10099d,0x0aea0a84,0x0b930b44,0x0c1b0be0,0x0c810c4f,0x0cdf0cb1,0x0d450d15,
0x0dae0d79,0x0e3b0df2,0x0edb0e87,0x0f970f37,0x104e0ff0,0x10f310a5,0x1183113f,0x11fa11c1,
0x12421223,0x1248124d,0x11fb1229,0x114f11b4,0x104d10d8,0x0f030fb0,0x0d940e51,0x0c0e0ccf,
0x0a980b4f,0x094b09e7,0x086508c8,0x080c0825,0x087c082b,0x09ba0902,0x0bc90aac,0x0e8d0d18,
0x11dc1026,0x158f13a9,0x196e177c,0x1d6c1b69,0x21a81f84,0x261c23d9,0x2ace286c,0x2f942d37,
0x341531dc,0x38373638,0x3ba03a0a,0x3e213cfd,0x3f8d3f00,0x3f713fb0,0x3df13edc,0x3b003ca6,
0x36c53904,0x31cd345c,0x2c632f21,0x270829af,0x21e1246d,0x1cf61f62,0x180d1a87,0x12c91571,
0x0d4d101e,0x07160a46,0x005b03ca,0xf8f7fcba,0xf0e8f4fc,0xe947ed05,0xe1bae581,0xdae1de25,
0xd513d7e1,0xcff1d26b,0xcc19cdd4,0xc920ca8e,0xc6e8c7de,0xc596c630,0xc4a8c50f,0xc44fc465,
0xc472c456,0xc4eec49e,0xc5d5c55b,0xc6f7c65a,0xc88fc7b5,0xca7ec97b,0xccdccb9e,0xcf7fce2d,
0xd226d0d2,0xd4b2d372,0xd6e6d5dd,0xd8d5d7e0,0xda96d9bd,0xdc3cdb68,0xddfadd19,0xdfd5dee8,
0xe1bde0c4,0xe3b1e2b8,0xe586e49e,0xe746e668,0xe8f5e822,0xea87e9c0,0xec24eb57,0xedb0ecf1,
0xef27ee69,0xf085efda,0xf1a5f11e,0xf29bf221,0xf388f313,0xf488f401,0xf5b2f519,0xf6e8f64e,
0xf80ff77e,0xf919f89d,0xf9faf98f,0xfab0fa59,0xfb4dfb03,0xfbd7fb94,0xfc85fc29,0xfd4dfce7,
0xfe30fdbc,0xff0bfe9d,0xffc1ff6a,0x00570007,0x00c3009a,0x011300ed,0x01550131,0x01970174,
0x01dd01b9,0x022f0207,0x0263024d,0x02950278,0x02b802a8,0x02d802c8,0x030102eb,0x03210311,
0x0334032e,0x03370338,0x03370334,0x032e0332,0x0326032a,0x03190321,0x031f031b,0x0332032b,
0x03510340,0x035a0359,0x03420351,0x0317032e,0x02f40303,0x02e902ec,0x02df02e3,0x02c902d7,
0x02a102b8,0x026b0285,0x0222024d,0x01ca01f8,0x01640196,0x01050130,0x00c600df,0x009f00af,
0x0079008e,0x001e0051,0xffc3fff6,0xff63ff91,0xff0dff38,0xfecffeee,0xfea4feb9,0xfe92fe95,
0xfea2fe98,0xfec4feb5,0xfeddfed8,0xfee0fee4,0xfed4fedd,0xfebffec9,0xfea8feb4,0xfe91fe98,
0xfe91fe90,0xfea7fe98,0xfed4febc,0xff0dfef2,0xff55ff33,0xff9cff79,0xffe7ffc3,0x00160000,
0x00440029,0x00790065,0x009e008b,0x00d800bc,0x011200f7,0x014e0131,0x0189016d,0x01c201a7,
0x01e601d6,0x020701f8,0x02220216,0x023c022e,0x02550247,0x02790263,0x02ab0291,0x02e002c8,
0x031602fe,0x03510332,0x0388036c,0x03dd03ad,0x0462041c,0x051204b3,0x05e90578,0x06d80660,
0x07d00750,0x08d40855,0x09bf094e,0x0a8f0a2d,0x0b2a0ae6,0x0b980b62,0x0bf50bc8,0x0c390c17,
0x0c810c59,0x0cd40ca9,0x0d2c0d02,0x0da40d63,0x0e350dee,0x0ec50e7b,0x0f4c0f09,0x0fce0f8e,
0x104f100f,0x10b71089,0x10ea10d9,0x10d810ea,0x107810b3,0x0fcd102d,0x0ec70f55,0x0d750e27,
0x0be90cb3,0x0a520b17,0x08e00991,0x07be0844,0x071e075a,0x07220706,0x07fa0771,0x09af08ba,
0x0c2f0ad6,0x0f550db1,0x12ec1114,0x16de14de,0x1b1218f4,0x1f5f1d31,0x23e42199,0x288a2638,
0x2d412ae5,0x31f82fa3,0x36393428,0x39fb382a,0x3cdf3b90,0x3ec63df4,0x3f873f52,0x3ecf3f5c,
0x3ca43de8,0x392c3b13,0x348d36f4,0x2f5331fd,0x29b32c8c,0x241126df,0x1e882148,0x19291bd2,
0x13f91691,0x0e9b114f,0x09340bed,0x0351065c,0xfcd9001a,0xf5e4f97a,0xee34f223,0xe6a0ea4f,
0xdf49e300,0xd879dbb4,0xd305d5a2,0xce57d08a,0xcb12cc7c,0xc8eac9f0,0xc761c80a,0xc6a6c6f3,
0xc625c65b,0xc629c613,0xc69fc65b,0xc761c6f3,0xc879c7e4,0xc9adc90f,0xcb2cca64,0xcce3cc01,
0xced5cdd2,0xd10ccfec,0xd35ad230,0xd5c8d48f,0xd834d705,0xda60d94f,0xdc5fdb66,0xde02dd38,
0xdf95decd,0xe13fe06c,0xe2e5e210,0xe4b5e3ce,0xe683e59f,0xe84be765,0xea10e932,0xeba1eae0,
0xed16ec5f,0xee71edca,0xefbbef14,0xf10cf062,0xf247f1b1,0xf361f2d6,0xf463f3e6,0xf54af4d6,
0xf63bf5c1,0xf735f6b7,0xf821f7ac,0xf916f899,0xfa0af990,0xfb0afa8a,0xfbfcfb86,0xfccefc6d,
0xfd83fd29,0xfe2cfddb,0xfedafe80,0xff8bff36,0x0021ffdd,0x00a7006a,0x010200d5,0x014c0128,
0x0196016f,0x01c701ae,0x01fe01e1,0x02370218,0x02780257,0x02aa0293,0x02ca02bf,0x02df02d7,
0x02e702e1,0x02fc02f1,0x031e030a,0x03520336,0x0381036a,0x039f0390,0x03a103a4,0x0382038f,
0x03610370,0x0341034f,0x032c0334,0x03230328,0x032e0328,0x033b0334,0x0337033e,0x030a0327,
0x02bd02e7,0x025e028b,0x020a0235,0x01c401e5,0x018301a3,0x0154016b,0x0128013e,0x00fb0112,
0x00be00db,0x006b0095,0xfffd002b,0xff9affc9,0xff46ff71,0xff01ff24,0xfedafeea,0xfec3feca,
0xfec9fec2,0xfecbfec8,0xfeccfecd,0xfecffecb,0xfed5fed4,0xfed4fed5,0xfedafed5,0xfedafeda,
0xfee0fedc,0xfef0fee6,0xff16ff02,0xff4aff2b,0xff87ff66,0xffbeff9f,0xfffdffdb,0x00410019,
0x0093006e,0x00dc00b8,0x01260100,0x0176014d,0x01bd019b,0x01f001da,0x02080200,0x020a020d,
0x020a020c,0x0214020a,0x0225021a,0x024a0237,0x02780260,0x02a90295,0x02d902c3,0x02fe02f0,
0x031c0311,0x0339032a,0x0366034f,0x03a30382,0x03f903cc,0x04710431,0x050e04bc,0x05c50565,
0x069c0630,0x078e0718,0x08790803,0x096708f1,0x0a3d09d8,0x0af20a9d,0x0b750b3a,0x0bc60ba1,
0x0c020be7,0x0c240c12,0x0c490c37,0x0c760c5c,0x0cad0c91,0x0cf20ccc,0x0d540d23,0x0dbe0d88,
0x0e360dfb,0x0eb40e72,0x0f330ef4,0x0fa40f6e,0x0fde0fc9,0x0fc40fde,0x0f430f90,0x0e670ee3,
0x0d2f0dd9,0x0bb60c79,0x0a1a0ae7,0x088d094b,0x075207e6,0x068106dd,0x06470650,0x06b70667,
0x07ff073b,0x0a2a08f9,0x0d080b81,0x10880eb7,0x147c1277,0x18ce169a,0x1d641b11,0x22041fb6,
0x26be245d,0x2b612914,0x2ff02daa,0x344a3228,0x3820364f,0x3b5b39d2,0x3dd03cb5,0x3f483eaa,
0x3f9b3f9c,0x3e6f3f3a,0x3bb23d40,0x37a739d7,0x328a3531,0x2ce32fc5,0x26ed29ed,0x211f23fb,
0x1b8a1e4e,0x163418d4,0x110b13a5,0x0ba90e6c,0x061108da,0x00160334,0xf980fcd2,0xf2abf624,
0xeb6fef15,0xe433e7b9,0xdd85e0d9,0xd73fda42,0xd233d496,0xcdfdcff9,0xcaedcc4e,0xc915c9e6,
0xc7f2c86c,0xc79dc7ad,0xc7aac79d,0xc80ec7cc,0xc8cac865,0xc9a5c932,0xcab9ca29,0xcbefcb54,
0xcd4dcc93,0xced8ce16,0xd090cfaa,0xd28cd189,0xd49fd391,0xd6d6d5b5,0xd914d7f6,0xdb44da32,
0xdd67dc57,0xdf5bde68,0xe131e047,0xe2e8e210,0xe47ae3b6,0xe604e53b,0xe790e6cb,0xe91be856,
0xeaa1e9df,0xec11eb5e,0xed62ecbb,0xeebeee10,0xf006ef66,0xf146f0a8,0xf278f1e2,0xf39cf309,
0xf4cbf435,0xf5e9f560,0xf6e7f66a,0xf7cef75c,0xf89af838,0xf978f903,0xfa69f9ef,0xfb67fae7,
0xfc68fbec,0xfd5afce4,0xfe31fdca,0xfeebfe93,0xff74ff33,0xffe9ffb2,0x005f0019,0x00cc0095,
0x013d0106,0x0196016d,0x01de01bd,0x020801f5,0x021e0217,0x0236022c,0x025e0246,0x0299027a,
0x02eb02c2,0x034b0319,0x039d0377,0x03da03c2,0x03e903e4,0x03e003e7,0x03c503d2,0x03aa03b9,
0x0393039d,0x038f038d,0x0391038d,0x038c0391,0x03730382,0x034e0366,0x031f0333,0x02f00307,
0x02c502da,0x028202a8,0x023d0260,0x01ee0217,0x01a101c6,0x0155017c,0x010a012d,0x00ca00ea,
0x008d00ab,0x0041006d,0xfffb0014,0xffadffd3,0xff61ff83,0xff1bff3c,0xfee5fefe,0xfec2fed2,
0xfea8feb0,0xfe8ffe97,0xfe78fe83,0xfe5afe67,0xfe44fe50,0xfe44fe43,0xfe63fe52,0xfe8ffe77,
0xfec5fea9,0xfef6fee1,0xff18ff05,0xff35ff25,0xff64ff4d,0xff9cff82,0xffdbffbc,0x0000fffd,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,
};
static const PROGMEM uint32_t sample_1_SynthBass2_SYBS248A[1664] = {
0xff650000,0xfcedfe73,0xfa18fb40,0xf97df9b9,0xfbcff9d0,0xfe84fe66,0xfc62fdf5,0xf8fdfa40,
0xfa02f897,0xfb5dfb3b,0xf61af935,0xf0bbf30e,0xf26ff06e,0xf323f40d,0xebb5efc4,0xeb7ee9d6,
0xeee3edd4,0xe636ec39,0xe034e252,0xdc78dd64,0xe110ddac,0xe123e497,0xd927dbbf,0xd277d5c8,
0xcc16cf40,0xc027c7cd,0xc521bd55,0xd63bceea,0xdfaadb34,0xe823e478,0xefddebb0,0xf269f24f,
0xf31cf26b,0xf68ff4c5,0xf9c7f840,0xfce5fb55,0x0009fe7b,0x036b01b9,0x06580513,0x08cd07a4,
0x0b360a0a,0x0e0e0c61,0x12e8109f,0x144f142b,0x134513d3,0x1455137a,0x17f515f7,0x1b3219f3,
0x19381ad0,0x162d1762,0x1743162f,0x1a2118d5,0x1a5b1ac4,0x18041957,0x18e217c3,0x1d201b0b,
0x1e581e74,0x1a261cc5,0x160d178f,0x170e15fa,0x172a17b6,0x13131574,0x0ffd10c8,0x126410cc,
0x1590141f,0x1474163b,0x0ecc1123,0x11aa0f3e,0x14fd1480,0x0ef21298,0x09140bd7,0x08b50786,
0x0ce40b73,0x096d0bc7,0x08a40938,0xf7b702e3,0xe38aec32,0xdf77e042,0xd369dcc0,0xbe3bc76c,
0xb6e2bad5,0xa499adee,0xb077a4e2,0xcf98c203,0xc477d0d8,0xab18b44d,0xb148ac0d,0xb5f4b53f,
0xaee0b4a2,0x9226a46b,0x842b840a,0x844083d9,0x894c83f8,0x87358e06,0x846b8414,0x842984a1,
0xa1608d22,0xbbeab175,0xba33bdc9,0xb25eb4a4,0xbf2db5c7,0xd7b9cbba,0xe317dfee,0xe025e249,
0xe2d8dfbf,0xf2ade9d1,0x00f1fb17,0x02150332,0xfd14ff74,0xfdc2fc56,0x043e00d0,0x088f0708,
0x084f08d6,0x07c707b6,0x0adb08cc,0x10200d7e,0x134b1226,0x143513d6,0x158014b0,0x191e1739,
0x1c491ad3,0x1ecd1d7f,0x213c200e,0x2317223b,0x24f12426,0x25ce25a0,0x255f2584,0x257b2566,
0x262825d8,0x24ae2593,0x22aa238d,0x230622b5,0x253923e0,0x274b2679,0x271727a1,0x2385257c,
0x210d21de,0x224a2141,0x253a23dd,0x283a26bd,0x28f72909,0x269c27c0,0x2890271a,0x2c7a2a73,
0x2f842e24,0x33f1315f,0x39f7374d,0x38a539fb,0x3e493a18,0x4a2143b9,0x58b051f9,0x5bb55c13,
0x5c8a5aed,0x66d060fd,0x71ae6d21,0x7818748d,0x7871787e,0x78717852,0x744a772f,0x721973f8,
0x65d86d2d,0x5f206055,0x56ef5e77,0x2fa64576,0x15e31dec,0x19e5162d,0x17231acc,0x085c1011,
0xf4d3ff37,0xe6e6eb3b,0xf1eaea12,0xf18ef6d2,0xc7d7e091,0x9d2aaf21,0x97379590,0xa5ee9e4d,
0xa729a9d4,0x952b9f23,0x8e2a8e2e,0xa3f89626,0xbfa8b36f,0xc5c4c604,0xbc79c174,0xbc51ba3d,
0xcb58c29e,0xd9ffd3cc,0xdd0ddcdb,0xdbe4dc20,0xe20cddd5,0xed8de7b0,0xf4c0f225,0xf396f4ee,
0xeed4f121,0xee62edca,0xf263f029,0xf511f445,0xf3b7f4ee,0xf16af229,0xf1adf132,0xf34bf294,
0xf4b5f406,0xf469f4e3,0xf28ff382,0xf283f235,0xf453f337,0xf680f585,0xf813f751,0xf942f8e4,
0xf91ef92e,0xf942f8ff,0xfb22fa2a,0xfd10fc3b,0xfd76fd55,0xfd6afd96,0xfe95fda9,0x0161ffbc,
0x060103c7,0x0848077d,0x07cb083d,0x066f0757,0x073a05fa,0x0b3e0957,0x0f080d39,0x0e4f0f6e,
0x0d720d1e,0x0dd90e62,0x0d110ca0,0x10b50ef2,0x145b1260,0x15fd15cf,0x13c9151a,0x11c71228,
0x1bda151d,0x23f021ea,0x237c2343,0x28fe25e2,0x2ab52a90,0x303c2b65,0x44a139e2,0x4e1b4b83,
0x538c4fd2,0x5b47589f,0x5411592c,0x539550f5,0x61f55b39,0x594361c9,0x3df34b81,0x2b803351,
0x24a32698,0x26b8259f,0x1c1d24bc,0xfe660e1f,0xf0eef3c3,0xfcf1f5aa,0xfd3f010c,0xdd7af0f6,
0xb42cc7c8,0xa12ba6d6,0xa57ca202,0xa484a75b,0x924d9c73,0x85ce899d,0x9142889b,0xa8a69d1c,
0xb678b1d2,0xb54cb70a,0xb30db34f,0xba57b590,0xc6a3c088,0xce55cb43,0xd1e2d061,0xd6eed3dc,
0xe030db1f,0xe994e564,0xed8dec8b,0xec35ed4e,0xeb68eb6b,0xede6ec6c,0xf08fef8f,0xf28af1a4,
0xf358f31b,0xf3a6f39d,0xf4f8f40a,0xf7d6f658,0xf9def946,0xfa72fa2b,0xfac8fa98,0xfb68fb44,
0xfd35fbe1,0x0063fef3,0x021b019e,0x02060232,0x0121018f,0x01ca0171,0x02b20201,0x04f80418,
0x037f04b6,0x026d02ae,0x0263022a,0x06220417,0x07e3073a,0x0963091c,0x052b079b,0x05a10482,
0x0900075d,0x0b090a67,0x0b0a0b06,0x0b730b94,0x09da0a81,0x0a5d0a4d,0x0995098f,0x105c0c3d,
0x12e81361,0x0c660fae,0x10020c68,0x16341448,0x18101673,0x22da1cf6,0x23f225b6,0x200020a3,
0x2bc22473,0x3653326b,0x3fd839c2,0x535c49bf,0x55b457ff,0x4d78507c,0x57c45063,0x65ee6035,
0x659367d2,0x55e25f76,0x40af4ab5,0x3c473bcc,0x440340b2,0x39a54265,0x1b9f2b43,0x0a6c0fae,
0x10df0b94,0x14c0156d,0xfcbe0c4f,0xd541e8d8,0xbbf0c55e,0xb77cb842,0xb195b62c,0x9d75a912,
0x8a03920f,0x8bd587e1,0x9e709458,0xae1ba7a2,0xb1d3b128,0xb1f7b19b,0xb815b403,0xc25cbd15,
0xcaf2c756,0xcfb7cd91,0xd574d233,0xdfecda39,0xec4ae65c,0xf2f5f09a,0xf455f41a,0xf4d9f44b,
0xf65ef58e,0xf959f7ad,0xfc47fad5,0xfd5bfd34,0xfd29fd38,0xfeaefd8b,0x00e70003,0x02990195,
0x047403b1,0x050f04dc,0x04b8050f,0x056d047a,0x09180774,0x0b0209f6,0x0c790c44,0x0b2c0bab,
0x0b360b46,0x0ccb0b51,0x10510f05,0x10131050,0x0fae101f,0x0e3c0eac,0x10250ec8,0x15361263,
0x1701171f,0x14f915ba,0x151a1517,0x15b31516,0x19c51784,0x1b121b17,0x1aed1a8d,0x1dcc1c86,
0x19881cbb,0x17ba16f5,0x1f6c1b9d,0x1f03205c,0x1edb1dd8,0x21d32103,0x1dc12033,0x21f61dc3,
0x2d5f286f,0x2cd12e54,0x2e412c3a,0x336931a0,0x32b932fb,0x3eff365d,0x54604a55,0x5aaa59c2,
0x56de58f8,0x570555e5,0x60225a56,0x6df16755,0x6dde70db,0x59df6536,0x4a874fef,0x4ea54a98,
0x54725310,0x48095084,0x32333cea,0x280b2ab9,0x2c922986,0x2ad22dde,0x13aa220b,0xf1e3028f,
0xdab2e445,0xcfc0d4b7,0xc1c7c9f9,0xabdcb74e,0x9a16a179,0x98fb9727,0xa50b9e19,0xb173ac0f,
0xb68ab4bb,0xb7a6b75c,0xba6ab8a0,0xc1a4bd7c,0xca40c643,0xd061cd98,0xd6a7d326,0xdf4adac8,
0xe7fde3bb,0xeeb9eba8,0xf2a3f119,0xf2c5f32d,0xf24ef226,0xf4a1f36e,0xf6fcf5cf,0xf88cf82b,
0xf8eaf885,0xf902f96b,0xf8b3f857,0xfb2ffa11,0xfcd6fbf2,0xfd9bfdc2,0xfc8ffce1,0xfcb3fcc7,
0xfd59fc9a,0xfff0fed9,0x00480064,0xfed6ffbc,0xfe3cfe40,0xfec2fe8b,0x00baff51,0x026f023a,
0xfefa0105,0xfdf0fddc,0xfff3fee0,0x01ff00eb,0x0447035d,0x02f10422,0x02b8021b,0x050a0455,
0x02b80400,0x06d0037e,0x0bdf0a8f,0x064e09e8,0x04790421,0x06a40607,0x050705ca,0x0a8a06be,
0x0d5e0da7,0x063009ec,0x085d0582,0x0f2f0c8d,0x10750ff3,0x16a012c4,0x1ae31a07,0x171e1956,
0x1a5a16e7,0x29392108,0x385d314c,0x3fae3d59,0x3d683f69,0x3d413c14,0x4ad6425f,0x5bd8549e,
0x5b265e5e,0x4aaf53bd,0x403e4383,0x4521414e,0x49ac48cb,0x3f024666,0x2cb93591,0x253a2712,
0x29d0271c,0x27382a9e,0x12b21f2e,0xf62e045f,0xdfc3e9f3,0xce6bd727,0xb913c4c0,0x9e58abe7,
0x8b1c92ce,0x88e187e4,0x93118d1d,0x9f789996,0xa71ca419,0xaa00a8c0,0xae6babc3,0xb606b1f1,
0xbe53ba66,0xc5cec1c3,0xcea7ca51,0xd612d24f,0xdededa87,0xe66ce2c3,0xebc0e9d0,0xec8dec41,
0xee21ed6d,0xeea6ee3a,0xf17eeffc,0xf438f2d3,0xf5f2f58a,0xf4e9f564,0xf5e3f52d,0xf813f6da,
0xfad0f982,0xfc75fbbb,0xfc86fcd4,0xfbbdfbdf,0xfd72fc7f,0xfe7efe1f,0xffdfff05,0x00490080,
0xfe8bff59,0x0025fec8,0x02d301de,0x02e502ed,0x02b5030e,0x00130184,0x02150009,0x06cd04ff,
0x060906be,0x080f0651,0x09c109d6,0x055c0792,0x08b905a2,0x0ed40cb5,0x0cc40e4a,0x0d210c60,
0x0be30d87,0x0674089f,0x0b52079c,0x0fdc0ed7,0x0c1b0e45,0x0c810b74,0x0e110dd5,0x0cbb0d19,
0x12c20ea9,0x1b4a1774,0x1cf51d12,0x1b441bf6,0x1e2d1bbb,0x29ae22cf,0x3a6c3228,0x4248402d,
0x3e3f4123,0x3ef73cd1,0x4e1f451d,0x5e285783,0x5cc55fe7,0x4e885618,0x469648d1,0x4bcf4812,
0x50b84f7d,0x48cc4e8e,0x3a494158,0x35943618,0x3b2137ed,0x3adc3cb1,0x2bd93505,0x151c2099,
0xffb70a28,0xea6cf54d,0xcec6dd64,0xafc8bef6,0x97a8a209,0x901691cc,0x9505915a,0x9f059a37,
0xa426a231,0xa849a635,0xac2faa06,0xb2f7af5a,0xba58b671,0xc437bf34,0xcc44c883,0xd4aad06a,
0xdd1ed910,0xe508e15c,0xea31e7f7,0xede8ec51,0xeeddeeb0,0xef6cef0c,0xf179f034,0xf4b9f33e,
0xf62df5ab,0xf708f69e,0xf722f736,0xf8c0f78f,0xfbf2fa7d,0xfd01fcd7,0xfd72fd19,0xfdbefdd8,
0xfd60fd66,0xffbcfe4d,0x004100b0,0xfee2ff56,0xff5bff1a,0xff1aff45,0x0175ffd6,0x02aa02d5,
0xfed700e8,0xffdefe5d,0x026c01d4,0x00ed01a1,0x04fb020e,0x084307cd,0x04700683,0x05ea0432,
0x087c07eb,0x08d30848,0x0e120b06,0x0ea40fe3,0x07b40b1c,0x07a70687,0x0ac709a8,0x0b5b0b0e,
0x0db20c51,0x0e130eb3,0x09cb0c0f,0x09bf08cf,0x10b50cbc,0x185b14d7,0x1bcf1ae8,0x1a071b65,
0x1ac9196b,0x262e1f39,0x360e2e96,0x3c453afb,0x39473b1a,0x3bde3902,0x4a37420a,0x57de5246,
0x57145982,0x4bf751f7,0x45fa478b,0x4a754771,0x4e794d62,0x48334ca1,0x3e6b42df,0x3b883bdb,
0x40493d58,0x41cc4243,0x38e73ea0,0x27fe3114,0x15331ed1,0xfc630a0d,0xdda3edb5,0xbad9cc92,
0x9e84ab3e,0x914d9619,0x92c590e9,0x97df9587,0x9ce59a6c,0xa1099f37,0xa528a311,0xaaf5a7d8,
0xb3c5af34,0xbcd0b88b,0xc5bfc14b,0xcee2ca7e,0xd6dfd30a,0xddbcda62,0xe43ae10b,0xe7d8e696,
0xe896e853,0xe9ece91f,0xeb89eac6,0xedd0ec8b,0xf055ef3c,0xf0f1f0df,0xf226f14d,0xf3e0f330,
0xf54df467,0xf893f6ed,0xf955f969,0xf94cf923,0xfab9fa0d,0xfad5fae0,0xfc4ffb57,0xfcb2fd10,
0xfa43fb58,0xfc3efaa6,0xfe46fdf2,0xfba7fd0f,0xfd65fbd9,0xfe90fec3,0xfbf2fd1e,0xfe73fc81,
0x0107005a,0x005300a7,0x02c70149,0x026a0362,0x004300d5,0x04ed01dd,0x08fa07d0,0x06ad0859,
0x040b051d,0x02620348,0x01a301aa,0x04e402dd,0x07cb06ee,0x05a60753,0x01a30389,0x012100b8,
0x06d6033e,0x0fde0b70,0x1439130d,0x12091382,0x12b11155,0x1d2816af,0x2b3f248e,0x31bf2fb4,
0x315c31cc,0x34f531fb,0x40d13a39,0x4cd64791,0x4e3f4f50,0x46d24aca,0x425b43c7,0x44f942f3,
0x479446f1,0x450046de,0x3ef0422d,0x3cdf3cea,0x408c3e87,0x438e4283,0x413d4374,0x38143d92,
0x277e3105,0x0f3a1c4a,0xef05002e,0xca48dca1,0xab1fb93a,0x993fa022,0x93879512,0x95409390,
0x9a2297a7,0x9dea9c2c,0xa1a29f8c,0xa7dfa451,0xb053abe7,0xb9c4b4c0,0xc4c9bf29,0xcea5c9f8,
0xd6a1d2b8,0xde5ada8b,0xe466e1ba,0xe83ae68a,0xeaf9e9dc,0xec46ebb5,0xee4fed2f,0xf041ef79,
0xf184f0d3,0xf35df27a,0xf3fdf3e9,0xf52ff43f,0xf7d4f6a2,0xf917f891,0xfac5f9cc,0xfbd5fbac,
0xfaf9fb62,0xfcabfb69,0xfdaafdcc,0xfb66fc7d,0xfc26fb50,0xfd06fd0b,0xfb90fc33,0xfd76fc0f,
0xff1cfec7,0xfe55fea4,0xffc9fed9,0xfff9004e,0xff7fff64,0x034700f1,0x06340554,0x052005eb,
0x04ed04ad,0x067505a3,0x08630755,0x0aa5099f,0x0a340aff,0x06a8088b,0x05050555,0x070105b7,
0x09560858,0x08d909a5,0x04c00702,0x027f02ff,0x06d003c0,0x0f680b18,0x145f12ac,0x13701471,
0x13a712ba,0x1b8716d7,0x266a210c,0x2dda2afd,0x30782f79,0x347831fd,0x3dfb38a1,0x47834383,
0x49b14985,0x46a5489e,0x437f44b3,0x4420436a,0x45b5451a,0x44484582,0x417842a3,0x41e9414a,
0x44cb430c,0x49a8470f,0x4cab4ba0,0x48fb4bc1,0x3d4e43e9,0x29133460,0x090f1a6a,0xe2acf5c7,
0xc0cdd0d5,0xa8a1b399,0x9be6a103,0x995b99e6,0x9a749a0b,0x9c579b64,0x9ff69e0f,0xa4eba27b,
0xabd6a81a,0xb622b0e1,0xc0b7bbc0,0xcaafc5de,0xd3eacf9f,0xdb62d804,0xe161dea6,0xe5a2e3e3,
0xe8b2e73e,0xebbcea56,0xed40ecb1,0xeef3edfe,0xf10df025,0xf1acf192,0xf2d0f209,0xf497f3e4,
0xf5b9f516,0xf8cdf719,0xfac5fa51,0xf9fefa79,0xfb50fa4d,0xfc90fc6d,0xfb00fbde,0xfb27fada,
0xfadcfb5e,0xf92bf9f2,0xf9acf931,0xfa59fa37,0xfa79fa50,0xfc28fb3d,0xfc32fca9,0xfa1efb20,
0xfb43fa26,0xfeeafd23,0x01570072,0x018701be,0x001a00fc,0xffa4ff82,0x030a0105,0x068e0528,
0x06c90734,0x03df0592,0x01a1027d,0x02a301b6,0x054a0432,0x04be0594,0x0129033f,0xfea7ff4f,
0x033d0017,0x0b2e0748,0x0f850e33,0x0f390fa8,0x10590f59,0x169e12c1,0x20ee1bc6,0x279b2505,
0x2a72291c,0x2f6f2c65,0x380f338a,0x3f9e3c31,0x42c741e9,0x40a54227,0x3e7b3f2d,0x3f063e9b,
0x3eeb3f3a,0x3d543e25,0x3cbb3ce5,0x3d313ccb,0x40ed3e86,0x47d6445e,0x4d424b1b,0x4e984ebb,
0x494d4d39,0x394e4317,0x1cf12cc1,0xf8790bb6,0xd2a9e54b,0xb402c1e3,0xa21fa976,0x99ce9cff,
0x974c97e2,0x981a9766,0x99e698e5,0x9dbe9b59,0xa57fa130,0xaf71aa45,0xba04b4b8,0xc3d8bef8,
0xcd62c897,0xd613d1df,0xdc69d980,0xe119debb,0xe51be33e,0xe754e652,0xe9dbe870,0xec5deb4a,
0xed69ecfe,0xeeeaee0b,0xeff1efb4,0xeffbefc8,0xf346f12b,0xf6e7f57c,0xf7acf779,0xf90df833,
0xfa56f9ec,0xfa53fa58,0xfafbfa95,0xfafefb2f,0xfa02fa7d,0xfa43f9f9,0xfa17fa6f,0xf927f97a,
0xfa81f984,0xfc94fbae,0xfc72fcc8,0xfbe1fc08,0xfc68fbf7,0xff15fd79,0x024d00e2,0x02b002fa,
0x006501a0,0x0017ffc9,0x02f2012f,0x0711051d,0x079107f1,0x049e0655,0x019502db,0x01b5012e,
0x03f402cb,0x03c70474,0xff2801bb,0xfd29fd5c,0x0130fe8f,0x08070498,0x0c790adb,0x0c770cd9,
0x0d310c35,0x141f0fdb,0x1d2518d1,0x238a20ad,0x27de25e0,0x2c8929fd,0x34273001,0x3c27389a,
0x3f1c3e69,0x3f113f30,0x3f1b3f3b,0x3ddc3eb1,0x3cb73d31,0x3c2b3c8d,0x3adf3b9d,0x3c113aee,
0x41523e5d,0x47ef4486,0x4f3b4b60,0x558452af,0x54d6564b,0x49db506f,0x348a4065,0x133c24f0,
0xeb89ff3e,0xc8cfd917,0xb011bb3f,0xa1b1a7e8,0x9b219e11,0x986799e0,0x987d987a,0x9c199a4e,
0xa2f89f8c,0xac03a7b1,0xb570b11c,0xbf68bab1,0xca20c549,0xd334cf6c,0xdacdd798,0xe0f7de90,
0xe4eee37e,0xe8abe707,0xeba0ea9d,0xed27ec84,0xefaaee49,0xf164f0e1,0xf112f13c,0xf25af15c,
0xf51af3b2,0xf75df643,0xf9bbf879,0xfb6bfad0,0xfbbefba4,0xfc70fc14,0xfcd2fcc7,0xfc75fcb0,
0xfcedfc8f,0xfcb0fd28,0xfa96fbb6,0xf96ef9ca,0xfa71f9b9,0xfc6bfb70,0xfdd6fd52,0xfd39fdc1,
0xfcfdfcd4,0xfef3fdc8,0x01b20062,0x02a90290,0x017b0238,0x00f800fc,0x035801e2,0x067e050e,
0x07f9078c,0x060e0778,0x02b00422,0x02910228,0x04320377,0x03500433,0x001601d2,0xfdbdfe8e,
0x000cfe1a,0x065b0325,0x09d308b0,0x09ff09fc,0x0be40a92,0x10f60e30,0x1852149b,0x1f1a1c24,
0x22c42120,0x277c2493,0x2eca2aeb,0x348531ec,0x3845366f,0x3b1339f0,0x3b1d3b78,0x39d13a97,
0x3861393f,0x362d376b,0x3536355f,0x37ca3621,0x3c943a20,0x43663fc2,0x4d354841,0x55df5234,
0x594b5865,0x55f958c1,0x4774505f,0x2ba83b47,0x06d61a18,0xe0b8f348,0xc221d000,0xadb0b654,
0xa183a638,0x9b529d5c,0x9904994e,0x9add9944,0xa0049d3e,0xa6a2a34e,0xaf97aaf0,0xba2eb4e6,
0xc396bec4,0xccebc7f3,0xd536d13b,0xdb47d867,0xe139de53,0xe52ce3b7,0xe6d8e624,0xe96fe7e3,
0xec7deb21,0xed79ed2b,0xee3fedce,0xefa8eeea,0xf18ef08d,0xf455f2cc,0xf6d8f5cc,0xf821f781,
0xfa06f8f9,0xfb90faef,0xfbc4fbc5,0xfc2efbdc,0xfc67fc70,0xfb52fbf5,0xf98efa84,0xf813f89a,
0xf8d0f828,0xfadef9cf,0xfc0ffbb3,0xfba4fbf7,0xfb3afb58,0xfc8ffb95,0xff10fdeb,0xffe8ffb5,
0xffbaffd5,0xff60ff7b,0x0092ffa3,0x03c00205,0x0559050e,0x035004a8,0x010d0205,0x00af009a,
0x01f10138,0x0246027a,0xff270110,0xfc9efd5d,0xff2cfd51,0x03fa01a0,0x07ba060e,0x09ad08ea,
0x0b690a55,0x10830d64,0x17d21435,0x1cec1aa3,0x21161edf,0x264023a5,0x2b862904,0x30e92e38,
0x35c13390,0x3806372c,0x3895386b,0x3810387d,0x35bb371c,0x3371344c,0x3380332d,0x358a3445,
0x3a71378c,0x427e3e26,0x4bda4711,0x54dc5073,0x5ac75872,0x59c75b47,0x4f2855e7,0x387b456c,
0x171b28d9,0xf1c2044d,0xcf8fdfa6,0xb6aec1e0,0xa7caae9b,0x9f3ea319,0x9bfd9cf5,0x9cdc9c0d,
0x9fa89e03,0xa574a229,0xad70a95a,0xb5e2b178,0xbf42ba6c,0xc8b7c433,0xd0afcceb,0xd830d477,
0xddfedb66,0xe156dfda,0xe4ace2e9,0xe834e690,0xea8ee97a,0xeccdeba3,0xeecaeddc,0xf06bef8f,
0xf297f161,0xf4d7f3cf,0xf6a5f5b4,0xf935f7d5,0xfb62fa6d,0xfc6cfc07,0xfcb5fc9f,0xfc81fcb0,
0xfbbffc2a,0xfac9fb48,0xf991fa34,0xf8c2f90d,0xf8d4f8ac,0xf9acf931,0xfa58fa12,0xfafcfa98,
0xfc70fb9e,0xfdfafd48,0xfec0fe6f,0xff87ff18,0x0079fffc,0x01ad010a,0x03040265,0x03c50375,
0x041303f1,0x045d0440,0x04330459,0x03e90403,0x036703c3,0x01d602b8,0x003c00f4,0xffacffd0,
0x001cffba,0x02620107,0x054c03dc,0x084506b4,0x0c840a31,0x117f0f11,0x15c813ad,0x1a4e17f7,
0x1f121caf,0x243321a1,0x298c26cf,0x2ede2c44,0x33163125,0x362c34c8,0x37eb3736,0x37b53821,
0x35ca36e2,0x343034d9,0x340033eb,0x3591347d,0x3a423774,0x421e3dee,0x4b494695,0x553c504d,
0x5d2d59b8,0x5ed65f09,0x58455c98,0x47725158,0x2a643a6b,0x046e17e7,0xdf1ff131,0xc15bcf3e,
0xad94b5fd,0xa2d7a73b,0x9e289ffd,0x9d849d49,0x9fcd9e65,0xa2e2a151,0xa793a4d3,0xaf6eab32,
0xb842b3dc,0xc0f0bc9b,0xc9e9c567,0xd188cdf7,0xd75dd49b,0xdc45d9ec,0xe02cde4f,0xe398e1e1,
0xe71ee55a,0xea21e8bd,0xecb1eb5f,0xef8aee1b,0xf221f0e5,0xf452f344,0xf698f567,0xf94bf7ee,
0xfbdefaa4,0xfd65fcd2,0xfdb3fda5,0xfd60fd93,0xfc2efce3,0xfa81fb58,0xf932f9c2,0xf85cf8c1,
0xf7e4f80d,0xf7b1f7cf,0xf750f77f,0xf793f746,0xf989f857,0xfc4dfaf4,0xfdfafd5c,0xfdc6fe19,
0xfd32fd56,0xff04fdba,0x029a00d0,0x040f03c3,0x02c8039a,0x01a601ff,0x03470217,0x063104d5,
0x066a06cf,0x032e0516,0xffc90136,0xff70ff31,0x013f0043,0x025401f7,0x02d8028e,0x04c8037f,
0x09ba06e9,0x0fe20ce0,0x1458126e,0x177a15e1,0x1b9c1965,0x20a01e00,0x26cc239b,0x2c7a29ce,
0x30e22ed3,0x34ca32d5,0x37c7368c,0x38a9386c,0x383638a0,0x36913777,0x357e35d0,0x369a35c5,
0x399d37dd,0x3f7d3c12,0x483743b6,0x51684cb9,0x5ade5642,0x61265eb6,0x5fac6186,0x55d85bd1,
0x412d4d21,0x200731ff,0xf88d0c72,0xd46be591,0xb939c592,0xa911afc5,0xa172a480,0x9e8b9f8f,
0x9ee69e5a,0xa0d39fd2,0xa336a1ec,0xa7dea512,0xaf9bab8a,0xb7f2b3c1,0xc046bc14,0xc873c46e,
0xcf6ccc20,0xd53cd26d,0xda2fd7d9,0xddfadc2a,0xe1b4dfd3,0xe55de38e,0xe8b5e714,0xec0dea54,
0xef9bedda,0xf2bff139,0xf590f435,0xf80ef6d0,0xfacaf96a,0xfd66fc28,0xfecdfe56,0xfea4fedc,
0xfdc4fe34,0xfc0dfd09,0xf9e9faf4,0xf892f916,0xf7e4f83c,0xf725f77b,0xf6acf6e5,0xf642f672,
0xf6aaf641,0xf94ff7b4,0xfcc6fb29,0xfe2efdd3,0xfd3ffdea,0xfc90fca1,0xff51fd72,0x03ea01bd,
0x04e30509,0x027d03cc,0x01960199,0x04a202b7,0x085706c3,0x07d308c0,0x033905ca,0xff8200e1,
0x0026ff59,0x026f0161,0x02d802e7,0x02c202ae,0x04c80361,0x0a2c071c,0x10b20d8b,0x14f21337,
0x17ad1639,0x1c1819a9,0x21861eb9,0x27df24a0,0x2da22aee,0x31fd2ff7,0x35df33e5,0x390637b8,
0x39f939b4,0x39a239f9,0x383038fc,0x375f378d,0x38d837d4,0x3bf73a38,0x41b93e5c,0x4a6245ed,
0x53434ec8,0x5c4b57e6,0x62045fe5,0x5f9d61f8,0x54f05b48,0x3faf4bec,0x1dde3029,0xf6230a0f,
0xd279e34f,0xb7ebc3fb,0xa887aed8,0xa17ca448,0x9eaf9fb5,0x9f099e79,0xa0f39ff6,0xa31fa1f6,
0xa798a4dc,0xaf54ab41,0xb791b373,0xbfccbba5,0xc7f8c3f2,0xcef8cba7,0xd4dad200,0xd9e1d783,
0xddacdbdd,0xe16ddf85,0xe52de352,0xe89ae6f0,0xec02ea40,0xefa3edd9,0xf2d0f147,0xf5a1f448,
0xf81df6e0,0xfad7f978,0xfd70fc33,0xfed1fe5d,0xfea4fedd,0xfdc4fe34,0xfc0dfd09,0xf9e9faf4,
0xf892f916,0xf7e4f83c,0xf725f77b,0xf6acf6e5,0xf642f672,0xf6aaf641,0xf94ff7b4,0xfcc6fb29,
0xfe2efdd3,0xfd3ffdea,0xfc90fca1,0xff51fd72,0x03ea01bd,0x04e30509,0x027d03cc,0x01960199,
0x04a202b7,0x085706c3,0x07d308c0,0x033905ca,0xff8200e1,0x0026ff59,0x026f0161,0x02d802e7,
0x02c202ae,0x04c80361,0x0a2c071c,0x10b20d8b,0x14f21337,0x17ad1639,0x1c1819a9,0x21861eb9,
0x27df24a0,0x2da22aee,0x31fd2ff7,0x35df33e5,0x390637b8,0x39f939b4,0x39a239f9,0x383038fc,
0x375f378d,0x38d837d4,0x3bf73a38,0x41b93e5c,0x4a6245ed,0x53434ec8,0x5c4b57e6,0x62045fe5,
0x5f9d61f8,0x54f05b48,0x3faf4bec,0x1dde3029,0xf6230a0f,0xd279e34f,0xb7ebc3fb,0xa887aed8,
0xa17ca448,0x9eaf9fb5,0x9f099e79,0xa0f39ff6,0xa31fa1f6,0xa798a4dc,0xaf54ab41,0xb791b373,
0xbfccbba5,0xc7f8c3f2,0xcef8cba7,0xd4dad200,0xd9e1d783,0xddacdbdd,0xe16ddf85,0xe52de352,
0xe89ae6f0,0xec02ea40,0xefa3edd9,0xf2d0f147,0xf5a1f448,0xf81df6e0,0xfad7f978,0xfd70fc33,
0xfed1fe5d,0xfea4fedd,0x0000fe34,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
};
static const PROGMEM uint32_t sample_2_SynthBass2_SYBS272A[1536] = {
0xff820000,0xfd93fe7b,0xfc02fc5d,0xf8e0fac1,0xf710f6d3,0xf2aaf5d1,0xeccfee92,0xe64be9fc,
0xde54e1bc,0xd75ad98f,0xdfe4d864,0xf51be9ae,0x0c980026,0x1bb71595,0x1bc51c70,0x11ff1738,
0x076c0a7c,0x00a403f5,0xef56f7fe,0xacf1d112,0xccffa903,0xbb57bba2,0xb4d7c748,0xc51ec0c7,
0xe3dadd88,0xf4b5f3d4,0xed1cfabe,0xead2ebf5,0x0067f5b7,0x1dde1179,0x32b82c09,0x32683759,
0x26c12e7e,0x168b1ebd,0x18f0156d,0x22fe1d23,0x3d3f2f40,0x63855368,0x7c277aa1,0x5b017514,
0x0c413d7b,0xe0fcee12,0xd23ddb8e,0xc68bcfdb,0xdac1cba4,0xf00fe602,0xf4def26f,0xd9afe664,
0xcea2cfd6,0xdacbd1dd,0xf2c1e55e,0x07e4fe2c,0x0c690b40,0x058e0a74,0xfa46ff48,0xf932f9b2,
0xff46fb3b,0x147e06c1,0x3796208a,0x5a824af7,0x4e3f5717,0x08192f2c,0xe2c3ec51,0xd16ed52f,
0xbc50c47e,0xd6e8c9d8,0xe8f4e3eb,0xed1df2c6,0xd538e119,0xd2ffd13f,0xe5b0db0e,0x0173f42e,
0x13000d08,0x145415e8,0x08990faa,0xfdad0169,0xfa9dfa35,0x0008fb5e,0x14e90aef,0x3c112783,
0x59625240,0x4d855bb8,0x0c7231dc,0xe506f8bb,0xd08fdbcc,0xbbdebbe4,0xd9c3ca65,0xef16e23e,
0xef62f5ba,0xda78e2e7,0xdaa5d7a2,0xee3de24e,0x09e5fc47,0x1be313ed,0x1eda1efe,0x15bd1aed,
0x0d2f11ec,0x0b1c0c96,0x13370c78,0x273d1a75,0x4fca3829,0x646a5c9c,0x554e62eb,0x22a539ed,
0xfb120bb5,0xda85f0f0,0xc680c595,0xdcb3d461,0xf2dfe740,0xec3ef562,0xd8fee0aa,0xd978d69e,
0xec2be0a9,0x0301f7fd,0x118f0bd1,0x10ad12f2,0x07be0bfb,0xfea80125,0xf9cafafb,0x0147fb9c,
0x146308b3,0x3a4228e9,0x52c5492b,0x44bb551f,0x18ec3002,0xf4b40324,0xc265e473,0xba2fb01f,
0xd0c7c64c,0xe9c3ddcc,0xe265e9fe,0xd3dcd872,0xd7d9d2c0,0xec22e057,0x0350f793,0x11db0bab,
0x120812d9,0x0a1e0f4e,0x02320683,0xfd35ff3c,0x04df00c9,0x1c3d0c6f,0x3fa42ed0,0x585e4db2,
0x49ad5561,0x2688395b,0x0b4a15b1,0xc779f14a,0xc0dbb9c0,0xd3f5c93c,0xecfde28b,0xe4ceebdd,
0xd920dc7f,0xdfd2da0a,0xf2ffe7f7,0x079afdec,0x12870f42,0x12a213e4,0x0bb70f6c,0x047f0811,
0x01640021,0x064f02aa,0x1fdc1033,0x3f603077,0x54ba4e1d,0x470f511d,0x29433954,0x15c91e9b,
0xc259edfc,0xbca2b816,0xcf89c3e9,0xe4d1ddf8,0xdabce27e,0xd252d40f,0xda7bd4ad,0xeefae46e,
0x03b8fa54,0x0d8409fc,0x0c750e5c,0x05c708eb,0xfb9f0153,0xf930fa17,0xff1dfa01,0x1aad0b3d,
0x3acd2a54,0x4dbc4846,0x426d4a2b,0x297135bd,0x1a18262c,0xbc7ae76e,0xb717b3e6,0xcdf9bf1f,
0xe364dd30,0xda8ee0c4,0xd567d6b2,0xdf49d8a6,0xf2cfe851,0x051dfcf7,0x0ed30b1c,0x0d9d0f6c,
0x08e80c9c,0x011a03e9,0xfd3ffe8d,0x054bfdfe,0x1f2310e7,0x3ebd2ee3,0x4d814a50,0x441a4acb,
0x338538be,0x248c34c8,0xc128eb6d,0xb615b65d,0xcb80bd64,0xdb57d8f4,0xd5d7d8e2,0xd693d46c,
0xe4f5dc74,0xf8dcef07,0x073e0110,0x0b980b1c,0x08de09aa,0x0182053f,0xfcaafe7f,0xfa9bfad7,
0x0737fe5c,0x20f312c4,0x3e3d3034,0x475345c7,0x3c1243fa,0x34d133c3,0x2609390a,0xc043ea10,
0xb225b3f5,0xc88eb9a0,0xd2dfd197,0xd019d137,0xd47fd0d3,0xe5f6dc17,0xf9d9f00a,0x09280204,
0x0c460b64,0x0a1d0c41,0x032a0641,0xfc26ffc0,0xf8ebf8ad,0x0589fccd,0x2064110d,0x3dc330d4,
0x477c44e3,0x3ca2440b,0x3df138a3,0x2c484256,0xc35dee45,0xae8bb1ce,0xc49db7a5,0xd050ce56,
0xd2c0d160,0xdae5d4d8,0xed0de33b,0xfecaf5e5,0x09df0695,0x0c5f0b97,0x08290b19,0x036d05a0,
0xfc43000b,0xfb40fa10,0x07acffdf,0x22781349,0x3ae030a9,0x42b24148,0x38513dc0,0x41e638dd,
0x31c947b8,0xc7c5f3bb,0xae88b06d,0xc1a8b461,0xca20c733,0xcdbccc1a,0xda19d286,0xedd9e419,
0x016cf7f9,0x09bf068c,0x0a610afe,0x0493074a,0xff6e0224,0xf8c2fba3,0xfb30f82c,0x0944005c,
0x2575167f,0x3adb3177,0x3eb33fc3,0x352e38cc,0x434b3840,0x348449e6,0xc86bf914,0xacefb1a8,
0xbdfcb4c4,0xc809c4f9,0xce18ca2d,0xdd56d3fa,0xf1b2e680,0x0398fc01,0x0bc2088a,0x0a640c38,
0x0547079f,0xff570284,0xf959fb53,0xfcddf9c6,0x0bb201c3,0x267418f9,0x3a23313f,0x3adb3da6,
0x347a3598,0x47103951,0x3a404c1c,0xca02fd2a,0xac0fb02b,0xb9b7b140,0xc426c194,0xcdd6c8d9,
0xdf58d71e,0xf594eadf,0x04d5fee6,0x0ab209ac,0x072709d5,0x023a0523,0xfbf6ffe9,0xf840f949,
0xfbdff97f,0x0ca3020a,0x252c193a,0x38122ffe,0x36273a1f,0x32cb3233,0x48193ac3,0x3dd2501b,
0xc922027b,0xa83eb055,0xb671adc5,0xc173bdc1,0xce4dc6c6,0xe01fd66e,0xf5b7ebd3,0x055cfe6a,
0x0aec0a0e,0x086d0a7b,0x0355062b,0xfbc0ffc2,0xf8ccf9b2,0xfc91f951,0x0e9503cc,0x264c1a5a,
0x38be311c,0x351638e8,0x34a63142,0x4c503c9c,0x433552b6,0xcb8c0513,0xa5dfb12f,0xb331acf9,
0xbe68bc18,0xccbac6c2,0xe0e3d6bc,0xf599ecc9,0x05f4ff5c,0x0ab20a0e,0x08640a7e,0x02d80675,
0xfb81feb8,0xf829f9ba,0xfd1bf8fe,0x0e500439,0x255f194b,0x36182f84,0x31433542,0x33dd2fbf,
0x4dab3e0c,0x44775610,0xcc7706f7,0xa372ae03,0xb05ca9b8,0xbce7b79e,0xcd18c50f,0xe2fbd835,
0xf788eddf,0x06670100,0x09e109a4,0x072c0920,0xffe4044a,0xfa51fc47,0xf7b1f857,0xff04f9af,
0x0fb505d0,0x26371a62,0x34882f31,0x2f4b31fc,0x33db2db7,0x50693e50,0x460f581c,0xce430bae,
0xa33daf02,0xae30a9dd,0xbb98b6e6,0xcdf0c547,0xe3f0d9f8,0xf9e8ef75,0x07fe0285,0x0b500a9f,
0x08960a94,0xffd603fe,0xfa49fc7a,0xf7a9f7aa,0xff6afa41,0x0fd805d6,0x267d1ab6,0x33162f34,
0x2ded30ce,0x33f32e17,0x52ca4056,0x45d6594f,0xcc760e82,0xa154aee3,0xac1ba78c,0xbadeb41e,
0xcf9ac418,0xe55bd985,0xfb05f036,0x07a50226,0x0a740930,0x06340913,0xfe430169,0xf954fb34,
0xf908f77c,0x0096fbf5,0x0ff606af,0x257b1a99,0x2f952cd5,0x2b602d18,0x33802c4b,0x54d84276,
0x473d5a59,0xcc861167,0x9f6caf15,0xa8a2a65a,0xb92fb154,0xcfbdc3be,0xe74cd9c8,0xfd42f230,
0x091803ce,0x0c170aca,0x05c0095e,0xfd990105,0xf88afab6,0xfa18f850,0x01c7fdb3,0x116b083f,
0x26651c45,0x2e182cfe,0x2a682c42,0x34932be8,0x56c64512,0x488f5c05,0xce5212df,0x9fc7ad5a,
0xa6a1a387,0xb863aed1,0xcea8c387,0xe7b0da87,0xfd61f344,0x08e60408,0x0b4f0b57,0x03da083f,
0xfc00ff7a,0xf827f94a,0xfad3f8a2,0x018bfe2e,0x114d086e,0x25c61cc2,0x2c502bc9,0x29342b32,
0x36682bfa,0x5873484f,0x48b75da4,0xccbd13b0,0x9dbeabed,0xa3e59f73,0xb833ab75,0xceffc1e8,
0xe992db32,0xfe5bf476,0x0a5504c1,0x0b300bf8,0x0300078d,0xfb4dfefa,0xf866f95e,0xfc1afa20,
0x0228fe9c,0x12610909,0x25a41d57,0x2af22a6c,0x280e2992,0x38bd2c85,0x5af34a65,0x4a3c5e3d,
0xccc513ab,0x9bd5abba,0xa0b69c97,0xb6e2aa96,0xcfb6c1a1,0xebd1dd82,0x0013f699,0x0bb60762,
0x0a640cc0,0x00f1060c,0xf93ffd3f,0xf861f7f5,0xfc4cfae5,0x037bff36,0x150f0b10,0x26b21f6a,
0x2a902a51,0x271d2811,0x39392c72,0x5b114a7a,0x49ce5df5,0xccba11c0,0x998dabce,0x9eec99ce,
0xb572a9f8,0xd013c1bc,0xec35df39,0x010cf731,0x0bc407eb,0x08bb0bd2,0x000d03c3,0xf89afb8b,
0xfa41f827,0xfcfafb7d,0x0412ffbb,0x15c20bf5,0x25cc1f65,0x28cd2950,0x271426b5,0x3b482e02,
0x5be24d53,0x48a95ef9,0xcdbd11bb,0x978bac23,0x9df797be,0xb519a8b4,0xd2ccc204,0xee47e087,
0x036df907,0x0c7d08f5,0x06870ab9,0xfe24028c,0xf7c2f99b,0xfaddf933,0xfde9fb9b,0x05dd0045,
0x17a80d8b,0x25f91f98,0x26fe27bc,0x268924e3,0x3c6b2e4b,0x5cb64ddd,0x47c15e91,0xcea11169,
0x94fcac52,0x9c4a966c,0xb3c3a6e4,0xd361c28e,0xef3ee104,0x04b0faaa,0x0c790a18,0x05c608a4,
0xfc5b0127,0xf856f805,0xfa69f9a2,0xfddbfb95,0x072000fd,0x18e10f35,0x25ec2079,0x25c626cf,
0x263d237f,0x3c962e89,0x5c034d61,0x45c55d78,0xd0531129,0x93baa9d8,0x9b4b9440,0xb40fa4c9,
0xd428c364,0xf0c0e1d8,0x05cefbe7,0x0a7a0a5f,0x04ff0777,0xfb11fff0,0xfa39f908,0xfae9fa83,
0xfea2fc57,0x08860268,0x19e010e0,0x2557212c,0x24cb25e5,0x285823e7,0x3f8f3142,0x5e2d506f,
0x45ee5e11,0xd2f21354,0x94a9a961,0x99af9317,0xb3cca37d,0xd2cdc33b,0xf0a2e280,0x067cfd5c,
0x08db0990,0x04260713,0xfaf8fde5,0xfacff9ee,0xfac8f9fe,0xfe8afc36,0x08e302d9,0x19b31177,
0x23221ff6,0x22952364,0x27de22af,0x3f8b315f,0x5dab501b,0x45d25c89,0xd5e616ea,0x97c3ab0a,
0x998892c4,0xb2d1a367,0xd047c17f,0xef4be09e,0x0465fc78,0x08280688,0x039d078c,0xfe25ff6a,
0xfcdcfde7,0xfb99fb80,0xfe88fc42,0x0836024d,0x183810c1,0x21091dc3,0x21e321ad,0x2a0823ec,
0x424f3455,0x5dfe529b,0x47be5cad,0xd8dc1a87,0x9afbad13,0x98bb8fbd,0xaf3ca2da,0xcd21c097,
0xf09cdff6,0x03fafb8c,0x09a0067c,0x03b808bf,0x01aa0294,0xfde9ffe8,0xfbb5fbc8,0xfe10fc47,
0x0819022f,0x16e51015,0x1eb31b9b,0x20a31fcb,0x2b262445,0x436e359b,0x5c6452a0,0x48c75b48,
0xdb0c1cf8,0x9d13af39,0x97688fe0,0xad76a4a7,0xce5fbe29,0xf086de4b,0xff98f99b,0x085106ec,
0x04fd062d,0x03fe0462,0xfe08019a,0xfc4afce2,0xfe74fc54,0x0797020e,0x147e0ee7,0x1b5b187f,
0x1f5c1ce8,0x2bf02468,0x4502371c,0x5c2e52eb,0x4a5a5bf6,0xdff41f39,0x9d44b195,0x95b49023,
0xab49a449,0xceeeba67,0xee19dea7,0xff0ef87f,0x083b06d2,0x07be0630,0x0527081a,0xff0c0233,
0xfbd3fcc7,0xfdf1fbfb,0x077601f1,0x138e0e3a,0x19c01710,0x1fdc1c9e,0x2de6256f,0x4647392d,
0x5b7a52ca,0x4b495ca9,0xe48720d7,0x9cf2b3d0,0x95869143,0xa9a2a2a6,0xcfc9b91a,0xea0ade31,
0xfee6f674,0x05bc03da,0x07d70611,0x050e0896,0xff650148,0xfc3efd4e,0x0012fe10,0x08bf030a,
0x121d0ea5,0x18051518,0x1f6e1b24,0x2f1725f4,0x472e3b02,0x5c8352a9,0x4c835dd9,0xe97b246d,
0x9c71b62f,0x95279275,0xa76d9e80,0xcea8b8ce,0xe621db5b,0xfe95f53d,0x05230120,0x0acc0954,
0x07ba0a88,0x014003d6,0xfddaff30,0x002ffea6,0x07870298,0x0f280c9b,0x15cf11cc,0x1eb619e1,
0x30ba2692,0x476b3beb,0x5d1c5358,0x4dc25e18,0xed252741,0x9bfeb72e,0x94749403,0xa7609b67,
0xcc6bb957,0xe530d92b,0xfd7af42f,0x05160068,0x0be40a6a,0x08af0af3,0x01dc0513,0xfea1ffe0,
0xffdbfea6,0x06910248,0x0e290b70,0x14b610a0,0x1e14191a,0x306c25ea,0x475a3bde,0x5d67536b,
0x4f235eca,0xef702972,0x9c58b84c,0x943a943e,0xa6a79a9f,0xcb6cb853,0xe485d8b1,0xfda7f36a,
0x04ea00a6,0x0ca70ac5,0x092d0b52,0x023005c5,0xfecbfffa,0xff74fe86,0x060b01de,0x0dad0abe,
0x14251028,0x1dc318ae,0x2ff72564,0x46dc3b8e,0x5d0e52dd,0x4fe65ed1,0xf2052b2e,0x9d10b9f7,
0x951c957f,0xa67e9a6e,0xca6fb7fb,0xe3c7d7fa,0xfd1af228,0x045c00ae,0x0d8e0aa1,0x09c40c05,
0x03620709,0xff780096,0xff55ff21,0x057c015a,0x0c8e09d6,0x12f20f0a,0x1cda1793,0x2f322482,
0x46ab3b30,0x5d325296,0x514b5f95,0xf5102d55,0x9d70bbf3,0x960e966d,0xa57199d0,0xc944b758,
0xe29bd67d,0xfc2af0f6,0x041f0073,0x0e660a8b,0x0aa20d35,0x04e40845,0x0003018d,0xff6dffad,
0x049f00b0,0x0b5c08f3,0x11a40d93,0x1bc91672,0x2e892390,0x46983ae5,0x5d7f528d,0x52f4607e,
0xf7fd2fba,0x9dc4be1c,0x971596d3,0xa3e0997c,0xc875b65a,0xe0e4d4e6,0xfb80efe0,0x03c3ffe8,
0x0f2e0aa5,0x0bb70e52,0x06690990,0x00c302b2,0xffb00043,0x03af003e,0x0a52080d,0x10230c1c,
0x1abc1557,0x2db72267,0x46823a94,0x5dcd5272,0x54b96192,0xfaf73235,0x9e41c06d,0x97f596ef,
0xa249996a,0xc7d7b4f7,0xdefed3b3,0xfb2eeea9,0x033aff7e,0x100c0acc,0x0c860f2a,0x07b10ab7,
0x01440389,0xffe000cb,0x02f4ffd4,0x09890758,0x0ef60b05,0x19f0146e,0x2cfb2186,0x465c3a3d,
0x5dc65248,0x56406247,0xfd98345e,0x9f0dc28f,0x98ab972d,0xa14e99c1,0xc73bb392,0xdd48d310,
0xfabbecf8,0x0243ff5c,0x10e70a39,0x0d031054,0x09760b9c,0x01c004ea,0x00c50180,0x0211ffc2,
0x08ee06af,0x0d3a09b0,0x18f31335,0x2b9d201d,0x462639a4,0x5da651e4,0x58256336,0x00c436e2,
0xa003c52c,0x99e097a7,0xa0279a72,0xc66db1de,0xdb2dd259,0xf9e9ea93,0x011aff37,0x11ae092e,
0x0db911e9,0x0b790c5c,0x028706f8,0x01e801fb,0x01150032,0x0868058d,0x0b08088c,0x17f0115d,
0x29c51eb9,0x462538ae,0x5d4f51a3,0x5a626403,0x03fa39b8,0xa13ac81a,0x9b0b97fe,0x9f369b90,
0xc558afbb,0xd930d1ea,0xf894e78f,0x0030ff65,0x11ff077e,0x0eda1401,0x0d2f0ca5,0x03df09b4,
0x02d70216,0x008b0170,0x07a703f4,0x090007f6,0x169e0ed5,0x27e11dc9,0x45ee36e9,0x5cef51e2,
0x5cb3644a,0x07403d21,0xa2abcace,0x9bf79883,0x9e929c8f,0xc3f3ad9f,0xd7b6d179,0xf6e0e4ba,
0xffe0ff94,0x11a905ea,0x107215d5,0x0e000cc7,0x05990c1c,0x02f6021e,0x00bd0289,0x067d0287,
0x080207af,0x14f90cac,0x26e01d2e,0x452a353d,0x5d005236,0x5e2e6445,0x0a8d403e,0xa3d6cd38,
0x9cff9921,0x9e4b9da9,0xc272abc4,0xd6a2d130,0xf45ee1c3,0xffe1ff6d,0x103c0406,0x12d21760,
0x0e2e0d32,0x08bf0e9f,0x02c602f5,0x023903c5,0x048a01c2,0x077b06e3,0x12050a6c,0x25ea1b8b,
0x433a3357,0x5d7f51d5,0x5f606493,0x0f2d43aa,0xa51dd0a5,0x9edb99d4,0x9e429fc3,0xc09ba976,
0xd583d0fc,0xf0bede0a,0x0001feb2,0x0dd501f0,0x15e81846,0x0e020e78,0x0cdb10a3,0x02a50554,
0x043d044c,0x02a20257,0x06ce04eb,0x0edf0909,0x244a1870,0x4134320a,0x5d7b5047,0x60da657f,
0x13a84685,0xa71bd4f9,0xa07d9a3a,0x9f3ca2b1,0xbddfa70e,0xd553d0b5,0xebd6da86,0x00b8fcec,
0x0a69008b,0x192d179b,0x0db71116,0x10da112d,0x036c0977,0x05b203be,0x02110478,0x04ef0237,
0x0ce0084f,0x211e14c9,0x40053086,0x5c204e75,0x62ff65e4,0x17a349b7,0xa9c4d901,0xa1df9b3e,
0xa12da580,0xbacca5a1,0xd5c7cfb1,0xe6b9d843,0x0124f9ad,0x07530073,0x1b15154b,0x0e78148c,
0x12fb1098,0x05d10dd5,0x05a1033d,0x03490655,0x025b00aa,0x0c470711,0x1dd612c2,0x3f332e0f,
0x5ac74dd1,0x6445650c,0x1b5b4ce1,0xab62dbe6,0xa32a9c2f,0xa27ca779,0xb8e5a4e5,0xd624cee2,
0xe374d735,0x00f9f6ea,0x057c00d7,0x1b8312df,0x0fd21747,0x13580fcf,0x08c410e6,0x04b20370,
0x0529071d,0x001700bd,0x0bb604fb,0x1b62121d,0x3d692adb,0x5a1c4d78,0x642c63b4,0x1fb74f8e,
0xac75df74,0xa4a29c31,0xa4d2aabf,0xb650a3fc,0xd788ce3b,0xdf90d6d9,0x00a5f30c,0x03f50201,
0x1aac0f6c,0x12431a23,0x12920f3e,0x0cc2134f,0x03a20513,0x071706c8,0xfec7025e,0x0a0f0200,
0x1a2511ea,0x3a242785,0x5a1b4c55,0x635062fc,0x2410510b,0xae28e41d,0xa5259b63,0xa8aaae7d,
0xb2efa3c7,0xd979ccab,0xdc1cd7fa,0xfef9edd7,0x03cd03b3,0x17e90bb3,0x15df1be9,0x110a1009,
0x10af13e4,0x03b708a0,0x07b30559,0xff7804d2,0x06e2ff61,0x19f410cc,0x364a2583,0x5996496d,
0x630e6348,0x271c5175,0xb12de8e6,0xa46a9af1,0xad93b13f,0xafd3a57f,0xda91c978,0xda94dab0,
0xfb0de828,0x0573049d,0x13c6097d,0x194f1b37,0x107512f8,0x12b712a1,0x06340d07,0x06880473,
0x01ab0627,0x0392fef4,0x19150dc9,0x33cc2506,0x573a45ac,0x64056346,0x28fc5265,0xb484ec54,
0xa4309c16,0xb147b2b4,0xaea0a827,0xda06c69b,0xda5cdc4c,0xf6e4e46f,0x062a0361,0x111808bd,
0x1a6e1975,0x11bc1571,0x1378128f,0x09060f9a,0x065d059d,0x02950646,0x024fff59,0x17270b91,
0x324623a8,0x551b438c,0x6426621f,0x2ad25384,0xb6fbeecc,0xa5859e08,0xb2c4b3f5,0xaf01a964,
0xd957c633,0xd925db7e,0xf4cfe2a4,0x0482016b,0x0ffd0754,0x1a7c18da,0x12b51607,0x150213ce,
0x0ab71153,0x07810711,0x03040715,0x0191ff2e,0x158c0a50,0x304b21ce,0x53684190,0x63b660eb,
0x2ca85420,0xb96bf178,0xa6a49f9d,0xb49cb566,0xaf62aacc,0xd8f9c5e2,0xd80cdb10,0xf2bde0cc,
0x02e6ff99,0x0e9f05c5,0x1a65180b,0x13701677,0x166e14d2,0x0c781311,0x08b0088a,0x03a40808,
0x00f0ff40,0x1411092e,0x2e5f200f,0x518e3f8a,0x631d5f87,0x2e3b548f,0xbbbdf3de,0xa7aba12c,
0xb65bb6b8,0xafdcac47,0xd8a9c5a0,0xd721dab3,0xf0b3df13,0x0140fdb2,0x0d260429,0x1a211713,
0x141116c3,0x17bd15c0,0x0e3a14bc,0x0a050a16,0x047a0925,0x008fff8a,0x12c10839,0x2c7f1e6a,
0x4fae3d98,0x62545e0d,0x2f9354cb,0xbde2f609,0xa89da294,0xb826b7f6,0xb087add9,0xd891c597,
0xd670da98,0xeed2dd92,0xff97fbe4,0x0b940286,0x19a215f2,0x147416d3,0x18e4167b,0x0ff6164a,
0x0b630bb2,0x05790a64,0x006a0007,0x119f0788,0x2abe1cf3,0x4dce3ba9,0x616d5c7c,0x30c754e3,
0xbfc4f7f3,0xa936a3b3,0xb9afb8dd,0xb124af48,0xd8bcc59f,0xd63edad8,0xed7edca4,0xfe7ffab2,
0x0a2e014a,0x191c14c8,0x147716cc,0x192b1665,0x11491749,0x0bee0cac,0x06aa0b1d,0x005d010a,
0x10b30692,0x29e11c5f,0x4bbf39f7,0x61385b0c,0x32ef55fb,0xc123fa7e,0xa700a29b,0xbe19b93f,
0xb09bb3ca,0xd730c145,0xdaa3df1c,0xe6c3da80,0x0130f731,0x07c80465,0x169c0ef6,0x183219d0,
0x161f15fd,0x152416e0,0x0cb210f1,0x067d097a,0x02700385,0x0d53056d,0x294419cf,0x49963987,
0x5f6857c1,0x37155773,0xc233feb1,0xa3449fbc,0xc48db9d2,0xb154baf5,0xd2fdbb82,0xe1c6e298,
0xdfcddbf5,0xffebef15,0x0a5c0909,0x0fbc0acd,0x1c161774,0x16a81ade,0x13c113cc,0x120e1431,
0x05a10c5e,0x02660196,0x0dfe0716,0x256217a7,0x4874367b,0x5e945778,0x383856a8,0xc56e0258,
0x9ee19eda,0xc874b74d,0xb5b0c2e4,0xccf1b837,0xe7a6e1c3,0xde60e1ad,0xf9c9e791,0x0f1209a0,
0x0b9c0cba,0x19ef113c,0x1b8e1e6a,0x1110150c,0x13ad11d2,0x098a1138,0xff7e018b,0x0e7704f4,
0x24cb191d,0x43a632d2,0x5e265462,0x3a1b5803,0xc786048e,0x9cc59f1c,0xcb9ab5c1,0xbc4bcaa6,
0xc73cb80b,0xea95dde1,0xe0cee844,0xf079e1fc,0x1143047e,0x0c5311ae,0x133d0bac,0x20d11d16,
0x13921be3,0x10e80f4d,0x0fd61318,0x000b0758,0x09b30087,0x262817b9,0x3fc332ff,0x58d34da3,
0x3e5f5770,0xca840a51,0x976a9d09,0xcff7b2c2,0xc5e5d550,0xc0afb953,0xebd4d782,0xe799f06c,
0xe62fdfe3,0x0ec5fa23,0x11f816f4,0x0b080a5d,0x20681536,0x1c06232e,0x0d541214,0x11380ef0,
0x07810e8d,0x04a4021c,0x22e310e5,0x41cf3454,0x529d4bd2,0x3d805139,0xd23b1020,0x91479f4a,
0xcda9a9a2,0xd4e5dea6,0xbd0cc23f,0xe508cc6c,0xf38df512,0xe1ece7bf,0x02b5ec73,0x1a4f15ab,
0x0a2c12ac,0x15ce0b22,0x2457214b,0x12641d44,0x0a550b3c,0x0d3a0c83,0x09490b18,0x1a460d63,
0x40b92d52,0x55134f1a,0x393c4f73,0xd5320e4b,0x918ba3c5,0xc7a3a413,0xddf4df67,0xc166cd37,
0xdc76c783,0xf8d9f180,0xe731f15e,0xf826e852,0x1a050d28,0x10a21957,0x0e640abb,0x21dd18f1,
0x1a792259,0x088d0fd9,0x09d10722,0x0f000cf9,0x1a361222,0x3b4628b2,0x56f84cd9,0x3c375363,
0xd4220eed,0x8faea218,0xc67fa227,0xe115e050,0xc2c9d0bb,0xd8d7c58b,0xfad0ef8a,0xeb11f634,
0xf351e7d2,0x182a07b0,0x15851c4b,0x0bd60d0d,0x1da5135e,0x1f0622c6,0x0a3114ce,0x0583048a,
0x10660aac,0x1cb015b4,0x375a27c1,0x558948b4,0x40ed559d,0xd6c713cb,0x8b3ba119,0xc3899ca6,
0xe78ae279,0xc4a6d735,0xd1f7c17e,0xfc87eb33,0xf14afcc2,0xedbde89f,0x13c1ffbb,0x1c061e66,
0x0bd11282,0x17190de9,0x22782046,0x0f571b8e,0x010304a1,0x0e500561,0x20e317f0,0x359e2a15,
0x50f943d8,0x44bf54ab,0xdcd51aa2,0x8676a271,0xbd409450,0xef3fe313,0xc9ffe126,0xc913be96,
0xfb22e301,0xfab00357,0xea6fedaa,0x0aeff649,0x218d1c43,0x10ac1b06,0x0f730b84,0x21361936,
0x178c2108,0xfff809ed,0x07d9ff48,0x2391157c,0x38cc2f32,0x4bd9426a,0x440c4fb6,0xe53c1fd2,
0x853fa872,0xb2dc8bca,0xf434de54,0xd4bdecea,0xc197c0f6,0xf387d726,0x04d50559,0xedbef83c,
0xff26efc3,0x214b135f,0x1a7e22e3,0x0bd2102b,0x19751030,0x1df42003,0x05e41331,0x00dafe15,
0x201e0dd2,0x3e9431a3,0x4b9f469d,0x40244bef,0xe8321f06,0x87cdacd2,0xafd08af3,0xf3a4dba2,
0xd6c6ee64,0xc18dc21f,0xf32fd693,0x00000559,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
};
static const PROGMEM uint32_t sample_3_SynthBass2_SYBS272A[1536] = {
0xff820000,0xfd93fe7b,0xfc02fc5d,0xf8e0fac1,0xf710f6d3,0xf2aaf5d1,0xeccfee92,0xe64be9fc,
0xde54e1bc,0xd75ad98f,0xdfe4d864,0xf51be9ae,0x0c980026,0x1bb71595,0x1bc51c70,0x11ff1738,
0x076c0a7c,0x00a403f5,0xef56f7fe,0xacf1d112,0xccffa903,0xbb57bba2,0xb4d7c748,0xc51ec0c7,
0xe3dadd88,0xf4b5f3d4,0xed1cfabe,0xead2ebf5,0x0067f5b7,0x1dde1179,0x32b82c09,0x32683759,
0x26c12e7e,0x168b1ebd,0x18f0156d,0x22fe1d23,0x3d3f2f40,0x63855368,0x7c277aa1,0x5b017514,
0x0c413d7b,0xe0fcee12,0xd23ddb8e,0xc68bcfdb,0xdac1cba4,0xf00fe602,0xf4def26f,0xd9afe664,
0xcea2cfd6,0xdacbd1dd,0xf2c1e55e,0x07e4fe2c,0x0c690b40,0x058e0a74,0xfa46ff48,0xf932f9b2,
0xff46fb3b,0x147e06c1,0x3796208a,0x5a824af7,0x4e3f5717,0x08192f2c,0xe2c3ec51,0xd16ed52f,
0xbc50c47e,0xd6e8c9d8,0xe8f4e3eb,0xed1df2c6,0xd538e119,0xd2ffd13f,0xe5b0db0e,0x0173f42e,
0x13000d08,0x145415e8,0x08990faa,0xfdad0169,0xfa9dfa35,0x0008fb5e,0x14e90aef,0x3c112783,
0x59625240,0x4d855bb8,0x0c7231dc,0xe506f8bb,0xd08fdbcc,0xbbdebbe4,0xd9c3ca65,0xef16e23e,
0xef62f5ba,0xda78e2e7,0xdaa5d7a2,0xee3de24e,0x09e5fc47,0x1be313ed,0x1eda1efe,0x15bd1aed,
0x0d2f11ec,0x0b1c0c96,0x13370c78,0x273d1a75,0x4fca3829,0x646a5c9c,0x554e62eb,0x22a539ed,
0xfb120bb5,0xda85f0f0,0xc680c595,0xdcb3d461,0xf2dfe740,0xec3ef562,0xd8fee0aa,0xd978d69e,
0xec2be0a9,0x0301f7fd,0x118f0bd1,0x10ad12f2,0x07be0bfb,0xfea80125,0xf9cafafb,0x0147fb9c,
0x146308b3,0x3a4228e9,0x52c5492b,0x44bb551f,0x18ec3002,0xf4b40324,0xc265e473,0xba2fb01f,
0xd0c7c64c,0xe9c3ddcc,0xe265e9fe,0xd3dcd872,0xd7d9d2c0,0xec22e057,0x0350f793,0x11db0bab,
0x120812d9,0x0a1e0f4e,0x02320683,0xfd35ff3c,0x04df00c9,0x1c3d0c6f,0x3fa42ed0,0x585e4db2,
0x49ad5561,0x2688395b,0x0b4a15b1,0xc779f14a,0xc0dbb9c0,0xd3f5c93c,0xecfde28b,0xe4ceebdd,
0xd920dc7f,0xdfd2da0a,0xf2ffe7f7,0x079afdec,0x12870f42,0x12a213e4,0x0bb70f6c,0x047f0811,
0x01640021,0x064f02aa,0x1fdc1033,0x3f603077,0x54ba4e1d,0x470f511d,0x29433954,0x15c91e9b,
0xc259edfc,0xbca2b816,0xcf89c3e9,0xe4d1ddf8,0xdabce27e,0xd252d40f,0xda7bd4ad,0xeefae46e,
0x03b8fa54,0x0d8409fc,0x0c750e5c,0x05c708eb,0xfb9f0153,0xf930fa17,0xff1dfa01,0x1aad0b3d,
0x3acd2a54,0x4dbc4846,0x426d4a2b,0x297135bd,0x1a18262c,0xbc7ae76e,0xb717b3e6,0xcdf9bf1f,
0xe364dd30,0xda8ee0c4,0xd567d6b2,0xdf49d8a6,0xf2cfe851,0x051dfcf7,0x0ed30b1c,0x0d9d0f6c,
0x08e80c9c,0x011a03e9,0xfd3ffe8d,0x054bfdfe,0x1f2310e7,0x3ebd2ee3,0x4d814a50,0x441a4acb,
0x338538be,0x248c34c8,0xc128eb6d,0xb615b65d,0xcb80bd64,0xdb57d8f4,0xd5d7d8e2,0xd693d46c,
0xe4f5dc74,0xf8dcef07,0x073e0110,0x0b980b1c,0x08de09aa,0x0182053f,0xfcaafe7f,0xfa9bfad7,
0x0737fe5c,0x20f312c4,0x3e3d3034,0x475345c7,0x3c1243fa,0x34d133c3,0x2609390a,0xc043ea10,
0xb225b3f5,0xc88eb9a0,0xd2dfd197,0xd019d137,0xd47fd0d3,0xe5f6dc17,0xf9d9f00a,0x09280204,
0x0c460b64,0x0a1d0c41,0x032a0641,0xfc26ffc0,0xf8ebf8ad,0x0589fccd,0x2064110d,0x3dc330d4,
0x477c44e3,0x3ca2440b,0x3df138a3,0x2c484256,0xc35dee45,0xae8bb1ce,0xc49db7a5,0xd050ce56,
0xd2c0d160,0xdae5d4d8,0xed0de33b,0xfecaf5e5,0x09df0695,0x0c5f0b97,0x08290b19,0x036d05a0,
0xfc43000b,0xfb40fa10,0x07acffdf,0x22781349,0x3ae030a9,0x42b24148,0x38513dc0,0x41e638dd,
0x31c947b8,0xc7c5f3bb,0xae88b06d,0xc1a8b461,0xca20c733,0xcdbccc1a,0xda19d286,0xedd9e419,
0x016cf7f9,0x09bf068c,0x0a610afe,0x0493074a,0xff6e0224,0xf8c2fba3,0xfb30f82c,0x0944005c,
0x2575167f,0x3adb3177,0x3eb33fc3,0x352e38cc,0x434b3840,0x348449e6,0xc86bf914,0xacefb1a8,
0xbdfcb4c4,0xc809c4f9,0xce18ca2d,0xdd56d3fa,0xf1b2e680,0x0398fc01,0x0bc2088a,0x0a640c38,
0x0547079f,0xff570284,0xf959fb53,0xfcddf9c6,0x0bb201c3,0x267418f9,0x3a23313f,0x3adb3da6,
0x347a3598,0x47103951,0x3a404c1c,0xca02fd2a,0xac0fb02b,0xb9b7b140,0xc426c194,0xcdd6c8d9,
0xdf58d71e,0xf594eadf,0x04d5fee6,0x0ab209ac,0x072709d5,0x023a0523,0xfbf6ffe9,0xf840f949,
0xfbdff97f,0x0ca3020a,0x252c193a,0x38122ffe,0x36273a1f,0x32cb3233,0x48193ac3,0x3dd2501b,
0xc922027b,0xa83eb055,0xb671adc5,0xc173bdc1,0xce4dc6c6,0xe01fd66e,0xf5b7ebd3,0x055cfe6a,
0x0aec0a0e,0x086d0a7b,0x0355062b,0xfbc0ffc2,0xf8ccf9b2,0xfc91f951,0x0e9503cc,0x264c1a5a,
0x38be311c,0x351638e8,0x34a63142,0x4c503c9c,0x433552b6,0xcb8c0513,0xa5dfb12f,0xb331acf9,
0xbe68bc18,0xccbac6c2,0xe0e3d6bc,0xf599ecc9,0x05f4ff5c,0x0ab20a0e,0x08640a7e,0x02d80675,
0xfb81feb8,0xf829f9ba,0xfd1bf8fe,0x0e500439,0x255f194b,0x36182f84,0x31433542,0x33dd2fbf,
0x4dab3e0c,0x44775610,0xcc7706f7,0xa372ae03,0xb05ca9b8,0xbce7b79e,0xcd18c50f,0xe2fbd835,
0xf788eddf,0x06670100,0x09e109a4,0x072c0920,0xffe4044a,0xfa51fc47,0xf7b1f857,0xff04f9af,
0x0fb505d0,0x26371a62,0x34882f31,0x2f4b31fc,0x33db2db7,0x50693e50,0x460f581c,0xce430bae,
0xa33daf02,0xae30a9dd,0xbb98b6e6,0xcdf0c547,0xe3f0d9f8,0xf9e8ef75,0x07fe0285,0x0b500a9f,
0x08960a94,0xffd603fe,0xfa49fc7a,0xf7a9f7aa,0xff6afa41,0x0fd805d6,0x267d1ab6,0x33162f34,
0x2ded30ce,0x33f32e17,0x52ca4056,0x45d6594f,0xcc760e82,0xa154aee3,0xac1ba78c,0xbadeb41e,
0xcf9ac418,0xe55bd985,0xfb05f036,0x07a50226,0x0a740930,0x06340913,0xfe430169,0xf954fb34,
0xf908f77c,0x0096fbf5,0x0ff606af,0x257b1a99,0x2f952cd5,0x2b602d18,0x33802c4b,0x54d84276,
0x473d5a59,0xcc861167,0x9f6caf15,0xa8a2a65a,0xb92fb154,0xcfbdc3be,0xe74cd9c8,0xfd42f230,
0x091803ce,0x0c170aca,0x05c0095e,0xfd990105,0xf88afab6,0xfa18f850,0x01c7fdb3,0x116b083f,
0x26651c45,0x2e182cfe,0x2a682c42,0x34932be8,0x56c64512,0x488f5c05,0xce5212df,0x9fc7ad5a,
0xa6a1a387,0xb863aed1,0xcea8c387,0xe7b0da87,0xfd61f344,0x08e60408,0x0b4f0b57,0x03da083f,
0xfc00ff7a,0xf827f94a,0xfad3f8a2,0x018bfe2e,0x114d086e,0x25c61cc2,0x2c502bc9,0x29342b32,
0x36682bfa,0x5873484f,0x48b75da4,0xccbd13b0,0x9dbeabed,0xa3e59f73,0xb833ab75,0xceffc1e8,
0xe992db32,0xfe5bf476,0x0a5504c1,0x0b300bf8,0x0300078d,0xfb4dfefa,0xf866f95e,0xfc1afa20,
0x0228fe9c,0x12610909,0x25a41d57,0x2af22a6c,0x280e2992,0x38bd2c85,0x5af34a65,0x4a3c5e3d,
0xccc513ab,0x9bd5abba,0xa0b69c97,0xb6e2aa96,0xcfb6c1a1,0xebd1dd82,0x0013f699,0x0bb60762,
0x0a640cc0,0x00f1060c,0xf93ffd3f,0xf861f7f5,0xfc4cfae5,0x037bff36,0x150f0b10,0x26b21f6a,
0x2a902a51,0x271d2811,0x39392c72,0x5b114a7a,0x49ce5df5,0xccba11c0,0x998dabce,0x9eec99ce,
0xb572a9f8,0xd013c1bc,0xec35df39,0x010cf731,0x0bc407eb,0x08bb0bd2,0x000d03c3,0xf89afb8b,
0xfa41f827,0xfcfafb7d,0x0412ffbb,0x15c20bf5,0x25cc1f65,0x28cd2950,0x271426b5,0x3b482e02,
0x5be24d53,0x48a95ef9,0xcdbd11bb,0x978bac23,0x9df797be,0xb519a8b4,0xd2ccc204,0xee47e087,
0x036df907,0x0c7d08f5,0x06870ab9,0xfe24028c,0xf7c2f99b,0xfaddf933,0xfde9fb9b,0x05dd0045,
0x17a80d8b,0x25f91f98,0x26fe27bc,0x268924e3,0x3c6b2e4b,0x5cb64ddd,0x47c15e91,0xcea11169,
0x94fcac52,0x9c4a966c,0xb3c3a6e4,0xd361c28e,0xef3ee104,0x04b0faaa,0x0c790a18,0x05c608a4,
0xfc5b0127,0xf856f805,0xfa69f9a2,0xfddbfb95,0x072000fd,0x18e10f35,0x25ec2079,0x25c626cf,
0x263d237f,0x3c962e89,0x5c034d61,0x45c55d78,0xd0531129,0x93baa9d8,0x9b4b9440,0xb40fa4c9,
0xd428c364,0xf0c0e1d8,0x05cefbe7,0x0a7a0a5f,0x04ff0777,0xfb11fff0,0xfa39f908,0xfae9fa83,
0xfea2fc57,0x08860268,0x19e010e0,0x2557212c,0x24cb25e5,0x285823e7,0x3f8f3142,0x5e2d506f,
0x45ee5e11,0xd2f21354,0x94a9a961,0x99af9317,0xb3cca37d,0xd2cdc33b,0xf0a2e280,0x067cfd5c,
0x08db0990,0x04260713,0xfaf8fde5,0xfacff9ee,0xfac8f9fe,0xfe8afc36,0x08e302d9,0x19b31177,
0x23221ff6,0x22952364,0x27de22af,0x3f8b315f,0x5dab501b,0x45d25c89,0xd5e616ea,0x97c3ab0a,
0x998892c4,0xb2d1a367,0xd047c17f,0xef4be09e,0x0465fc78,0x08280688,0x039d078c,0xfe25ff6a,
0xfcdcfde7,0xfb99fb80,0xfe88fc42,0x0836024d,0x183810c1,0x21091dc3,0x21e321ad,0x2a0823ec,
0x424f3455,0x5dfe529b,0x47be5cad,0xd8dc1a87,0x9afbad13,0x98bb8fbd,0xaf3ca2da,0xcd21c097,
0xf09cdff6,0x03fafb8c,0x09a0067c,0x03b808bf,0x01aa0294,0xfde9ffe8,0xfbb5fbc8,0xfe10fc47,
0x0819022f,0x16e51015,0x1eb31b9b,0x20a31fcb,0x2b262445,0x436e359b,0x5c6452a0,0x48c75b48,
0xdb0c1cf8,0x9d13af39,0x97688fe0,0xad76a4a7,0xce5fbe29,0xf086de4b,0xff98f99b,0x085106ec,
0x04fd062d,0x03fe0462,0xfe08019a,0xfc4afce2,0xfe74fc54,0x0797020e,0x147e0ee7,0x1b5b187f,
0x1f5c1ce8,0x2bf02468,0x4502371c,0x5c2e52eb,0x4a5a5bf6,0xdff41f39,0x9d44b195,0x95b49023,
0xab49a449,0xceeeba67,0xee19dea7,0xff0ef87f,0x083b06d2,0x07be0630,0x0527081a,0xff0c0233,
0xfbd3fcc7,0xfdf1fbfb,0x077601f1,0x138e0e3a,0x19c01710,0x1fdc1c9e,0x2de6256f,0x4647392d,
0x5b7a52ca,0x4b495ca9,0xe48720d7,0x9cf2b3d0,0x95869143,0xa9a2a2a6,0xcfc9b91a,0xea0ade31,
0xfee6f674,0x05bc03da,0x07d70611,0x050e0896,0xff650148,0xfc3efd4e,0x0012fe10,0x08bf030a,
0x121d0ea5,0x18051518,0x1f6e1b24,0x2f1725f4,0x472e3b02,0x5c8352a9,0x4c835dd9,0xe97b246d,
0x9c71b62f,0x95279275,0xa76d9e80,0xcea8b8ce,0xe621db5b,0xfe95f53d,0x05230120,0x0acc0954,
0x07ba0a88,0x014003d6,0xfddaff30,0x002ffea6,0x07870298,0x0f280c9b,0x15cf11cc,0x1eb619e1,
0x30ba2692,0x476b3beb,0x5d1c5358,0x4dc25e18,0xed252741,0x9bfeb72e,0x94749403,0xa7609b67,
0xcc6bb957,0xe530d92b,0xfd7af42f,0x05160068,0x0be40a6a,0x08af0af3,0x01dc0513,0xfea1ffe0,
0xffdbfea6,0x06910248,0x0e290b70,0x14b610a0,0x1e14191a,0x306c25ea,0x475a3bde,0x5d67536b,
0x4f235eca,0xef702972,0x9c58b84c,0x943a943e,0xa6a79a9f,0xcb6cb853,0xe485d8b1,0xfda7f36a,
0x04ea00a6,0x0ca70ac5,0x092d0b52,0x023005c5,0xfecbfffa,0xff74fe86,0x060b01de,0x0dad0abe,
0x14251028,0x1dc318ae,0x2ff72564,0x46dc3b8e,0x5d0e52dd,0x4fe65ed1,0xf2052b2e,0x9d10b9f7,
0x951c957f,0xa67e9a6e,0xca6fb7fb,0xe3c7d7fa,0xfd1af228,0x045c00ae,0x0d8e0aa1,0x09c40c05,
0x03620709,0xff780096,0xff55ff21,0x057c015a,0x0c8e09d6,0x12f20f0a,0x1cda1793,0x2f322482,
0x46ab3b30,0x5d325296,0x514b5f95,0xf5102d55,0x9d70bbf3,0x960e966d,0xa57199d0,0xc944b758,
0xe29bd67d,0xfc2af0f6,0x041f0073,0x0e660a8b,0x0aa20d35,0x04e40845,0x0003018d,0xff6dffad,
0x049f00b0,0x0b5c08f3,0x11a40d93,0x1bc91672,0x2e892390,0x46983ae5,0x5d7f528d,0x52f4607e,
0xf7fd2fba,0x9dc4be1c,0x971596d3,0xa3e0997c,0xc875b65a,0xe0e4d4e6,0xfb80efe0,0x03c3ffe8,
0x0f2e0aa5,0x0bb70e52,0x06690990,0x00c302b2,0xffb00043,0x03af003e,0x0a52080d,0x10230c1c,
0x1abc1557,0x2db72267,0x46823a94,0x5dcd5272,0x54b96192,0xfaf73235,0x9e41c06d,0x97f596ef,
0xa249996a,0xc7d7b4f7,0xdefed3b3,0xfb2eeea9,0x033aff7e,0x100c0acc,0x0c860f2a,0x07b10ab7,
0x01440389,0xffe000cb,0x02f4ffd4,0x09890758,0x0ef60b05,0x19f0146e,0x2cfb2186,0x465c3a3d,
0x5dc65248,0x56406247,0xfd98345e,0x9f0dc28f,0x98ab972d,0xa14e99c1,0xc73bb392,0xdd48d310,
0xfabbecf8,0x0243ff5c,0x10e70a39,0x0d031054,0x09760b9c,0x01c004ea,0x00c50180,0x0211ffc2,
0x08ee06af,0x0d3a09b0,0x18f31335,0x2b9d201d,0x462639a4,0x5da651e4,0x58256336,0x00c436e2,
0xa003c52c,0x99e097a7,0xa0279a72,0xc66db1de,0xdb2dd259,0xf9e9ea93,0x011aff37,0x11ae092e,
0x0db911e9,0x0b790c5c,0x028706f8,0x01e801fb,0x01150032,0x0868058d,0x0b08088c,0x17f0115d,
0x29c51eb9,0x462538ae,0x5d4f51a3,0x5a626403,0x03fa39b8,0xa13ac81a,0x9b0b97fe,0x9f369b90,
0xc558afbb,0xd930d1ea,0xf894e78f,0x0030ff65,0x11ff077e,0x0eda1401,0x0d2f0ca5,0x03df09b4,
0x02d70216,0x008b0170,0x07a703f4,0x090007f6,0x169e0ed5,0x27e11dc9,0x45ee36e9,0x5cef51e2,
0x5cb3644a,0x07403d21,0xa2abcace,0x9bf79883,0x9e929c8f,0xc3f3ad9f,0xd7b6d179,0xf6e0e4ba,
0xffe0ff94,0x11a905ea,0x107215d5,0x0e000cc7,0x05990c1c,0x02f6021e,0x00bd0289,0x067d0287,
0x080207af,0x14f90cac,0x26e01d2e,0x452a353d,0x5d005236,0x5e2e6445,0x0a8d403e,0xa3d6cd38,
0x9cff9921,0x9e4b9da9,0xc272abc4,0xd6a2d130,0xf45ee1c3,0xffe1ff6d,0x103c0406,0x12d21760,
0x0e2e0d32,0x08bf0e9f,0x02c602f5,0x023903c5,0x048a01c2,0x077b06e3,0x12050a6c,0x25ea1b8b,
0x433a3357,0x5d7f51d5,0x5f606493,0x0f2d43aa,0xa51dd0a5,0x9edb99d4,0x9e429fc3,0xc09ba976,
0xd583d0fc,0xf0bede0a,0x0001feb2,0x0dd501f0,0x15e81846,0x0e020e78,0x0cdb10a3,0x02a50554,
0x043d044c,0x02a20257,0x06ce04eb,0x0edf0909,0x244a1870,0x4134320a,0x5d7b5047,0x60da657f,
0x13a84685,0xa71bd4f9,0xa07d9a3a,0x9f3ca2b1,0xbddfa70e,0xd553d0b5,0xebd6da86,0x00b8fcec,
0x0a69008b,0x192d179b,0x0db71116,0x10da112d,0x036c0977,0x05b203be,0x02110478,0x04ef0237,
0x0ce0084f,0x211e14c9,0x40053086,0x5c204e75,0x62ff65e4,0x17a349b7,0xa9c4d901,0xa1df9b3e,
0xa12da580,0xbacca5a1,0xd5c7cfb1,0xe6b9d843,0x0124f9ad,0x07530073,0x1b15154b,0x0e78148c,
0x12fb1098,0x05d10dd5,0x05a1033d,0x03490655,0x025b00aa,0x0c470711,0x1dd612c2,0x3f332e0f,
0x5ac74dd1,0x6445650c,0x1b5b4ce1,0xab62dbe6,0xa32a9c2f,0xa27ca779,0xb8e5a4e5,0xd624cee2,
0xe374d735,0x00f9f6ea,0x057c00d7,0x1b8312df,0x0fd21747,0x13580fcf,0x08c410e6,0x04b20370,
0x0529071d,0x001700bd,0x0bb604fb,0x1b62121d,0x3d692adb,0x5a1c4d78,0x642c63b4,0x1fb74f8e,
0xac75df74,0xa4a29c31,0xa4d2aabf,0xb650a3fc,0xd788ce3b,0xdf90d6d9,0x00a5f30c,0x03f50201,
0x1aac0f6c,0x12431a23,0x12920f3e,0x0cc2134f,0x03a20513,0x071706c8,0xfec7025e,0x0a0f0200,
0x1a2511ea,0x3a242785,0x5a1b4c55,0x635062fc,0x2410510b,0xae28e41d,0xa5259b63,0xa8aaae7d,
0xb2efa3c7,0xd979ccab,0xdc1cd7fa,0xfef9edd7,0x03cd03b3,0x17e90bb3,0x15df1be9,0x110a1009,
0x10af13e4,0x03b708a0,0x07b30559,0xff7804d2,0x06e2ff61,0x19f410cc,0x364a2583,0x5996496d,
0x630e6348,0x271c5175,0xb12de8e6,0xa46a9af1,0xad93b13f,0xafd3a57f,0xda91c978,0xda94dab0,
0xfb0de828,0x0573049d,0x13c6097d,0x194f1b37,0x107512f8,0x12b712a1,0x06340d07,0x06880473,
0x01ab0627,0x0392fef4,0x19150dc9,0x33cc2506,0x573a45ac,0x64056346,0x28fc5265,0xb484ec54,
0xa4309c16,0xb147b2b4,0xaea0a827,0xda06c69b,0xda5cdc4c,0xf6e4e46f,0x062a0361,0x111808bd,
0x1a6e1975,0x11bc1571,0x1378128f,0x09060f9a,0x065d059d,0x02950646,0x024fff59,0x17270b91,
0x324623a8,0x551b438c,0x6426621f,0x2ad25384,0xb6fbeecc,0xa5859e08,0xb2c4b3f5,0xaf01a964,
0xd957c633,0xd925db7e,0xf4cfe2a4,0x0482016b,0x0ffd0754,0x1a7c18da,0x12b51607,0x150213ce,
0x0ab71153,0x07810711,0x03040715,0x0191ff2e,0x158c0a50,0x304b21ce,0x53684190,0x63b660eb,
0x2ca85420,0xb96bf178,0xa6a49f9d,0xb49cb566,0xaf62aacc,0xd8f9c5e2,0xd80cdb10,0xf2bde0cc,
0x02e6ff99,0x0e9f05c5,0x1a65180b,0x13701677,0x166e14d2,0x0c781311,0x08b0088a,0x03a40808,
0x00f0ff40,0x1411092e,0x2e5f200f,0x518e3f8a,0x631d5f87,0x2e3b548f,0xbbbdf3de,0xa7aba12c,
0xb65bb6b8,0xafdcac47,0xd8a9c5a0,0xd721dab3,0xf0b3df13,0x0140fdb2,0x0d260429,0x1a211713,
0x141116c3,0x17bd15c0,0x0e3a14bc,0x0a050a16,0x047a0925,0x008fff8a,0x12c10839,0x2c7f1e6a,
0x4fae3d98,0x62545e0d,0x2f9354cb,0xbde2f609,0xa89da294,0xb826b7f6,0xb087add9,0xd891c597,
0xd670da98,0xeed2dd92,0xff97fbe4,0x0b940286,0x19a215f2,0x147416d3,0x18e4167b,0x0ff6164a,
0x0b630bb2,0x05790a64,0x006a0007,0x119f0788,0x2abe1cf3,0x4dce3ba9,0x616d5c7c,0x30c754e3,
0xbfc4f7f3,0xa936a3b3,0xb9afb8dd,0xb124af48,0xd8bcc59f,0xd63edad8,0xed7edca4,0xfe7ffab2,
0x0a2e014a,0x191c14c8,0x147716cc,0x192b1665,0x11491749,0x0bee0cac,0x06aa0b1d,0x005d010a,
0x10b30692,0x29e11c5f,0x4bbf39f7,0x61385b0c,0x32ef55fb,0xc123fa7e,0xa700a29b,0xbe19b93f,
0xb09bb3ca,0xd730c145,0xdaa3df1c,0xe6c3da80,0x0130f731,0x07c80465,0x169c0ef6,0x183219d0,
0x161f15fd,0x152416e0,0x0cb210f1,0x067d097a,0x02700385,0x0d53056d,0x294419cf,0x49963987,
0x5f6857c1,0x37155773,0xc233feb1,0xa3449fbc,0xc48db9d2,0xb154baf5,0xd2fdbb82,0xe1c6e298,
0xdfcddbf5,0xffebef15,0x0a5c0909,0x0fbc0acd,0x1c161774,0x16a81ade,0x13c113cc,0x120e1431,
0x05a10c5e,0x02660196,0x0dfe0716,0x256217a7,0x4874367b,0x5e945778,0x383856a8,0xc56e0258,
0x9ee19eda,0xc874b74d,0xb5b0c2e4,0xccf1b837,0xe7a6e1c3,0xde60e1ad,0xf9c9e791,0x0f1209a0,
0x0b9c0cba,0x19ef113c,0x1b8e1e6a,0x1110150c,0x13ad11d2,0x098a1138,0xff7e018b,0x0e7704f4,
0x24cb191d,0x43a632d2,0x5e265462,0x3a1b5803,0xc786048e,0x9cc59f1c,0xcb9ab5c1,0xbc4bcaa6,
0xc73cb80b,0xea95dde1,0xe0cee844,0xf079e1fc,0x1143047e,0x0c5311ae,0x133d0bac,0x20d11d16,
0x13921be3,0x10e80f4d,0x0fd61318,0x000b0758,0x09b30087,0x262817b9,0x3fc332ff,0x58d34da3,
0x3e5f5770,0xca840a51,0x976a9d09,0xcff7b2c2,0xc5e5d550,0xc0afb953,0xebd4d782,0xe799f06c,
0xe62fdfe3,0x0ec5fa23,0x11f816f4,0x0b080a5d,0x20681536,0x1c06232e,0x0d541214,0x11380ef0,
0x07810e8d,0x04a4021c,0x22e310e5,0x41cf3454,0x529d4bd2,0x3d805139,0xd23b1020,0x91479f4a,
0xcda9a9a2,0xd4e5dea6,0xbd0cc23f,0xe508cc6c,0xf38df512,0xe1ece7bf,0x02b5ec73,0x1a4f15ab,
0x0a2c12ac,0x15ce0b22,0x2457214b,0x12641d44,0x0a550b3c,0x0d3a0c83,0x09490b18,0x1a460d63,
0x40b92d52,0x55134f1a,0x393c4f73,0xd5320e4b,0x918ba3c5,0xc7a3a413,0xddf4df67,0xc166cd37,
0xdc76c783,0xf8d9f180,0xe731f15e,0xf826e852,0x1a050d28,0x10a21957,0x0e640abb,0x21dd18f1,
0x1a792259,0x088d0fd9,0x09d10722,0x0f000cf9,0x1a361222,0x3b4628b2,0x56f84cd9,0x3c375363,
0xd4220eed,0x8faea218,0xc67fa227,0xe115e050,0xc2c9d0bb,0xd8d7c58b,0xfad0ef8a,0xeb11f634,
0xf351e7d2,0x182a07b0,0x15851c4b,0x0bd60d0d,0x1da5135e,0x1f0622c6,0x0a3114ce,0x0583048a,
0x10660aac,0x1cb015b4,0x375a27c1,0x558948b4,0x40ed559d,0xd6c713cb,0x8b3ba119,0xc3899ca6,
0xe78ae279,0xc4a6d735,0xd1f7c17e,0xfc87eb33,0xf14afcc2,0xedbde89f,0x13c1ffbb,0x1c061e66,
0x0bd11282,0x17190de9,0x22782046,0x0f571b8e,0x010304a1,0x0e500561,0x20e317f0,0x359e2a15,
0x50f943d8,0x44bf54ab,0xdcd51aa2,0x8676a271,0xbd409450,0xef3fe313,0xc9ffe126,0xc913be96,
0xfb22e301,0xfab00357,0xea6fedaa,0x0aeff649,0x218d1c43,0x10ac1b06,0x0f730b84,0x21361936,
0x178c2108,0xfff809ed,0x07d9ff48,0x2391157c,0x38cc2f32,0x4bd9426a,0x440c4fb6,0xe53c1fd2,
0x853fa872,0xb2dc8bca,0xf434de54,0xd4bdecea,0xc197c0f6,0xf387d726,0x04d50559,0xedbef83c,
0xff26efc3,0x214b135f,0x1a7e22e3,0x0bd2102b,0x19751030,0x1df42003,0x05e41331,0x00dafe15,
0x201e0dd2,0x3e9431a3,0x4b9f469d,0x40244bef,0xe8321f06,0x87cdacd2,0xafd08af3,0xf3a4dba2,
0xd6c6ee64,0xc18dc21f,0xf32fd693,0x00000559,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
};
static const PROGMEM uint32_t sample_4_SynthBass2_STLGT84B[1536] = {
0x005b0000,0x034802fb,0xffebff52,0x00aeff26,0x0077ff91,0xf704f638,0xf8a501c5,0x08bbf78c,
0x04991a15,0x19cb0961,0x27f624cd,0x11ff1de2,0xf58b0fad,0x13550059,0x0b64058a,0xfb51166d,
0xceddd186,0xc60dc822,0xd5dde35f,0xd48fc044,0xf6f5f565,0xf92f0530,0xf7f5edb7,0xc9d4d17b,
0xfd19ed97,0x17fa08f3,0xc7c703bc,0xe97ec9d0,0x0d34fcc9,0xe714fce6,0x0ecaf276,0x49b62043,
0x36f94cd2,0xea5221d1,0x1c5fe249,0x4e403fed,0x258f4b5f,0xe084dcfc,0x278605d4,0x1b453436,
0xf7a1f8d6,0x30b718f9,0x6a515e99,0x23a343e2,0xd228ee0d,0x29fcfbed,0x3b1d3ca6,0xae880836,
0xcd95a5de,0x0dd9f9a6,0xcd50fde1,0xe06dbaca,0x25d7f862,0x2202445f,0xc32afe4f,0xbee39b42,
0x19b2fc4e,0xee1a1d1f,0x83d99cea,0xed2fb79b,0xfc390425,0xb68ccf04,0xf5e7dbd3,0x52bf2b31,
0x15663933,0xb3ccdb4f,0x13dfd82b,0x44af3c16,0xc13b1979,0xd55598cd,0x345e1852,0xf4802612,
0xfb49d4ff,0x478818c9,0x4b4f6a4f,0xf3dc2618,0xdbafc298,0x3f4b15c0,0x1935463a,0x938bbd8c,
0xfe1ec6b8,0x14d81ab1,0xc2d4e512,0xffc5e837,0x4ff727fd,0x16353ab2,0xb209e63f,0xffbac438,
0x39432f02,0xc4091df9,0xbc7391ca,0x0b43f0f4,0xe9200f30,0xe9e7c9c5,0x2dab04d7,0x4f5b5fbd,
0x042c2fd1,0xd83bccf5,0x447017ae,0x39864dcf,0xabf2e384,0x02e8cd7c,0x218d1cab,0xd9d0fef3,
0x1058f7b6,0x60932c37,0x2c204e8f,0xd09c05d3,0x09ead0f4,0x48883538,0xe7a339ff,0xc0eea868,
0x08c8f06a,0xf325111a,0xe34cc819,0x18fffd2c,0x3a8b48f9,0xf3841809,0xb2bfb918,0x17c3ed97,
0x24692cbb,0x9525daf6,0xd5b2a34a,0xfdfbf2f1,0xc072e8ea,0xf536d9a3,0x467c1284,0x1aba3e8b,
0xc546005c,0xe949b6af,0x363d196a,0xf0c6349f,0xb149a80d,0x007ae27c,0xfd0f1085,0xeabfd284,
0x25630c47,0x52dc55e4,0x167f305b,0xc872db12,0x2740f3b3,0x49f1446a,0xb9bd088f,0xe88db8b9,
0x11310444,0xd6c5ffde,0x08ece713,0x4e951e56,0x2bae4d33,0xdb0812d4,0xe3e7beef,0x314714ea,
0x060f3c6b,0xaca4b80f,0xf910d87f,0xff1f0adf,0xe224d6f6,0x1a690539,0x54d14e18,0x17ac3577,
0xc2afe3e5,0x1177e32b,0x423f326e,0xbe5410cb,0xd637ae1e,0x0d29f844,0xddd007c8,0x0738e2e9,
0x4bb31e4d,0x3873565a,0xee2d1eb4,0xe41ac71b,0x324810ad,0x1cb245bb,0xa8dcc5cb,0xef19cb6e,
0x02b9032c,0xd9cbda7e,0x13a0f9f0,0x54fc4227,0x1e7a3694,0xc25bee64,0x00f8d3bb,0x3e9525dc,
0xc6521d04,0xbbee9fdc,0xf86bdf41,0xd46bfbba,0xeed0cc3a,0x34750855,0x31164ce8,0xec4e1a7e,
0xcd74c0a0,0x208ffa86,0x2acd42f4,0xa60dd717,0xe442bff3,0x0699fded,0xd4d5e546,0x0c27f64f,
0x571e39d1,0x2d05419d,0xcf7e026c,0x02ccd4e2,0x4bfc2ad5,0xec503cfc,0xc5e2b473,0x0502ea87,
0xf166106a,0xfeccddf7,0x3d4d12e7,0x4a785d20,0x0a243103,0xd180d40d,0x22c2fa4b,0x40584743,
0xb3c5f116,0xdf09bc69,0x0b8bf7d4,0xd8b5f046,0x076ef395,0x51182d85,0x2c61420f,0xd03f08a6,
0xefd4c87d,0x3dfc1770,0xf7a340de,0xb4c2b205,0xf051d6f1,0xed5706ac,0xed47d50e,0x28d20472,
0x44765232,0x0d582e96,0xc535d66d,0x1228ea86,0x43753b91,0xb788003e,0xd26ab581,0x06a7edb5,
0xd970f4ae,0x060af06d,0x4f3c24c3,0x315a4525,0xd8ea11ba,0xe44ac2e0,0x34990a2b,0x0712446f,
0xaf2fb83a,0xe68eca0e,0xf35f0043,0xe73fd293,0x1d66fc4e,0x44924a64,0x15723055,0xc100dcdb,
0x0591df55,0x451f2e08,0xbeed0d4a,0xc661ad1d,0xfe4ce1d6,0xd5e1f64b,0xffe9ea36,0x4cd81e72,
0x37e94c71,0xe9682070,0xe359ca42,0x32d708a5,0x1ce44fa8,0xb2facd21,0xe621cc45,0x026507bd,
0xed10e091,0x201f03d8,0x511c4ea3,0x28c53f19,0xccf0f2b3,0x061ee2e4,0x50252fa7,0xd4742676,
0xc6d0b270,0xfed7dec3,0xdc61fc2e,0xfbbae3d7,0x44c81473,0x3a114bd3,0xf1d62541,0xd700c643,
0x2434f862,0x266747a2,0xab8ed317,0xd2ecb94d,0xfa25f460,0xdc10d8cd,0x0adef380,0x47483b22,
0x249b3798,0xc632f2b6,0xf30dd207,0x45fd1cc7,0xdd332e45,0xbbf3b135,0xf3d4d540,0xdea8fee4,
0xf388deb2,0x3a4d0aa1,0x3c3f4b02,0xfcf42c3b,0xd2c6ccf6,0x1b14f41e,0x3934493b,0xb69cec96,
0xd336bbed,0x0382f3ee,0xe181e523,0x0a4ef5df,0x4d8a38a7,0x2fc140aa,0xd0bd0318,0xeed1d086,
0x43a013aa,0xf0a439ff,0xb923b542,0xee13cd59,0xe76301c4,0xf294de7d,0x33130558,0x41084b02,
0x0b03327d,0xcfb8d42b,0x0faaeb34,0x42f64180,0xbcc2fd74,0xcbe2b9f8,0x0354eb9f,0xe0b2ec16,
0x047ff435,0x4eb9323b,0x39bb46c0,0xdce2151a,0xec86d361,0x3fa71027,0x055147fc,0xb95fc19a,
0xe713c967,0xef2903d2,0xf211e0c5,0x2ae50170,0x44d34adc,0x16423908,0xcd4bddb8,0x021fe39d,
0x437f3296,0xbee30642,0xbdccafb8,0xf7d2d8b2,0xd63ae708,0xf47be5f5,0x40b51d03,0x32cb3bd4,
0xdcd11462,0xdd6ec659,0x2e39fbdf,0x0e1c43a8,0xaf30c339,0xd645bb46,0xec2ef8e2,0xea12da21,
0x1e3bf6ee,0x451f44f0,0x22e33cc6,0xd0c2ebb9,0xfe2ee409,0x4c6b3063,0xd18e1e2e,0xc132b970,
0xfd61d966,0xe17bf643,0xf823edd6,0x453f1d62,0x3f2847e6,0xef0628b4,0xdf75cf6b,0x2aa8fa76,
0x247f4c41,0xb6a3d61f,0xd333bc3f,0xf334f7b6,0xe7b7dd26,0x121af106,0x41d13c8b,0x27c73a6a,
0xcd92f0b1,0xf29ad90c,0x48bb20ec,0xda7e2756,0xb84cb512,0xf4f1cd5d,0xdf02f5d1,0xf1a7e796,
0x3d130fa7,0x416d4558,0xf8c62fde,0xd8dad04a,0x1f16f121,0x32dc4bba,0xbc5ee74b,0xce98bca2,
0xfba7f5d6,0xea4be4b5,0x0d7ef2f6,0x451c3b4d,0x329f41b6,0xd1d40012,0xeb5dd6c3,0x44cf1670,
0xe956342c,0xb4ceb99e,0xea68c3b6,0xddf8f584,0xe8a0e18d,0x2e3000b3,0x3b5c3d6d,0x00523031,
0xce97ced6,0x0ae4e0c3,0x36063d69,0xba1cee09,0xbf9fb2e2,0xf780e62c,0xe42ee1fa,0x0156eaa4,
0x418b2e80,0x39cf40e4,0xd98f0c70,0xe74cd513,0x41e10da5,0xffd54346,0xbbb4c691,0xeb28c4ef,
0xebadffe2,0xf02cea55,0x2ed90258,0x467d459e,0x188841df,0xd811e2c6,0x08f7e6e9,0x46e23e7c,
0xc9020752,0xbf60b97a,0xfbcfe3d4,0xe40ae8d8,0xfa79eb88,0x3ec626f1,0x3dc74112,0xe0ff18d4,
0xde57d209,0x3340fdba,0x09344393,0xb4e2c82b,0xd938b7fb,0xe6a0f621,0xe6d3e153,0x1e96f257,
0x3ea239ca,0x1ef13d76,0xd3c9e658,0xfb27ddd0,0x491b30ab,0xd286153e,0xbb09baa2,0xfa16d909,
0xe5bbec1b,0xf435ea6d,0x3d651e2e,0x44094369,0xeefc2830,0xddd7d766,0x2a91f682,0x1c484924,
0xbab4d6f5,0xd131b6ba,0xea89f4f3,0xe6bde3a1,0x144eeda8,0x3c103554,0x27793f2f,0xd277ef04,
0xed24d74d,0x455420ad,0xd9e22098,0xb386ba3c,0xf289cd17,0xe376ec60,0xeba7e701,0x345f1065,
0x43633e34,0xf9d4308c,0xdb89d9d8,0x2108eedf,0x2e234ad3,0xc4b3e87a,0xcea9ba01,0xf43df56b,
0xef42eaac,0x1488f166,0x4337381a,0x39ae48d3,0xdf6703be,0xed36dd00,0x4a101bf3,0xef9234ad,
0xb9b8c6d3,0xf1f3ca05,0xe8b9f380,0xeab1eba9,0x2ec60a08,0x42a13c1c,0x033237eb,0xd5f0db7f,
0x0fa7e360,0x334a4115,0xc4bdf0ff,0xc123b594,0xee82e9de,0xe74ce467,0x0337e690,0x38872990,
0x39eb413f,0xdeaf08a2,0xe1c2d744,0x3f640b9c,0xfa013a83,0xb8deca86,0xe956c0a1,0xe9b2f2d3,
0xea71ec0e,0x2aad03a2,0x446f3b54,0x11de403a,0xda7ae498,0x079ee15d,0x40623c6a,0xd13502d7,
0xc028bbfc,0xf299e5c7,0xea7be828,0xfdf8e7b8,0x370324f9,0x40c5408a,0xe6a015e4,0xdc50d7aa,
0x3628ffbf,0x07b14171,0xbadbd2e1,0xdf32bb0b,0xe6dcf0da,0xe664e9f0,0x21b6fa8b,0x41263691,
0x1d8a44e5,0xdba1ecee,0xfe50df5c,0x4728357a,0xdc641338,0xbf97c316,0xf69ae22f,0xef28ed5f,
0xfb7eeb22,0x398622ab,0x49aa43f0,0xf3f52699,0xdf65dee3,0x3166fa74,0x1c484a5b,0xc56be251,
0xdc7bbc73,0xec38f3de,0xe8baed26,0x1b39f534,0x3fe63402,0x28594757,0xdc70f41c,0xf13ed981,
0x45cd2683,0xe1bd1cf8,0xb5ecc194,0xee58d3c2,0xe8dee893,0xef3fe51e,0x2f9314bb,0x472c3c43,
0xf8aa2cf7,0xd81fde3e,0x20bdecb0,0x25e84790,0xc77aeab6,0xd2e3b8ab,0xecb3f129,0xe8cded19,
0x137cf006,0x3ccf2ffc,0x34d74a38,0xe2f0013f,0xeb28da75,0x493c1dba,0xf2402dab,0xba08cc37,
0xefc1cfe5,0xee14ed90,0xed8ee995,0x2c110e66,0x497439bb,0x063b38de,0xd8cae45f,0x14bde4a3,
0x314b444b,0xce89f62d,0xcab3b8fd,0xed31ec35,0xead8ee3f,0x0ae0ebcb,0x392829ad,0x3e824a51,
0xe8c00cbc,0xe46edb69,0x459b1268,0x011a3ace,0xbeced79c,0xeecdcc90,0xf258f1ed,0xedd0ef4a,
0x2a350a84,0x4b0c3a06,0x146b4496,0xdd7ceead,0x0bdce2b8,0x3dc74195,0xd9ee0605,0xc7b9beae,
0xeff4eaa4,0xed82f019,0x03faea1e,0x34e7246b,0x4470470f,0xede61621,0xdc78d9cc,0x39900194,
0x087c3cd5,0xbcf1da7e,0xe4b4c14e,0xed52ec96,0xe64beb21,0x1eabfd2d,0x43572fcb,0x1ab2453c,
0xdc18f140,0xfd67db85,0x413a3669,0xe138109e,0xc16cc16f,0xef5ce42d,0xee59f00f,0xfc2fe7dd,
0x313f1ebd,0x4ad94583,0xf7162322,0xdad6df35,0x3270f91f,0x172c4499,0xc3a5e5f2,0xe0cfbf88,
0xeeb3ee3f,0xe5d1edeb,0x1a03f7c3,0x40a42d97,0x253249aa,0xdf21f88e,0xf268d813,0x43e92b27,
0xe9a61b66,0xbd05c52e,0xeddadd71,0xef4eeeef,0xf607e691,0x2d1817ef,0x4da8404d,0x00c62d19,
0xdb6be49a,0x290df11d,0x251647f7,0xcbbff26a,0xdcfebe64,0xf10eef40,0xe91af1fb,0x1758f577,
0x3fe42d76,0x327f4f8c,0xe6560528,0xebb4da95,0x46592259,0xf5d628e2,0xba6ccc84,0xeb3dd6f6,
0xef5aee2e,0xee5ae63b,0x25a80f07,0x4a69382f,0x04d73236,0xd59ee4ac,0x177de2e2,0x29f941ac,
0xccdcf78e,0xd021b6fe,0xeb33e6ee,0xe4e0edfe,0x0a98ea7b,0x36332311,0x37924ae7,0xe8cf0a80,
0xe191d7c0,0x425b1373,0x00d93174,0xba3dd444,0xe829cf74,0xf1c1ed3c,0xec1be8de,0x237b0a08,
0x4be1353b,0x10a63cbc,0xd985ed82,0x0d07de92,0x34b23f46,0xd847055c,0xcb9eba64,0xeb0be58c,
0xe6ffefc9,0x036ce787,0x30511eaf,0x3d43486e,0xee941313,0xdb06d9a3,0x3a4a0579,0x0a25370c,
0xbb97dd2b,0xe37ec8f6,0xf114eb20,0xe89eea03,0x1f57033a,0x4a1130aa,0x1c2b4412,0xdf89f6f9,
0x0358dcfe,0x3cd739d6,0xe54a129d,0xc94fc058,0xedb1e480,0xed7df3ce,0x0122e8f5,0x2e161d0c,
0x45f2477e,0xfa222026,0xd9fce070,0x3371fb27,0x163f3cba,0xc068e869,0xdf26c3dc,0xefaee8dc,
0xe4d3ea8d,0x16d1fae1,0x40f7274b,0x20bd43e5,0xdf8afaab,0xf1a0d591,0x3a3a2a95,0xea03176f,
0xbefcc01c,0xe5c5daa1,0xeb00eeaf,0xf707e405,0x24971418,0x46973ef1,0x00db272d,0xd7b8e4d1,
0x27f6ef3b,0x1f863e20,0xc76df37e,0xdc32c16a,0xf208e876,0xe78aefb4,0x1466f7a0,0x3dec240f,
0x2cf2490b,0xe84005f9,0xeae1d83d,0x3eb02280,0xf8d62405,0xbedec9fc,0xe501d782,0xef34ef29,
0xf29ee5c1,0x1ebb0eb4,0x471e3826,0x079d2e5a,0xd608e85f,0x1957e377,0x24e83ab4,0xcbe8fba6,
0xd3ddbc60,0xee0ce333,0xe62cf02e,0x0d0ff103,0x36dc1ddc,0x34464969,0xede70e7b,0xe233d995,
0x3d4a16d5,0x04ee2d07,0xbf65d43b,0xe4f2d4f1,0xf36ff029,0xf115e966,0x1d370c38,0x4aac3588,
0x13f43940,0xdbdcf285,0x10bfdf5d,0x2ea83ab8,0xd6d307a7,0xcfcdbcc6,0xebeee01f,0xe606f072,
0x0521ea7c,0x2d9f1641,0x38064506,0xf1f213bf,0xd8e0d963,0x33bb05c5,0x09cc2d81,0xbaeed8ed,
0xdc45cafc,0xeecae894,0xe78ee511,0x13e601c4,0x43ca2a49,0x18e63b1d,0xdd7af6e3,0x02b9d991,
0x322f33ae,0xe10a1147,0xcbf1bf5a,0xea14dde7,0xe8f9f1eb,0x027de977,0x29ba1538,0x405544f4,
0xfe212092,0xda25e342,0x307efe34,0x1666343a,0xc186e71d,0xdbe2ca19,0xf0d3e7be,0xe6d4e8dd,
0x118ffe64,0x40cc24b3,0x21ed3f4f,0xe3d5ff9b,0xf69cd6ba,0x34382a9f,0xeb881978,0xc729c238,
0xe51ed8d2,0xe9e2eff5,0xfc12e5e8,0x22690fda,0x42943f87,0x05802770,0xd921e973,0x2839f3a2,
0x203f373a,0xc86ff4bc,0xda10c8f5,0xf268e6b3,0xe725ed83,0x0f62fb6e,0x3e2f2101,0x2bfb4518,
0xec170a16,0xeda2d8cf,0x357a2227,0xf7e12205,0xc4eec903,0xe249d586,0xeb71ef04,0xf606e3ec,
0x1a590a4b,0x41a4377c,0x0a242b78,0xd6c7ec42,0x1a84e678,0x23543292,0xcb3dfbd2,0xd28bc2b8,
0xed1edf0e,0xe294eb53,0x07b9f27d,0x3535176d,0x2fff42d0,0xf0e40f2b,0xe337d8bb,0x32d215df,
0x032727da,0xc3ccd0c4,0xdfbed28f,0xef04eecf,0xf27ae4e7,0x179f0871,0x449e34a8,0x149534b5,
0xdba5f628,0x110ee0e1,0x2a5d31f4,0xd4bb0834,0xd0a7c375,0xec83dd85,0xe3adeea0,0x0437eef3,
0x2eff12d6,0x3612425a,0xf8591754,0xdcb0dc35,0x2e370a36,0x0c392ae3,0xc2abd855,0xdaccce1f,
0xee6cea51,0xeca5e35e,0x112c0286,0x42632c54,0x1ba93919,0xdf8afc92,0x0647db98,0x2da22cf8,
0xde7e1202,0xce48c499,0xea5ada97,0xe4dff017,0x00dbeb30,0x299d0f44,0x3ba141ad,0x007a1f6d,
0xd9b2e296,0x29680082,0x15c22de3,0xc4c0e2f3,0xd7f0cc03,0xeeb0e787,0xe6dfe391,0x0a90fc41,
0x3dad2428,0x20633b2c,0xe37a01f2,0xf9acd6f2,0x2c832483,0xe63417cc,0xc90ec478,0xe451d4d9,
0xe3c4edc0,0xfa4de540,0x20d90880,0x3c763bb9,0x05f623bf,0xd73ee752,0x21d4f59b,0x1d4d2dbd,
0xc83ced7f,0xd578c9f9,0xef6fe48f,0xe529e5e3,0x07f8f93f,0x3b1f1ede,0x28013edb,0xec360ac2,
0xf1c7d84e,0x2def1e5e,0xf391211a,0xc990cb22,0xe244d3c4,0xe682eeb6,0xf668e386,0x1a400516,
0x3e4d3756,0x0d1129f2,0xd6e4ee50,0x1845ebac,0x22062b24,0xcc58f786,0xd11dc78d,0xedd4dfcd,
0xe2e3e792,0x0376f4cf,0x351d1780,0x2dfa3fa4,0xf3921202,0xe99dd9b9,0x2c3c15f8,0xff992722,
0xc992d213,0xdf91d1c1,0xea0aee84,0xf42ce38a,0x159c02e4,0x40733326,0x160c3138,0xdb64f7c3,
0x10e2e5b6,0x286129dd,0xd47603d5,0xcf08c803,0xec1bdbf5,0xe1b9e98a,0xff8bf0b6,0x2e3f10e9,
0x31ec3e44,0xfa0417b1,0xe0ccdb9a,0x263d0a93,0x07e42890,0xc79bd7a0,0xd94bcd50,0xe95bea0f,
0xee7ee0ea,0x0dcefdb0,0x3d752adc,0x1bc53485,0xdf27ff04,0x0739df93,0x2b502580,0xddcb0ed9,
0xcdd5ca1b,0xea2ad8ce,0xe265ebb9,0xfd5fee1c,0x28a00c48,0x37613d5d,0x03ef1fd7,0xde09e2d4,
0x22ad02b6,0x135a2bb4,0xcaeae235,0xd683cca6,0xeb98e7be,0xeb9ae1cd,0x0888fac2,0x3aa223ec,
0x21a3378e,0xe473065a,0xfceadaf2,0x2ade1e8d,0xe6bd16f6,0xcbc6cc21,0xe5fcd487,0xe288ec3f,
0xf9dceab5,0x218d06fb,0x3a5e3a24,0x0c06263a,0xdc34ea09,0x1dd8fb17,0x1d342d2c,0xcff0edd1,
0xd553cdc3,0xeeb0e6a3,0xead1e4e7,0x0611f9d8,0x39271f5c,0x29753c35,0xed7a1003,0xf662db61,
0x2c0719f6,0xf279206b,0xccb6d14a,0xe3d2d2ed,0xe43fedb8,0xf719e822,0x1ab302bc,0x3b523554,
0x12042a6c,0xd9daefb8,0x1500f0e2,0x22502987,0xd27ff655,0xd076cb7b,0xecdde0e3,0xe66ce443,
0x0067f525,0x33191760,0x2d493c07,0xf49d1635,0xee57db6f,0x296c1291,0xfd3d26a1,0xcd77d706,
0xe07bd10d,0xe6beee45,0xf5a1e760,0x15b60068,0x3d7431e5,0x1a5f30ce,0xdcb3f93f,0x0f08eb47,
0x28f227d5,0xd9f0025a,0xcfc0cdb5,0xed6dde22,0xe5d9e724,0xfde4f370,0x2e3311c4,0x31ef3c6a,
0xfcc11cbc,0xe7b2dd97,0x25300a84,0x06f02a34,0xcdf1dcc8,0xdbf2ce8b,0xe804eca5,0xf299e55f,
0x0ffffd2a,0x3d362c92,0x20ef34e5,0xe0d90212,0x0840e67d,0x2d3a245a,0xe2270da3,0xcfc3d0a7,
0xed5adbdb,0xe5dbea0f,0xfcaef22c,0x2a660e37,0x36ed3d1d,0x0666240f,0xe43de359,0x21620456,
0x11a12d7e,0xd13de568,0xd95fced5,0xe9f0eb99,0xefd2e489,0x0ab6fa69,0x3af42670,0x25ba3744,
0xe52c0983,0xffb3e199,0x2cc81d7d,0xe8ad1524,0xce00d203,0xe99ad6e9,0xe3abe9d3,0xf903ee21,
0x235e0836,0x38533998,0x0db82816,0xe0e5e8c0,0x1af9fc9e,0x19f62d35,0xd4deede1,0xd69ecf4e,
0xebcfe97e,0xee0de4e3,0x06f3f8cb,0x390c214e,0x2b333a2e,0xecdf126f,0xf971e0a3,0x2c6d17d3,
0xf2281d97,0xcf0fd69b,0xe76ad49a,0xe420ebb0,0xf6dcec11,0x1db60440,0x3a2e36bb,0x155d2c97,
0xdfa0efd0,0x13cdf587,0x207e2ac5,0xd894f663,0xd329cf53,0xec4de5dd,0xeb70e4c8,0x02c7f645,
0x35311b25,0x2f273b2f,0xf48d19b2,0xf347e08e,0x2a1e112c,0xfc082451,0xd0f1dc20,0xe4d0d2c4,
0xe5ceed38,0xf5daeb18,0x18d40193,0x3bd13386,0x1d4d3125,0xe11ef8be,0x0d74f056,0x268627f9,
0xde980058,0xd144d17b,0xecace258,0xe9d2e5ca,0xff79f473,0x30bf1593,0x323e3b50,0xfc982019,
0xed5ae1dd,0x25170967,0x047a27f6,0xd232e142,0xdffdd010,0xe5c6ec21,0xf30ae886,0x1284fda4,
0x3ae12dfd,0x232f3398,0xe3a20116,0x0605eb62,0x29a82292,0xe4fb0960,0xcfd5d3f4,0xec13de59,
0xe835e695,0xfc9ff279,0x2bb71034,0x35153aaa,0x05bf2649,0xe9d1e5ef,0x1fb902c3,0x0d942a85,
0xd564e849,0xdc11cf41,0xe6b0eb18,0xf10fe728,0x0d30fad7,0x395e2884,0x286d359d,0xe7fb09c2,
0xff16e7ff,0x2aba1c47,0xebdb1190,0xcf13d724,0xea4cda24,0xe68ee71d,0xf9aef024,0x25e80af2,
0x36b9389d,0x0e792b21,0xe778eb3e,0x197efc72,0x16022b44,0xd9a0f02c,0xd8a4cfa3,0xe7f0e9ae,
0xef71e670,0x089ef89f,0x37602303,0x2d42375c,0xee2b129f,0xf936e68a,0x2a7d15c2,0xf3c41953,
0xcf9bdb70,0xe81bd670,0xe593e7d7,0xf6dcedf9,0x1f6505ae,0x372b3543,0x160e2e7d,0xe5a0f0ec,
0x11c6f5de,0x1c42292c,0xdd43f747,0xd455cfa5,0xe7f3e678,0xeccfe51c,0x034cf588,0x336e1c37,
0x302f3764,0xf48319fc,0xf362e5b8,0x28030e6c,0xfb671f65,0xd08adfe2,0xe529d2f0,0xe527e866,
0xf48cec19,0x193f0145,0x377b318b,0x1db931b5,0xe61af848,0x0ae0f10a,0x21f5264a,0xe264ff5a,
0xd14fd14f,0xe855e34f,0xeb09e4db,0xfefff33f,0x2f1a15e7,0x329936ff,0xfbef20dc,0xeed0e6aa,
0x24230743,0x0334240e,0xd267e50c,0xe187d002,0xe4d0e854,0xf241ea3d,0x1300fd31,0x36b82ce5,
0x243e33b3,0xe8110030,0x041ced52,0x260e21fe,0xe848076c,0xcf4bd426,0xe852dfe8,0xe991e4f3,
0xfb8df16a,0x2a6a1021,0x34583611,0x04322710,0xebe3e993,0x1f4200d8,0x0b2d274b,0xd5b9eb50,
0xdddfce6c,0xe4cee7df,0xf03fe89f,0x0d09f9b2,0x34f3278e,0x29633489,0xeb2e0807,0xfd7cea83,
0x27e51c11,0xee590ea4,0xcddcd785,0xe746dbde,0xe7c4e4b4,0xf821ef39,0x24d80a45,0x34ce33ed,
0x0c252bbd,0xe9d9ed73,0x1910fab5,0x124a286a,0xd9e2f1de,0xda32cdec,0xe4dfe6d8,0xee71e735,
0x07c1f6e1,0x32cb2229,0x2dcf34f1,0xeffd1035,0xf809e976,0x284d15c6,0xf543158e,0xce19dc42,
0xe60bd865,0xe675e4d3,0xf585ed75,0x1f430533,0x34c4315b,0x14162f7f,0xe95bf2bd,0x125ef597,
0x187e27a8,0xdecaf8c1,0xd6d5cebb,0xe4f1e525,0xec9ce5d3,0x02f4f45e,0x2fe91c6e,0x30f434c5,
0xf5cf1809,0xf364e956,0x26c10ee4,0xfc1e1b8c,0xcf8ce153,0xe445d4ff,0xe54ee549,0xf35bebcd,
0x197700b3,0x349f2e98,0x1bea3229,0xe973f8e1,0x0b51f158,0x1e77258c,0xe401ff8c,0xd341d09d,
0xe59fe330,0xeafae4e4,0xfea0f26b,0x2d0f1675,0x33183468,0xfc3d1f97,0xef87e9d6,0x23dc07c9,
0x030f2110,0xd1fbe6bf,0xe1ded1b9,0xe494e5ed,0xf187ea29,0x136efcb7,0x341f2b4b,0x230433cb,
0xea89ffdb,0x0457edf3,0x234a21bd,0xe98e06a4,0xd06cd39f,0xe62ae057,0xe95be461,0xfaf9f0ac,
0x294b1070,0x344833c0,0x03b02627,0xec98eb8d,0x1f390106,0x0a44251a,0xd580ec6f,0xdea0cf6d,
0xe44ce64d,0xefdae890,0x0d81f964,0x33462715,0x28fa349c,0xece807ae,0xfde1eb78,0x26741c5f,
0xef630de6,0xcebcd796,0xe64cdcc6,0xe7cce453,0xf7f3ef0b,0x24aa0aaa,0x34cb32ae,0x0bc42b79,
0xea93ee9b,0x1940faee,0x117e274e,0xd9d7f26e,0xdad3ce6a,0xe475e61d,0xee3ae714,0x07f3f6a5,
0x31f12210,0x2da234de,0xf0aa0fe9,0xf831e9ea,0x27a515eb,0xf5901501,0xce6fdc3b,0xe5bad8d7,
0xe669e4ae,0xf574ed6c,0x1f4e055e,0x34da3105,0x14042f73,0xe97ff310,0x1271f5ae,0x18602776,
0xdebcf8ca,0xd6e0ced1,0xe4f7e51f,0xec9de5d1,0x02f4f45f,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,
};
static const PROGMEM AudioSynthWavetable::sample_data SynthBass2_samples[5] = {
{
(int16_t*)sample_0_SynthBass2_SYBS233, // sample
true, // LOOP
14, // LENGTH_BITS
(1 << (32 - 14)) * WAVETABLE_CENTS_SHIFT(0) * 22050.0 / WAVETABLE_NOTE_TO_FREQUENCY(33) / AUDIO_SAMPLE_RATE_EXACT + 0.5, // PER_HERTZ_PHASE_INCREMENT
((uint32_t)9903 - 1) << (32 - 14), // MAX_PHASE
((uint32_t)9902 - 1) << (32 - 14), // LOOP_PHASE_END
(((uint32_t)9902 - 1) << (32 - 14)) - (((uint32_t)9501 - 1) << (32 - 14)), // LOOP_PHASE_LENGTH
uint16_t(UINT16_MAX * WAVETABLE_DECIBEL_SHIFT(0)), // INITIAL_ATTENUATION_SCALAR
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // DELAY_COUNT
uint32_t(1.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // ATTACK_COUNT
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // HOLD_COUNT
uint32_t(5489.47 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // DECAY_COUNT
uint32_t(150.03 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // RELEASE_COUNT
int32_t((1.0 - WAVETABLE_DECIBEL_SHIFT(-2.1)) * AudioSynthWavetable::UNITY_GAIN), // SUSTAIN_MULT
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / (2 * AudioSynthWavetable::LFO_PERIOD)), // VIBRATO_DELAY
uint32_t(8.2 * AudioSynthWavetable::LFO_PERIOD * (UINT32_MAX / AUDIO_SAMPLE_RATE_EXACT)), // VIBRATO_INCREMENT
(WAVETABLE_CENTS_SHIFT(0) - 1.0) * 4, // VIBRATO_PITCH_COEFFICIENT_INITIAL
(1.0 - WAVETABLE_CENTS_SHIFT(0)) * 4, // VIBRATO_COEFFICIENT_SECONDARY
uint32_t(334.10 * AudioSynthWavetable::SAMPLES_PER_MSEC / (2 * AudioSynthWavetable::LFO_PERIOD)), // MODULATION_DELAY
uint32_t(6.0 * AudioSynthWavetable::LFO_PERIOD * (UINT32_MAX / AUDIO_SAMPLE_RATE_EXACT)), // MODULATION_INCREMENT
(WAVETABLE_CENTS_SHIFT(0) - 1.0) * 4, // MODULATION_PITCH_COEFFICIENT_INITIAL
(1.0 - WAVETABLE_CENTS_SHIFT(0)) * 4, // MODULATION_PITCH_COEFFICIENT_SECOND
int32_t(UINT16_MAX * (WAVETABLE_DECIBEL_SHIFT(0) - 1.0)) * 4, // MODULATION_AMPLITUDE_INITIAL_GAIN
int32_t(UINT16_MAX * (1.0 - WAVETABLE_DECIBEL_SHIFT(0))) * 4, // MODULATION_AMPLITUDE_FINAL_GAIN
},
{
(int16_t*)sample_1_SynthBass2_SYBS248A, // sample
true, // LOOP
12, // LENGTH_BITS
(1 << (32 - 12)) * WAVETABLE_CENTS_SHIFT(0) * 22050.0 / WAVETABLE_NOTE_TO_FREQUENCY(48) / AUDIO_SAMPLE_RATE_EXACT + 0.5, // PER_HERTZ_PHASE_INCREMENT
((uint32_t)3109 - 1) << (32 - 12), // MAX_PHASE
((uint32_t)3108 - 1) << (32 - 12), // LOOP_PHASE_END
(((uint32_t)3108 - 1) << (32 - 12)) - (((uint32_t)2768 - 1) << (32 - 12)), // LOOP_PHASE_LENGTH
uint16_t(UINT16_MAX * WAVETABLE_DECIBEL_SHIFT(0)), // INITIAL_ATTENUATION_SCALAR
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // DELAY_COUNT
uint32_t(1.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // ATTACK_COUNT
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // HOLD_COUNT
uint32_t(5489.47 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // DECAY_COUNT
uint32_t(150.03 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // RELEASE_COUNT
int32_t((1.0 - WAVETABLE_DECIBEL_SHIFT(-2.1)) * AudioSynthWavetable::UNITY_GAIN), // SUSTAIN_MULT
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / (2 * AudioSynthWavetable::LFO_PERIOD)), // VIBRATO_DELAY
uint32_t(8.2 * AudioSynthWavetable::LFO_PERIOD * (UINT32_MAX / AUDIO_SAMPLE_RATE_EXACT)), // VIBRATO_INCREMENT
(WAVETABLE_CENTS_SHIFT(0) - 1.0) * 4, // VIBRATO_PITCH_COEFFICIENT_INITIAL
(1.0 - WAVETABLE_CENTS_SHIFT(0)) * 4, // VIBRATO_COEFFICIENT_SECONDARY
uint32_t(334.10 * AudioSynthWavetable::SAMPLES_PER_MSEC / (2 * AudioSynthWavetable::LFO_PERIOD)), // MODULATION_DELAY
uint32_t(6.0 * AudioSynthWavetable::LFO_PERIOD * (UINT32_MAX / AUDIO_SAMPLE_RATE_EXACT)), // MODULATION_INCREMENT
(WAVETABLE_CENTS_SHIFT(0) - 1.0) * 4, // MODULATION_PITCH_COEFFICIENT_INITIAL
(1.0 - WAVETABLE_CENTS_SHIFT(0)) * 4, // MODULATION_PITCH_COEFFICIENT_SECOND
int32_t(UINT16_MAX * (WAVETABLE_DECIBEL_SHIFT(0) - 1.0)) * 4, // MODULATION_AMPLITUDE_INITIAL_GAIN
int32_t(UINT16_MAX * (1.0 - WAVETABLE_DECIBEL_SHIFT(0))) * 4, // MODULATION_AMPLITUDE_FINAL_GAIN
},
{
(int16_t*)sample_2_SynthBass2_SYBS272A, // sample
true, // LOOP
12, // LENGTH_BITS
(1 << (32 - 12)) * WAVETABLE_CENTS_SHIFT(0) * 22050.0 / WAVETABLE_NOTE_TO_FREQUENCY(72) / AUDIO_SAMPLE_RATE_EXACT + 0.5, // PER_HERTZ_PHASE_INCREMENT
((uint32_t)2999 - 1) << (32 - 12), // MAX_PHASE
((uint32_t)2998 - 1) << (32 - 12), // LOOP_PHASE_END
(((uint32_t)2998 - 1) << (32 - 12)) - (((uint32_t)2956 - 1) << (32 - 12)), // LOOP_PHASE_LENGTH
uint16_t(UINT16_MAX * WAVETABLE_DECIBEL_SHIFT(0)), // INITIAL_ATTENUATION_SCALAR
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // DELAY_COUNT
uint32_t(1.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // ATTACK_COUNT
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // HOLD_COUNT
uint32_t(5489.47 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // DECAY_COUNT
uint32_t(150.03 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // RELEASE_COUNT
int32_t((1.0 - WAVETABLE_DECIBEL_SHIFT(-2.1)) * AudioSynthWavetable::UNITY_GAIN), // SUSTAIN_MULT
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / (2 * AudioSynthWavetable::LFO_PERIOD)), // VIBRATO_DELAY
uint32_t(8.2 * AudioSynthWavetable::LFO_PERIOD * (UINT32_MAX / AUDIO_SAMPLE_RATE_EXACT)), // VIBRATO_INCREMENT
(WAVETABLE_CENTS_SHIFT(0) - 1.0) * 4, // VIBRATO_PITCH_COEFFICIENT_INITIAL
(1.0 - WAVETABLE_CENTS_SHIFT(0)) * 4, // VIBRATO_COEFFICIENT_SECONDARY
uint32_t(334.10 * AudioSynthWavetable::SAMPLES_PER_MSEC / (2 * AudioSynthWavetable::LFO_PERIOD)), // MODULATION_DELAY
uint32_t(6.0 * AudioSynthWavetable::LFO_PERIOD * (UINT32_MAX / AUDIO_SAMPLE_RATE_EXACT)), // MODULATION_INCREMENT
(WAVETABLE_CENTS_SHIFT(0) - 1.0) * 4, // MODULATION_PITCH_COEFFICIENT_INITIAL
(1.0 - WAVETABLE_CENTS_SHIFT(0)) * 4, // MODULATION_PITCH_COEFFICIENT_SECOND
int32_t(UINT16_MAX * (WAVETABLE_DECIBEL_SHIFT(0) - 1.0)) * 4, // MODULATION_AMPLITUDE_INITIAL_GAIN
int32_t(UINT16_MAX * (1.0 - WAVETABLE_DECIBEL_SHIFT(0))) * 4, // MODULATION_AMPLITUDE_FINAL_GAIN
},
{
(int16_t*)sample_3_SynthBass2_SYBS272A, // sample
true, // LOOP
12, // LENGTH_BITS
(1 << (32 - 12)) * WAVETABLE_CENTS_SHIFT(0) * 22050.0 / WAVETABLE_NOTE_TO_FREQUENCY(72) / AUDIO_SAMPLE_RATE_EXACT + 0.5, // PER_HERTZ_PHASE_INCREMENT
((uint32_t)2999 - 1) << (32 - 12), // MAX_PHASE
((uint32_t)2998 - 1) << (32 - 12), // LOOP_PHASE_END
(((uint32_t)2998 - 1) << (32 - 12)) - (((uint32_t)2956 - 1) << (32 - 12)), // LOOP_PHASE_LENGTH
uint16_t(UINT16_MAX * WAVETABLE_DECIBEL_SHIFT(0)), // INITIAL_ATTENUATION_SCALAR
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // DELAY_COUNT
uint32_t(1.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // ATTACK_COUNT
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // HOLD_COUNT
uint32_t(5489.47 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // DECAY_COUNT
uint32_t(150.03 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // RELEASE_COUNT
int32_t((1.0 - WAVETABLE_DECIBEL_SHIFT(-2.1)) * AudioSynthWavetable::UNITY_GAIN), // SUSTAIN_MULT
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / (2 * AudioSynthWavetable::LFO_PERIOD)), // VIBRATO_DELAY
uint32_t(8.2 * AudioSynthWavetable::LFO_PERIOD * (UINT32_MAX / AUDIO_SAMPLE_RATE_EXACT)), // VIBRATO_INCREMENT
(WAVETABLE_CENTS_SHIFT(0) - 1.0) * 4, // VIBRATO_PITCH_COEFFICIENT_INITIAL
(1.0 - WAVETABLE_CENTS_SHIFT(0)) * 4, // VIBRATO_COEFFICIENT_SECONDARY
uint32_t(334.10 * AudioSynthWavetable::SAMPLES_PER_MSEC / (2 * AudioSynthWavetable::LFO_PERIOD)), // MODULATION_DELAY
uint32_t(6.0 * AudioSynthWavetable::LFO_PERIOD * (UINT32_MAX / AUDIO_SAMPLE_RATE_EXACT)), // MODULATION_INCREMENT
(WAVETABLE_CENTS_SHIFT(0) - 1.0) * 4, // MODULATION_PITCH_COEFFICIENT_INITIAL
(1.0 - WAVETABLE_CENTS_SHIFT(0)) * 4, // MODULATION_PITCH_COEFFICIENT_SECOND
int32_t(UINT16_MAX * (WAVETABLE_DECIBEL_SHIFT(0) - 1.0)) * 4, // MODULATION_AMPLITUDE_INITIAL_GAIN
int32_t(UINT16_MAX * (1.0 - WAVETABLE_DECIBEL_SHIFT(0))) * 4, // MODULATION_AMPLITUDE_FINAL_GAIN
},
{
(int16_t*)sample_4_SynthBass2_STLGT84B, // sample
true, // LOOP
12, // LENGTH_BITS
(1 << (32 - 12)) * WAVETABLE_CENTS_SHIFT(0) * 22050.0 / WAVETABLE_NOTE_TO_FREQUENCY(84) / AUDIO_SAMPLE_RATE_EXACT + 0.5, // PER_HERTZ_PHASE_INCREMENT
((uint32_t)2954 - 1) << (32 - 12), // MAX_PHASE
((uint32_t)2953 - 1) << (32 - 12), // LOOP_PHASE_END
(((uint32_t)2953 - 1) << (32 - 12)) - (((uint32_t)2763 - 1) << (32 - 12)), // LOOP_PHASE_LENGTH
uint16_t(UINT16_MAX * WAVETABLE_DECIBEL_SHIFT(0)), // INITIAL_ATTENUATION_SCALAR
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // DELAY_COUNT
uint32_t(1.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // ATTACK_COUNT
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // HOLD_COUNT
uint32_t(5489.47 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // DECAY_COUNT
uint32_t(150.03 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // RELEASE_COUNT
int32_t((1.0 - WAVETABLE_DECIBEL_SHIFT(-2.1)) * AudioSynthWavetable::UNITY_GAIN), // SUSTAIN_MULT
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / (2 * AudioSynthWavetable::LFO_PERIOD)), // VIBRATO_DELAY
uint32_t(8.2 * AudioSynthWavetable::LFO_PERIOD * (UINT32_MAX / AUDIO_SAMPLE_RATE_EXACT)), // VIBRATO_INCREMENT
(WAVETABLE_CENTS_SHIFT(0) - 1.0) * 4, // VIBRATO_PITCH_COEFFICIENT_INITIAL
(1.0 - WAVETABLE_CENTS_SHIFT(0)) * 4, // VIBRATO_COEFFICIENT_SECONDARY
uint32_t(334.10 * AudioSynthWavetable::SAMPLES_PER_MSEC / (2 * AudioSynthWavetable::LFO_PERIOD)), // MODULATION_DELAY
uint32_t(6.0 * AudioSynthWavetable::LFO_PERIOD * (UINT32_MAX / AUDIO_SAMPLE_RATE_EXACT)), // MODULATION_INCREMENT
(WAVETABLE_CENTS_SHIFT(0) - 1.0) * 4, // MODULATION_PITCH_COEFFICIENT_INITIAL
(1.0 - WAVETABLE_CENTS_SHIFT(0)) * 4, // MODULATION_PITCH_COEFFICIENT_SECOND
int32_t(UINT16_MAX * (WAVETABLE_DECIBEL_SHIFT(0) - 1.0)) * 4, // MODULATION_AMPLITUDE_INITIAL_GAIN
int32_t(UINT16_MAX * (1.0 - WAVETABLE_DECIBEL_SHIFT(0))) * 4, // MODULATION_AMPLITUDE_FINAL_GAIN
},
};
static const PROGMEM uint8_t SynthBass2_ranges[] = {43, 66, 83, 96, 127, };
const PROGMEM AudioSynthWavetable::instrument_data SynthBass2 = {5, SynthBass2_ranges, SynthBass2_samples };
| 87.508772 | 151 | 0.885874 | manicken |
aa2189162c3b04b1b1facd84eaca45707d24a94c | 2,818 | cpp | C++ | src/qt/src/corelib/arch/parisc/qatomic_parisc.cpp | martende/phantomjs | 5cecd7dde7b8fd04ad2c036d16f09a8d2a139854 | [
"BSD-3-Clause"
] | 1 | 2015-03-16T20:49:09.000Z | 2015-03-16T20:49:09.000Z | src/qt/src/corelib/arch/parisc/qatomic_parisc.cpp | firedfox/phantomjs | afb0707c9db7b5e693ad1b216a50081565c08ebb | [
"BSD-3-Clause"
] | null | null | null | src/qt/src/corelib/arch/parisc/qatomic_parisc.cpp | firedfox/phantomjs | afb0707c9db7b5e693ad1b216a50081565c08ebb | [
"BSD-3-Clause"
] | null | null | null | /****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtCore/qglobal.h>
#include <QtCore/qhash.h>
QT_BEGIN_NAMESPACE
QT_USE_NAMESPACE
#define UNLOCKED {-1,-1,-1,-1}
#define UNLOCKED2 UNLOCKED,UNLOCKED
#define UNLOCKED4 UNLOCKED2,UNLOCKED2
#define UNLOCKED8 UNLOCKED4,UNLOCKED4
#define UNLOCKED16 UNLOCKED8,UNLOCKED8
#define UNLOCKED32 UNLOCKED16,UNLOCKED16
#define UNLOCKED64 UNLOCKED32,UNLOCKED32
#define UNLOCKED128 UNLOCKED64,UNLOCKED64
#define UNLOCKED256 UNLOCKED128,UNLOCKED128
// use a 4k page for locks
static int locks[256][4] = { UNLOCKED256 };
int *getLock(volatile void *addr)
{ return locks[qHash(const_cast<void *>(addr)) % 256]; }
static int *align16(int *lock)
{
ulong off = (((ulong) lock) % 16);
return off ? (int *)(ulong(lock) + 16 - off) : lock;
}
extern "C" {
int q_ldcw(volatile int *addr);
void q_atomic_lock(int *lock)
{
// ldcw requires a 16-byte aligned address
volatile int *x = align16(lock);
while (q_ldcw(x) == 0)
;
}
void q_atomic_unlock(int *lock)
{ lock[0] = lock[1] = lock[2] = lock[3] = -1; }
}
QT_END_NAMESPACE
| 31.662921 | 77 | 0.679205 | martende |
aa21c0b4124ca9ee858ff56965e21eaf059ff1d7 | 5,289 | cpp | C++ | src/compiler/ParserProductionRule.cpp | LucvandenBrand/OperatorGraph | a15f2c9acfc9265e5ed5cbd89a8d3f7f638cb565 | [
"MIT"
] | null | null | null | src/compiler/ParserProductionRule.cpp | LucvandenBrand/OperatorGraph | a15f2c9acfc9265e5ed5cbd89a8d3f7f638cb565 | [
"MIT"
] | null | null | null | src/compiler/ParserProductionRule.cpp | LucvandenBrand/OperatorGraph | a15f2c9acfc9265e5ed5cbd89a8d3f7f638cb565 | [
"MIT"
] | null | null | null | #include <algorithm>
#include <cctype>
#include <functional>
#include <boost/variant/get.hpp>
#include <pga/compiler/Symbol.h>
#include <pga/compiler/Operator.h>
#include "ParserUtils.h"
#include "ParserOperator.h"
#include "ParserSymbol.h"
#include "ParserProductionRule.h"
namespace PGA
{
namespace Compiler
{
namespace Parser
{
bool ProductionRule::check(Logger& logger)
{
double probabilitySum = 0;
unsigned int else_idx = 0;
for (auto it = successors.begin(); it != successors.end(); ++it)
{
double tmp_prob = 0;
unsigned int idx = static_cast<unsigned int>(std::distance(successors.begin(), it));
switch (it->which())
{
case 0:
{
Symbol& sym = boost::get<Symbol>(*it);
tmp_prob = sym.probability;
if (tmp_prob == -1)
if (else_idx != 0)
{
logger.addMessage(Logger::LL_ERROR, "(line = %d, column = %d) multiple *else* branches in stochastic rule (%s)", line + 1, column, symbol.c_str());
return false;
}
else
else_idx = idx;
else
probabilitySum += tmp_prob;
break;
}
case 1:
{
Operator& op = boost::get<Operator>(*it);
tmp_prob = op.probability;
if (tmp_prob == -1)
if (else_idx != 0)
{
logger.addMessage(Logger::LL_ERROR, "(line = %d, column = %d) multiple *else* branches in stochastic rule (%s)", line + 1, column, symbol.c_str());
return false;
}
else
else_idx = idx;
else
{
probabilitySum += tmp_prob;
if (op.check(logger) == false)
return false;
}
break;
}
}
}
if (probabilitySum >= 100)
{
logger.addMessage(Logger::LL_ERROR, "probability sum of stochastic rule(%s) is %d (more than 100%)", symbol.c_str(), probabilitySum);
return false;
}
else
{
double else_prob = 100 - probabilitySum;
switch (successors.at(else_idx).which())
{
case 0:
boost::get<Symbol>(successors.at(else_idx)).probability = else_prob;
break;
case 1:
boost::get<Operator>(successors.at(else_idx)).probability = else_prob;
break;
}
}
return true;
}
void ProductionRule::convertToAbstraction(std::vector<PGA::Compiler::Terminal>& terminals, PGA::Compiler::Rule& rule) const
{
rule.symbol = trim(symbol);
double probabilitySum = 0;
switch (successors.at(0).which())
{
case 0:
probabilitySum = boost::get<Symbol>(successors.at(0)).probability;
break;
case 1:
probabilitySum = boost::get<Operator>(successors.at(0)).probability;
break;
}
// TODO: Maybe support more rule successors (e.g. A --> B C D;)
// For this, changes to the abstraction in ProductionRule.h need to be made
// but this is not supported anyway (see next comment)
if ((probabilitySum == 100) && (successors.size() == 1))
{
for (auto it = successors.begin(); it != successors.end(); ++it)
{
switch (it->which())
{
case 0: // shouldn't happen: RuleA --> RuleB produces cpp code with only CallRule<RuleB>, which is not supported afaik (but this works in the editor)
rule.successor = std::shared_ptr<PGA::Compiler::Successor>(new PGA::Compiler::Symbol(boost::get<Symbol>(*it).symbol));
rule.successor->id = nextSuccessorIdx();
rule.successor->myrule = symbol;
break;
case 1:
Operator op = boost::get<Operator>(*it);
PGA::Compiler::Operator* newOperator = new PGA::Compiler::Operator();
newOperator->myrule = symbol;
newOperator->id = nextSuccessorIdx();
if (op.operator_ == OperatorType::GENERATE)
{
for (auto it = terminals.begin(); it != terminals.end(); ++it)
{
// The 'if' below is true when there's a RuleA --> Generate()
if (std::find(it->symbols.begin(), it->symbols.end(), symbol) != it->symbols.end())
{
newOperator->type = OperatorType::GENERATE;
for (const auto& termAttr : it->parameters)
newOperator->terminalAttributes.push_back(termAttr);
break;
}
}
}
rule.successor = std::shared_ptr<PGA::Compiler::Successor>(newOperator);
op.convertToAbstraction(terminals, *newOperator, rule);
break;
}
}
}
else
{
Operator stochasticOperator;
stochasticOperator.operator_ = STOCHASTIC;
for (auto it = successors.begin(); it != successors.end(); ++it)
{
ParameterizedSuccessor parameterizedSuccessor(*it);
switch (it->which())
{
case 0:
parameterizedSuccessor.parameters.push_back(boost::get<Symbol>(*it).probability);
break;
case 1:
parameterizedSuccessor.parameters.push_back(boost::get<Operator>(*it).probability);
break;
}
stochasticOperator.successors.push_back(parameterizedSuccessor);
}
PGA::Compiler::Operator* newOperator = new PGA::Compiler::Operator();
newOperator->id = nextSuccessorIdx();
newOperator->myrule = symbol;
rule.successor = std::shared_ptr<PGA::Compiler::Successor>(newOperator);
stochasticOperator.convertToAbstraction(terminals, *newOperator, rule);
}
}
}
}
} | 29.220994 | 155 | 0.607487 | LucvandenBrand |
aa2230de19cb2fff34da3fa5a554b9a482a49b55 | 4,400 | cpp | C++ | HugeCTR/src/optimizer.cpp | x-y-z/HugeCTR | 17bf942215df60827ece9dc015af5191ef9219b7 | [
"Apache-2.0"
] | 130 | 2021-10-11T11:55:28.000Z | 2022-03-31T21:53:07.000Z | HugeCTR/src/optimizer.cpp | Teora/HugeCTR | c55a63401ad350669ccfcd374aefd7a5fc879ca2 | [
"Apache-2.0"
] | 72 | 2021-10-09T04:59:09.000Z | 2022-03-31T11:27:54.000Z | HugeCTR/src/optimizer.cpp | Teora/HugeCTR | c55a63401ad350669ccfcd374aefd7a5fc879ca2 | [
"Apache-2.0"
] | 29 | 2021-11-03T22:35:01.000Z | 2022-03-30T13:11:59.000Z | /*
* Copyright (c) 2021, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <optimizer.hpp>
#include <optimizers/adagrad_optimizer.hpp>
#include <optimizers/adam_optimizer.hpp>
#include <optimizers/momentum_sgd_optimizer.hpp>
#include <optimizers/nesterov_optimizer.hpp>
#include <optimizers/sgd_optimizer.hpp>
#include <type_traits>
namespace HugeCTR {
OptParamsPy::OptParamsPy() : initialized(false) {}
OptParamsPy::OptParamsPy(Optimizer_t optimizer_type, Update_t update_t,
OptHyperParams opt_hyper_params)
: optimizer(optimizer_type),
update_type(update_t),
hyperparams(opt_hyper_params),
initialized(true) {}
template <typename T>
std::unique_ptr<Optimizer> Optimizer::Create(const OptParams& params,
const Tensor2<float>& weight_main,
const Tensor2<__half>& weight_main_half,
const Tensor2<T>& wgrad, const float scaler,
const std::shared_ptr<BufferBlock2<T>>& opt_buff,
const std::shared_ptr<GPUResource>& gpu_resource,
bool use_mixed_precision) {
std::unique_ptr<Optimizer> ret;
switch (params.optimizer) {
case Optimizer_t::Adam: {
auto lr = params.lr;
auto beta1 = params.hyperparams.adam.beta1;
auto beta2 = params.hyperparams.adam.beta2;
auto epsilon = params.hyperparams.adam.epsilon;
ret.reset(new AdamOptimizer<T>(weight_main, wgrad, opt_buff, gpu_resource, lr, beta1, beta2,
epsilon, scaler));
break;
}
case Optimizer_t::AdaGrad: {
auto lr = params.lr;
auto initial_accu_value = params.hyperparams.adagrad.initial_accu_value;
auto epsilon = params.hyperparams.adagrad.epsilon;
ret.reset(new AdaGradOptimizer<T>(weight_main, wgrad, opt_buff, gpu_resource, lr,
initial_accu_value, epsilon, scaler));
}
case Optimizer_t::MomentumSGD: {
auto learning_rate = params.lr;
auto momentum_factor = params.hyperparams.momentum.factor;
ret.reset(new MomentumSGDOptimizer<T>(weight_main, wgrad, opt_buff, gpu_resource,
learning_rate, momentum_factor, scaler));
break;
}
case Optimizer_t::Nesterov: {
auto learning_rate = params.lr;
auto momentum_factor = params.hyperparams.nesterov.mu;
ret.reset(new NesterovOptimizer<T>(weight_main, wgrad, opt_buff, gpu_resource, learning_rate,
momentum_factor, scaler));
break;
}
case Optimizer_t::SGD: {
auto learning_rate = params.lr;
ret.reset(new SGDOptimizer<T>(weight_main, weight_main_half, wgrad, gpu_resource,
learning_rate, scaler, use_mixed_precision));
break;
}
default:
assert(!"Error: no such optimizer && should never get here!");
}
return ret;
}
template std::unique_ptr<Optimizer> Optimizer::Create<float>(
const OptParams& params, const Tensor2<float>& weight_main,
const Tensor2<__half>& weight_main_half, const Tensor2<float>& wgrad, const float scaler,
const std::shared_ptr<BufferBlock2<float>>& opt_buff,
const std::shared_ptr<GPUResource>& gpu_resource, bool use_mixed_precision);
template std::unique_ptr<Optimizer> Optimizer::Create<__half>(
const OptParams& params, const Tensor2<float>& weight_main,
const Tensor2<__half>& weight_main_half, const Tensor2<__half>& wgrad, const float scaler,
const std::shared_ptr<BufferBlock2<__half>>& opt_buff,
const std::shared_ptr<GPUResource>& gpu_resource, bool use_mixed_precision);
} // end namespace HugeCTR
| 43.137255 | 99 | 0.655909 | x-y-z |
aa230dc8b07ea8f54f90d006f116822cb4a903f1 | 25,341 | cpp | C++ | src/hardware/gus.cpp | electroduck/boxless | f3a587c73c8003acac3f40392e323600aa6ebb62 | [
"BSD-3-Clause"
] | null | null | null | src/hardware/gus.cpp | electroduck/boxless | f3a587c73c8003acac3f40392e323600aa6ebb62 | [
"BSD-3-Clause"
] | null | null | null | src/hardware/gus.cpp | electroduck/boxless | f3a587c73c8003acac3f40392e323600aa6ebb62 | [
"BSD-3-Clause"
] | null | null | null | /*
* Copyright (C) 2002-2010 The DOSBox Team
*
* 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.
*/
/* $Id: gus.cpp,v 1.37 2009-09-03 16:03:01 c2woody Exp $ */
#include <string.h>
#include <iomanip>
#include <sstream>
#include "dosbox.h"
#include "inout.h"
#include "mixer.h"
#include "dma.h"
#include "pic.h"
#include "setup.h"
#include "shell.h"
#include "math.h"
#include "regs.h"
using namespace std;
//Extra bits of precision over normal gus
#define WAVE_BITS 2
#define WAVE_FRACT (9+WAVE_BITS)
#define WAVE_FRACT_MASK ((1 << WAVE_FRACT)-1)
#define WAVE_MSWMASK ((1 << (16+WAVE_BITS))-1)
#define WAVE_LSWMASK (0xffffffff ^ WAVE_MSWMASK)
//Amount of precision the volume has
#define RAMP_FRACT (10)
#define RAMP_FRACT_MASK ((1 << RAMP_FRACT)-1)
#define GUS_BASE myGUS.portbase
#define GUS_RATE myGUS.rate
#define LOG_GUS 0
Bit8u adlib_commandreg;
static MixerChannel * gus_chan;
static Bit8u irqtable[8] = { 0, 2, 5, 3, 7, 11, 12, 15 };
static Bit8u dmatable[8] = { 0, 1, 3, 5, 6, 7, 0, 0 };
static Bit8u GUSRam[1024*1024]; // 1024K of GUS Ram
static Bit32s AutoAmp = 512;
static Bit16u vol16bit[4096];
static Bit32u pantable[16];
class GUSChannels;
static void CheckVoiceIrq(void);
struct GFGus {
Bit8u gRegSelect;
Bit16u gRegData;
Bit32u gDramAddr;
Bit16u gCurChannel;
Bit8u DMAControl;
Bit16u dmaAddr;
Bit8u TimerControl;
Bit8u SampControl;
Bit8u mixControl;
Bit8u ActiveChannels;
Bit32u basefreq;
struct GusTimer {
Bit8u value;
bool reached;
bool raiseirq;
bool masked;
bool running;
float delay;
} timers[2];
Bit32u rate;
Bitu portbase;
Bit8u dma1;
Bit8u dma2;
Bit8u irq1;
Bit8u irq2;
bool irqenabled;
bool ChangeIRQDMA;
// IRQ status register values
Bit8u IRQStatus;
Bit32u ActiveMask;
Bit8u IRQChan;
Bit32u RampIRQ;
Bit32u WaveIRQ;
} myGUS;
Bitu DEBUG_EnableDebugger(void);
static void GUS_DMA_Callback(DmaChannel * chan,DMAEvent event);
// Returns a single 16-bit sample from the Gravis's RAM
static INLINE Bit32s GetSample(Bit32u Delta, Bit32u CurAddr, bool eightbit) {
Bit32u useAddr;
Bit32u holdAddr;
useAddr = CurAddr >> WAVE_FRACT;
if (eightbit) {
if (Delta >= (1 << WAVE_FRACT)) {
Bit32s tmpsmall = (Bit8s)GUSRam[useAddr];
return tmpsmall << 8;
} else {
// Interpolate
Bit32s w1 = ((Bit8s)GUSRam[useAddr+0]) << 8;
Bit32s w2 = ((Bit8s)GUSRam[useAddr+1]) << 8;
Bit32s diff = w2 - w1;
return (w1+((diff*(Bit32s)(CurAddr&WAVE_FRACT_MASK ))>>WAVE_FRACT));
}
} else {
// Formula used to convert addresses for use with 16-bit samples
holdAddr = useAddr & 0xc0000L;
useAddr = useAddr & 0x1ffffL;
useAddr = useAddr << 1;
useAddr = (holdAddr | useAddr);
if(Delta >= (1 << WAVE_FRACT)) {
return (GUSRam[useAddr+0] | (((Bit8s)GUSRam[useAddr+1]) << 8));
} else {
// Interpolate
Bit32s w1 = (GUSRam[useAddr+0] | (((Bit8s)GUSRam[useAddr+1]) << 8));
Bit32s w2 = (GUSRam[useAddr+2] | (((Bit8s)GUSRam[useAddr+3]) << 8));
Bit32s diff = w2 - w1;
return (w1+((diff*(Bit32s)(CurAddr&WAVE_FRACT_MASK ))>>WAVE_FRACT));
}
}
}
class GUSChannels {
public:
Bit32u WaveStart;
Bit32u WaveEnd;
Bit32u WaveAddr;
Bit32u WaveAdd;
Bit8u WaveCtrl;
Bit16u WaveFreq;
Bit32u RampStart;
Bit32u RampEnd;
Bit32u RampVol;
Bit32u RampAdd;
Bit32u RampAddReal;
Bit8u RampRate;
Bit8u RampCtrl;
Bit8u PanPot;
Bit8u channum;
Bit32u irqmask;
Bit32u PanLeft;
Bit32u PanRight;
Bit32s VolLeft;
Bit32s VolRight;
GUSChannels(Bit8u num) {
channum = num;
irqmask = 1 << num;
WaveStart = 0;
WaveEnd = 0;
WaveAddr = 0;
WaveAdd = 0;
WaveFreq = 0;
WaveCtrl = 3;
RampRate = 0;
RampStart = 0;
RampEnd = 0;
RampCtrl = 3;
RampAdd = 0;
RampVol = 0;
VolLeft = 0;
VolRight = 0;
PanLeft = 0;
PanRight = 0;
PanPot = 0x7;
};
void WriteWaveFreq(Bit16u val) {
WaveFreq = val;
double frameadd = double(val >> 1)/512.0; //Samples / original gus frame
double realadd = (frameadd*(double)myGUS.basefreq/(double)GUS_RATE) * (double)(1 << WAVE_FRACT);
WaveAdd = (Bit32u)realadd;
}
void WriteWaveCtrl(Bit8u val) {
Bit32u oldirq=myGUS.WaveIRQ;
WaveCtrl = val & 0x7f;
if ((val & 0xa0)==0xa0) myGUS.WaveIRQ|=irqmask;
else myGUS.WaveIRQ&=~irqmask;
if (oldirq != myGUS.WaveIRQ)
CheckVoiceIrq();
}
INLINE Bit8u ReadWaveCtrl(void) {
Bit8u ret=WaveCtrl;
if (myGUS.WaveIRQ & irqmask) ret|=0x80;
return ret;
}
void UpdateWaveRamp(void) {
WriteWaveFreq(WaveFreq);
WriteRampRate(RampRate);
}
void WritePanPot(Bit8u val) {
PanPot = val;
PanLeft = pantable[0x0f-(val & 0xf)];
PanRight = pantable[(val & 0xf)];
UpdateVolumes();
}
Bit8u ReadPanPot(void) {
return PanPot;
}
void WriteRampCtrl(Bit8u val) {
Bit32u old=myGUS.RampIRQ;
RampCtrl = val & 0x7f;
if ((val & 0xa0)==0xa0) myGUS.RampIRQ|=irqmask;
else myGUS.RampIRQ&=~irqmask;
if (old != myGUS.RampIRQ) CheckVoiceIrq();
}
INLINE Bit8u ReadRampCtrl(void) {
Bit8u ret=RampCtrl;
if (myGUS.RampIRQ & irqmask) ret|=0x80;
return ret;
}
void WriteRampRate(Bit8u val) {
RampRate = val;
double frameadd = (double)(RampRate & 63)/(double)(1 << (3*(val >> 6)));
double realadd = (frameadd*(double)myGUS.basefreq/(double)GUS_RATE) * (double)(1 << RAMP_FRACT);
RampAdd = (Bit32u)realadd;
}
INLINE void WaveUpdate(void) {
if (WaveCtrl & 0x3) return;
Bit32s WaveLeft;
if (WaveCtrl & 0x40) {
WaveAddr-=WaveAdd;
WaveLeft=WaveStart-WaveAddr;
} else {
WaveAddr+=WaveAdd;
WaveLeft=WaveAddr-WaveEnd;
}
if (WaveLeft<0) return;
/* Generate an IRQ if needed */
if (WaveCtrl & 0x20) {
myGUS.WaveIRQ|=irqmask;
}
/* Check for not being in PCM operation */
if (RampCtrl & 0x04) return;
/* Check for looping */
if (WaveCtrl & 0x08) {
/* Bi-directional looping */
if (WaveCtrl & 0x10) WaveCtrl^=0x40;
WaveAddr = (WaveCtrl & 0x40) ? (WaveEnd-WaveLeft) : (WaveStart+WaveLeft);
} else {
WaveCtrl|=1; //Stop the channel
WaveAddr = (WaveCtrl & 0x40) ? WaveStart : WaveEnd;
}
}
INLINE void UpdateVolumes(void) {
Bit32s templeft=RampVol - PanLeft;
templeft&=~(templeft >> 31);
Bit32s tempright=RampVol - PanRight;
tempright&=~(tempright >> 31);
VolLeft=vol16bit[templeft >> RAMP_FRACT];
VolRight=vol16bit[tempright >> RAMP_FRACT];
}
INLINE void RampUpdate(void) {
/* Check if ramping enabled */
if (RampCtrl & 0x3) return;
Bit32s RampLeft;
if (RampCtrl & 0x40) {
RampVol-=RampAdd;
RampLeft=RampStart-RampVol;
} else {
RampVol+=RampAdd;
RampLeft=RampVol-RampEnd;
}
if (RampLeft<0) {
UpdateVolumes();
return;
}
/* Generate an IRQ if needed */
if (RampCtrl & 0x20) {
myGUS.RampIRQ|=irqmask;
}
/* Check for looping */
if (RampCtrl & 0x08) {
/* Bi-directional looping */
if (RampCtrl & 0x10) RampCtrl^=0x40;
RampVol = (RampCtrl & 0x40) ? (RampEnd-RampLeft) : (RampStart+RampLeft);
} else {
RampCtrl|=1; //Stop the channel
RampVol = (RampCtrl & 0x40) ? RampStart : RampEnd;
}
UpdateVolumes();
}
void generateSamples(Bit32s * stream,Bit32u len) {
int i;
Bit32s tmpsamp;
bool eightbit;
if (RampCtrl & WaveCtrl & 3) return;
eightbit = ((WaveCtrl & 0x4) == 0);
for(i=0;i<(int)len;i++) {
// Get sample
tmpsamp = GetSample(WaveAdd, WaveAddr, eightbit);
// Output stereo sample
stream[i<<1]+= tmpsamp * VolLeft;
stream[(i<<1)+1]+= tmpsamp * VolRight;
WaveUpdate();
RampUpdate();
}
}
};
static GUSChannels *guschan[32];
static GUSChannels *curchan;
static void GUSReset(void) {
if((myGUS.gRegData & 0x1) == 0x1) {
// Reset
adlib_commandreg = 85;
myGUS.IRQStatus = 0;
myGUS.timers[0].raiseirq = false;
myGUS.timers[1].raiseirq = false;
myGUS.timers[0].reached = false;
myGUS.timers[1].reached = false;
myGUS.timers[0].running = false;
myGUS.timers[1].running = false;
myGUS.timers[0].value = 0xff;
myGUS.timers[1].value = 0xff;
myGUS.timers[0].delay = 0.080f;
myGUS.timers[1].delay = 0.320f;
myGUS.ChangeIRQDMA = false;
myGUS.mixControl = 0x0b; // latches enabled by default LINEs disabled
// Stop all channels
int i;
for(i=0;i<32;i++) {
guschan[i]->RampVol=0;
guschan[i]->WriteWaveCtrl(0x1);
guschan[i]->WriteRampCtrl(0x1);
guschan[i]->WritePanPot(0x7);
}
myGUS.IRQChan = 0;
}
if ((myGUS.gRegData & 0x4) != 0) {
myGUS.irqenabled = true;
} else {
myGUS.irqenabled = false;
}
}
static INLINE void GUS_CheckIRQ(void) {
if (myGUS.IRQStatus && (myGUS.mixControl & 0x08))
PIC_ActivateIRQ(myGUS.irq1);
}
static void CheckVoiceIrq(void) {
myGUS.IRQStatus&=0x9f;
Bitu totalmask=(myGUS.RampIRQ|myGUS.WaveIRQ) & myGUS.ActiveMask;
if (!totalmask) return;
if (myGUS.RampIRQ) myGUS.IRQStatus|=0x40;
if (myGUS.WaveIRQ) myGUS.IRQStatus|=0x20;
GUS_CheckIRQ();
for (;;) {
Bit32u check=(1 << myGUS.IRQChan);
if (totalmask & check) return;
myGUS.IRQChan++;
if (myGUS.IRQChan>=myGUS.ActiveChannels) myGUS.IRQChan=0;
}
}
static Bit16u ExecuteReadRegister(void) {
Bit8u tmpreg;
// LOG_MSG("Read global reg %x",myGUS.gRegSelect);
switch (myGUS.gRegSelect) {
case 0x41: // Dma control register - read acknowledges DMA IRQ
tmpreg = myGUS.DMAControl & 0xbf;
tmpreg |= (myGUS.IRQStatus & 0x80) >> 1;
myGUS.IRQStatus&=0x7f;
return (Bit16u)(tmpreg << 8);
case 0x42: // Dma address register
return myGUS.dmaAddr;
case 0x45: // Timer control register. Identical in operation to Adlib's timer
return (Bit16u)(myGUS.TimerControl << 8);
break;
case 0x49: // Dma sample register
tmpreg = myGUS.DMAControl & 0xbf;
tmpreg |= (myGUS.IRQStatus & 0x80) >> 1;
return (Bit16u)(tmpreg << 8);
case 0x80: // Channel voice control read register
if (curchan) return curchan->ReadWaveCtrl() << 8;
else return 0x0300;
case 0x82: // Channel MSB start address register
if (curchan) return (Bit16u)(curchan->WaveStart >> (WAVE_BITS+16));
else return 0x0000;
case 0x83: // Channel LSW start address register
if (curchan) return (Bit16u)(curchan->WaveStart >> WAVE_BITS);
else return 0x0000;
case 0x89: // Channel volume register
if (curchan) return (Bit16u)((curchan->RampVol >> RAMP_FRACT) << 4);
else return 0x0000;
case 0x8a: // Channel MSB current address register
if (curchan) return (Bit16u)(curchan->WaveAddr >> (WAVE_BITS+16));
else return 0x0000;
case 0x8b: // Channel LSW current address register
if (curchan) return (Bit16u)(curchan->WaveAddr >> WAVE_BITS);
else return 0x0000;
case 0x8d: // Channel volume control register
if (curchan) return curchan->ReadRampCtrl() << 8;
else return 0x0300;
case 0x8f: // General channel IRQ status register
tmpreg=myGUS.IRQChan|0x20;
Bit32u mask;
mask=1 << myGUS.IRQChan;
if (!(myGUS.RampIRQ & mask)) tmpreg|=0x40;
if (!(myGUS.WaveIRQ & mask)) tmpreg|=0x80;
myGUS.RampIRQ&=~mask;
myGUS.WaveIRQ&=~mask;
CheckVoiceIrq();
return (Bit16u)(tmpreg << 8);
default:
#if LOG_GUS
LOG_MSG("Read Register num 0x%x", myGUS.gRegSelect);
#endif
return myGUS.gRegData;
}
}
static void GUS_TimerEvent(Bitu val) {
if (!myGUS.timers[val].masked) myGUS.timers[val].reached=true;
if (myGUS.timers[val].raiseirq) {
myGUS.IRQStatus|=0x4 << val;
GUS_CheckIRQ();
}
if (myGUS.timers[val].running)
PIC_AddEvent(GUS_TimerEvent,myGUS.timers[val].delay,val);
}
static void ExecuteGlobRegister(void) {
int i;
// if (myGUS.gRegSelect|1!=0x44) LOG_MSG("write global register %x with %x", myGUS.gRegSelect, myGUS.gRegData);
switch(myGUS.gRegSelect) {
case 0x0: // Channel voice control register
if(curchan) curchan->WriteWaveCtrl((Bit16u)myGUS.gRegData>>8);
break;
case 0x1: // Channel frequency control register
if(curchan) curchan->WriteWaveFreq(myGUS.gRegData);
break;
case 0x2: // Channel MSW start address register
if (curchan) {
Bit32u tmpaddr = (Bit32u)(myGUS.gRegData & 0x1fff) << (16+WAVE_BITS);
curchan->WaveStart = (curchan->WaveStart & WAVE_MSWMASK) | tmpaddr;
}
break;
case 0x3: // Channel LSW start address register
if(curchan != NULL) {
Bit32u tmpaddr = (Bit32u)(myGUS.gRegData) << WAVE_BITS;
curchan->WaveStart = (curchan->WaveStart & WAVE_LSWMASK) | tmpaddr;
}
break;
case 0x4: // Channel MSW end address register
if(curchan != NULL) {
Bit32u tmpaddr = (Bit32u)(myGUS.gRegData & 0x1fff) << (16+WAVE_BITS);
curchan->WaveEnd = (curchan->WaveEnd & WAVE_MSWMASK) | tmpaddr;
}
break;
case 0x5: // Channel MSW end address register
if(curchan != NULL) {
Bit32u tmpaddr = (Bit32u)(myGUS.gRegData) << WAVE_BITS;
curchan->WaveEnd = (curchan->WaveEnd & WAVE_LSWMASK) | tmpaddr;
}
break;
case 0x6: // Channel volume ramp rate register
if(curchan != NULL) {
Bit8u tmpdata = (Bit16u)myGUS.gRegData>>8;
curchan->WriteRampRate(tmpdata);
}
break;
case 0x7: // Channel volume ramp start register EEEEMMMM
if(curchan != NULL) {
Bit8u tmpdata = (Bit16u)myGUS.gRegData >> 8;
curchan->RampStart = tmpdata << (4+RAMP_FRACT);
}
break;
case 0x8: // Channel volume ramp end register EEEEMMMM
if(curchan != NULL) {
Bit8u tmpdata = (Bit16u)myGUS.gRegData >> 8;
curchan->RampEnd = tmpdata << (4+RAMP_FRACT);
}
break;
case 0x9: // Channel current volume register
if(curchan != NULL) {
Bit16u tmpdata = (Bit16u)myGUS.gRegData >> 4;
curchan->RampVol = tmpdata << RAMP_FRACT;
curchan->UpdateVolumes();
}
break;
case 0xA: // Channel MSW current address register
if(curchan != NULL) {
Bit32u tmpaddr = (Bit32u)(myGUS.gRegData & 0x1fff) << (16+WAVE_BITS);
curchan->WaveAddr = (curchan->WaveAddr & WAVE_MSWMASK) | tmpaddr;
}
break;
case 0xB: // Channel LSW current address register
if(curchan != NULL) {
Bit32u tmpaddr = (Bit32u)(myGUS.gRegData) << (WAVE_BITS);
curchan->WaveAddr = (curchan->WaveAddr & WAVE_LSWMASK) | tmpaddr;
}
break;
case 0xC: // Channel pan pot register
if(curchan) curchan->WritePanPot((Bit16u)myGUS.gRegData>>8);
break;
case 0xD: // Channel volume control register
if(curchan) curchan->WriteRampCtrl((Bit16u)myGUS.gRegData>>8);
break;
case 0xE: // Set active channel register
myGUS.gRegSelect = myGUS.gRegData>>8; //JAZZ Jackrabbit seems to assume this?
myGUS.ActiveChannels = 1+((myGUS.gRegData>>8) & 63);
if(myGUS.ActiveChannels < 14) myGUS.ActiveChannels = 14;
if(myGUS.ActiveChannels > 32) myGUS.ActiveChannels = 32;
myGUS.ActiveMask=0xffffffffU >> (32-myGUS.ActiveChannels);
gus_chan->Enable(true);
myGUS.basefreq = (Bit32u)((float)1000000/(1.619695497*(float)(myGUS.ActiveChannels)));
#if LOG_GUS
LOG_MSG("GUS set to %d channels", myGUS.ActiveChannels);
#endif
for (i=0;i<myGUS.ActiveChannels;i++) guschan[i]->UpdateWaveRamp();
break;
case 0x10: // Undocumented register used in Fast Tracker 2
break;
case 0x41: // Dma control register
myGUS.DMAControl = (Bit8u)(myGUS.gRegData>>8);
GetDMAChannel(myGUS.dma1)->Register_Callback(
(myGUS.DMAControl & 0x1) ? GUS_DMA_Callback : 0);
break;
case 0x42: // Gravis DRAM DMA address register
myGUS.dmaAddr = myGUS.gRegData;
break;
case 0x43: // MSB Peek/poke DRAM position
myGUS.gDramAddr = (0xff0000 & myGUS.gDramAddr) | ((Bit32u)myGUS.gRegData);
break;
case 0x44: // LSW Peek/poke DRAM position
myGUS.gDramAddr = (0xffff & myGUS.gDramAddr) | ((Bit32u)myGUS.gRegData>>8) << 16;
break;
case 0x45: // Timer control register. Identical in operation to Adlib's timer
myGUS.TimerControl = (Bit8u)(myGUS.gRegData>>8);
myGUS.timers[0].raiseirq=(myGUS.TimerControl & 0x04)>0;
if (!myGUS.timers[0].raiseirq) myGUS.IRQStatus&=~0x04;
myGUS.timers[1].raiseirq=(myGUS.TimerControl & 0x08)>0;
if (!myGUS.timers[1].raiseirq) myGUS.IRQStatus&=~0x08;
break;
case 0x46: // Timer 1 control
myGUS.timers[0].value = (Bit8u)(myGUS.gRegData>>8);
myGUS.timers[0].delay = (0x100 - myGUS.timers[0].value) * 0.080f;
break;
case 0x47: // Timer 2 control
myGUS.timers[1].value = (Bit8u)(myGUS.gRegData>>8);
myGUS.timers[1].delay = (0x100 - myGUS.timers[1].value) * 0.320f;
break;
case 0x49: // DMA sampling control register
myGUS.SampControl = (Bit8u)(myGUS.gRegData>>8);
GetDMAChannel(myGUS.dma1)->Register_Callback(
(myGUS.SampControl & 0x1) ? GUS_DMA_Callback : 0);
break;
case 0x4c: // GUS reset register
GUSReset();
break;
default:
#if LOG_GUS
LOG_MSG("Unimplemented global register %x -- %x", myGUS.gRegSelect, myGUS.gRegData);
#endif
break;
}
return;
}
static Bitu read_gus(Bitu port,Bitu iolen) {
// LOG_MSG("read from gus port %x",port);
switch(port - GUS_BASE) {
case 0x206:
return myGUS.IRQStatus;
case 0x208:
Bit8u tmptime;
tmptime = 0;
if (myGUS.timers[0].reached) tmptime |= (1 << 6);
if (myGUS.timers[1].reached) tmptime |= (1 << 5);
if (tmptime & 0x60) tmptime |= (1 << 7);
if (myGUS.IRQStatus & 0x04) tmptime|=(1 << 2);
if (myGUS.IRQStatus & 0x08) tmptime|=(1 << 1);
return tmptime;
case 0x20a:
return adlib_commandreg;
case 0x302:
return (Bit8u)myGUS.gCurChannel;
case 0x303:
return myGUS.gRegSelect;
case 0x304:
if (iolen==2) return ExecuteReadRegister() & 0xffff;
else return ExecuteReadRegister() & 0xff;
case 0x305:
return ExecuteReadRegister() >> 8;
case 0x307:
if(myGUS.gDramAddr < sizeof(GUSRam)) {
return GUSRam[myGUS.gDramAddr];
} else {
return 0;
}
default:
#if LOG_GUS
LOG_MSG("Read GUS at port 0x%x", port);
#endif
break;
}
return 0xff;
}
static void write_gus(Bitu port,Bitu val,Bitu iolen) {
// LOG_MSG("Write gus port %x val %x",port,val);
switch(port - GUS_BASE) {
case 0x200:
myGUS.mixControl = (Bit8u)val;
myGUS.ChangeIRQDMA = true;
return;
case 0x208:
adlib_commandreg = (Bit8u)val;
break;
case 0x209:
//TODO adlib_commandreg should be 4 for this to work else it should just latch the value
if (val & 0x80) {
myGUS.timers[0].reached=false;
myGUS.timers[1].reached=false;
return;
}
myGUS.timers[0].masked=(val & 0x40)>0;
myGUS.timers[1].masked=(val & 0x20)>0;
if (val & 0x1) {
if (!myGUS.timers[0].running) {
PIC_AddEvent(GUS_TimerEvent,myGUS.timers[0].delay,0);
myGUS.timers[0].running=true;
}
} else myGUS.timers[0].running=false;
if (val & 0x2) {
if (!myGUS.timers[1].running) {
PIC_AddEvent(GUS_TimerEvent,myGUS.timers[1].delay,1);
myGUS.timers[1].running=true;
}
} else myGUS.timers[1].running=false;
break;
//TODO Check if 0x20a register is also available on the gus like on the interwave
case 0x20b:
if (!myGUS.ChangeIRQDMA) break;
myGUS.ChangeIRQDMA=false;
if (myGUS.mixControl & 0x40) {
// IRQ configuration, only use low bits for irq 1
if (irqtable[val & 0x7]) myGUS.irq1=irqtable[val & 0x7];
#if LOG_GUS
LOG_MSG("Assigned GUS to IRQ %d", myGUS.irq1);
#endif
} else {
// DMA configuration, only use low bits for dma 1
if (dmatable[val & 0x7]) myGUS.dma1=dmatable[val & 0x7];
#if LOG_GUS
LOG_MSG("Assigned GUS to DMA %d", myGUS.dma1);
#endif
}
break;
case 0x302:
myGUS.gCurChannel = val & 31 ;
curchan = guschan[myGUS.gCurChannel];
break;
case 0x303:
myGUS.gRegSelect = (Bit8u)val;
myGUS.gRegData = 0;
break;
case 0x304:
if (iolen==2) {
myGUS.gRegData=(Bit16u)val;
ExecuteGlobRegister();
} else myGUS.gRegData = (Bit16u)val;
break;
case 0x305:
myGUS.gRegData = (Bit16u)((0x00ff & myGUS.gRegData) | val << 8);
ExecuteGlobRegister();
break;
case 0x307:
if(myGUS.gDramAddr < sizeof(GUSRam)) GUSRam[myGUS.gDramAddr] = (Bit8u)val;
break;
default:
#if LOG_GUS
LOG_MSG("Write GUS at port 0x%x with %x", port, val);
#endif
break;
}
}
static void GUS_DMA_Callback(DmaChannel * chan,DMAEvent event) {
if (event!=DMA_UNMASKED) return;
Bitu dmaaddr = myGUS.dmaAddr << 4;
if((myGUS.DMAControl & 0x2) == 0) {
Bitu read=chan->Read(chan->currcnt+1,&GUSRam[dmaaddr]);
//Check for 16 or 8bit channel
read*=(chan->DMA16+1);
if((myGUS.DMAControl & 0x80) != 0) {
//Invert the MSB to convert twos compliment form
Bitu i;
if((myGUS.DMAControl & 0x40) == 0) {
// 8-bit data
for(i=dmaaddr;i<(dmaaddr+read);i++) GUSRam[i] ^= 0x80;
} else {
// 16-bit data
for(i=dmaaddr+1;i<(dmaaddr+read);i+=2) GUSRam[i] ^= 0x80;
}
}
} else {
//Read data out of UltraSound
chan->Write(chan->currcnt+1,&GUSRam[dmaaddr]);
}
/* Raise the TC irq if needed */
if((myGUS.DMAControl & 0x20) != 0) {
myGUS.IRQStatus |= 0x80;
GUS_CheckIRQ();
}
chan->Register_Callback(0);
}
static void GUS_CallBack(Bitu len) {
memset(&MixTemp,0,len*8);
Bitu i;
Bit16s * buf16 = (Bit16s *)MixTemp;
Bit32s * buf32 = (Bit32s *)MixTemp;
for(i=0;i<myGUS.ActiveChannels;i++)
guschan[i]->generateSamples(buf32,len);
for(i=0;i<len*2;i++) {
Bit32s sample=((buf32[i] >> 13)*AutoAmp)>>9;
if (sample>32767) {
sample=32767;
AutoAmp--;
} else if (sample<-32768) {
sample=-32768;
AutoAmp--;
}
buf16[i] = (Bit16s)(sample);
}
gus_chan->AddSamples_s16(len,buf16);
CheckVoiceIrq();
}
// Generate logarithmic to linear volume conversion tables
static void MakeTables(void) {
int i;
double out = (double)(1 << 13);
for (i=4095;i>=0;i--) {
vol16bit[i]=(Bit16s)out;
out/=1.002709201; /* 0.0235 dB Steps */
}
pantable[0]=0;
for (i=1;i<16;i++) {
pantable[i]=(Bit32u)(-128.0*(log((double)i/15.0)/log(2.0))*(double)(1 << RAMP_FRACT));
}
}
class GUS:public Module_base{
private:
IO_ReadHandleObject ReadHandler[8];
IO_WriteHandleObject WriteHandler[9];
AutoexecObject autoexecline[2];
MixerObject MixerChan;
public:
GUS(Section* configuration):Module_base(configuration){
if(!IS_EGAVGA_ARCH) return;
Section_prop * section=static_cast<Section_prop *>(configuration);
if(!section->Get_bool("gus")) return;
memset(&myGUS,0,sizeof(myGUS));
memset(GUSRam,0,1024*1024);
myGUS.rate=section->Get_int("gusrate");
myGUS.portbase = section->Get_hex("gusbase") - 0x200;
int dma_val = section->Get_int("gusdma");
if ((dma_val<0) || (dma_val>255)) dma_val = 3; // sensible default
int irq_val = section->Get_int("gusirq");
if ((irq_val<0) || (irq_val>255)) irq_val = 5; // sensible default
myGUS.dma1 = (Bit8u)dma_val;
myGUS.dma2 = (Bit8u)dma_val;
myGUS.irq1 = (Bit8u)irq_val;
myGUS.irq2 = (Bit8u)irq_val;
// We'll leave the MIDI interface to the MPU-401
// Ditto for the Joystick
// GF1 Synthesizer
ReadHandler[0].Install(0x302 + GUS_BASE,read_gus,IO_MB);
WriteHandler[0].Install(0x302 + GUS_BASE,write_gus,IO_MB);
WriteHandler[1].Install(0x303 + GUS_BASE,write_gus,IO_MB);
ReadHandler[1].Install(0x303 + GUS_BASE,read_gus,IO_MB);
WriteHandler[2].Install(0x304 + GUS_BASE,write_gus,IO_MB|IO_MW);
ReadHandler[2].Install(0x304 + GUS_BASE,read_gus,IO_MB|IO_MW);
WriteHandler[3].Install(0x305 + GUS_BASE,write_gus,IO_MB);
ReadHandler[3].Install(0x305 + GUS_BASE,read_gus,IO_MB);
ReadHandler[4].Install(0x206 + GUS_BASE,read_gus,IO_MB);
WriteHandler[4].Install(0x208 + GUS_BASE,write_gus,IO_MB);
ReadHandler[5].Install(0x208 + GUS_BASE,read_gus,IO_MB);
WriteHandler[5].Install(0x209 + GUS_BASE,write_gus,IO_MB);
WriteHandler[6].Install(0x307 + GUS_BASE,write_gus,IO_MB);
ReadHandler[6].Install(0x307 + GUS_BASE,read_gus,IO_MB);
// Board Only
WriteHandler[7].Install(0x200 + GUS_BASE,write_gus,IO_MB);
ReadHandler[7].Install(0x20A + GUS_BASE,read_gus,IO_MB);
WriteHandler[8].Install(0x20B + GUS_BASE,write_gus,IO_MB);
// DmaChannels[myGUS.dma1]->Register_TC_Callback(GUS_DMA_TC_Callback);
MakeTables();
for (Bit8u chan_ct=0; chan_ct<32; chan_ct++) {
guschan[chan_ct] = new GUSChannels(chan_ct);
}
// Register the Mixer CallBack
gus_chan=MixerChan.Install(GUS_CallBack,GUS_RATE,"GUS");
myGUS.gRegData=0x1;
GUSReset();
myGUS.gRegData=0x0;
int portat = 0x200+GUS_BASE;
// ULTRASND=Port,DMA1,DMA2,IRQ1,IRQ2
// [GUS port], [GUS DMA (recording)], [GUS DMA (playback)], [GUS IRQ (playback)], [GUS IRQ (MIDI)]
ostringstream temp;
temp << "SET ULTRASND=" << hex << setw(3) << portat << ","
<< dec << (Bitu)myGUS.dma1 << "," << (Bitu)myGUS.dma2 << ","
<< (Bitu)myGUS.irq1 << "," << (Bitu)myGUS.irq2 << ends;
// Create autoexec.bat lines
autoexecline[0].Install(temp.str());
autoexecline[1].Install(std::string("SET ULTRADIR=") + section->Get_string("ultradir"));
}
~GUS() {
if(!IS_EGAVGA_ARCH) return;
Section_prop * section=static_cast<Section_prop *>(m_configuration);
if(!section->Get_bool("gus")) return;
myGUS.gRegData=0x1;
GUSReset();
myGUS.gRegData=0x0;
for(Bitu i=0;i<32;i++) {
delete guschan[i];
}
memset(&myGUS,0,sizeof(myGUS));
memset(GUSRam,0,1024*1024);
}
};
static GUS* test;
void GUS_ShutDown(Section* /*sec*/) {
delete test;
}
void GUS_Init(Section* sec) {
test = new GUS(sec);
sec->AddDestroyFunction(&GUS_ShutDown,true);
}
| 28.441077 | 111 | 0.680084 | electroduck |
aa295c708985e7c4994156642cb22e6253554fc3 | 3,368 | cpp | C++ | src/vcml/net/client_tap.cpp | sturmk/vcml | e6ace78cd039c200df217dd629da16f95c7ca050 | [
"Apache-2.0"
] | 36 | 2018-01-29T12:20:37.000Z | 2022-03-29T06:14:59.000Z | src/vcml/net/client_tap.cpp | sturmk/vcml | e6ace78cd039c200df217dd629da16f95c7ca050 | [
"Apache-2.0"
] | 9 | 2018-12-04T10:37:14.000Z | 2021-11-16T16:57:29.000Z | src/vcml/net/client_tap.cpp | sturmk/vcml | e6ace78cd039c200df217dd629da16f95c7ca050 | [
"Apache-2.0"
] | 18 | 2018-10-14T11:30:43.000Z | 2022-01-08T07:12:56.000Z | /******************************************************************************
* *
* Copyright 2021 Jan Henrik Weinstock *
* *
* 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 <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <linux/if.h>
#include <linux/if_tun.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include "vcml/net/client_tap.h"
namespace vcml { namespace net {
client_tap::client_tap(const string& adapter, int devno):
client(adapter) {
m_fd = open("/dev/net/tun", O_RDWR);
VCML_REPORT_ON(m_fd < 0, "error opening tundev: %s", strerror(errno));
struct ifreq ifr;
memset(&ifr, 0, sizeof(ifr));
ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
snprintf(ifr.ifr_name, IFNAMSIZ, "tap%d", devno);
int err = ioctl(m_fd, TUNSETIFF, (void*)&ifr);
VCML_REPORT_ON(err < 0, "error creating tapdev: %s", strerror(errno));
log_info("using tap device %s", ifr.ifr_name);
m_type = mkstr("tap:%d", devno);
}
client_tap::~client_tap() {
if (m_fd >= 0)
close(m_fd);
}
bool client_tap::recv_packet(vector<u8>& packet) {
if (m_fd < 0)
return false;
if (!fd_peek(m_fd))
return false;
ssize_t len;
packet.resize(ETH_MAX_FRAME_SIZE);
do {
len = ::read(m_fd, packet.data(), packet.size());
} while (len < 0 && errno == EINTR);
if (len < 0) {
log_error("error reading tap device: %s", strerror(errno));
close(m_fd);
m_fd = -1;
}
if (len <= 0)
return false;
packet.resize(len);
return true;
}
void client_tap::send_packet(const vector<u8>& packet) {
if (m_fd >= 0)
fd_write(m_fd, packet.data(), packet.size());
}
client* client_tap::create(const string& adapter, const string& type) {
int devno = 0;
vector<string> args = split(type, ':');
if (args.size() > 1)
devno = from_string<int>(args[1]);
return new client_tap(adapter, devno);
}
}}
| 35.083333 | 80 | 0.461401 | sturmk |
aa29f0bd81aabde4162fd3af125a6adbecf1b7f5 | 5,109 | hpp | C++ | src/frontier_lib/StateFrontier.hpp | junkawahara/frontier | 4ae3eb360c96511ec5f3592b8bc85a1d8bce3aec | [
"MIT"
] | 16 | 2015-08-02T14:23:23.000Z | 2021-10-18T13:45:47.000Z | src/frontier_lib/StateFrontier.hpp | junkawahara/frontier | 4ae3eb360c96511ec5f3592b8bc85a1d8bce3aec | [
"MIT"
] | 1 | 2017-07-26T01:52:38.000Z | 2017-07-26T01:59:21.000Z | src/frontier_lib/StateFrontier.hpp | junkawahara/frontier | 4ae3eb360c96511ec5f3592b8bc85a1d8bce3aec | [
"MIT"
] | 7 | 2015-07-29T22:19:36.000Z | 2021-04-20T17:19:40.000Z | //
// StateFrontier.hpp
//
// Copyright (c) 2012 -- 2016 Jun Kawahara
//
// 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.
#ifndef STATEFRONTIER_HPP
#define STATEFRONTIER_HPP
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <iostream>
#include <cassert>
#include <cstdio>
#include "Global.hpp"
#include "Graph.hpp"
#include "ZDDNode.hpp"
#include "RBuffer.hpp"
#include "FrontierManager.hpp"
#include "State.hpp"
#include "Mate.hpp"
#include "PseudoZDD.hpp"
namespace frontier_lib {
class Mate;
//*************************************************************************************************
// StateFrontier:
template<typename MT>
class StateFrontier : public State {
protected:
FrontierManager frontier_manager_;
//static const short SEPARATOR_ = 32767;
enum {SEPARATOR_ = 32767};
public:
StateFrontier(Graph* graph) : State(graph), frontier_manager_(graph) { }
virtual void StartNextEdge()
{
State::StartNextEdge();
frontier_manager_.Update(GetCurrentEdge(), GetCurrentEdgeNumber());
}
virtual Mate* Initialize(ZDDNode* root_node)
{
MateS* mate = new MT(this);
if (subsetting_dd_ != NULL) {
mate->SetUseSubsetting(true, root_node);
}
return mate;
}
virtual bool Equals(const ZDDNode& node1, const ZDDNode& node2, Mate* mate) const
{
return mate->Equals(node1, node2, frontier_manager_);
}
virtual intx GetHashValue(const ZDDNode& node, Mate* mate) const
{
return mate->GetHashValue(node, frontier_manager_);
}
virtual void PackMate(ZDDNode* node, Mate* mate)
{
mate->PackMate(node, frontier_manager_);
}
virtual void UnpackMate(ZDDNode* node, Mate* mate, int child_num)
{
mate->UnpackMate(node, child_num, frontier_manager_);
}
virtual void Revert(Mate* mate)
{
mate->Revert(frontier_manager_);
}
virtual ZDDNode* MakeNewNode(ZDDNode* /*node*/, Mate* mate,
int child_num, PseudoZDD* zdd)
{
MT* m = static_cast<MT*>(mate);
if (m->IsUseSubsetting()) {
if (DoSubsetting(child_num, m) == 0) {
return zdd->ZeroTerminal;
}
}
int c = this->CheckTerminalPre(m, child_num); // 終端に遷移するか事前にチェック
if (c == 0) { // 0終端に行くとき
return zdd->ZeroTerminal; // 0終端を返す
} else if (c == 1) { // 1終端に行くとき
return zdd->OneTerminal; // 1終端を返す
}
this->UpdateMate(m, child_num); // mate を更新する
c = this->CheckTerminalPost(m); // 終端に遷移するか再度チェック
if (c == 0) { // 0終端に行くとき
return zdd->ZeroTerminal; // 0終端を返す
} else if (c == 1) { // 1終端に行くとき
return zdd->OneTerminal; // 1終端を返す
} else {
ZDDNode* child_node = zdd->CreateNode();
return child_node;
}
}
template<typename T>
static void VectorVectorToVector(const std::vector<std::vector<T> >& vv,
std::vector<T>* v)
{
for (uint i = 0; i < vv.size(); ++i) {
for (uint j = 0; j < vv[i].size(); ++j) {
v->push_back(vv[i][j]);
}
v->push_back(SEPARATOR_);
}
}
template<typename T>
static void VectorToVectorVector(const std::vector<T>& v,
std::vector<std::vector<T> >* vv)
{
if (v.size() >= 1) {
vv->push_back(std::vector<T>());
}
for (uint i = 0; i < v.size(); ++i) {
if (v[i] == SEPARATOR_) {
if (i < v.size() - 1) {
vv->push_back(std::vector<T>());
}
} else {
vv->back().push_back(v[i]);
}
}
}
protected:
virtual void UpdateMate(MT* mate, int child_num) = 0;
virtual int CheckTerminalPre(MT* mate, int child_num) = 0;
virtual int CheckTerminalPost(MT* mate) = 0;
};
} // the end of the namespace
#endif // STATEFRONTIER_HPP
| 29.703488 | 99 | 0.592875 | junkawahara |
aa2b5a4f34a8cb0c5313c5fd858c06b38368a806 | 5,484 | cpp | C++ | src/cpp/SPL/FrontEnd/ScopeExpand.cpp | IBMStreams/OSStreams | c6287bd9ec4323f567d2faf59125baba8604e1db | [
"Apache-2.0"
] | 10 | 2021-02-19T20:19:24.000Z | 2021-09-16T05:11:50.000Z | src/cpp/SPL/FrontEnd/ScopeExpand.cpp | xguerin/openstreams | 7000370b81a7f8778db283b2ba9f9ead984b7439 | [
"Apache-2.0"
] | 7 | 2021-02-20T01:17:12.000Z | 2021-06-08T14:56:34.000Z | src/cpp/SPL/FrontEnd/ScopeExpand.cpp | IBMStreams/OSStreams | c6287bd9ec4323f567d2faf59125baba8604e1db | [
"Apache-2.0"
] | 4 | 2021-02-19T18:43:10.000Z | 2022-02-23T14:18:16.000Z | /*
* Copyright 2021 IBM Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <SPL/FrontEnd/FrontEndStage.h>
#include <SPL/FrontEnd/ScopeExpander.h> // Include this header first
#include <SPL/FrontEnd/SymbolTable.h>
#include <SPL/FrontEnd/SymbolTableEntries.h>
namespace SPL {
ScopeExpander::ScopeExpander(ParserContext& pContext)
: AstVisitorPushPop(pContext, Debug::TraceScopeExpander)
, _opInvoke(NULL)
{}
void ScopeExpander::run(ParserContext& pContext, AstNode& ast)
{
ScopeExpander expander(pContext);
MODEL("PhaseStart(ScopeExpander, " << (void*)&ast << ")\n");
expander.visit(ast);
MODEL("PhaseEnd(ScopeExpander, " << (void*)&ast << ")\n");
}
void ScopeExpander::visitCompositeDef(AstNode& ast)
{
if (astStage(ast) < FrontEndStage::SCOPE_EXPANDER) {
astSymbol(ast).as<SPL::CompositeDefSym>().expandParamScope();
}
_symTab.pushOld(ast);
AstVisitor::visitCompositeDef(ast);
_symTab.pop(ast);
}
void ScopeExpander::visitConfigItem(AstNode& ast)
{
visit(AST::config::id(ast));
_symTab.pushOld(ast);
if (astStage(ast) < FrontEndStage::SCOPE_EXPANDER) {
astSymbol(ast).as<SPL::ActualConfigSym>().expand();
}
for (int i = 0, n = AST::config::exprCount(ast); i < n; i++) {
visit(AST::config::expr(ast, i));
}
_symTab.pop(ast);
}
void ScopeExpander::visitOpInvoke(AstNode& ast)
{
assert(NULL == _opInvoke);
_opInvoke = *
_symTab.pushOld(ast);
if (astStage(ast) < FrontEndStage::SCOPE_EXPANDER) {
astSymbol(ast).as<SPL::OpInvokeSym>().expand();
}
AstVisitor::visitOpInvoke(ast);
_symTab.pop(ast);
_opInvoke = NULL;
}
void ScopeExpander::visitOnProcessLogic(AstNode& ast)
{
_symTab.pushOld(ast);
if (astStage(ast) < FrontEndStage::SCOPE_EXPANDER) {
astSymbol(ast).as<SPL::OnProcessLogicSym>().expand();
}
visit(AST::opInvokeLogicOnProcess::stmt(ast));
_symTab.pop(ast);
}
void ScopeExpander::visitOnTupleLogic(AstNode& ast)
{
visit(AST::opInvokeLogicOnTuple::id(ast));
_symTab.pushOld(ast);
if (astStage(ast) < FrontEndStage::SCOPE_EXPANDER) {
astSymbol(ast).as<SPL::OnTupleLogicSym>().expand();
}
visit(AST::opInvokeLogicOnTuple::stmt(ast));
_symTab.pop(ast);
}
void ScopeExpander::visitOnPunctLogic(AstNode& ast)
{
visit(AST::opInvokeLogicOnPunct::id(ast));
_symTab.pushOld(ast);
if (astStage(ast) < FrontEndStage::SCOPE_EXPANDER) {
astSymbol(ast).as<SPL::OnPunctLogicSym>().expand();
}
visit(AST::opInvokeLogicOnPunct::stmt(ast));
_symTab.pop(ast);
}
#if 0
// STREAMS_SPL_EVENTTIME_CUSTOM_SUPPORT
void ScopeExpander::visitOnWatermarkLogic(AstNode & ast)
{
visit(AST::opInvokeLogicOnWatermark::id(ast));
_symTab.pushOld(ast);
if (astStage(ast) < FrontEndStage::SCOPE_EXPANDER) {
astSymbol(ast).as<SPL::OnWatermarkLogicSym>().expand();
}
visit(AST::opInvokeLogicOnWatermark::stmt(ast));
_symTab.pop(ast);
}
#endif
void ScopeExpander::visitOpInvokeWindow(AstNode& ast)
{
visit(AST::opInvokeWindow::id(ast));
_symTab.pushOld(ast);
if (astStage(ast) < FrontEndStage::SCOPE_EXPANDER) {
astSymbol(ast).as<SPL::OpInvokeWindowSym>().expand();
}
for (int i = 0, n = AST::opInvokeWindow::exprCount(ast); i < n; i++) {
visit(AST::opInvokeWindow::expr(ast, i));
}
_symTab.pop(ast);
}
void ScopeExpander::visitOpInvokeActual(AstNode& ast)
{
visit(AST::opInvokeActual::id(ast));
_symTab.pushOld(ast);
if (astStage(ast) < FrontEndStage::SCOPE_EXPANDER) {
assert(NULL != _opInvoke);
astSymbol(ast).as<SPL::OpInvokeActualSym>().expand(*_opInvoke);
}
visit(AST::opInvokeActual::opActual(ast));
_symTab.pop(ast);
}
void ScopeExpander::visitOpInvokeOutput(AstNode& ast)
{
visit(AST::opInvokeOutput::id(ast));
_symTab.pushOld(ast);
OpInvokeOutputSym& sym = astSymbol(ast).as<OpInvokeOutputSym>();
if (astStage(ast) < FrontEndStage::SCOPE_EXPANDER) {
assert(NULL != _opInvoke);
sym.expand(*_opInvoke);
}
for (int i = 0, n = AST::opInvokeOutput::exprCount(ast); i < n; i++) {
AstNode& exprAst = AST::opInvokeOutput::expr(ast, i);
visit(AST::infixExpr::lhs(exprAst));
sym.switchRight();
visit(AST::infixExpr::rhs(exprAst));
sym.switchLeft();
}
_symTab.pop(ast);
}
void ScopeExpander::visitTupleAttrib(AstNode& ast)
{
_symTab.pushOld(ast);
if (astStage(ast) < FrontEndStage::SCOPE_EXPANDER) {
astSymbol(ast).as<SPL::TupleAttribSym>().expand();
}
AstVisitor::visitTupleAttrib(ast);
_symTab.pop(ast);
}
void ScopeExpander::visitTupleExtend(AstNode& ast)
{
_symTab.pushOld(ast);
if (astStage(ast) < FrontEndStage::SCOPE_EXPANDER) {
astSymbol(ast).as<SPL::TupleExtendSym>().expand();
}
AstVisitor::visitTupleExtend(ast);
_symTab.pop(ast);
}
} // namespace SPL
| 27.014778 | 75 | 0.671955 | IBMStreams |
aa2ecce0c5589845edfba32250a98fdd2d068e7a | 1,302 | hpp | C++ | build/external/include/marnav/nmea/rot.hpp | jft7/signalk-server-cpp | 060e79d364e3b82200f0d2962742bf81be9b47da | [
"Apache-2.0"
] | null | null | null | build/external/include/marnav/nmea/rot.hpp | jft7/signalk-server-cpp | 060e79d364e3b82200f0d2962742bf81be9b47da | [
"Apache-2.0"
] | 1 | 2021-11-10T14:40:21.000Z | 2021-11-10T14:40:21.000Z | build/external/include/marnav/nmea/rot.hpp | jft7/signalk-server-cpp | 060e79d364e3b82200f0d2962742bf81be9b47da | [
"Apache-2.0"
] | 1 | 2020-08-14T08:10:05.000Z | 2020-08-14T08:10:05.000Z | #ifndef MARNAV__NMEA__ROT__HPP
#define MARNAV__NMEA__ROT__HPP
#include <marnav/nmea/sentence.hpp>
#include <marnav/utils/optional.hpp>
namespace marnav
{
namespace nmea
{
/// @brief ROT - Rate Of Turn
///
/// @code
/// 1 2
/// | |
/// $--ROT,x.x,A*hh<CR><LF>
/// @endcode
///
/// Field Number:
/// 1. Rate Of Turn, degrees per minute, "-" means bow turns to port
/// 2. Status
/// - A = data is valid
/// - V = invalid
///
class rot : public sentence
{
friend class detail::factory;
public:
constexpr static sentence_id ID = sentence_id::ROT;
constexpr static const char * TAG = "ROT";
rot();
rot(const rot &) = default;
rot & operator=(const rot &) = default;
rot(rot &&) = default;
rot & operator=(rot &&) = default;
protected:
rot(talker talk, fields::const_iterator first, fields::const_iterator last);
virtual void append_data_to(std::string &) const override;
private:
utils::optional<double> deg_per_minute_;
utils::optional<status> data_valid_;
public:
decltype(deg_per_minute_) get_deg_per_minute() const { return deg_per_minute_; }
decltype(data_valid_) get_data_valid() const { return data_valid_; }
void set_deg_per_minute(double t) noexcept { deg_per_minute_ = t; }
void set_data_valid(status t) noexcept { data_valid_ = t; }
};
}
}
#endif
| 22.448276 | 81 | 0.685868 | jft7 |
aa2faeec1bccc3f361a6742ccef03da1a22bab95 | 1,345 | cpp | C++ | example_math_svd/src/ofApp.cpp | icq4ever/ofxDlib | d87602b3f66f2ef3f478f004b65bc414360cd748 | [
"MIT"
] | 56 | 2017-04-11T14:09:28.000Z | 2020-12-23T15:01:35.000Z | example_math_svd/src/ofApp.cpp | icq4ever/ofxDlib | d87602b3f66f2ef3f478f004b65bc414360cd748 | [
"MIT"
] | 30 | 2017-04-13T01:15:43.000Z | 2020-12-03T23:28:02.000Z | example_math_svd/src/ofApp.cpp | icq4ever/ofxDlib | d87602b3f66f2ef3f478f004b65bc414360cd748 | [
"MIT"
] | 16 | 2017-04-18T07:47:47.000Z | 2021-07-09T13:35:51.000Z | //
// Copyright (c) 2017 Christopher Baker <https://christopherbaker.net>
//
// SPDX-License-Identifier: MIT
//
#include "ofApp.h"
void ofApp::setup()
{
// Example from https://www.mathworks.com/help/matlab/ref/svd.html
dlib::matrix<double> A(4, 2);
A = 1, 2,
3, 4,
5, 6,
7, 8;
std::cout << "Matrix A = \n" << A << std::endl;
// SVD usually takes the form of M = U * Σ * trans(V)
dlib::matrix<double> U,
Σ, // aka S or W
V;
// Calculate the singular value decomposion.
dlib::svd(A, // m x n, where m >= n).
U, // m x n, orthogonal columns (i.e. U*trans(U) == I)
Σ, // n x n, diagonal matrix, with singular values on diagonal (returned as n-col matrix).
V // n x n, orthonormal matrix, (i.e. V*trans(V) == trans(V)*V == I)
);
std::cout << "U = \n" << U << std::endl;
std::cout << "Σ = \n" << Σ << std::endl;
std::cout << "V = \n" << V << std::endl;;
dlib::matrix<double> A_reconstructed = U * Σ * dlib::trans(V);
std::cout << "A_reconstructed = \n" << A_reconstructed << std::endl;;
// The reconstructed A matrix may not be exact due to rounding and numerical
// errors, especially if using dlib::svd_fast(...).
ofExit();
}
| 29.23913 | 104 | 0.517472 | icq4ever |
a8f907b57e189def24cb125e52c2bd6e22ab6664 | 3,039 | cpp | C++ | captcha/src/v20190722/model/TicketThroughUnit.cpp | suluner/tencentcloud-sdk-cpp | a56c73cc3f488c4d1e10755704107bb15c5e000d | [
"Apache-2.0"
] | 43 | 2019-08-14T08:14:12.000Z | 2022-03-30T12:35:09.000Z | captcha/src/v20190722/model/TicketThroughUnit.cpp | suluner/tencentcloud-sdk-cpp | a56c73cc3f488c4d1e10755704107bb15c5e000d | [
"Apache-2.0"
] | 12 | 2019-07-15T10:44:59.000Z | 2021-11-02T12:35:00.000Z | captcha/src/v20190722/model/TicketThroughUnit.cpp | suluner/tencentcloud-sdk-cpp | a56c73cc3f488c4d1e10755704107bb15c5e000d | [
"Apache-2.0"
] | 28 | 2019-07-12T09:06:22.000Z | 2022-03-30T08:04:18.000Z | /*
* Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. 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.
*/
#include <tencentcloud/captcha/v20190722/model/TicketThroughUnit.h>
using TencentCloud::CoreInternalOutcome;
using namespace TencentCloud::Captcha::V20190722::Model;
using namespace std;
TicketThroughUnit::TicketThroughUnit() :
m_dateKeyHasBeenSet(false),
m_throughHasBeenSet(false)
{
}
CoreInternalOutcome TicketThroughUnit::Deserialize(const rapidjson::Value &value)
{
string requestId = "";
if (value.HasMember("DateKey") && !value["DateKey"].IsNull())
{
if (!value["DateKey"].IsString())
{
return CoreInternalOutcome(Core::Error("response `TicketThroughUnit.DateKey` IsString=false incorrectly").SetRequestId(requestId));
}
m_dateKey = string(value["DateKey"].GetString());
m_dateKeyHasBeenSet = true;
}
if (value.HasMember("Through") && !value["Through"].IsNull())
{
if (!value["Through"].IsInt64())
{
return CoreInternalOutcome(Core::Error("response `TicketThroughUnit.Through` IsInt64=false incorrectly").SetRequestId(requestId));
}
m_through = value["Through"].GetInt64();
m_throughHasBeenSet = true;
}
return CoreInternalOutcome(true);
}
void TicketThroughUnit::ToJsonObject(rapidjson::Value &value, rapidjson::Document::AllocatorType& allocator) const
{
if (m_dateKeyHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "DateKey";
iKey.SetString(key.c_str(), allocator);
value.AddMember(iKey, rapidjson::Value(m_dateKey.c_str(), allocator).Move(), allocator);
}
if (m_throughHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "Through";
iKey.SetString(key.c_str(), allocator);
value.AddMember(iKey, m_through, allocator);
}
}
string TicketThroughUnit::GetDateKey() const
{
return m_dateKey;
}
void TicketThroughUnit::SetDateKey(const string& _dateKey)
{
m_dateKey = _dateKey;
m_dateKeyHasBeenSet = true;
}
bool TicketThroughUnit::DateKeyHasBeenSet() const
{
return m_dateKeyHasBeenSet;
}
int64_t TicketThroughUnit::GetThrough() const
{
return m_through;
}
void TicketThroughUnit::SetThrough(const int64_t& _through)
{
m_through = _through;
m_throughHasBeenSet = true;
}
bool TicketThroughUnit::ThroughHasBeenSet() const
{
return m_throughHasBeenSet;
}
| 27.133929 | 143 | 0.699243 | suluner |
a8fb51cea758bfcfa784023d10376d44a45c35ca | 4,685 | cpp | C++ | src/faststep/findCommunities.cpp | michel94/fhgc-tool | 4d3f011f606d1fbdad6791d1cbcdfa9ab83796a0 | [
"MIT"
] | 1 | 2018-08-23T09:15:54.000Z | 2018-08-23T09:15:54.000Z | src/faststep/findCommunities.cpp | michel94/fhgc-tool | 4d3f011f606d1fbdad6791d1cbcdfa9ab83796a0 | [
"MIT"
] | null | null | null | src/faststep/findCommunities.cpp | michel94/fhgc-tool | 4d3f011f606d1fbdad6791d1cbcdfa9ab83796a0 | [
"MIT"
] | null | null | null | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <string>
#include <sstream>
#include <map>
#include <iostream>
#include "utils/graph.h"
#include "BinaryDecomposition.h"
#include "ApproxGradient.h"
using namespace std;
int* NodeCommunities, *NodeLabels;
int MAX_COMM_SIZE;
int samples, size;
bool equiv;
int iters;
double absstop;
double relstop;
double pratio = 2;
vector<int> maxCommSizes = {500000, 200000, 100000, 50000, 20000, 10000, 5000, 2000, 1000, 500, 200, 100, 50, 20, 10};
class Subgraph;
class Tree{
public:
vector<Tree*> children;
Subgraph* graph;
void add(Tree* tree){
children.push_back(tree);
}
};
class Subgraph{
public:
vector<int> nodeIndex;
Graph* g;
int s;
Tree* tree = new Tree();
Subgraph(){
g = NULL;
s = 0;
tree->graph = this;
}
Subgraph(vector<int> index, Graph* g){
nodeIndex = index;
this->g = g;
s = g->getN();
tree->graph = this;
}
const int size();
};
const int Subgraph::size(){
return s;
}
struct Compare{
const bool operator() (Subgraph* a, Subgraph* b){
return a->size() < b->size();
}
};
inline int min(int a, int b){
return (a < b ? a : b);
}
vector<int> parseList(string str){
vector<int> elements;
stringstream ss(str);
int i;
while (ss >> i){
elements.push_back(i);
if (ss.peek() == ',')
ss.ignore();
}
return elements;
}
int COMMID = 0;
int LABEL = 0;
int getCommId(){
return COMMID++;
}
int getLabel(){
return LABEL++;
}
const int FACTORS = 4;
double TAU = 20.0;
void writeLabels(Subgraph* sg){
int comm = getCommId();
for(int i=0; i<(int)sg->g->getN(); i++){
//assert(NodeCommunities[nodeIndex[i]] == -1);
NodeCommunities[sg->nodeIndex[i]] = comm;
NodeLabels[sg->nodeIndex[i]] = getLabel();
}
}
void findCommunities(vector<vector<int> >& communities, Graph* g){
printf("Graph with size %d\n", (int)g->getN());
int samples = (int)g->getNEdges() * FACTORS;
BinaryDecomposition *bd = new ApproxGradient(g, FACTORS, equiv, TAU, samples, pratio);
printf("Running approximate %s decomposition using %d factors, min. iters=%d, abs. stop=%lf, rel. stop=%lf, samples=%d\n",
(equiv?"AA": "AB"), FACTORS, iters, absstop, relstop, samples);
Decomposition *d = bd->calc(iters, absstop, relstop);
cout << "Finished decomposition" << endl;
for(int c=0; c<FACTORS; c++){
int maxIndex = 0;
double mbk = maxBk(d, c, maxIndex);
double threshold = TAU / (FACTORS * mbk);
cout << "threshold: " << threshold << " max(b_k): " << mbk << endl;
for(int i=0; i<(int)g->getN(); i++){
//int hf = highestFactor(d, i);
double v = factorAt(d, i, c);
double S = d->score(i, maxIndex);
if(v >= threshold && S >= TAU)
communities[c].push_back(i);
}
}
delete bd;
}
int main(int argc, const char *argv[]) {
/**
PARSE ARGUMENTS
**/
if (argc < 3) {
printf("Usage: %s <DecompositionType> <FILE> <#Factors> [min iters] [absolute stoppage] [relative stoppage] [samples]\n", argv[0]);
puts("\n ATTENTION: Results are saved to the 'communities/' folder!!\n");
puts("\t<DecompositionType>: AA if using a symmetric decomposition (row and columns will have the same values), AB otherwise.");
puts("\t<FILE>: 0-index edge list file. The first line should represent the size of the matrix.");
puts("\t<#Max community size>: Number of factors of the decomposition.");
puts("\t[min iters] (optional): Minimum number of gradient descent iterations. (DEFAULT = 5)");
puts("\t[absolute stoppage] (optional): Gradient descent will continue while the absolute error improvement is above this threshold. (DEFAULT = 10)");
puts("\t[relative stoppage] (optional): Gradient descent will continue while the relative improvement is above this threshold. (DEFAULT = 0.01)");
puts("\t[samples] (optional): Number of samples used in approximating F. (default = #factors*number of edges)");
exit(-1);
}
Graph *g = new Graph(true, true, false);
g->readNormalizedEL(argv[2]);
size = g->getN();
equiv = (strcmp(argv[1], "AA") == 0);
iters = (argc > 4 ? atoi(argv[4]) : 12);
absstop = (argc > 5 ? atof(argv[5]) : 0.001);
relstop = (argc > 6 ? atof(argv[6]) : 0.0001);
samples = (argc > 7 ? atoi(argv[7]) : 4*g->getNEdges() );
vector<vector<int> > communities(FACTORS);
findCommunities(communities, g);
for(int c=0; c<FACTORS; c++){
/*for(int i=0; i<(int)communities[c].size(); i++){
cout << communities[c][i] << " ";
}*/
cout << "Community " << c << ": " << communities[c].size() << " elements";
cout << endl;
}
}
| 26.027778 | 154 | 0.623052 | michel94 |
a8fba8542063e488be2af5788f0ce8e53c1393ca | 7,958 | cpp | C++ | Engine/Collider.cpp | LeviMooreDev/Wolfenstein-3D-CPlusPlus | 24242623b679a6ec9e5020dfc1266d5b0e53db4a | [
"MIT"
] | null | null | null | Engine/Collider.cpp | LeviMooreDev/Wolfenstein-3D-CPlusPlus | 24242623b679a6ec9e5020dfc1266d5b0e53db4a | [
"MIT"
] | null | null | null | Engine/Collider.cpp | LeviMooreDev/Wolfenstein-3D-CPlusPlus | 24242623b679a6ec9e5020dfc1266d5b0e53db4a | [
"MIT"
] | null | null | null | #include "Collider.h"
#include "Scene.h"
#include <GLFW\glfw3.h>
#include <iostream>
#include "Debug.h"
#include "Raycast.h"
typedef std::basic_string<char> string;
//declare static fields
bool Collider::showWireframe = false;
void Collider::ListenForHit(std::function<void(GameObject *)> onHit)
{
(*this).onHit = onHit;
}
void Collider::ListenForTrigger(std::function<void(GameObject *)> onTrigger)
{
(*this).onTrigger = onTrigger;
}
Vector3 Collider::Min()
{
return Vector3(gameObject->transform.position.x - centerOffset.x - size.x / 2.0f,
gameObject->transform.position.y - centerOffset.y - size.y / 2.0f,
gameObject->transform.position.z - centerOffset.z - size.z / 2.0f);
}
Vector3 Collider::Max()
{
return Vector3(gameObject->transform.position.x + centerOffset.x + size.x / 2.0f,
gameObject->transform.position.y + centerOffset.y + size.y / 2.0f,
gameObject->transform.position.z + centerOffset.z + size.z / 2.0f);
}
void Collider::Update(Scene * scene)
{
//if we have not changed position, center offset or size we dont need to check for collision
if (lastCenterOffset == centerOffset && lastSize == size && lastValidPosition == gameObject->transform.position)
return;
//true if we need to check for collision
bool checkForCollision = true;
//the amount of times we are allowed to recheck for collision
int checkCountLeft = 5;
//if we want to check for a collision
while (checkForCollision)
{
checkForCollision = false;
//we are going to use min and max x,y,z a lot so we store them here for faster access later
Vector3 selfMin = Min();
Vector3 selfMax = Max();
//loop through all game objects in the scene
std::vector<GameObject *>::iterator otherGameObject = scene->GetAllGameObjects()->begin();
while (otherGameObject != scene->GetAllGameObjects()->end())
{
//if the game object we are at is not ourself and it is enabled
if ((*otherGameObject) != gameObject && (*otherGameObject)->enabled)
{
//if it has a collider on it
if ((*otherGameObject)->HasColliders())
{
//get the collider component and check if it is enabled
Collider * otherCollider = (Collider *)(*otherGameObject)->GetComponent(ColliderComponentName);
if (otherCollider->enabled)
{
//get the min and max x,y,z value of the other collider
Vector3 otherMin = otherCollider->Min();
Vector3 otherMax = otherCollider->Max();
//if our box is inside the other box
if ((selfMax.x > otherMin.x && selfMin.x < otherMax.x && selfMax.y > otherMin.y && selfMin.y < otherMax.y && selfMax.z > otherMin.z && selfMin.z < otherMax.z))
{
//if the other box is solid
if (otherCollider->solid)
{
//if we are solid
if (solid)
{
// ------------------
// ---------|------ |
// | minX| | |
// | |< w >| other |
// | self | |maxX |
// | ------|-----------
// ----------------
//w = abs(minX - maxX)
//self.position -= w
// ----------------
// ----------------| |
// | || |
// | || other |
// | self || |
// | |----------------
// ----------------
//the amount we want to move our game object to avoid being inside the other game object
Vector3 move = Vector3();
//if we are to the right of the other game object subtract the amount we are inside the other game object to our x position
//see the beautiful drawing above for visual explanation
//#to the right
if (gameObject->transform.position.x < (*otherGameObject)->transform.position.x)
{
Vector3 newMove = Vector3(-abs(selfMax.x - otherMin.x), 0, 0);
//only set move to newMove if the amount we want to move is less than what we already want to move
//we only use the smallest move amount for every collision check to avoid being pushed into another game collider that then do the same
if (move == Vector3() || move.Distance(Vector3()) > newMove.Distance(Vector3()))
move = newMove;
}
//left, right, forward and back checks are almost the same
//# behind
if (gameObject->transform.position.z > (*otherGameObject)->transform.position.z)
{
Vector3 newMove = Vector3(0, 0, abs(otherMax.z - selfMin.z));
if (move == Vector3() || move.Distance(Vector3()) > newMove.Distance(Vector3()))
move = newMove;
}
//# to the right
if (gameObject->transform.position.x > (*otherGameObject)->transform.position.x)
{
Vector3 newMove = Vector3(abs(selfMin.x - otherMax.x), 0, 0);
if (move == Vector3() || move.Distance(Vector3()) > newMove.Distance(Vector3()))
move = newMove;
}
//# infront
if (gameObject->transform.position.z < (*otherGameObject)->transform.position.z)
{
Vector3 newMove = Vector3(0, 0, -abs(otherMin.z - selfMax.z));
if (move == Vector3() || move.Distance(Vector3()) > newMove.Distance(Vector3()))
move = newMove;
}
//if we want to move the game object
if (move != Vector3())
{
//move the game object
gameObject->transform.position += move;
//remove a collision check
checkCountLeft--;
//if we have no more collision checks left, reset the game object position to the last known valid position
//this should not happen except if the game object is placed in a closed area smaller then itself
if (checkCountLeft == 0)
{
gameObject->transform.position = lastValidPosition;
}
//if we are allowed to use more collision checks, stop the code here and return to the beginning
else
{
checkForCollision = true;
break;
}
}
//call the onHit method on our self and the other game object
if (onHit != nullptr)
onHit(otherCollider->gameObject);
if (otherCollider->onHit != nullptr)
otherCollider->onHit(gameObject);
}
}
else
{
//call the onTrigger method on our self and the other game object
if (onTrigger != nullptr)
onTrigger(otherCollider->gameObject);
if (otherCollider->onTrigger != nullptr)
otherCollider->onTrigger(gameObject);
}
}
}
}
}
otherGameObject++;
}
}
//set last center offset, size and valid position
lastCenterOffset = centerOffset;
lastSize = size;
lastValidPosition = gameObject->transform.position;
}
void Collider::Draw2(Scene * scene)
{
//if we dont want to draw a wireframe for our collision box return.
if (!Collider::showWireframe)
return;
glPushMatrix();
//set position
glTranslatef(gameObject->transform.position.x + centerOffset.x, gameObject->transform.position.y + centerOffset.y, -gameObject->transform.position.z - centerOffset.z);
//set scale
glScalef(size.x, size.y, size.z);
//set polygon mode to line to give the wireframe effect
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
//disable depth test. we want to see all colliders even if they are behind other things
glDisable(GL_DEPTH_TEST);
//enable drawing by vertex and color arrays
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, wireframeVertices);
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(3, GL_FLOAT, 0, colors);
//draw
glDrawArrays(GL_QUADS, 0, 24);
//cleanup
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glPopMatrix();
} | 34.301724 | 168 | 0.602413 | LeviMooreDev |
a8fc68640a6667f1ca9933f6a12576ba0eef8455 | 3,150 | cpp | C++ | DDOCP/LevelButton.cpp | shortydude/DDOBuilder-learning | e71162c10b81bb4afd0365e61088437353cc4607 | [
"MIT"
] | null | null | null | DDOCP/LevelButton.cpp | shortydude/DDOBuilder-learning | e71162c10b81bb4afd0365e61088437353cc4607 | [
"MIT"
] | null | null | null | DDOCP/LevelButton.cpp | shortydude/DDOBuilder-learning | e71162c10b81bb4afd0365e61088437353cc4607 | [
"MIT"
] | null | null | null | // LevelButton.cpp
//
#include "stdafx.h"
#include "LevelButton.h"
#include "Character.h"
#include "GlobalSupportFunctions.h"
namespace
{
const COLORREF c_pinkWarningColour = RGB(0xFF, 0xB6, 0xC1); // Light Pink
}
#pragma warning(push)
#pragma warning(disable: 4407) // warning C4407: cast between different pointer to member representations, compiler may generate incorrect code
BEGIN_MESSAGE_MAP(CLevelButton, CStatic)
//{{AFX_MSG_MAP(CLevelButton)
ON_WM_ERASEBKGND()
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
#pragma warning(pop)
CLevelButton::CLevelButton() :
m_level(0),
m_class(Class_Unknown),
m_bSelected(false),
m_bHasIssue(false)
{
//{{AFX_DATA_INIT(CLevelButton)
//}}AFX_DATA_INIT
HRESULT result = LoadImageFile(
IT_enhancement,
(LPCTSTR)EnumEntryText(m_class, classTypeMap),
&m_image);
m_image.SetTransparentColor(c_transparentColour);
// create the font used
LOGFONT lf;
ZeroMemory((PVOID)&lf, sizeof(LOGFONT));
NONCLIENTMETRICS nm;
nm.cbSize = sizeof(NONCLIENTMETRICS);
VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, nm.cbSize, &nm, 0));
lf = nm.lfMenuFont;
lf.lfHeight = -12;
m_font.CreateFontIndirect(&lf);
}
BOOL CLevelButton::OnEraseBkgnd(CDC* pDC)
{
return 0;
}
void CLevelButton::OnPaint()
{
CPaintDC pdc(this); // validates the client area on destruction
pdc.SaveDC();
CRect rect;
GetWindowRect(&rect);
rect -= rect.TopLeft(); // convert to client rectangle
// fill the background
if (m_bSelected)
{
pdc.FillSolidRect(rect, GetSysColor(COLOR_HIGHLIGHT));
}
else
{
if (m_bHasIssue)
{
pdc.FillSolidRect(rect, c_pinkWarningColour);
}
else
{
pdc.FillSolidRect(rect, GetSysColor(COLOR_BTNFACE));
}
}
m_image.TransparentBlt(
pdc.GetSafeHdc(),
(rect.Width() - 32) / 2,
4, // always 4 pixels from the top
32,
32);
// and lastly add the level text
pdc.SelectObject(&m_font);
CString text;
text.Format("Level %d", m_level);
CSize ts = pdc.GetTextExtent(text);
pdc.SetBkMode(TRANSPARENT);
pdc.TextOut((rect.Width() - ts.cx) / 2, 38, text);
pdc.RestoreDC(-1);
}
void CLevelButton::SetLevel(size_t level)
{
m_level = level;
}
void CLevelButton::SetClass(ClassType ct)
{
m_class = ct;
m_image.Destroy();
// load the new icon to display
HRESULT result = LoadImageFile(
IT_ui,
(LPCTSTR)EnumEntryText(m_class, classTypeMap),
&m_image);
m_image.SetTransparentColor(c_transparentColour);
Invalidate();
}
void CLevelButton::SetSelected(bool selected)
{
if (selected != m_bSelected)
{
m_bSelected = selected;
Invalidate(); // redraw on state change
}
}
bool CLevelButton::IsSelected() const
{
return m_bSelected;
}
void CLevelButton::SetIssueState(bool hasIssue)
{
if (m_bHasIssue != hasIssue)
{
m_bHasIssue = hasIssue;
Invalidate();
}
}
| 23.333333 | 143 | 0.63873 | shortydude |