blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 3 264 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 5 140 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 986
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 23
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 145
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 10.4M | extension stringclasses 122
values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
95d6c0d42860cc397a0b962d5da7f5d1b89389de | 4611624808ccc2681272cc0847f01e54389490a7 | /build/Android/Debug/app/src/main/jni/Uno.Compiler.ExportTargetInterop.Foreign.Android.g.cpp | 6cc3d0b97fc9a1652e482392a420a0810888332d | [] | no_license | kvitberg/TestCase | 62d6c88e5cab7ac46fd70c29a6e2e695d838f261 | 75c6e7fdf680189e6d6a447c157a07e10218796a | refs/heads/master | 2020-12-02T18:01:51.624735 | 2017-07-06T18:55:24 | 2017-07-06T18:55:24 | 96,462,146 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 172,212 | cpp | // This file was generated based on '(multiple files)'.
// WARNING: Changes might be lost if you edit this file directly.
#include <Android.Base.JNI.h>
#include <Android.Base.JNI.RefType.h>
#include <Android.Base.Primitiv-2b9696be.h>
#include <Android.Base.Primitiv-45253430.h>
#include <Android.Base.Primitiv-ae5fb0f1.h>
#include <Android.Base.Primitiv-b7b09a.h>
#include <Android.Base.Primitiv-e437692f.h>
#include <Android.Base.Types.String.h>
#include <Android.Base.Wrappers.JWrapper.h>
#include <Android.Base.Wrappers-88f7a41f.h>
#include <Fuse.Android.AppRoot.h>
#include <Fuse.Android.StatusBarConfig.h>
#include <Fuse.Controls.Native.-3a814c3c.h>
#include <Fuse.Controls.Native.-43e7fbf.h>
#include <Fuse.Controls.Native.-454aa827.h>
#include <Fuse.Controls.Native.-51b6e8e5.h>
#include <Fuse.Controls.Native.-c67cabe.h>
#include <Fuse.Controls.Native.-ca2427b3.h>
#include <Fuse.Controls.Native.-dd7dd49d.h>
#include <Fuse.Controls.Native.-e502cdf1.h>
#include <Fuse.Controls.Native.-f43d469d.h>
#include <Fuse.Controls.VideoIm-78c612f4.h>
#include <Fuse.Internal.Android-336f3d43.h>
#include <Fuse.Platform.SystemUI.h>
#include <Java.Object.h>
#include <jni.h>
#include <Neovisionaries.WebSocketClient.h>
#include <Uno.Action.h>
#include <Uno.Action-1.h>
#include <Uno.Bool.h>
#include <Uno.Byte.h>
#include <Uno.Char.h>
#include <Uno.Collections.List-1.h>
#include <Uno.Compiler.ExportTa-39be7c2b.h>
#include <Uno.Compiler.ExportTa-7a61a803.h>
#include <Uno.Compiler.ExportTa-d4b8b207.h>
#include <Uno.Double.h>
#include <Uno.Exception.h>
#include <Uno.Float.h>
#include <Uno.Int.h>
#include <Uno.IO.BundleFile.h>
#include <Uno.Long.h>
#include <Uno.Object.h>
#include <Uno.Platform.AndroidDisplay.h>
#include <Uno.SByte.h>
#include <Uno.Short.h>
#include <Uno.String.h>
#include <Uno/JNIHelper.h>
//~
void __JavaUnoObject_Finalizer(JNIEnv *env , jclass clazz, jlong ptr)
{
uAutoReleasePool pool;
uRelease((::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject*)ptr);
}
jboolean JNICALL callUno_Fuse_Controls_Native_Android_InputDispatch_OnTouch153(JNIEnv *env,jclass clazz,jobject view,jobject motionEvent,jlong viewPtr,jlong motionEventPtr)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Java::Object* uno_view = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(view, true);
::g::Java::Object* uno_motionEvent = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(motionEvent, true);
jboolean __jresult;
JTRY
bool __result=::g::Fuse::Controls::Native::Android::InputDispatch::OnTouch(uCast<::g::Java::Object*>(uno_view, ::g::Java::Object_typeof()), uCast<::g::Java::Object*>(uno_motionEvent, ::g::Java::Object_typeof()));
__jresult = (jboolean)__result;
JCATCH
return __jresult;
}
jboolean JNICALL callUno_Fuse_Controls_Native_Android_TextInput_OnEditorAction208(JNIEnv *env,jclass clazz,jobject jthis,jint actionCode)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Fuse::Controls::Native::Android::TextInput* uno_jthis = uCast<::g::Fuse::Controls::Native::Android::TextInput*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Fuse::Controls::Native::Android::TextInput_typeof());
int uno_actionCode = (int)actionCode;
jboolean __jresult;
JTRY
bool __result=uno_jthis->OnEditorAction(uno_actionCode);
__jresult = (jboolean)__result;
JCATCH
return __jresult;
}
jboolean JNICALL callUno_Fuse_Platform_SystemUI_firstSizingGet101(JNIEnv *env,jclass clazz)
{
uAutoReleasePool pool;
INIT_JNI;
jboolean __jresult;
JTRY
bool __result=::g::Fuse::Platform::SystemUI::firstSizing();
__jresult = (jboolean)__result;
JCATCH
return __jresult;
}
jboolean JNICALL callUno_Fuse_Platform_SystemUI_hasCachedStatusBarSizeGet84(JNIEnv *env,jclass clazz)
{
uAutoReleasePool pool;
INIT_JNI;
jboolean __jresult;
JTRY
bool __result=::g::Fuse::Platform::SystemUI::hasCachedStatusBarSize();
__jresult = (jboolean)__result;
JCATCH
return __jresult;
}
jboolean JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetBool16(JNIEnv *env,jclass clazz,jobject array,jint index)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
jboolean __jresult;
JTRY
bool __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::GetBool(uno_array, uno_index);
__jresult = (jboolean)__result;
JCATCH
return __jresult;
}
jboolean JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetBool39(JNIEnv *env,jclass clazz,jobject array,jint index,jboolean val)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
bool uno_val = (bool)val;
jboolean __jresult;
JTRY
bool __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::SetBool(uno_array, uno_index, uno_val);
__jresult = (jboolean)__result;
JCATCH
return __jresult;
}
jboolean JNICALL callUno_Uno_Platform_AndroidDisplay__initializedGet54(JNIEnv *env,jclass clazz)
{
uAutoReleasePool pool;
INIT_JNI;
jboolean __jresult;
JTRY
bool __result=::g::Uno::Platform::AndroidDisplay::_initialized_;
__jresult = (jboolean)__result;
JCATCH
return __jresult;
}
jbyte JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetByte17(JNIEnv *env,jclass clazz,jobject array,jint index)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
jbyte __jresult;
JTRY
int8_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::GetByte(uno_array, uno_index);
__jresult = (jbyte)__result;
JCATCH
return __jresult;
}
jbyte JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetUByte26(JNIEnv *env,jclass clazz,jobject array,jint index)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
jbyte __jresult;
JTRY
int8_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::GetUByte(uno_array, uno_index);
__jresult = (jbyte)__result;
JCATCH
return __jresult;
}
jbyte JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetByte40(JNIEnv *env,jclass clazz,jobject array,jint index,jbyte val)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
int8_t uno_val = (int8_t)val;
jbyte __jresult;
JTRY
int8_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::SetByte(uno_array, uno_index, uno_val);
__jresult = (jbyte)__result;
JCATCH
return __jresult;
}
jbyte JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetUByte49(JNIEnv *env,jclass clazz,jobject array,jint index,jbyte val)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
int8_t uno_val = (int8_t)val;
jbyte __jresult;
JTRY
int8_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::SetUByte(uno_array, uno_index, uno_val);
__jresult = (jbyte)__result;
JCATCH
return __jresult;
}
jchar JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetChar18(JNIEnv *env,jclass clazz,jobject array,jint index)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
jchar __jresult;
JTRY
uChar __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::GetChar(uno_array, uno_index);
__jresult = (jchar)__result;
JCATCH
return __jresult;
}
jchar JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetChar41(JNIEnv *env,jclass clazz,jobject array,jint index,jchar val)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
uChar uno_val = (uChar)val;
jchar __jresult;
JTRY
uChar __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::SetChar(uno_array, uno_index, uno_val);
__jresult = (jchar)__result;
JCATCH
return __jresult;
}
jdouble JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetDouble19(JNIEnv *env,jclass clazz,jobject array,jint index)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
jdouble __jresult;
JTRY
double __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::GetDouble(uno_array, uno_index);
__jresult = (jdouble)__result;
JCATCH
return __jresult;
}
jdouble JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetDouble42(JNIEnv *env,jclass clazz,jobject array,jint index,jdouble val)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
double uno_val = (double)val;
jdouble __jresult;
JTRY
double __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::SetDouble(uno_array, uno_index, uno_val);
__jresult = (jdouble)__result;
JCATCH
return __jresult;
}
jfloat JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetFloat20(JNIEnv *env,jclass clazz,jobject array,jint index)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
jfloat __jresult;
JTRY
float __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::GetFloat(uno_array, uno_index);
__jresult = (jfloat)__result;
JCATCH
return __jresult;
}
jfloat JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetFloat43(JNIEnv *env,jclass clazz,jobject array,jint index,jfloat val)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
float uno_val = (float)val;
jfloat __jresult;
JTRY
float __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::SetFloat(uno_array, uno_index, uno_val);
__jresult = (jfloat)__result;
JCATCH
return __jresult;
}
jint JNICALL callUno_Fuse_Platform_SystemUI__systemUIStateGet77(JNIEnv *env,jclass clazz)
{
uAutoReleasePool pool;
INIT_JNI;
jint __jresult;
JTRY
int __result=::g::Fuse::Platform::SystemUI::_systemUIState();
__jresult = (jint)__result;
JCATCH
return __jresult;
}
jint JNICALL callUno_Fuse_Platform_SystemUI_cachedOpenSizeGet85(JNIEnv *env,jclass clazz)
{
uAutoReleasePool pool;
INIT_JNI;
jint __jresult;
JTRY
int __result=::g::Fuse::Platform::SystemUI::cachedOpenSize();
__jresult = (jint)__result;
JCATCH
return __jresult;
}
jint JNICALL callUno_Fuse_Platform_SystemUI_GetRealDisplayHeight73(JNIEnv *env,jclass clazz)
{
uAutoReleasePool pool;
INIT_JNI;
jint __jresult;
JTRY
int __result=::g::Fuse::Platform::SystemUI::GetRealDisplayHeight();
__jresult = (jint)__result;
JCATCH
return __jresult;
}
jint JNICALL callUno_Fuse_Platform_SystemUI_GetRealDisplayWidth92(JNIEnv *env,jclass clazz)
{
uAutoReleasePool pool;
INIT_JNI;
jint __jresult;
JTRY
int __result=::g::Fuse::Platform::SystemUI::GetRealDisplayWidth();
__jresult = (jint)__result;
JCATCH
return __jresult;
}
jint JNICALL callUno_Fuse_Platform_SystemUI_lastKeyboardHeightGet100(JNIEnv *env,jclass clazz)
{
uAutoReleasePool pool;
INIT_JNI;
jint __jresult;
JTRY
int __result=::g::Fuse::Platform::SystemUI::lastKeyboardHeight();
__jresult = (jint)__result;
JCATCH
return __jresult;
}
jint JNICALL callUno_Fuse_Platform_SystemUI_realHeightGet67(JNIEnv *env,jclass clazz)
{
uAutoReleasePool pool;
INIT_JNI;
jint __jresult;
JTRY
int __result=::g::Fuse::Platform::SystemUI::realHeight();
__jresult = (jint)__result;
JCATCH
return __jresult;
}
jint JNICALL callUno_Fuse_Platform_SystemUI_realWidthGet66(JNIEnv *env,jclass clazz)
{
uAutoReleasePool pool;
INIT_JNI;
jint __jresult;
JTRY
int __result=::g::Fuse::Platform::SystemUI::realWidth();
__jresult = (jint)__result;
JCATCH
return __jresult;
}
jint JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetInt21(JNIEnv *env,jclass clazz,jobject array,jint index)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
jint __jresult;
JTRY
int __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::GetInt(uno_array, uno_index);
__jresult = (jint)__result;
JCATCH
return __jresult;
}
jint JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetInt44(JNIEnv *env,jclass clazz,jobject array,jint index,jint val)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
int uno_val = (int)val;
jint __jresult;
JTRY
int __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::SetInt(uno_array, uno_index, uno_val);
__jresult = (jint)__result;
JCATCH
return __jresult;
}
jlong JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_BoolArrayToUnoArrayPtr0(JNIEnv *env,jclass clazz,jobject jarr,jlong jarrPtr)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Java::Object* uno_jarr = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(jarr, true);
jlong __jresult;
JTRY
int64_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::BoolArrayToUnoArrayPtr(uCast<::g::Java::Object*>(uno_jarr, ::g::Java::Object_typeof()));
__jresult = (jlong)__result;
JCATCH
return __jresult;
}
jlong JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_ByteArrayToUnoArrayPtr1(JNIEnv *env,jclass clazz,jobject jarr,jlong jarrPtr)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Java::Object* uno_jarr = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(jarr, true);
jlong __jresult;
JTRY
int64_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::ByteArrayToUnoArrayPtr(uCast<::g::Java::Object*>(uno_jarr, ::g::Java::Object_typeof()));
__jresult = (jlong)__result;
JCATCH
return __jresult;
}
jlong JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CharArrayToUnoArrayPtr2(JNIEnv *env,jclass clazz,jobject jarr,jlong jarrPtr)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Java::Object* uno_jarr = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(jarr, true);
jlong __jresult;
JTRY
int64_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::CharArrayToUnoArrayPtr(uCast<::g::Java::Object*>(uno_jarr, ::g::Java::Object_typeof()));
__jresult = (jlong)__result;
JCATCH
return __jresult;
}
jlong JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_DoubleArrayToUnoArrayPtr14(JNIEnv *env,jclass clazz,jobject jarr,jlong jarrPtr)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Java::Object* uno_jarr = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(jarr, true);
jlong __jresult;
JTRY
int64_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::DoubleArrayToUnoArrayPtr(uCast<::g::Java::Object*>(uno_jarr, ::g::Java::Object_typeof()));
__jresult = (jlong)__result;
JCATCH
return __jresult;
}
jlong JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_FloatArrayToUnoArrayPtr15(JNIEnv *env,jclass clazz,jobject jarr,jlong jarrPtr)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Java::Object* uno_jarr = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(jarr, true);
jlong __jresult;
JTRY
int64_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::FloatArrayToUnoArrayPtr(uCast<::g::Java::Object*>(uno_jarr, ::g::Java::Object_typeof()));
__jresult = (jlong)__result;
JCATCH
return __jresult;
}
jlong JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetLong22(JNIEnv *env,jclass clazz,jobject array,jint index)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
jlong __jresult;
JTRY
int64_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::GetLong(uno_array, uno_index);
__jresult = (jlong)__result;
JCATCH
return __jresult;
}
jlong JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_IntArrayToUnoArrayPtr27(JNIEnv *env,jclass clazz,jobject jarr,jlong jarrPtr)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Java::Object* uno_jarr = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(jarr, true);
jlong __jresult;
JTRY
int64_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::IntArrayToUnoArrayPtr(uCast<::g::Java::Object*>(uno_jarr, ::g::Java::Object_typeof()));
__jresult = (jlong)__result;
JCATCH
return __jresult;
}
jlong JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_LongArrayToUnoArrayPtr28(JNIEnv *env,jclass clazz,jobject jarr,jlong jarrPtr)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Java::Object* uno_jarr = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(jarr, true);
jlong __jresult;
JTRY
int64_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::LongArrayToUnoArrayPtr(uCast<::g::Java::Object*>(uno_jarr, ::g::Java::Object_typeof()));
__jresult = (jlong)__result;
JCATCH
return __jresult;
}
jlong JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewBoolArrayPtr29(JNIEnv *env,jclass clazz,jint length)
{
uAutoReleasePool pool;
INIT_JNI;
int uno_length = (int)length;
jlong __jresult;
JTRY
int64_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::NewBoolArrayPtr(uno_length);
__jresult = (jlong)__result;
JCATCH
return __jresult;
}
jlong JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewByteArrayPtr30(JNIEnv *env,jclass clazz,jint length,jboolean unoIsUnsigned)
{
uAutoReleasePool pool;
INIT_JNI;
int uno_length = (int)length;
bool uno_unoIsUnsigned = (bool)unoIsUnsigned;
jlong __jresult;
JTRY
int64_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::NewByteArrayPtr(uno_length, uno_unoIsUnsigned);
__jresult = (jlong)__result;
JCATCH
return __jresult;
}
jlong JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewCharArrayPtr31(JNIEnv *env,jclass clazz,jint length)
{
uAutoReleasePool pool;
INIT_JNI;
int uno_length = (int)length;
jlong __jresult;
JTRY
int64_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::NewCharArrayPtr(uno_length);
__jresult = (jlong)__result;
JCATCH
return __jresult;
}
jlong JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewDoubleArrayPtr32(JNIEnv *env,jclass clazz,jint length)
{
uAutoReleasePool pool;
INIT_JNI;
int uno_length = (int)length;
jlong __jresult;
JTRY
int64_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::NewDoubleArrayPtr(uno_length);
__jresult = (jlong)__result;
JCATCH
return __jresult;
}
jlong JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewFloatArrayPtr33(JNIEnv *env,jclass clazz,jint length)
{
uAutoReleasePool pool;
INIT_JNI;
int uno_length = (int)length;
jlong __jresult;
JTRY
int64_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::NewFloatArrayPtr(uno_length);
__jresult = (jlong)__result;
JCATCH
return __jresult;
}
jlong JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewIntArrayPtr34(JNIEnv *env,jclass clazz,jint length)
{
uAutoReleasePool pool;
INIT_JNI;
int uno_length = (int)length;
jlong __jresult;
JTRY
int64_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::NewIntArrayPtr(uno_length);
__jresult = (jlong)__result;
JCATCH
return __jresult;
}
jlong JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewLongArrayPtr35(JNIEnv *env,jclass clazz,jint length)
{
uAutoReleasePool pool;
INIT_JNI;
int uno_length = (int)length;
jlong __jresult;
JTRY
int64_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::NewLongArrayPtr(uno_length);
__jresult = (jlong)__result;
JCATCH
return __jresult;
}
jlong JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewObjectArrayPtr36(JNIEnv *env,jclass clazz,jint length)
{
uAutoReleasePool pool;
INIT_JNI;
int uno_length = (int)length;
jlong __jresult;
JTRY
int64_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::NewObjectArrayPtr(uno_length);
__jresult = (jlong)__result;
JCATCH
return __jresult;
}
jlong JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewShortArrayPtr37(JNIEnv *env,jclass clazz,jint length)
{
uAutoReleasePool pool;
INIT_JNI;
int uno_length = (int)length;
jlong __jresult;
JTRY
int64_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::NewShortArrayPtr(uno_length);
__jresult = (jlong)__result;
JCATCH
return __jresult;
}
jlong JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewStringArrayPtr38(JNIEnv *env,jclass clazz,jint length)
{
uAutoReleasePool pool;
INIT_JNI;
int uno_length = (int)length;
jlong __jresult;
JTRY
int64_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::NewStringArrayPtr(uno_length);
__jresult = (jlong)__result;
JCATCH
return __jresult;
}
jlong JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetLong45(JNIEnv *env,jclass clazz,jobject array,jint index,jlong val)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
int64_t uno_val = (int64_t)val;
jlong __jresult;
JTRY
int64_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::SetLong(uno_array, uno_index, uno_val);
__jresult = (jlong)__result;
JCATCH
return __jresult;
}
jlong JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_ShortArrayToUnoArrayPtr50(JNIEnv *env,jclass clazz,jobject jarr,jlong jarrPtr)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Java::Object* uno_jarr = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(jarr, true);
jlong __jresult;
JTRY
int64_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::ShortArrayToUnoArrayPtr(uCast<::g::Java::Object*>(uno_jarr, ::g::Java::Object_typeof()));
__jresult = (jlong)__result;
JCATCH
return __jresult;
}
jobject JNICALL callUno_Fuse_Controls_Native_ViewHandle_NativeHandleGet251(JNIEnv *env,jclass clazz,jobject jthis)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Fuse::Controls::Native::ViewHandle* uno_jthis = uCast<::g::Fuse::Controls::Native::ViewHandle*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Fuse::Controls::Native::ViewHandle_typeof());
jobject __jresult;
JTRY
::g::Java::Object* __result=uno_jthis->NativeHandle;
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef(((__result==NULL ? NULL : U_JNIVAR->NewLocalRef(::g::Android::Base::Wrappers::IJWrapper::_GetJavaObject(uInterface((uObject*)__result, ::g::Android::Base::Wrappers::IJWrapper_typeof())))))));
JCATCH
return __jresult;
}
jobject JNICALL callUno_Fuse_Platform_SystemUI__keyboardListenerGet64(JNIEnv *env,jclass clazz)
{
uAutoReleasePool pool;
INIT_JNI;
jobject __jresult;
JTRY
::g::Java::Object* __result=::g::Fuse::Platform::SystemUI::_keyboardListener();
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef(((__result==NULL ? NULL : U_JNIVAR->NewLocalRef(::g::Android::Base::Wrappers::IJWrapper::_GetJavaObject(uInterface((uObject*)__result, ::g::Android::Base::Wrappers::IJWrapper_typeof())))))));
JCATCH
return __jresult;
}
jobject JNICALL callUno_Fuse_Platform_SystemUI_layoutAttachedToGet63(JNIEnv *env,jclass clazz)
{
uAutoReleasePool pool;
INIT_JNI;
jobject __jresult;
JTRY
::g::Java::Object* __result=::g::Fuse::Platform::SystemUI::layoutAttachedTo();
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef(((__result==NULL ? NULL : U_JNIVAR->NewLocalRef(::g::Android::Base::Wrappers::IJWrapper::_GetJavaObject(uInterface((uObject*)__result, ::g::Android::Base::Wrappers::IJWrapper_typeof())))))));
JCATCH
return __jresult;
}
jobject JNICALL callUno_Fuse_Platform_SystemUI_RootLayoutGet70(JNIEnv *env,jclass clazz)
{
uAutoReleasePool pool;
INIT_JNI;
jobject __jresult;
JTRY
::g::Java::Object* __result=::g::Fuse::Platform::SystemUI::RootLayout();
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef(((__result==NULL ? NULL : U_JNIVAR->NewLocalRef(::g::Android::Base::Wrappers::IJWrapper::_GetJavaObject(uInterface((uObject*)__result, ::g::Android::Base::Wrappers::IJWrapper_typeof())))))));
JCATCH
return __jresult;
}
jobject JNICALL callUno_Fuse_Platform_SystemUI_SuperLayoutGet68(JNIEnv *env,jclass clazz)
{
uAutoReleasePool pool;
INIT_JNI;
jobject __jresult;
JTRY
::g::Java::Object* __result=::g::Fuse::Platform::SystemUI::SuperLayout();
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef(((__result==NULL ? NULL : U_JNIVAR->NewLocalRef(::g::Android::Base::Wrappers::IJWrapper::_GetJavaObject(uInterface((uObject*)__result, ::g::Android::Base::Wrappers::IJWrapper_typeof())))))));
JCATCH
return __jresult;
}
jobject JNICALL callUno_Neovisionaries_WebSocketClient__webSocketGet365(JNIEnv *env,jclass clazz,jobject jthis)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Neovisionaries::WebSocketClient* uno_jthis = uCast<::g::Neovisionaries::WebSocketClient*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Neovisionaries::WebSocketClient_typeof());
jobject __jresult;
JTRY
::g::Java::Object* __result=uno_jthis->_webSocket;
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef(((__result==NULL ? NULL : U_JNIVAR->NewLocalRef(::g::Android::Base::Wrappers::IJWrapper::_GetJavaObject(uInterface((uObject*)__result, ::g::Android::Base::Wrappers::IJWrapper_typeof())))))));
JCATCH
return __jresult;
}
jobject JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyBoolArray3(JNIEnv *env,jclass clazz,jobject array)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
jobject __jresult;
JTRY
::g::Java::Object* __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::CopyBoolArray(uno_array);
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef(((__result==NULL ? NULL : U_JNIVAR->NewLocalRef(::g::Android::Base::Wrappers::IJWrapper::_GetJavaObject(uInterface((uObject*)__result, ::g::Android::Base::Wrappers::IJWrapper_typeof())))))));
JCATCH
return __jresult;
}
jobject JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyByteArray4(JNIEnv *env,jclass clazz,jobject array)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
jobject __jresult;
JTRY
::g::Java::Object* __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::CopyByteArray(uno_array);
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef(((__result==NULL ? NULL : U_JNIVAR->NewLocalRef(::g::Android::Base::Wrappers::IJWrapper::_GetJavaObject(uInterface((uObject*)__result, ::g::Android::Base::Wrappers::IJWrapper_typeof())))))));
JCATCH
return __jresult;
}
jobject JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyCharArray5(JNIEnv *env,jclass clazz,jobject array)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
jobject __jresult;
JTRY
::g::Java::Object* __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::CopyCharArray(uno_array);
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef(((__result==NULL ? NULL : U_JNIVAR->NewLocalRef(::g::Android::Base::Wrappers::IJWrapper::_GetJavaObject(uInterface((uObject*)__result, ::g::Android::Base::Wrappers::IJWrapper_typeof())))))));
JCATCH
return __jresult;
}
jobject JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyDoubleArray6(JNIEnv *env,jclass clazz,jobject array)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
jobject __jresult;
JTRY
::g::Java::Object* __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::CopyDoubleArray(uno_array);
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef(((__result==NULL ? NULL : U_JNIVAR->NewLocalRef(::g::Android::Base::Wrappers::IJWrapper::_GetJavaObject(uInterface((uObject*)__result, ::g::Android::Base::Wrappers::IJWrapper_typeof())))))));
JCATCH
return __jresult;
}
jobject JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyFloatArray7(JNIEnv *env,jclass clazz,jobject array)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
jobject __jresult;
JTRY
::g::Java::Object* __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::CopyFloatArray(uno_array);
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef(((__result==NULL ? NULL : U_JNIVAR->NewLocalRef(::g::Android::Base::Wrappers::IJWrapper::_GetJavaObject(uInterface((uObject*)__result, ::g::Android::Base::Wrappers::IJWrapper_typeof())))))));
JCATCH
return __jresult;
}
jobject JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyIntArray8(JNIEnv *env,jclass clazz,jobject array)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
jobject __jresult;
JTRY
::g::Java::Object* __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::CopyIntArray(uno_array);
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef(((__result==NULL ? NULL : U_JNIVAR->NewLocalRef(::g::Android::Base::Wrappers::IJWrapper::_GetJavaObject(uInterface((uObject*)__result, ::g::Android::Base::Wrappers::IJWrapper_typeof())))))));
JCATCH
return __jresult;
}
jobject JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyLongArray9(JNIEnv *env,jclass clazz,jobject array)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
jobject __jresult;
JTRY
::g::Java::Object* __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::CopyLongArray(uno_array);
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef(((__result==NULL ? NULL : U_JNIVAR->NewLocalRef(::g::Android::Base::Wrappers::IJWrapper::_GetJavaObject(uInterface((uObject*)__result, ::g::Android::Base::Wrappers::IJWrapper_typeof())))))));
JCATCH
return __jresult;
}
jobject JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyObjectArray10(JNIEnv *env,jclass clazz,jobject array)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
jobject __jresult;
JTRY
::g::Java::Object* __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::CopyObjectArray(uno_array);
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef(((__result==NULL ? NULL : U_JNIVAR->NewLocalRef(::g::Android::Base::Wrappers::IJWrapper::_GetJavaObject(uInterface((uObject*)__result, ::g::Android::Base::Wrappers::IJWrapper_typeof())))))));
JCATCH
return __jresult;
}
jobject JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyShortArray11(JNIEnv *env,jclass clazz,jobject array)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
jobject __jresult;
JTRY
::g::Java::Object* __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::CopyShortArray(uno_array);
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef(((__result==NULL ? NULL : U_JNIVAR->NewLocalRef(::g::Android::Base::Wrappers::IJWrapper::_GetJavaObject(uInterface((uObject*)__result, ::g::Android::Base::Wrappers::IJWrapper_typeof())))))));
JCATCH
return __jresult;
}
jobject JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyStringArray12(JNIEnv *env,jclass clazz,jobject array)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
jobject __jresult;
JTRY
::g::Java::Object* __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::CopyStringArray(uno_array);
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef(((__result==NULL ? NULL : U_JNIVAR->NewLocalRef(::g::Android::Base::Wrappers::IJWrapper::_GetJavaObject(uInterface((uObject*)__result, ::g::Android::Base::Wrappers::IJWrapper_typeof())))))));
JCATCH
return __jresult;
}
jobject JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyUByteArray13(JNIEnv *env,jclass clazz,jobject array)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
jobject __jresult;
JTRY
::g::Java::Object* __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::CopyUByteArray(uno_array);
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef(((__result==NULL ? NULL : U_JNIVAR->NewLocalRef(::g::Android::Base::Wrappers::IJWrapper::_GetJavaObject(uInterface((uObject*)__result, ::g::Android::Base::Wrappers::IJWrapper_typeof())))))));
JCATCH
return __jresult;
}
jobject JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetObject23(JNIEnv *env,jclass clazz,jobject array,jint index)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
jobject __jresult;
JTRY
uObject* __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::GetObject(uno_array, uno_index);
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef((::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(__result))));
JCATCH
return __jresult;
}
jobject JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetString25(JNIEnv *env,jclass clazz,jobject array,jint index)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
jobject __jresult;
JTRY
uString* __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::GetString(uno_array, uno_index);
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef((JniHelper::UnoToJavaString(__result))));
JCATCH
return __jresult;
}
jobject JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetObject46(JNIEnv *env,jclass clazz,jobject array,jint index,jobject val)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
uObject* uno_val = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(val);
jobject __jresult;
JTRY
uObject* __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::SetObject(uno_array, uno_index, uno_val);
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef((::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(__result))));
JCATCH
return __jresult;
}
jobject JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetString48(JNIEnv *env,jclass clazz,jobject array,jint index,jobject val)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
uString* uno_val = JniHelper::JavaToUnoString((jstring)val);
jobject __jresult;
JTRY
uString* __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::SetString(uno_array, uno_index, uCast<uString*>(uno_val, ::g::Uno::String_typeof()));
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef((JniHelper::UnoToJavaString(__result))));
JCATCH
return __jresult;
}
jobject JNICALL callUno_Uno_IO_BundleFile_BundlePathGet308(JNIEnv *env,jclass clazz,jobject jthis)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Uno::IO::BundleFile* uno_jthis = uCast<::g::Uno::IO::BundleFile*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Uno::IO::BundleFile_typeof());
jobject __jresult;
JTRY
uString* __result=uno_jthis->BundlePath();
__jresult = (__result==NULL ? NULL : U_JNIVAR->NewLocalRef((JniHelper::UnoToJavaString(__result))));
JCATCH
return __jresult;
}
jshort JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetShort24(JNIEnv *env,jclass clazz,jobject array,jint index)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
jshort __jresult;
JTRY
int16_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::GetShort(uno_array, uno_index);
__jresult = (jshort)__result;
JCATCH
return __jresult;
}
jshort JNICALL callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetShort47(JNIEnv *env,jclass clazz,jobject array,jint index,jshort val)
{
uAutoReleasePool pool;
INIT_JNI;
uObject* uno_array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(array);
int uno_index = (int)index;
int16_t uno_val = (int16_t)val;
jshort __jresult;
JTRY
int16_t __result=::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::SetShort(uno_array, uno_index, uno_val);
__jresult = (jshort)__result;
JCATCH
return __jresult;
}
void JNICALL callUno_Action(JNIEnv *env,jclass clazz,jobject theDelegate)
{
uAutoReleasePool pool;
INIT_JNI;
uDelegate* uno_theDelegate = uCast<uDelegate*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(theDelegate), ::g::Uno::Action_typeof());
JTRY
uno_theDelegate->InvokeVoid();
JCATCH
}
void JNICALL callUno_Action_ByteArray(JNIEnv *env,jclass clazz,jobject theDelegate,jobject arg)
{
uAutoReleasePool pool;
INIT_JNI;
uDelegate* uno_theDelegate = uCast<uDelegate*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(theDelegate), ::g::Uno::Action1_typeof()->MakeType(::g::Uno::Byte_typeof()->Array(), NULL));
uArray* uno_arg = uCast<uArray*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(arg), ::g::Uno::Byte_typeof()->Array());
JTRY
uno_theDelegate->InvokeVoid(uCast<uArray*>(uno_arg, ::g::Uno::Byte_typeof()->Array()));
JCATCH
}
void JNICALL callUno_Action_int(JNIEnv *env,jclass clazz,jobject theDelegate,jint arg)
{
uAutoReleasePool pool;
INIT_JNI;
uDelegate* uno_theDelegate = uCast<uDelegate*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(theDelegate), ::g::Uno::Action1_typeof()->MakeType(::g::Uno::Int_typeof(), NULL));
int uno_arg = (int)arg;
JTRY
uno_theDelegate->InvokeVoid(uCRef<int>(uno_arg));
JCATCH
}
void JNICALL callUno_Action_Object(JNIEnv *env,jclass clazz,jobject theDelegate,jobject arg,jlong argPtr)
{
uAutoReleasePool pool;
INIT_JNI;
uDelegate* uno_theDelegate = uCast<uDelegate*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(theDelegate), ::g::Uno::Action1_typeof()->MakeType(::g::Java::Object_typeof(), NULL));
::g::Java::Object* uno_arg = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(arg, true);
JTRY
uno_theDelegate->InvokeVoid(uCast<::g::Java::Object*>(uno_arg, ::g::Java::Object_typeof()));
JCATCH
}
void JNICALL callUno_Action_String(JNIEnv *env,jclass clazz,jobject theDelegate,jobject arg)
{
uAutoReleasePool pool;
INIT_JNI;
uDelegate* uno_theDelegate = uCast<uDelegate*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(theDelegate), ::g::Uno::Action1_typeof()->MakeType(::g::Uno::String_typeof(), NULL));
uString* uno_arg = JniHelper::JavaToUnoString((jstring)arg);
JTRY
uno_theDelegate->InvokeVoid(uCast<uString*>(uno_arg, ::g::Uno::String_typeof()));
JCATCH
}
void JNICALL callUno_Fuse_Android_AppRoot_OnTouchEvent__326(JNIEnv *env,jclass clazz,jobject motionEvent,jlong motionEventPtr)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Java::Object* uno_motionEvent = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(motionEvent, true);
JTRY
::g::Fuse::Android::AppRoot::OnTouchEvent__(uCast<::g::Java::Object*>(uno_motionEvent, ::g::Java::Object_typeof()));
JCATCH
}
void JNICALL callUno_Fuse_Android_StatusBarConfig_UpdateStatusBar348(JNIEnv *env,jclass clazz)
{
uAutoReleasePool pool;
INIT_JNI;
JTRY
::g::Fuse::Android::StatusBarConfig::UpdateStatusBar();
JCATCH
}
void JNICALL callUno_Fuse_Controls_Native_Android_FocusChangedListener_OnFocusChange136(JNIEnv *env,jclass clazz,jobject jthis,jboolean hasFocus)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Fuse::Controls::Native::Android::FocusChangedListener* uno_jthis = uCast<::g::Fuse::Controls::Native::Android::FocusChangedListener*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Fuse::Controls::Native::Android::FocusChangedListener_typeof());
bool uno_hasFocus = (bool)hasFocus;
JTRY
uno_jthis->OnFocusChange(uno_hasFocus);
JCATCH
}
void JNICALL callUno_Fuse_Controls_Native_Android_ScrollView_OnScrollChanged178(JNIEnv *env,jclass clazz,jobject jthis,jint x,jint y,jint oldx,jint oldy)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Fuse::Controls::Native::Android::ScrollView* uno_jthis = uCast<::g::Fuse::Controls::Native::Android::ScrollView*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Fuse::Controls::Native::Android::ScrollView_typeof());
int uno_x = (int)x;
int uno_y = (int)y;
int uno_oldx = (int)oldx;
int uno_oldy = (int)oldy;
JTRY
uno_jthis->OnScrollChanged(uno_x, uno_y, uno_oldx, uno_oldy);
JCATCH
}
void JNICALL callUno_Fuse_Controls_Native_Android_Slider_OnSeekBarChanged190(JNIEnv *env,jclass clazz,jobject jthis,jdouble newProgress)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Fuse::Controls::Native::Android::Slider* uno_jthis = uCast<::g::Fuse::Controls::Native::Android::Slider*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Fuse::Controls::Native::Android::Slider_typeof());
double uno_newProgress = (double)newProgress;
JTRY
uno_jthis->OnSeekBarChanged(uno_newProgress);
JCATCH
}
void JNICALL callUno_Fuse_Controls_Native_Android_SurfaceView_OnSurfaceChanged197(JNIEnv *env,jclass clazz,jobject jthis,jobject holder,jint f,jint w,jint h,jlong holderPtr)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Fuse::Controls::Native::Android::SurfaceView* uno_jthis = uCast<::g::Fuse::Controls::Native::Android::SurfaceView*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Fuse::Controls::Native::Android::SurfaceView_typeof());
::g::Java::Object* uno_holder = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(holder, true);
int uno_f = (int)f;
int uno_w = (int)w;
int uno_h = (int)h;
JTRY
uno_jthis->OnSurfaceChanged(uCast<::g::Java::Object*>(uno_holder, ::g::Java::Object_typeof()), uno_f, uno_w, uno_h);
JCATCH
}
void JNICALL callUno_Fuse_Controls_Native_Android_SurfaceView_OnSurfaceCreated198(JNIEnv *env,jclass clazz,jobject jthis,jobject holder,jlong holderPtr)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Fuse::Controls::Native::Android::SurfaceView* uno_jthis = uCast<::g::Fuse::Controls::Native::Android::SurfaceView*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Fuse::Controls::Native::Android::SurfaceView_typeof());
::g::Java::Object* uno_holder = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(holder, true);
JTRY
uno_jthis->OnSurfaceCreated(uCast<::g::Java::Object*>(uno_holder, ::g::Java::Object_typeof()));
JCATCH
}
void JNICALL callUno_Fuse_Controls_Native_Android_SurfaceView_OnSurfaceDestroyed199(JNIEnv *env,jclass clazz,jobject jthis,jobject holder,jlong holderPtr)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Fuse::Controls::Native::Android::SurfaceView* uno_jthis = uCast<::g::Fuse::Controls::Native::Android::SurfaceView*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Fuse::Controls::Native::Android::SurfaceView_typeof());
::g::Java::Object* uno_holder = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(holder, true);
JTRY
uno_jthis->OnSurfaceDestroyed(uCast<::g::Java::Object*>(uno_holder, ::g::Java::Object_typeof()));
JCATCH
}
void JNICALL callUno_Fuse_Controls_Native_Android_SurfaceView_OnSurfaceRedrawNeeded196(JNIEnv *env,jclass clazz,jobject jthis,jobject holder,jlong holderPtr)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Fuse::Controls::Native::Android::SurfaceView* uno_jthis = uCast<::g::Fuse::Controls::Native::Android::SurfaceView*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Fuse::Controls::Native::Android::SurfaceView_typeof());
::g::Java::Object* uno_holder = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(holder, true);
JTRY
uno_jthis->OnSurfaceRedrawNeeded(uCast<::g::Java::Object*>(uno_holder, ::g::Java::Object_typeof()));
JCATCH
}
void JNICALL callUno_Fuse_Controls_Native_Android_Switch_OnToggleChanged203(JNIEnv *env,jclass clazz,jobject jthis,jboolean value)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Fuse::Controls::Native::Android::Switch* uno_jthis = uCast<::g::Fuse::Controls::Native::Android::Switch*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Fuse::Controls::Native::Android::Switch_typeof());
bool uno_value = (bool)value;
JTRY
uno_jthis->OnToggleChanged(uno_value);
JCATCH
}
void JNICALL callUno_Fuse_Controls_Native_Android_TextInput_OnTextChanged210(JNIEnv *env,jclass clazz,jobject jthis,jobject value)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Fuse::Controls::Native::Android::TextInput* uno_jthis = uCast<::g::Fuse::Controls::Native::Android::TextInput*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Fuse::Controls::Native::Android::TextInput_typeof());
uString* uno_value = JniHelper::JavaToUnoString((jstring)value);
JTRY
uno_jthis->OnTextChanged(uCast<uString*>(uno_value, ::g::Uno::String_typeof()));
JCATCH
}
void JNICALL callUno_Fuse_Controls_Native_Android_TextureView_OnSurfaceTextureAvailable224(JNIEnv *env,jclass clazz,jobject jthis,jobject surface,jlong surfacePtr)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Fuse::Controls::Native::Android::TextureView* uno_jthis = uCast<::g::Fuse::Controls::Native::Android::TextureView*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Fuse::Controls::Native::Android::TextureView_typeof());
::g::Java::Object* uno_surface = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(surface, true);
JTRY
uno_jthis->OnSurfaceTextureAvailable(uCast<::g::Java::Object*>(uno_surface, ::g::Java::Object_typeof()));
JCATCH
}
void JNICALL callUno_Fuse_Controls_Native_Android_TextureView_OnSurfaceTextureDestroyed225(JNIEnv *env,jclass clazz,jobject jthis)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Fuse::Controls::Native::Android::TextureView* uno_jthis = uCast<::g::Fuse::Controls::Native::Android::TextureView*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Fuse::Controls::Native::Android::TextureView_typeof());
JTRY
uno_jthis->OnSurfaceTextureDestroyed();
JCATCH
}
void JNICALL callUno_Fuse_Controls_VideoImpl_Android_MediaPlayer_OnBuffer275(JNIEnv *env,jclass clazz,jobject jthis,jint percent)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Fuse::Controls::VideoImpl::Android::MediaPlayer* uno_jthis = uCast<::g::Fuse::Controls::VideoImpl::Android::MediaPlayer*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Fuse::Controls::VideoImpl::Android::MediaPlayer_typeof());
int uno_percent = (int)percent;
JTRY
uno_jthis->OnBuffer(uno_percent);
JCATCH
}
void JNICALL callUno_Fuse_Controls_VideoImpl_Android_MediaPlayer_OnCompletion273(JNIEnv *env,jclass clazz,jobject jthis)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Fuse::Controls::VideoImpl::Android::MediaPlayer* uno_jthis = uCast<::g::Fuse::Controls::VideoImpl::Android::MediaPlayer*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Fuse::Controls::VideoImpl::Android::MediaPlayer_typeof());
JTRY
uno_jthis->OnCompletion();
JCATCH
}
void JNICALL callUno_Fuse_Controls_VideoImpl_Android_MediaPlayer_OnError274(JNIEnv *env,jclass clazz,jobject jthis,jint what,jint extra)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Fuse::Controls::VideoImpl::Android::MediaPlayer* uno_jthis = uCast<::g::Fuse::Controls::VideoImpl::Android::MediaPlayer*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Fuse::Controls::VideoImpl::Android::MediaPlayer_typeof());
int uno_what = (int)what;
int uno_extra = (int)extra;
JTRY
uno_jthis->OnError(uno_what, uno_extra);
JCATCH
}
void JNICALL callUno_Fuse_Controls_VideoImpl_Android_MediaPlayer_OnErrorOccurred287(JNIEnv *env,jclass clazz,jobject jthis,jobject msg)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Fuse::Controls::VideoImpl::Android::MediaPlayer* uno_jthis = uCast<::g::Fuse::Controls::VideoImpl::Android::MediaPlayer*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Fuse::Controls::VideoImpl::Android::MediaPlayer_typeof());
uString* uno_msg = JniHelper::JavaToUnoString((jstring)msg);
JTRY
uno_jthis->OnErrorOccurred(uCast<uString*>(uno_msg, ::g::Uno::String_typeof()));
JCATCH
}
void JNICALL callUno_Fuse_Controls_VideoImpl_Android_MediaPlayer_OnFrameAvailable278(JNIEnv *env,jclass clazz,jobject jthis)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Fuse::Controls::VideoImpl::Android::MediaPlayer* uno_jthis = uCast<::g::Fuse::Controls::VideoImpl::Android::MediaPlayer*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Fuse::Controls::VideoImpl::Android::MediaPlayer_typeof());
JTRY
uno_jthis->OnFrameAvailable();
JCATCH
}
void JNICALL callUno_Fuse_Controls_VideoImpl_Android_MediaPlayer_OnPrepared272(JNIEnv *env,jclass clazz,jobject jthis)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Fuse::Controls::VideoImpl::Android::MediaPlayer* uno_jthis = uCast<::g::Fuse::Controls::VideoImpl::Android::MediaPlayer*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Fuse::Controls::VideoImpl::Android::MediaPlayer_typeof());
JTRY
uno_jthis->OnPrepared();
JCATCH
}
void JNICALL callUno_Fuse_Internal_AndroidSystemFont_AddAlias107(JNIEnv *env,jclass clazz,jobject name,jobject to,jint weight)
{
uAutoReleasePool pool;
INIT_JNI;
uString* uno_name = JniHelper::JavaToUnoString((jstring)name);
uString* uno_to = JniHelper::JavaToUnoString((jstring)to);
int uno_weight = (int)weight;
JTRY
::g::Fuse::Internal::AndroidSystemFont::AddAlias(uCast<uString*>(uno_name, ::g::Uno::String_typeof()), uCast<uString*>(uno_to, ::g::Uno::String_typeof()), uno_weight);
JCATCH
}
void JNICALL callUno_Fuse_Internal_AndroidSystemFont_AddFamily105(JNIEnv *env,jclass clazz,jobject name,jobject language,jobject variant)
{
uAutoReleasePool pool;
INIT_JNI;
uString* uno_name = JniHelper::JavaToUnoString((jstring)name);
uString* uno_language = JniHelper::JavaToUnoString((jstring)language);
uString* uno_variant = JniHelper::JavaToUnoString((jstring)variant);
JTRY
::g::Fuse::Internal::AndroidSystemFont::AddFamily(uCast<uString*>(uno_name, ::g::Uno::String_typeof()), uCast<uString*>(uno_language, ::g::Uno::String_typeof()), uCast<uString*>(uno_variant, ::g::Uno::String_typeof()));
JCATCH
}
void JNICALL callUno_Fuse_Internal_AndroidSystemFont_AddFont106(JNIEnv *env,jclass clazz,jobject path,jint index,jint weight,jboolean isItalic)
{
uAutoReleasePool pool;
INIT_JNI;
uString* uno_path = JniHelper::JavaToUnoString((jstring)path);
int uno_index = (int)index;
int uno_weight = (int)weight;
bool uno_isItalic = (bool)isItalic;
JTRY
::g::Fuse::Internal::AndroidSystemFont::AddFont(uCast<uString*>(uno_path, ::g::Uno::String_typeof()), uno_index, uno_weight, uno_isItalic);
JCATCH
}
void JNICALL callUno_Fuse_Internal_AndroidSystemFont_ThrowUno108(JNIEnv *env,jclass clazz,jobject message)
{
uAutoReleasePool pool;
INIT_JNI;
uString* uno_message = JniHelper::JavaToUnoString((jstring)message);
JTRY
::g::Fuse::Internal::AndroidSystemFont::ThrowUno(uCast<uString*>(uno_message, ::g::Uno::String_typeof()));
JCATCH
}
void JNICALL callUno_Fuse_Platform_SystemUI__keyboardListenerSet64(JNIEnv *env,jclass clazz,jobject setVal,jlong setValPtr)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Java::Object* uno_setVal = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(setVal, true);
JTRY
::g::Fuse::Platform::SystemUI::_keyboardListener() = uCast<::g::Java::Object*>(uno_setVal, ::g::Java::Object_typeof());
JCATCH
}
void JNICALL callUno_Fuse_Platform_SystemUI__systemUIStateSet77(JNIEnv *env,jclass clazz,jint setVal)
{
uAutoReleasePool pool;
INIT_JNI;
int uno_setVal = (int)setVal;
JTRY
::g::Fuse::Platform::SystemUI::_systemUIState() = uno_setVal;
JCATCH
}
void JNICALL callUno_Fuse_Platform_SystemUI_cachedOpenSizeSet85(JNIEnv *env,jclass clazz,jint setVal)
{
uAutoReleasePool pool;
INIT_JNI;
int uno_setVal = (int)setVal;
JTRY
::g::Fuse::Platform::SystemUI::cachedOpenSize() = uno_setVal;
JCATCH
}
void JNICALL callUno_Fuse_Platform_SystemUI_CompensateRootLayoutForSystemUI74(JNIEnv *env,jclass clazz)
{
uAutoReleasePool pool;
INIT_JNI;
JTRY
::g::Fuse::Platform::SystemUI::CompensateRootLayoutForSystemUI();
JCATCH
}
void JNICALL callUno_Fuse_Platform_SystemUI_cppOnConfigChanged93(JNIEnv *env,jclass clazz)
{
uAutoReleasePool pool;
INIT_JNI;
JTRY
::g::Fuse::Platform::SystemUI::cppOnConfigChanged();
JCATCH
}
void JNICALL callUno_Fuse_Platform_SystemUI_cppOnTopFrameChanged80(JNIEnv *env,jclass clazz,jint height)
{
uAutoReleasePool pool;
INIT_JNI;
int uno_height = (int)height;
JTRY
::g::Fuse::Platform::SystemUI::cppOnTopFrameChanged(uno_height);
JCATCH
}
void JNICALL callUno_Fuse_Platform_SystemUI_firstSizingSet101(JNIEnv *env,jclass clazz,jboolean setVal)
{
uAutoReleasePool pool;
INIT_JNI;
bool uno_setVal = (bool)setVal;
JTRY
::g::Fuse::Platform::SystemUI::firstSizing() = uno_setVal;
JCATCH
}
void JNICALL callUno_Fuse_Platform_SystemUI_hasCachedStatusBarSizeSet84(JNIEnv *env,jclass clazz,jboolean setVal)
{
uAutoReleasePool pool;
INIT_JNI;
bool uno_setVal = (bool)setVal;
JTRY
::g::Fuse::Platform::SystemUI::hasCachedStatusBarSize() = uno_setVal;
JCATCH
}
void JNICALL callUno_Fuse_Platform_SystemUI_layoutAttachedToSet63(JNIEnv *env,jclass clazz,jobject setVal,jlong setValPtr)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Java::Object* uno_setVal = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(setVal, true);
JTRY
::g::Fuse::Platform::SystemUI::layoutAttachedTo() = uCast<::g::Java::Object*>(uno_setVal, ::g::Java::Object_typeof());
JCATCH
}
void JNICALL callUno_Fuse_Platform_SystemUI_OnConfigChanged91(JNIEnv *env,jclass clazz)
{
uAutoReleasePool pool;
INIT_JNI;
JTRY
::g::Fuse::Platform::SystemUI::OnConfigChanged();
JCATCH
}
void JNICALL callUno_Fuse_Platform_SystemUI_OnDestroy90(JNIEnv *env,jclass clazz)
{
uAutoReleasePool pool;
INIT_JNI;
JTRY
::g::Fuse::Platform::SystemUI::OnDestroy();
JCATCH
}
void JNICALL callUno_Fuse_Platform_SystemUI_onHideKeyboard102(JNIEnv *env,jclass clazz,jint keyboardHeight,jboolean force)
{
uAutoReleasePool pool;
INIT_JNI;
int uno_keyboardHeight = (int)keyboardHeight;
bool uno_force = (bool)force;
JTRY
::g::Fuse::Platform::SystemUI::onHideKeyboard(uno_keyboardHeight, uno_force);
JCATCH
}
void JNICALL callUno_Fuse_Platform_SystemUI_onShowKeyboard103(JNIEnv *env,jclass clazz,jint keyboardHeight,jboolean force)
{
uAutoReleasePool pool;
INIT_JNI;
int uno_keyboardHeight = (int)keyboardHeight;
bool uno_force = (bool)force;
JTRY
::g::Fuse::Platform::SystemUI::onShowKeyboard(uno_keyboardHeight, uno_force);
JCATCH
}
void JNICALL callUno_Fuse_Platform_SystemUI_realHeightSet67(JNIEnv *env,jclass clazz,jint setVal)
{
uAutoReleasePool pool;
INIT_JNI;
int uno_setVal = (int)setVal;
JTRY
::g::Fuse::Platform::SystemUI::realHeight() = uno_setVal;
JCATCH
}
void JNICALL callUno_Fuse_Platform_SystemUI_realWidthSet66(JNIEnv *env,jclass clazz,jint setVal)
{
uAutoReleasePool pool;
INIT_JNI;
int uno_setVal = (int)setVal;
JTRY
::g::Fuse::Platform::SystemUI::realWidth() = uno_setVal;
JCATCH
}
void JNICALL callUno_Fuse_Platform_SystemUI_ResendFrameSizes94(JNIEnv *env,jclass clazz)
{
uAutoReleasePool pool;
INIT_JNI;
JTRY
::g::Fuse::Platform::SystemUI::ResendFrameSizes();
JCATCH
}
void JNICALL callUno_Fuse_Platform_SystemUI_RootLayoutSet70(JNIEnv *env,jclass clazz,jobject setVal,jlong setValPtr)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Java::Object* uno_setVal = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(setVal, true);
JTRY
::g::Fuse::Platform::SystemUI::RootLayout() = uCast<::g::Java::Object*>(uno_setVal, ::g::Java::Object_typeof());
JCATCH
}
void JNICALL callUno_Fuse_Platform_SystemUI_SuperLayoutSet68(JNIEnv *env,jclass clazz,jobject setVal,jlong setValPtr)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Java::Object* uno_setVal = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(setVal, true);
JTRY
::g::Fuse::Platform::SystemUI::SuperLayout() = uCast<::g::Java::Object*>(uno_setVal, ::g::Java::Object_typeof());
JCATCH
}
void JNICALL callUno_Fuse_Platform_SystemUI_UpdateStatusBar97(JNIEnv *env,jclass clazz)
{
uAutoReleasePool pool;
INIT_JNI;
JTRY
::g::Fuse::Platform::SystemUI::UpdateStatusBar();
JCATCH
}
void JNICALL callUno_Neovisionaries_WebSocketClient__webSocketSet365(JNIEnv *env,jclass clazz,jobject jthis,jobject setVal,jlong setValPtr)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Neovisionaries::WebSocketClient* uno_jthis = uCast<::g::Neovisionaries::WebSocketClient*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Neovisionaries::WebSocketClient_typeof());
::g::Java::Object* uno_setVal = (::g::Java::Object*)::g::Android::Base::Wrappers::JavaObjectHelper::JObjectToJWrapper(setVal, true);
JTRY
uno_jthis->_webSocket = uCast<::g::Java::Object*>(uno_setVal, ::g::Java::Object_typeof());
JCATCH
}
void JNICALL callUno_Uno_Collections_List_lt_string_gt__Add58(JNIEnv *env,jclass clazz,jobject jthis,jobject item)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Uno::Collections::List* uno_jthis = uCast<::g::Uno::Collections::List*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Uno::Collections::List_typeof()->MakeType(::g::Uno::String_typeof(), NULL));
uString* uno_item = JniHelper::JavaToUnoString((jstring)item);
JTRY
::g::Uno::Collections::List__Add_fn(uno_jthis, uCast<uString*>(uno_item, ::g::Uno::String_typeof()));
JCATCH
}
void JNICALL callUno_Uno_Platform_AndroidDisplay__initializedSet54(JNIEnv *env,jclass clazz,jboolean setVal)
{
uAutoReleasePool pool;
INIT_JNI;
bool uno_setVal = (bool)setVal;
JTRY
::g::Uno::Platform::AndroidDisplay::_initialized_ = uno_setVal;
JCATCH
}
void JNICALL callUno_Uno_Platform_AndroidDisplay_OnFrameCallback55(JNIEnv *env,jclass clazz,jobject jthis,jdouble currentTime,jdouble deltaTime)
{
uAutoReleasePool pool;
INIT_JNI;
::g::Uno::Platform::AndroidDisplay* uno_jthis = uCast<::g::Uno::Platform::AndroidDisplay*>(::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBox(jthis), ::g::Uno::Platform::AndroidDisplay_typeof());
double uno_currentTime = (double)currentTime;
double uno_deltaTime = (double)deltaTime;
JTRY
uno_jthis->OnFrameCallback(uno_currentTime, uno_deltaTime);
JCATCH
}
static uString* STRINGS[27];
static uType* TYPES[12];
namespace g{
namespace Uno{
namespace Compiler{
namespace ExportTargetInterop{
namespace Foreign{
namespace Android{
// /Users/kitsco12/Library/Application Support/Fusetools/Packages/UnoCore/1.0.13/source/uno/compiler/exporttargetinterop/foreign/android/$.uno
// -------------------------------------------------------------------------------------------------------------------------------------------
// internal static extern class ExternBlockHost :12
// {
static void ExternBlockHost_build(uType* type)
{
}
uClassType* ExternBlockHost_typeof()
{
static uSStrong<uClassType*> type;
if (type != NULL) return type;
uTypeOptions options;
options.TypeSize = sizeof(uClassType);
type = uClassType::New("Uno.Compiler.ExportTargetInterop.Foreign.Android.ExternBlockHost", options);
type->fp_build_ = ExternBlockHost_build;
return type;
}
// private static extern void RegisterFunctions() :15
void ExternBlockHost__RegisterFunctions_fn()
{
ExternBlockHost::RegisterFunctions();
}
// private static extern void RegisterFunctions() [static] :15
void ExternBlockHost::RegisterFunctions()
{
JniHelper jni;
static JNINativeMethod native_activity_funcs[] = {
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_BoolArrayToUnoArrayPtr0", (char* const)"(Ljava/lang/Object;J)J", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_BoolArrayToUnoArrayPtr0},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_ByteArrayToUnoArrayPtr1", (char* const)"(Ljava/lang/Object;J)J", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_ByteArrayToUnoArrayPtr1},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CharArrayToUnoArrayPtr2", (char* const)"(Ljava/lang/Object;J)J", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CharArrayToUnoArrayPtr2},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyBoolArray3", (char* const)"(Lcom/uno/UnoObject;)Ljava/lang/Object;", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyBoolArray3},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyByteArray4", (char* const)"(Lcom/uno/UnoObject;)Ljava/lang/Object;", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyByteArray4},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyCharArray5", (char* const)"(Lcom/uno/UnoObject;)Ljava/lang/Object;", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyCharArray5},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyDoubleArray6", (char* const)"(Lcom/uno/UnoObject;)Ljava/lang/Object;", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyDoubleArray6},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyFloatArray7", (char* const)"(Lcom/uno/UnoObject;)Ljava/lang/Object;", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyFloatArray7},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyIntArray8", (char* const)"(Lcom/uno/UnoObject;)Ljava/lang/Object;", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyIntArray8},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyLongArray9", (char* const)"(Lcom/uno/UnoObject;)Ljava/lang/Object;", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyLongArray9},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyObjectArray10", (char* const)"(Lcom/uno/UnoObject;)Ljava/lang/Object;", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyObjectArray10},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyShortArray11", (char* const)"(Lcom/uno/UnoObject;)Ljava/lang/Object;", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyShortArray11},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyStringArray12", (char* const)"(Lcom/uno/UnoObject;)Ljava/lang/Object;", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyStringArray12},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyUByteArray13", (char* const)"(Lcom/uno/UnoObject;)Ljava/lang/Object;", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_CopyUByteArray13},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_DoubleArrayToUnoArrayPtr14", (char* const)"(Ljava/lang/Object;J)J", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_DoubleArrayToUnoArrayPtr14},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_FloatArrayToUnoArrayPtr15", (char* const)"(Ljava/lang/Object;J)J", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_FloatArrayToUnoArrayPtr15},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetBool16", (char* const)"(Lcom/uno/UnoObject;I)Z", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetBool16},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetByte17", (char* const)"(Lcom/uno/UnoObject;I)B", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetByte17},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetChar18", (char* const)"(Lcom/uno/UnoObject;I)C", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetChar18},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetDouble19", (char* const)"(Lcom/uno/UnoObject;I)D", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetDouble19},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetFloat20", (char* const)"(Lcom/uno/UnoObject;I)F", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetFloat20},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetInt21", (char* const)"(Lcom/uno/UnoObject;I)I", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetInt21},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetLong22", (char* const)"(Lcom/uno/UnoObject;I)J", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetLong22},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetObject23", (char* const)"(Lcom/uno/UnoObject;I)Lcom/uno/UnoObject;", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetObject23},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetShort24", (char* const)"(Lcom/uno/UnoObject;I)S", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetShort24},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetString25", (char* const)"(Lcom/uno/UnoObject;I)Ljava/lang/String;", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetString25},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetUByte26", (char* const)"(Lcom/uno/UnoObject;I)B", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_GetUByte26},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_IntArrayToUnoArrayPtr27", (char* const)"(Ljava/lang/Object;J)J", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_IntArrayToUnoArrayPtr27},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_LongArrayToUnoArrayPtr28", (char* const)"(Ljava/lang/Object;J)J", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_LongArrayToUnoArrayPtr28},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewBoolArrayPtr29", (char* const)"(I)J", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewBoolArrayPtr29},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewByteArrayPtr30", (char* const)"(IZ)J", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewByteArrayPtr30},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewCharArrayPtr31", (char* const)"(I)J", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewCharArrayPtr31},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewDoubleArrayPtr32", (char* const)"(I)J", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewDoubleArrayPtr32},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewFloatArrayPtr33", (char* const)"(I)J", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewFloatArrayPtr33},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewIntArrayPtr34", (char* const)"(I)J", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewIntArrayPtr34},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewLongArrayPtr35", (char* const)"(I)J", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewLongArrayPtr35},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewObjectArrayPtr36", (char* const)"(I)J", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewObjectArrayPtr36},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewShortArrayPtr37", (char* const)"(I)J", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewShortArrayPtr37},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewStringArrayPtr38", (char* const)"(I)J", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_NewStringArrayPtr38},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetBool39", (char* const)"(Lcom/uno/UnoObject;IZ)Z", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetBool39},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetByte40", (char* const)"(Lcom/uno/UnoObject;IB)B", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetByte40},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetChar41", (char* const)"(Lcom/uno/UnoObject;IC)C", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetChar41},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetDouble42", (char* const)"(Lcom/uno/UnoObject;ID)D", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetDouble42},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetFloat43", (char* const)"(Lcom/uno/UnoObject;IF)F", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetFloat43},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetInt44", (char* const)"(Lcom/uno/UnoObject;II)I", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetInt44},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetLong45", (char* const)"(Lcom/uno/UnoObject;IJ)J", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetLong45},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetObject46", (char* const)"(Lcom/uno/UnoObject;ILcom/uno/UnoObject;)Lcom/uno/UnoObject;", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetObject46},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetShort47", (char* const)"(Lcom/uno/UnoObject;IS)S", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetShort47},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetString48", (char* const)"(Lcom/uno/UnoObject;ILjava/lang/String;)Ljava/lang/String;", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetString48},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetUByte49", (char* const)"(Lcom/uno/UnoObject;IB)B", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_SetUByte49},
{(char* const)"callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_ShortArrayToUnoArrayPtr50", (char* const)"(Ljava/lang/Object;J)J", (void *)&callUno_Uno_Compiler_ExportTargetInterop_Foreign_Android_JavaToUnoArrayEntrypoints_ShortArrayToUnoArrayPtr50},
{(char* const)"callUno_Uno_Platform_AndroidDisplay__initializedGet54", (char* const)"()Z", (void *)&callUno_Uno_Platform_AndroidDisplay__initializedGet54},
{(char* const)"callUno_Uno_Platform_AndroidDisplay__initializedSet54", (char* const)"(Z)V", (void *)&callUno_Uno_Platform_AndroidDisplay__initializedSet54},
{(char* const)"callUno_Uno_Platform_AndroidDisplay_OnFrameCallback55", (char* const)"(Lcom/uno/UnoObject;DD)V", (void *)&callUno_Uno_Platform_AndroidDisplay_OnFrameCallback55},
{(char* const)"callUno_Uno_Collections_List_lt_string_gt__Add58", (char* const)"(Lcom/uno/UnoObject;Ljava/lang/String;)V", (void *)&callUno_Uno_Collections_List_lt_string_gt__Add58},
{(char* const)"callUno_Fuse_Platform_SystemUI_layoutAttachedToGet63", (char* const)"()Ljava/lang/Object;", (void *)&callUno_Fuse_Platform_SystemUI_layoutAttachedToGet63},
{(char* const)"callUno_Fuse_Platform_SystemUI_layoutAttachedToSet63", (char* const)"(Ljava/lang/Object;J)V", (void *)&callUno_Fuse_Platform_SystemUI_layoutAttachedToSet63},
{(char* const)"callUno_Fuse_Platform_SystemUI__keyboardListenerGet64", (char* const)"()Ljava/lang/Object;", (void *)&callUno_Fuse_Platform_SystemUI__keyboardListenerGet64},
{(char* const)"callUno_Fuse_Platform_SystemUI_realWidthSet66", (char* const)"(I)V", (void *)&callUno_Fuse_Platform_SystemUI_realWidthSet66},
{(char* const)"callUno_Fuse_Platform_SystemUI_realHeightSet67", (char* const)"(I)V", (void *)&callUno_Fuse_Platform_SystemUI_realHeightSet67},
{(char* const)"callUno_Fuse_Platform_SystemUI_SuperLayoutGet68", (char* const)"()Ljava/lang/Object;", (void *)&callUno_Fuse_Platform_SystemUI_SuperLayoutGet68},
{(char* const)"callUno_Fuse_Platform_SystemUI_realHeightGet67", (char* const)"()I", (void *)&callUno_Fuse_Platform_SystemUI_realHeightGet67},
{(char* const)"callUno_Fuse_Platform_SystemUI_realWidthGet66", (char* const)"()I", (void *)&callUno_Fuse_Platform_SystemUI_realWidthGet66},
{(char* const)"callUno_Fuse_Platform_SystemUI_SuperLayoutSet68", (char* const)"(Ljava/lang/Object;J)V", (void *)&callUno_Fuse_Platform_SystemUI_SuperLayoutSet68},
{(char* const)"callUno_Fuse_Platform_SystemUI_RootLayoutSet70", (char* const)"(Ljava/lang/Object;J)V", (void *)&callUno_Fuse_Platform_SystemUI_RootLayoutSet70},
{(char* const)"callUno_Fuse_Platform_SystemUI_RootLayoutGet70", (char* const)"()Ljava/lang/Object;", (void *)&callUno_Fuse_Platform_SystemUI_RootLayoutGet70},
{(char* const)"callUno_Fuse_Platform_SystemUI_GetRealDisplayHeight73", (char* const)"()I", (void *)&callUno_Fuse_Platform_SystemUI_GetRealDisplayHeight73},
{(char* const)"callUno_Fuse_Platform_SystemUI_CompensateRootLayoutForSystemUI74", (char* const)"()V", (void *)&callUno_Fuse_Platform_SystemUI_CompensateRootLayoutForSystemUI74},
{(char* const)"callUno_Fuse_Platform_SystemUI__systemUIStateSet77", (char* const)"(I)V", (void *)&callUno_Fuse_Platform_SystemUI__systemUIStateSet77},
{(char* const)"callUno_Fuse_Platform_SystemUI_cppOnTopFrameChanged80", (char* const)"(I)V", (void *)&callUno_Fuse_Platform_SystemUI_cppOnTopFrameChanged80},
{(char* const)"callUno_Fuse_Platform_SystemUI__systemUIStateGet77", (char* const)"()I", (void *)&callUno_Fuse_Platform_SystemUI__systemUIStateGet77},
{(char* const)"callUno_Fuse_Platform_SystemUI_hasCachedStatusBarSizeGet84", (char* const)"()Z", (void *)&callUno_Fuse_Platform_SystemUI_hasCachedStatusBarSizeGet84},
{(char* const)"callUno_Fuse_Platform_SystemUI_cachedOpenSizeGet85", (char* const)"()I", (void *)&callUno_Fuse_Platform_SystemUI_cachedOpenSizeGet85},
{(char* const)"callUno_Fuse_Platform_SystemUI_hasCachedStatusBarSizeSet84", (char* const)"(Z)V", (void *)&callUno_Fuse_Platform_SystemUI_hasCachedStatusBarSizeSet84},
{(char* const)"callUno_Fuse_Platform_SystemUI_cachedOpenSizeSet85", (char* const)"(I)V", (void *)&callUno_Fuse_Platform_SystemUI_cachedOpenSizeSet85},
{(char* const)"callUno_Fuse_Platform_SystemUI_OnDestroy90", (char* const)"()V", (void *)&callUno_Fuse_Platform_SystemUI_OnDestroy90},
{(char* const)"callUno_Fuse_Platform_SystemUI_OnConfigChanged91", (char* const)"()V", (void *)&callUno_Fuse_Platform_SystemUI_OnConfigChanged91},
{(char* const)"callUno_Fuse_Platform_SystemUI_GetRealDisplayWidth92", (char* const)"()I", (void *)&callUno_Fuse_Platform_SystemUI_GetRealDisplayWidth92},
{(char* const)"callUno_Fuse_Platform_SystemUI_cppOnConfigChanged93", (char* const)"()V", (void *)&callUno_Fuse_Platform_SystemUI_cppOnConfigChanged93},
{(char* const)"callUno_Fuse_Platform_SystemUI_ResendFrameSizes94", (char* const)"()V", (void *)&callUno_Fuse_Platform_SystemUI_ResendFrameSizes94},
{(char* const)"callUno_Fuse_Platform_SystemUI__keyboardListenerSet64", (char* const)"(Ljava/lang/Object;J)V", (void *)&callUno_Fuse_Platform_SystemUI__keyboardListenerSet64},
{(char* const)"callUno_Fuse_Platform_SystemUI_UpdateStatusBar97", (char* const)"()V", (void *)&callUno_Fuse_Platform_SystemUI_UpdateStatusBar97},
{(char* const)"callUno_Fuse_Platform_SystemUI_lastKeyboardHeightGet100", (char* const)"()I", (void *)&callUno_Fuse_Platform_SystemUI_lastKeyboardHeightGet100},
{(char* const)"callUno_Fuse_Platform_SystemUI_firstSizingGet101", (char* const)"()Z", (void *)&callUno_Fuse_Platform_SystemUI_firstSizingGet101},
{(char* const)"callUno_Fuse_Platform_SystemUI_onHideKeyboard102", (char* const)"(IZ)V", (void *)&callUno_Fuse_Platform_SystemUI_onHideKeyboard102},
{(char* const)"callUno_Fuse_Platform_SystemUI_onShowKeyboard103", (char* const)"(IZ)V", (void *)&callUno_Fuse_Platform_SystemUI_onShowKeyboard103},
{(char* const)"callUno_Fuse_Platform_SystemUI_firstSizingSet101", (char* const)"(Z)V", (void *)&callUno_Fuse_Platform_SystemUI_firstSizingSet101},
{(char* const)"callUno_Fuse_Internal_AndroidSystemFont_AddFamily105", (char* const)"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", (void *)&callUno_Fuse_Internal_AndroidSystemFont_AddFamily105},
{(char* const)"callUno_Fuse_Internal_AndroidSystemFont_AddFont106", (char* const)"(Ljava/lang/String;IIZ)V", (void *)&callUno_Fuse_Internal_AndroidSystemFont_AddFont106},
{(char* const)"callUno_Fuse_Internal_AndroidSystemFont_AddAlias107", (char* const)"(Ljava/lang/String;Ljava/lang/String;I)V", (void *)&callUno_Fuse_Internal_AndroidSystemFont_AddAlias107},
{(char* const)"callUno_Fuse_Internal_AndroidSystemFont_ThrowUno108", (char* const)"(Ljava/lang/String;)V", (void *)&callUno_Fuse_Internal_AndroidSystemFont_ThrowUno108},
{(char* const)"callUno_Fuse_Controls_Native_Android_FocusChangedListener_OnFocusChange136", (char* const)"(Lcom/uno/UnoObject;Z)V", (void *)&callUno_Fuse_Controls_Native_Android_FocusChangedListener_OnFocusChange136},
{(char* const)"callUno_Action_Object", (char* const)"(Lcom/foreign/Uno/Action_Object;Ljava/lang/Object;J)V", (void *)&callUno_Action_Object},
{(char* const)"callUno_Action_String", (char* const)"(Lcom/foreign/Uno/Action_String;Ljava/lang/String;)V", (void *)&callUno_Action_String},
{(char* const)"callUno_Fuse_Controls_Native_Android_InputDispatch_OnTouch153", (char* const)"(Ljava/lang/Object;Ljava/lang/Object;JJ)Z", (void *)&callUno_Fuse_Controls_Native_Android_InputDispatch_OnTouch153},
{(char* const)"callUno_Fuse_Controls_Native_Android_ScrollView_OnScrollChanged178", (char* const)"(Lcom/uno/UnoObject;IIII)V", (void *)&callUno_Fuse_Controls_Native_Android_ScrollView_OnScrollChanged178},
{(char* const)"callUno_Fuse_Controls_Native_Android_Slider_OnSeekBarChanged190", (char* const)"(Lcom/uno/UnoObject;D)V", (void *)&callUno_Fuse_Controls_Native_Android_Slider_OnSeekBarChanged190},
{(char* const)"callUno_Fuse_Controls_Native_Android_SurfaceView_OnSurfaceRedrawNeeded196", (char* const)"(Lcom/uno/UnoObject;Ljava/lang/Object;J)V", (void *)&callUno_Fuse_Controls_Native_Android_SurfaceView_OnSurfaceRedrawNeeded196},
{(char* const)"callUno_Fuse_Controls_Native_Android_SurfaceView_OnSurfaceChanged197", (char* const)"(Lcom/uno/UnoObject;Ljava/lang/Object;IIIJ)V", (void *)&callUno_Fuse_Controls_Native_Android_SurfaceView_OnSurfaceChanged197},
{(char* const)"callUno_Fuse_Controls_Native_Android_SurfaceView_OnSurfaceCreated198", (char* const)"(Lcom/uno/UnoObject;Ljava/lang/Object;J)V", (void *)&callUno_Fuse_Controls_Native_Android_SurfaceView_OnSurfaceCreated198},
{(char* const)"callUno_Fuse_Controls_Native_Android_SurfaceView_OnSurfaceDestroyed199", (char* const)"(Lcom/uno/UnoObject;Ljava/lang/Object;J)V", (void *)&callUno_Fuse_Controls_Native_Android_SurfaceView_OnSurfaceDestroyed199},
{(char* const)"callUno_Fuse_Controls_Native_Android_Switch_OnToggleChanged203", (char* const)"(Lcom/uno/UnoObject;Z)V", (void *)&callUno_Fuse_Controls_Native_Android_Switch_OnToggleChanged203},
{(char* const)"callUno_Fuse_Controls_Native_Android_TextInput_OnEditorAction208", (char* const)"(Lcom/uno/UnoObject;I)Z", (void *)&callUno_Fuse_Controls_Native_Android_TextInput_OnEditorAction208},
{(char* const)"callUno_Fuse_Controls_Native_Android_TextInput_OnTextChanged210", (char* const)"(Lcom/uno/UnoObject;Ljava/lang/String;)V", (void *)&callUno_Fuse_Controls_Native_Android_TextInput_OnTextChanged210},
{(char* const)"callUno_Fuse_Controls_Native_Android_TextureView_OnSurfaceTextureAvailable224", (char* const)"(Lcom/uno/UnoObject;Ljava/lang/Object;J)V", (void *)&callUno_Fuse_Controls_Native_Android_TextureView_OnSurfaceTextureAvailable224},
{(char* const)"callUno_Fuse_Controls_Native_Android_TextureView_OnSurfaceTextureDestroyed225", (char* const)"(Lcom/uno/UnoObject;)V", (void *)&callUno_Fuse_Controls_Native_Android_TextureView_OnSurfaceTextureDestroyed225},
{(char* const)"callUno_Fuse_Controls_Native_ViewHandle_NativeHandleGet251", (char* const)"(Lcom/uno/UnoObject;)Ljava/lang/Object;", (void *)&callUno_Fuse_Controls_Native_ViewHandle_NativeHandleGet251},
{(char* const)"callUno_Fuse_Controls_VideoImpl_Android_MediaPlayer_OnPrepared272", (char* const)"(Lcom/uno/UnoObject;)V", (void *)&callUno_Fuse_Controls_VideoImpl_Android_MediaPlayer_OnPrepared272},
{(char* const)"callUno_Fuse_Controls_VideoImpl_Android_MediaPlayer_OnCompletion273", (char* const)"(Lcom/uno/UnoObject;)V", (void *)&callUno_Fuse_Controls_VideoImpl_Android_MediaPlayer_OnCompletion273},
{(char* const)"callUno_Fuse_Controls_VideoImpl_Android_MediaPlayer_OnError274", (char* const)"(Lcom/uno/UnoObject;II)V", (void *)&callUno_Fuse_Controls_VideoImpl_Android_MediaPlayer_OnError274},
{(char* const)"callUno_Fuse_Controls_VideoImpl_Android_MediaPlayer_OnBuffer275", (char* const)"(Lcom/uno/UnoObject;I)V", (void *)&callUno_Fuse_Controls_VideoImpl_Android_MediaPlayer_OnBuffer275},
{(char* const)"callUno_Fuse_Controls_VideoImpl_Android_MediaPlayer_OnFrameAvailable278", (char* const)"(Lcom/uno/UnoObject;)V", (void *)&callUno_Fuse_Controls_VideoImpl_Android_MediaPlayer_OnFrameAvailable278},
{(char* const)"callUno_Fuse_Controls_VideoImpl_Android_MediaPlayer_OnErrorOccurred287", (char* const)"(Lcom/uno/UnoObject;Ljava/lang/String;)V", (void *)&callUno_Fuse_Controls_VideoImpl_Android_MediaPlayer_OnErrorOccurred287},
{(char* const)"callUno_Uno_IO_BundleFile_BundlePathGet308", (char* const)"(Lcom/uno/UnoObject;)Ljava/lang/String;", (void *)&callUno_Uno_IO_BundleFile_BundlePathGet308},
{(char* const)"callUno_Action_int", (char* const)"(Lcom/foreign/Uno/Action_int;I)V", (void *)&callUno_Action_int},
{(char* const)"callUno_Action", (char* const)"(Lcom/foreign/Uno/Action;)V", (void *)&callUno_Action},
{(char* const)"callUno_Fuse_Android_AppRoot_OnTouchEvent__326", (char* const)"(Ljava/lang/Object;J)V", (void *)&callUno_Fuse_Android_AppRoot_OnTouchEvent__326},
{(char* const)"callUno_Fuse_Android_StatusBarConfig_UpdateStatusBar348", (char* const)"()V", (void *)&callUno_Fuse_Android_StatusBarConfig_UpdateStatusBar348},
{(char* const)"callUno_Neovisionaries_WebSocketClient__webSocketGet365", (char* const)"(Lcom/uno/UnoObject;)Ljava/lang/Object;", (void *)&callUno_Neovisionaries_WebSocketClient__webSocketGet365},
{(char* const)"callUno_Action_ByteArray", (char* const)"(Lcom/foreign/Uno/Action_ByteArray;Lcom/uno/ByteArray;)V", (void *)&callUno_Action_ByteArray},
{(char* const)"callUno_Neovisionaries_WebSocketClient__webSocketSet365", (char* const)"(Lcom/uno/UnoObject;Ljava/lang/Object;J)V", (void *)&callUno_Neovisionaries_WebSocketClient__webSocketSet365},
};
int funcCount = 121;
if ((int)jni->RegisterNatives(JniHelper::GetNativeExternClass(), native_activity_funcs, funcCount)<0) {
LOGD("COULD NOT REGISTER NATIVE EXTERN FUNCTIONS");
throw uBase::Exception("COULD NOT REGISTER NATIVE EXTERN FUNCTIONS");
}
}
// }
// /Users/kitsco12/Library/Application Support/Fusetools/Packages/UnoCore/1.0.13/source/uno/compiler/exporttargetinterop/foreign/android/$.uno
// -------------------------------------------------------------------------------------------------------------------------------------------
// public static extern class JavaToUnoArrayEntrypoints :305
// {
static void JavaToUnoArrayEntrypoints_build(uType* type)
{
::STRINGS[0] = uString::Const("java/lang/Object");
::STRINGS[1] = uString::Const("java/lang/String");
::TYPES[0] = ::g::Android::Base::Wrappers::JWrapper_typeof();
::TYPES[1] = ::g::Uno::Bool_typeof()->Array();
::TYPES[2] = ::g::Uno::Byte_typeof()->Array();
::TYPES[3] = ::g::Uno::Char_typeof()->Array();
::TYPES[4] = ::g::Uno::SByte_typeof()->Array();
::TYPES[5] = ::g::Uno::Double_typeof()->Array();
::TYPES[6] = ::g::Uno::Float_typeof()->Array();
::TYPES[7] = ::g::Uno::Int_typeof()->Array();
::TYPES[8] = ::g::Uno::Long_typeof()->Array();
::TYPES[9] = uObject_typeof()->Array();
::TYPES[10] = ::g::Uno::Short_typeof()->Array();
::TYPES[11] = ::g::Uno::String_typeof()->Array();
type->SetFields(0,
::g::Android::Base::Primitives::ujclass_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::_objectClass_, uFieldFlagsStatic,
::g::Android::Base::Primitives::ujclass_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaToUnoArrayEntrypoints::_stringClass_, uFieldFlagsStatic);
}
uClassType* JavaToUnoArrayEntrypoints_typeof()
{
static uSStrong<uClassType*> type;
if (type != NULL) return type;
uTypeOptions options;
options.FieldCount = 2;
options.TypeSize = sizeof(uClassType);
type = uClassType::New("Uno.Compiler.ExportTargetInterop.Foreign.Android.JavaToUnoArrayEntrypoints", options);
type->fp_build_ = JavaToUnoArrayEntrypoints_build;
return type;
}
// public static long BoolArrayToUnoArrayPtr(Java.Object jarr) :897
void JavaToUnoArrayEntrypoints__BoolArrayToUnoArrayPtr_fn(::g::Java::Object* jarr, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::BoolArrayToUnoArrayPtr(jarr);
}
// public static long ByteArrayToUnoArrayPtr(Java.Object jarr) :925
void JavaToUnoArrayEntrypoints__ByteArrayToUnoArrayPtr_fn(::g::Java::Object* jarr, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::ByteArrayToUnoArrayPtr(jarr);
}
// public static long CharArrayToUnoArrayPtr(Java.Object jarr) :911
void JavaToUnoArrayEntrypoints__CharArrayToUnoArrayPtr_fn(::g::Java::Object* jarr, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::CharArrayToUnoArrayPtr(jarr);
}
// public static Java.Object CopyBoolArray(object array) :398
void JavaToUnoArrayEntrypoints__CopyBoolArray_fn(uObject* array, ::g::Java::Object** __retval)
{
*__retval = JavaToUnoArrayEntrypoints::CopyBoolArray(array);
}
// public static Java.Object CopyByteArray(object array) :406
void JavaToUnoArrayEntrypoints__CopyByteArray_fn(uObject* array, ::g::Java::Object** __retval)
{
*__retval = JavaToUnoArrayEntrypoints::CopyByteArray(array);
}
// public static Java.Object CopyCharArray(object array) :422
void JavaToUnoArrayEntrypoints__CopyCharArray_fn(uObject* array, ::g::Java::Object** __retval)
{
*__retval = JavaToUnoArrayEntrypoints::CopyCharArray(array);
}
// public static Java.Object CopyDoubleArray(object array) :462
void JavaToUnoArrayEntrypoints__CopyDoubleArray_fn(uObject* array, ::g::Java::Object** __retval)
{
*__retval = JavaToUnoArrayEntrypoints::CopyDoubleArray(array);
}
// public static Java.Object CopyFloatArray(object array) :454
void JavaToUnoArrayEntrypoints__CopyFloatArray_fn(uObject* array, ::g::Java::Object** __retval)
{
*__retval = JavaToUnoArrayEntrypoints::CopyFloatArray(array);
}
// public static Java.Object CopyIntArray(object array) :438
void JavaToUnoArrayEntrypoints__CopyIntArray_fn(uObject* array, ::g::Java::Object** __retval)
{
*__retval = JavaToUnoArrayEntrypoints::CopyIntArray(array);
}
// public static Java.Object CopyLongArray(object array) :446
void JavaToUnoArrayEntrypoints__CopyLongArray_fn(uObject* array, ::g::Java::Object** __retval)
{
*__retval = JavaToUnoArrayEntrypoints::CopyLongArray(array);
}
// public static Java.Object CopyObjectArray(object array) :492
void JavaToUnoArrayEntrypoints__CopyObjectArray_fn(uObject* array, ::g::Java::Object** __retval)
{
*__retval = JavaToUnoArrayEntrypoints::CopyObjectArray(array);
}
// public static Java.Object CopyShortArray(object array) :430
void JavaToUnoArrayEntrypoints__CopyShortArray_fn(uObject* array, ::g::Java::Object** __retval)
{
*__retval = JavaToUnoArrayEntrypoints::CopyShortArray(array);
}
// public static Java.Object CopyStringArray(object array) :472
void JavaToUnoArrayEntrypoints__CopyStringArray_fn(uObject* array, ::g::Java::Object** __retval)
{
*__retval = JavaToUnoArrayEntrypoints::CopyStringArray(array);
}
// public static Java.Object CopyUByteArray(object array) :414
void JavaToUnoArrayEntrypoints__CopyUByteArray_fn(uObject* array, ::g::Java::Object** __retval)
{
*__retval = JavaToUnoArrayEntrypoints::CopyUByteArray(array);
}
// public static long DoubleArrayToUnoArrayPtr(Java.Object jarr) :995
void JavaToUnoArrayEntrypoints__DoubleArrayToUnoArrayPtr_fn(::g::Java::Object* jarr, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::DoubleArrayToUnoArrayPtr(jarr);
}
// public static long FloatArrayToUnoArrayPtr(Java.Object jarr) :981
void JavaToUnoArrayEntrypoints__FloatArrayToUnoArrayPtr_fn(::g::Java::Object* jarr, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::FloatArrayToUnoArrayPtr(jarr);
}
// public static bool getBool(object array, int index) :511
void JavaToUnoArrayEntrypoints__getBool_fn(uObject* array, int* index, bool* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::getBool(array, *index);
}
// public static bool GetBool(object array, int index) :307
void JavaToUnoArrayEntrypoints__GetBool_fn(uObject* array, int* index, bool* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::GetBool(array, *index);
}
// public static sbyte getByte(object array, int index) :517
void JavaToUnoArrayEntrypoints__getByte_fn(uObject* array, int* index, int8_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::getByte(array, *index);
}
// public static sbyte GetByte(object array, int index) :311
void JavaToUnoArrayEntrypoints__GetByte_fn(uObject* array, int* index, int8_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::GetByte(array, *index);
}
// public static char GetChar(object array, int index) :319
void JavaToUnoArrayEntrypoints__GetChar_fn(uObject* array, int* index, uChar* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::GetChar(array, *index);
}
// public static double getDouble(object array, int index) :559
void JavaToUnoArrayEntrypoints__getDouble_fn(uObject* array, int* index, double* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::getDouble(array, *index);
}
// public static double GetDouble(object array, int index) :339
void JavaToUnoArrayEntrypoints__GetDouble_fn(uObject* array, int* index, double* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::GetDouble(array, *index);
}
// public static float getFloat(object array, int index) :553
void JavaToUnoArrayEntrypoints__getFloat_fn(uObject* array, int* index, float* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::getFloat(array, *index);
}
// public static float GetFloat(object array, int index) :335
void JavaToUnoArrayEntrypoints__GetFloat_fn(uObject* array, int* index, float* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::GetFloat(array, *index);
}
// public static int getInt(object array, int index) :541
void JavaToUnoArrayEntrypoints__getInt_fn(uObject* array, int* index, int* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::getInt(array, *index);
}
// public static int GetInt(object array, int index) :327
void JavaToUnoArrayEntrypoints__GetInt_fn(uObject* array, int* index, int* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::GetInt(array, *index);
}
// public static long getLong(object array, int index) :547
void JavaToUnoArrayEntrypoints__getLong_fn(uObject* array, int* index, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::getLong(array, *index);
}
// public static long GetLong(object array, int index) :331
void JavaToUnoArrayEntrypoints__GetLong_fn(uObject* array, int* index, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::GetLong(array, *index);
}
// public static object getObject(object array, int index) :571
void JavaToUnoArrayEntrypoints__getObject_fn(uObject* array, int* index, uObject** __retval)
{
*__retval = JavaToUnoArrayEntrypoints::getObject(array, *index);
}
// public static object GetObject(object array, int index) :347
void JavaToUnoArrayEntrypoints__GetObject_fn(uObject* array, int* index, uObject** __retval)
{
*__retval = JavaToUnoArrayEntrypoints::GetObject(array, *index);
}
// public static short getShort(object array, int index) :535
void JavaToUnoArrayEntrypoints__getShort_fn(uObject* array, int* index, int16_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::getShort(array, *index);
}
// public static short GetShort(object array, int index) :323
void JavaToUnoArrayEntrypoints__GetShort_fn(uObject* array, int* index, int16_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::GetShort(array, *index);
}
// public static string getString(object array, int index) :565
void JavaToUnoArrayEntrypoints__getString_fn(uObject* array, int* index, uString** __retval)
{
*__retval = JavaToUnoArrayEntrypoints::getString(array, *index);
}
// public static string GetString(object array, int index) :343
void JavaToUnoArrayEntrypoints__GetString_fn(uObject* array, int* index, uString** __retval)
{
*__retval = JavaToUnoArrayEntrypoints::GetString(array, *index);
}
// public static sbyte GetUByte(object array, int index) :315
void JavaToUnoArrayEntrypoints__GetUByte_fn(uObject* array, int* index, int8_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::GetUByte(array, *index);
}
// public static long IntArrayToUnoArrayPtr(Java.Object jarr) :953
void JavaToUnoArrayEntrypoints__IntArrayToUnoArrayPtr_fn(::g::Java::Object* jarr, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::IntArrayToUnoArrayPtr(jarr);
}
// public static long LongArrayToUnoArrayPtr(Java.Object jarr) :967
void JavaToUnoArrayEntrypoints__LongArrayToUnoArrayPtr_fn(::g::Java::Object* jarr, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::LongArrayToUnoArrayPtr(jarr);
}
// public static long NewBoolArrayPtr(int length) :773
void JavaToUnoArrayEntrypoints__NewBoolArrayPtr_fn(int* length, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::NewBoolArrayPtr(*length);
}
// public static long NewByteArrayPtr(int length, bool unoIsUnsigned) :780
void JavaToUnoArrayEntrypoints__NewByteArrayPtr_fn(int* length, bool* unoIsUnsigned, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::NewByteArrayPtr(*length, *unoIsUnsigned);
}
// public static long NewCharArrayPtr(int length) :791
void JavaToUnoArrayEntrypoints__NewCharArrayPtr_fn(int* length, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::NewCharArrayPtr(*length);
}
// public static long NewDoubleArrayPtr(int length) :826
void JavaToUnoArrayEntrypoints__NewDoubleArrayPtr_fn(int* length, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::NewDoubleArrayPtr(*length);
}
// public static long NewFloatArrayPtr(int length) :819
void JavaToUnoArrayEntrypoints__NewFloatArrayPtr_fn(int* length, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::NewFloatArrayPtr(*length);
}
// public static long NewIntArrayPtr(int length) :805
void JavaToUnoArrayEntrypoints__NewIntArrayPtr_fn(int* length, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::NewIntArrayPtr(*length);
}
// public static long NewLongArrayPtr(int length) :812
void JavaToUnoArrayEntrypoints__NewLongArrayPtr_fn(int* length, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::NewLongArrayPtr(*length);
}
// public static long NewObjectArrayPtr(int length) :840
void JavaToUnoArrayEntrypoints__NewObjectArrayPtr_fn(int* length, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::NewObjectArrayPtr(*length);
}
// public static long NewShortArrayPtr(int length) :798
void JavaToUnoArrayEntrypoints__NewShortArrayPtr_fn(int* length, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::NewShortArrayPtr(*length);
}
// public static long NewStringArrayPtr(int length) :833
void JavaToUnoArrayEntrypoints__NewStringArrayPtr_fn(int* length, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::NewStringArrayPtr(*length);
}
// public static bool setBool(object array, int index, bool val) :579
void JavaToUnoArrayEntrypoints__setBool_fn(uObject* array, int* index, bool* val, bool* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::setBool(array, *index, *val);
}
// public static bool SetBool(object array, int index, bool val) :352
void JavaToUnoArrayEntrypoints__SetBool_fn(uObject* array, int* index, bool* val, bool* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::SetBool(array, *index, *val);
}
// public static sbyte setByte(object array, int index, sbyte val) :585
void JavaToUnoArrayEntrypoints__setByte_fn(uObject* array, int* index, int8_t* val, int8_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::setByte(array, *index, *val);
}
// public static sbyte SetByte(object array, int index, sbyte val) :356
void JavaToUnoArrayEntrypoints__SetByte_fn(uObject* array, int* index, int8_t* val, int8_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::SetByte(array, *index, *val);
}
// public static char SetChar(object array, int index, char val) :365
void JavaToUnoArrayEntrypoints__SetChar_fn(uObject* array, int* index, uChar* val, uChar* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::SetChar(array, *index, *val);
}
// public static double setDouble(object array, int index, double val) :627
void JavaToUnoArrayEntrypoints__setDouble_fn(uObject* array, int* index, double* val, double* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::setDouble(array, *index, *val);
}
// public static double SetDouble(object array, int index, double val) :385
void JavaToUnoArrayEntrypoints__SetDouble_fn(uObject* array, int* index, double* val, double* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::SetDouble(array, *index, *val);
}
// public static float setFloat(object array, int index, float val) :621
void JavaToUnoArrayEntrypoints__setFloat_fn(uObject* array, int* index, float* val, float* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::setFloat(array, *index, *val);
}
// public static float SetFloat(object array, int index, float val) :381
void JavaToUnoArrayEntrypoints__SetFloat_fn(uObject* array, int* index, float* val, float* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::SetFloat(array, *index, *val);
}
// public static int setInt(object array, int index, int val) :609
void JavaToUnoArrayEntrypoints__setInt_fn(uObject* array, int* index, int* val, int* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::setInt(array, *index, *val);
}
// public static int SetInt(object array, int index, int val) :373
void JavaToUnoArrayEntrypoints__SetInt_fn(uObject* array, int* index, int* val, int* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::SetInt(array, *index, *val);
}
// public static long setLong(object array, int index, long val) :615
void JavaToUnoArrayEntrypoints__setLong_fn(uObject* array, int* index, int64_t* val, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::setLong(array, *index, *val);
}
// public static long SetLong(object array, int index, long val) :377
void JavaToUnoArrayEntrypoints__SetLong_fn(uObject* array, int* index, int64_t* val, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::SetLong(array, *index, *val);
}
// public static object setObject(object array, int index, object val) :639
void JavaToUnoArrayEntrypoints__setObject_fn(uObject* array, int* index, uObject* val, uObject** __retval)
{
*__retval = JavaToUnoArrayEntrypoints::setObject(array, *index, val);
}
// public static object SetObject(object array, int index, object val) :393
void JavaToUnoArrayEntrypoints__SetObject_fn(uObject* array, int* index, uObject* val, uObject** __retval)
{
*__retval = JavaToUnoArrayEntrypoints::SetObject(array, *index, val);
}
// public static short setShort(object array, int index, short val) :603
void JavaToUnoArrayEntrypoints__setShort_fn(uObject* array, int* index, int16_t* val, int16_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::setShort(array, *index, *val);
}
// public static short SetShort(object array, int index, short val) :369
void JavaToUnoArrayEntrypoints__SetShort_fn(uObject* array, int* index, int16_t* val, int16_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::SetShort(array, *index, *val);
}
// public static string setString(object array, int index, string val) :633
void JavaToUnoArrayEntrypoints__setString_fn(uObject* array, int* index, uString* val, uString** __retval)
{
*__retval = JavaToUnoArrayEntrypoints::setString(array, *index, val);
}
// public static string SetString(object array, int index, string val) :389
void JavaToUnoArrayEntrypoints__SetString_fn(uObject* array, int* index, uString* val, uString** __retval)
{
*__retval = JavaToUnoArrayEntrypoints::SetString(array, *index, val);
}
// public static sbyte SetUByte(object array, int index, sbyte val) :360
void JavaToUnoArrayEntrypoints__SetUByte_fn(uObject* array, int* index, int8_t* val, int8_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::SetUByte(array, *index, *val);
}
// public static long ShortArrayToUnoArrayPtr(Java.Object jarr) :939
void JavaToUnoArrayEntrypoints__ShortArrayToUnoArrayPtr_fn(::g::Java::Object* jarr, int64_t* __retval)
{
*__retval = JavaToUnoArrayEntrypoints::ShortArrayToUnoArrayPtr(jarr);
}
jclass JavaToUnoArrayEntrypoints::_objectClass_;
jclass JavaToUnoArrayEntrypoints::_stringClass_;
// public static long BoolArrayToUnoArrayPtr(Java.Object jarr) [static] :897
int64_t JavaToUnoArrayEntrypoints::BoolArrayToUnoArrayPtr(::g::Java::Object* jarr)
{
jbooleanArray obj = static_cast<jbooleanArray>(uPtr(uCast< ::g::Android::Base::Wrappers::JWrapper*>(jarr, ::TYPES[0/*Android.Base.Wrappers.JWrapper*/]))->_GetJavaObject());
JNIEnv* env = ::g::Android::Base::JNI::GetEnvPtr();
int len = (int)env->GetArrayLength(obj);
uArray* arr = uArray::New(::TYPES[1/*bool[]*/], len);
env->GetBooleanArrayRegion(obj, (jsize)0, (jsize)len, (jboolean*)arr->_ptr);
uRetain(arr);
return (int64_t)arr;
}
// public static long ByteArrayToUnoArrayPtr(Java.Object jarr) [static] :925
int64_t JavaToUnoArrayEntrypoints::ByteArrayToUnoArrayPtr(::g::Java::Object* jarr)
{
jbyteArray obj = static_cast<jbyteArray>(uPtr(uCast< ::g::Android::Base::Wrappers::JWrapper*>(jarr, ::TYPES[0/*Android.Base.Wrappers.JWrapper*/]))->_GetJavaObject());
JNIEnv* env = ::g::Android::Base::JNI::GetEnvPtr();
int len = (int)env->GetArrayLength(obj);
uArray* arr = uArray::New(::TYPES[2/*byte[]*/], len);
env->GetByteArrayRegion(obj, (jsize)0, (jsize)len, (jbyte*)arr->_ptr);
uRetain(arr);
return (int64_t)arr;
}
// public static long CharArrayToUnoArrayPtr(Java.Object jarr) [static] :911
int64_t JavaToUnoArrayEntrypoints::CharArrayToUnoArrayPtr(::g::Java::Object* jarr)
{
jcharArray obj = static_cast<jcharArray>(uPtr(uCast< ::g::Android::Base::Wrappers::JWrapper*>(jarr, ::TYPES[0/*Android.Base.Wrappers.JWrapper*/]))->_GetJavaObject());
JNIEnv* env = ::g::Android::Base::JNI::GetEnvPtr();
int len = (int)env->GetArrayLength(obj);
uArray* arr = uArray::New(::TYPES[3/*char[]*/], len);
env->GetCharArrayRegion(obj, (jsize)0, (jsize)len, (jchar*)arr->_ptr);
uRetain(arr);
return (int64_t)arr;
}
// public static Java.Object CopyBoolArray(object array) [static] :398
::g::Java::Object* JavaToUnoArrayEntrypoints::CopyBoolArray(uObject* array)
{
uArray* arr = uCast<uArray*>(array, ::TYPES[1/*bool[]*/]);
jobject jarr = ::g::Android::Base::JNI::NewBooleanArray(uPtr(arr)->Length());
::g::Android::Base::JNI::SetBooleanArrayRegion(jarr, arr, 0, -1);
return ::g::Android::Base::Wrappers::JWrapper::Wrap(jarr, false, false);
}
// public static Java.Object CopyByteArray(object array) [static] :406
::g::Java::Object* JavaToUnoArrayEntrypoints::CopyByteArray(uObject* array)
{
uArray* arr = uCast<uArray*>(array, ::TYPES[4/*sbyte[]*/]);
jobject jarr = ::g::Android::Base::JNI::NewByteArray(uPtr(arr)->Length());
::g::Android::Base::JNI::SetByteArrayRegion1(jarr, arr, 0, -1);
return ::g::Android::Base::Wrappers::JWrapper::Wrap(jarr, false, false);
}
// public static Java.Object CopyCharArray(object array) [static] :422
::g::Java::Object* JavaToUnoArrayEntrypoints::CopyCharArray(uObject* array)
{
uArray* arr = uCast<uArray*>(array, ::TYPES[3/*char[]*/]);
jobject jarr = ::g::Android::Base::JNI::NewCharArray(uPtr(arr)->Length());
::g::Android::Base::JNI::SetCharArrayRegion(jarr, arr, 0, -1);
return ::g::Android::Base::Wrappers::JWrapper::Wrap(jarr, false, false);
}
// public static Java.Object CopyDoubleArray(object array) [static] :462
::g::Java::Object* JavaToUnoArrayEntrypoints::CopyDoubleArray(uObject* array)
{
uArray* arr = uCast<uArray*>(array, ::TYPES[5/*double[]*/]);
jobject jarr = ::g::Android::Base::JNI::NewDoubleArray(uPtr(arr)->Length());
::g::Android::Base::JNI::SetDoubleArrayRegion(jarr, arr, 0, -1);
return ::g::Android::Base::Wrappers::JWrapper::Wrap(jarr, false, false);
}
// public static Java.Object CopyFloatArray(object array) [static] :454
::g::Java::Object* JavaToUnoArrayEntrypoints::CopyFloatArray(uObject* array)
{
uArray* arr = uCast<uArray*>(array, ::TYPES[6/*float[]*/]);
jobject jarr = ::g::Android::Base::JNI::NewFloatArray(uPtr(arr)->Length());
::g::Android::Base::JNI::SetFloatArrayRegion(jarr, arr, 0, -1);
return ::g::Android::Base::Wrappers::JWrapper::Wrap(jarr, false, false);
}
// public static Java.Object CopyIntArray(object array) [static] :438
::g::Java::Object* JavaToUnoArrayEntrypoints::CopyIntArray(uObject* array)
{
uArray* arr = uCast<uArray*>(array, ::TYPES[7/*int[]*/]);
jobject jarr = ::g::Android::Base::JNI::NewIntArray(uPtr(arr)->Length());
::g::Android::Base::JNI::SetIntArrayRegion(jarr, arr, 0, -1);
return ::g::Android::Base::Wrappers::JWrapper::Wrap(jarr, false, false);
}
// public static Java.Object CopyLongArray(object array) [static] :446
::g::Java::Object* JavaToUnoArrayEntrypoints::CopyLongArray(uObject* array)
{
uArray* arr = uCast<uArray*>(array, ::TYPES[8/*long[]*/]);
jobject jarr = ::g::Android::Base::JNI::NewLongArray(uPtr(arr)->Length());
::g::Android::Base::JNI::SetLongArrayRegion(jarr, arr, 0, -1);
return ::g::Android::Base::Wrappers::JWrapper::Wrap(jarr, false, false);
}
// public static Java.Object CopyObjectArray(object array) [static] :492
::g::Java::Object* JavaToUnoArrayEntrypoints::CopyObjectArray(uObject* array)
{
JNIEnv* env = ::g::Android::Base::JNI::GetEnvPtr();
if (::g::Android::Base::Primitives::ujclass::op_Equality(JavaToUnoArrayEntrypoints::_objectClass_, ::g::Android::Base::Primitives::ujclass::Null()))
JavaToUnoArrayEntrypoints::_objectClass_ = ::g::Android::Base::JNI::NewGlobalRef(::g::Android::Base::JNI::LoadClass3(::STRINGS[0/*"java/lang/O...*/], true));
uArray* arr = uCast<uArray*>(array, ::TYPES[9/*object[]*/]);
jobject jarr = ::g::Android::Base::JNI::NewObjectArray(JavaToUnoArrayEntrypoints::_objectClass_, uPtr(arr)->Length());
for (int i = 0; i < arr->Length(); i++)
{
jobject o = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(uPtr(arr)->Strong<uObject*>(i));
env->SetObjectArrayElement((jobjectArray)jarr, i, o);
::g::Android::Base::JNI::DeleteLocalRef1(o);
}
return ::g::Android::Base::Wrappers::JWrapper::Wrap(jarr, false, false);
}
// public static Java.Object CopyShortArray(object array) [static] :430
::g::Java::Object* JavaToUnoArrayEntrypoints::CopyShortArray(uObject* array)
{
uArray* arr = uCast<uArray*>(array, ::TYPES[10/*short[]*/]);
jobject jarr = ::g::Android::Base::JNI::NewShortArray(uPtr(arr)->Length());
::g::Android::Base::JNI::SetShortArrayRegion(jarr, arr, 0, -1);
return ::g::Android::Base::Wrappers::JWrapper::Wrap(jarr, false, false);
}
// public static Java.Object CopyStringArray(object array) [static] :472
::g::Java::Object* JavaToUnoArrayEntrypoints::CopyStringArray(uObject* array)
{
JNIEnv* env = ::g::Android::Base::JNI::GetEnvPtr();
if (::g::Android::Base::Primitives::ujclass::op_Equality(JavaToUnoArrayEntrypoints::_stringClass_, ::g::Android::Base::Primitives::ujclass::Null()))
JavaToUnoArrayEntrypoints::_stringClass_ = ::g::Android::Base::JNI::NewGlobalRef(::g::Android::Base::JNI::LoadClass3(::STRINGS[1/*"java/lang/S...*/], true));
uArray* arr = uCast<uArray*>(array, ::TYPES[11/*string[]*/]);
jobject jarr = ::g::Android::Base::JNI::NewObjectArray(JavaToUnoArrayEntrypoints::_stringClass_, uPtr(arr)->Length());
for (int i = 0; i < arr->Length(); i++)
{
jobject s = ::g::Android::Base::Types::String::UnoToJava1(uPtr(arr)->Strong<uString*>(i));
env->SetObjectArrayElement((jobjectArray)jarr, i, (jobject)s);
::g::Android::Base::JNI::DeleteLocalRef1(s);
}
return ::g::Android::Base::Wrappers::JWrapper::Wrap(jarr, false, false);
}
// public static Java.Object CopyUByteArray(object array) [static] :414
::g::Java::Object* JavaToUnoArrayEntrypoints::CopyUByteArray(uObject* array)
{
uArray* arr = uCast<uArray*>(array, ::TYPES[2/*byte[]*/]);
jobject jarr = ::g::Android::Base::JNI::NewByteArray(uPtr(arr)->Length());
::g::Android::Base::JNI::SetByteArrayRegion(jarr, arr, 0, -1);
return ::g::Android::Base::Wrappers::JWrapper::Wrap(jarr, false, false);
}
// public static long DoubleArrayToUnoArrayPtr(Java.Object jarr) [static] :995
int64_t JavaToUnoArrayEntrypoints::DoubleArrayToUnoArrayPtr(::g::Java::Object* jarr)
{
jdoubleArray obj = static_cast<jdoubleArray>(uPtr(uCast< ::g::Android::Base::Wrappers::JWrapper*>(jarr, ::TYPES[0/*Android.Base.Wrappers.JWrapper*/]))->_GetJavaObject());
JNIEnv* env = ::g::Android::Base::JNI::GetEnvPtr();
int len = (int)env->GetArrayLength(obj);
uArray* arr = uArray::New(::TYPES[5/*double[]*/], len);
env->GetDoubleArrayRegion(obj, (jsize)0, (jsize)len, (jdouble*)arr->_ptr);
uRetain(arr);
return (int64_t)arr;
}
// public static long FloatArrayToUnoArrayPtr(Java.Object jarr) [static] :981
int64_t JavaToUnoArrayEntrypoints::FloatArrayToUnoArrayPtr(::g::Java::Object* jarr)
{
jfloatArray obj = static_cast<jfloatArray>(uPtr(uCast< ::g::Android::Base::Wrappers::JWrapper*>(jarr, ::TYPES[0/*Android.Base.Wrappers.JWrapper*/]))->_GetJavaObject());
JNIEnv* env = ::g::Android::Base::JNI::GetEnvPtr();
int len = (int)env->GetArrayLength(obj);
uArray* arr = uArray::New(::TYPES[6/*float[]*/], len);
env->GetFloatArrayRegion(obj, (jsize)0, (jsize)len, (jfloat*)arr->_ptr);
uRetain(arr);
return (int64_t)arr;
}
// public static bool getBool(object array, int index) [static] :511
bool JavaToUnoArrayEntrypoints::getBool(uObject* array, int index)
{
{
INIT_JNI;
jclass __cls = JniHelper::GetNativeExternClass();
WITH_STATIC_JAVA_METHOD(__mtd, __cls, "getBool", "(Lcom/uno/UnoObject;I)Z");
uObject* _uarray=array;
jobject _array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(_uarray);
int _uindex=index;
jint _index = (jint)_uindex;
jboolean __jresult = U_JNIVAR->CallStaticBooleanMethod(__cls,__mtd,_array,_index);
bool __result = (bool)__jresult;
if (_array!=NULL) { U_JNIVAR->DeleteLocalRef(_array); }
::g::Android::Base::JNI::CheckException();
return __result;
}
}
// public static bool GetBool(object array, int index) [static] :307
bool JavaToUnoArrayEntrypoints::GetBool(uObject* array, int index)
{
return uPtr(uCast<uArray*>(array, ::TYPES[1/*bool[]*/]))->Item<bool>(index);
}
// public static sbyte getByte(object array, int index) [static] :517
int8_t JavaToUnoArrayEntrypoints::getByte(uObject* array, int index)
{
{
INIT_JNI;
jclass __cls = JniHelper::GetNativeExternClass();
WITH_STATIC_JAVA_METHOD(__mtd, __cls, "getByte", "(Lcom/uno/UnoObject;I)B");
uObject* _uarray=array;
jobject _array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(_uarray);
int _uindex=index;
jint _index = (jint)_uindex;
jbyte __jresult = U_JNIVAR->CallStaticByteMethod(__cls,__mtd,_array,_index);
int8_t __result = (int8_t)__jresult;
if (_array!=NULL) { U_JNIVAR->DeleteLocalRef(_array); }
::g::Android::Base::JNI::CheckException();
return __result;
}
}
// public static sbyte GetByte(object array, int index) [static] :311
int8_t JavaToUnoArrayEntrypoints::GetByte(uObject* array, int index)
{
return uPtr(uCast<uArray*>(array, ::TYPES[4/*sbyte[]*/]))->Item<int8_t>(index);
}
// public static char GetChar(object array, int index) [static] :319
uChar JavaToUnoArrayEntrypoints::GetChar(uObject* array, int index)
{
return uPtr(uCast<uArray*>(array, ::TYPES[3/*char[]*/]))->Item<uChar>(index);
}
// public static double getDouble(object array, int index) [static] :559
double JavaToUnoArrayEntrypoints::getDouble(uObject* array, int index)
{
{
INIT_JNI;
jclass __cls = JniHelper::GetNativeExternClass();
WITH_STATIC_JAVA_METHOD(__mtd, __cls, "getDouble", "(Lcom/uno/UnoObject;I)D");
uObject* _uarray=array;
jobject _array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(_uarray);
int _uindex=index;
jint _index = (jint)_uindex;
jdouble __jresult = U_JNIVAR->CallStaticDoubleMethod(__cls,__mtd,_array,_index);
double __result = (double)__jresult;
if (_array!=NULL) { U_JNIVAR->DeleteLocalRef(_array); }
::g::Android::Base::JNI::CheckException();
return __result;
}
}
// public static double GetDouble(object array, int index) [static] :339
double JavaToUnoArrayEntrypoints::GetDouble(uObject* array, int index)
{
return uPtr(uCast<uArray*>(array, ::TYPES[5/*double[]*/]))->Item<double>(index);
}
// public static float getFloat(object array, int index) [static] :553
float JavaToUnoArrayEntrypoints::getFloat(uObject* array, int index)
{
{
INIT_JNI;
jclass __cls = JniHelper::GetNativeExternClass();
WITH_STATIC_JAVA_METHOD(__mtd, __cls, "getFloat", "(Lcom/uno/UnoObject;I)F");
uObject* _uarray=array;
jobject _array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(_uarray);
int _uindex=index;
jint _index = (jint)_uindex;
jfloat __jresult = U_JNIVAR->CallStaticFloatMethod(__cls,__mtd,_array,_index);
float __result = (float)__jresult;
if (_array!=NULL) { U_JNIVAR->DeleteLocalRef(_array); }
::g::Android::Base::JNI::CheckException();
return __result;
}
}
// public static float GetFloat(object array, int index) [static] :335
float JavaToUnoArrayEntrypoints::GetFloat(uObject* array, int index)
{
return uPtr(uCast<uArray*>(array, ::TYPES[6/*float[]*/]))->Item<float>(index);
}
// public static int getInt(object array, int index) [static] :541
int JavaToUnoArrayEntrypoints::getInt(uObject* array, int index)
{
{
INIT_JNI;
jclass __cls = JniHelper::GetNativeExternClass();
WITH_STATIC_JAVA_METHOD(__mtd, __cls, "getInt", "(Lcom/uno/UnoObject;I)I");
uObject* _uarray=array;
jobject _array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(_uarray);
int _uindex=index;
jint _index = (jint)_uindex;
jint __jresult = U_JNIVAR->CallStaticIntMethod(__cls,__mtd,_array,_index);
int __result = (int)__jresult;
if (_array!=NULL) { U_JNIVAR->DeleteLocalRef(_array); }
::g::Android::Base::JNI::CheckException();
return __result;
}
}
// public static int GetInt(object array, int index) [static] :327
int JavaToUnoArrayEntrypoints::GetInt(uObject* array, int index)
{
return uPtr(uCast<uArray*>(array, ::TYPES[7/*int[]*/]))->Item<int>(index);
}
// public static long getLong(object array, int index) [static] :547
int64_t JavaToUnoArrayEntrypoints::getLong(uObject* array, int index)
{
{
INIT_JNI;
jclass __cls = JniHelper::GetNativeExternClass();
WITH_STATIC_JAVA_METHOD(__mtd, __cls, "getLong", "(Lcom/uno/UnoObject;I)J");
uObject* _uarray=array;
jobject _array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(_uarray);
int _uindex=index;
jint _index = (jint)_uindex;
jlong __jresult = U_JNIVAR->CallStaticLongMethod(__cls,__mtd,_array,_index);
int64_t __result = (int64_t)__jresult;
if (_array!=NULL) { U_JNIVAR->DeleteLocalRef(_array); }
::g::Android::Base::JNI::CheckException();
return __result;
}
}
// public static long GetLong(object array, int index) [static] :331
int64_t JavaToUnoArrayEntrypoints::GetLong(uObject* array, int index)
{
return uPtr(uCast<uArray*>(array, ::TYPES[8/*long[]*/]))->Item<int64_t>(index);
}
// public static object getObject(object array, int index) [static] :571
uObject* JavaToUnoArrayEntrypoints::getObject(uObject* array, int index)
{
{
INIT_JNI;
jclass __cls = JniHelper::GetNativeExternClass();
WITH_STATIC_JAVA_METHOD(__mtd, __cls, "getObject", "(Lcom/uno/UnoObject;I)Lcom/uno/UnoObject;");
uObject* _uarray=array;
jobject _array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(_uarray);
int _uindex=index;
jint _index = (jint)_uindex;
jobject __jresult = U_JNIVAR->CallStaticObjectMethod(__cls,__mtd,_array,_index);
uObject* __result = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBoxFreeingLocalRef(__jresult);
if (_array!=NULL) { U_JNIVAR->DeleteLocalRef(_array); }
::g::Android::Base::JNI::CheckException();
return __result;
}
}
// public static object GetObject(object array, int index) [static] :347
uObject* JavaToUnoArrayEntrypoints::GetObject(uObject* array, int index)
{
return uPtr(uCast<uArray*>(array, ::TYPES[9/*object[]*/]))->Strong<uObject*>(index);
}
// public static short getShort(object array, int index) [static] :535
int16_t JavaToUnoArrayEntrypoints::getShort(uObject* array, int index)
{
{
INIT_JNI;
jclass __cls = JniHelper::GetNativeExternClass();
WITH_STATIC_JAVA_METHOD(__mtd, __cls, "getShort", "(Lcom/uno/UnoObject;I)S");
uObject* _uarray=array;
jobject _array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(_uarray);
int _uindex=index;
jint _index = (jint)_uindex;
jshort __jresult = U_JNIVAR->CallStaticShortMethod(__cls,__mtd,_array,_index);
int16_t __result = (int16_t)__jresult;
if (_array!=NULL) { U_JNIVAR->DeleteLocalRef(_array); }
::g::Android::Base::JNI::CheckException();
return __result;
}
}
// public static short GetShort(object array, int index) [static] :323
int16_t JavaToUnoArrayEntrypoints::GetShort(uObject* array, int index)
{
return uPtr(uCast<uArray*>(array, ::TYPES[10/*short[]*/]))->Item<int16_t>(index);
}
// public static string getString(object array, int index) [static] :565
uString* JavaToUnoArrayEntrypoints::getString(uObject* array, int index)
{
{
INIT_JNI;
jclass __cls = JniHelper::GetNativeExternClass();
WITH_STATIC_JAVA_METHOD(__mtd, __cls, "getString", "(Lcom/uno/UnoObject;I)Ljava/lang/String;");
uObject* _uarray=array;
jobject _array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(_uarray);
int _uindex=index;
jint _index = (jint)_uindex;
jobject __jresult = U_JNIVAR->CallStaticObjectMethod(__cls,__mtd,_array,_index);
uString* __result = JniHelper::JavaToUnoString((jstring)__jresult);
if (_array!=NULL) { U_JNIVAR->DeleteLocalRef(_array); }
if (__jresult!=NULL && U_JNIVAR->GetObjectRefType(__jresult) == JNILocalRefType) U_JNIVAR->DeleteLocalRef(__jresult);
::g::Android::Base::JNI::CheckException();
return __result;
}
}
// public static string GetString(object array, int index) [static] :343
uString* JavaToUnoArrayEntrypoints::GetString(uObject* array, int index)
{
return uPtr(uCast<uArray*>(array, ::TYPES[11/*string[]*/]))->Strong<uString*>(index);
}
// public static sbyte GetUByte(object array, int index) [static] :315
int8_t JavaToUnoArrayEntrypoints::GetUByte(uObject* array, int index)
{
return (int8_t)uPtr(uCast<uArray*>(array, ::TYPES[2/*byte[]*/]))->Item<uint8_t>(index);
}
// public static long IntArrayToUnoArrayPtr(Java.Object jarr) [static] :953
int64_t JavaToUnoArrayEntrypoints::IntArrayToUnoArrayPtr(::g::Java::Object* jarr)
{
jintArray obj = static_cast<jintArray>(uPtr(uCast< ::g::Android::Base::Wrappers::JWrapper*>(jarr, ::TYPES[0/*Android.Base.Wrappers.JWrapper*/]))->_GetJavaObject());
JNIEnv* env = ::g::Android::Base::JNI::GetEnvPtr();
int len = (int)env->GetArrayLength(obj);
uArray* arr = uArray::New(::TYPES[7/*int[]*/], len);
env->GetIntArrayRegion(obj, (jsize)0, (jsize)len, (jint*)arr->_ptr);
uRetain(arr);
return (int64_t)arr;
}
// public static long LongArrayToUnoArrayPtr(Java.Object jarr) [static] :967
int64_t JavaToUnoArrayEntrypoints::LongArrayToUnoArrayPtr(::g::Java::Object* jarr)
{
jlongArray obj = static_cast<jlongArray>(uPtr(uCast< ::g::Android::Base::Wrappers::JWrapper*>(jarr, ::TYPES[0/*Android.Base.Wrappers.JWrapper*/]))->_GetJavaObject());
JNIEnv* env = ::g::Android::Base::JNI::GetEnvPtr();
int len = (int)env->GetArrayLength(obj);
uArray* arr = uArray::New(::TYPES[8/*long[]*/], len);
env->GetLongArrayRegion(obj, (jsize)0, (jsize)len, (jlong*)arr->_ptr);
uRetain(arr);
return (int64_t)arr;
}
// public static long NewBoolArrayPtr(int length) [static] :773
int64_t JavaToUnoArrayEntrypoints::NewBoolArrayPtr(int length)
{
uArray* arr = uArray::New(::TYPES[1/*bool[]*/], length);
uRetain(arr);
return (int64_t)arr;
}
// public static long NewByteArrayPtr(int length, bool unoIsUnsigned) [static] :780
int64_t JavaToUnoArrayEntrypoints::NewByteArrayPtr(int length, bool unoIsUnsigned)
{
uObject* arr;
if (unoIsUnsigned)
arr = uArray::New(::TYPES[2/*byte[]*/], length);
else
arr = uArray::New(::TYPES[4/*sbyte[]*/], length);
uRetain(arr);
return (int64_t)arr;
}
// public static long NewCharArrayPtr(int length) [static] :791
int64_t JavaToUnoArrayEntrypoints::NewCharArrayPtr(int length)
{
uArray* arr = uArray::New(::TYPES[3/*char[]*/], length);
uRetain(arr);
return (int64_t)arr;
}
// public static long NewDoubleArrayPtr(int length) [static] :826
int64_t JavaToUnoArrayEntrypoints::NewDoubleArrayPtr(int length)
{
uArray* arr = uArray::New(::TYPES[5/*double[]*/], length);
uRetain(arr);
return (int64_t)arr;
}
// public static long NewFloatArrayPtr(int length) [static] :819
int64_t JavaToUnoArrayEntrypoints::NewFloatArrayPtr(int length)
{
uArray* arr = uArray::New(::TYPES[6/*float[]*/], length);
uRetain(arr);
return (int64_t)arr;
}
// public static long NewIntArrayPtr(int length) [static] :805
int64_t JavaToUnoArrayEntrypoints::NewIntArrayPtr(int length)
{
uArray* arr = uArray::New(::TYPES[7/*int[]*/], length);
uRetain(arr);
return (int64_t)arr;
}
// public static long NewLongArrayPtr(int length) [static] :812
int64_t JavaToUnoArrayEntrypoints::NewLongArrayPtr(int length)
{
uArray* arr = uArray::New(::TYPES[8/*long[]*/], length);
uRetain(arr);
return (int64_t)arr;
}
// public static long NewObjectArrayPtr(int length) [static] :840
int64_t JavaToUnoArrayEntrypoints::NewObjectArrayPtr(int length)
{
uArray* arr = uArray::New(::TYPES[9/*object[]*/], length);
uRetain(arr);
return (int64_t)arr;
}
// public static long NewShortArrayPtr(int length) [static] :798
int64_t JavaToUnoArrayEntrypoints::NewShortArrayPtr(int length)
{
uArray* arr = uArray::New(::TYPES[10/*short[]*/], length);
uRetain(arr);
return (int64_t)arr;
}
// public static long NewStringArrayPtr(int length) [static] :833
int64_t JavaToUnoArrayEntrypoints::NewStringArrayPtr(int length)
{
uArray* arr = uArray::New(::TYPES[11/*string[]*/], length);
uRetain(arr);
return (int64_t)arr;
}
// public static bool setBool(object array, int index, bool val) [static] :579
bool JavaToUnoArrayEntrypoints::setBool(uObject* array, int index, bool val)
{
{
INIT_JNI;
jclass __cls = JniHelper::GetNativeExternClass();
WITH_STATIC_JAVA_METHOD(__mtd, __cls, "setBool", "(Lcom/uno/UnoObject;IZ)Z");
uObject* _uarray=array;
jobject _array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(_uarray);
int _uindex=index;
jint _index = (jint)_uindex;
bool _uval=val;
jboolean _val = (jboolean)_uval;
jboolean __jresult = U_JNIVAR->CallStaticBooleanMethod(__cls,__mtd,_array,_index,_val);
bool __result = (bool)__jresult;
if (_array!=NULL) { U_JNIVAR->DeleteLocalRef(_array); }
::g::Android::Base::JNI::CheckException();
return __result;
}
}
// public static bool SetBool(object array, int index, bool val) [static] :352
bool JavaToUnoArrayEntrypoints::SetBool(uObject* array, int index, bool val)
{
return uPtr(uCast<uArray*>(array, ::TYPES[1/*bool[]*/]))->Item<bool>(index) = val;
}
// public static sbyte setByte(object array, int index, sbyte val) [static] :585
int8_t JavaToUnoArrayEntrypoints::setByte(uObject* array, int index, int8_t val)
{
{
INIT_JNI;
jclass __cls = JniHelper::GetNativeExternClass();
WITH_STATIC_JAVA_METHOD(__mtd, __cls, "setByte", "(Lcom/uno/UnoObject;IB)B");
uObject* _uarray=array;
jobject _array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(_uarray);
int _uindex=index;
jint _index = (jint)_uindex;
int8_t _uval=val;
jbyte _val = (jbyte)_uval;
jbyte __jresult = U_JNIVAR->CallStaticByteMethod(__cls,__mtd,_array,_index,_val);
int8_t __result = (int8_t)__jresult;
if (_array!=NULL) { U_JNIVAR->DeleteLocalRef(_array); }
::g::Android::Base::JNI::CheckException();
return __result;
}
}
// public static sbyte SetByte(object array, int index, sbyte val) [static] :356
int8_t JavaToUnoArrayEntrypoints::SetByte(uObject* array, int index, int8_t val)
{
return uPtr(uCast<uArray*>(array, ::TYPES[4/*sbyte[]*/]))->Item<int8_t>(index) = val;
}
// public static char SetChar(object array, int index, char val) [static] :365
uChar JavaToUnoArrayEntrypoints::SetChar(uObject* array, int index, uChar val)
{
return uPtr(uCast<uArray*>(array, ::TYPES[3/*char[]*/]))->Item<uChar>(index) = val;
}
// public static double setDouble(object array, int index, double val) [static] :627
double JavaToUnoArrayEntrypoints::setDouble(uObject* array, int index, double val)
{
{
INIT_JNI;
jclass __cls = JniHelper::GetNativeExternClass();
WITH_STATIC_JAVA_METHOD(__mtd, __cls, "setDouble", "(Lcom/uno/UnoObject;ID)D");
uObject* _uarray=array;
jobject _array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(_uarray);
int _uindex=index;
jint _index = (jint)_uindex;
double _uval=val;
jdouble _val = (jdouble)_uval;
jdouble __jresult = U_JNIVAR->CallStaticDoubleMethod(__cls,__mtd,_array,_index,_val);
double __result = (double)__jresult;
if (_array!=NULL) { U_JNIVAR->DeleteLocalRef(_array); }
::g::Android::Base::JNI::CheckException();
return __result;
}
}
// public static double SetDouble(object array, int index, double val) [static] :385
double JavaToUnoArrayEntrypoints::SetDouble(uObject* array, int index, double val)
{
return uPtr(uCast<uArray*>(array, ::TYPES[5/*double[]*/]))->Item<double>(index) = val;
}
// public static float setFloat(object array, int index, float val) [static] :621
float JavaToUnoArrayEntrypoints::setFloat(uObject* array, int index, float val)
{
{
INIT_JNI;
jclass __cls = JniHelper::GetNativeExternClass();
WITH_STATIC_JAVA_METHOD(__mtd, __cls, "setFloat", "(Lcom/uno/UnoObject;IF)F");
uObject* _uarray=array;
jobject _array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(_uarray);
int _uindex=index;
jint _index = (jint)_uindex;
float _uval=val;
jfloat _val = (jfloat)_uval;
jfloat __jresult = U_JNIVAR->CallStaticFloatMethod(__cls,__mtd,_array,_index,_val);
float __result = (float)__jresult;
if (_array!=NULL) { U_JNIVAR->DeleteLocalRef(_array); }
::g::Android::Base::JNI::CheckException();
return __result;
}
}
// public static float SetFloat(object array, int index, float val) [static] :381
float JavaToUnoArrayEntrypoints::SetFloat(uObject* array, int index, float val)
{
return uPtr(uCast<uArray*>(array, ::TYPES[6/*float[]*/]))->Item<float>(index) = val;
}
// public static int setInt(object array, int index, int val) [static] :609
int JavaToUnoArrayEntrypoints::setInt(uObject* array, int index, int val)
{
{
INIT_JNI;
jclass __cls = JniHelper::GetNativeExternClass();
WITH_STATIC_JAVA_METHOD(__mtd, __cls, "setInt", "(Lcom/uno/UnoObject;II)I");
uObject* _uarray=array;
jobject _array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(_uarray);
int _uindex=index;
jint _index = (jint)_uindex;
int _uval=val;
jint _val = (jint)_uval;
jint __jresult = U_JNIVAR->CallStaticIntMethod(__cls,__mtd,_array,_index,_val);
int __result = (int)__jresult;
if (_array!=NULL) { U_JNIVAR->DeleteLocalRef(_array); }
::g::Android::Base::JNI::CheckException();
return __result;
}
}
// public static int SetInt(object array, int index, int val) [static] :373
int JavaToUnoArrayEntrypoints::SetInt(uObject* array, int index, int val)
{
return uPtr(uCast<uArray*>(array, ::TYPES[7/*int[]*/]))->Item<int>(index) = val;
}
// public static long setLong(object array, int index, long val) [static] :615
int64_t JavaToUnoArrayEntrypoints::setLong(uObject* array, int index, int64_t val)
{
{
INIT_JNI;
jclass __cls = JniHelper::GetNativeExternClass();
WITH_STATIC_JAVA_METHOD(__mtd, __cls, "setLong", "(Lcom/uno/UnoObject;IJ)J");
uObject* _uarray=array;
jobject _array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(_uarray);
int _uindex=index;
jint _index = (jint)_uindex;
int64_t _uval=val;
jlong _val = (jlong)_uval;
jlong __jresult = U_JNIVAR->CallStaticLongMethod(__cls,__mtd,_array,_index,_val);
int64_t __result = (int64_t)__jresult;
if (_array!=NULL) { U_JNIVAR->DeleteLocalRef(_array); }
::g::Android::Base::JNI::CheckException();
return __result;
}
}
// public static long SetLong(object array, int index, long val) [static] :377
int64_t JavaToUnoArrayEntrypoints::SetLong(uObject* array, int index, int64_t val)
{
return uPtr(uCast<uArray*>(array, ::TYPES[8/*long[]*/]))->Item<int64_t>(index) = val;
}
// public static object setObject(object array, int index, object val) [static] :639
uObject* JavaToUnoArrayEntrypoints::setObject(uObject* array, int index, uObject* val)
{
{
INIT_JNI;
jclass __cls = JniHelper::GetNativeExternClass();
WITH_STATIC_JAVA_METHOD(__mtd, __cls, "setObject", "(Lcom/uno/UnoObject;ILcom/uno/UnoObject;)Lcom/uno/UnoObject;");
uObject* _uarray=array;
jobject _array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(_uarray);
int _uindex=index;
jint _index = (jint)_uindex;
uObject* _uval=val;
jobject _val = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(_uval);
jobject __jresult = U_JNIVAR->CallStaticObjectMethod(__cls,__mtd,_array,_index,_val);
uObject* __result = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::UnBoxFreeingLocalRef(__jresult);
if (_array!=NULL) { U_JNIVAR->DeleteLocalRef(_array); }
if (_val!=NULL) { U_JNIVAR->DeleteLocalRef(_val); }
::g::Android::Base::JNI::CheckException();
return __result;
}
}
// public static object SetObject(object array, int index, object val) [static] :393
uObject* JavaToUnoArrayEntrypoints::SetObject(uObject* array, int index, uObject* val)
{
return uPtr(uCast<uArray*>(array, ::TYPES[9/*object[]*/]))->Strong<uObject*>(index) = val;
}
// public static short setShort(object array, int index, short val) [static] :603
int16_t JavaToUnoArrayEntrypoints::setShort(uObject* array, int index, int16_t val)
{
{
INIT_JNI;
jclass __cls = JniHelper::GetNativeExternClass();
WITH_STATIC_JAVA_METHOD(__mtd, __cls, "setShort", "(Lcom/uno/UnoObject;IS)S");
uObject* _uarray=array;
jobject _array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(_uarray);
int _uindex=index;
jint _index = (jint)_uindex;
int16_t _uval=val;
jshort _val = (jshort)_uval;
jshort __jresult = U_JNIVAR->CallStaticShortMethod(__cls,__mtd,_array,_index,_val);
int16_t __result = (int16_t)__jresult;
if (_array!=NULL) { U_JNIVAR->DeleteLocalRef(_array); }
::g::Android::Base::JNI::CheckException();
return __result;
}
}
// public static short SetShort(object array, int index, short val) [static] :369
int16_t JavaToUnoArrayEntrypoints::SetShort(uObject* array, int index, int16_t val)
{
return uPtr(uCast<uArray*>(array, ::TYPES[10/*short[]*/]))->Item<int16_t>(index) = val;
}
// public static string setString(object array, int index, string val) [static] :633
uString* JavaToUnoArrayEntrypoints::setString(uObject* array, int index, uString* val)
{
{
INIT_JNI;
jclass __cls = JniHelper::GetNativeExternClass();
WITH_STATIC_JAVA_METHOD(__mtd, __cls, "setString", "(Lcom/uno/UnoObject;ILjava/lang/String;)Ljava/lang/String;");
uObject* _uarray=array;
jobject _array = ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::Box6(_uarray);
int _uindex=index;
jint _index = (jint)_uindex;
uString* _uval=val;
jstring _val = JniHelper::UnoToJavaString(_uval);
jobject __jresult = U_JNIVAR->CallStaticObjectMethod(__cls,__mtd,_array,_index,_val);
uString* __result = JniHelper::JavaToUnoString((jstring)__jresult);
if (_array!=NULL) { U_JNIVAR->DeleteLocalRef(_array); }
if (_val!=NULL) { U_JNIVAR->DeleteLocalRef(_val); }
if (__jresult!=NULL && U_JNIVAR->GetObjectRefType(__jresult) == JNILocalRefType) U_JNIVAR->DeleteLocalRef(__jresult);
::g::Android::Base::JNI::CheckException();
return __result;
}
}
// public static string SetString(object array, int index, string val) [static] :389
uString* JavaToUnoArrayEntrypoints::SetString(uObject* array, int index, uString* val)
{
return uPtr(uCast<uArray*>(array, ::TYPES[11/*string[]*/]))->Strong<uString*>(index) = val;
}
// public static sbyte SetUByte(object array, int index, sbyte val) [static] :360
int8_t JavaToUnoArrayEntrypoints::SetUByte(uObject* array, int index, int8_t val)
{
uPtr(uCast<uArray*>(array, ::TYPES[2/*byte[]*/]))->Item<uint8_t>(index) = (uint8_t)val;
return val;
}
// public static long ShortArrayToUnoArrayPtr(Java.Object jarr) [static] :939
int64_t JavaToUnoArrayEntrypoints::ShortArrayToUnoArrayPtr(::g::Java::Object* jarr)
{
jshortArray obj = static_cast<jshortArray>(uPtr(uCast< ::g::Android::Base::Wrappers::JWrapper*>(jarr, ::TYPES[0/*Android.Base.Wrappers.JWrapper*/]))->_GetJavaObject());
JNIEnv* env = ::g::Android::Base::JNI::GetEnvPtr();
int len = (int)env->GetArrayLength(obj);
uArray* arr = uArray::New(::TYPES[10/*short[]*/], len);
env->GetShortArrayRegion(obj, (jsize)0, (jsize)len, (jshort*)arr->_ptr);
uRetain(arr);
return (int64_t)arr;
}
// }
// /Users/kitsco12/Library/Application Support/Fusetools/Packages/UnoCore/1.0.13/source/uno/compiler/exporttargetinterop/foreign/android/$.uno
// -------------------------------------------------------------------------------------------------------------------------------------------
// public static extern class JavaUnoObject :45
// {
static void JavaUnoObject_build(uType* type)
{
::STRINGS[2] = uString::Const("<init>");
::STRINGS[3] = uString::Const("(J)V");
::STRINGS[4] = uString::Const("com/uno/UnoObject");
::STRINGS[5] = uString::Const("_GetRetainedUnoPtr");
::STRINGS[6] = uString::Const("()J");
::STRINGS[7] = uString::Const("com/uno/BoolArray");
::STRINGS[8] = uString::Const("InitFromUnoPtr");
::STRINGS[9] = uString::Const("(J)Lcom/uno/BoolArray;");
::STRINGS[10] = uString::Const("com/uno/ByteArray");
::STRINGS[11] = uString::Const("(JZ)Lcom/uno/ByteArray;");
::STRINGS[12] = uString::Const("com/uno/ShortArray");
::STRINGS[13] = uString::Const("(J)Lcom/uno/ShortArray;");
::STRINGS[14] = uString::Const("com/uno/IntArray");
::STRINGS[15] = uString::Const("(J)Lcom/uno/IntArray;");
::STRINGS[16] = uString::Const("com/uno/LongArray");
::STRINGS[17] = uString::Const("(J)Lcom/uno/LongArray;");
::STRINGS[18] = uString::Const("com/uno/FloatArray");
::STRINGS[19] = uString::Const("(J)Lcom/uno/FloatArray;");
::STRINGS[20] = uString::Const("com/uno/DoubleArray");
::STRINGS[21] = uString::Const("(J)Lcom/uno/DoubleArray;");
::STRINGS[22] = uString::Const("com/uno/StringArray");
::STRINGS[23] = uString::Const("(J)Lcom/uno/StringArray;");
::STRINGS[24] = uString::Const("com/uno/ObjectArray");
::STRINGS[25] = uString::Const("(J)Lcom/uno/ObjectArray;");
::STRINGS[26] = uString::Const("Could not register the finalizer callback for JavaUnoObject");
type->SetFields(0,
::g::Android::Base::Primitives::ujclass_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::_unoBoolArrayClass_, uFieldFlagsStatic,
::g::Android::Base::Primitives::jmethodID_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::_unoBoolArrayFactoryMethod_, uFieldFlagsStatic,
::g::Android::Base::Primitives::ujclass_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::_unoByteArrayClass_, uFieldFlagsStatic,
::g::Android::Base::Primitives::jmethodID_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::_unoByteArrayFactoryMethod_, uFieldFlagsStatic,
::g::Android::Base::Primitives::ujclass_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::_unoDoubleArrayClass_, uFieldFlagsStatic,
::g::Android::Base::Primitives::jmethodID_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::_unoDoubleArrayFactoryMethod_, uFieldFlagsStatic,
::g::Android::Base::Primitives::ujclass_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::_unoFloatArrayClass_, uFieldFlagsStatic,
::g::Android::Base::Primitives::jmethodID_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::_unoFloatArrayFactoryMethod_, uFieldFlagsStatic,
::g::Android::Base::Primitives::ujclass_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::_unoIntArrayClass_, uFieldFlagsStatic,
::g::Android::Base::Primitives::jmethodID_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::_unoIntArrayFactoryMethod_, uFieldFlagsStatic,
::g::Android::Base::Primitives::ujclass_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::_unoLongArrayClass_, uFieldFlagsStatic,
::g::Android::Base::Primitives::jmethodID_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::_unoLongArrayFactoryMethod_, uFieldFlagsStatic,
::g::Android::Base::Primitives::ujclass_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::_unoObjectArrayClass_, uFieldFlagsStatic,
::g::Android::Base::Primitives::jmethodID_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::_unoObjectArrayFactoryMethod_, uFieldFlagsStatic,
::g::Android::Base::Primitives::ujclass_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::_unoObjectClass_, uFieldFlagsStatic,
::g::Android::Base::Primitives::jmethodID_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::_unoObjectConstructor_, uFieldFlagsStatic,
::g::Android::Base::Primitives::jmethodID_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::_unoObjectGetRetainedUnoPtr_, uFieldFlagsStatic,
::g::Android::Base::Primitives::ujclass_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::_unoShortArrayClass_, uFieldFlagsStatic,
::g::Android::Base::Primitives::jmethodID_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::_unoShortArrayFactoryMethod_, uFieldFlagsStatic,
::g::Android::Base::Primitives::ujclass_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::_unoStringArrayClass_, uFieldFlagsStatic,
::g::Android::Base::Primitives::jmethodID_typeof(), (uintptr_t)&::g::Uno::Compiler::ExportTargetInterop::Foreign::Android::JavaUnoObject::_unoStringArrayFactoryMethod_, uFieldFlagsStatic);
}
uClassType* JavaUnoObject_typeof()
{
static uSStrong<uClassType*> type;
if (type != NULL) return type;
uTypeOptions options;
options.FieldCount = 21;
options.TypeSize = sizeof(uClassType);
type = uClassType::New("Uno.Compiler.ExportTargetInterop.Foreign.Android.JavaUnoObject", options);
type->fp_build_ = JavaUnoObject_build;
return type;
}
// public static Android.Base.Primitives.ujobject Box(bool[] unoArray) :156
void JavaUnoObject__Box_fn(uArray* unoArray, jobject* __retval)
{
*__retval = JavaUnoObject::Box(unoArray);
}
// public static Android.Base.Primitives.ujobject Box(byte[] unoArray) :145
void JavaUnoObject__Box1_fn(uArray* unoArray, jobject* __retval)
{
*__retval = JavaUnoObject::Box1(unoArray);
}
// public static Android.Base.Primitives.ujobject Box(double[] unoArray) :211
void JavaUnoObject__Box2_fn(uArray* unoArray, jobject* __retval)
{
*__retval = JavaUnoObject::Box2(unoArray);
}
// public static Android.Base.Primitives.ujobject Box(float[] unoArray) :200
void JavaUnoObject__Box3_fn(uArray* unoArray, jobject* __retval)
{
*__retval = JavaUnoObject::Box3(unoArray);
}
// public static Android.Base.Primitives.ujobject Box(int[] unoArray) :178
void JavaUnoObject__Box4_fn(uArray* unoArray, jobject* __retval)
{
*__retval = JavaUnoObject::Box4(unoArray);
}
// public static Android.Base.Primitives.ujobject Box(long[] unoArray) :189
void JavaUnoObject__Box5_fn(uArray* unoArray, jobject* __retval)
{
*__retval = JavaUnoObject::Box5(unoArray);
}
// public static Android.Base.Primitives.ujobject Box(object unoObject) :123
void JavaUnoObject__Box6_fn(uObject* unoObject, jobject* __retval)
{
*__retval = JavaUnoObject::Box6(unoObject);
}
// public static Android.Base.Primitives.ujobject Box(object[] unoArray) :233
void JavaUnoObject__Box7_fn(uArray* unoArray, jobject* __retval)
{
*__retval = JavaUnoObject::Box7(unoArray);
}
// public static Android.Base.Primitives.ujobject Box(sbyte[] unoArray) :134
void JavaUnoObject__Box8_fn(uArray* unoArray, jobject* __retval)
{
*__retval = JavaUnoObject::Box8(unoArray);
}
// public static Android.Base.Primitives.ujobject Box(short[] unoArray) :167
void JavaUnoObject__Box9_fn(uArray* unoArray, jobject* __retval)
{
*__retval = JavaUnoObject::Box9(unoArray);
}
// public static Android.Base.Primitives.ujobject Box(string[] unoArray) :222
void JavaUnoObject__Box10_fn(uArray* unoArray, jobject* __retval)
{
*__retval = JavaUnoObject::Box10(unoArray);
}
// public static Android.Base.Primitives.ujobject BoxDelegate(object delegateObj, Android.Base.Primitives.ConstCharPtr javaClassName) :244
void JavaUnoObject__BoxDelegate_fn(uObject* delegateObj, const char** javaClassName, jobject* __retval)
{
*__retval = JavaUnoObject::BoxDelegate(delegateObj, *javaClassName);
}
// private static void EnsureInitialized() :78
void JavaUnoObject__EnsureInitialized_fn()
{
JavaUnoObject::EnsureInitialized();
}
// public static object UnBox(Android.Base.Primitives.ujobject javaObject) :261
void JavaUnoObject__UnBox_fn(jobject* javaObject, uObject** __retval)
{
*__retval = JavaUnoObject::UnBox(*javaObject);
}
// public static object UnBoxFreeingLocalRef(Android.Base.Primitives.ujobject javaObject) :269
void JavaUnoObject__UnBoxFreeingLocalRef_fn(jobject* javaObject, uObject** __retval)
{
*__retval = JavaUnoObject::UnBoxFreeingLocalRef(*javaObject);
}
jclass JavaUnoObject::_unoBoolArrayClass_;
jmethodID JavaUnoObject::_unoBoolArrayFactoryMethod_;
jclass JavaUnoObject::_unoByteArrayClass_;
jmethodID JavaUnoObject::_unoByteArrayFactoryMethod_;
jclass JavaUnoObject::_unoDoubleArrayClass_;
jmethodID JavaUnoObject::_unoDoubleArrayFactoryMethod_;
jclass JavaUnoObject::_unoFloatArrayClass_;
jmethodID JavaUnoObject::_unoFloatArrayFactoryMethod_;
jclass JavaUnoObject::_unoIntArrayClass_;
jmethodID JavaUnoObject::_unoIntArrayFactoryMethod_;
jclass JavaUnoObject::_unoLongArrayClass_;
jmethodID JavaUnoObject::_unoLongArrayFactoryMethod_;
jclass JavaUnoObject::_unoObjectArrayClass_;
jmethodID JavaUnoObject::_unoObjectArrayFactoryMethod_;
jclass JavaUnoObject::_unoObjectClass_;
jmethodID JavaUnoObject::_unoObjectConstructor_;
jmethodID JavaUnoObject::_unoObjectGetRetainedUnoPtr_;
jclass JavaUnoObject::_unoShortArrayClass_;
jmethodID JavaUnoObject::_unoShortArrayFactoryMethod_;
jclass JavaUnoObject::_unoStringArrayClass_;
jmethodID JavaUnoObject::_unoStringArrayFactoryMethod_;
// public static Android.Base.Primitives.ujobject Box(bool[] unoArray) [static] :156
jobject JavaUnoObject::Box(uArray* unoArray)
{
if (unoArray == NULL)
return ::g::Android::Base::Primitives::ujobject::Null();
JavaUnoObject::EnsureInitialized();
uRetain(unoArray);
int64_t longPtr = (int64_t)unoArray;
jobject boxed = ::g::Android::Base::JNI::GetEnvPtr()->CallStaticObjectMethod(JavaUnoObject::_unoBoolArrayClass_,JavaUnoObject::_unoBoolArrayFactoryMethod_,longPtr);
::g::Android::Base::JNI::CheckException();
return boxed;
}
// public static Android.Base.Primitives.ujobject Box(byte[] unoArray) [static] :145
jobject JavaUnoObject::Box1(uArray* unoArray)
{
if (unoArray == NULL)
return ::g::Android::Base::Primitives::ujobject::Null();
JavaUnoObject::EnsureInitialized();
uRetain(unoArray);
int64_t longPtr = (int64_t)unoArray;
jobject boxed = ::g::Android::Base::JNI::GetEnvPtr()->CallStaticObjectMethod(JavaUnoObject::_unoByteArrayClass_,JavaUnoObject::_unoByteArrayFactoryMethod_,longPtr,true);
::g::Android::Base::JNI::CheckException();
return boxed;
}
// public static Android.Base.Primitives.ujobject Box(double[] unoArray) [static] :211
jobject JavaUnoObject::Box2(uArray* unoArray)
{
if (unoArray == NULL)
return ::g::Android::Base::Primitives::ujobject::Null();
JavaUnoObject::EnsureInitialized();
uRetain(unoArray);
int64_t longPtr = (int64_t)unoArray;
jobject boxed = ::g::Android::Base::JNI::GetEnvPtr()->CallStaticObjectMethod(JavaUnoObject::_unoDoubleArrayClass_,JavaUnoObject::_unoDoubleArrayFactoryMethod_,longPtr);
::g::Android::Base::JNI::CheckException();
return boxed;
}
// public static Android.Base.Primitives.ujobject Box(float[] unoArray) [static] :200
jobject JavaUnoObject::Box3(uArray* unoArray)
{
if (unoArray == NULL)
return ::g::Android::Base::Primitives::ujobject::Null();
JavaUnoObject::EnsureInitialized();
uRetain(unoArray);
int64_t longPtr = (int64_t)unoArray;
jobject boxed = ::g::Android::Base::JNI::GetEnvPtr()->CallStaticObjectMethod(JavaUnoObject::_unoFloatArrayClass_,JavaUnoObject::_unoFloatArrayFactoryMethod_,longPtr);
::g::Android::Base::JNI::CheckException();
return boxed;
}
// public static Android.Base.Primitives.ujobject Box(int[] unoArray) [static] :178
jobject JavaUnoObject::Box4(uArray* unoArray)
{
if (unoArray == NULL)
return ::g::Android::Base::Primitives::ujobject::Null();
JavaUnoObject::EnsureInitialized();
uRetain(unoArray);
int64_t longPtr = (int64_t)unoArray;
jobject boxed = ::g::Android::Base::JNI::GetEnvPtr()->CallStaticObjectMethod(JavaUnoObject::_unoIntArrayClass_,JavaUnoObject::_unoIntArrayFactoryMethod_,longPtr);
::g::Android::Base::JNI::CheckException();
return boxed;
}
// public static Android.Base.Primitives.ujobject Box(long[] unoArray) [static] :189
jobject JavaUnoObject::Box5(uArray* unoArray)
{
if (unoArray == NULL)
return ::g::Android::Base::Primitives::ujobject::Null();
JavaUnoObject::EnsureInitialized();
uRetain(unoArray);
int64_t longPtr = (int64_t)unoArray;
jobject boxed = ::g::Android::Base::JNI::GetEnvPtr()->CallStaticObjectMethod(JavaUnoObject::_unoLongArrayClass_,JavaUnoObject::_unoLongArrayFactoryMethod_,longPtr);
::g::Android::Base::JNI::CheckException();
return boxed;
}
// public static Android.Base.Primitives.ujobject Box(object unoObject) [static] :123
jobject JavaUnoObject::Box6(uObject* unoObject)
{
if (unoObject == NULL)
return ::g::Android::Base::Primitives::ujobject::Null();
JavaUnoObject::EnsureInitialized();
uRetain(unoObject);
int64_t longPtr = (int64_t)unoObject;
jobject boxed = ::g::Android::Base::JNI::GetEnvPtr()->NewObject(JavaUnoObject::_unoObjectClass_,JavaUnoObject::_unoObjectConstructor_,longPtr);
::g::Android::Base::JNI::CheckException();
return boxed;
}
// public static Android.Base.Primitives.ujobject Box(object[] unoArray) [static] :233
jobject JavaUnoObject::Box7(uArray* unoArray)
{
if (unoArray == NULL)
return ::g::Android::Base::Primitives::ujobject::Null();
JavaUnoObject::EnsureInitialized();
uRetain(unoArray);
int64_t longPtr = (int64_t)unoArray;
jobject boxed = ::g::Android::Base::JNI::GetEnvPtr()->CallStaticObjectMethod(JavaUnoObject::_unoObjectArrayClass_,JavaUnoObject::_unoObjectArrayFactoryMethod_,longPtr);
::g::Android::Base::JNI::CheckException();
return boxed;
}
// public static Android.Base.Primitives.ujobject Box(sbyte[] unoArray) [static] :134
jobject JavaUnoObject::Box8(uArray* unoArray)
{
if (unoArray == NULL)
return ::g::Android::Base::Primitives::ujobject::Null();
JavaUnoObject::EnsureInitialized();
uRetain(unoArray);
int64_t longPtr = (int64_t)unoArray;
jobject boxed = ::g::Android::Base::JNI::GetEnvPtr()->CallStaticObjectMethod(JavaUnoObject::_unoByteArrayClass_,JavaUnoObject::_unoByteArrayFactoryMethod_,longPtr,false);
::g::Android::Base::JNI::CheckException();
return boxed;
}
// public static Android.Base.Primitives.ujobject Box(short[] unoArray) [static] :167
jobject JavaUnoObject::Box9(uArray* unoArray)
{
if (unoArray == NULL)
return ::g::Android::Base::Primitives::ujobject::Null();
JavaUnoObject::EnsureInitialized();
uRetain(unoArray);
int64_t longPtr = (int64_t)unoArray;
jobject boxed = ::g::Android::Base::JNI::GetEnvPtr()->CallStaticObjectMethod(JavaUnoObject::_unoShortArrayClass_,JavaUnoObject::_unoShortArrayFactoryMethod_,longPtr);
::g::Android::Base::JNI::CheckException();
return boxed;
}
// public static Android.Base.Primitives.ujobject Box(string[] unoArray) [static] :222
jobject JavaUnoObject::Box10(uArray* unoArray)
{
if (unoArray == NULL)
return ::g::Android::Base::Primitives::ujobject::Null();
JavaUnoObject::EnsureInitialized();
uRetain(unoArray);
int64_t longPtr = (int64_t)unoArray;
jobject boxed = ::g::Android::Base::JNI::GetEnvPtr()->CallStaticObjectMethod(JavaUnoObject::_unoStringArrayClass_,JavaUnoObject::_unoStringArrayFactoryMethod_,longPtr);
::g::Android::Base::JNI::CheckException();
return boxed;
}
// public static Android.Base.Primitives.ujobject BoxDelegate(object delegateObj, Android.Base.Primitives.ConstCharPtr javaClassName) [static] :244
jobject JavaUnoObject::BoxDelegate(uObject* delegateObj, const char* javaClassName)
{
if (delegateObj == NULL)
return ::g::Android::Base::Primitives::ujobject::Null();
JavaUnoObject::EnsureInitialized();
jclass delegateJavaClass = ::g::Android::Base::JNI::LoadClass(::g::Android::Base::JNI::GetEnvPtr(), javaClassName);
jmethodID constructor = ::g::Android::Base::JNI::GetMethodID(JavaUnoObject::_unoObjectArrayClass_, ::STRINGS[2/*"<init>"*/], ::STRINGS[3/*"(J)V"*/]);
uRetain(delegateObj);
int64_t longPtr = (int64_t)delegateObj;
jobject boxed = ::g::Android::Base::JNI::GetEnvPtr()->NewObject(delegateJavaClass,constructor,longPtr);
::g::Android::Base::JNI::DeleteLocalRef(delegateJavaClass);
::g::Android::Base::JNI::CheckException();
return boxed;
}
// private static void EnsureInitialized() [static] :78
void JavaUnoObject::EnsureInitialized()
{
if (uEnterCriticalIfNull(&JavaUnoObject::_unoObjectClass_))
{
JavaUnoObject::_unoObjectClass_ = ::g::Android::Base::JNI::NewGlobalRef(::g::Android::Base::JNI::LoadClass3(::STRINGS[4/*"com/uno/Uno...*/], false));
JavaUnoObject::_unoObjectConstructor_ = ::g::Android::Base::JNI::GetMethodID(JavaUnoObject::_unoObjectClass_, ::STRINGS[2/*"<init>"*/], ::STRINGS[3/*"(J)V"*/]);
JavaUnoObject::_unoObjectGetRetainedUnoPtr_ = ::g::Android::Base::JNI::GetMethodID(JavaUnoObject::_unoObjectClass_, ::STRINGS[5/*"_GetRetaine...*/], ::STRINGS[6/*"()J"*/]);
JavaUnoObject::_unoBoolArrayClass_ = ::g::Android::Base::JNI::NewGlobalRef(::g::Android::Base::JNI::LoadClass3(::STRINGS[7/*"com/uno/Boo...*/], false));
JavaUnoObject::_unoBoolArrayFactoryMethod_ = ::g::Android::Base::JNI::GetStaticMethodID(JavaUnoObject::_unoBoolArrayClass_, ::STRINGS[8/*"InitFromUno...*/], ::STRINGS[9/*"(J)Lcom/uno...*/]);
JavaUnoObject::_unoByteArrayClass_ = ::g::Android::Base::JNI::NewGlobalRef(::g::Android::Base::JNI::LoadClass3(::STRINGS[10/*"com/uno/Byt...*/], false));
JavaUnoObject::_unoByteArrayFactoryMethod_ = ::g::Android::Base::JNI::GetStaticMethodID(JavaUnoObject::_unoByteArrayClass_, ::STRINGS[8/*"InitFromUno...*/], ::STRINGS[11/*"(JZ)Lcom/un...*/]);
JavaUnoObject::_unoShortArrayClass_ = ::g::Android::Base::JNI::NewGlobalRef(::g::Android::Base::JNI::LoadClass3(::STRINGS[12/*"com/uno/Sho...*/], false));
JavaUnoObject::_unoShortArrayFactoryMethod_ = ::g::Android::Base::JNI::GetStaticMethodID(JavaUnoObject::_unoShortArrayClass_, ::STRINGS[8/*"InitFromUno...*/], ::STRINGS[13/*"(J)Lcom/uno...*/]);
JavaUnoObject::_unoIntArrayClass_ = ::g::Android::Base::JNI::NewGlobalRef(::g::Android::Base::JNI::LoadClass3(::STRINGS[14/*"com/uno/Int...*/], false));
JavaUnoObject::_unoIntArrayFactoryMethod_ = ::g::Android::Base::JNI::GetStaticMethodID(JavaUnoObject::_unoIntArrayClass_, ::STRINGS[8/*"InitFromUno...*/], ::STRINGS[15/*"(J)Lcom/uno...*/]);
JavaUnoObject::_unoLongArrayClass_ = ::g::Android::Base::JNI::NewGlobalRef(::g::Android::Base::JNI::LoadClass3(::STRINGS[16/*"com/uno/Lon...*/], false));
JavaUnoObject::_unoLongArrayFactoryMethod_ = ::g::Android::Base::JNI::GetStaticMethodID(JavaUnoObject::_unoLongArrayClass_, ::STRINGS[8/*"InitFromUno...*/], ::STRINGS[17/*"(J)Lcom/uno...*/]);
JavaUnoObject::_unoFloatArrayClass_ = ::g::Android::Base::JNI::NewGlobalRef(::g::Android::Base::JNI::LoadClass3(::STRINGS[18/*"com/uno/Flo...*/], false));
JavaUnoObject::_unoFloatArrayFactoryMethod_ = ::g::Android::Base::JNI::GetStaticMethodID(JavaUnoObject::_unoFloatArrayClass_, ::STRINGS[8/*"InitFromUno...*/], ::STRINGS[19/*"(J)Lcom/uno...*/]);
JavaUnoObject::_unoDoubleArrayClass_ = ::g::Android::Base::JNI::NewGlobalRef(::g::Android::Base::JNI::LoadClass3(::STRINGS[20/*"com/uno/Dou...*/], false));
JavaUnoObject::_unoDoubleArrayFactoryMethod_ = ::g::Android::Base::JNI::GetStaticMethodID(JavaUnoObject::_unoDoubleArrayClass_, ::STRINGS[8/*"InitFromUno...*/], ::STRINGS[21/*"(J)Lcom/uno...*/]);
JavaUnoObject::_unoStringArrayClass_ = ::g::Android::Base::JNI::NewGlobalRef(::g::Android::Base::JNI::LoadClass3(::STRINGS[22/*"com/uno/Str...*/], false));
JavaUnoObject::_unoStringArrayFactoryMethod_ = ::g::Android::Base::JNI::GetStaticMethodID(JavaUnoObject::_unoStringArrayClass_, ::STRINGS[8/*"InitFromUno...*/], ::STRINGS[23/*"(J)Lcom/uno...*/]);
JavaUnoObject::_unoObjectArrayClass_ = ::g::Android::Base::JNI::NewGlobalRef(::g::Android::Base::JNI::LoadClass3(::STRINGS[24/*"com/uno/Obj...*/], false));
JavaUnoObject::_unoObjectArrayFactoryMethod_ = ::g::Android::Base::JNI::GetStaticMethodID(JavaUnoObject::_unoObjectArrayClass_, ::STRINGS[8/*"InitFromUno...*/], ::STRINGS[25/*"(J)Lcom/uno...*/]);
JNINativeMethod nativeFunc = {(char* const)"Finalize", (char* const)"(J)V", (void *)&__JavaUnoObject_Finalizer};
int attached = ::g::Android::Base::JNI::GetEnvPtr()->RegisterNatives(JavaUnoObject::_unoObjectClass_, &nativeFunc, 1);
if (attached < 0)
U_THROW(::g::Uno::Exception::New2(::STRINGS[26/*"Could not r...*/]));
uExitCritical();;
}
}
// public static object UnBox(Android.Base.Primitives.ujobject javaObject) [static] :261
uObject* JavaUnoObject::UnBox(jobject javaObject)
{
if (::g::Android::Base::JNI::IsSameObject(javaObject, ::g::Android::Base::Primitives::ujobject::Null()))
return NULL;
int64_t longPtr = (int64_t)::g::Android::Base::JNI::GetEnvPtr()->CallLongMethod(javaObject,JavaUnoObject::_unoObjectGetRetainedUnoPtr_);
::g::Android::Base::JNI::CheckException();
return (uObject*)longPtr;
}
// public static object UnBoxFreeingLocalRef(Android.Base.Primitives.ujobject javaObject) [static] :269
uObject* JavaUnoObject::UnBoxFreeingLocalRef(jobject javaObject)
{
if (::g::Android::Base::JNI::IsSameObject(javaObject, ::g::Android::Base::Primitives::ujobject::Null()))
return NULL;
int64_t longPtr = (int64_t)::g::Android::Base::JNI::GetEnvPtr()->CallLongMethod(javaObject,JavaUnoObject::_unoObjectGetRetainedUnoPtr_);
::g::Android::Base::JNI::CheckException();
if (::g::Android::Base::JNI::GetRefType1(javaObject) == 1)
::g::Android::Base::JNI::DeleteLocalRef1(javaObject);
return (uObject*)longPtr;
}
// }
}}}}}} // ::g::Uno::Compiler::ExportTargetInterop::Foreign::Android
| [
"scott.kvitberg@gmail.com"
] | scott.kvitberg@gmail.com |
f09e0fd583cfdafcb49dc5afc47eb9a66db823d1 | 5f02aa5e3449c9d3002c8a248b67e965d377cedf | /Source-32-Bit/Page200.h | d03167bc8aa44bd7928b66bb582a16d5dbc003c5 | [] | no_license | YYGYYGyy/LSPC-Loading-Simulation-Program | bb94fe04d4b620d6afd30b9d40eb582b84283a0b | 2f846c6719088642178a636ed3ae7630d8df9afd | refs/heads/master | 2021-09-24T04:46:44.649224 | 2018-03-07T19:05:35 | 2018-03-07T19:05:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 629 | h | // Page200.h: interface for the CPage200 class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_Page200_H__F8E4F306_EE09_11D3_B2F2_00104B9CFF37__INCLUDED_)
#define AFX_Page200_H__F8E4F306_EE09_11D3_B2F2_00104B9CFF37__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "PageAdd.h"
class CPage200 : public CPageAdd
{
public:
CPage200();
CPage200(UINT nIDCap);
virtual ~CPage200();
virtual void InitGrid();
virtual BOOL UpdateData( BOOL bSaveAndValidate = TRUE );
};
#endif // !defined(AFX_Page200_H__F8E4F306_EE09_11D3_B2F2_00104B9CFF37__INCLUDED_)
| [
"tim@twool.com"
] | tim@twool.com |
bc83b6bbf2c3ce0648b940a2470f535835c3fb5b | 4f01bcde69831f8312c88dae20ea841303c991ce | /06. Classes and Objects/demo/02.Enumerations.cpp | a88177f15411d921bd039b5d7c2fe96b288546f7 | [] | no_license | Kristiyan93/Cpp-Fundamentals | efc063630045e952a03f086f2984332fd67b10f6 | 4c250b0917007a8512fa00f6e9605e9a64bedc77 | refs/heads/master | 2020-05-16T10:27:05.676035 | 2019-04-23T09:56:51 | 2019-04-23T09:56:51 | 182,985,872 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 603 | cpp | #include<iostream>
using namespace std;
int main() {
enum planets
{
earth = 3,
mars,
jupiter,
saturn,
uranus,
neptune
};
// We can do math on this enum, because it is just const int underneath
cout << "earth (" << earth << ") is "
<< uranus - earth << " planets away from "
<< "uranus (" << uranus << ")" << endl;
enum class Planets
{
earth = 3,
mars,
jupiter,
saturn,
uranus,
neptune
};
return 0;
}
| [
"kristiyan93@outlook.com"
] | kristiyan93@outlook.com |
67305d9dcc70af38b07a35c249a56fb79f889b5c | fb37334b43dabe0f1b12aa55538ec7c4684c6e6a | /src/PeoplePrefView.cpp | 8b7547654d094f05bafbf2a186d4db604da5a392 | [
"BSD-2-Clause"
] | permissive | HaikuArchives/DeeperPeople | 1ef1627744e06b13b47c7431290e92e66b8e4277 | f6326e48920d0e9732871e50d2126d72afe35ae5 | refs/heads/master | 2020-12-25T10:49:32.967497 | 2018-11-12T03:46:56 | 2018-11-12T03:46:56 | 64,023,025 | 1 | 3 | NOASSERTION | 2018-11-12T03:46:57 | 2016-07-23T15:41:39 | C++ | UTF-8 | C++ | false | false | 5,906 | cpp | //--------------------------------------------------------------------
//
// PeopleView.cpp
//
// Written by: Robert Polic
// Extended by: Olivier Cortes
//
//--------------------------------------------------------------------
/*
Copyright 1999, Be Incorporated. All Rights Reserved.
This file may be used under the terms of the Be Sample Code License.
*/
#include <fs_attr.h>
#include <Window.h>
#include <Box.h>
#include <MenuField.h>
#include <MenuItem.h>
#include <PopUpMenu.h>
#include <Query.h>
#include <VolumeRoster.h>
#include <malloc.h>
#include <string.h>
#include <stdio.h>
#include <image.h>
#include <OS.h>
#include <stdlib.h>
#include <OutlineListView.h>
#include "PeoplePrefView.h"
#include "TTextControl.h"
//====================================================================
TPeoplePrefView::TPeoplePrefView(BRect rect, char *title, entry_ref *ref)
:BTabView(rect, title, B_WIDTH_AS_USUAL, B_FOLLOW_ALL, B_WILL_DRAW)
{
if (ref)
fFile = new BFile(ref, O_RDWR);
else
fFile = NULL;
}
//--------------------------------------------------------------------
TPeoplePrefView::~TPeoplePrefView(void)
{
if (fFile)
delete fFile;
}
//--------------------------------------------------------------------
void TPeoplePrefView::AttachedToWindow(void)
{
char *text;
float offset;
BFont font = *be_plain_font;
BFont ufont = *be_plain_font;
BMenuField *field;
BRect r,rb;
rgb_color c;
attr_info info;
ufont.SetFace(B_UNDERSCORE_FACE);
ufont.SetSpacing(B_FIXED_SPACING);
c.red = c.green = c.blue = VIEW_COLOR;
SetViewColor(c);
r = Bounds();
r.InsetBy(-1, -1);
rb = r;
offset = font.StringWidth(LARGEST_GENERAL_TEXT) + 18;
////////////////////////////////////
// general stuff
BView *v = new BView(rb, "0", B_FOLLOW_ALL, B_WILL_DRAW);
v->SetViewColor(c);
text = (char *)malloc(1);
text[0] = 0;
AddTab(v);
TabAt(0)->SetLabel("PREFERENCES");
free(text);
// final focus ! at last !
// selecting tab1 then tab0 is awful, but if i don't do that, the first tab
// never draws ! i must switch manually to make its fielfs appear !
Select(1);
Select(0);
}
//--------------------------------------------------------------------
void TPeoplePrefView::MessageReceived(BMessage* msg)
{
int32 loop;
BTextView *text;
char *buff;
char **arg_v;
int32 arg_c = 2;
thread_id t;
extern char **environ;
switch (msg->what) {
case M_SAVE:
Save();
break;
case M_REVERT:
for (loop = 0; loop < F_END; loop++)
fField[loop]->Revert();
break;
}
}
//--------------------------------------------------------------------
void TPeoplePrefView::BuildGroupMenu(void)
{
char *offset;
char str[256];
char *text;
char *text1;
int32 count = 0;
int32 index;
BEntry entry;
BFile file;
BMessage *msg;
BMenuItem *item;
BQuery query;
BVolume vol;
BVolumeRoster volume;
attr_info info;
while ((item = fGroups->ItemAt(0))) {
fGroups->RemoveItem(item);
delete item;
}
volume.GetBootVolume(&vol);
query.SetVolume(&vol);
sprintf(str, "%s=*", P_GROUPNAME);
query.SetPredicate(str);
query.Fetch();
while (query.GetNextEntry(&entry) == B_NO_ERROR) {
file.SetTo(&entry, O_RDONLY);
if ((file.InitCheck() == B_NO_ERROR) &&
(file.GetAttrInfo(P_GROUPNAME, &info) == B_NO_ERROR) &&
(info.size > 1)) {
text = (char *)malloc(info.size);
text1 = text;
file.ReadAttr(P_GROUPNAME, B_STRING_TYPE, 0, text, info.size);
while (1) {
if ((offset = strstr(text, ",")))
*offset = 0;
if (!fGroups->FindItem(text)) {
index = 0;
while ((item = fGroups->ItemAt(index))) {
if (strcmp(text, item->Label()) < 0)
break;
index++;
}
msg = new BMessage(M_GROUP_MENU);
msg->AddString("group", text);
fGroups->AddItem(new BMenuItem(text, msg), index);
count++;
}
if (offset) {
text = offset + 1;
while (*text == ' ')
text++;
}
else
break;
}
free(text1);
}
}
if (!count) {
fGroups->AddItem(item = new BMenuItem(VIEW_GROUP_NONE, new BMessage(M_GROUP_MENU)));
item->SetEnabled(FALSE);
}
}
//--------------------------------------------------------------------
bool TPeoplePrefView::CheckSave(void)
{
int32 loop;
for (loop = 0; loop < F_END; loop++)
if (fField[loop]->Changed())
return TRUE;
return FALSE;
}
//--------------------------------------------------------------------
const char* TPeoplePrefView::GetField(int32 index)
{
if (index < F_END)
return fField[index]->Text();
else
return NULL;
}
//--------------------------------------------------------------------
void TPeoplePrefView::NewFile(entry_ref *ref)
{
if (fFile)
delete fFile;
fFile = new BFile(ref, O_RDWR);
Save();
}
//--------------------------------------------------------------------
void TPeoplePrefView::Save(void)
{
}
//--------------------------------------------------------------------
void TPeoplePrefView::SetField(int32 index, char *data, bool update)
{
int32 end;
int32 start;
BTextView *text;
Window()->Lock();
if (update) {
fField[index]->SetText(data);
fField[index]->Update();
}
else {
text = (BTextView *)fField[index]->ChildAt(0);
text->GetSelection(&start, &end);
if (start != end) {
text->Delete();
text->Insert(data);
}
else if ((end = text->TextLength())) {
text->Select(end, end);
text->Insert(",");
text->Insert(data);
text->Select(text->TextLength(), text->TextLength());
}
else
fField[index]->SetText(data);
}
Window()->Unlock();
}
//--------------------------------------------------------------------
bool TPeoplePrefView::TextSelected(void)
{
int32 end;
int32 loop;
int32 start;
BTextView *text;
for (loop = 0; loop < F_END; loop++) {
text = (BTextView *)fField[loop]->ChildAt(0);
text->GetSelection(&start, &end);
if (start != end)
return TRUE;
}
return FALSE;
} | [
"waddlesplash@gmail.com"
] | waddlesplash@gmail.com |
ea32debcafa2f0fd4566915bd0f0c7410056dfbe | d2f967e5d9e3f79bd428b43b22dc305173c68e3b | /PERSONEL/prs_personel_kesinti_ekleme_fisi.cpp | 638bf0b52332f94287c134a61b73d2915205146f | [] | no_license | adakteknoloji/E9 | 44886f1799b72ee98293245b23a87a53914be62e | 41ed314ae97482de6716d5d4b2e6b521ac11e528 | refs/heads/master | 2021-01-01T17:57:03.914973 | 2014-04-11T11:26:12 | 2014-04-11T11:26:12 | 4,817,418 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 33,961 | cpp | #include "prs_personel_kesinti_ekleme_fisi_class.h"
#include "prs_personel_kesinti_ekleme_fisi_open.h"
#include "prs_enum.h"
#include "prs_con_utils.h"
#include "prs_gui_utils.h"
#include "e9_log.h"
#include "sube_console_utils.h"
#include "cari_console_utils.h"
#include "cari_kart_arama_open.h"
#include "cari_struct.h"
extern ADAK_SQL * DB;
#define ROW_ID_COLUMN 0
#define RECORD_ID_COLUMN 1
#define ORDER_COLUMN 2
#define BORDRO_DONEMI_AY_COLUMN 3
#define BORDRO_DONEMI_YIL_COLUMN 4
#define KESINTI_ADI_COLUMN 5
#define KESINTI_YUZDE_MI_COLUMN 6
#define YUZDE_COLUMN 7
#define TUTAR_COLUMN 8
#define ACIKLAMA_COLUMN 9
/**************************************************************************************
SHOW_PRS_PERSONEL_KESINTI_EKLEME_FISI
***************************************************************************************/
void SHOW_PRS_PERSONEL_KESINTI_EKLEME_FISI( int who_called, int record_id , QWidget * parent )
{
PRS_PERSONEL_KESINTI_EKLEME_FISI * F = new PRS_PERSONEL_KESINTI_EKLEME_FISI( who_called, record_id, parent);
F->SHOW( NOT_FULL_SCREEN );
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::PRS_PERSONEL_KESINTI_EKLEME_FISI
***************************************************************************************/
PRS_PERSONEL_KESINTI_EKLEME_FISI::PRS_PERSONEL_KESINTI_EKLEME_FISI(int who_called, int record_id, QWidget * parent) :FIS_KERNEL(parent)
{
m_who_called = who_called;
m_record_id = record_id;
setupUi ( this );
START_FIS_KERNEL ( this, DB );
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::SETUP_FORM
**************************************************************************************/
void PRS_PERSONEL_KESINTI_EKLEME_FISI::SETUP_FORM()
{
SET_HELP_PAGE ( "personel-bordrosu_ek-kesinti-tanimlama" );
SET_PAGE_TITLE ( tr( "PRS - EK KESİNTİ EKLEME" ) );
int num_of_columns = 10;
if ( m_who_called EQ PRS_PERSONEL_SICIL_KARTI ) {
SET_SINGLE_RECORD_ID (m_record_id);
}
REGISTER_BUTTONS_WIDGET ( navigation_button_widget);
REGISTER_TABLE_WIDGET ( table_widget_kesinti_satirlari, num_of_columns );
SET_FORM_ID_COLUMN_POSITION ( RECORD_ID_COLUMN );
SET_FIS_ORDER_COLUMN_NUMBER ( ORDER_COLUMN );
SET_ROW_ID_COLUMN_POSITION ( ROW_ID_COLUMN );
SET_NUMBER_OF_HIDDEN_COLUMN ( 3 );
SET_WIDGETS_MAXIMUM_SIZE () ;
SET_FIS_ORDER_DATABASE ( "prs_ek_kesintiler_odenekler", "order_number", "kesinti_odenek_id" );
SET_TABLE_ROW_WIDGETS ( BORDRO_DONEMI_AY_COLUMN, WIDGET_COMBO_BOX );
SET_TABLE_ROW_WIDGETS ( BORDRO_DONEMI_YIL_COLUMN, WIDGET_COMBO_BOX );
SET_TABLE_ROW_WIDGETS ( KESINTI_ADI_COLUMN, WIDGET_LINE_EDIT );
SET_TABLE_ROW_WIDGETS ( KESINTI_YUZDE_MI_COLUMN, WIDGET_COMBO_BOX);
SET_TABLE_ROW_WIDGETS ( YUZDE_COLUMN, WIDGET_COMMA_EDIT);
SET_TABLE_ROW_WIDGETS ( TUTAR_COLUMN, WIDGET_COMMA_EDIT );
SET_TABLE_ROW_WIDGETS ( ACIKLAMA_COLUMN, WIDGET_LINE_EDIT );
table_widget_kesinti_satirlari->setHorizontalHeaderLabels(QStringList()<<"id"<<"record_id"<<"satir_order"
<<tr("Bordro Dönemi Ay") <<tr("Bordro Dönemi Yıl")
<<tr("Kesinti Adı")
<<tr("Yüzde Mi")<<tr("Yüzde")<<tr("Tutar")
<<tr("Açıklama")<<tr("")<<tr("") );
table_widget_kesinti_satirlari->setColumnWidth ( BORDRO_DONEMI_AY_COLUMN , 150 );
table_widget_kesinti_satirlari->setColumnWidth ( BORDRO_DONEMI_YIL_COLUMN , 150 );
table_widget_kesinti_satirlari->setColumnWidth ( KESINTI_ADI_COLUMN , 150 );
table_widget_kesinti_satirlari->setColumnWidth ( KESINTI_YUZDE_MI_COLUMN , 80 );
table_widget_kesinti_satirlari->setColumnWidth ( YUZDE_COLUMN , 80 );
table_widget_kesinti_satirlari->setColumnWidth ( TUTAR_COLUMN , 80 );
table_widget_kesinti_satirlari->setColumnWidth ( ACIKLAMA_COLUMN , 200 );
SET_SETTING_NAME ( "PRS_PERSONEL_KESINTI_EKLEME_FISI" );
SET_FIRST_FOCUS_WIDGET ( table_widget_kesinti_satirlari );
FOCUS_FIRST_WIDGET();
line_edit_personel_sicil_no->setReadOnly(true);
line_edit_personel_adi_soyadi->setReadOnly(true);
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::CLEAR_FORM_MEMBERS
***************************************************************************************/
void PRS_PERSONEL_KESINTI_EKLEME_FISI::CLEAR_FORM_MEMBERS()
{
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::NEW_FIS_RECORD
**************************************************************************************/
void PRS_PERSONEL_KESINTI_EKLEME_FISI::NEW_FIS_RECORD()
{
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::GET_FIS_RECORD
***************************************************************************************/
int PRS_PERSONEL_KESINTI_EKLEME_FISI::GET_FIS_RECORD ( int record_id )
{
SQL_QUERY sql_query(DB);
SQL_QUERY query (DB);
sql_query.PREPARE_SELECT( "prs_personeller","sicil_no, cari_hesap_id","personel_id = :personel_id" );
sql_query.SET_VALUE( ":personel_id", record_id );
if ( sql_query.SELECT() EQ 0 ) {
return ADAK_FAIL;
}
sql_query.NEXT();
line_edit_personel_sicil_no->setText ( sql_query.VALUE(0).toString() );
int cari_hesap_id = sql_query.VALUE( 1 ).toInt();
CARI_HESAP_STRUCT hesap_bilgileri;
CARI_SET_HESAP_STRUCT_DEFAULTS(&hesap_bilgileri);
CARI_KART_BILGILERINI_OKU( cari_hesap_id, &hesap_bilgileri );
line_edit_personel_adi_soyadi->setText ( hesap_bilgileri.cari_hesap_ismi );
query.PREPARE_SELECT ( "prs_ek_kesintiler_odenekler ",
"kesinti_odenek_id, personel_id, order_number, "
"odenek_kesinti_adi, "
"bordro_donemi_ay, bordro_donemi_yil, "
"yuzde_mi, yuzde_orani, tutar, aciklama,bordro_id ",
"personel_id = :personel_id "
"AND bordrosu_kesildi_mi = :bordrosu_kesildi_mi "
"AND kesinti_odenek_turu = :kesinti_odenek_turu ");
query.SET_VALUE ( ":personel_id", record_id );
query.SET_VALUE ( ":bordrosu_kesildi_mi" , 0 );
query.SET_VALUE ( ":kesinti_odenek_turu" , ENUM_PRS_KESINTI);
query.SELECT("order_number ASC",0,1);
while ( query.NEXT() EQ true ) {
int p_current_row;
p_current_row = ADD_NEW_LINE ();
int bordro_id = query.VALUE("bordro_id").toInt();
int bordro_donemi_ay = 0;
int bordro_donemi_yil= 0;
PRS_GET_BORDRO_DONEMI_AY_YIL(bordro_donemi_ay,bordro_donemi_yil,bordro_id);
QWidget * cell_widget = table_widget_kesinti_satirlari->cellWidget( p_current_row, KESINTI_ADI_COLUMN );
QLineEdit * line_edit_kesinti_adi = static_cast < QLineEdit * > ( cell_widget );
line_edit_kesinti_adi->setText( query.VALUE("odenek_kesinti_adi").toString() );
cell_widget = table_widget_kesinti_satirlari->cellWidget( p_current_row, BORDRO_DONEMI_AY_COLUMN );
QComboBox * combo_box_bordro_donemi_ay = static_cast < QComboBox * > ( cell_widget );
combo_box_bordro_donemi_ay->setCurrentIndex( query.VALUE("bordro_donemi_ay").toInt() );
cell_widget = table_widget_kesinti_satirlari->cellWidget( p_current_row, BORDRO_DONEMI_YIL_COLUMN );
QComboBox * combo_box_bordro_donemi_yil = static_cast < QComboBox * > ( cell_widget );
combo_box_bordro_donemi_yil->setCurrentIndex( combo_box_bordro_donemi_yil->findText( query.VALUE("bordro_donemi_yil").toString()));
cell_widget = table_widget_kesinti_satirlari->cellWidget( p_current_row, KESINTI_YUZDE_MI_COLUMN );
QComboBox * combo_box_kesinti_yuzde_mi = static_cast < QComboBox * > ( cell_widget );
combo_box_kesinti_yuzde_mi->setCurrentIndex( query.VALUE("yuzde_mi").toInt() );
cell_widget = table_widget_kesinti_satirlari->cellWidget( p_current_row, YUZDE_COLUMN );
QCommaEdit * comma_edit_yuzde_orani = static_cast < QCommaEdit * > ( cell_widget );
comma_edit_yuzde_orani->SET_DOUBLE ( query.VALUE("yuzde_orani").toDouble() );
cell_widget = table_widget_kesinti_satirlari->cellWidget( p_current_row, TUTAR_COLUMN );
QCommaEdit * comma_edit_tutar = static_cast < QCommaEdit * > ( cell_widget );
comma_edit_tutar->SET_DOUBLE ( query.VALUE("tutar").toDouble() );
cell_widget = table_widget_kesinti_satirlari->cellWidget( p_current_row, ACIKLAMA_COLUMN );
QLineEdit * line_edit_aciklama = static_cast < QLineEdit * > ( cell_widget );
line_edit_aciklama->setText( query.VALUE("aciklama").toString() );
QString id = query.VALUE("kesinti_odenek_id").toString();
QString personel_id = query.VALUE("personel_id").toString();
QString order_number = query.VALUE("order_number").toString();
QTableWidgetItem * new_item;
table_widget_kesinti_satirlari->setHorizontalHeaderLabels((QStringList()<<"id"<<"record_id"<<"satir_order"
<<tr("Bordro Dönemi Ay") <<tr("Bordro Dönemi Yıl")
<<tr("Kesinti Adı")
<<("Yüzde Mi")<<("Yüzde")<<tr("Tutar")
<<tr("Açıklama")<<tr("")<<tr("")));
new_item = new QTableWidgetItem(tr("%1").arg(id));
table_widget_kesinti_satirlari->setItem(p_current_row, ROW_ID_COLUMN, new_item);
new_item = new QTableWidgetItem(tr("%1").arg(personel_id));
table_widget_kesinti_satirlari->setItem(p_current_row, RECORD_ID_COLUMN, new_item);
new_item = new QTableWidgetItem(tr("%1").arg(order_number));
table_widget_kesinti_satirlari->setItem(p_current_row, ORDER_COLUMN, new_item);
}
return ADAK_OK;
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::SET_LINE_DEFAULTS
***************************************************************************************/
void PRS_PERSONEL_KESINTI_EKLEME_FISI::SET_LINE_DEFAULTS ( int row_number ) {
QWidget * cell_widget;
QComboBox * combo_box_bordro_donemi_ay;
QComboBox * combo_box_bordro_donemi_yil;
QComboBox * combobox_kesinti_yuzde_mi;
QStringList bordro_donemi_ay;
QStringList kesinti_yuzde_mi;
QLineEdit * line_edit_aciklama = ((QLineEdit *) table_widget_kesinti_satirlari->cellWidget(row_number, ACIKLAMA_COLUMN ));
QLineEdit * line_edit_kesinti_adi = ((QLineEdit*) table_widget_kesinti_satirlari->cellWidget(row_number, KESINTI_ADI_COLUMN ));
line_edit_kesinti_adi->setMaxLength (128) ;
line_edit_aciklama->setMaxLength ( 512 );
bordro_donemi_ay <<tr("")<< tr("OCAK")<< tr("ŞUBAT")<< tr("MART") << tr("NİSAN")
<< tr("MAYIS")<< tr("HAZİRAN")<< tr("TEMMUZ") << tr("AĞUSTOS")
<< tr("EYLÜL")<< tr("EKİM")<< tr("KASIM") << tr("ARALIK");
cell_widget = table_widget_kesinti_satirlari->cellWidget(row_number, BORDRO_DONEMI_AY_COLUMN);
combo_box_bordro_donemi_ay = static_cast <QComboBox*> (cell_widget);
combo_box_bordro_donemi_ay->addItems(bordro_donemi_ay);
combo_box_bordro_donemi_ay->setCurrentIndex( QDate::currentDate().month() );
cell_widget = table_widget_kesinti_satirlari->cellWidget(row_number, BORDRO_DONEMI_YIL_COLUMN);
combo_box_bordro_donemi_yil = static_cast <QComboBox*> (cell_widget);
PRS_FILL_COMBO_BOX_BORDRO_YILLARI( combo_box_bordro_donemi_yil );
kesinti_yuzde_mi << tr("TUTAR")<< tr("YÜZDE");
cell_widget = table_widget_kesinti_satirlari->cellWidget(row_number, KESINTI_YUZDE_MI_COLUMN);
combobox_kesinti_yuzde_mi = static_cast <QComboBox*> (cell_widget);
combobox_kesinti_yuzde_mi->addItems(kesinti_yuzde_mi);
QCommaEdit * comma_edit_tutar = ( QCommaEdit * ) table_widget_kesinti_satirlari->cellWidget(row_number, TUTAR_COLUMN );
QCommaEdit * comma_edit_yuzde = ( QCommaEdit * ) table_widget_kesinti_satirlari->cellWidget(row_number, YUZDE_COLUMN );
comma_edit_tutar->setEnabled( true );
comma_edit_yuzde->setEnabled( false );
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_FIS_FORM_VAR
**************************************************************************************/
int PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_FIS_FORM_VAR ( QObject * object )
{
Q_UNUSED ( object );
return ADAK_OK;
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_FIS_FORM_EMPTY
***************************************************************************************/
int PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_FIS_FORM_EMPTY()
{
return ADAK_OK;
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_FIS_RECORD_ADD
**************************************************************************************/
int PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_FIS_RECORD_ADD()
{
return ADAK_OK;
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::ADD_FIS_RECORD
***************************************************************************************/
int PRS_PERSONEL_KESINTI_EKLEME_FISI::ADD_FIS_RECORD()
{
return 1;
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_FIS_RECORD_UPDATE
**************************************************************************************/
int PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_FIS_RECORD_UPDATE(int record_id)
{
Q_UNUSED(record_id);
return ADAK_OK;
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::UPDATE_FIS_RECORD
***************************************************************************************/
void PRS_PERSONEL_KESINTI_EKLEME_FISI::UPDATE_FIS_RECORD(int record_id)
{
Q_UNUSED(record_id);
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_FIS_RECORD_DELETE
***************************************************************************************/
int PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_FIS_RECORD_DELETE(int record_id)
{
Q_UNUSED(record_id);
return ADAK_OK;
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::DELETE_FIS_RECORD
**************************************************************************************/
void PRS_PERSONEL_KESINTI_EKLEME_FISI::DELETE_FIS_RECORD ( int record_id )
{
Q_UNUSED(record_id);
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::SELECT_FIS_RECORD
***************************************************************************************/
int PRS_PERSONEL_KESINTI_EKLEME_FISI::SELECT_FIS_RECORD()
{
int cari_hesap_id = OPEN_CARI_KART_ARAMA ( "", SAHIS_ARTI_FIRMA, this, 0, E9_PROGRAMI, PERSONEL_MODULU, "Personel Arama", "DELETED" );
SQL_QUERY sql_query( DB );
sql_query.PREPARE_SELECT("prs_personeller","personel_id",
"cari_hesap_id = :cari_hesap_id");
sql_query.SET_VALUE( ":cari_hesap_id" , cari_hesap_id );
if ( sql_query.SELECT() NE 0 ) {
sql_query.NEXT();
return sql_query.VALUE(0).toInt();
}
return -1;
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::FIND_FIS_RECORD
**************************************************************************************/
int PRS_PERSONEL_KESINTI_EKLEME_FISI::FIND_FIS_RECORD()
{
SQL_QUERY sql_query( DB );
sql_query.PREPARE_SELECT("prs_personeller","personel_id",
"sicil_no = :sicil_no ");
sql_query.SET_VALUE( ":sicil_no" ,line_edit_personel_sicil_no->text() );
if ( sql_query.SELECT() NE 0 ) {
sql_query.NEXT();
return sql_query.VALUE(0).toInt();
}
return -1;
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::FIND_FIRST_FIS_RECORD
***************************************************************************************/
int PRS_PERSONEL_KESINTI_EKLEME_FISI::FIND_FIRST_FIS_RECORD()
{
SQL_QUERY sql_query( DB );
sql_query.PREPARE_SELECT("prs_personeller","personel_id ");
if ( sql_query.SELECT("sicil_no ASC",0,1) NE 0 ) {
sql_query.NEXT();
return sql_query.VALUE(0).toInt();
}
return -1;
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::FIND_LAST_FIS_RECORD
**************************************************************************************/
int PRS_PERSONEL_KESINTI_EKLEME_FISI::FIND_LAST_FIS_RECORD()
{
SQL_QUERY sql_query( DB );
sql_query.PREPARE_SELECT("prs_personeller","personel_id ");
if ( sql_query.SELECT("sicil_no DESC",0,1) NE 0 ) {
sql_query.NEXT();
return sql_query.VALUE(0).toInt();
}
return -1;
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::FIND_PREV_FIS_RECORD
***************************************************************************************/
int PRS_PERSONEL_KESINTI_EKLEME_FISI::FIND_PREV_FIS_RECORD()
{
SQL_QUERY sql_query( DB );
sql_query.PREPARE_SELECT("prs_personeller","personel_id ",
"sicil_no < :sicil_no ");
sql_query.SET_VALUE( ":sicil_no", line_edit_personel_sicil_no->text() );
if ( sql_query.SELECT("sicil_no DESC",0,1) NE 0 ) {
sql_query.NEXT();
return sql_query.VALUE(0).toInt();
}
return -1;
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::FIND_NEXT_FIS_RECORD
***************************************************************************************/
int PRS_PERSONEL_KESINTI_EKLEME_FISI::FIND_NEXT_FIS_RECORD()
{
SQL_QUERY sql_query( DB );
sql_query.PREPARE_SELECT("prs_personeller","personel_id ",
"sicil_no > :sicil_no");
sql_query.SET_VALUE( ":sicil_no", line_edit_personel_sicil_no->text() );
if ( sql_query.SELECT("sicil_no ASC",0,1) NE 0 ) {
sql_query.NEXT();
return sql_query.VALUE(0).toInt();
}
return -1;
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_LINE_VAR
***************************************************************************************/
int PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_LINE_VAR(int row_number, QObject * object)
{
QComboBox * combo_box_kesinti_yuzde_mi = ( QComboBox * ) table_widget_kesinti_satirlari->cellWidget(row_number, KESINTI_YUZDE_MI_COLUMN );
QCommaEdit * comma_edit_tutar = ( QCommaEdit * ) table_widget_kesinti_satirlari->cellWidget(row_number, TUTAR_COLUMN );
QCommaEdit * comma_edit_yuzde = ( QCommaEdit * ) table_widget_kesinti_satirlari->cellWidget(row_number, YUZDE_COLUMN );
if( object EQ combo_box_kesinti_yuzde_mi ) {
if ( combo_box_kesinti_yuzde_mi->currentText() EQ tr("TUTAR") ) {
comma_edit_yuzde->setEnabled( false );
comma_edit_tutar->setEnabled( true );
}
else {
comma_edit_tutar->setEnabled( false );
comma_edit_yuzde->setEnabled( true );
}
comma_edit_tutar->clear();
comma_edit_yuzde->clear();
}
return ADAK_OK;
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_LINE_EMPTY
***************************************************************************************/
int PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_LINE_EMPTY(int row_number)
{
QComboBox * combo_box_odenek_yuzde_mi = ( QComboBox * ) table_widget_kesinti_satirlari->cellWidget(row_number, KESINTI_YUZDE_MI_COLUMN );
QCommaEdit * comma_edit_tutar = ( QCommaEdit * ) table_widget_kesinti_satirlari->cellWidget(row_number, TUTAR_COLUMN );
QCommaEdit * comma_edit_yuzde_orani = ( QCommaEdit * ) table_widget_kesinti_satirlari->cellWidget(row_number, YUZDE_COLUMN );
QLineEdit * line_edit_kesinti_adi = ( QLineEdit * ) table_widget_kesinti_satirlari->cellWidget(row_number, KESINTI_ADI_COLUMN );
if ( line_edit_kesinti_adi->text().isEmpty() EQ true ) {
MSG_WARNING( tr( "Ödenek adını girmek zorundasınız." ), line_edit_kesinti_adi );
return ADAK_FAIL;
}
if ( combo_box_odenek_yuzde_mi->currentText() EQ tr("TUTAR") ) {
if ( comma_edit_tutar->GET_DOUBLE() EQ 0.00 ) {
MSG_WARNING( tr( "Tutarı girmek zorundasınız." ), comma_edit_tutar );
return ADAK_FAIL;
}
}
else { // yuzde
if ( comma_edit_yuzde_orani->GET_DOUBLE() EQ 0.00 ) {
MSG_WARNING( tr( "Yüzdeyi girmek zorundasınız." ), comma_edit_yuzde_orani );
return ADAK_FAIL;
}
}
return ADAK_OK;
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_ADD_LINE
**************************************************************************************/
int PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_ADD_LINE(int record_id, int row_number)
{
Q_UNUSED(record_id);
Q_UNUSED(row_number);
return ADAK_OK;
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::ADD_LINE
***************************************************************************************/
void PRS_PERSONEL_KESINTI_EKLEME_FISI::ADD_LINE(int record_id, int row_number)
{
SQL_QUERY sql_query(DB);
double tutar = 0;
double yuzde_orani = 0 ;
int order_number = table_widget_kesinti_satirlari->item ( row_number, ORDER_COLUMN )->text().toInt();
int bordro_donemi_ay = ((QComboBox *) table_widget_kesinti_satirlari->cellWidget(row_number, BORDRO_DONEMI_AY_COLUMN ))->currentIndex();
int bordro_donemi_yil = ((QComboBox *) table_widget_kesinti_satirlari->cellWidget(row_number, BORDRO_DONEMI_YIL_COLUMN ))->currentText().toInt();
QString kesinti_adi = ((QLineEdit *) table_widget_kesinti_satirlari->cellWidget(row_number, KESINTI_ADI_COLUMN))->text();
int kesinti_yuzde_mi = ((QComboBox *) table_widget_kesinti_satirlari->cellWidget(row_number, KESINTI_YUZDE_MI_COLUMN))->currentIndex();
yuzde_orani = ((QCommaEdit *) table_widget_kesinti_satirlari->cellWidget(row_number, YUZDE_COLUMN ))->GET_DOUBLE();
tutar = ((QCommaEdit *) table_widget_kesinti_satirlari->cellWidget(row_number, TUTAR_COLUMN ))->GET_DOUBLE();
QString aciklama = ((QLineEdit *) table_widget_kesinti_satirlari->cellWidget(row_number, ACIKLAMA_COLUMN))->text();
sql_query.PREPARE_INSERT("prs_ek_kesintiler_odenekler","kesinti_odenek_id",
"personel_id, order_number, "
"odenek_kesinti_adi, bordro_donemi_ay, bordro_donemi_yil, "
"yuzde_mi, yuzde_orani, tutar, aciklama, "
"bordrosu_kesildi_mi,kesinti_odenek_turu,bordro_id ");
sql_query.SET_VALUE(":personel_id" , record_id );
sql_query.SET_VALUE(":order_number" , order_number );
sql_query.SET_VALUE(":odenek_kesinti_adi" , kesinti_adi );
sql_query.SET_VALUE(":bordro_donemi_ay" , bordro_donemi_ay );
sql_query.SET_VALUE(":bordro_donemi_yil" , bordro_donemi_yil );
sql_query.SET_VALUE(":yuzde_mi" , kesinti_yuzde_mi );
sql_query.SET_VALUE(":yuzde_orani" , yuzde_orani );
sql_query.SET_VALUE(":tutar" , tutar );
sql_query.SET_VALUE(":aciklama" , aciklama );
sql_query.SET_VALUE(":bordrosu_kesildi_mi", 0 );
sql_query.SET_VALUE(":kesinti_odenek_turu", ENUM_PRS_KESINTI );
sql_query.SET_VALUE(":bordro_id" , PRS_GET_BORDRO_ID(bordro_donemi_ay,bordro_donemi_yil, SUBE_GET_SUBE_ID() ));
int satir_id = sql_query.INSERT();
QTableWidgetItem * new_item = new QTableWidgetItem ( QVariant ( satir_id ).toString() );
table_widget_kesinti_satirlari->setItem ( row_number, ROW_ID_COLUMN, new_item );
QString personel_adi_soyadi = line_edit_personel_adi_soyadi->text();
QString personel_sicil_no = line_edit_personel_sicil_no->text();
QString log_detaylari = "Personel Kesinti Ekleme";
log_detaylari.append("\nPersonel Adı / Soyadı : " + personel_adi_soyadi +
"Sicil No : " + personel_sicil_no);
E9_LOG_KAYDI_EKLE ( PERSONEL_MODULU , -1 , LOG_ISLEM_ADD , log_detaylari);
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_UPDATE_LINE
***************************************************************************************/
int PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_UPDATE_LINE ( int record_id, int row_number )
{
Q_UNUSED(record_id);
Q_UNUSED(row_number);
return ADAK_OK;
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::UPDATE_LINE
***************************************************************************************/
void PRS_PERSONEL_KESINTI_EKLEME_FISI::UPDATE_LINE ( int record_id, int row_number )
{
SQL_QUERY sql_query(DB);
int row_id = table_widget_kesinti_satirlari->item ( row_number, ROW_ID_COLUMN )->text().toInt();
int bordro_donemi_ay = ((QComboBox *) table_widget_kesinti_satirlari->cellWidget(row_number, BORDRO_DONEMI_AY_COLUMN ))->currentIndex();
int bordro_donemi_yil = ((QComboBox *) table_widget_kesinti_satirlari->cellWidget(row_number, BORDRO_DONEMI_YIL_COLUMN ))->currentText().toInt();
QString kesinti_adi = ((QLineEdit *) table_widget_kesinti_satirlari->cellWidget(row_number, KESINTI_ADI_COLUMN))->text();
int kesinti_yuzde_mi = ((QComboBox *) table_widget_kesinti_satirlari->cellWidget(row_number, KESINTI_YUZDE_MI_COLUMN))->currentIndex();
double yuzde_orani = ((QCommaEdit *) table_widget_kesinti_satirlari->cellWidget(row_number, YUZDE_COLUMN ))->GET_DOUBLE();
double tutar = ((QCommaEdit *) table_widget_kesinti_satirlari->cellWidget(row_number, TUTAR_COLUMN ))->GET_DOUBLE();
QString aciklama = ((QLineEdit *) table_widget_kesinti_satirlari->cellWidget(row_number, ACIKLAMA_COLUMN))->text();
sql_query.PREPARE_UPDATE("prs_ek_kesintiler_odenekler ","kesinti_odenek_id",
"personel_id , "
"odenek_kesinti_adi , "
"bordro_donemi_ay , "
"bordro_donemi_yil , "
"yuzde_mi , "
"yuzde_orani , "
"tutar , "
"aciklama , "
"bordro_id ",
"kesinti_odenek_id = :kesinti_odenek_id");
sql_query.SET_VALUE(":personel_id" , record_id );
sql_query.SET_VALUE(":odenek_kesinti_adi" , kesinti_adi );
sql_query.SET_VALUE(":bordro_donemi_ay" , bordro_donemi_ay );
sql_query.SET_VALUE(":bordro_donemi_yil" , bordro_donemi_yil );
sql_query.SET_VALUE(":yuzde_mi" , kesinti_yuzde_mi );
sql_query.SET_VALUE(":yuzde_orani" , yuzde_orani );
sql_query.SET_VALUE(":tutar" , tutar );
sql_query.SET_VALUE(":aciklama" , aciklama );
sql_query.SET_VALUE(":kesinti_odenek_id" , row_id );
sql_query.SET_VALUE(":bordro_id" ,PRS_GET_BORDRO_ID(bordro_donemi_ay , bordro_donemi_yil, SUBE_GET_SUBE_ID()));
sql_query.UPDATE();
QString personel_adi_soyadi = line_edit_personel_adi_soyadi->text();
QString personel_sicil_no = line_edit_personel_sicil_no->text();
QString log_detaylari = "Personel Kesinti Ekleme";
log_detaylari.append("\nPersonel Adı / Soyadı : " + personel_adi_soyadi +
"Sicil No : " + personel_sicil_no);
E9_LOG_KAYDI_EKLE ( PERSONEL_MODULU , -1 , LOG_ISLEM_UPDATE , log_detaylari);
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_DELETE_LINE
***************************************************************************************/
int PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_DELETE_LINE(int record_id, int row_number)
{
Q_UNUSED(record_id);
Q_UNUSED(row_number);
return ADAK_OK;
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::DELETE_LINE
***************************************************************************************/
void PRS_PERSONEL_KESINTI_EKLEME_FISI::DELETE_LINE(int record_id, int row_number)
{
Q_UNUSED( record_id );
Q_UNUSED( row_number );
SQL_QUERY sql_query (DB);
int row_id = table_widget_kesinti_satirlari->item ( row_number, ROW_ID_COLUMN )->text().toInt();
sql_query.PREPARE_DELETE("prs_ek_kesintiler_odenekler", "kesinti_odenek_id = :kesinti_odenek_id");
sql_query.SET_VALUE(":kesinti_odenek_id", row_id );
sql_query.DELETE();
QString personel_adi_soyadi = line_edit_personel_adi_soyadi->text();
QString personel_sicil_no = line_edit_personel_sicil_no->text();
QString log_detaylari = "Personel Kesinti Ekleme";
log_detaylari.append("\nPersonel Adı / Soyadı : " + personel_adi_soyadi +
"Sicil No : " + personel_sicil_no);
E9_LOG_KAYDI_EKLE ( PERSONEL_MODULU , -1 , LOG_ISLEM_DELETE , log_detaylari);
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::LOCK_FIS_RECORD
***************************************************************************************/
int PRS_PERSONEL_KESINTI_EKLEME_FISI::LOCK_FIS_RECORD(int record_id)
{
return DB->LOCK_ROW( "personel_id", "prs_personeller", QString ( "personel_id = %1" ).arg ( record_id ));
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::UNLOCK_FIS_RECORD
**************************************************************************************/
void PRS_PERSONEL_KESINTI_EKLEME_FISI::UNLOCK_FIS_RECORD(int record_id)
{
DB->UNLOCK_ROW( "personel_id", "prs_personeller", QString ( "personel_id = %1" ).arg ( record_id ));
}
/**************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_EXIT
***************************************************************************************/
int PRS_PERSONEL_KESINTI_EKLEME_FISI::CHECK_EXIT()
{
return ADAK_OK;
}
/***************************************************************************************
PRS_PERSONEL_KESINTI_EKLEME_FISI::SET_WIDGETS_MAXIMUM_SIZE
***************************************************************************************/
void PRS_PERSONEL_KESINTI_EKLEME_FISI::SET_WIDGETS_MAXIMUM_SIZE ()
{
line_edit_personel_adi_soyadi->setMaxLength (100);
line_edit_personel_sicil_no->setMaxLength (20);
}
| [
"cavit.vural@adak.com.tr"
] | cavit.vural@adak.com.tr |
7917d50ea824829fd1ac3b82a0e4ddd5e2941b2b | e98e505de1a1a3542189125ef4bdde147f9c77cd | /ios/chrome/browser/web/chrome_web_client.h | ae2de1163d27a96fc5d0dea1afbea11a5ad958d9 | [
"BSD-3-Clause"
] | permissive | jesonlay/chromium | b98fca219ab71d230df9a758252058a18e075a06 | 292532fedbb55d68a83b46c106fd04849a47571d | refs/heads/master | 2022-12-16T15:25:13.723395 | 2017-03-20T14:36:34 | 2017-03-20T15:37:49 | 158,929,892 | 0 | 0 | NOASSERTION | 2018-11-24T11:32:20 | 2018-11-24T11:32:19 | null | UTF-8 | C++ | false | false | 2,264 | h | // 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.
#ifndef IOS_CHROME_BROWSER_WEB_CHROME_WEB_CLIENT_H_
#define IOS_CHROME_BROWSER_WEB_CHROME_WEB_CLIENT_H_
#include "base/macros.h"
#include "ios/web/public/web_client.h"
// Chrome implementation of WebClient.
class ChromeWebClient : public web::WebClient {
public:
ChromeWebClient();
~ChromeWebClient() override;
// WebClient implementation.
web::WebMainParts* CreateWebMainParts() override;
void PreWebViewCreation() const override;
void AddAdditionalSchemes(std::vector<url::SchemeWithType>*
additional_standard_schemes) const override;
std::string GetAcceptLangs(web::BrowserState* state) const override;
std::string GetApplicationLocale() const override;
bool IsAppSpecificURL(const GURL& url) const override;
base::string16 GetPluginNotSupportedText() const override;
std::string GetProduct() const override;
std::string GetUserAgent(web::UserAgentType type) const override;
base::string16 GetLocalizedString(int message_id) const override;
base::StringPiece GetDataResource(
int resource_id,
ui::ScaleFactor scale_factor) const override;
base::RefCountedMemory* GetDataResourceBytes(int resource_id) const override;
void GetAdditionalWebUISchemes(
std::vector<std::string>* additional_schemes) override;
void PostBrowserURLRewriterCreation(
web::BrowserURLRewriter* rewriter) override;
NSString* GetEarlyPageScript(web::BrowserState* browser_state) const override;
void AllowCertificateError(
web::WebState* web_state,
int cert_error,
const net::SSLInfo& ssl_info,
const GURL& request_url,
bool overridable,
const base::Callback<void(bool)>& callback) override;
void GetTaskSchedulerInitializationParams(
std::vector<base::SchedulerWorkerPoolParams>* params_vector,
base::TaskScheduler::WorkerPoolIndexForTraitsCallback*
index_to_traits_callback) override;
void PerformExperimentalTaskSchedulerRedirections() override;
private:
DISALLOW_COPY_AND_ASSIGN(ChromeWebClient);
};
#endif // IOS_CHROME_BROWSER_WEB_CHROME_WEB_CLIENT_H_
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
e81d6717591579865ea4cf393ebe783f6c402ed6 | c853fc6275c4e5f3e73da755a80a6acbee5b82ed | /Main.cpp | 9bb2c84e10286b2bef580f9c090882ddfbb7186a | [] | no_license | wgoeks/CHIP-8 | d1e4f7a0c0c89c230a5401d05dcdc1dc4a2b50ac | d890a784082fb52a90d34e66372c95c21ae4e7ed | refs/heads/main | 2022-12-30T00:18:09.447155 | 2020-10-17T18:24:20 | 2020-10-17T18:24:20 | 304,942,390 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,095 | cpp | #include <chrono>
#include <iostream>
#include <string>
#include "Chip8.hpp"
#include "Platform.hpp"
int main(int argc, char* argv[]) {
if (argc != 4) {
std::cerr << "Usage: " << argv[0] << " <Scale> <Delay> <ROM>\n";
std::exit(EXIT_FAILURE);
}
int videoScale = std::stoi(argv[1]);
int cycleDelay = std::stoi(argv[2]);
char const* romFilename = argv[3];
Platform platform("CHIP-8 Emulator", VIDEO_WIDTH * videoScale, VIDEO_HEIGHT * videoScale, VIDEO_WIDTH, VIDEO_HEIGHT);
Chip8 chip8;
chip8.LoadROM(romFilename);
int videoPitch = sizeof(chip8.video[0]) * VIDEO_WIDTH;
auto lastCycleTime = std::chrono::high_resolution_clock::now();
bool quit = false;
while (!quit) {
quit = platform.ProcessInput(chip8.keypad);
auto currentTime = std::chrono::high_resolution_clock::now();
float dt = std::chrono::duration<float, std::chrono::milliseconds::period>(currentTime - lastCycleTime).count();
if (dt > cycleDelay) {
lastCycleTime = currentTime;
chip8.Cycle();
platform.Update(chip8.video, videoPitch);
}
}
return 0;
} | [
"noreply@github.com"
] | wgoeks.noreply@github.com |
4ea2c48eb061916586a8a977136c8a4e623a874f | cd77a73316254ce67d41cd9ed85e8e2c70c965ee | /ElectroVentilador/moskvich/rpm.cpp | b4eec00168c09d258c6ee3031ffe50c93e6ef81c | [] | no_license | vladimir1284/arduino | a29e3c13ce02e3df0b0d62261f4c61475868180a | 69a7ee7d1d66a12be5587655cc3d34e2b821686f | refs/heads/master | 2021-12-09T14:13:16.937213 | 2021-12-07T17:33:29 | 2021-12-07T17:33:29 | 233,625,356 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 850 | cpp | #include "rpm.h"
// Constructor
RPM::RPM()
{
}
//-----------------------------------------------------
void RPM::init(int pin)
{
digitalPIN = pin;
pinMode(digitalPIN, INPUT);
lastState = digitalRead(digitalPIN);
startCount = millis();
}
//-----------------------------------------------------
int RPM::getRPM()
{
int elapsedTime = millis() - startCount;
int rpm = edgeCount * RMPCONST / elapsedTime;
edgeCount = 0;
startCount = millis();
return rpm;
}
//-----------------------------------------------------
void RPM::run()
{
currentState = digitalRead(digitalPIN);
if (currentState != lastState)
{
innerCount++;
}
else
{
innerCount = 0;
}
if (innerCount == NCHECK)
{
edgeCount++;
innerCount = 0;
lastState = currentState;
}
} | [
"vladimir.rdguez@gmail.com"
] | vladimir.rdguez@gmail.com |
838d6334e4894a34ca7d3291b4a324762b5383a5 | aa271e98d3ea105c25e770e4638f47d68f8e631f | /edu/Patterns for Coding Questions/Subsets/Balanced Parentheses (hard)/main.cpp | be659c303ad9b3be5a50eea03d9123949d13ff53 | [] | no_license | LeoChenL/Miscellaneous | 50b894b4fce6965ae5aa4f600f90b22e08e18b41 | 9dcaa0890f638d78d7f2b5a7461eb4a6c2b80560 | refs/heads/master | 2021-07-12T07:12:12.084036 | 2020-09-21T02:58:32 | 2020-09-21T02:58:32 | 196,024,605 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,359 | cpp | /*
Problem Statement #
For a given number ‘N’, write a function to generate all combination of ‘N’
pairs of balanced parentheses.
Example 1:
Input: N=2
Output: (()), ()()
Example 2:
Input: N=3
Output: ((())), (()()), (())(), ()(()), ()()()
Time complexity #
Let’s try to estimate how many combinations we can have for ‘N’ pairs of
balanced parentheses. If we don’t care for the ordering - that ) can only come
after ( - then we have two options for every position, i.e., either put open
parentheses or close parentheses. This means we can have a maximum of 2^N
combinations. Because of the ordering, the actual number will be less than 2^N
If you see the visual representation of Example-2 closely you will realize that,
in the worst case, it is equivalent to a binary tree, where each node will have
two children. This means that we will have 2^N leaf nodes and 2^N-1 intermediate
nodes. So the total number of elements pushed to the queue will be 2^N + 2^N-1,
which is asymptotically equivalent to O(2^N). While processing each element, we
do need to concatenate the current string with ( or ). This operation will take
O(N), so the overall time complexity of our algorithm will be O(N*2^N). This is
not completely accurate but reasonable enough to be presented in the interview.
The actual time complexity ( O(4^n / sqrt{n}) is bounded by the Catalan number
and is beyond the scope of a coding interview. See more details here.
Space complexity #
All the additional space used by our algorithm is for the output list. Since we
can’t have more than O(2^N) combinations, the space complexity of our algorithm
is O(N*2^N)
*/
using namespace std;
#include <iostream>
#include <queue>
#include <string>
#include <vector>
class ParenthesesString {
public:
string str;
int openCount = 0; // open parentheses count
int closeCount = 0; // close parentheses count
ParenthesesString(const string &s, int openCount, int closeCount) {
this->str = s;
this->openCount = openCount;
this->closeCount = closeCount;
}
};
class GenerateParentheses {
public:
static vector<string> generateValidParentheses(int num) {
vector<string> result;
queue<ParenthesesString> queue;
queue.push({"", 0, 0});
while (!queue.empty()) {
ParenthesesString ps = queue.front();
queue.pop();
// if we've reached the maximum number of open and close parentheses, add to the result
if (ps.openCount == num && ps.closeCount == num) {
result.push_back(ps.str);
} else {
if (ps.openCount < num) { // if we can add an open parentheses, add it
queue.push({ps.str + "(", ps.openCount + 1, ps.closeCount});
}
if (ps.openCount > ps.closeCount) { // if we can add a close parentheses, add it
queue.push({ps.str + ")", ps.openCount, ps.closeCount + 1});
}
}
}
return result;
}
};
int main(int argc, char *argv[]) {
vector<string> result = GenerateParentheses::generateValidParentheses(2);
cout << "All combinations of balanced parentheses are: ";
for (auto str : result) {
cout << str << " ";
}
cout << endl;
result = GenerateParentheses::generateValidParentheses(3);
cout << "All combinations of balanced parentheses are: ";
for (auto str : result) {
cout << str << " ";
}
cout << endl;
}
| [
"leochenlang7@gmail.com"
] | leochenlang7@gmail.com |
c4441ad2364a13b2702374b97371a434123b0ef0 | dcf168586642674872dcf43b38b547c1d641e8a9 | /utils/main.cpp | 261efd1c2dd81c756dbefcb08cc90c2ba8d10cd0 | [] | no_license | nh2oh/utils | 67892e7add07c617615bb96e21cde2362b5a1eaf | faad55574aa359c340793a0a0d37af8c3d1e21eb | refs/heads/master | 2020-06-18T08:44:43.843803 | 2019-07-10T18:43:14 | 2019-07-10T18:43:14 | 196,238,886 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 152 | cpp | #include <iostream>
#include <filesystem>
#include <string>
int main(int argc, char **argv) {
std::cout << "yay" << std::endl;
return 0;
}
| [
"ben_junk@ionophore.com"
] | ben_junk@ionophore.com |
44f081864d0b969c4412771033fe85057a1db282 | 66deb611781cae17567efc4fd3717426d7df5e85 | /pcmanager/src/src_3rdlib/stlsoft/include/winstl/synch/spin_mutex.hpp | 6401c93baf85de0c69867985eda7e388f4fad2fb | [
"Apache-2.0"
] | permissive | heguoxing98/knoss-pcmanager | 4671548e14b8b080f2d3a9f678327b06bf9660c9 | 283ca2e3b671caa85590b0f80da2440a3fab7205 | refs/heads/master | 2023-03-19T02:11:01.833194 | 2020-01-03T01:45:24 | 2020-01-03T01:45:24 | 504,422,245 | 1 | 0 | null | 2022-06-17T06:40:03 | 2022-06-17T06:40:02 | null | UTF-8 | C++ | false | false | 13,415 | hpp | /* /////////////////////////////////////////////////////////////////////////
* File: winstl/synch/spin_mutex.hpp (originally MWSpinMx.h, ::SynesisWin)
*
* Purpose: Intra-process mutex, based on spin waits.
*
* Created: 27th August 1997
* Updated: 29th April 2010
*
* Thanks: To Rupert Kittinger, for pointing out that prior
* implementation that always yielded was not really "spinning".
*
* Home: http://stlsoft.org/
*
* Copyright (c) 1997-2010, Matthew Wilson and Synesis Software
* 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(s) of Matthew Wilson and Synesis Software nor the names of
* any 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.
*
* ////////////////////////////////////////////////////////////////////// */
/** \file winstl/synch/spin_mutex.hpp
*
* \brief [C++ only] Definition of winstl::spin_index class
* (\ref group__library__synch "Synchronisation" Library).
*/
#ifndef WINSTL_INCL_WINSTL_SYNCH_HPP_SPIN_MUTEX
#define WINSTL_INCL_WINSTL_SYNCH_HPP_SPIN_MUTEX
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define WINSTL_VER_WINSTL_SYNCH_HPP_SPIN_MUTEX_MAJOR 4
# define WINSTL_VER_WINSTL_SYNCH_HPP_SPIN_MUTEX_MINOR 1
# define WINSTL_VER_WINSTL_SYNCH_HPP_SPIN_MUTEX_REVISION 3
# define WINSTL_VER_WINSTL_SYNCH_HPP_SPIN_MUTEX_EDIT 56
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
* Includes
*/
#ifndef WINSTL_INCL_WINSTL_H_WINSTL
# include <winstl/winstl.h>
#endif /* !WINSTL_INCL_WINSTL_H_WINSTL */
#ifndef STLSOFT_INCL_STLSOFT_SYNCH_HPP_CONCEPTS
# include <stlsoft/synch/concepts.hpp>
#endif /* !STLSOFT_INCL_STLSOFT_SYNCH_HPP_CONCEPTS */
#ifndef STLSOFT_INCL_STLSOFT_SYNCH_HPP_SPIN_POLICIES
# include <stlsoft/synch/spin_policies.hpp>
#endif /* !STLSOFT_INCL_STLSOFT_SYNCH_HPP_SPIN_POLICIES */
#ifndef WINSTL_INCL_WINSTL_SYNCH_H_ATOMIC_TYPES
# include <winstl/synch/atomic_types.h>
#endif /* !WINSTL_INCL_WINSTL_SYNCH_H_ATOMIC_TYPES */
#ifdef STLSOFT_UNITTEST
# include <stlsoft/synch/lock_scope.hpp>
#endif /* STLSOFT_UNITTEST */
#if defined(_DEBUG)
# define STLSOFT_SPINMUTEX_COUNT_LOCKS
#endif /* _DEBUG */
#if defined(_ATL_MIN_CRT)
# define WINSTL_SPINMUTEX_CHECK_INIT
#endif /* _ATL_MIN_CRT */
/* /////////////////////////////////////////////////////////////////////////
* Namespace
*/
#ifndef _WINSTL_NO_NAMESPACE
# if defined(_STLSOFT_NO_NAMESPACE) || \
defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
/* There is no stlsoft namespace, so must define ::winstl */
namespace winstl
{
# else
/* Define stlsoft::winstl_project */
namespace stlsoft
{
namespace winstl_project
{
# endif /* _STLSOFT_NO_NAMESPACE */
#endif /* !_WINSTL_NO_NAMESPACE */
/* /////////////////////////////////////////////////////////////////////////
* Classes
*/
// class spin_mutex_base
/** \brief This class provides an implementation of the mutex model based on
* a spinning mechanism
*
* \ingroup group__library__synch
*
* \note A spin mutex is not recursive. If you re-enter it your thread will
* be in irrecoverable deadlock.
*/
template <typename SP>
class spin_mutex_base
: public stlsoft_ns_qual(critical_section)< STLSOFT_CRITICAL_SECTION_ISNOT_RECURSIVE
, STLSOFT_CRITICAL_SECTION_ISNOT_TRYABLE
>
{
/// \name Member Types
/// @{
private:
/// \brief The spin-policy class
typedef SP spin_policy_class;
public:
/// \brief This class
typedef spin_mutex_base<SP> class_type;
/// \brief The atomic integer type
typedef winstl_ns_qual(atomic_int_t) atomic_int_type;
/// \brief The count type
typedef ws_sint32_t count_type;
/// \brief The bool type
typedef ws_bool_t bool_type;
/// @}
/// \name Construction
/// @{
public:
#ifdef __SYNSOFT_DBS_COMPILER_SUPPORTS_PRAGMA_MESSAGE
# pragma message(_sscomp_fileline_message("Create stlsoft/synch/spin_mutex_base.hpp, and factor out"))
#endif /* __SYNSOFT_DBS_COMPILER_SUPPORTS_PRAGMA_MESSAGE */
/// \brief Creates an instance of the mutex
///
/// \param p Pointer to an external counter variable. May be NULL, in
/// which case an internal member is used for the counter variable.
///
/// \note
ss_explicit_k spin_mutex_base(atomic_int_type *p = NULL) stlsoft_throw_0()
: m_spinCount((NULL != p) ? p : &m_internalCount)
, m_internalCount(0)
#ifdef STLSOFT_SPINMUTEX_COUNT_LOCKS
, m_cLocks(0)
#endif // STLSOFT_SPINMUTEX_COUNT_LOCKS
, m_spunCount(0)
, m_bYieldOnSpin(spin_policy_class::value)
{}
/// \brief Creates an instance of the mutex
///
/// \param p Pointer to an external counter variable. May be NULL, in
/// which case an internal member is used for the counter variable.
/// \param bYieldOnSpin
spin_mutex_base(atomic_int_type *p, bool_type bYieldOnSpin) stlsoft_throw_0()
: m_spinCount((NULL != p) ? p : &m_internalCount)
, m_internalCount(0)
#ifdef STLSOFT_SPINMUTEX_COUNT_LOCKS
, m_cLocks(0)
#endif // STLSOFT_SPINMUTEX_COUNT_LOCKS
, m_spunCount(0)
, m_bYieldOnSpin(bYieldOnSpin)
{}
/// Destroys an instance of the mutex
~spin_mutex_base() stlsoft_throw_0()
{
#ifdef STLSOFT_SPINMUTEX_COUNT_LOCKS
WINSTL_ASSERT(0 == m_cLocks);
#endif // STLSOFT_SPINMUTEX_COUNT_LOCKS
}
/// @}
/// \name Operations
/// @{
public:
/// \brief Acquires a lock on the mutex, pending the thread until the lock is aquired
void lock() stlsoft_throw_0()
{
#ifdef WINSTL_SPINMUTEX_CHECK_INIT
// If the dynamic initialisation phase has been skipped, the
// members will all be assigned to 0, which is correct for
// all except m_spinCount, which must be assigned to
// &m_internalCount
if(NULL == m_spinCount)
{
m_spinCount = &m_internalCount;
}
#endif /* WINSTL_SPINMUTEX_CHECK_INIT */
WINSTL_MESSAGE_ASSERT("A global instance of spin_mutex has skipped dynamic initialisation. You must #define WINSTL_SPINMUTEX_CHECK_INIT if your compilation causes dynamic initialisation to be skipped.", NULL != m_spinCount);
// WINSTL_MESSAGE_ASSERT("Attempting to re-enter a spin mutex that is already acquired: this will deadlock!", 0 == m_spunCount);
for(m_spunCount = 1; 0 != ::InterlockedExchange(reinterpret_cast<LPLONG>(m_spinCount), 1); ++m_spunCount)
{
if(m_bYieldOnSpin)
{
::Sleep(1);
}
}
#ifdef STLSOFT_SPINMUTEX_COUNT_LOCKS
WINSTL_ASSERT(0 != ++m_cLocks);
#endif // STLSOFT_SPINMUTEX_COUNT_LOCKS
}
/// \brief Releases an aquired lock on the mutex
void unlock() stlsoft_throw_0()
{
#ifdef STLSOFT_SPINMUTEX_COUNT_LOCKS
WINSTL_ASSERT(0 != m_cLocks--);
#endif // STLSOFT_SPINMUTEX_COUNT_LOCKS
m_spunCount = 0;
static_cast<void>(::InterlockedExchange(reinterpret_cast<LPLONG>(m_spinCount), 0));
}
/// @}
/// \name Attributes
/// @{
public:
/// \brief An indicator as to the level of contention on the mutex.
///
/// \note The value returned is only meaningful after lock() has been
/// called and before a corresponding unlock() has been called.
///
/// \note The value returned is only reliable when an external counter
/// variable is being used, and when each spin_mutex instance is
/// thread-specific. In all other cases, the spun count is subject to
/// race conditions (that do <b>not</b> affect the good functioning of
/// the spin_mutex) and value returned may be, at best, used only as a
/// guide as to contention.
count_type spun_count() const
{
return m_spunCount;
}
/// @}
/// \name Members
/// @{
private:
atomic_int_type *m_spinCount;
atomic_int_type m_internalCount;
#ifdef STLSOFT_SPINMUTEX_COUNT_LOCKS
count_type m_cLocks; // Used as check on matched Lock/Unlock calls
#endif // STLSOFT_SPINMUTEX_COUNT_LOCKS
count_type m_spunCount;
const bool_type m_bYieldOnSpin;
/// @}
/// \name Not to be implemented
/// @{
private:
spin_mutex_base(class_type const& rhs);
class_type& operator =(class_type const& rhs);
/// @}
};
typedef spin_mutex_base<stlsoft_ns_qual(spin_yield)> spin_mutex_yield;
typedef spin_mutex_base<stlsoft_ns_qual(spin_no_yield)> spin_mutex_no_yield;
#ifdef STLSOFT_OLD_SPIN_MUTEX_BEHAVIOUR
typedef spin_mutex_no_yield spin_mutex;
#else /* ? STLSOFT_OLD_SPIN_MUTEX_BEHAVIOUR */
typedef spin_mutex_yield spin_mutex;
#endif /* STLSOFT_OLD_SPIN_MUTEX_BEHAVIOUR */
/* /////////////////////////////////////////////////////////////////////////
* Control shims
*/
#ifndef _WINSTL_NO_NAMESPACE
# if defined(_STLSOFT_NO_NAMESPACE) || \
defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
} // namespace winstl
# else
} // namespace winstl_project
# endif /* _STLSOFT_NO_NAMESPACE */
#endif /* !_WINSTL_NO_NAMESPACE */
/** \brief This \ref group__concept__shims "control shim" aquires a lock on the given mutex
*
* \ingroup group__concept__shim__synchronisation_control
*
* \param mx The mutex on which to aquire the lock.
*/
template <ss_typename_param_k SP>
inline void lock_instance(winstl_ns_qual(spin_mutex_base)<SP> &mx)
{
mx.lock();
}
/** \brief This \ref group__concept__shims "control shim" releases a lock on the given mutex
*
* \ingroup group__concept__shim__synchronisation_control
*
* \param mx The mutex on which to release the lock
*/
template <ss_typename_param_k SP>
inline void unlock_instance(winstl_ns_qual(spin_mutex_base)<SP> &mx)
{
mx.unlock();
}
#ifndef _WINSTL_NO_NAMESPACE
# if defined(_STLSOFT_NO_NAMESPACE) || \
defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
namespace winstl {
# else
namespace winstl_project {
# if defined(STLSOFT_COMPILER_IS_BORLAND)
using ::stlsoft::lock_instance;
using ::stlsoft::unlock_instance;
# endif /* compiler */
# endif /* _STLSOFT_NO_NAMESPACE */
#endif /* !_WINSTL_NO_NAMESPACE */
/* /////////////////////////////////////////////////////////////////////////
* lock_traits
*/
// class lock_traits
/** \brief Traits for the spin_mutex class
*
* \ingroup group__library__synch
*/
struct spin_mutex_lock_traits
{
public:
/// The lockable type
typedef spin_mutex lock_type;
/// This type
typedef spin_mutex_lock_traits class_type;
// Operations
public:
/// Lock the given spin_mutex instance
static void lock(spin_mutex &c)
{
lock_instance(c);
}
/// Unlock the given spin_mutex instance
static void unlock(spin_mutex &c)
{
unlock_instance(c);
}
};
////////////////////////////////////////////////////////////////////////////
// Unit-testing
#ifdef STLSOFT_UNITTEST
# include "./unittest/spin_mutex_unittest_.h"
#endif /* STLSOFT_UNITTEST */
/* ////////////////////////////////////////////////////////////////////// */
#ifndef _WINSTL_NO_NAMESPACE
# if defined(_STLSOFT_NO_NAMESPACE) || \
defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
} // namespace winstl
# else
} // namespace winstl_project
} // namespace stlsoft
# endif /* _STLSOFT_NO_NAMESPACE */
#endif /* !_WINSTL_NO_NAMESPACE */
/* ////////////////////////////////////////////////////////////////////// */
#endif /* !WINSTL_INCL_WINSTL_SYNCH_HPP_SPIN_MUTEX */
/* ///////////////////////////// end of file //////////////////////////// */
| [
"dreamsxin@qq.com"
] | dreamsxin@qq.com |
3d578f25ed274a790d14ec2cfbfcf7647936f4e1 | c429b0989f34a2ef37f4a37f9617dbc3c891a2f8 | /GraphicEngine/Drivers/OpenGL/GraphicPipelines/OpenGLShadowMapGraphicPipeline.hpp | 4bf5967d9ecfd361d21a83e76e528dd97b645b85 | [] | no_license | sylmroz/GraphicEngine | 432d685b74e68b0e4e5eaa5f938bff254eef91e4 | 8552e3ffc79709968030b803fd318226d77990fc | refs/heads/master | 2023-07-08T02:01:10.283360 | 2021-08-08T13:53:54 | 2021-08-08T13:53:54 | 236,573,010 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,124 | hpp | #pragma once
#include "OpenGLGraphicPipeline.hpp"
#include "../../../Engines/Graphic/Pipelines/ShadowMapGraphicPipeline.hpp"
#include "../OpenGLTexture.hpp"
#include "../../../Engines/Graphic/Shaders/Models/LightPositionFarPlane.hpp"
#include <array>
namespace GraphicEngine::OpenGL
{
enum class LightTypeShadow
{
directional,
point,
spot
};
class OpenGLShadowMapGraphicPipeline : public Engines::Graphic::ShadowMapGraphicPipeline<VertexBuffer, UniformBuffer, UniformBuffer>
{
public:
OpenGLShadowMapGraphicPipeline(std::shared_ptr<Texture> depthTexture, Engines::Graphic::Shaders::LightSpaceMatrixArray lightSpaceMatrixArray, LightTypeShadow type = LightTypeShadow::directional, Engines::Graphic::Shaders::LightPositionFarPlaneArray lightPositionFarPlaneArray = {});
virtual void draw() override;
void updateLights(Engines::Graphic::Shaders::LightSpaceMatrixArray lightSpaceMatrixArray, Engines::Graphic::Shaders::LightPositionFarPlaneArray lightPositionFarPlaneArray = {});
void updateLight(Engines::Graphic::Shaders::LightSpaceMatrix lightSpaceMatrix, uint32_t index, Engines::Graphic::Shaders::LightPositionFarPlane lightPositionFarPlane = {});
void updateLight(std::array<Engines::Graphic::Shaders::LightSpaceMatrix, 6> lightSpaceMatrices, uint32_t index, Engines::Graphic::Shaders::LightPositionFarPlane lightPositionFarPlane = {});
uint32_t getOffset();
std::string getShaderTypePlaceholder();
std::string getDepth();
private:
std::shared_ptr<OpenGLShaderProgram> m_shaderProgram;
std::shared_ptr<UniformBufferArray<Engines::Graphic::Shaders::LightSpaceMatrixArray>> m_lightSpaceMatrixArrayUniform;
std::shared_ptr<UniformBufferArray<Engines::Graphic::Shaders::LightPositionFarPlaneArray>> m_lightPositionFarPlaneArrayUniform;
GLuint dephMapFBO;
std::shared_ptr<Texture> m_depthTexture;
std::string m_shaderTemplate;
std::vector<std::shared_ptr<OpenGLShader>> m_shaders;
Engines::Graphic::Shaders::LightSpaceMatrixArray m_lightSpaceMatrixArray;
Engines::Graphic::Shaders::LightPositionFarPlaneArray m_lightPositionFarPlaneArray;
LightTypeShadow m_type;
};
}
| [
"sylwinho555@wp.pl"
] | sylwinho555@wp.pl |
9d8fe9009eec048edf03c96337801507e9021344 | 1459f96431805683554f93b59e2c91da35a31909 | /src/leveldb/util/hash.cc | e351e4ededfc78038a89ae291d5dd7d0a291be5f | [
"MIT",
"BSD-3-Clause"
] | permissive | btrcoin/btrcoin | 04683de7ed03dab86ae96c9d99f96978d1ee6a2d | e6a7ef4b04da0397b4348daff25ca98c6fabf448 | refs/heads/master | 2021-04-30T08:20:39.835614 | 2018-02-13T11:04:28 | 2018-02-13T11:04:28 | 121,356,334 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,294 | cc | // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the BTRCENSE file. See the AUTHORS file for names of contributors.
#include <string.h>
#include "util/coding.h"
#include "util/hash.h"
// The FALLTHROUGH_INTENDED macro can be used to annotate implicit fall-through
// between switch labels. The real definition should be provided externally.
// This one is a fallback version for unsupported compilers.
#ifndef FALLTHROUGH_INTENDED
#define FALLTHROUGH_INTENDED do { } while (0)
#endif
namespace leveldb {
uint32_t Hash(const char* data, size_t n, uint32_t seed) {
// Similar to murmur hash
const uint32_t m = 0xc6a4a793;
const uint32_t r = 24;
const char* limit = data + n;
uint32_t h = seed ^ (n * m);
// Pick up four bytes at a time
while (data + 4 <= limit) {
uint32_t w = DecodeFixed32(data);
data += 4;
h += w;
h *= m;
h ^= (h >> 16);
}
// Pick up remaining bytes
switch (limit - data) {
case 3:
h += data[2] << 16;
FALLTHROUGH_INTENDED;
case 2:
h += data[1] << 8;
FALLTHROUGH_INTENDED;
case 1:
h += data[0];
h *= m;
h ^= (h >> r);
break;
}
return h;
}
} // namespace leveldb
| [
"bitredgroup@gmail.com"
] | bitredgroup@gmail.com |
992f4db6798f4c296d6ac0bf9a57f4b48cd09d03 | 7741caceff805e78823444baa9a09ea8474dd202 | /Synthesizer/ADLplug/sources/ui/components/styled_knobs.h | 3ed1f1776d8e322fd0edb6d4242df1ddbb81d086 | [
"LicenseRef-scancode-unknown-license-reference",
"BSL-1.0"
] | permissive | radtek/ZimReader | 99ff5d156062538786fc9343e5d17385ae4be006 | 13f189707a78ebc3c0e553fa512417ff673a5bee | refs/heads/master | 2023-02-17T07:55:26.562832 | 2021-01-08T07:11:22 | 2021-01-08T07:11:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,885 | h | // Copyright Jean Pierre Cimalando 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#pragma once
#include "ui/components/knob_component.h"
#include "ui/utility/knobman_skin.h"
#define EACH_STYLED_KNOB(F, ...) \
F(Knob_Default, ##__VA_ARGS__) \
F(Knob_DefaultSmall, ##__VA_ARGS__) \
F(Slider_Default, ##__VA_ARGS__) \
F(Slider_DefaultSmall, ##__VA_ARGS__)
class Styled_Knob_Default : public Knob
{
public:
Styled_Knob_Default() { set_skin(style_skin()); }
static Km_Skin *style_skin();
static void release_skin() { skin_ = nullptr; }
private:
static Km_Skin_Ptr skin_;
};
//------------------------------------------------------------------------------
class Styled_Knob_DefaultSmall : public Knob
{
public:
Styled_Knob_DefaultSmall() { set_skin(style_skin()); }
static Km_Skin *style_skin();
static void release_skin() { skin_ = nullptr; }
private:
static Km_Skin_Ptr skin_;
};
//------------------------------------------------------------------------------
class Styled_Slider_Default : public Knob
{
public:
Styled_Slider_Default() { set_skin(style_skin()); }
static Km_Skin *style_skin();
static void release_skin() { skin_ = nullptr; }
private:
static Km_Skin_Ptr skin_;
};
//------------------------------------------------------------------------------
class Styled_Slider_DefaultSmall : public Knob
{
public:
Styled_Slider_DefaultSmall() { set_skin(style_skin()); }
static Km_Skin *style_skin();
static void release_skin() { skin_ = nullptr; }
private:
static Km_Skin_Ptr skin_;
};
//------------------------------------------------------------------------------
namespace Styled_Knobs
{
void release_skins();
};
| [
"jndev_zch0218@outlook.com"
] | jndev_zch0218@outlook.com |
0a21fd5ff6031f2ab3c29e3c03459e8bb6ad87df | 3b9b4049a8e7d38b49e07bb752780b2f1d792851 | /src/third_party/skia/gm/imagefiltersgraph.cpp | 0f3dcd10c9cd942e3d4a51735e77d0f9717dde3e | [
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-public-domain"
] | permissive | webosce/chromium53 | f8e745e91363586aee9620c609aacf15b3261540 | 9171447efcf0bb393d41d1dc877c7c13c46d8e38 | refs/heads/webosce | 2020-03-26T23:08:14.416858 | 2018-08-23T08:35:17 | 2018-09-20T14:25:18 | 145,513,343 | 0 | 2 | Apache-2.0 | 2019-08-21T22:44:55 | 2018-08-21T05:52:31 | null | UTF-8 | C++ | false | false | 8,888 | cpp | /*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "gm.h"
#include "SkArithmeticMode.h"
#include "SkBlurImageFilter.h"
#include "SkColorFilter.h"
#include "SkColorFilterImageFilter.h"
#include "SkColorMatrixFilter.h"
#include "SkImage.h"
#include "SkImageSource.h"
#include "SkMatrixConvolutionImageFilter.h"
#include "SkOffsetImageFilter.h"
#include "SkReadBuffer.h"
#include "SkSpecialImage.h"
#include "SkSpecialSurface.h"
#include "SkWriteBuffer.h"
#include "SkMergeImageFilter.h"
#include "SkMorphologyImageFilter.h"
#include "SkXfermodeImageFilter.h"
class ImageFiltersGraphGM : public skiagm::GM {
public:
ImageFiltersGraphGM() {}
protected:
SkString onShortName() override {
return SkString("imagefiltersgraph");
}
SkISize onISize() override { return SkISize::Make(600, 150); }
void onOnceBeforeDraw() override {
fImage = SkImage::MakeFromBitmap(
sk_tool_utils::create_string_bitmap(100, 100, SK_ColorWHITE, 20, 70, 96, "e"));
}
void onDraw(SkCanvas* canvas) override {
canvas->clear(SK_ColorBLACK);
{
sk_sp<SkImageFilter> bitmapSource(SkImageSource::Make(fImage));
sk_sp<SkColorFilter> cf(SkColorFilter::MakeModeFilter(SK_ColorRED,
SkXfermode::kSrcIn_Mode));
sk_sp<SkImageFilter> blur(SkBlurImageFilter::Make(4.0f, 4.0f, std::move(bitmapSource)));
sk_sp<SkImageFilter> erode(SkErodeImageFilter::Make(4, 4, blur));
sk_sp<SkImageFilter> color(SkColorFilterImageFilter::Make(std::move(cf),
std::move(erode)));
sk_sp<SkImageFilter> merge(SkMergeImageFilter::Make(blur, color));
SkPaint paint;
paint.setImageFilter(std::move(merge));
canvas->drawPaint(paint);
canvas->translate(SkIntToScalar(100), 0);
}
{
sk_sp<SkImageFilter> morph(SkDilateImageFilter::Make(5, 5, nullptr));
SkScalar matrix[20] = { SK_Scalar1, 0, 0, 0, 0,
0, SK_Scalar1, 0, 0, 0,
0, 0, SK_Scalar1, 0, 0,
0, 0, 0, 0.5f, 0 };
sk_sp<SkColorFilter> matrixFilter(SkColorFilter::MakeMatrixFilterRowMajor255(matrix));
sk_sp<SkImageFilter> colorMorph(SkColorFilterImageFilter::Make(std::move(matrixFilter),
std::move(morph)));
SkPaint paint;
paint.setImageFilter(SkXfermodeImageFilter::Make(
SkXfermode::Make(SkXfermode::kSrcOver_Mode),
std::move(colorMorph)));
DrawClippedImage(canvas, fImage.get(), paint);
canvas->translate(SkIntToScalar(100), 0);
}
{
SkScalar matrix[20] = { SK_Scalar1, 0, 0, 0, 0,
0, SK_Scalar1, 0, 0, 0,
0, 0, SK_Scalar1, 0, 0,
0, 0, 0, 0.5f, 0 };
sk_sp<SkColorFilter> matrixCF(SkColorFilter::MakeMatrixFilterRowMajor255(matrix));
sk_sp<SkImageFilter> matrixFilter(SkColorFilterImageFilter::Make(std::move(matrixCF),
nullptr));
sk_sp<SkImageFilter> offsetFilter(SkOffsetImageFilter::Make(10.0f, 10.f,
matrixFilter));
SkPaint paint;
paint.setImageFilter(
SkXfermodeImageFilter::Make(SkArithmeticMode::Make(0, SK_Scalar1, SK_Scalar1, 0),
std::move(matrixFilter),
std::move(offsetFilter),
nullptr));
DrawClippedImage(canvas, fImage.get(), paint);
canvas->translate(SkIntToScalar(100), 0);
}
{
sk_sp<SkImageFilter> blur(SkBlurImageFilter::Make(SkIntToScalar(10),
SkIntToScalar(10),
nullptr));
SkImageFilter::CropRect cropRect(SkRect::MakeWH(SkIntToScalar(95), SkIntToScalar(100)));
SkPaint paint;
paint.setImageFilter(
SkXfermodeImageFilter::Make(SkXfermode::Make(SkXfermode::kSrcIn_Mode),
std::move(blur),
nullptr, &cropRect));
DrawClippedImage(canvas, fImage.get(), paint);
canvas->translate(SkIntToScalar(100), 0);
}
{
// Dilate -> matrix convolution.
// This tests that a filter using asFragmentProcessor (matrix
// convolution) correctly handles a non-zero source offset
// (supplied by the dilate).
sk_sp<SkImageFilter> dilate(SkDilateImageFilter::Make(5, 5, nullptr));
SkScalar kernel[9] = {
SkIntToScalar(-1), SkIntToScalar( -1 ), SkIntToScalar(-1),
SkIntToScalar(-1), SkIntToScalar( 7 ), SkIntToScalar(-1),
SkIntToScalar(-1), SkIntToScalar( -1 ), SkIntToScalar(-1),
};
SkISize kernelSize = SkISize::Make(3, 3);
SkScalar gain = 1.0f, bias = SkIntToScalar(0);
SkIPoint kernelOffset = SkIPoint::Make(1, 1);
auto tileMode = SkMatrixConvolutionImageFilter::kClamp_TileMode;
bool convolveAlpha = false;
sk_sp<SkImageFilter> convolve(SkMatrixConvolutionImageFilter::Make(kernelSize,
kernel,
gain,
bias,
kernelOffset,
tileMode,
convolveAlpha,
std::move(dilate)));
SkPaint paint;
paint.setImageFilter(std::move(convolve));
DrawClippedImage(canvas, fImage.get(), paint);
canvas->translate(SkIntToScalar(100), 0);
}
{
// Test that crop offsets are absolute, not relative to the parent's crop rect.
sk_sp<SkColorFilter> cf1(SkColorFilter::MakeModeFilter(SK_ColorBLUE,
SkXfermode::kSrcIn_Mode));
sk_sp<SkColorFilter> cf2(SkColorFilter::MakeModeFilter(SK_ColorGREEN,
SkXfermode::kSrcIn_Mode));
SkImageFilter::CropRect outerRect(SkRect::MakeXYWH(SkIntToScalar(10), SkIntToScalar(10),
SkIntToScalar(80), SkIntToScalar(80)));
SkImageFilter::CropRect innerRect(SkRect::MakeXYWH(SkIntToScalar(20), SkIntToScalar(20),
SkIntToScalar(60), SkIntToScalar(60)));
sk_sp<SkImageFilter> color1(SkColorFilterImageFilter::Make(std::move(cf1),
nullptr,
&outerRect));
sk_sp<SkImageFilter> color2(SkColorFilterImageFilter::Make(std::move(cf2),
std::move(color1),
&innerRect));
SkPaint paint;
paint.setImageFilter(std::move(color2));
paint.setColor(SK_ColorRED);
canvas->drawRect(SkRect::MakeXYWH(0, 0, 100, 100), paint);
canvas->translate(SkIntToScalar(100), 0);
}
}
private:
static void DrawClippedImage(SkCanvas* canvas, const SkImage* image, const SkPaint& paint) {
canvas->save();
canvas->clipRect(SkRect::MakeIWH(image->width(), image->height()));
canvas->drawImage(image, 0, 0, &paint);
canvas->restore();
}
sk_sp<SkImage> fImage;
typedef GM INHERITED;
};
///////////////////////////////////////////////////////////////////////////////
DEF_GM(return new ImageFiltersGraphGM;)
| [
"changhyeok.bae@lge.com"
] | changhyeok.bae@lge.com |
14bbc9ce9ea650bf1403e45a1ac837826f365232 | 6aeccfb60568a360d2d143e0271f0def40747d73 | /sandbox/icl/libs/xplore/value_sem/TreeSync1/TreeSync1/Syncable/Syncable_Concept.h | 2d2904ea175a72e410e42a864c5fe993e06e06c1 | [
"BSL-1.0"
] | permissive | ttyang/sandbox | 1066b324a13813cb1113beca75cdaf518e952276 | e1d6fde18ced644bb63e231829b2fe0664e51fac | refs/heads/trunk | 2021-01-19T17:17:47.452557 | 2013-06-07T14:19:55 | 2013-06-07T14:19:55 | 13,488,698 | 1 | 3 | null | 2023-03-20T11:52:19 | 2013-10-11T03:08:51 | C++ | UTF-8 | C++ | false | false | 1,379 | h | #pragma once
#include <boost/utility/enable_if.hpp>
#include "Syncable/Syncable_ModeledBy.h"
template<class Model>
typename boost::enable_if<Syncable_ModeledBy<Model>,
typename Syncable_ModeledBy<Model>::Uuid>::type uuid(Model const& object)
{
return Syncable_ModeledBy<Model>::uuid(object);
}
template<class Model>
typename boost::enable_if<Syncable_ModeledBy<Model>,
typename Syncable_ModeledBy<Model>::Time>::type time(Model const& object)
{
return Syncable_ModeledBy<Model>::time(object);
}
template<class Model>
typename boost::enable_if<Syncable_ModeledBy<Model>,
bool>::type less_for_time(Model const& lhs, Model const& rhs)
{
return time(lhs) < time(rhs);
}
template<class Model>
typename boost::enable_if<Syncable_ModeledBy<Model>,
bool>::type less_for_uuid(Model const& lhs, Model const& rhs)
{
return uuid(lhs) < uuid(rhs);
}
template<class Syncable>
struct LessForUuid : std::binary_function<Syncable, Syncable, bool>
{
bool operator()(Syncable const& lhs, Syncable const& rhs)
{
return less_for_uuid(lhs, rhs);
}
};
template<class Syncable>
struct LessForTime : std::binary_function<Syncable, Syncable, bool>
{
typedef Syncable first_argument_type;
typedef Syncable second_argument_type;
bool operator()(Syncable const& lhs, Syncable const& rhs)
{
return less_for_time(lhs, rhs);
}
};
| [
"afojgo@gmail.com"
] | afojgo@gmail.com |
2b016502c7ce368e33a4d01f590019c9ea2f0f96 | 6918de4691487ea98e3f8d7e38d81cd09fc4cd0a | /rational/rational.cpp | a8b50be70249872bb8673d2b51cb7e8bb7fc9637 | [] | no_license | ababkina/babkina_alena | 3855ccf85e1a5d2a2146a9297b2ed845380ac2e5 | d24340ec90f7488a36c4b6d1c69d9af0ec57d68f | refs/heads/master | 2021-09-01T12:19:36.199842 | 2017-12-27T00:10:25 | 2017-12-27T00:10:25 | 108,102,184 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 362 | cpp | #include <iostream>
#include "rational.h"
Rational::Rational(const int num) : Rational(num, 1) { }
Rational::Rational(const int numerator, const int denominator) : num(numerator), denom(denominator)
{
if (0 == denom) {}
}
Rational& Rational:: operator+=(const Rational& rhs)
{
num += rhs.num;
denom += rhs.denom;
return *this;
} | [
"noreply@github.com"
] | ababkina.noreply@github.com |
c56451158c0aa595731fc8fd8471d85d2be65cb8 | b23178522514773cd0cced4af05e618a08112b34 | /tools/cfg/include/oneflow/cfg/map_field.h | 04168bcf68cef593030b5ba21d3a6ca40a1275fb | [
"Apache-2.0"
] | permissive | gvvynplaine/oneflow | 94a1bb3ea405bc93228acc6073dde1cb51b61b61 | b99a4aa91b5686a4c31fe64d9436b0355cc691cb | refs/heads/master | 2023-01-02T01:23:08.488126 | 2020-10-31T01:54:52 | 2020-10-31T01:54:52 | 308,883,220 | 0 | 0 | Apache-2.0 | 2020-10-31T13:03:28 | 2020-10-31T13:03:19 | null | UTF-8 | C++ | false | false | 3,913 | h | #ifndef ONEFLOW_CFG_MAP_FIELD_H_
#define ONEFLOW_CFG_MAP_FIELD_H_
#include <map>
#include <string>
#include <memory>
#include <type_traits>
namespace oneflow {
namespace cfg {
template<typename Key, typename T>
class _MapField_ {
public:
static_assert(std::is_nothrow_move_constructible<T>::value, "");
using key_type = typename std::map<Key, T>::key_type;
using mapped_type = typename std::map<Key, T>::mapped_type;
using value_type = typename std::map<Key, T>::value_type;
using size_type = typename std::map<Key, T>::size_type;
using difference_type = typename std::map<Key, T>::difference_type;
using reference = typename std::map<Key, T>::reference;
using const_reference = typename std::map<Key, T>::const_reference;
using pointer = typename std::map<Key, T>::pointer;
using const_pointer = typename std::map<Key, T>::const_pointer;
using iterator = typename std::map<Key, T>::iterator;
using const_iterator = typename std::map<Key, T>::const_iterator;
using reverse_iterator = typename std::map<Key, T>::reverse_iterator;
using const_reverse_iterator = typename std::map<Key, T>::const_reverse_iterator;
_MapField_(): data_(std::make_shared<std::map<Key, T>>()) {}
_MapField_(const std::shared_ptr<std::map<Key, T>>& data): data_(data) {}
_MapField_(const _MapField_& other): data_(std::make_shared<std::map<Key, T>>()) {
CopyFrom(other);
}
_MapField_(_MapField_&&) = default;
template<typename InputIt>
_MapField_(InputIt begin, InputIt end): data_(std::make_shared<std::map<Key, T>>(begin, end)) {}
~_MapField_() = default;
iterator begin() noexcept { return data_->begin(); }
const_iterator begin() const noexcept { return data_->begin(); }
const_iterator cbegin() const noexcept { return data_->cbegin(); }
iterator end() noexcept { return data_->end(); }
const_iterator end() const noexcept { return data_->end(); }
const_iterator cend() const noexcept { return data_->cend(); }
reverse_iterator rbegin() noexcept { return reverse_iterator(end()); }
const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); }
const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(cend()); }
reverse_iterator rend() noexcept { return reverse_iterator(begin()); }
const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); }
const_reverse_iterator crend() const noexcept { return const_reverse_iterator(cbegin()); }
bool empty() const { return data_->empty(); }
size_type size() const { return data_->size(); }
T& at(const Key& key) { return data_->at(key); }
const T& at(const Key& key) const { return data_->at(key); }
T& operator[](const Key& key) { return (*data_)[key]; }
const T& operator[](const Key& key) const { return (*data_)[key]; }
const_iterator find(const Key& key) const { return data_->find(key); }
iterator find(const Key& key) { return data_->find(key); }
int count(const Key& key) const { return data_->count(key); }
size_type erase(const Key& key) { return data_->erase(key); }
iterator erase(const_iterator pos) { return data_->erase(pos); }
iterator erase(const_iterator first, const_iterator last) { return data_->erase(first, last); }
std::pair<iterator, bool> insert(const value_type& value) { return data_->insert(value); }
template<class InputIt>
void insert(InputIt first, InputIt last) { return data_->insert(first, last); }
void Clear() { data_->clear(); }
void CopyFrom(const _MapField_& other) {
*data_ = *other.data_;
}
_MapField_& operator=(const _MapField_& other) {
CopyFrom(other);
return *this;
}
const std::shared_ptr<std::map<Key, T>>& __SharedPtr__() const { return data_; }
const std::shared_ptr<std::map<Key, T>>& __SharedPtr__() { return data_; }
private:
std::shared_ptr<std::map<Key, T>> data_;
};
}
}
#endif // ONEFLOW_CFG_MAP_FIELD_H_
| [
"noreply@github.com"
] | gvvynplaine.noreply@github.com |
939e8dbba21462b94b29978f2445ed019100d0f8 | 0a8b9cf51ee8554ceb829ce0cef91004048683c8 | /MoltenVKShaderConverter/MoltenVKShaderConverter/FileSupport.h | 3c74d402a749cc241a9ce02c23f942984b0f5e55 | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | elix22/MoltenVK | 40ab74ae6a82687488c7ed821a1fb91f86abe1b5 | 9366457b86831a6b67d44caf45440043e635eef4 | refs/heads/master | 2022-02-15T22:55:40.369464 | 2022-01-19T22:06:15 | 2022-01-19T22:06:15 | 173,045,148 | 0 | 0 | Apache-2.0 | 2019-02-28T05:12:24 | 2019-02-28T05:12:24 | null | UTF-8 | C++ | false | false | 2,989 | h | /*
* FileSupport.h
*
* Copyright (c) 2015-2021 The Brenwill Workshop Ltd. (http://www.brenwill.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <string>
#include <vector>
namespace mvk {
/** Returns an absolute path from the specified path, which may be absolute or relative. */
std::string absolutePath(const std::string& path);
/** Returns the file name from the path, with or without the file extension. */
std::string fileName(const std::string& path, bool includeExtenison = true);
/** Returns the extension component (after the .) of the specified path. */
std::string pathExtension(const std::string& path);
/** Returns whether the specified path exists and is a readable file. */
bool canReadFile(const std::string& path);
/** Returns whether the specified path is a file that is writable. */
bool canWriteFile(const std::string& path);
/**
* Returns a copy of the specified path, with the extension of the path set or changed
* to the specified extension. If includeOrigPathExtn is true, the original file extension
* of the path will be appended to the file name (before the new separator), separated
* by origPathExtnSep string (eg. myshader.vsh -> myshader_vsh.spv).
*/
std::string pathWithExtension(const std::string& path,
const std::string pathExtn,
bool includeOrigPathExtn,
const std::string origPathExtnSep);
/**
* Reads the contents of the specified file path into the specified contents vector.
* and returns whether the file read was successful.
*
* If successful, copies the file contents into the contents vector and returns true.
* If unsuccessful, places an explanatory error message in the errMsg string and returns false.
* If file was partially read, copies what could be read into the contents vector, places an
* error message in errMsg, and returns false.
*/
bool readFile(const std::string& path, std::vector<char>& contents, std::string& errMsg);
/**
* Writes the contents of the specified contents string to the file in the specified file
* path, creating the file if necessary, and returns whether the file write was successful.
*
* If successful, overwrites the entire contents of the file and returns true.
* If unsuccessful, places an explanatory error message in the errMsg string and returns false.
*/
bool writeFile(const std::string& path, const std::vector<char>& contents, std::string& errMsg);
}
| [
"bill.hollings@brenwill.com"
] | bill.hollings@brenwill.com |
9a6009fa446b7b49c63e6351a81ee13a5c76cb7e | 430de1f93d90cea7217cccf9363f2d56ec4fd800 | /graphics_scene-animation/animation/animationTraj.h | 6e11e89881bd121c301222440a723bc199cfd5e3 | [] | no_license | Zertos10/cahier_de_jeu_defin | 03834f316b05c3f39eb43bdbc25ce423a82e36c6 | 46ea26daa04f57b1bdb05f88fe61687fc2c60758 | refs/heads/main | 2023-05-31T11:11:24.048014 | 2021-06-08T18:31:10 | 2021-06-08T18:31:10 | 375,106,659 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 852 | h | #ifndef ANIMATIONTRAJ_H
#define ANIMATIONTRAJ_H
#include <QWidget>
#include <QParallelAnimationGroup>
#include <QSequentialAnimationGroup>
#include <QPropertyAnimation>
#include "graphics_scene-animation/animation/confAnimation.h"
#include <QDebug>
#include <QAnimationGroup>
class AnimationTraj : public QObject
{
Q_OBJECT
public:
AnimationTraj(QVector<CreateAnimation*> *listPlayer);
AnimationTraj();
//Trajet de l'animation
void breakAnimation(int ms);
void stopAnimation();
double count();
void setListFramePlayerAnimation(QVector<CreateAnimation*> *listPlayer);
void startAnimation();
public slots:
void depTimeLineChanged();
void createAnimation();
private:
QTimer *timer ;
QVector<CreateAnimation*>* listPlayer;
int size = 0;
int compteur = 0;
};
#endif // ANIMATIONTRAJ_H
| [
"noreply@github.com"
] | Zertos10.noreply@github.com |
5ad44dfb9f04bc78c7621938e7ebf56229734453 | 99dce8019f290ac1b492eae177759b437b99e292 | /src/ErrnoException.h | a801972430a4643c75498b962df65828f2fe3262 | [
"MIT"
] | permissive | the-reverend/rpw.core | f1ce4adfb24a91384c112e55aa84400a1b14bd32 | 8eab10e8676f82b0e7417310709e2e9868b93cbb | refs/heads/master | 2016-09-13T20:27:16.608560 | 2016-04-17T00:53:45 | 2016-04-17T01:05:40 | 56,412,441 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 568 | h | /// @file ErrnoException.h
/// @author rev
#pragma once
#include <stdexcept>
#include <string>
namespace RPW
{
namespace Core
{
class ErrnoException : public std::runtime_error
{
public:
ErrnoException( errno_t errNo );
virtual ~ErrnoException( void );
int errNo( void );
virtual std::string shortErrorText( void );
std::string longErrorText( void ) const;
static std::string getShortErrorText( int errNo );
static std::string getLongErrorText( int errNo );
static errno_t getErrNo();
protected:
errno_t m_errNo;
};
}
}
| [
"ronaldpwilson@gmail.com"
] | ronaldpwilson@gmail.com |
cf35a801c79dfd845c934d0e14e1215d4f21bdb1 | d939ea588d1b215261b92013e050993b21651f9a | /tcr/src/v20190924/TcrClient.cpp | 29f669711ac5b9911ce45302a45706a133fdbfa9 | [
"Apache-2.0"
] | permissive | chenxx98/tencentcloud-sdk-cpp | 374e6d1349f8992893ded7aa08f911dd281f1bda | a9e75d321d96504bc3437300d26e371f5f4580a0 | refs/heads/master | 2023-03-27T05:35:50.158432 | 2021-03-26T05:18:10 | 2021-03-26T05:18:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 116,677 | cpp | /*
* 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/tcr/v20190924/TcrClient.h>
#include <tencentcloud/core/Executor.h>
#include <tencentcloud/core/Runnable.h>
using namespace TencentCloud;
using namespace TencentCloud::Tcr::V20190924;
using namespace TencentCloud::Tcr::V20190924::Model;
using namespace std;
namespace
{
const string VERSION = "2019-09-24";
const string ENDPOINT = "tcr.tencentcloudapi.com";
}
TcrClient::TcrClient(const Credential &credential, const string ®ion) :
TcrClient(credential, region, ClientProfile())
{
}
TcrClient::TcrClient(const Credential &credential, const string ®ion, const ClientProfile &profile) :
AbstractClient(ENDPOINT, VERSION, credential, region, profile)
{
}
TcrClient::BatchDeleteImagePersonalOutcome TcrClient::BatchDeleteImagePersonal(const BatchDeleteImagePersonalRequest &request)
{
auto outcome = MakeRequest(request, "BatchDeleteImagePersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
BatchDeleteImagePersonalResponse rsp = BatchDeleteImagePersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return BatchDeleteImagePersonalOutcome(rsp);
else
return BatchDeleteImagePersonalOutcome(o.GetError());
}
else
{
return BatchDeleteImagePersonalOutcome(outcome.GetError());
}
}
void TcrClient::BatchDeleteImagePersonalAsync(const BatchDeleteImagePersonalRequest& request, const BatchDeleteImagePersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->BatchDeleteImagePersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::BatchDeleteImagePersonalOutcomeCallable TcrClient::BatchDeleteImagePersonalCallable(const BatchDeleteImagePersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<BatchDeleteImagePersonalOutcome()>>(
[this, request]()
{
return this->BatchDeleteImagePersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::BatchDeleteRepositoryPersonalOutcome TcrClient::BatchDeleteRepositoryPersonal(const BatchDeleteRepositoryPersonalRequest &request)
{
auto outcome = MakeRequest(request, "BatchDeleteRepositoryPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
BatchDeleteRepositoryPersonalResponse rsp = BatchDeleteRepositoryPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return BatchDeleteRepositoryPersonalOutcome(rsp);
else
return BatchDeleteRepositoryPersonalOutcome(o.GetError());
}
else
{
return BatchDeleteRepositoryPersonalOutcome(outcome.GetError());
}
}
void TcrClient::BatchDeleteRepositoryPersonalAsync(const BatchDeleteRepositoryPersonalRequest& request, const BatchDeleteRepositoryPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->BatchDeleteRepositoryPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::BatchDeleteRepositoryPersonalOutcomeCallable TcrClient::BatchDeleteRepositoryPersonalCallable(const BatchDeleteRepositoryPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<BatchDeleteRepositoryPersonalOutcome()>>(
[this, request]()
{
return this->BatchDeleteRepositoryPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::CheckInstanceNameOutcome TcrClient::CheckInstanceName(const CheckInstanceNameRequest &request)
{
auto outcome = MakeRequest(request, "CheckInstanceName");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CheckInstanceNameResponse rsp = CheckInstanceNameResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CheckInstanceNameOutcome(rsp);
else
return CheckInstanceNameOutcome(o.GetError());
}
else
{
return CheckInstanceNameOutcome(outcome.GetError());
}
}
void TcrClient::CheckInstanceNameAsync(const CheckInstanceNameRequest& request, const CheckInstanceNameAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->CheckInstanceName(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::CheckInstanceNameOutcomeCallable TcrClient::CheckInstanceNameCallable(const CheckInstanceNameRequest &request)
{
auto task = std::make_shared<std::packaged_task<CheckInstanceNameOutcome()>>(
[this, request]()
{
return this->CheckInstanceName(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::CreateApplicationTriggerPersonalOutcome TcrClient::CreateApplicationTriggerPersonal(const CreateApplicationTriggerPersonalRequest &request)
{
auto outcome = MakeRequest(request, "CreateApplicationTriggerPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CreateApplicationTriggerPersonalResponse rsp = CreateApplicationTriggerPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CreateApplicationTriggerPersonalOutcome(rsp);
else
return CreateApplicationTriggerPersonalOutcome(o.GetError());
}
else
{
return CreateApplicationTriggerPersonalOutcome(outcome.GetError());
}
}
void TcrClient::CreateApplicationTriggerPersonalAsync(const CreateApplicationTriggerPersonalRequest& request, const CreateApplicationTriggerPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->CreateApplicationTriggerPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::CreateApplicationTriggerPersonalOutcomeCallable TcrClient::CreateApplicationTriggerPersonalCallable(const CreateApplicationTriggerPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<CreateApplicationTriggerPersonalOutcome()>>(
[this, request]()
{
return this->CreateApplicationTriggerPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::CreateImageLifecyclePersonalOutcome TcrClient::CreateImageLifecyclePersonal(const CreateImageLifecyclePersonalRequest &request)
{
auto outcome = MakeRequest(request, "CreateImageLifecyclePersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CreateImageLifecyclePersonalResponse rsp = CreateImageLifecyclePersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CreateImageLifecyclePersonalOutcome(rsp);
else
return CreateImageLifecyclePersonalOutcome(o.GetError());
}
else
{
return CreateImageLifecyclePersonalOutcome(outcome.GetError());
}
}
void TcrClient::CreateImageLifecyclePersonalAsync(const CreateImageLifecyclePersonalRequest& request, const CreateImageLifecyclePersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->CreateImageLifecyclePersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::CreateImageLifecyclePersonalOutcomeCallable TcrClient::CreateImageLifecyclePersonalCallable(const CreateImageLifecyclePersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<CreateImageLifecyclePersonalOutcome()>>(
[this, request]()
{
return this->CreateImageLifecyclePersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::CreateInstanceOutcome TcrClient::CreateInstance(const CreateInstanceRequest &request)
{
auto outcome = MakeRequest(request, "CreateInstance");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CreateInstanceResponse rsp = CreateInstanceResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CreateInstanceOutcome(rsp);
else
return CreateInstanceOutcome(o.GetError());
}
else
{
return CreateInstanceOutcome(outcome.GetError());
}
}
void TcrClient::CreateInstanceAsync(const CreateInstanceRequest& request, const CreateInstanceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->CreateInstance(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::CreateInstanceOutcomeCallable TcrClient::CreateInstanceCallable(const CreateInstanceRequest &request)
{
auto task = std::make_shared<std::packaged_task<CreateInstanceOutcome()>>(
[this, request]()
{
return this->CreateInstance(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::CreateInstanceTokenOutcome TcrClient::CreateInstanceToken(const CreateInstanceTokenRequest &request)
{
auto outcome = MakeRequest(request, "CreateInstanceToken");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CreateInstanceTokenResponse rsp = CreateInstanceTokenResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CreateInstanceTokenOutcome(rsp);
else
return CreateInstanceTokenOutcome(o.GetError());
}
else
{
return CreateInstanceTokenOutcome(outcome.GetError());
}
}
void TcrClient::CreateInstanceTokenAsync(const CreateInstanceTokenRequest& request, const CreateInstanceTokenAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->CreateInstanceToken(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::CreateInstanceTokenOutcomeCallable TcrClient::CreateInstanceTokenCallable(const CreateInstanceTokenRequest &request)
{
auto task = std::make_shared<std::packaged_task<CreateInstanceTokenOutcome()>>(
[this, request]()
{
return this->CreateInstanceToken(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::CreateInternalEndpointDnsOutcome TcrClient::CreateInternalEndpointDns(const CreateInternalEndpointDnsRequest &request)
{
auto outcome = MakeRequest(request, "CreateInternalEndpointDns");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CreateInternalEndpointDnsResponse rsp = CreateInternalEndpointDnsResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CreateInternalEndpointDnsOutcome(rsp);
else
return CreateInternalEndpointDnsOutcome(o.GetError());
}
else
{
return CreateInternalEndpointDnsOutcome(outcome.GetError());
}
}
void TcrClient::CreateInternalEndpointDnsAsync(const CreateInternalEndpointDnsRequest& request, const CreateInternalEndpointDnsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->CreateInternalEndpointDns(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::CreateInternalEndpointDnsOutcomeCallable TcrClient::CreateInternalEndpointDnsCallable(const CreateInternalEndpointDnsRequest &request)
{
auto task = std::make_shared<std::packaged_task<CreateInternalEndpointDnsOutcome()>>(
[this, request]()
{
return this->CreateInternalEndpointDns(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::CreateNamespaceOutcome TcrClient::CreateNamespace(const CreateNamespaceRequest &request)
{
auto outcome = MakeRequest(request, "CreateNamespace");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CreateNamespaceResponse rsp = CreateNamespaceResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CreateNamespaceOutcome(rsp);
else
return CreateNamespaceOutcome(o.GetError());
}
else
{
return CreateNamespaceOutcome(outcome.GetError());
}
}
void TcrClient::CreateNamespaceAsync(const CreateNamespaceRequest& request, const CreateNamespaceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->CreateNamespace(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::CreateNamespaceOutcomeCallable TcrClient::CreateNamespaceCallable(const CreateNamespaceRequest &request)
{
auto task = std::make_shared<std::packaged_task<CreateNamespaceOutcome()>>(
[this, request]()
{
return this->CreateNamespace(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::CreateNamespacePersonalOutcome TcrClient::CreateNamespacePersonal(const CreateNamespacePersonalRequest &request)
{
auto outcome = MakeRequest(request, "CreateNamespacePersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CreateNamespacePersonalResponse rsp = CreateNamespacePersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CreateNamespacePersonalOutcome(rsp);
else
return CreateNamespacePersonalOutcome(o.GetError());
}
else
{
return CreateNamespacePersonalOutcome(outcome.GetError());
}
}
void TcrClient::CreateNamespacePersonalAsync(const CreateNamespacePersonalRequest& request, const CreateNamespacePersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->CreateNamespacePersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::CreateNamespacePersonalOutcomeCallable TcrClient::CreateNamespacePersonalCallable(const CreateNamespacePersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<CreateNamespacePersonalOutcome()>>(
[this, request]()
{
return this->CreateNamespacePersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::CreateRepositoryOutcome TcrClient::CreateRepository(const CreateRepositoryRequest &request)
{
auto outcome = MakeRequest(request, "CreateRepository");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CreateRepositoryResponse rsp = CreateRepositoryResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CreateRepositoryOutcome(rsp);
else
return CreateRepositoryOutcome(o.GetError());
}
else
{
return CreateRepositoryOutcome(outcome.GetError());
}
}
void TcrClient::CreateRepositoryAsync(const CreateRepositoryRequest& request, const CreateRepositoryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->CreateRepository(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::CreateRepositoryOutcomeCallable TcrClient::CreateRepositoryCallable(const CreateRepositoryRequest &request)
{
auto task = std::make_shared<std::packaged_task<CreateRepositoryOutcome()>>(
[this, request]()
{
return this->CreateRepository(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::CreateRepositoryPersonalOutcome TcrClient::CreateRepositoryPersonal(const CreateRepositoryPersonalRequest &request)
{
auto outcome = MakeRequest(request, "CreateRepositoryPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CreateRepositoryPersonalResponse rsp = CreateRepositoryPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CreateRepositoryPersonalOutcome(rsp);
else
return CreateRepositoryPersonalOutcome(o.GetError());
}
else
{
return CreateRepositoryPersonalOutcome(outcome.GetError());
}
}
void TcrClient::CreateRepositoryPersonalAsync(const CreateRepositoryPersonalRequest& request, const CreateRepositoryPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->CreateRepositoryPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::CreateRepositoryPersonalOutcomeCallable TcrClient::CreateRepositoryPersonalCallable(const CreateRepositoryPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<CreateRepositoryPersonalOutcome()>>(
[this, request]()
{
return this->CreateRepositoryPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::CreateSecurityPolicyOutcome TcrClient::CreateSecurityPolicy(const CreateSecurityPolicyRequest &request)
{
auto outcome = MakeRequest(request, "CreateSecurityPolicy");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CreateSecurityPolicyResponse rsp = CreateSecurityPolicyResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CreateSecurityPolicyOutcome(rsp);
else
return CreateSecurityPolicyOutcome(o.GetError());
}
else
{
return CreateSecurityPolicyOutcome(outcome.GetError());
}
}
void TcrClient::CreateSecurityPolicyAsync(const CreateSecurityPolicyRequest& request, const CreateSecurityPolicyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->CreateSecurityPolicy(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::CreateSecurityPolicyOutcomeCallable TcrClient::CreateSecurityPolicyCallable(const CreateSecurityPolicyRequest &request)
{
auto task = std::make_shared<std::packaged_task<CreateSecurityPolicyOutcome()>>(
[this, request]()
{
return this->CreateSecurityPolicy(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::CreateUserPersonalOutcome TcrClient::CreateUserPersonal(const CreateUserPersonalRequest &request)
{
auto outcome = MakeRequest(request, "CreateUserPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CreateUserPersonalResponse rsp = CreateUserPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CreateUserPersonalOutcome(rsp);
else
return CreateUserPersonalOutcome(o.GetError());
}
else
{
return CreateUserPersonalOutcome(outcome.GetError());
}
}
void TcrClient::CreateUserPersonalAsync(const CreateUserPersonalRequest& request, const CreateUserPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->CreateUserPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::CreateUserPersonalOutcomeCallable TcrClient::CreateUserPersonalCallable(const CreateUserPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<CreateUserPersonalOutcome()>>(
[this, request]()
{
return this->CreateUserPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::CreateWebhookTriggerOutcome TcrClient::CreateWebhookTrigger(const CreateWebhookTriggerRequest &request)
{
auto outcome = MakeRequest(request, "CreateWebhookTrigger");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
CreateWebhookTriggerResponse rsp = CreateWebhookTriggerResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return CreateWebhookTriggerOutcome(rsp);
else
return CreateWebhookTriggerOutcome(o.GetError());
}
else
{
return CreateWebhookTriggerOutcome(outcome.GetError());
}
}
void TcrClient::CreateWebhookTriggerAsync(const CreateWebhookTriggerRequest& request, const CreateWebhookTriggerAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->CreateWebhookTrigger(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::CreateWebhookTriggerOutcomeCallable TcrClient::CreateWebhookTriggerCallable(const CreateWebhookTriggerRequest &request)
{
auto task = std::make_shared<std::packaged_task<CreateWebhookTriggerOutcome()>>(
[this, request]()
{
return this->CreateWebhookTrigger(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DeleteApplicationTriggerPersonalOutcome TcrClient::DeleteApplicationTriggerPersonal(const DeleteApplicationTriggerPersonalRequest &request)
{
auto outcome = MakeRequest(request, "DeleteApplicationTriggerPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteApplicationTriggerPersonalResponse rsp = DeleteApplicationTriggerPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteApplicationTriggerPersonalOutcome(rsp);
else
return DeleteApplicationTriggerPersonalOutcome(o.GetError());
}
else
{
return DeleteApplicationTriggerPersonalOutcome(outcome.GetError());
}
}
void TcrClient::DeleteApplicationTriggerPersonalAsync(const DeleteApplicationTriggerPersonalRequest& request, const DeleteApplicationTriggerPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DeleteApplicationTriggerPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DeleteApplicationTriggerPersonalOutcomeCallable TcrClient::DeleteApplicationTriggerPersonalCallable(const DeleteApplicationTriggerPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<DeleteApplicationTriggerPersonalOutcome()>>(
[this, request]()
{
return this->DeleteApplicationTriggerPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DeleteImageOutcome TcrClient::DeleteImage(const DeleteImageRequest &request)
{
auto outcome = MakeRequest(request, "DeleteImage");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteImageResponse rsp = DeleteImageResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteImageOutcome(rsp);
else
return DeleteImageOutcome(o.GetError());
}
else
{
return DeleteImageOutcome(outcome.GetError());
}
}
void TcrClient::DeleteImageAsync(const DeleteImageRequest& request, const DeleteImageAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DeleteImage(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DeleteImageOutcomeCallable TcrClient::DeleteImageCallable(const DeleteImageRequest &request)
{
auto task = std::make_shared<std::packaged_task<DeleteImageOutcome()>>(
[this, request]()
{
return this->DeleteImage(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DeleteImageLifecycleGlobalPersonalOutcome TcrClient::DeleteImageLifecycleGlobalPersonal(const DeleteImageLifecycleGlobalPersonalRequest &request)
{
auto outcome = MakeRequest(request, "DeleteImageLifecycleGlobalPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteImageLifecycleGlobalPersonalResponse rsp = DeleteImageLifecycleGlobalPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteImageLifecycleGlobalPersonalOutcome(rsp);
else
return DeleteImageLifecycleGlobalPersonalOutcome(o.GetError());
}
else
{
return DeleteImageLifecycleGlobalPersonalOutcome(outcome.GetError());
}
}
void TcrClient::DeleteImageLifecycleGlobalPersonalAsync(const DeleteImageLifecycleGlobalPersonalRequest& request, const DeleteImageLifecycleGlobalPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DeleteImageLifecycleGlobalPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DeleteImageLifecycleGlobalPersonalOutcomeCallable TcrClient::DeleteImageLifecycleGlobalPersonalCallable(const DeleteImageLifecycleGlobalPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<DeleteImageLifecycleGlobalPersonalOutcome()>>(
[this, request]()
{
return this->DeleteImageLifecycleGlobalPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DeleteImageLifecyclePersonalOutcome TcrClient::DeleteImageLifecyclePersonal(const DeleteImageLifecyclePersonalRequest &request)
{
auto outcome = MakeRequest(request, "DeleteImageLifecyclePersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteImageLifecyclePersonalResponse rsp = DeleteImageLifecyclePersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteImageLifecyclePersonalOutcome(rsp);
else
return DeleteImageLifecyclePersonalOutcome(o.GetError());
}
else
{
return DeleteImageLifecyclePersonalOutcome(outcome.GetError());
}
}
void TcrClient::DeleteImageLifecyclePersonalAsync(const DeleteImageLifecyclePersonalRequest& request, const DeleteImageLifecyclePersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DeleteImageLifecyclePersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DeleteImageLifecyclePersonalOutcomeCallable TcrClient::DeleteImageLifecyclePersonalCallable(const DeleteImageLifecyclePersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<DeleteImageLifecyclePersonalOutcome()>>(
[this, request]()
{
return this->DeleteImageLifecyclePersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DeleteImagePersonalOutcome TcrClient::DeleteImagePersonal(const DeleteImagePersonalRequest &request)
{
auto outcome = MakeRequest(request, "DeleteImagePersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteImagePersonalResponse rsp = DeleteImagePersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteImagePersonalOutcome(rsp);
else
return DeleteImagePersonalOutcome(o.GetError());
}
else
{
return DeleteImagePersonalOutcome(outcome.GetError());
}
}
void TcrClient::DeleteImagePersonalAsync(const DeleteImagePersonalRequest& request, const DeleteImagePersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DeleteImagePersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DeleteImagePersonalOutcomeCallable TcrClient::DeleteImagePersonalCallable(const DeleteImagePersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<DeleteImagePersonalOutcome()>>(
[this, request]()
{
return this->DeleteImagePersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DeleteInstanceOutcome TcrClient::DeleteInstance(const DeleteInstanceRequest &request)
{
auto outcome = MakeRequest(request, "DeleteInstance");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteInstanceResponse rsp = DeleteInstanceResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteInstanceOutcome(rsp);
else
return DeleteInstanceOutcome(o.GetError());
}
else
{
return DeleteInstanceOutcome(outcome.GetError());
}
}
void TcrClient::DeleteInstanceAsync(const DeleteInstanceRequest& request, const DeleteInstanceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DeleteInstance(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DeleteInstanceOutcomeCallable TcrClient::DeleteInstanceCallable(const DeleteInstanceRequest &request)
{
auto task = std::make_shared<std::packaged_task<DeleteInstanceOutcome()>>(
[this, request]()
{
return this->DeleteInstance(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DeleteInstanceTokenOutcome TcrClient::DeleteInstanceToken(const DeleteInstanceTokenRequest &request)
{
auto outcome = MakeRequest(request, "DeleteInstanceToken");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteInstanceTokenResponse rsp = DeleteInstanceTokenResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteInstanceTokenOutcome(rsp);
else
return DeleteInstanceTokenOutcome(o.GetError());
}
else
{
return DeleteInstanceTokenOutcome(outcome.GetError());
}
}
void TcrClient::DeleteInstanceTokenAsync(const DeleteInstanceTokenRequest& request, const DeleteInstanceTokenAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DeleteInstanceToken(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DeleteInstanceTokenOutcomeCallable TcrClient::DeleteInstanceTokenCallable(const DeleteInstanceTokenRequest &request)
{
auto task = std::make_shared<std::packaged_task<DeleteInstanceTokenOutcome()>>(
[this, request]()
{
return this->DeleteInstanceToken(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DeleteInternalEndpointDnsOutcome TcrClient::DeleteInternalEndpointDns(const DeleteInternalEndpointDnsRequest &request)
{
auto outcome = MakeRequest(request, "DeleteInternalEndpointDns");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteInternalEndpointDnsResponse rsp = DeleteInternalEndpointDnsResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteInternalEndpointDnsOutcome(rsp);
else
return DeleteInternalEndpointDnsOutcome(o.GetError());
}
else
{
return DeleteInternalEndpointDnsOutcome(outcome.GetError());
}
}
void TcrClient::DeleteInternalEndpointDnsAsync(const DeleteInternalEndpointDnsRequest& request, const DeleteInternalEndpointDnsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DeleteInternalEndpointDns(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DeleteInternalEndpointDnsOutcomeCallable TcrClient::DeleteInternalEndpointDnsCallable(const DeleteInternalEndpointDnsRequest &request)
{
auto task = std::make_shared<std::packaged_task<DeleteInternalEndpointDnsOutcome()>>(
[this, request]()
{
return this->DeleteInternalEndpointDns(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DeleteNamespaceOutcome TcrClient::DeleteNamespace(const DeleteNamespaceRequest &request)
{
auto outcome = MakeRequest(request, "DeleteNamespace");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteNamespaceResponse rsp = DeleteNamespaceResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteNamespaceOutcome(rsp);
else
return DeleteNamespaceOutcome(o.GetError());
}
else
{
return DeleteNamespaceOutcome(outcome.GetError());
}
}
void TcrClient::DeleteNamespaceAsync(const DeleteNamespaceRequest& request, const DeleteNamespaceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DeleteNamespace(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DeleteNamespaceOutcomeCallable TcrClient::DeleteNamespaceCallable(const DeleteNamespaceRequest &request)
{
auto task = std::make_shared<std::packaged_task<DeleteNamespaceOutcome()>>(
[this, request]()
{
return this->DeleteNamespace(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DeleteNamespacePersonalOutcome TcrClient::DeleteNamespacePersonal(const DeleteNamespacePersonalRequest &request)
{
auto outcome = MakeRequest(request, "DeleteNamespacePersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteNamespacePersonalResponse rsp = DeleteNamespacePersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteNamespacePersonalOutcome(rsp);
else
return DeleteNamespacePersonalOutcome(o.GetError());
}
else
{
return DeleteNamespacePersonalOutcome(outcome.GetError());
}
}
void TcrClient::DeleteNamespacePersonalAsync(const DeleteNamespacePersonalRequest& request, const DeleteNamespacePersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DeleteNamespacePersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DeleteNamespacePersonalOutcomeCallable TcrClient::DeleteNamespacePersonalCallable(const DeleteNamespacePersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<DeleteNamespacePersonalOutcome()>>(
[this, request]()
{
return this->DeleteNamespacePersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DeleteRepositoryOutcome TcrClient::DeleteRepository(const DeleteRepositoryRequest &request)
{
auto outcome = MakeRequest(request, "DeleteRepository");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteRepositoryResponse rsp = DeleteRepositoryResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteRepositoryOutcome(rsp);
else
return DeleteRepositoryOutcome(o.GetError());
}
else
{
return DeleteRepositoryOutcome(outcome.GetError());
}
}
void TcrClient::DeleteRepositoryAsync(const DeleteRepositoryRequest& request, const DeleteRepositoryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DeleteRepository(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DeleteRepositoryOutcomeCallable TcrClient::DeleteRepositoryCallable(const DeleteRepositoryRequest &request)
{
auto task = std::make_shared<std::packaged_task<DeleteRepositoryOutcome()>>(
[this, request]()
{
return this->DeleteRepository(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DeleteRepositoryPersonalOutcome TcrClient::DeleteRepositoryPersonal(const DeleteRepositoryPersonalRequest &request)
{
auto outcome = MakeRequest(request, "DeleteRepositoryPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteRepositoryPersonalResponse rsp = DeleteRepositoryPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteRepositoryPersonalOutcome(rsp);
else
return DeleteRepositoryPersonalOutcome(o.GetError());
}
else
{
return DeleteRepositoryPersonalOutcome(outcome.GetError());
}
}
void TcrClient::DeleteRepositoryPersonalAsync(const DeleteRepositoryPersonalRequest& request, const DeleteRepositoryPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DeleteRepositoryPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DeleteRepositoryPersonalOutcomeCallable TcrClient::DeleteRepositoryPersonalCallable(const DeleteRepositoryPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<DeleteRepositoryPersonalOutcome()>>(
[this, request]()
{
return this->DeleteRepositoryPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DeleteSecurityPolicyOutcome TcrClient::DeleteSecurityPolicy(const DeleteSecurityPolicyRequest &request)
{
auto outcome = MakeRequest(request, "DeleteSecurityPolicy");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteSecurityPolicyResponse rsp = DeleteSecurityPolicyResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteSecurityPolicyOutcome(rsp);
else
return DeleteSecurityPolicyOutcome(o.GetError());
}
else
{
return DeleteSecurityPolicyOutcome(outcome.GetError());
}
}
void TcrClient::DeleteSecurityPolicyAsync(const DeleteSecurityPolicyRequest& request, const DeleteSecurityPolicyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DeleteSecurityPolicy(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DeleteSecurityPolicyOutcomeCallable TcrClient::DeleteSecurityPolicyCallable(const DeleteSecurityPolicyRequest &request)
{
auto task = std::make_shared<std::packaged_task<DeleteSecurityPolicyOutcome()>>(
[this, request]()
{
return this->DeleteSecurityPolicy(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DeleteWebhookTriggerOutcome TcrClient::DeleteWebhookTrigger(const DeleteWebhookTriggerRequest &request)
{
auto outcome = MakeRequest(request, "DeleteWebhookTrigger");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DeleteWebhookTriggerResponse rsp = DeleteWebhookTriggerResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DeleteWebhookTriggerOutcome(rsp);
else
return DeleteWebhookTriggerOutcome(o.GetError());
}
else
{
return DeleteWebhookTriggerOutcome(outcome.GetError());
}
}
void TcrClient::DeleteWebhookTriggerAsync(const DeleteWebhookTriggerRequest& request, const DeleteWebhookTriggerAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DeleteWebhookTrigger(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DeleteWebhookTriggerOutcomeCallable TcrClient::DeleteWebhookTriggerCallable(const DeleteWebhookTriggerRequest &request)
{
auto task = std::make_shared<std::packaged_task<DeleteWebhookTriggerOutcome()>>(
[this, request]()
{
return this->DeleteWebhookTrigger(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeApplicationTriggerLogPersonalOutcome TcrClient::DescribeApplicationTriggerLogPersonal(const DescribeApplicationTriggerLogPersonalRequest &request)
{
auto outcome = MakeRequest(request, "DescribeApplicationTriggerLogPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeApplicationTriggerLogPersonalResponse rsp = DescribeApplicationTriggerLogPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeApplicationTriggerLogPersonalOutcome(rsp);
else
return DescribeApplicationTriggerLogPersonalOutcome(o.GetError());
}
else
{
return DescribeApplicationTriggerLogPersonalOutcome(outcome.GetError());
}
}
void TcrClient::DescribeApplicationTriggerLogPersonalAsync(const DescribeApplicationTriggerLogPersonalRequest& request, const DescribeApplicationTriggerLogPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeApplicationTriggerLogPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeApplicationTriggerLogPersonalOutcomeCallable TcrClient::DescribeApplicationTriggerLogPersonalCallable(const DescribeApplicationTriggerLogPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeApplicationTriggerLogPersonalOutcome()>>(
[this, request]()
{
return this->DescribeApplicationTriggerLogPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeApplicationTriggerPersonalOutcome TcrClient::DescribeApplicationTriggerPersonal(const DescribeApplicationTriggerPersonalRequest &request)
{
auto outcome = MakeRequest(request, "DescribeApplicationTriggerPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeApplicationTriggerPersonalResponse rsp = DescribeApplicationTriggerPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeApplicationTriggerPersonalOutcome(rsp);
else
return DescribeApplicationTriggerPersonalOutcome(o.GetError());
}
else
{
return DescribeApplicationTriggerPersonalOutcome(outcome.GetError());
}
}
void TcrClient::DescribeApplicationTriggerPersonalAsync(const DescribeApplicationTriggerPersonalRequest& request, const DescribeApplicationTriggerPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeApplicationTriggerPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeApplicationTriggerPersonalOutcomeCallable TcrClient::DescribeApplicationTriggerPersonalCallable(const DescribeApplicationTriggerPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeApplicationTriggerPersonalOutcome()>>(
[this, request]()
{
return this->DescribeApplicationTriggerPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeExternalEndpointStatusOutcome TcrClient::DescribeExternalEndpointStatus(const DescribeExternalEndpointStatusRequest &request)
{
auto outcome = MakeRequest(request, "DescribeExternalEndpointStatus");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeExternalEndpointStatusResponse rsp = DescribeExternalEndpointStatusResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeExternalEndpointStatusOutcome(rsp);
else
return DescribeExternalEndpointStatusOutcome(o.GetError());
}
else
{
return DescribeExternalEndpointStatusOutcome(outcome.GetError());
}
}
void TcrClient::DescribeExternalEndpointStatusAsync(const DescribeExternalEndpointStatusRequest& request, const DescribeExternalEndpointStatusAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeExternalEndpointStatus(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeExternalEndpointStatusOutcomeCallable TcrClient::DescribeExternalEndpointStatusCallable(const DescribeExternalEndpointStatusRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeExternalEndpointStatusOutcome()>>(
[this, request]()
{
return this->DescribeExternalEndpointStatus(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeFavorRepositoryPersonalOutcome TcrClient::DescribeFavorRepositoryPersonal(const DescribeFavorRepositoryPersonalRequest &request)
{
auto outcome = MakeRequest(request, "DescribeFavorRepositoryPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeFavorRepositoryPersonalResponse rsp = DescribeFavorRepositoryPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeFavorRepositoryPersonalOutcome(rsp);
else
return DescribeFavorRepositoryPersonalOutcome(o.GetError());
}
else
{
return DescribeFavorRepositoryPersonalOutcome(outcome.GetError());
}
}
void TcrClient::DescribeFavorRepositoryPersonalAsync(const DescribeFavorRepositoryPersonalRequest& request, const DescribeFavorRepositoryPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeFavorRepositoryPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeFavorRepositoryPersonalOutcomeCallable TcrClient::DescribeFavorRepositoryPersonalCallable(const DescribeFavorRepositoryPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeFavorRepositoryPersonalOutcome()>>(
[this, request]()
{
return this->DescribeFavorRepositoryPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeImageFilterPersonalOutcome TcrClient::DescribeImageFilterPersonal(const DescribeImageFilterPersonalRequest &request)
{
auto outcome = MakeRequest(request, "DescribeImageFilterPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeImageFilterPersonalResponse rsp = DescribeImageFilterPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeImageFilterPersonalOutcome(rsp);
else
return DescribeImageFilterPersonalOutcome(o.GetError());
}
else
{
return DescribeImageFilterPersonalOutcome(outcome.GetError());
}
}
void TcrClient::DescribeImageFilterPersonalAsync(const DescribeImageFilterPersonalRequest& request, const DescribeImageFilterPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeImageFilterPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeImageFilterPersonalOutcomeCallable TcrClient::DescribeImageFilterPersonalCallable(const DescribeImageFilterPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeImageFilterPersonalOutcome()>>(
[this, request]()
{
return this->DescribeImageFilterPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeImageLifecycleGlobalPersonalOutcome TcrClient::DescribeImageLifecycleGlobalPersonal(const DescribeImageLifecycleGlobalPersonalRequest &request)
{
auto outcome = MakeRequest(request, "DescribeImageLifecycleGlobalPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeImageLifecycleGlobalPersonalResponse rsp = DescribeImageLifecycleGlobalPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeImageLifecycleGlobalPersonalOutcome(rsp);
else
return DescribeImageLifecycleGlobalPersonalOutcome(o.GetError());
}
else
{
return DescribeImageLifecycleGlobalPersonalOutcome(outcome.GetError());
}
}
void TcrClient::DescribeImageLifecycleGlobalPersonalAsync(const DescribeImageLifecycleGlobalPersonalRequest& request, const DescribeImageLifecycleGlobalPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeImageLifecycleGlobalPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeImageLifecycleGlobalPersonalOutcomeCallable TcrClient::DescribeImageLifecycleGlobalPersonalCallable(const DescribeImageLifecycleGlobalPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeImageLifecycleGlobalPersonalOutcome()>>(
[this, request]()
{
return this->DescribeImageLifecycleGlobalPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeImageLifecyclePersonalOutcome TcrClient::DescribeImageLifecyclePersonal(const DescribeImageLifecyclePersonalRequest &request)
{
auto outcome = MakeRequest(request, "DescribeImageLifecyclePersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeImageLifecyclePersonalResponse rsp = DescribeImageLifecyclePersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeImageLifecyclePersonalOutcome(rsp);
else
return DescribeImageLifecyclePersonalOutcome(o.GetError());
}
else
{
return DescribeImageLifecyclePersonalOutcome(outcome.GetError());
}
}
void TcrClient::DescribeImageLifecyclePersonalAsync(const DescribeImageLifecyclePersonalRequest& request, const DescribeImageLifecyclePersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeImageLifecyclePersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeImageLifecyclePersonalOutcomeCallable TcrClient::DescribeImageLifecyclePersonalCallable(const DescribeImageLifecyclePersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeImageLifecyclePersonalOutcome()>>(
[this, request]()
{
return this->DescribeImageLifecyclePersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeImageManifestsOutcome TcrClient::DescribeImageManifests(const DescribeImageManifestsRequest &request)
{
auto outcome = MakeRequest(request, "DescribeImageManifests");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeImageManifestsResponse rsp = DescribeImageManifestsResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeImageManifestsOutcome(rsp);
else
return DescribeImageManifestsOutcome(o.GetError());
}
else
{
return DescribeImageManifestsOutcome(outcome.GetError());
}
}
void TcrClient::DescribeImageManifestsAsync(const DescribeImageManifestsRequest& request, const DescribeImageManifestsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeImageManifests(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeImageManifestsOutcomeCallable TcrClient::DescribeImageManifestsCallable(const DescribeImageManifestsRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeImageManifestsOutcome()>>(
[this, request]()
{
return this->DescribeImageManifests(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeImagePersonalOutcome TcrClient::DescribeImagePersonal(const DescribeImagePersonalRequest &request)
{
auto outcome = MakeRequest(request, "DescribeImagePersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeImagePersonalResponse rsp = DescribeImagePersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeImagePersonalOutcome(rsp);
else
return DescribeImagePersonalOutcome(o.GetError());
}
else
{
return DescribeImagePersonalOutcome(outcome.GetError());
}
}
void TcrClient::DescribeImagePersonalAsync(const DescribeImagePersonalRequest& request, const DescribeImagePersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeImagePersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeImagePersonalOutcomeCallable TcrClient::DescribeImagePersonalCallable(const DescribeImagePersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeImagePersonalOutcome()>>(
[this, request]()
{
return this->DescribeImagePersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeImagesOutcome TcrClient::DescribeImages(const DescribeImagesRequest &request)
{
auto outcome = MakeRequest(request, "DescribeImages");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeImagesResponse rsp = DescribeImagesResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeImagesOutcome(rsp);
else
return DescribeImagesOutcome(o.GetError());
}
else
{
return DescribeImagesOutcome(outcome.GetError());
}
}
void TcrClient::DescribeImagesAsync(const DescribeImagesRequest& request, const DescribeImagesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeImages(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeImagesOutcomeCallable TcrClient::DescribeImagesCallable(const DescribeImagesRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeImagesOutcome()>>(
[this, request]()
{
return this->DescribeImages(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeInstanceStatusOutcome TcrClient::DescribeInstanceStatus(const DescribeInstanceStatusRequest &request)
{
auto outcome = MakeRequest(request, "DescribeInstanceStatus");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeInstanceStatusResponse rsp = DescribeInstanceStatusResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeInstanceStatusOutcome(rsp);
else
return DescribeInstanceStatusOutcome(o.GetError());
}
else
{
return DescribeInstanceStatusOutcome(outcome.GetError());
}
}
void TcrClient::DescribeInstanceStatusAsync(const DescribeInstanceStatusRequest& request, const DescribeInstanceStatusAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeInstanceStatus(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeInstanceStatusOutcomeCallable TcrClient::DescribeInstanceStatusCallable(const DescribeInstanceStatusRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeInstanceStatusOutcome()>>(
[this, request]()
{
return this->DescribeInstanceStatus(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeInstanceTokenOutcome TcrClient::DescribeInstanceToken(const DescribeInstanceTokenRequest &request)
{
auto outcome = MakeRequest(request, "DescribeInstanceToken");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeInstanceTokenResponse rsp = DescribeInstanceTokenResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeInstanceTokenOutcome(rsp);
else
return DescribeInstanceTokenOutcome(o.GetError());
}
else
{
return DescribeInstanceTokenOutcome(outcome.GetError());
}
}
void TcrClient::DescribeInstanceTokenAsync(const DescribeInstanceTokenRequest& request, const DescribeInstanceTokenAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeInstanceToken(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeInstanceTokenOutcomeCallable TcrClient::DescribeInstanceTokenCallable(const DescribeInstanceTokenRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeInstanceTokenOutcome()>>(
[this, request]()
{
return this->DescribeInstanceToken(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeInstancesOutcome TcrClient::DescribeInstances(const DescribeInstancesRequest &request)
{
auto outcome = MakeRequest(request, "DescribeInstances");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeInstancesResponse rsp = DescribeInstancesResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeInstancesOutcome(rsp);
else
return DescribeInstancesOutcome(o.GetError());
}
else
{
return DescribeInstancesOutcome(outcome.GetError());
}
}
void TcrClient::DescribeInstancesAsync(const DescribeInstancesRequest& request, const DescribeInstancesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeInstances(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeInstancesOutcomeCallable TcrClient::DescribeInstancesCallable(const DescribeInstancesRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeInstancesOutcome()>>(
[this, request]()
{
return this->DescribeInstances(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeInternalEndpointDnsStatusOutcome TcrClient::DescribeInternalEndpointDnsStatus(const DescribeInternalEndpointDnsStatusRequest &request)
{
auto outcome = MakeRequest(request, "DescribeInternalEndpointDnsStatus");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeInternalEndpointDnsStatusResponse rsp = DescribeInternalEndpointDnsStatusResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeInternalEndpointDnsStatusOutcome(rsp);
else
return DescribeInternalEndpointDnsStatusOutcome(o.GetError());
}
else
{
return DescribeInternalEndpointDnsStatusOutcome(outcome.GetError());
}
}
void TcrClient::DescribeInternalEndpointDnsStatusAsync(const DescribeInternalEndpointDnsStatusRequest& request, const DescribeInternalEndpointDnsStatusAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeInternalEndpointDnsStatus(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeInternalEndpointDnsStatusOutcomeCallable TcrClient::DescribeInternalEndpointDnsStatusCallable(const DescribeInternalEndpointDnsStatusRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeInternalEndpointDnsStatusOutcome()>>(
[this, request]()
{
return this->DescribeInternalEndpointDnsStatus(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeInternalEndpointsOutcome TcrClient::DescribeInternalEndpoints(const DescribeInternalEndpointsRequest &request)
{
auto outcome = MakeRequest(request, "DescribeInternalEndpoints");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeInternalEndpointsResponse rsp = DescribeInternalEndpointsResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeInternalEndpointsOutcome(rsp);
else
return DescribeInternalEndpointsOutcome(o.GetError());
}
else
{
return DescribeInternalEndpointsOutcome(outcome.GetError());
}
}
void TcrClient::DescribeInternalEndpointsAsync(const DescribeInternalEndpointsRequest& request, const DescribeInternalEndpointsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeInternalEndpoints(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeInternalEndpointsOutcomeCallable TcrClient::DescribeInternalEndpointsCallable(const DescribeInternalEndpointsRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeInternalEndpointsOutcome()>>(
[this, request]()
{
return this->DescribeInternalEndpoints(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeNamespacePersonalOutcome TcrClient::DescribeNamespacePersonal(const DescribeNamespacePersonalRequest &request)
{
auto outcome = MakeRequest(request, "DescribeNamespacePersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeNamespacePersonalResponse rsp = DescribeNamespacePersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeNamespacePersonalOutcome(rsp);
else
return DescribeNamespacePersonalOutcome(o.GetError());
}
else
{
return DescribeNamespacePersonalOutcome(outcome.GetError());
}
}
void TcrClient::DescribeNamespacePersonalAsync(const DescribeNamespacePersonalRequest& request, const DescribeNamespacePersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeNamespacePersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeNamespacePersonalOutcomeCallable TcrClient::DescribeNamespacePersonalCallable(const DescribeNamespacePersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeNamespacePersonalOutcome()>>(
[this, request]()
{
return this->DescribeNamespacePersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeNamespacesOutcome TcrClient::DescribeNamespaces(const DescribeNamespacesRequest &request)
{
auto outcome = MakeRequest(request, "DescribeNamespaces");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeNamespacesResponse rsp = DescribeNamespacesResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeNamespacesOutcome(rsp);
else
return DescribeNamespacesOutcome(o.GetError());
}
else
{
return DescribeNamespacesOutcome(outcome.GetError());
}
}
void TcrClient::DescribeNamespacesAsync(const DescribeNamespacesRequest& request, const DescribeNamespacesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeNamespaces(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeNamespacesOutcomeCallable TcrClient::DescribeNamespacesCallable(const DescribeNamespacesRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeNamespacesOutcome()>>(
[this, request]()
{
return this->DescribeNamespaces(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeReplicationInstanceCreateTasksOutcome TcrClient::DescribeReplicationInstanceCreateTasks(const DescribeReplicationInstanceCreateTasksRequest &request)
{
auto outcome = MakeRequest(request, "DescribeReplicationInstanceCreateTasks");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeReplicationInstanceCreateTasksResponse rsp = DescribeReplicationInstanceCreateTasksResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeReplicationInstanceCreateTasksOutcome(rsp);
else
return DescribeReplicationInstanceCreateTasksOutcome(o.GetError());
}
else
{
return DescribeReplicationInstanceCreateTasksOutcome(outcome.GetError());
}
}
void TcrClient::DescribeReplicationInstanceCreateTasksAsync(const DescribeReplicationInstanceCreateTasksRequest& request, const DescribeReplicationInstanceCreateTasksAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeReplicationInstanceCreateTasks(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeReplicationInstanceCreateTasksOutcomeCallable TcrClient::DescribeReplicationInstanceCreateTasksCallable(const DescribeReplicationInstanceCreateTasksRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeReplicationInstanceCreateTasksOutcome()>>(
[this, request]()
{
return this->DescribeReplicationInstanceCreateTasks(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeReplicationInstancesOutcome TcrClient::DescribeReplicationInstances(const DescribeReplicationInstancesRequest &request)
{
auto outcome = MakeRequest(request, "DescribeReplicationInstances");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeReplicationInstancesResponse rsp = DescribeReplicationInstancesResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeReplicationInstancesOutcome(rsp);
else
return DescribeReplicationInstancesOutcome(o.GetError());
}
else
{
return DescribeReplicationInstancesOutcome(outcome.GetError());
}
}
void TcrClient::DescribeReplicationInstancesAsync(const DescribeReplicationInstancesRequest& request, const DescribeReplicationInstancesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeReplicationInstances(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeReplicationInstancesOutcomeCallable TcrClient::DescribeReplicationInstancesCallable(const DescribeReplicationInstancesRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeReplicationInstancesOutcome()>>(
[this, request]()
{
return this->DescribeReplicationInstances(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeRepositoriesOutcome TcrClient::DescribeRepositories(const DescribeRepositoriesRequest &request)
{
auto outcome = MakeRequest(request, "DescribeRepositories");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeRepositoriesResponse rsp = DescribeRepositoriesResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeRepositoriesOutcome(rsp);
else
return DescribeRepositoriesOutcome(o.GetError());
}
else
{
return DescribeRepositoriesOutcome(outcome.GetError());
}
}
void TcrClient::DescribeRepositoriesAsync(const DescribeRepositoriesRequest& request, const DescribeRepositoriesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeRepositories(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeRepositoriesOutcomeCallable TcrClient::DescribeRepositoriesCallable(const DescribeRepositoriesRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeRepositoriesOutcome()>>(
[this, request]()
{
return this->DescribeRepositories(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeRepositoryFilterPersonalOutcome TcrClient::DescribeRepositoryFilterPersonal(const DescribeRepositoryFilterPersonalRequest &request)
{
auto outcome = MakeRequest(request, "DescribeRepositoryFilterPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeRepositoryFilterPersonalResponse rsp = DescribeRepositoryFilterPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeRepositoryFilterPersonalOutcome(rsp);
else
return DescribeRepositoryFilterPersonalOutcome(o.GetError());
}
else
{
return DescribeRepositoryFilterPersonalOutcome(outcome.GetError());
}
}
void TcrClient::DescribeRepositoryFilterPersonalAsync(const DescribeRepositoryFilterPersonalRequest& request, const DescribeRepositoryFilterPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeRepositoryFilterPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeRepositoryFilterPersonalOutcomeCallable TcrClient::DescribeRepositoryFilterPersonalCallable(const DescribeRepositoryFilterPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeRepositoryFilterPersonalOutcome()>>(
[this, request]()
{
return this->DescribeRepositoryFilterPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeRepositoryOwnerPersonalOutcome TcrClient::DescribeRepositoryOwnerPersonal(const DescribeRepositoryOwnerPersonalRequest &request)
{
auto outcome = MakeRequest(request, "DescribeRepositoryOwnerPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeRepositoryOwnerPersonalResponse rsp = DescribeRepositoryOwnerPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeRepositoryOwnerPersonalOutcome(rsp);
else
return DescribeRepositoryOwnerPersonalOutcome(o.GetError());
}
else
{
return DescribeRepositoryOwnerPersonalOutcome(outcome.GetError());
}
}
void TcrClient::DescribeRepositoryOwnerPersonalAsync(const DescribeRepositoryOwnerPersonalRequest& request, const DescribeRepositoryOwnerPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeRepositoryOwnerPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeRepositoryOwnerPersonalOutcomeCallable TcrClient::DescribeRepositoryOwnerPersonalCallable(const DescribeRepositoryOwnerPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeRepositoryOwnerPersonalOutcome()>>(
[this, request]()
{
return this->DescribeRepositoryOwnerPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeRepositoryPersonalOutcome TcrClient::DescribeRepositoryPersonal(const DescribeRepositoryPersonalRequest &request)
{
auto outcome = MakeRequest(request, "DescribeRepositoryPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeRepositoryPersonalResponse rsp = DescribeRepositoryPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeRepositoryPersonalOutcome(rsp);
else
return DescribeRepositoryPersonalOutcome(o.GetError());
}
else
{
return DescribeRepositoryPersonalOutcome(outcome.GetError());
}
}
void TcrClient::DescribeRepositoryPersonalAsync(const DescribeRepositoryPersonalRequest& request, const DescribeRepositoryPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeRepositoryPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeRepositoryPersonalOutcomeCallable TcrClient::DescribeRepositoryPersonalCallable(const DescribeRepositoryPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeRepositoryPersonalOutcome()>>(
[this, request]()
{
return this->DescribeRepositoryPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeSecurityPoliciesOutcome TcrClient::DescribeSecurityPolicies(const DescribeSecurityPoliciesRequest &request)
{
auto outcome = MakeRequest(request, "DescribeSecurityPolicies");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeSecurityPoliciesResponse rsp = DescribeSecurityPoliciesResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeSecurityPoliciesOutcome(rsp);
else
return DescribeSecurityPoliciesOutcome(o.GetError());
}
else
{
return DescribeSecurityPoliciesOutcome(outcome.GetError());
}
}
void TcrClient::DescribeSecurityPoliciesAsync(const DescribeSecurityPoliciesRequest& request, const DescribeSecurityPoliciesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeSecurityPolicies(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeSecurityPoliciesOutcomeCallable TcrClient::DescribeSecurityPoliciesCallable(const DescribeSecurityPoliciesRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeSecurityPoliciesOutcome()>>(
[this, request]()
{
return this->DescribeSecurityPolicies(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeUserQuotaPersonalOutcome TcrClient::DescribeUserQuotaPersonal(const DescribeUserQuotaPersonalRequest &request)
{
auto outcome = MakeRequest(request, "DescribeUserQuotaPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeUserQuotaPersonalResponse rsp = DescribeUserQuotaPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeUserQuotaPersonalOutcome(rsp);
else
return DescribeUserQuotaPersonalOutcome(o.GetError());
}
else
{
return DescribeUserQuotaPersonalOutcome(outcome.GetError());
}
}
void TcrClient::DescribeUserQuotaPersonalAsync(const DescribeUserQuotaPersonalRequest& request, const DescribeUserQuotaPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeUserQuotaPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeUserQuotaPersonalOutcomeCallable TcrClient::DescribeUserQuotaPersonalCallable(const DescribeUserQuotaPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeUserQuotaPersonalOutcome()>>(
[this, request]()
{
return this->DescribeUserQuotaPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeWebhookTriggerOutcome TcrClient::DescribeWebhookTrigger(const DescribeWebhookTriggerRequest &request)
{
auto outcome = MakeRequest(request, "DescribeWebhookTrigger");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeWebhookTriggerResponse rsp = DescribeWebhookTriggerResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeWebhookTriggerOutcome(rsp);
else
return DescribeWebhookTriggerOutcome(o.GetError());
}
else
{
return DescribeWebhookTriggerOutcome(outcome.GetError());
}
}
void TcrClient::DescribeWebhookTriggerAsync(const DescribeWebhookTriggerRequest& request, const DescribeWebhookTriggerAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeWebhookTrigger(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeWebhookTriggerOutcomeCallable TcrClient::DescribeWebhookTriggerCallable(const DescribeWebhookTriggerRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeWebhookTriggerOutcome()>>(
[this, request]()
{
return this->DescribeWebhookTrigger(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DescribeWebhookTriggerLogOutcome TcrClient::DescribeWebhookTriggerLog(const DescribeWebhookTriggerLogRequest &request)
{
auto outcome = MakeRequest(request, "DescribeWebhookTriggerLog");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DescribeWebhookTriggerLogResponse rsp = DescribeWebhookTriggerLogResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DescribeWebhookTriggerLogOutcome(rsp);
else
return DescribeWebhookTriggerLogOutcome(o.GetError());
}
else
{
return DescribeWebhookTriggerLogOutcome(outcome.GetError());
}
}
void TcrClient::DescribeWebhookTriggerLogAsync(const DescribeWebhookTriggerLogRequest& request, const DescribeWebhookTriggerLogAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DescribeWebhookTriggerLog(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DescribeWebhookTriggerLogOutcomeCallable TcrClient::DescribeWebhookTriggerLogCallable(const DescribeWebhookTriggerLogRequest &request)
{
auto task = std::make_shared<std::packaged_task<DescribeWebhookTriggerLogOutcome()>>(
[this, request]()
{
return this->DescribeWebhookTriggerLog(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::DuplicateImagePersonalOutcome TcrClient::DuplicateImagePersonal(const DuplicateImagePersonalRequest &request)
{
auto outcome = MakeRequest(request, "DuplicateImagePersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
DuplicateImagePersonalResponse rsp = DuplicateImagePersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return DuplicateImagePersonalOutcome(rsp);
else
return DuplicateImagePersonalOutcome(o.GetError());
}
else
{
return DuplicateImagePersonalOutcome(outcome.GetError());
}
}
void TcrClient::DuplicateImagePersonalAsync(const DuplicateImagePersonalRequest& request, const DuplicateImagePersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->DuplicateImagePersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::DuplicateImagePersonalOutcomeCallable TcrClient::DuplicateImagePersonalCallable(const DuplicateImagePersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<DuplicateImagePersonalOutcome()>>(
[this, request]()
{
return this->DuplicateImagePersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::ManageExternalEndpointOutcome TcrClient::ManageExternalEndpoint(const ManageExternalEndpointRequest &request)
{
auto outcome = MakeRequest(request, "ManageExternalEndpoint");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ManageExternalEndpointResponse rsp = ManageExternalEndpointResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ManageExternalEndpointOutcome(rsp);
else
return ManageExternalEndpointOutcome(o.GetError());
}
else
{
return ManageExternalEndpointOutcome(outcome.GetError());
}
}
void TcrClient::ManageExternalEndpointAsync(const ManageExternalEndpointRequest& request, const ManageExternalEndpointAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->ManageExternalEndpoint(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::ManageExternalEndpointOutcomeCallable TcrClient::ManageExternalEndpointCallable(const ManageExternalEndpointRequest &request)
{
auto task = std::make_shared<std::packaged_task<ManageExternalEndpointOutcome()>>(
[this, request]()
{
return this->ManageExternalEndpoint(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::ManageImageLifecycleGlobalPersonalOutcome TcrClient::ManageImageLifecycleGlobalPersonal(const ManageImageLifecycleGlobalPersonalRequest &request)
{
auto outcome = MakeRequest(request, "ManageImageLifecycleGlobalPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ManageImageLifecycleGlobalPersonalResponse rsp = ManageImageLifecycleGlobalPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ManageImageLifecycleGlobalPersonalOutcome(rsp);
else
return ManageImageLifecycleGlobalPersonalOutcome(o.GetError());
}
else
{
return ManageImageLifecycleGlobalPersonalOutcome(outcome.GetError());
}
}
void TcrClient::ManageImageLifecycleGlobalPersonalAsync(const ManageImageLifecycleGlobalPersonalRequest& request, const ManageImageLifecycleGlobalPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->ManageImageLifecycleGlobalPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::ManageImageLifecycleGlobalPersonalOutcomeCallable TcrClient::ManageImageLifecycleGlobalPersonalCallable(const ManageImageLifecycleGlobalPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<ManageImageLifecycleGlobalPersonalOutcome()>>(
[this, request]()
{
return this->ManageImageLifecycleGlobalPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::ManageInternalEndpointOutcome TcrClient::ManageInternalEndpoint(const ManageInternalEndpointRequest &request)
{
auto outcome = MakeRequest(request, "ManageInternalEndpoint");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ManageInternalEndpointResponse rsp = ManageInternalEndpointResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ManageInternalEndpointOutcome(rsp);
else
return ManageInternalEndpointOutcome(o.GetError());
}
else
{
return ManageInternalEndpointOutcome(outcome.GetError());
}
}
void TcrClient::ManageInternalEndpointAsync(const ManageInternalEndpointRequest& request, const ManageInternalEndpointAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->ManageInternalEndpoint(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::ManageInternalEndpointOutcomeCallable TcrClient::ManageInternalEndpointCallable(const ManageInternalEndpointRequest &request)
{
auto task = std::make_shared<std::packaged_task<ManageInternalEndpointOutcome()>>(
[this, request]()
{
return this->ManageInternalEndpoint(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::ManageReplicationOutcome TcrClient::ManageReplication(const ManageReplicationRequest &request)
{
auto outcome = MakeRequest(request, "ManageReplication");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ManageReplicationResponse rsp = ManageReplicationResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ManageReplicationOutcome(rsp);
else
return ManageReplicationOutcome(o.GetError());
}
else
{
return ManageReplicationOutcome(outcome.GetError());
}
}
void TcrClient::ManageReplicationAsync(const ManageReplicationRequest& request, const ManageReplicationAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->ManageReplication(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::ManageReplicationOutcomeCallable TcrClient::ManageReplicationCallable(const ManageReplicationRequest &request)
{
auto task = std::make_shared<std::packaged_task<ManageReplicationOutcome()>>(
[this, request]()
{
return this->ManageReplication(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::ModifyApplicationTriggerPersonalOutcome TcrClient::ModifyApplicationTriggerPersonal(const ModifyApplicationTriggerPersonalRequest &request)
{
auto outcome = MakeRequest(request, "ModifyApplicationTriggerPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ModifyApplicationTriggerPersonalResponse rsp = ModifyApplicationTriggerPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ModifyApplicationTriggerPersonalOutcome(rsp);
else
return ModifyApplicationTriggerPersonalOutcome(o.GetError());
}
else
{
return ModifyApplicationTriggerPersonalOutcome(outcome.GetError());
}
}
void TcrClient::ModifyApplicationTriggerPersonalAsync(const ModifyApplicationTriggerPersonalRequest& request, const ModifyApplicationTriggerPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->ModifyApplicationTriggerPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::ModifyApplicationTriggerPersonalOutcomeCallable TcrClient::ModifyApplicationTriggerPersonalCallable(const ModifyApplicationTriggerPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<ModifyApplicationTriggerPersonalOutcome()>>(
[this, request]()
{
return this->ModifyApplicationTriggerPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::ModifyInstanceTokenOutcome TcrClient::ModifyInstanceToken(const ModifyInstanceTokenRequest &request)
{
auto outcome = MakeRequest(request, "ModifyInstanceToken");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ModifyInstanceTokenResponse rsp = ModifyInstanceTokenResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ModifyInstanceTokenOutcome(rsp);
else
return ModifyInstanceTokenOutcome(o.GetError());
}
else
{
return ModifyInstanceTokenOutcome(outcome.GetError());
}
}
void TcrClient::ModifyInstanceTokenAsync(const ModifyInstanceTokenRequest& request, const ModifyInstanceTokenAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->ModifyInstanceToken(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::ModifyInstanceTokenOutcomeCallable TcrClient::ModifyInstanceTokenCallable(const ModifyInstanceTokenRequest &request)
{
auto task = std::make_shared<std::packaged_task<ModifyInstanceTokenOutcome()>>(
[this, request]()
{
return this->ModifyInstanceToken(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::ModifyNamespaceOutcome TcrClient::ModifyNamespace(const ModifyNamespaceRequest &request)
{
auto outcome = MakeRequest(request, "ModifyNamespace");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ModifyNamespaceResponse rsp = ModifyNamespaceResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ModifyNamespaceOutcome(rsp);
else
return ModifyNamespaceOutcome(o.GetError());
}
else
{
return ModifyNamespaceOutcome(outcome.GetError());
}
}
void TcrClient::ModifyNamespaceAsync(const ModifyNamespaceRequest& request, const ModifyNamespaceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->ModifyNamespace(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::ModifyNamespaceOutcomeCallable TcrClient::ModifyNamespaceCallable(const ModifyNamespaceRequest &request)
{
auto task = std::make_shared<std::packaged_task<ModifyNamespaceOutcome()>>(
[this, request]()
{
return this->ModifyNamespace(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::ModifyRepositoryOutcome TcrClient::ModifyRepository(const ModifyRepositoryRequest &request)
{
auto outcome = MakeRequest(request, "ModifyRepository");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ModifyRepositoryResponse rsp = ModifyRepositoryResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ModifyRepositoryOutcome(rsp);
else
return ModifyRepositoryOutcome(o.GetError());
}
else
{
return ModifyRepositoryOutcome(outcome.GetError());
}
}
void TcrClient::ModifyRepositoryAsync(const ModifyRepositoryRequest& request, const ModifyRepositoryAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->ModifyRepository(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::ModifyRepositoryOutcomeCallable TcrClient::ModifyRepositoryCallable(const ModifyRepositoryRequest &request)
{
auto task = std::make_shared<std::packaged_task<ModifyRepositoryOutcome()>>(
[this, request]()
{
return this->ModifyRepository(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::ModifyRepositoryAccessPersonalOutcome TcrClient::ModifyRepositoryAccessPersonal(const ModifyRepositoryAccessPersonalRequest &request)
{
auto outcome = MakeRequest(request, "ModifyRepositoryAccessPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ModifyRepositoryAccessPersonalResponse rsp = ModifyRepositoryAccessPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ModifyRepositoryAccessPersonalOutcome(rsp);
else
return ModifyRepositoryAccessPersonalOutcome(o.GetError());
}
else
{
return ModifyRepositoryAccessPersonalOutcome(outcome.GetError());
}
}
void TcrClient::ModifyRepositoryAccessPersonalAsync(const ModifyRepositoryAccessPersonalRequest& request, const ModifyRepositoryAccessPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->ModifyRepositoryAccessPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::ModifyRepositoryAccessPersonalOutcomeCallable TcrClient::ModifyRepositoryAccessPersonalCallable(const ModifyRepositoryAccessPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<ModifyRepositoryAccessPersonalOutcome()>>(
[this, request]()
{
return this->ModifyRepositoryAccessPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::ModifyRepositoryInfoPersonalOutcome TcrClient::ModifyRepositoryInfoPersonal(const ModifyRepositoryInfoPersonalRequest &request)
{
auto outcome = MakeRequest(request, "ModifyRepositoryInfoPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ModifyRepositoryInfoPersonalResponse rsp = ModifyRepositoryInfoPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ModifyRepositoryInfoPersonalOutcome(rsp);
else
return ModifyRepositoryInfoPersonalOutcome(o.GetError());
}
else
{
return ModifyRepositoryInfoPersonalOutcome(outcome.GetError());
}
}
void TcrClient::ModifyRepositoryInfoPersonalAsync(const ModifyRepositoryInfoPersonalRequest& request, const ModifyRepositoryInfoPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->ModifyRepositoryInfoPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::ModifyRepositoryInfoPersonalOutcomeCallable TcrClient::ModifyRepositoryInfoPersonalCallable(const ModifyRepositoryInfoPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<ModifyRepositoryInfoPersonalOutcome()>>(
[this, request]()
{
return this->ModifyRepositoryInfoPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::ModifySecurityPolicyOutcome TcrClient::ModifySecurityPolicy(const ModifySecurityPolicyRequest &request)
{
auto outcome = MakeRequest(request, "ModifySecurityPolicy");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ModifySecurityPolicyResponse rsp = ModifySecurityPolicyResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ModifySecurityPolicyOutcome(rsp);
else
return ModifySecurityPolicyOutcome(o.GetError());
}
else
{
return ModifySecurityPolicyOutcome(outcome.GetError());
}
}
void TcrClient::ModifySecurityPolicyAsync(const ModifySecurityPolicyRequest& request, const ModifySecurityPolicyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->ModifySecurityPolicy(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::ModifySecurityPolicyOutcomeCallable TcrClient::ModifySecurityPolicyCallable(const ModifySecurityPolicyRequest &request)
{
auto task = std::make_shared<std::packaged_task<ModifySecurityPolicyOutcome()>>(
[this, request]()
{
return this->ModifySecurityPolicy(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::ModifyUserPasswordPersonalOutcome TcrClient::ModifyUserPasswordPersonal(const ModifyUserPasswordPersonalRequest &request)
{
auto outcome = MakeRequest(request, "ModifyUserPasswordPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ModifyUserPasswordPersonalResponse rsp = ModifyUserPasswordPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ModifyUserPasswordPersonalOutcome(rsp);
else
return ModifyUserPasswordPersonalOutcome(o.GetError());
}
else
{
return ModifyUserPasswordPersonalOutcome(outcome.GetError());
}
}
void TcrClient::ModifyUserPasswordPersonalAsync(const ModifyUserPasswordPersonalRequest& request, const ModifyUserPasswordPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->ModifyUserPasswordPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::ModifyUserPasswordPersonalOutcomeCallable TcrClient::ModifyUserPasswordPersonalCallable(const ModifyUserPasswordPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<ModifyUserPasswordPersonalOutcome()>>(
[this, request]()
{
return this->ModifyUserPasswordPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::ModifyWebhookTriggerOutcome TcrClient::ModifyWebhookTrigger(const ModifyWebhookTriggerRequest &request)
{
auto outcome = MakeRequest(request, "ModifyWebhookTrigger");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ModifyWebhookTriggerResponse rsp = ModifyWebhookTriggerResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ModifyWebhookTriggerOutcome(rsp);
else
return ModifyWebhookTriggerOutcome(o.GetError());
}
else
{
return ModifyWebhookTriggerOutcome(outcome.GetError());
}
}
void TcrClient::ModifyWebhookTriggerAsync(const ModifyWebhookTriggerRequest& request, const ModifyWebhookTriggerAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->ModifyWebhookTrigger(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::ModifyWebhookTriggerOutcomeCallable TcrClient::ModifyWebhookTriggerCallable(const ModifyWebhookTriggerRequest &request)
{
auto task = std::make_shared<std::packaged_task<ModifyWebhookTriggerOutcome()>>(
[this, request]()
{
return this->ModifyWebhookTrigger(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::RenewInstanceOutcome TcrClient::RenewInstance(const RenewInstanceRequest &request)
{
auto outcome = MakeRequest(request, "RenewInstance");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
RenewInstanceResponse rsp = RenewInstanceResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return RenewInstanceOutcome(rsp);
else
return RenewInstanceOutcome(o.GetError());
}
else
{
return RenewInstanceOutcome(outcome.GetError());
}
}
void TcrClient::RenewInstanceAsync(const RenewInstanceRequest& request, const RenewInstanceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->RenewInstance(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::RenewInstanceOutcomeCallable TcrClient::RenewInstanceCallable(const RenewInstanceRequest &request)
{
auto task = std::make_shared<std::packaged_task<RenewInstanceOutcome()>>(
[this, request]()
{
return this->RenewInstance(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::ValidateNamespaceExistPersonalOutcome TcrClient::ValidateNamespaceExistPersonal(const ValidateNamespaceExistPersonalRequest &request)
{
auto outcome = MakeRequest(request, "ValidateNamespaceExistPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ValidateNamespaceExistPersonalResponse rsp = ValidateNamespaceExistPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ValidateNamespaceExistPersonalOutcome(rsp);
else
return ValidateNamespaceExistPersonalOutcome(o.GetError());
}
else
{
return ValidateNamespaceExistPersonalOutcome(outcome.GetError());
}
}
void TcrClient::ValidateNamespaceExistPersonalAsync(const ValidateNamespaceExistPersonalRequest& request, const ValidateNamespaceExistPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->ValidateNamespaceExistPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::ValidateNamespaceExistPersonalOutcomeCallable TcrClient::ValidateNamespaceExistPersonalCallable(const ValidateNamespaceExistPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<ValidateNamespaceExistPersonalOutcome()>>(
[this, request]()
{
return this->ValidateNamespaceExistPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
TcrClient::ValidateRepositoryExistPersonalOutcome TcrClient::ValidateRepositoryExistPersonal(const ValidateRepositoryExistPersonalRequest &request)
{
auto outcome = MakeRequest(request, "ValidateRepositoryExistPersonal");
if (outcome.IsSuccess())
{
auto r = outcome.GetResult();
string payload = string(r.Body(), r.BodySize());
ValidateRepositoryExistPersonalResponse rsp = ValidateRepositoryExistPersonalResponse();
auto o = rsp.Deserialize(payload);
if (o.IsSuccess())
return ValidateRepositoryExistPersonalOutcome(rsp);
else
return ValidateRepositoryExistPersonalOutcome(o.GetError());
}
else
{
return ValidateRepositoryExistPersonalOutcome(outcome.GetError());
}
}
void TcrClient::ValidateRepositoryExistPersonalAsync(const ValidateRepositoryExistPersonalRequest& request, const ValidateRepositoryExistPersonalAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context)
{
auto fn = [this, request, handler, context]()
{
handler(this, request, this->ValidateRepositoryExistPersonal(request), context);
};
Executor::GetInstance()->Submit(new Runnable(fn));
}
TcrClient::ValidateRepositoryExistPersonalOutcomeCallable TcrClient::ValidateRepositoryExistPersonalCallable(const ValidateRepositoryExistPersonalRequest &request)
{
auto task = std::make_shared<std::packaged_task<ValidateRepositoryExistPersonalOutcome()>>(
[this, request]()
{
return this->ValidateRepositoryExistPersonal(request);
}
);
Executor::GetInstance()->Submit(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
| [
"tencentcloudapi@tenent.com"
] | tencentcloudapi@tenent.com |
3a81b44370ac578730b7cf09d611db31eb7626c2 | df0d5c29f8ac471ea5f481c45a3c4fa4a2cd48a2 | /TP3/src/Location.cpp | df25910f1db750e3f9ed73ebe52c9ecd609138e1 | [] | no_license | marouaneaba/TP-C-graphique-GTK-MVC-..- | 748e9b1fbf29578d69bf8b65ab386295a89a80da | 58de98cca264ff87670bc0434bcbf9aa63f425f0 | refs/heads/master | 2021-08-28T07:50:49.730889 | 2017-12-11T15:20:58 | 2017-12-11T15:20:58 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 183 | cpp | #include "Location.hpp"
#include <iostream>
void Location::afficherLocation() const{
std::cout<<"Location du Produit N° "<<_idProduit<<" par Client N° "<<_idClient<<std::endl;
}
| [
"mar.abakarim@gmail.com"
] | mar.abakarim@gmail.com |
b629fd5b0fe50074c710e6d0c1e30d8256e4b13d | fb4bfff1957df21a1c598e22851712702f391776 | /tools/gfx/render-graphics-common.h | 59dfb888a14dbd6d83485c34a602bf01e8bce375 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain",
"MIT"
] | permissive | Checkmate50/slang | f753e53b25b833efea141ee59ebce11b17558f4e | 39975b207e5db7de8feaaebfda2ae122c1850b26 | refs/heads/master | 2023-03-28T01:01:16.077572 | 2021-02-16T22:03:39 | 2021-02-16T22:03:39 | 264,261,923 | 0 | 0 | null | 2020-05-15T17:52:30 | 2020-05-15T17:52:30 | null | UTF-8 | C++ | false | false | 1,324 | h | #pragma once
#include "tools/gfx/renderer-shared.h"
#include "core/slang-basic.h"
#include "tools/gfx/slang-context.h"
namespace gfx
{
class GraphicsCommonProgramLayout;
class GraphicsCommonShaderProgram : public ShaderProgramBase
{
public:
GraphicsCommonProgramLayout* getLayout() const;
private:
friend class GraphicsAPIRenderer;
Slang::RefPtr<ShaderObjectLayoutBase> m_layout;
};
class GraphicsAPIRenderer : public RendererBase
{
public:
virtual SLANG_NO_THROW Result SLANG_MCALL createShaderObjectLayout(
slang::TypeLayoutReflection* typeLayout, IShaderObjectLayout** outLayout) SLANG_OVERRIDE;
virtual SLANG_NO_THROW Result SLANG_MCALL
createShaderObject(IShaderObjectLayout* layout, IShaderObject** outObject) SLANG_OVERRIDE;
virtual SLANG_NO_THROW Result SLANG_MCALL createRootShaderObject(
IShaderProgram* program,
IShaderObject** outObject) SLANG_OVERRIDE;
virtual SLANG_NO_THROW Result SLANG_MCALL
bindRootShaderObject(PipelineType pipelineType, IShaderObject* object) SLANG_OVERRIDE;
void preparePipelineDesc(GraphicsPipelineStateDesc& desc);
void preparePipelineDesc(ComputePipelineStateDesc& desc);
Result initProgramCommon(
GraphicsCommonShaderProgram* program,
IShaderProgram::Desc const& desc);
};
}
| [
"noreply@github.com"
] | Checkmate50.noreply@github.com |
6c54056dd08f2304c2d01faf447a4d1d82433952 | 37a98aaf8e67432e1fbcbe1b3c14721ae80933ce | /DAY 29.cpp | 3fb4ea7e32d7bfc085bcbe0349c5a3403a7c8f2c | [] | no_license | Ayush-KS/June-LeetCoding-Challenge | f40968fe956b4911b94789dd20ba176d030e1f6d | d40e9fc3cc5b5a57849c9470a5ea5e7d51830447 | refs/heads/master | 2022-11-11T20:27:58.416571 | 2020-07-01T08:22:24 | 2020-07-01T08:22:24 | 268,602,645 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 280 | cpp | // Unique Paths
class Solution {
public:
int uniquePaths(int m, int n) {
vector<int> dp(n, 1);
for(int i = 1; i < m; i++) {
for(int i = 1; i < n; i++) {
dp[i] += dp[i - 1];
}
}
return dp[n - 1];
}
}; | [
"45496026+Ayush-KS@users.noreply.github.com"
] | 45496026+Ayush-KS@users.noreply.github.com |
e75448eec2e464c5f79c5e965251026245cc6acb | 575ad7f16f282e35a6f025036d927a2ef43bfd87 | /build-460-Desktop_Qt_5_13_0_MSVC2017_64bit-Debug/debug/qrc_glsl.cpp | a49d010300880ab89e35d2e254e3b5f078dfe9e4 | [] | no_license | cis-460-2019/hw00-course-prep-giaosame | 0ffb03c669f2682eaabaf9fd60514f12a9fb4d28 | d9d880ce9d813c62b900b2f303f2c106d5df4684 | refs/heads/master | 2020-07-18T10:53:24.903687 | 2019-09-04T16:33:39 | 2019-09-04T16:33:39 | 206,233,218 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,697 | cpp | /****************************************************************************
** Resource object code
**
** Created by: The Resource Compiler for Qt version 5.13.0
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
static const unsigned char qt_resource_data[] = {
// C:/Graduate/CIS560 - Computer Graphics/Assignments/hw00-course-prep-giaosame/Qt_GL_Test/glsl/lambert.frag.glsl
0x0,0x0,0x3,0x27,
0x23,
0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x31,0x35,0x30,0xd,0xa,0x2f,0x2f,0x20,
0x5e,0x20,0x43,0x68,0x61,0x6e,0x67,0x65,0x20,0x74,0x68,0x69,0x73,0x20,0x74,0x6f,
0x20,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x31,0x33,0x30,0x20,0x69,0x66,0x20,
0x79,0x6f,0x75,0x20,0x68,0x61,0x76,0x65,0x20,0x63,0x6f,0x6d,0x70,0x61,0x74,0x69,
0x62,0x69,0x6c,0x69,0x74,0x79,0x20,0x69,0x73,0x73,0x75,0x65,0x73,0xd,0xa,0xd,
0xa,0x2f,0x2f,0x74,0x68,0x65,0x73,0x65,0x20,0x61,0x72,0x65,0x20,0x74,0x68,0x65,
0x20,0x69,0x6e,0x74,0x65,0x72,0x70,0x6f,0x6c,0x61,0x74,0x65,0x64,0x20,0x76,0x61,
0x6c,0x75,0x65,0x73,0x20,0x6f,0x75,0x74,0x20,0x6f,0x66,0x20,0x74,0x68,0x65,0x20,
0x72,0x61,0x73,0x74,0x65,0x72,0x69,0x7a,0x65,0x72,0x2c,0x20,0x73,0x6f,0x20,0x79,
0x6f,0x75,0x20,0x63,0x61,0x6e,0x27,0x74,0x20,0x6b,0x6e,0x6f,0x77,0xd,0xa,0x2f,
0x2f,0x74,0x68,0x65,0x69,0x72,0x20,0x73,0x70,0x65,0x63,0x69,0x66,0x69,0x63,0x20,
0x76,0x61,0x6c,0x75,0x65,0x73,0x20,0x77,0x69,0x74,0x68,0x6f,0x75,0x74,0x20,0x6b,
0x6e,0x6f,0x77,0x69,0x6e,0x67,0x20,0x74,0x68,0x65,0x20,0x76,0x65,0x72,0x74,0x69,
0x63,0x65,0x73,0x20,0x74,0x68,0x61,0x74,0x20,0x63,0x6f,0x6e,0x74,0x72,0x69,0x62,
0x75,0x74,0x65,0x64,0x20,0x74,0x6f,0x20,0x74,0x68,0x65,0x6d,0xd,0xa,0x69,0x6e,
0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x73,0x5f,0x4e,0x6f,0x72,0x3b,0xd,0xa,0x69,
0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x73,0x5f,0x4c,0x69,0x67,0x68,0x74,0x56,
0x65,0x63,0x3b,0xd,0xa,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x73,0x5f,
0x43,0x6f,0x6c,0x3b,0xd,0xa,0xd,0xa,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,
0x20,0x6f,0x75,0x74,0x5f,0x43,0x6f,0x6c,0x3b,0xd,0xa,0xd,0xa,0x76,0x6f,0x69,
0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0xd,0xa,0x7b,0xd,0xa,0x20,0x20,0x20,
0x20,0x2f,0x2f,0x20,0x4d,0x61,0x74,0x65,0x72,0x69,0x61,0x6c,0x20,0x62,0x61,0x73,
0x65,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x28,0x62,0x65,0x66,0x6f,0x72,0x65,0x20,
0x73,0x68,0x61,0x64,0x69,0x6e,0x67,0x29,0xd,0xa,0x20,0x20,0x20,0x20,0x76,0x65,
0x63,0x34,0x20,0x64,0x69,0x66,0x66,0x75,0x73,0x65,0x43,0x6f,0x6c,0x6f,0x72,0x20,
0x3d,0x20,0x66,0x73,0x5f,0x43,0x6f,0x6c,0x3b,0xd,0xa,0xd,0xa,0x20,0x20,0x20,
0x20,0x2f,0x2f,0x20,0x43,0x61,0x6c,0x63,0x75,0x6c,0x61,0x74,0x65,0x20,0x74,0x68,
0x65,0x20,0x64,0x69,0x66,0x66,0x75,0x73,0x65,0x20,0x74,0x65,0x72,0x6d,0xd,0xa,
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x64,0x69,0x66,0x66,0x75,0x73,
0x65,0x54,0x65,0x72,0x6d,0x20,0x3d,0x20,0x64,0x6f,0x74,0x28,0x6e,0x6f,0x72,0x6d,
0x61,0x6c,0x69,0x7a,0x65,0x28,0x66,0x73,0x5f,0x4e,0x6f,0x72,0x29,0x2c,0x20,0x6e,
0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x66,0x73,0x5f,0x4c,0x69,0x67,0x68,
0x74,0x56,0x65,0x63,0x29,0x29,0x3b,0xd,0xa,0x20,0x20,0x20,0x20,0x2f,0x2f,0x20,
0x41,0x76,0x6f,0x69,0x64,0x20,0x6e,0x65,0x67,0x61,0x74,0x69,0x76,0x65,0x20,0x6c,
0x69,0x67,0x68,0x74,0x69,0x6e,0x67,0x20,0x76,0x61,0x6c,0x75,0x65,0x73,0xd,0xa,
0x20,0x20,0x20,0x20,0x64,0x69,0x66,0x66,0x75,0x73,0x65,0x54,0x65,0x72,0x6d,0x20,
0x3d,0x20,0x63,0x6c,0x61,0x6d,0x70,0x28,0x64,0x69,0x66,0x66,0x75,0x73,0x65,0x54,
0x65,0x72,0x6d,0x2c,0x20,0x30,0x2c,0x20,0x31,0x29,0x3b,0xd,0xa,0xd,0xa,0x20,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x61,0x6d,0x62,0x69,0x65,0x6e,0x74,
0x54,0x65,0x72,0x6d,0x20,0x3d,0x20,0x30,0x2e,0x32,0x3b,0xd,0xa,0xd,0xa,0x20,
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x6c,0x69,0x67,0x68,0x74,0x49,0x6e,
0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x20,0x3d,0x20,0x64,0x69,0x66,0x66,0x75,0x73,
0x65,0x54,0x65,0x72,0x6d,0x20,0x2b,0x20,0x61,0x6d,0x62,0x69,0x65,0x6e,0x74,0x54,
0x65,0x72,0x6d,0x3b,0xd,0xa,0xd,0xa,0x20,0x20,0x20,0x20,0x2f,0x2f,0x20,0x43,
0x6f,0x6d,0x70,0x75,0x74,0x65,0x20,0x66,0x69,0x6e,0x61,0x6c,0x20,0x73,0x68,0x61,
0x64,0x65,0x64,0x20,0x63,0x6f,0x6c,0x6f,0x72,0xd,0xa,0x20,0x20,0x20,0x20,0x6f,
0x75,0x74,0x5f,0x43,0x6f,0x6c,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x64,0x69,
0x66,0x66,0x75,0x73,0x65,0x43,0x6f,0x6c,0x6f,0x72,0x2e,0x72,0x67,0x62,0x20,0x2a,
0x20,0x6c,0x69,0x67,0x68,0x74,0x49,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79,0x2c,
0x20,0x64,0x69,0x66,0x66,0x75,0x73,0x65,0x43,0x6f,0x6c,0x6f,0x72,0x2e,0x61,0x29,
0x3b,0xd,0xa,0x7d,0xd,0xa,
// C:/Graduate/CIS560 - Computer Graphics/Assignments/hw00-course-prep-giaosame/Qt_GL_Test/glsl/wire.frag.glsl
0x0,0x0,0x0,0xd1,
0x23,
0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x31,0x35,0x30,0xd,0xa,0x2f,0x2f,0x20,
0x5e,0x20,0x43,0x68,0x61,0x6e,0x67,0x65,0x20,0x74,0x68,0x69,0x73,0x20,0x74,0x6f,
0x20,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x31,0x33,0x30,0x20,0x69,0x66,0x20,
0x79,0x6f,0x75,0x20,0x68,0x61,0x76,0x65,0x20,0x63,0x6f,0x6d,0x70,0x61,0x74,0x69,
0x62,0x69,0x6c,0x69,0x74,0x79,0x20,0x69,0x73,0x73,0x75,0x65,0x73,0xd,0xa,0xd,
0xa,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x73,0x5f,0x43,0x6f,0x6c,0x3b,
0xd,0xa,0xd,0xa,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x6f,0x75,0x74,
0x5f,0x43,0x6f,0x6c,0x3b,0xd,0xa,0xd,0xa,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,
0x69,0x6e,0x28,0x29,0xd,0xa,0x7b,0xd,0xa,0x20,0x20,0x20,0x20,0x2f,0x2f,0x20,
0x43,0x6f,0x70,0x79,0x20,0x74,0x68,0x65,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x20,
0x74,0x68,0x65,0x72,0x65,0x20,0x69,0x73,0x20,0x6e,0x6f,0x20,0x73,0x68,0x61,0x64,
0x69,0x6e,0x67,0x2e,0xd,0xa,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x5f,0x43,0x6f,
0x6c,0x20,0x3d,0x20,0x66,0x73,0x5f,0x43,0x6f,0x6c,0x3b,0xd,0xa,0x7d,0xd,0xa,
// C:/Graduate/CIS560 - Computer Graphics/Assignments/hw00-course-prep-giaosame/Qt_GL_Test/glsl/lambert.vert.glsl
0x0,0x0,0x2,0x8e,
0x23,
0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x31,0x35,0x30,0xd,0xa,0x2f,0x2f,0x20,
0x5e,0x20,0x43,0x68,0x61,0x6e,0x67,0x65,0x20,0x74,0x68,0x69,0x73,0x20,0x74,0x6f,
0x20,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x31,0x33,0x30,0x20,0x69,0x66,0x20,
0x79,0x6f,0x75,0x20,0x68,0x61,0x76,0x65,0x20,0x63,0x6f,0x6d,0x70,0x61,0x74,0x69,
0x62,0x69,0x6c,0x69,0x74,0x79,0x20,0x69,0x73,0x73,0x75,0x65,0x73,0xd,0xa,0xd,
0xa,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x6d,0x61,0x74,0x34,0x20,0x75,0x5f,
0x4d,0x6f,0x64,0x65,0x6c,0x3b,0xd,0xa,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,
0x6d,0x61,0x74,0x34,0x20,0x75,0x5f,0x4d,0x6f,0x64,0x65,0x6c,0x49,0x6e,0x76,0x54,
0x72,0x3b,0xd,0xa,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x6d,0x61,0x74,0x34,
0x20,0x75,0x5f,0x56,0x69,0x65,0x77,0x50,0x72,0x6f,0x6a,0x3b,0xd,0xa,0xd,0xa,
0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x76,0x73,0x5f,0x50,0x6f,0x73,0x3b,0xd,
0xa,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x76,0x73,0x5f,0x4e,0x6f,0x72,0x3b,
0xd,0xa,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x76,0x73,0x5f,0x43,0x6f,0x6c,
0x3b,0xd,0xa,0xd,0xa,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x73,
0x5f,0x4e,0x6f,0x72,0x3b,0xd,0xa,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,
0x66,0x73,0x5f,0x4c,0x69,0x67,0x68,0x74,0x56,0x65,0x63,0x3b,0xd,0xa,0x6f,0x75,
0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x73,0x5f,0x43,0x6f,0x6c,0x3b,0xd,0xa,
0xd,0xa,0x63,0x6f,0x6e,0x73,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x6c,0x69,0x67,
0x68,0x74,0x50,0x6f,0x73,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x35,0x2c,0x20,
0x35,0x2c,0x20,0x33,0x2c,0x20,0x31,0x29,0x3b,0xd,0xa,0xd,0xa,0x76,0x6f,0x69,
0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0xd,0xa,0x7b,0xd,0xa,0x20,0x20,0x20,
0x20,0x66,0x73,0x5f,0x43,0x6f,0x6c,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x76,
0x73,0x5f,0x43,0x6f,0x6c,0x2c,0x20,0x31,0x29,0x3b,0xd,0xa,0x20,0x20,0x20,0x20,
0x66,0x73,0x5f,0x4e,0x6f,0x72,0x20,0x3d,0x20,0x75,0x5f,0x4d,0x6f,0x64,0x65,0x6c,
0x49,0x6e,0x76,0x54,0x72,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x76,0x73,0x5f,
0x4e,0x6f,0x72,0x2c,0x20,0x30,0x29,0x3b,0xd,0xa,0xd,0xa,0x20,0x20,0x20,0x20,
0x76,0x65,0x63,0x34,0x20,0x6d,0x6f,0x64,0x65,0x6c,0x70,0x6f,0x73,0x69,0x74,0x69,
0x6f,0x6e,0x20,0x3d,0x20,0x75,0x5f,0x4d,0x6f,0x64,0x65,0x6c,0x20,0x2a,0x20,0x76,
0x65,0x63,0x34,0x28,0x76,0x73,0x5f,0x50,0x6f,0x73,0x2c,0x20,0x31,0x29,0x3b,0xd,
0xa,0xd,0xa,0x20,0x20,0x20,0x20,0x2f,0x2f,0x20,0x53,0x65,0x74,0x20,0x75,0x70,
0x20,0x6f,0x75,0x72,0x20,0x76,0x65,0x63,0x74,0x6f,0x72,0x20,0x66,0x6f,0x72,0x20,
0x74,0x68,0x65,0x20,0x6c,0x69,0x67,0x68,0x74,0xd,0xa,0x20,0x20,0x20,0x20,0x66,
0x73,0x5f,0x4c,0x69,0x67,0x68,0x74,0x56,0x65,0x63,0x20,0x3d,0x20,0x6c,0x69,0x67,
0x68,0x74,0x50,0x6f,0x73,0x20,0x2d,0x20,0x6d,0x6f,0x64,0x65,0x6c,0x70,0x6f,0x73,
0x69,0x74,0x69,0x6f,0x6e,0x3b,0xd,0xa,0xd,0xa,0x20,0x20,0x20,0x20,0x2f,0x2f,
0x62,0x75,0x69,0x6c,0x74,0x2d,0x69,0x6e,0x20,0x74,0x68,0x69,0x6e,0x67,0x73,0x20,
0x74,0x6f,0x20,0x70,0x61,0x73,0x73,0x20,0x64,0x6f,0x77,0x6e,0x20,0x74,0x68,0x65,
0x20,0x70,0x69,0x70,0x65,0x6c,0x69,0x6e,0x65,0xd,0xa,0x20,0x20,0x20,0x20,0x67,
0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x75,0x5f,0x56,
0x69,0x65,0x77,0x50,0x72,0x6f,0x6a,0x20,0x2a,0x20,0x6d,0x6f,0x64,0x65,0x6c,0x70,
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0xd,0xa,0x7d,0xd,0xa,
// C:/Graduate/CIS560 - Computer Graphics/Assignments/hw00-course-prep-giaosame/Qt_GL_Test/glsl/wire.vert.glsl
0x0,0x0,0x1,0x88,
0x23,
0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x31,0x35,0x30,0xd,0xa,0x2f,0x2f,0x20,
0x5e,0x20,0x43,0x68,0x61,0x6e,0x67,0x65,0x20,0x74,0x68,0x69,0x73,0x20,0x74,0x6f,
0x20,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x31,0x33,0x30,0x20,0x69,0x66,0x20,
0x79,0x6f,0x75,0x20,0x68,0x61,0x76,0x65,0x20,0x63,0x6f,0x6d,0x70,0x61,0x74,0x69,
0x62,0x69,0x6c,0x69,0x74,0x79,0x20,0x69,0x73,0x73,0x75,0x65,0x73,0xd,0xa,0xd,
0xa,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x6d,0x61,0x74,0x34,0x20,0x75,0x5f,
0x4d,0x6f,0x64,0x65,0x6c,0x3b,0xd,0xa,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,
0x6d,0x61,0x74,0x34,0x20,0x75,0x5f,0x56,0x69,0x65,0x77,0x50,0x72,0x6f,0x6a,0x3b,
0xd,0xa,0xd,0xa,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x76,0x73,0x5f,0x50,
0x6f,0x73,0x3b,0xd,0xa,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x76,0x73,0x5f,
0x43,0x6f,0x6c,0x3b,0xd,0xa,0xd,0xa,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,
0x20,0x66,0x73,0x5f,0x43,0x6f,0x6c,0x3b,0xd,0xa,0xd,0xa,0x76,0x6f,0x69,0x64,
0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0xd,0xa,0x7b,0xd,0xa,0x20,0x20,0x20,0x20,
0x66,0x73,0x5f,0x43,0x6f,0x6c,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x76,0x73,
0x5f,0x43,0x6f,0x6c,0x2c,0x20,0x31,0x29,0x3b,0xd,0xa,0x20,0x20,0x20,0x20,0x76,
0x65,0x63,0x34,0x20,0x6d,0x6f,0x64,0x65,0x6c,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
0x6e,0x20,0x3d,0x20,0x75,0x5f,0x4d,0x6f,0x64,0x65,0x6c,0x20,0x2a,0x20,0x76,0x65,
0x63,0x34,0x28,0x76,0x73,0x5f,0x50,0x6f,0x73,0x2c,0x20,0x31,0x29,0x3b,0xd,0xa,
0xd,0xa,0x20,0x20,0x20,0x20,0x2f,0x2f,0x62,0x75,0x69,0x6c,0x74,0x2d,0x69,0x6e,
0x20,0x74,0x68,0x69,0x6e,0x67,0x73,0x20,0x74,0x6f,0x20,0x70,0x61,0x73,0x73,0x20,
0x64,0x6f,0x77,0x6e,0x20,0x74,0x68,0x65,0x20,0x70,0x69,0x70,0x65,0x6c,0x69,0x6e,
0x65,0xd,0xa,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,
0x6f,0x6e,0x20,0x3d,0x20,0x75,0x5f,0x56,0x69,0x65,0x77,0x50,0x72,0x6f,0x6a,0x20,
0x2a,0x20,0x6d,0x6f,0x64,0x65,0x6c,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,
0xd,0xa,0xd,0xa,0x7d,0xd,0xa,
};
static const unsigned char qt_resource_name[] = {
// glsl
0x0,0x4,
0x0,0x6,0xe3,0x9c,
0x0,0x67,
0x0,0x6c,0x0,0x73,0x0,0x6c,
// lambert.frag.glsl
0x0,0x11,
0xf,0x80,0x76,0xbc,
0x0,0x6c,
0x0,0x61,0x0,0x6d,0x0,0x62,0x0,0x65,0x0,0x72,0x0,0x74,0x0,0x2e,0x0,0x66,0x0,0x72,0x0,0x61,0x0,0x67,0x0,0x2e,0x0,0x67,0x0,0x6c,0x0,0x73,0x0,0x6c,
// wire.frag.glsl
0x0,0xe,
0x6,0xb4,0x67,0x1c,
0x0,0x77,
0x0,0x69,0x0,0x72,0x0,0x65,0x0,0x2e,0x0,0x66,0x0,0x72,0x0,0x61,0x0,0x67,0x0,0x2e,0x0,0x67,0x0,0x6c,0x0,0x73,0x0,0x6c,
// lambert.vert.glsl
0x0,0x11,
0x1,0x90,0x94,0x3c,
0x0,0x6c,
0x0,0x61,0x0,0x6d,0x0,0x62,0x0,0x65,0x0,0x72,0x0,0x74,0x0,0x2e,0x0,0x76,0x0,0x65,0x0,0x72,0x0,0x74,0x0,0x2e,0x0,0x67,0x0,0x6c,0x0,0x73,0x0,0x6c,
// wire.vert.glsl
0x0,0xe,
0x8,0x64,0x85,0x9c,
0x0,0x77,
0x0,0x69,0x0,0x72,0x0,0x65,0x0,0x2e,0x0,0x76,0x0,0x65,0x0,0x72,0x0,0x74,0x0,0x2e,0x0,0x67,0x0,0x6c,0x0,0x73,0x0,0x6c,
};
static const unsigned char qt_resource_struct[] = {
// :
0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x1,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
// :/glsl
0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x2,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
// :/glsl/lambert.vert.glsl
0x0,0x0,0x0,0x58,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x4,0x0,
0x0,0x0,0x1,0x6c,0xfd,0x12,0xd3,0x88,
// :/glsl/wire.frag.glsl
0x0,0x0,0x0,0x36,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x3,0x2b,
0x0,0x0,0x1,0x6c,0xfd,0x12,0xd3,0x89,
// :/glsl/wire.vert.glsl
0x0,0x0,0x0,0x80,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x6,0x92,
0x0,0x0,0x1,0x6c,0xfd,0x12,0xd3,0x8a,
// :/glsl/lambert.frag.glsl
0x0,0x0,0x0,0xe,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,
0x0,0x0,0x1,0x6c,0xfd,0x12,0xd3,0x87,
};
#ifdef QT_NAMESPACE
# define QT_RCC_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name
# define QT_RCC_MANGLE_NAMESPACE0(x) x
# define QT_RCC_MANGLE_NAMESPACE1(a, b) a##_##b
# define QT_RCC_MANGLE_NAMESPACE2(a, b) QT_RCC_MANGLE_NAMESPACE1(a,b)
# define QT_RCC_MANGLE_NAMESPACE(name) QT_RCC_MANGLE_NAMESPACE2( \
QT_RCC_MANGLE_NAMESPACE0(name), QT_RCC_MANGLE_NAMESPACE0(QT_NAMESPACE))
#else
# define QT_RCC_PREPEND_NAMESPACE(name) name
# define QT_RCC_MANGLE_NAMESPACE(name) name
#endif
#ifdef QT_NAMESPACE
namespace QT_NAMESPACE {
#endif
bool qRegisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *);
bool qUnregisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *);
#ifdef QT_NAMESPACE
}
#endif
int QT_RCC_MANGLE_NAMESPACE(qInitResources_glsl)();
int QT_RCC_MANGLE_NAMESPACE(qInitResources_glsl)()
{
int version = 3;
QT_RCC_PREPEND_NAMESPACE(qRegisterResourceData)
(version, qt_resource_struct, qt_resource_name, qt_resource_data);
return 1;
}
int QT_RCC_MANGLE_NAMESPACE(qCleanupResources_glsl)();
int QT_RCC_MANGLE_NAMESPACE(qCleanupResources_glsl)()
{
int version = 3;
QT_RCC_PREPEND_NAMESPACE(qUnregisterResourceData)
(version, qt_resource_struct, qt_resource_name, qt_resource_data);
return 1;
}
namespace {
struct initializer {
initializer() { QT_RCC_MANGLE_NAMESPACE(qInitResources_glsl)(); }
~initializer() { QT_RCC_MANGLE_NAMESPACE(qCleanupResources_glsl)(); }
} dummy;
}
| [
"giaosamchen@outlook.com"
] | giaosamchen@outlook.com |
f36209291fa5ffabf0813d1e4915d3f73dc36abb | 2f10f807d3307b83293a521da600c02623cdda82 | /deps/boost/win/debug/include/boost/archive/iterators/wchar_from_mb.hpp | 42fd08b1abf73beb55aed7c1c448dbdc8c66bc27 | [] | no_license | xpierrohk/dpt-rp1-cpp | 2ca4e377628363c3e9d41f88c8cbccc0fc2f1a1e | 643d053983fce3e6b099e2d3c9ab8387d0ea5a75 | refs/heads/master | 2021-05-23T08:19:48.823198 | 2019-07-26T17:35:28 | 2019-07-26T17:35:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 129 | hpp | version https://git-lfs.github.com/spec/v1
oid sha256:bed496e360b3331359b0ad19b3902a523a51aea93e949d15d003d62f76685ca8
size 5645
| [
"YLiLarry@gmail.com"
] | YLiLarry@gmail.com |
202a3629fc83a08d1f8b67692d67adbdd5c63264 | 8d88c774dd7979401f434c1b0e35e4cb9a42938e | /176.Second Highest Salary.cpp | 70b2725d6efdb53ba6cc2a5a89d9052da5ecc8f8 | [] | no_license | yycccccccc/Leetcode | 15a76eca96f6d5420416d806b5372bdf2c55efbf | 8e879cc1495e47f1230e968b941543326cb28f38 | refs/heads/master | 2020-05-27T08:09:58.411710 | 2019-03-28T06:46:43 | 2019-03-28T06:46:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 870 | cpp | # Write your MySQL query statement below
select
(select DISTINCT
Salary
from
Employee
order by
Salary DESC
LIMIT 1 OFFSET 1) as SecondHighestSalary
注意:
1.DISTINCT 唯一的、独特的,用于返回唯一不同的值。当多个值相同的时候只返回一个
2.LIMIT 1 OFFSET 1 返回1行,从第二行开始
##第一个被检索的行是第0行,而不是第1行。因此,LIMIT 1 OFFSET 1会检索第2行,而不是第1行
e.g.select * from student limit 4 offset 9,表示返回4行,9表示从表的第十行开始
3.升序:ASC
降序:DESC
4.需要注意,题意是如果没有第二高,应该返回空
SELECT DISTINCT
Salary AS SecondHighestSalary
FROM
Employee
ORDER BY Salary DESC
LIMIT 1 OFFSET 1
如果写成上述代码,不会产生空,只有SecondHighestSalary的标题,WA | [
"shuaiwang0121@gmail.com"
] | shuaiwang0121@gmail.com |
903d5f13968fdc396f8f309abc5b4fd1977dc140 | 98fea01b10bb8d716d3296798fe5674923416349 | /TribesAscendSDK/HeaderDump/TribesGame__TrAnimNotify_Sound.h | 32c105d0274182544490f200ea2d575f726b84fe | [] | no_license | NomadGSF/TASDK | 16378639fe63d41c926a057393b1f625adc49bba | ee0de87836b69cf334e4cb7750b567c62ff5aae2 | refs/heads/master | 2020-12-30T17:45:06.447552 | 2013-07-15T02:59:03 | 2013-07-15T02:59:03 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 888 | h | #pragma once
#define ADD_VAR( x, y, z ) ( ##x ) var_##y() \
{ \
static ScriptProperty *script_property = ScriptObject::Find< ScriptProperty >( #x " TribesGame.TrAnimNotify_Sound." #y ); \
return ( ##x( this, script_property->offset, z ) ); \
}
#define ADD_STRUCT( x, y, z ) ( ##x ) var_##y() \
{ \
static ScriptProperty *script_property = ScriptObject::Find< ScriptProperty >( "StructProperty TribesGame.TrAnimNotify_Sound." #y ); \
return ( ##x( this, script_property->offset, z ) ); \
}
#define ADD_OBJECT( x, y ) ( class x* ) var_##y() \
{ \
static ScriptProperty *script_property = ScriptObject::Find< ScriptProperty >( "ObjectProperty TribesGame.TrAnimNotify_Sound." #y ); \
return *( x** )( this + script_property->offset ); \
}
namespace UnrealScript
{
class TrAnimNotify_Sound : public AnimNotify_Sound
{
public:
};
}
#undef ADD_VAR
#undef ADD_STRUCT
#undef ADD_OBJECT
| [
"altimormc@gmail.com"
] | altimormc@gmail.com |
faded6c8f4650f77a8b6f4cfc226fe25fc70fa5b | 53b8bdde700a71a9506f963aef2b65a4eb22460c | /src/lib/geogram/mesh/mesh_fill_holes.cpp | 8e92e60fe2d0deac24c0268e2cc0eea21f17deb1 | [
"BSD-3-Clause"
] | permissive | alicevision/geogram | 967a607f5f5f74d5f176644c8ed6d031f1df4535 | dfc40f6805e962274665792932fc736d350c80b8 | refs/heads/master | 2023-07-04T23:35:54.395151 | 2022-07-11T09:59:45 | 2022-07-11T09:59:45 | 99,132,003 | 121 | 61 | BSD-3-Clause | 2022-08-16T20:02:11 | 2017-08-02T15:23:07 | C++ | UTF-8 | C++ | false | false | 26,282 | cpp | /*
* Copyright (c) 2012-2014, Bruno Levy
* 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 ALICE Project-Team nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* If you modify this software, you should include a notice giving the
* name of the person performing the modification, the date of modification,
* and the reason for such modification.
*
* Contact: Bruno Levy
*
* Bruno.Levy@inria.fr
* http://www.loria.fr/~levy
*
* ALICE Project
* LORIA, INRIA Lorraine,
* Campus Scientifique, BP 239
* 54506 VANDOEUVRE LES NANCY CEDEX
* FRANCE
*
*/
#include <geogram/mesh/mesh_fill_holes.h>
#include <geogram/mesh/mesh.h>
#include <geogram/mesh/mesh_repair.h>
#include <geogram/mesh/mesh_halfedges.h>
#include <geogram/mesh/mesh_io.h>
#include <geogram/mesh/index.h>
#include <geogram/basic/command_line.h>
#include <geogram/basic/logger.h>
#undef geo_debug_assert
#define geo_debug_assert(x) geo_assert(x)
namespace {
using namespace GEO;
/**
* \brief Checks whether a halfedge is
* incident to a vertex.
* \details Checks whether the origin of \p H
* is adjacent to \p v. In other words,
* returns true in one of the following
* configurations (the origin of \p H is
* denoted by \p x).
* \code
*
* H
* v--->x--->*
*
* H
* *--->x--->v
*
* \endcode
* \param[in] MH the mesh, wrapped with halfedge accessors
* \param[in] H the halfedge
* \param[in] v the index of the vertex
*/
bool halfedge_has_neighbor(
const MeshHalfedges& MH,
const MeshHalfedges::Halfedge& H,
index_t v
) {
geo_debug_assert(MH.halfedge_is_valid(H));
const Mesh& M = MH.mesh();
index_t f = H.facet;
index_t c = H.corner;
{
index_t cnext = M.facets.next_corner_around_facet(f, c);
if(M.facet_corners.vertex(cnext) == v) {
return true;
}
}
{
index_t cprev = M.facets.prev_corner_around_facet(f, c);
if(M.facet_corners.vertex(cprev) == v) {
return true;
}
}
return false;
}
/**
* \brief Checks whether an halfedge exists between
* the two origins of two halfedges.
* \param[in] MH the mesh, wrapped with halfedge accessors
* \param[in] h1 first halfedge
* \param[in] h2 second halfedge
* \return true if an halfedge exists between the origins
* of \p h1 and \p h2, false otherwise
*/
bool halfedge_exists_between_vertices(
const MeshHalfedges& MH,
const MeshHalfedges::Halfedge& h1,
const MeshHalfedges::Halfedge& h2
) {
index_t v2 = MH.mesh().facet_corners.vertex(h2.corner);
MeshHalfedges::Halfedge H = h1;
do {
if(halfedge_has_neighbor(MH, H, v2)) {
return true;
}
if(!MH.move_to_prev_around_vertex(H)) {
break;
}
} while(H != h1);
return false;
}
/**
* \brief Gets the 3d vertex at the origin of a halfedge.
* \param[in] MH the mesh, wrapped with halfedge accessors
* \param[in] H the halfedge
* \return a const reference to the geometry of the 3d vertex at the
* origin of \p H
*/
inline const vec3& halfedge_vertex(
const MeshHalfedges& MH, const MeshHalfedges::Halfedge& H
) {
return Geom::mesh_vertex(
MH.mesh(), MH.mesh().facet_corners.vertex(H.corner)
);
}
/**
* \brief Internal representation of a Hole.
* \details A Hole is an ordered sequence of Halfedge.
*/
typedef vector<MeshHalfedges::Halfedge> Hole;
/**
* \brief Computes a vector orthogonal to the border of a surface and in the
* tangent plane of the surface.
* \param[in] MH the mesh, wrapped with halfedge accessors
* \param[in] H the halfedge
* \return a 3d vector orthogonal to \p H, in the plange of the
* surface triangle incident to \p H and pointing towards the
* exterior of the surface.
*/
vec3 border_normal(
const MeshHalfedges& MH,
const MeshHalfedges::Halfedge& H
) {
const Mesh& M = MH.mesh();
index_t c = H.corner;
index_t f = H.facet;
index_t v1 = M.facet_corners.vertex(c);
c = M.facets.next_corner_around_facet(f, c);
index_t v2 = M.facet_corners.vertex(c);
vec3 E = Geom::mesh_vertex(M, v2) - Geom::mesh_vertex(M, v1);
vec3 N = Geom::mesh_facet_normal(M, f);
return cross(E, N);
}
/**
* \brief Splits a hole into two.
* \details This function is used recursively to triangulate the holes.
* \param[in] MH the mesh, wrapped with halfedge accessors
* \param[in] hole the hole to be split
* \param[out] hole1 one of the computed halves
* \param[out] hole2 the other half
* \param[in] use_normals if set, then couples of vertices
* (v1,v2) that have their border normals that match
* the new segment [v1,v2], are connected in priority.
* This improves the result on 788_raw_hand.off (but
* may cause some triangles overlap)
* \retval true on success
* \retval false otherwise (for instance, if no valid edge
* could be found to split the hole)
*/
bool split_hole(
const MeshHalfedges& MH, const Hole& hole,
Hole& hole1, Hole& hole2, bool use_normals
) {
// Step 0: compute normals to border
vector<vec3> N;
if(use_normals) {
N.assign(hole.size(), vec3(0.0, 0.0, 0.0));
for(index_t i = 0; i < hole.size(); i++) {
index_t j = i + 1;
if(j == hole.size()) {
j = 0;
}
vec3 n = border_normal(MH, hole[i]);
N[i] += n;
N[j] += n;
}
for(index_t i = 0; i < N.size(); i++) {
N[i] = normalize(N[i]);
}
}
// Step 1: compute total curve length and curvilinear abscissa
vector<double> s(hole.size());
double cur_s = 0.0;
s[0] = cur_s;
for(index_t i = 1; i < hole.size(); i++) {
const vec3& p1 = halfedge_vertex(MH, hole[i - 1]);
const vec3& p2 = halfedge_vertex(MH, hole[i]);
cur_s += length(p2 - p1);
s[i] = cur_s;
}
const vec3& p1 = halfedge_vertex(MH, hole[hole.size() - 1]);
const vec3& p2 = halfedge_vertex(MH, hole[0]);
double total_length = cur_s + length(p2 - p1);
// Step 2: find best pair to connect
double best_rij = Numeric::max_float64();
signed_index_t v1 = -1;
signed_index_t v2 = -1;
for(index_t i = 0; i < hole.size(); i++) {
for(index_t j = i + 2; j < hole.size(); j++) {
// Do not split using vertices
// already connected by an edge.
if(
(i == 0 && j == hole.size() - 1) ||
halfedge_exists_between_vertices(MH, hole[i], hole[j])
) {
continue;
}
double dsij = std::min(
s[j] - s[i], total_length - (s[j] - s[i])
);
const vec3& pi = halfedge_vertex(MH, hole[i]);
const vec3& pj = halfedge_vertex(MH, hole[j]);
double dxij = length(pj - pi);
dsij = std::max(dsij, 1e-6);
dxij = std::max(dxij, 1e-6);
double rij = dxij / dsij;
if(use_normals) {
const vec3& Pi = halfedge_vertex(MH, hole[i]);
const vec3& Pj = halfedge_vertex(MH, hole[j]);
vec3 Dij = normalize(Pj - Pi);
// between -1 (worse) and 1 (best)
double angle_factor =
0.5 * (dot(Dij, N[i]) - dot(Dij, N[j]));
// between 0 (best) and 1 (worse)
angle_factor = 0.5 * (1.0 - angle_factor);
rij *= angle_factor;
}
if(rij < best_rij) {
best_rij = rij;
v1 = signed_index_t(i);
v2 = signed_index_t(j);
}
}
}
if(v1 == -1 || v2 == -1) {
return false;
}
// Now I do not think this can happen
// (to be checked)
if(v2 < v1) {
std::swap(v1, v2);
}
// Step 3: copy the two "sub-holes"
hole1.clear();
hole2.clear();
for(signed_index_t i = 0; i < signed_index_t(hole.size()); i++) {
if(i <= v1 || i >= v2) {
hole1.push_back(hole[i]);
}
if(i >= v1 && i <= v2) {
hole2.push_back(hole[i]);
}
}
return true;
}
/**
* \brief Triangulates a hole.
* \param[in] MH the mesh, wrapped with halfedge accessors
* \param[in] hole the hole, represented by a vector of halfedges
* \param[out] triangles the generated triangles
* \param[in] use_normals if set, then couples of vertices
* (v1,v2) that have their border normals that match
* the new segment [v1,v2], are connected in priority.
* This improves the result on 788_raw_hand.off (but
* may cause some triangles overlap)
* \param[in] clear if set, \p triangles is cleared
* \retval true on success
* \retval false otherwise (for instance, if no valid edge
* could be found to split the hole)
*/
bool triangulate_hole_loop_splitting(
const MeshHalfedges& MH, const Hole& hole,
vector<trindex>& triangles, bool use_normals,
bool clear = true
) {
bool ok = true;
if(clear) {
triangles.clear();
}
if(hole.size() <= 3) {
if(hole.size() == 3) {
trindex T(
MH.mesh().facet_corners.vertex(hole[0].corner),
MH.mesh().facet_corners.vertex(hole[1].corner),
MH.mesh().facet_corners.vertex(hole[2].corner),
trindex::KEEP_ORDER
);
triangles.push_back(T);
}
} else {
Hole hole1, hole2;
ok = split_hole(MH, hole, hole1, hole2, use_normals);
ok = ok && triangulate_hole_loop_splitting(
MH, hole1, triangles, use_normals, false
);
ok = ok && triangulate_hole_loop_splitting(
MH, hole2, triangles, use_normals, false
);
}
return ok;
}
/************************************************************************/
/**
* \brief Computes the score obtained when generating a triangle
* in the ear cutting algorithm triangulate_hole_ear_cutting().
* \param[in] M the mesh
* \param[in] T1 first triangle, encoded as a vertex indices triplet
* \param[in] T2 second triangle, encoded as a vertex indices triplet
* \return the score obtained when generating an ear from \p T1 to \p T2
*/
double ear_score(
const Mesh& M,
const trindex& T1,
const trindex& T2
) {
geo_debug_assert(T1.indices[1] == T2.indices[0]);
const vec3& p10 = Geom::mesh_vertex(M, T1.indices[0]);
const vec3& p11 = Geom::mesh_vertex(M, T1.indices[1]);
const vec3& p12 = Geom::mesh_vertex(M, T1.indices[2]);
const vec3& p20 = Geom::mesh_vertex(M, T2.indices[0]);
const vec3& p21 = Geom::mesh_vertex(M, T2.indices[1]);
const vec3& p22 = Geom::mesh_vertex(M, T2.indices[2]);
vec3 n = normalize(
Geom::triangle_normal(p10, p11, p12) +
Geom::triangle_normal(p20, p21, p22)
);
vec3 a = normalize(p11 - p10);
vec3 b = normalize(p21 - p20);
return -::atan2(dot(n, cross(a, b)), dot(a, b));
}
/**
* \brief Triangulates a hole using the ear cutting algorithm.
* \param[in] MH the mesh, wrapped with halfedge accessors
* \param[in] hole_in the hole, represented by a vector of halfedges
* \param[out] triangles the generated triangles
* \param[out] clear if set, \p triangles is cleared
*/
void triangulate_hole_ear_cutting(
const MeshHalfedges& MH, const Hole& hole_in,
vector<trindex>& triangles, bool clear = true
) {
if(clear) {
triangles.clear();
}
if(hole_in.size() <= 3) {
if(hole_in.size() == 3) {
trindex T(
MH.mesh().facet_corners.vertex(hole_in[0].corner),
MH.mesh().facet_corners.vertex(hole_in[1].corner),
MH.mesh().facet_corners.vertex(hole_in[2].corner),
trindex::KEEP_ORDER
);
triangles.push_back(T);
}
} else {
const Mesh& M = MH.mesh();
// Step 1: convert hole into easier-to-manipulate representation.
vector<trindex> hole;
hole.reserve(hole_in.size());
for(index_t i = 0; i < hole_in.size(); i++) {
const MeshHalfedges::Halfedge& H = hole_in[i];
geo_debug_assert(H.facet != MeshHalfedges::Halfedge::NO_FACET);
index_t c = H.corner;
index_t v1 = M.facet_corners.vertex(c);
c = M.facets.next_corner_around_facet(H.facet, c);
index_t v2 = M.facet_corners.vertex(c);
c = M.facets.next_corner_around_facet(H.facet, c);
index_t v3 = M.facet_corners.vertex(c);
hole.push_back(trindex(v1, v2, v3, trindex::KEEP_ORDER));
}
// Step 2: ear cutting
while(hole.size() > 3) {
signed_index_t best_i1 = -1;
double best_score = Numeric::min_float64();
// TODO: take existing edges into account.
for(index_t i1 = 0; i1 < hole.size(); i1++) {
index_t i2 = i1 + 1;
if(i2 == hole.size()) {
i2 = 0;
}
double score = ear_score(M, hole[i1], hole[i2]);
if(score > best_score) {
best_i1 = signed_index_t(i1);
best_score = score;
}
}
geo_assert(best_i1 != -1);
index_t best_i2 = index_t(best_i1) + 1;
if(best_i2 == hole.size()) {
best_i2 = 0;
}
const trindex& T1 = hole[best_i1];
const trindex& T2 = hole[best_i2];
geo_debug_assert(T1.indices[1] == T2.indices[0]);
trindex T(
T1.indices[0], T2.indices[1], T1.indices[1],
trindex::KEEP_ORDER
);
hole[best_i1] = T;
hole.erase(hole.begin() + std::ptrdiff_t(best_i2));
triangles.push_back(T);
}
// Step 3: last triangle
geo_assert(hole.size() == 3);
trindex T(
hole[0].indices[0],
hole[1].indices[0],
hole[2].indices[0],
trindex::KEEP_ORDER
);
triangles.push_back(T);
}
}
/************************************************************************/
/**
* \brief Computes the area of a hole, i.e. the area of the generated
* triangles that will fill the hole.
* \param[in] M the mesh
* \param[in] triangles the triangles that will fill the hole
* \return the summed ares of the triangles in \p triangles
*/
double hole_area(
const Mesh& M, const vector<trindex>& triangles
) {
double result = 0.0;
for(index_t t = 0; t < triangles.size(); t++) {
index_t i = triangles[t].indices[0];
index_t j = triangles[t].indices[1];
index_t k = triangles[t].indices[2];
const vec3& p1 = Geom::mesh_vertex(M, i);
const vec3& p2 = Geom::mesh_vertex(M, j);
const vec3& p3 = Geom::mesh_vertex(M, k);
result += Geom::triangle_area(p1, p2, p3);
}
return result;
}
/**
* \brief Strategy used to fill the holes.
*/
enum HoleFilling {
LOOP_SPLIT, /**< Splits loops by generating small segments */
NLOOP_SPLIT, /**< Takes normals into account */
EAR_CUT /**< Uses the "ear cutting" strategy */
};
/************************************************************************/
/**
* \brief Removes all the facets of a mesh that are
* on a bridge.
* \details A facet is said to be on a bridge if it is
* incident to a border and if when turning around the
* border it is encountered more than once.
*/
void remove_bridges(Mesh& M) {
MeshHalfedges MH(M);
vector<bool> corner_is_visited(M.facet_corners.nb(),false);
vector<index_t> f_status(M.facets.nb(),0);
index_t f_stamp=1;
const index_t BRIDGE = index_t(-1);
for(index_t f: M.facets) {
for(index_t c: M.facets.corners(f)) {
if(
M.facet_corners.adjacent_facet(c) == NO_FACET &&
!corner_is_visited[c]
) {
MeshHalfedges::Halfedge first(f, c);
MeshHalfedges::Halfedge H(f, c);
do {
corner_is_visited[H.corner] = true;
MH.move_to_next_around_facet(H);
while(MH.move_to_next_around_vertex(H)) {
if(f_status[H.facet] == f_stamp) {
f_status[H.facet] = BRIDGE;
} else if(
f_status[H.facet] != BRIDGE &&
f_status[H.facet] != f_stamp) {
f_status[H.facet] = f_stamp;
}
}
} while(H != first);
++f_stamp;
}
}
}
index_t nb_bridges = 0;
for(index_t f: M.facets) {
if(f_status[f] == BRIDGE) {
++nb_bridges;
} else {
f_status[f] = 0;
}
}
if(nb_bridges != 0) {
M.facets.delete_elements(f_status);
Logger::out("Bridges")
<< "Removed " << nb_bridges << " bridge(s)"
<< std::endl;
}
}
}
/****************************************************************************/
namespace GEO {
void fill_holes(
Mesh& M, double max_area, index_t max_edges, bool repair
) {
// mesh_save(M, "before_fill_holes.geogram");
if(max_area == 0.0 || max_edges == 0) {
return;
}
remove_bridges(M);
MeshHalfedges MH(M);
vector<Hole> holes;
index_t nb_filled_holes = 0;
index_t nb_skipped_by_edges = 0;
index_t nb_skipped_by_area = 0;
index_t nb_could_not_fill = 0;
// Step 1: detect holes
{
vector<bool> corner_is_visited(M.facet_corners.nb(), false);
for(index_t f: M.facets) {
for(index_t c: M.facets.corners(f)) {
if(
M.facet_corners.adjacent_facet(c) == NO_FACET &&
!corner_is_visited[c]
) {
holes.push_back(Hole());
MeshHalfedges::Halfedge first(f, c);
MeshHalfedges::Halfedge H(f, c);
do {
holes.rbegin()->push_back(H);
corner_is_visited[H.corner] = true;
MH.move_to_next_around_border(H);
} while(H != first);
if(holes.rbegin()->size() > max_edges) {
++nb_skipped_by_edges;
holes.pop_back();
}
}
}
}
}
if(holes.size() == 0) {
return;
}
Logger::out("FillHoles") << "Found " << holes.size()
<< " holes" << std::endl;
HoleFilling algo = LOOP_SPLIT;
std::string algo_name = CmdLine::get_arg("algo:hole_filling");
if(algo_name == "loop_split") {
algo = LOOP_SPLIT;
} else if(algo_name == "Nloop_split") {
algo = NLOOP_SPLIT;
} else if(algo_name == "ear_cut") {
algo = EAR_CUT;
} else {
Logger::warn("FillHoles")
<< algo_name << ": no such hole filling method"
<< std::endl;
Logger::warn("FillHoles")
<< "falling back to \'loop_split\'"
<< std::endl;
}
for(index_t i = 0; i < holes.size(); i++) {
vector<trindex> triangles;
bool ok = true;
switch(algo) {
case LOOP_SPLIT:
ok = triangulate_hole_loop_splitting(
MH, holes[i], triangles, false
);
break;
case NLOOP_SPLIT:
ok = triangulate_hole_loop_splitting(
MH, holes[i], triangles, true
);
break;
case EAR_CUT:
triangulate_hole_ear_cutting(MH, holes[i], triangles);
break;
}
if(ok) {
if(hole_area(M, triangles) < max_area) {
for(index_t j = 0; j < triangles.size(); j++) {
M.facets.create_triangle(
triangles[j].indices[2],
triangles[j].indices[1],
triangles[j].indices[0]
);
}
++nb_filled_holes;
} else {
++nb_skipped_by_area;
}
} else {
++nb_could_not_fill;
}
}
if(nb_skipped_by_area != 0) {
Logger::out("FillHoles")
<< "Skipped " << nb_skipped_by_area
<< " holes (area too large)" << std::endl;
}
if(nb_skipped_by_edges != 0) {
Logger::out("FillHoles")
<< "Skipped " << nb_skipped_by_edges
<< " holes (too many edges)" << std::endl;
}
if(nb_could_not_fill != 0) {
Logger::out("FillHoles")
<< "Skipped " << nb_could_not_fill
<< " holes (could not fill)" << std::endl;
}
if(nb_filled_holes != 0 && repair) {
// Needed because we may generate zero-length edges
// and zero-area facets that need to be eliminated.
// Note: this also reconstructs the connections between the facets.
MeshRepairMode mode = MESH_REPAIR_DEFAULT;
mesh_repair(M, mode);
}
}
/**
* \brief Tessellates a hole.
* \param[in] MH the MeshHalfHeddes the hole belongs to.
* \param[in] H the hole.
* \param[in] max_nb_vertices maximum number of vertices in
* the new facets to create.
* \param[in] copy_facet_attrib an optional facet index. If
* specified, all the attributes of this facet will be copied
* to the created facets.
*/
static void tessellate_hole(
MeshHalfedges& MH, Hole& H, index_t max_nb_vertices,
index_t copy_facet_attrib = index_t(-1)
) {
Mesh& M = MH.mesh();
if(H.size() <= max_nb_vertices) {
index_t f = M.facets.create_polygon(H.size());
FOR(i,H.size()) {
index_t v = M.facet_corners.vertex(H[i].corner);
M.facets.set_vertex(f,i,v);
}
if(copy_facet_attrib != index_t(-1)) {
M.facets.attributes().copy_item(f, copy_facet_attrib);
}
} else {
Hole H1,H2;
split_hole(MH,H,H1,H2,false);
tessellate_hole(MH,H1,max_nb_vertices,copy_facet_attrib);
tessellate_hole(MH,H2,max_nb_vertices,copy_facet_attrib);
}
}
void tessellate_facets(
Mesh& M, index_t max_nb_vertices
) {
MeshHalfedges MH(M);
vector<index_t> delete_f(M.facets.nb(),0);
for(index_t f: M.facets) {
if(M.facets.nb_vertices(f) > max_nb_vertices) {
delete_f[f] = 1;
Hole h;
for(index_t c: M.facets.corners(f)) {
h.push_back(MeshHalfedges::Halfedge(f,c));
}
tessellate_hole(MH, h, max_nb_vertices, f);
}
}
delete_f.resize(M.facets.nb());
M.facets.delete_elements(delete_f);
M.facets.connect();
if(max_nb_vertices == 3) {
M.facets.is_simplicial();
}
}
}
| [
"simone.gasparini@gmail.com"
] | simone.gasparini@gmail.com |
14e1a55956bc459069b024759d5fa00c384f798a | e521b57eb5d414b28c9e152e6c0921e8ab77ad43 | /PEInfo/PEInfo/main.cpp | 8f0ee80d1b8e866a99258c4411ea91f5f83182f3 | [
"Apache-2.0"
] | permissive | zhaojunchen/PEViewPlus | 90658d2e3c25a16e21c287970e563eaef32c41cb | ba36236bb6b2f88d1f326188f81203edb37cdfd9 | refs/heads/master | 2022-12-28T12:53:09.072123 | 2020-09-23T02:56:18 | 2020-09-23T02:56:18 | 259,530,475 | 2 | 1 | null | null | null | null | GB18030 | C++ | false | false | 30,021 | cpp | /*
author: ls
*/
# define _CRT_SECURE_NO_WARNINGS
# include <QtCore/QCoreApplication>
# include "stdio.h"
# include "stdlib.h"
# include "windows.h"
# include "PE.h"
# include "string"
# include "qdebug.h"
#include <IMAGEHLP.H>
#pragma comment(lib, "ImageHlp.lib")
/*
1、定位导入表,并打印出导入表中的内容、同时打印出INT表和IAT表
*/
int PrintImportTable(PVOID FileAddress)
{
int ret = 0;
//1、指向相关内容
PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)(FileAddress);
PIMAGE_FILE_HEADER pFileHeader = (PIMAGE_FILE_HEADER)((DWORD)pDosHeader + pDosHeader->e_lfanew + 4);
PIMAGE_OPTIONAL_HEADER32 pOptionalHeader = (PIMAGE_OPTIONAL_HEADER32)((DWORD)pFileHeader + sizeof(IMAGE_FILE_HEADER));
//2、获取导入表的地址
DWORD ImportDirectory_RVAAdd = pOptionalHeader->DataDirectory[1].VirtualAddress;
DWORD ImportDirectory_FOAAdd = 0;
// (1)、判断导入表是否存在
if (ImportDirectory_RVAAdd == 0)
{
printf("ImportDirectory 不存在!\n");
return ret;
}
// (2)、获取导入表的FOA地址
ret = RVA_TO_FOA(FileAddress, ImportDirectory_RVAAdd, &ImportDirectory_FOAAdd);
if (ret != 0)
{
printf("func RVA_TO_FOA() Error!\n");
return ret;
}
//3、指向导入表
PIMAGE_IMPORT_DESCRIPTOR ImportDirectory = (PIMAGE_IMPORT_DESCRIPTOR)((DWORD)FileAddress + ImportDirectory_FOAAdd);
//4、循环打印每一个导入表的信息 重要成员为0时结束循环
while (ImportDirectory->FirstThunk && ImportDirectory->OriginalFirstThunk)
{
// (1)获取导入文件的名字
DWORD ImportNameAdd_RVA = ImportDirectory->Name;
DWORD ImportNameAdd_FOA = 0;
ret = RVA_TO_FOA(FileAddress, ImportNameAdd_RVA, &ImportNameAdd_FOA);
if (ret != 0)
{
printf("func RVA_TO_FOA() Error!\n");
return ret;
}
PCHAR pImportName = (PCHAR)((DWORD)FileAddress + ImportNameAdd_FOA);
printf("=========================ImportTable %s Start=============================\n", pImportName);
printf("OriginalFirstThunk RVA:%08X\n", ImportDirectory->OriginalFirstThunk);
// (2)指向INT表
DWORD OriginalFirstThunk_RVA = ImportDirectory->OriginalFirstThunk;
DWORD OriginalFirstThunk_FOA = 0;
ret = RVA_TO_FOA(FileAddress, OriginalFirstThunk_RVA, &OriginalFirstThunk_FOA);
if (ret != 0)
{
printf("func RVA_TO_FOA() Error!\n");
return ret;
}
PDWORD OriginalFirstThunk_INT = (PDWORD)((DWORD)FileAddress + OriginalFirstThunk_FOA);
// (3)循环打印INT表的内容 当内容为0时结束
while (*OriginalFirstThunk_INT)
{
// (4)进行判断,如果最高位为1则是按序号导入信息,去掉最高位就是函数序号,否则是名字导入
if ((*OriginalFirstThunk_INT) >> 31) //最高位是1,序号导入
{
// (5)获取函数序号
DWORD Original = *OriginalFirstThunk_INT << 1 >> 1; //去除最高标志位。
printf("按序号导入: %08Xh -- %08dd\n", Original, Original); //16进制 -- 10 进制
}
else //名字导入
{
// (5)获取函数名
DWORD ImportNameAdd_RAV = *OriginalFirstThunk_INT;
DWORD ImportNameAdd_FOA = 0;
ret = RVA_TO_FOA(FileAddress, ImportNameAdd_RAV, &ImportNameAdd_FOA);
if (ret != 0)
{
printf("func RVA_TO_FOA() Error!\n");
return ret;
}
PIMAGE_IMPORT_BY_NAME ImportName = (PIMAGE_IMPORT_BY_NAME)((DWORD)FileAddress + ImportNameAdd_FOA);
printf("按名字导入[HINT/NAME]: %02X--%s\n", ImportName->Hint, ImportName->Name);
}
// (6)指向下一个地址
OriginalFirstThunk_INT++;
}
printf("----------------------------------------------------------------\n");
printf("FirstThunk RVA :%08X\n", ImportDirectory->FirstThunk);
printf("TimeDateStamp :%08X\n", ImportDirectory->TimeDateStamp);
// (2)指向IAT表
DWORD FirstThunk_RVA = ImportDirectory->FirstThunk;
DWORD FirstThunk_FOA = 0;
ret = RVA_TO_FOA(FileAddress, FirstThunk_RVA, &FirstThunk_FOA);
if (ret != 0)
{
printf("func RVA_TO_FOA() Error!\n");
return ret;
}
PDWORD FirstThunk_IAT = (PDWORD)((DWORD)FileAddress + FirstThunk_FOA);
// (3)判断IAT表是否被绑定 时间戳 = 0:没有绑定地址 时间戳 = 0xFFFFFFFF:绑定地址 ——知识在绑定导入表中
if (ImportDirectory->TimeDateStamp == 0xFFFFFFFF)
{
while (*FirstThunk_IAT)
{
printf("绑定函数地址: %08X\n", *FirstThunk_IAT);
FirstThunk_IAT++;
}
}
else
{
// (4)循环打印IAT表的内容 当内容为0时结束 打印方法和INT表一样
while (*FirstThunk_IAT)
{
// (5)进行判断,如果最高位为1则是按序号导入信息,去掉最高位就是函数序号,否则是名字导入
if ((*FirstThunk_IAT) >> 31) //最高位是1,序号导入
{
// (6)获取函数序号
DWORD Original = *FirstThunk_IAT << 1 >> 1; //去除最高标志位。
printf("按序号导入: %08Xh -- %08dd\n", Original, Original); //16进制 -- 10 进制
}
else //名字导入
{
// (7)获取函数名
DWORD ImportNameAdd_RAV = *FirstThunk_IAT;
DWORD ImportNameAdd_FOA = 0;
ret = RVA_TO_FOA(FileAddress, ImportNameAdd_RAV, &ImportNameAdd_FOA);
if (ret != 0)
{
printf("func RVA_TO_FOA() Error!\n");
return ret;
}
PIMAGE_IMPORT_BY_NAME ImportName = (PIMAGE_IMPORT_BY_NAME)((DWORD)FileAddress + ImportNameAdd_FOA);
printf("按名字导入[HINT/NAME]: %02X--%s\n", ImportName->Hint, ImportName->Name);
}
FirstThunk_IAT++;
}
}
printf("=========================ImportTable %s End =============================\n", pImportName);
// (8)指向下一个导入表
ImportDirectory++;
}
return ret;
}
/*
读64位输入表
*/
int PrintImportTable_64(PVOID FileAddress)
{
int ret = 0;
PIMAGE_NT_HEADERS64 pNTHeader64;
PIMAGE_DOS_HEADER pDosHeader;
pDosHeader = (PIMAGE_DOS_HEADER)FileAddress;
pNTHeader64 = (PIMAGE_NT_HEADERS64)((DWORD)FileAddress + pDosHeader->e_lfanew);
PIMAGE_IMPORT_DESCRIPTOR ImportDirectory;
PIMAGE_THUNK_DATA64 _pThunk = NULL;
DWORD dwThunk = NULL;
USHORT Hint;
if (pNTHeader64->OptionalHeader.DataDirectory[1].VirtualAddress == 0)
{
printf("no import table!");
return ret;
}
ImportDirectory = (PIMAGE_IMPORT_DESCRIPTOR)ImageRvaToVa((PIMAGE_NT_HEADERS)pNTHeader64, pDosHeader, pNTHeader64->OptionalHeader.DataDirectory[1].VirtualAddress, NULL);
printf("=================== import table start ===================\n");
for (; ImportDirectory->Name != NULL;)
{
char* szName = (PSTR)ImageRvaToVa((PIMAGE_NT_HEADERS)pNTHeader64, pDosHeader, (ULONG)ImportDirectory->Name, 0);
printf("%s\n", szName);
if (ImportDirectory->OriginalFirstThunk != 0)
{
dwThunk = ImportDirectory->OriginalFirstThunk;
_pThunk = (PIMAGE_THUNK_DATA64)ImageRvaToVa((PIMAGE_NT_HEADERS)pNTHeader64, pDosHeader, (ULONG)ImportDirectory->OriginalFirstThunk, NULL);
}
else
{
dwThunk = ImportDirectory->FirstThunk;
_pThunk = (PIMAGE_THUNK_DATA64)ImageRvaToVa((PIMAGE_NT_HEADERS)pNTHeader64, pDosHeader, (ULONG)ImportDirectory->FirstThunk, NULL);
}
for (; _pThunk->u1.AddressOfData != NULL;)
{
char* szFun = (PSTR)ImageRvaToVa((PIMAGE_NT_HEADERS)pNTHeader64, pDosHeader, (ULONG)(((PIMAGE_IMPORT_BY_NAME)_pThunk->u1.AddressOfData)->Name), 0);
if (szFun != NULL)
memcpy(&Hint, szFun - 2, 2);
else
Hint = -1;
printf("\t%0.4x\t%0.8x\t%s\n", Hint, dwThunk, szFun);
dwThunk += 8;
_pThunk++;
}
ImportDirectory++;
}
printf("=================== import table end ===================\n");
return ret;
}
/*
读64位pe输出表
*/
int PrintExportTable_64(PVOID FileAddress)
{
int ret = 0;
//1.指向相关内容
PIMAGE_NT_HEADERS64 pNTHeader64;
PIMAGE_DOS_HEADER pDosHeader;
PIMAGE_EXPORT_DIRECTORY pExportDirectory;
pDosHeader = (PIMAGE_DOS_HEADER)FileAddress;
pNTHeader64 = (PIMAGE_NT_HEADERS64)((DWORD)FileAddress + pDosHeader->e_lfanew);
if (pNTHeader64->OptionalHeader.DataDirectory[0].VirtualAddress == 0)
{
printf("no export table!");
return ret;
}
pExportDirectory = (PIMAGE_EXPORT_DIRECTORY)ImageRvaToVa((PIMAGE_NT_HEADERS)pNTHeader64, pDosHeader, pNTHeader64->OptionalHeader.DataDirectory[0].VirtualAddress, NULL);
DWORD i = 0;
DWORD NumberOfNames = pExportDirectory->NumberOfNames;
//printf("%d\n", NumberOfNames);
//printf("%d\n", pExportDirectory->NumberOfFunctions);
//DWORD NumberOF
ULONGLONG** NameTable = (ULONGLONG**)pExportDirectory->AddressOfNames;
NameTable = (PULONGLONG*)ImageRvaToVa((PIMAGE_NT_HEADERS)pNTHeader64, pDosHeader, (ULONG)NameTable, NULL);
ULONGLONG** AddressTable = (ULONGLONG**)pExportDirectory->AddressOfFunctions;
AddressTable = (PULONGLONG*)ImageRvaToVa((PIMAGE_NT_HEADERS)pNTHeader64, pDosHeader, (DWORD)AddressTable, NULL);
ULONGLONG** OrdinalTable = (ULONGLONG**)ImageRvaToVa((PIMAGE_NT_HEADERS)pNTHeader64, pDosHeader, (ULONG)pExportDirectory->AddressOfNameOrdinals, NULL);
//OrdinalTable = (PULONGLONG*)ImageRvaToVa((PIMAGE_NT_HEADERS)pNTHeader64, pDosHeader, (DWORD)OrdinalTable, NULL);
//PIMAGE_IMPORT_BY_NAME;
char* szFun = (PSTR)ImageRvaToVa((PIMAGE_NT_HEADERS)pNTHeader64, pDosHeader, (ULONG)*NameTable, NULL);
printf("=================== export table start ===================\n");
for (i = 0; i < NumberOfNames; i++)
{
printf("%0.4x\t%0.8x\t%s\n", i + pExportDirectory->Base, *AddressTable, szFun);
//printf("%s\n", szFun);
szFun = szFun + strlen(szFun) + 1;
AddressTable++;
/*if (i % 200 == 0 && i / 200 >= 1)
{
printf("{Press [ENTER] to continue...}");
getchar();
}*/
}
printf("=================== export table end ===================\n");
return ret;
}
// IAT
int PrintFunctionAddressTable(PVOID FileAddress, DWORD AddressOfFunctions_RVA, DWORD NumberOfFunctions)
{
int ret = 0;
DWORD AddressOfFunctions_FOA = 0;
//1、RVA --> FOA
ret = RVA_TO_FOA(FileAddress, AddressOfFunctions_RVA, &AddressOfFunctions_FOA);
if (ret != 0)
{
printf("func RVA_TO_FOA() Error!\n");
return ret;
}
//2、指向函数地址表
PDWORD FuncAddressTable = (PDWORD)((DWORD)FileAddress + AddressOfFunctions_FOA);
//2、循环打印函数地址表
printf("=================== 函数地址表 Start ===================\n");
for (DWORD i = 0; i < NumberOfFunctions; i++)
{
DWORD FuncAddress_RVA = FuncAddressTable[i];
DWORD FuncAddress_FOA = 0;
ret = RVA_TO_FOA(FileAddress, FuncAddress_RVA, &FuncAddress_FOA);
if (ret != 0)
{
printf("func RVA_TO_FOA() Error!\n");
return ret;
}
printf("函数地址RVA : %08X |函数地址FOA : %08X \n", FuncAddress_RVA, FuncAddress_FOA);
}
printf("=================== 函数地址表 End ===================\n\n");
return ret;
}
//打印函数序号表
int PrintFunctionOrdinalTable(PVOID FileAddress, DWORD AddressOfOrdinal_RVA, DWORD NumberOfNames, DWORD Base)
{
int ret = 0;
DWORD AddressOfOrdinal_FOA = 0;
//1、RVA --> FOA
ret = RVA_TO_FOA(FileAddress, AddressOfOrdinal_RVA, &AddressOfOrdinal_FOA);
if (ret != 0)
{
printf("func RVA_TO_FOA() Error!\n");
return ret;
}
//2、指向函数序号表
PWORD OrdinalTable = (PWORD)((DWORD)FileAddress + AddressOfOrdinal_FOA);
//3、循环打印函数序号表
printf("=================== 函数序号表 Start ===================\n");
for (DWORD i = 0; i < NumberOfNames; i++)
{
printf("函数序号 :%04X |Base+Ordinal :%04X\n", OrdinalTable[i], OrdinalTable[i] + Base);
}
printf("=================== 函数序号表 End ===================\n\n");
return ret;
}
//打印函数名字表
int PrintFunctionNameTable(PVOID FileAddress, DWORD AddressOfNames_RVA, DWORD NumberOfNames)
{
int ret = 0;
DWORD AddressOfNames_FOA = 0;
//1、RVA --> FOA
ret = RVA_TO_FOA(FileAddress, AddressOfNames_RVA, &AddressOfNames_FOA);
if (ret != 0)
{
printf("func RVA_TO_FOA() Error!\n");
return ret;
}
//2、指向函数名表
PDWORD NameTable = (PDWORD)((DWORD)FileAddress + AddressOfNames_FOA);
//3、循环打印函数序号表
printf("=================== 函数名表 Start ===================\n");
for (DWORD i = 0; i < NumberOfNames; i++)
{
DWORD FuncName_RVA = NameTable[i];
DWORD FuncName_FOA = 0;
ret = RVA_TO_FOA(FileAddress, FuncName_RVA, &FuncName_FOA);
if (ret != 0)
{
printf("func RVA_TO_FOA() Error!\n");
return ret;
}
PCHAR FuncName = (PCHAR)((DWORD)FileAddress + FuncName_FOA);
printf("函数名 :%s\n", FuncName);
}
printf("=================== 函数名表 End ===================\n\n");
return ret;
}
/*
输出表
*/
int PrintExportTable(PVOID FileAddress)
{
int ret = 0;
//1、指向相关内容
PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)(FileAddress);
PIMAGE_FILE_HEADER pFileHeader = (PIMAGE_FILE_HEADER)((DWORD)pDosHeader + pDosHeader->e_lfanew + 4);
PIMAGE_OPTIONAL_HEADER32 pOptionalHeader = (PIMAGE_OPTIONAL_HEADER32)((DWORD)pFileHeader + sizeof(IMAGE_FILE_HEADER));
printf("%02X\n", pOptionalHeader->Magic);
//2、获取导出表的地址
DWORD ExportDirectory_RAVAdd = pOptionalHeader->DataDirectory[0].VirtualAddress;
DWORD ExportDirectory_FOAAdd = 0;
// (1)、判断导出表是否存在
if (ExportDirectory_RAVAdd == 0)
{
printf("ExportDirectory 不存在!\n");
return ret;
}
// (2)、获取导出表的FOA地址
ret = RVA_TO_FOA(FileAddress, ExportDirectory_RAVAdd, &ExportDirectory_FOAAdd);
if (ret != 0)
{
printf("func RVA_TO_FOA() Error!\n");
return ret;
}
//3、指向导出表
PIMAGE_EXPORT_DIRECTORY ExportDirectory = (PIMAGE_EXPORT_DIRECTORY)((DWORD)FileAddress + ExportDirectory_FOAAdd);
//4、找到文件名
DWORD FileName_RVA = ExportDirectory->Name;
DWORD FileName_FOA = 0;
ret = RVA_TO_FOA(FileAddress, FileName_RVA, &FileName_FOA);
if (ret != 0)
{
printf("func RVA_TO_FOA() Error!\n");
return ret;
}
PCHAR FileName = (PCHAR)((DWORD)FileAddress + FileName_FOA);
//5、打印导出表信息
printf("*********************************************************\n");
printf("=======================ExportTable=======================\n");
printf("DWORD Characteristics; : %08X\n", ExportDirectory->Characteristics);
printf("DWORD TimeDateStamp; : %08X\n", ExportDirectory->TimeDateStamp);
printf("WORD MajorVersion; : %04X\n", ExportDirectory->MajorVersion);
printf("WORD MinorVersion; : %04X\n", ExportDirectory->MinorVersion);
printf("DWORD Name; : %08X \"%s\"\n", ExportDirectory->Name, FileName);
printf("DWORD Base; : %08X\n", ExportDirectory->Base);
printf("DWORD NumberOfFunctions; : %08X\n", ExportDirectory->NumberOfFunctions);
printf("DWORD NumberOfNames; : %08X\n", ExportDirectory->NumberOfNames);
printf("DWORD AddressOfFunctions; : %08X\n", ExportDirectory->AddressOfFunctions);
printf("DWORD AddressOfNames; : %08X\n", ExportDirectory->AddressOfNames);
printf("DWORD AddressOfNameOrdinals; : %08X\n", ExportDirectory->AddressOfNameOrdinals);
printf("=========================================================\n");
printf("*********************************************************\n");
//6、打印函数地址表 数量由NumberOfFunctions决定
ret = PrintFunctionAddressTable(FileAddress, ExportDirectory->AddressOfFunctions, ExportDirectory->NumberOfFunctions);
if (ret != 0)
{
printf("func PrintFunctionAddressTable() Error!\n");
return ret;
}
//7、打印函数序号表 数量由NumberOfNames决定
ret = PrintFunctionOrdinalTable(FileAddress, ExportDirectory->AddressOfNameOrdinals, ExportDirectory->NumberOfNames, ExportDirectory->Base);
if (ret != 0)
{
printf("func PrintFunctionOrdinalTable() Error!\n");
return ret;
}
//8、打印函数名表 数量由NumberOfNames决定
ret = PrintFunctionNameTable(FileAddress, ExportDirectory->AddressOfNames, ExportDirectory->NumberOfNames);
if (ret != 0)
{
printf("func PrintFunctionNameTable() Error!\n");
return ret;
}
return ret;
}
/*
重定位表
*/
int PrintReloactionTable(PVOID FileAddress)
{
int ret = 0;
//1、指向相关内容
PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)(FileAddress);
PIMAGE_FILE_HEADER pFileHeader = (PIMAGE_FILE_HEADER)((DWORD)pDosHeader + pDosHeader->e_lfanew + 4);
PIMAGE_OPTIONAL_HEADER32 pOptionalHeader = (PIMAGE_OPTIONAL_HEADER32)((DWORD)pFileHeader + sizeof(IMAGE_FILE_HEADER));
//2、获取重定位表的地址
DWORD RelocationDirectory_RAVAdd = pOptionalHeader->DataDirectory[5].VirtualAddress;
DWORD RelocationDirectory_FOAAdd = 0;
// (1)、判断重定位表是否存在
if (RelocationDirectory_RAVAdd == 0)
{
printf("RelocationDirectory 不存在!\n");
return ret;
}
// (2)、获取重定位表的FOA地址
ret = RVA_TO_FOA(FileAddress, RelocationDirectory_RAVAdd, &RelocationDirectory_FOAAdd);
if (ret != 0)
{
printf("func RVA_TO_FOA() Error!\n");
return ret;
}
//3、指向重定位表
PIMAGE_BASE_RELOCATION RelocationDirectory = (PIMAGE_BASE_RELOCATION)((DWORD)FileAddress + RelocationDirectory_FOAAdd);
//4、循环打印重定位信息 当VirtualAddress和SizeOfBlock都为0时遍历完成
while (RelocationDirectory->VirtualAddress && RelocationDirectory->SizeOfBlock)
{
printf("VirtualAddress :%08X\n", RelocationDirectory->VirtualAddress);
printf("SizeOfBlock :%08X\n", RelocationDirectory->SizeOfBlock);
printf("================= BlockData Start ======================\n");
//5、计算在当前块中的数据个数
DWORD DataNumber = (RelocationDirectory->SizeOfBlock - 8) / 2;
//6、指向数据块
PWORD DataGroup = (PWORD)((DWORD)RelocationDirectory + 8);
//7、循环打印数据块中的数据
for (DWORD i = 0; i < DataNumber; i++)
{
//(1)判断高4位是否为0
if (DataGroup[i] >> 12 != 0)
{
//(2)提取数据块中的有效数据 低12位
WORD BlockData = DataGroup[i] & 0xFFF;
//(3)计算数据块的RVA和FOA
DWORD Data_RVA = RelocationDirectory->VirtualAddress + BlockData;
DWORD Data_FOA = 0;
ret = RVA_TO_FOA(FileAddress, Data_RVA, &Data_FOA);
if (ret != 0)
{
printf("func RVA_TO_FOA() Error!\n");
return ret;
}
//(4)获取需要重定位的数据
PDWORD RelocationData = (PDWORD)((DWORD)FileAddress + Data_FOA);
printf("第[%04X]项 |数据 :[%04X] |数据的RVA :[%08X] |数据属性 :[%X] |重定位数据 :[%08X]\n", i + 1, BlockData, Data_RVA, (DataGroup[i] >> 12), *RelocationData);
}
}
printf("================= BlockData End ========================\n");
//指向下一个数据块
RelocationDirectory = (PIMAGE_BASE_RELOCATION)((DWORD)RelocationDirectory + RelocationDirectory->SizeOfBlock);
}
return ret;
}
/*
资源表
*/
int PrintResourceTable(PVOID FileAddress)
{
/*string szResType[0x11] = { 0, "鼠标指针", "位图", "图标", "菜单",
"对话框", "字符串列表", "字体目录", "字体",
"加速键", "非格式化资源", "消息列表", "鼠标指针组",
"zz", "图标组", "xx", "版本信息" };
*/
int szResType[17] = { '0', '1', '2', '3', '4', '5', '6', '7', '8',
'9', '10', '11', '12', '13', '14', '15', '16' };
int ret = 0;
//1、指向相关内容
PIMAGE_DOS_HEADER pDosHeader = (PIMAGE_DOS_HEADER)(FileAddress);
PIMAGE_FILE_HEADER pFileHeader = (PIMAGE_FILE_HEADER)((DWORD)pDosHeader + pDosHeader->e_lfanew + 4);
PIMAGE_OPTIONAL_HEADER32 pOptionalHeader = (PIMAGE_OPTIONAL_HEADER32)((DWORD)pFileHeader + sizeof(IMAGE_FILE_HEADER));
//2、获取资源表的地址
DWORD ResourceDirectory_RVAAdd = pOptionalHeader->DataDirectory[2].VirtualAddress;
DWORD ResourceDirectory_FOAAdd = 0;
// (1)、判断资源表是否存在
if (ResourceDirectory_RVAAdd == 0)
{
printf("ResourceDirectory 不存在!\n");
return ret;
}
// (2)、获取资源表的FOA地址
ret = RVA_TO_FOA(FileAddress, ResourceDirectory_RVAAdd, &ResourceDirectory_FOAAdd);
if (ret != 0)
{
printf("func RVA_TO_FOA() Error!\n");
return ret;
}
//3、指向资源表
PIMAGE_RESOURCE_DIRECTORY ResourceDirectory = (PIMAGE_RESOURCE_DIRECTORY)((DWORD)FileAddress + ResourceDirectory_FOAAdd);
//4、打印资源表信息(一级目录)
printf("|==================================================\n");
printf("|资源表一级目录信息:\n");
printf("|Characteristics :%08X\n", ResourceDirectory->Characteristics);
printf("|TimeDateStamp :%08X\n", ResourceDirectory->TimeDateStamp);
printf("|MajorVersion :%04X\n", ResourceDirectory->MajorVersion);
printf("|MinorVersion :%04X\n", ResourceDirectory->MinorVersion);
printf("|NumberOfNamedEntries :%04X\n", ResourceDirectory->NumberOfNamedEntries);
printf("|NumberOfIdEntries :%04X\n", ResourceDirectory->NumberOfIdEntries);
printf("|==================================================\n");
//4、循环打印后续资源表信息
// (1)指向一级目录中的资源目录项(一级目录) 资源类型
PIMAGE_RESOURCE_DIRECTORY_ENTRY ResourceDirectoryEntry = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)((DWORD)ResourceDirectory + sizeof(IMAGE_RESOURCE_DIRECTORY));
printf("|----------------------------------------\n");
for (int i = 0; i < (ResourceDirectory->NumberOfIdEntries + ResourceDirectory->NumberOfNamedEntries); i++)
{
// (2)判断一级目录中的资源目录项中类型是否是字符串 1 = 字符串(非标准类型); 0 = 非字符串(标准类型)
if (ResourceDirectoryEntry->NameIsString) //字符串(非标准类型)
{
// 1.指向名字结构体
PIMAGE_RESOURCE_DIR_STRING_U pStringName = (PIMAGE_RESOURCE_DIR_STRING_U)((DWORD)ResourceDirectory + ResourceDirectoryEntry->NameOffset);
// 2.将Unicode字符串转换成ASCII字符串
CHAR TypeName[20] = { 0 };
for (int j = 0; j < pStringName->Length; j++)
{
TypeName[j] = (CHAR)pStringName->NameString[j];
}
// 3.打印字符串
printf("|ResourceType :\"%s\"\n", TypeName);
}
else //非字符串(标准类型)
{
if (ResourceDirectoryEntry->Id < 0x11) //只有1 - 16有定义
printf("|ResourceType :%d\n", szResType[ResourceDirectoryEntry->Id]);
else
printf("|ResourceType :%04Xh\n", ResourceDirectoryEntry->Id);
}
// (3)判断一级目录中子节点的类型 1 = 目录; 0 = 数据 (一级目录和二级目录该值都为1)
if (ResourceDirectoryEntry->DataIsDirectory)
{
// (4)打印目录偏移
printf("|OffsetToDirectory :%08X\n", ResourceDirectoryEntry->OffsetToDirectory);
printf("|----------------------------------------\n");
// (5)指向二级目录 资源编号
PIMAGE_RESOURCE_DIRECTORY ResourceDirectory_Sec = (PIMAGE_RESOURCE_DIRECTORY)((DWORD)ResourceDirectory + ResourceDirectoryEntry->OffsetToDirectory);
// (6)打印资源表信息(二级目录)
printf(" |====================================\n");
printf(" |资源表二级目录信息:\n");
printf(" |Characteristics :%08X\n", ResourceDirectory_Sec->Characteristics);
printf(" |TimeDateStamp :%08X\n", ResourceDirectory_Sec->TimeDateStamp);
printf(" |MajorVersion :%04X\n", ResourceDirectory_Sec->MajorVersion);
printf(" |MinorVersion :%04X\n", ResourceDirectory_Sec->MinorVersion);
printf(" |NumberOfNamedEntries :%04X\n", ResourceDirectory_Sec->NumberOfNamedEntries);
printf(" |NumberOfIdEntries :%04X\n", ResourceDirectory_Sec->NumberOfIdEntries);
printf(" |====================================\n");
// (7)指向二级目录中的资源目录项
PIMAGE_RESOURCE_DIRECTORY_ENTRY ResourceDirectoryEntry_Sec = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)((DWORD)ResourceDirectory_Sec + sizeof(IMAGE_RESOURCE_DIRECTORY));
// (8)循环打印二级目录
for (int j = 0; j < (ResourceDirectory_Sec->NumberOfIdEntries + ResourceDirectory_Sec->NumberOfNamedEntries); j++)
{
// (9)判断二级目录中的资源目录项中编号是否是字符串
if (ResourceDirectoryEntry_Sec->NameIsString) //字符串(非标准类型)
{
// 1.指向名字结构体
PIMAGE_RESOURCE_DIR_STRING_U pStringName = (PIMAGE_RESOURCE_DIR_STRING_U)((DWORD)ResourceDirectory + ResourceDirectoryEntry_Sec->NameOffset);
// 2.将Unicode字符串转换成ASCII字符串
CHAR TypeName[20] = { 0 };
for (int k = 0; k < pStringName->Length; k++)
{
TypeName[k] = (CHAR)pStringName->NameString[k];
}
// 3.打印字符串
printf(" |ResourceNumber :\"%s\"\n", TypeName);
}
else //非字符串(标准类型)
{
printf(" |ResourceNumber :%04Xh\n", ResourceDirectoryEntry_Sec->Id);
}
// (10)判断二级目录中子节点的类型
if (ResourceDirectoryEntry_Sec->DataIsDirectory)
{
// (11)打印目录偏移
printf(" |OffsetToDirectory :%08X\n", ResourceDirectoryEntry_Sec->OffsetToDirectory);
printf(" |------------------------------------\n");
// (12)指向三级目录 代码页
PIMAGE_RESOURCE_DIRECTORY ResourceDirectory_Thir = (PIMAGE_RESOURCE_DIRECTORY)((DWORD)ResourceDirectory + ResourceDirectoryEntry_Sec->OffsetToDirectory);
// (13)打印资源表信息(三级目录)
printf(" |================================\n");
printf(" |资源表三级目录信息:\n");
printf(" |Characteristics :%08X\n", ResourceDirectory_Thir->Characteristics);
printf(" |TimeDateStamp :%08X\n", ResourceDirectory_Thir->TimeDateStamp);
printf(" |MajorVersion :%04X\n", ResourceDirectory_Thir->MajorVersion);
printf(" |MinorVersion :%04X\n", ResourceDirectory_Thir->MinorVersion);
printf(" |NumberOfNamedEntries :%04X\n", ResourceDirectory_Thir->NumberOfNamedEntries);
printf(" |NumberOfIdEntries :%04X\n", ResourceDirectory_Thir->NumberOfIdEntries);
printf(" |================================\n");
// (14)指向三级目录中的资源目录项
PIMAGE_RESOURCE_DIRECTORY_ENTRY ResourceDirectoryEntry_Thir = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)((DWORD)ResourceDirectory_Thir + sizeof(IMAGE_RESOURCE_DIRECTORY));
// (15)循环打印三级目录项
for (int k = 0; k < (ResourceDirectory_Thir->NumberOfNamedEntries + ResourceDirectory_Thir->NumberOfIdEntries); k++)
{
// (16)判断三级目录中的资源目录项中编号是否是字符串
if (ResourceDirectoryEntry_Thir->NameIsString) //字符串(非标准类型)
{
// 1.指向名字结构体
PIMAGE_RESOURCE_DIR_STRING_U pStringName = (PIMAGE_RESOURCE_DIR_STRING_U)((DWORD)ResourceDirectory + ResourceDirectoryEntry_Thir->NameOffset);
// 2.将Unicode字符串转换成ASCII字符串
CHAR TypeName[20] = { 0 };
for (int k = 0; k < pStringName->Length; k++)
{
TypeName[k] = (CHAR)pStringName->NameString[k];
}
// 3.打印字符串
printf(" |CodePageNumber :\"%s\"\n", TypeName);
}
else //非字符串(标准类型)
{
printf(" |CodePageNumber :%04Xh\n", ResourceDirectoryEntry_Thir->Id);
}
// (17)判断三级目录中子节点的类型 (三级目录子节点都是数据,这里可以省去判断)
if (ResourceDirectoryEntry_Thir->DataIsDirectory)
{
// (18)打印偏移
printf(" |OffsetToDirectory :%08X\n", ResourceDirectoryEntry_Thir->OffsetToDirectory);
printf(" |------------------------------------\n");
}
else
{
// (18)打印偏移
printf(" |OffsetToData :%08X\n", ResourceDirectoryEntry_Thir->OffsetToData);
printf(" |------------------------------------\n");
// (19)指向数据内容 (资源表的FOA + OffsetToData)
PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry = (PIMAGE_RESOURCE_DATA_ENTRY)((DWORD)ResourceDirectory + ResourceDirectoryEntry_Thir->OffsetToData);
// (20)打印数据信息
printf(" |================================\n");
printf(" |资源表的数据信息\n");
printf(" |OffsetToData(RVA) :%08X\n", ResourceDataEntry->OffsetToData);
printf(" |Size :%08X\n", ResourceDataEntry->Size);
printf(" |CodePage :%08X\n", ResourceDataEntry->CodePage);
printf(" |================================\n");
}
ResourceDirectoryEntry_Thir++;
}
}
// (21)目录项后移
ResourceDirectoryEntry_Sec++;
}
}
printf("|----------------------------------------\n");
// (22)目录项后移
ResourceDirectoryEntry++;
}
return ret;
}
int main()
{
int ret = 0;
PVOID FileAddress = NULL;
//1、将文件读入到内存
ret = MyReadFile(&FileAddress);
if (ret != 0)
{
if (FileAddress != NULL)
free(FileAddress);
return ret;
}
//2、打印导入表信息64位
ret = PrintImportTable_64(FileAddress);
if (ret != 0)
{
if (FileAddress != NULL)
free(FileAddress);
return ret;
}
qDebug() << "print done\n";
//2、打印导出表信息64位
/*ret = PrintExportTable_64(FileAddress);
if (ret != 0)
{
if (FileAddress != NULL)
free(FileAddress);
return ret;
}*/
//2、打印导入表信息
/*ret = PrintImportTable(FileAddress);
if (ret != 0)
{
if (FileAddress != NULL)
free(FileAddress);
return ret;
}*/
//3、输出表
/*ret = PrintExportTable(FileAddress);
if (ret != 0)
{
if (FileAddress != NULL)
free(FileAddress);
return ret;
}*/
//4、打印重定位表信息
/*ret = PrintReloactionTable(FileAddress);
if (ret != 0)
{
if (FileAddress != NULL)
free(FileAddress);
return ret;
}*/
//5、打印资源表的信息
/*ret = PrintResourceTable(FileAddress);
if (ret != 0)
{
if (FileAddress != NULL)
free(FileAddress);
return ret;
}*/
//checkFile
ret = checkFile(FileAddress);
if (ret != 0)
{
if (FileAddress != NULL)
free(FileAddress);
return ret;
}
qDebug() << "check done\n";
if (FileAddress != NULL)
free(FileAddress);
system("pause");
return ret;
}
//异常表[3]
| [
"1827108135@qq.com"
] | 1827108135@qq.com |
bb385ffdb2330c6844a6145e9a032a213ef76f9a | 0cac6ddd49496d3966f2ee73024491b1766e56cc | /2309.cpp | 13446264a10bd45ddb668f037ae107804ab7edd7 | [] | no_license | tmddsu95/ACMICPC | 27e4b1e2e4b822a952671052e189dea6a2e99bd6 | a7465ac7a59143dfc7691eaf77ff21a423b48f8c | refs/heads/master | 2020-06-19T08:25:55.749867 | 2019-07-19T14:51:00 | 2019-07-19T14:51:00 | 196,638,231 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 526 | cpp | #include <iostream>
#include <algorithm>
using namespace std;
bool check = false;
int main(void)
{
int a[9];
int sum = 0;
for (int i = 0; i < 9; i++) {
cin >> a[i];
}
for (int i = 0; i < 9; i++) sum += a[i];
int ans = 0;
ans = sum-100;
for (int i = 0; i < 9; i++) {
for (int j = i+1; j < 9; j++) {
if (a[i] + a[j] == ans ) {
a[i] = 0;
a[j] = 0;
check = true;
break;
}
if (check)
break;
}
}
sort(a, a + 9);//정렬
for (int i = 2; i < 9; i++) cout << a[i] << endl;
return 0;
}
| [
"noreply@github.com"
] | tmddsu95.noreply@github.com |
3e7f23f2e0a0c6ef96bbb029239ffbb181ae04bc | 8291a58e0639319a509d81c664f07345092a6f34 | /2DEngine/j1FileSystem.h | 5728db29062131bc9a82f268d99d43f986755b05 | [] | no_license | kellazo/2DEngine | 77234a5852b77b4f0d4089a5fdb4994a662d2933 | 60489b21959ccde50604336f8df2c3dddf596b37 | refs/heads/master | 2021-01-12T17:49:49.142291 | 2016-10-13T21:23:06 | 2016-10-13T21:23:06 | 69,399,722 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,116 | h | #ifndef __j1FILESYSTEM_H__
#define __j1FILESYSTEM_H__
#include "j1Module.h"
struct SDL_RWops;
int close_sdl_rwops(SDL_RWops *rw);
class j1FileSystem : public j1Module
{
public:
j1FileSystem(const char* game_path);
// Destructor
virtual ~j1FileSystem();
// Called before render is available
bool Awake(pugi::xml_node&);
// Open for Read/Write
unsigned int Load(const char* file, char** buffer) const;
SDL_RWops* Load(const char* file) const;
//utility methods
unsigned int Exist(const char* file) const;
unsigned int Size(const char* fileptr) const;
bool CreateDir(const char* directory, const char* writeDirectory) const;
unsigned int IsDir(const char* fname) const;
bool Delete(const char* file_or_dir, const char* writeDirectory) const;
bool Mount(const char* newDir, const char* mountPoint = NULL) const;
const char* SetWritingDir(const char* organization, const char* application) const;
unsigned int BufferToFile(const char* file, const char* buffer, unsigned int size) const;
const char* GetSaveDirectory() const
{
return "save/";
}
private:
};
#endif // __j1FILESYSTEM_H__ | [
"gilli11519@gmail.com"
] | gilli11519@gmail.com |
21b4058a0e7f4e107f909c05397ce82d93af5b0d | 183e242af385f62a44057b9e53f48da56ce0ab52 | /SFML/SFML02-Snake/src/Textbox.h | ab888049e0e31856ea02b7bead0a5a9f1358f738 | [
"MIT"
] | permissive | Gaetz/cpp-training | ade384e99b6b690ff69a4c552f128f3ede7f196b | 5191da36be37c5bef18637ba82f1edac1c2474fa | refs/heads/master | 2021-01-19T16:41:56.910412 | 2020-04-07T20:38:49 | 2020-04-07T20:38:49 | 101,016,941 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 700 | h | #pragma once
#include <vector>
#include <string>
#include <SFML/Graphics.hpp>
using MessageContainer = std::vector<std::string>;
class Textbox
{
public:
Textbox();
Textbox(int visible, int charSize, int width, sf::Vector2f screenPosition);
~Textbox();
/// Setup text box
void setup(int visible, int charSize, int width, sf::Vector2f screenPosition);
/// Add text in textbox
void add(std::string message);
/// Clear textbox
void clear();
/// Draw textbox in window
void render(sf::RenderWindow &window);
private:
MessageContainer mMessages;
int mNumVisible;
sf::RectangleShape mBackdrop;
sf::Font mFont;
sf::Text mContent;
}; | [
"gaetz@rufflerim.com"
] | gaetz@rufflerim.com |
dc5ee80d9e7d20f67d3ab9d4c78eeb30413c7bb6 | 659161ee6efa05509e679ed30dbac187db1ad0cf | /CPP-02-D.05_StaticMembers/CPP-02-D.05_StaticMembers/src/StaticMembers.cpp | bcccec27d20bb8f71ff129da365f1d06c04a2ab5 | [] | no_license | tjasmin21/CPP_Projects | 9c504f46a4eee42cff855c68cc5efd9a960011c1 | f36af0399fe00de23181252f8b58b2a9a1291c08 | refs/heads/master | 2021-04-15T09:51:57.349239 | 2018-06-24T16:44:03 | 2018-06-24T16:44:03 | 126,486,605 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,702 | cpp | ///////////////////////////////////////////////////////////////////////////////
// Demo: CPP-02.05D - Static Members (Example: Object Counter) //
///////////////////////////////////////////////////////////////////////////////
#include <iostream>
using namespace std;
class CPoint
///////////////////////////////////////////////////////////////////////////////
{
private: // data member
static int iCount; // count of used Objects
int iX; // x coordinate of point
int iY; // y coordinate of point
public: // data member
static bool bVisible; // visibility of all points
public: // function member
CPoint() {iCount++;};
~CPoint() {iCount--;};
static int GetCount() {return iCount;};
static void ShowVisibility();
void SetVisibility(bool flag) {bVisible = flag;};
};
// init static members ////////////////////////////////////////////////////////
int CPoint::iCount = 0;
bool CPoint::bVisible = true;
void CPoint::ShowVisibility()
///////////////////////////////////////////////////////////////////////////////
{
// try to access non static class members
//CPoint::iX = 0;
//SetVisibility(true);
// show visibility of points
cout << "Visibility: " << CPoint::bVisible << endl;
}
int main()
///////////////////////////////////////////////////////////////////////////////
{
// define pointer to point
CPoint *pPoint;
// show count of points
cout << "\nCount: " << CPoint::GetCount() << " (no object created)" << endl;
// create static point and show current count
CPoint P1;
cout << "Count: " << CPoint::GetCount() << " (static object created)" << endl;
// create dynamic point and show current count
pPoint = new CPoint;
cout << "Count: " << CPoint::GetCount() << " (dynamic object created)" << endl;
cout << "Count: " << P1.GetCount() << endl;
cout << "Count: " << pPoint->GetCount() << endl;
// delete dynamic created point and show current count
delete pPoint;
cout << "Count: " << CPoint::GetCount() << " (dynamic object deleted)" << endl << endl;
// show and set visibility flag (static class member function calls)
CPoint::ShowVisibility();
P1.SetVisibility(false);
P1.ShowVisibility();
/* begin array demo
// create dynamic point array and show current count
pPoint = new CPoint[100];
cout << "\nCount: " << CPoint::GetCount() << " (dynamic array created)" << endl;
// delete dynamic created point array and show current count
delete[] pPoint;
cout << "Count: " << CPoint::GetCount() << " (dynamic array deleted)" << endl;
// end array demo */
return 0;
}
| [
"Jasmin.thevathas@sitasys.com"
] | Jasmin.thevathas@sitasys.com |
53f1e38d9503c11e27a3e11024f8cefeaab7af5a | 6d5aaac34dfeb1fbfc11da874727f6c0b247e0fb | /ThirdParty/Theia/main.cpp | 8868c718e2cf77c5b08b70bc91d26224d2a38974 | [] | no_license | minhpvo/Tmp | e44ad5c6dbdb4f3b3ff777a97948dbc971dde5d8 | 3b968f51ccafaf8b16c363d55df4ccf2644ae117 | refs/heads/main | 2023-02-02T08:17:16.534551 | 2020-12-19T00:16:07 | 2020-12-19T00:16:07 | 322,732,218 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,740 | cpp | #include <Eigen/Core>
#include <Eigen/Geometry>
#include <vector>
#include <iostream>
#include <random>
#include "perspective_three_point.h"
#include "four_point_focal_length.h"
#include "epnp.h"
#include "dls_pnp.h"
#include "util.h"
using namespace std;
using namespace Eigen;
using Eigen::AngleAxisd;
using Eigen::Map;
using Eigen::Matrix3d;
using Eigen::Quaterniond;
using Eigen::Vector2d;
using Eigen::Vector3d;
typedef Eigen::Matrix<double, 3, 4> Matrix3x4d;
std::random_device rd; //Will be used to obtain a seed for the random number engine
std::mt19937 gen(rd()); //Standard mersenne_twister_engine seeded with rd()
double RandDouble(const double lower, const double upper)
{
std::uniform_real_distribution<double> distribution(lower, upper);
return distribution(gen);
}
void AddNoiseToProjection(const double noise_factor, Vector2d* ray)
{
*ray += Eigen::Vector2d(RandDouble(-noise_factor, noise_factor), RandDouble(-noise_factor, noise_factor));
}
int P4Pf_Test(const double noise, const double reproj_tolerance)
{
const double focal = 800;
const double x = -0.10; // rotation of the view around x axis
const double y = -0.20; // rotation of the view around y axis
const double z = 0.30; // rotation of the view around z axis
// Create a ground truth pose.
Matrix3d Rz, Ry, Rx;
Rz << cos(z), sin(z), 0,
-sin(z), cos(z), 0,
0, 0, 1;
Ry << cos(y), 0, -sin(y),
0, 1, 0,
sin(y), 0, cos(y);
Rx << 1, 0, 0,
0, cos(x), sin(x),
0, -sin(x), cos(x);
const Matrix3d gt_rotation = Rz * Ry * Rx;
const Vector3d gt_translation = Vector3d(-0.00950692, 0.0171496, 0.0508743);
cout << gt_rotation << endl;
// Create 3D world points that are viable based on the camera intrinsics and extrinsics.
std::vector<Vector3d> world_points_vector = { Vector3d(-1.0, 0.5, 1.2),
Vector3d(-0.79, -0.68, 1.9),
Vector3d(1.42, 1.01, 2.19),
Vector3d(0.87, -0.49, 0.89),
Vector3d(0.0, -0.69, -1.09) };
Map<const Matrix<double, 3, 4> > world_points(world_points_vector[0].data());
// Camera intrinsics matrix.
const Matrix3d camera_matrix = Eigen::DiagonalMatrix<double, 3>(focal, focal, 1.0);
// Create the projection matrix P = K * [R t].
Matrix<double, 3, 4> gt_projection;
gt_projection << gt_rotation, gt_translation;
gt_projection = camera_matrix * gt_projection;
// Reproject 3D points to get undistorted image points.
std::vector<Eigen::Vector2d> image_points_vector(4);
Map<Matrix<double, 2, 4> > image_point(image_points_vector[0].data());
image_point = (gt_projection * world_points.colwise().homogeneous()).colwise().hnormalized();
/*FILE *fp = fopen("C:/temp/X.txt", "w+");
for (int ii = 0; ii < 4; ii++)
fprintf(fp, "%.16f %.16f %.16f\n", world_points(0, ii), world_points(1, ii), world_points(2, ii));
fclose(fp);
fp = fopen("C:/temp/y.txt", "w+");
for (int ii = 0; ii < 4; ii++)
fprintf(fp, "%.16f %.16f\n", image_point(0, ii), image_point(1, ii));
fclose(fp);*/
// Run P4pf algorithm.
std::vector<double> focal_length;
std::vector<Matrix<double, 3, 4> > soln_projection;
std::vector<Matrix<double, 3, 3> > soln_rotation;
std::vector<Vector3d > soln_translation;
int num_solns = FourPointPoseAndFocalLength(image_points_vector, world_points_vector, focal_length, &soln_rotation, &soln_translation);
double K[9], R[9], T[3], P[12];
int goodSol;
bool matched_transform;
for (int jj = 0; jj < num_solns; jj++)
{
matched_transform = true;
Matrix<double, 3, 4> transformation_matrix;
transformation_matrix.block<3, 3>(0, 0) = soln_rotation[jj];
transformation_matrix.col(3) = soln_translation[jj];
Matrix3d camera_matrix = Eigen::DiagonalMatrix<double, 3>(focal_length[jj], focal_length[jj], 1.0);
Matrix<double, 3, 4> projection_matrix = camera_matrix * transformation_matrix;
cout << projection_matrix << endl;
K[0] = focal_length[jj], K[1] = 0, K[2] = 0, K[3] = 0, K[4] = focal_length[jj], K[5] = 0, K[6] = 0, K[7] = 0, K[8] = 1;
R[0] = soln_rotation[jj].coeff(0, 0), R[1] = soln_rotation[jj].coeff(0, 1), R[2] = soln_rotation[jj].coeff(0, 2),
R[3] = soln_rotation[jj].coeff(1, 0), R[4] = soln_rotation[jj].coeff(1, 1), R[5] = soln_rotation[jj].coeff(1, 2),
R[6] = soln_rotation[jj].coeff(2, 0), R[7] = soln_rotation[jj].coeff(2, 1), R[8] = soln_rotation[jj].coeff(2, 2);
T[0] = soln_translation[jj].coeff(0), T[1] = soln_translation[jj].coeff(1), T[2] = soln_translation[jj].coeff(2);
Map < Vector3d > eT(T, 3);
Map < Matrix < double, 3, 3, RowMajor > > eK(K, 3, 3), eR(R, 3, 3);
Map < Matrix < double, 3, 4, RowMajor > > eP(P, 3, 4);
Matrix<double, 3, 4> eRT;
eRT.block<3, 3>(0, 0) = eR;
eRT.col(3) = eT;
eP = eK*eRT;
// Check that the reprojection error is very small.
for (int n = 0; n < 4; n++)
{
Vector3d reproj_point = projection_matrix * world_points.col(n).homogeneous();
cout << reproj_point.hnormalized() << endl << endl;
double x = world_points(0, n), y = world_points(1, n), z = world_points(2, n);
double numx = P[0] * x + P[1] * y + P[2] * z + P[3];
double numy = P[4] * x + P[5] * y + P[6] * z + P[7];
double denum = P[8] * x + P[9] * y + P[10] * z + P[11];
double errx = numx / denum - image_point(0, n), erry = numy / denum - image_point(1, n);
if (errx*errx + erry *erry > reproj_tolerance)
{
matched_transform = false;
;// break;
}
else
goodSol = jj;
}
if (matched_transform)
;// break;
}
std::cout << focal_length[goodSol] << std::endl;
std::cout << soln_rotation[goodSol] << std::endl;
std::cout << soln_translation[goodSol] << std::endl;
// One of the solutions must have been a valid solution.
if (matched_transform)
return 1;
else
return 0;
}
void DSPNP_Test()
{
const std::vector<Vector3d> world_points = { Vector3d(-1.0, 3.0, 3.0),
Vector3d(1.0, -1.0, 2.0),
Vector3d(-1.0, 1.0, 2.0),
Vector3d(2.0, 1.0, 3.0) };
const Quaterniond expected_rotation = Quaterniond(AngleAxisd(M_PI / 6.0, Vector3d(0.0, 0.0, 1.0)));
const Vector3d expected_translation(1.0, 1.0, 1.0);
const double projection_noise_std_dev = 0.01;
const double max_reprojection_error = 1e-4;
const double max_rotation_difference = 1e-5;
const double max_translation_difference = 1e-8;
const int num_points = world_points.size();
Matrix3x4d expected_transform;
expected_transform << expected_rotation.toRotationMatrix(), expected_translation;
std::vector<Vector2d> feature_points;
feature_points.reserve(num_points);
for (int i = 0; i < num_points; i++)
feature_points.push_back((expected_transform * world_points[i].homogeneous()).eval().hnormalized());
if (projection_noise_std_dev)
for (int i = 0; i < num_points; i++)
AddNoiseToProjection(projection_noise_std_dev, &feature_points[i]);
// Run DLS PnP.
std::vector<Quaterniond> soln_rotation;
std::vector<Vector3d> soln_translation;
DlsPnp(feature_points, world_points, &soln_rotation, &soln_translation);
// Check solutions and verify at least one is close to the actual solution.
const int num_solutions = soln_rotation.size();
if (num_solutions == 0)
abort();
bool matched_transform = false;
for (int i = 0; i < num_solutions; i++)
{
// Check that reprojection errors are small.
Matrix3x4d soln_transform;
soln_transform << soln_rotation[i].toRotationMatrix(), soln_translation[i];
cout << soln_transform;
for (int j = 0; j < num_points; j++)
{
const Vector2d reprojected_point = (soln_transform * world_points[j].homogeneous()).eval().hnormalized();
const double reprojection_error = (feature_points[j] - reprojected_point).squaredNorm();
if (reprojection_error > max_reprojection_error)
abort();
}
// Check that the solution is accurate.
const double rotation_difference = expected_rotation.angularDistance(soln_rotation[i]);
const bool matched_rotation = (rotation_difference < max_rotation_difference);
const double translation_difference = (expected_translation - soln_translation[i]).squaredNorm();
const bool matched_translation = (translation_difference < max_translation_difference);
if (matched_translation && matched_rotation)
matched_transform = true;
}
//EXPECT_TRUE(matched_transform);
return;
}
void P3P_Test(const double noise)
{
// Projection matrix.
const Matrix3d gt_rotation = (Eigen::AngleAxisd(DegToRad(15.0), Vector3d(1.0, 0.0, 0.0)) *Eigen::AngleAxisd(DegToRad(-10.0), Vector3d(0.0, 1.0, 0.0))).toRotationMatrix();
const Vector3d gt_translation(0.3, -1.7, 1.15);
Matrix3x4d projection_mat;
projection_mat << gt_rotation, gt_translation;
// Points in the 3D scene.
const Vector3d kPoints3d[3] = { Vector3d(-0.3001, -0.5840, 1.2271),
Vector3d(-1.4487, 0.6965, 0.3889),
Vector3d(-0.7815, 0.7642, 0.1257) };
// Points in the camera view.
Vector2d kPoints2d[3];
for (int i = 0; i < 3; i++)
{
kPoints2d[i] = (projection_mat * kPoints3d[i].homogeneous()).eval().hnormalized();
if (noise)
AddNoiseToProjection(noise, &kPoints2d[i]);
}
std::vector<Matrix3d> rotations;
std::vector<Vector3d> translations;
PoseFromThreePoints(kPoints2d, kPoints3d, &rotations, &translations);
bool matched_transform = false;
for (int i = 0; i < rotations.size(); ++i)
{
// Check that the rotation and translation are close.
double angular_diff = RadToDeg(Eigen::Quaterniond(rotations[i]).angularDistance(Eigen::Quaterniond(gt_rotation)));
double trans_diff = ((-gt_rotation * gt_translation) - (-rotations[i] * translations[i])).norm();
bool rot_match = angular_diff < 1.0;
bool trans_match = trans_diff < 0.1;
if (rot_match && trans_match)
{
matched_transform = true;
Matrix3x4d soln_proj;
soln_proj << rotations[i], translations[i];
// Check the reprojection error.
for (int j = 0; j < 3; j++)
{
const Vector3d projected_pt = soln_proj * kPoints3d[j].homogeneous();
//EXPECT_LT((kPoints2d[j] - projected_pt.hnormalized()).norm() * 800.0, 2.0);
if ((kPoints2d[j] - projected_pt.hnormalized()).norm() * 800.0 > 2.0)
abort();
}
}
}
if (matched_transform)
printf("1\n");
return;
//EXPECT_TRUE(matched_transform);
}
const int n =5;
const double noise = 0;
const double uc = 320;
const double vc = 240;
const double fu = 800;
const double fv = 800;
double rand(double min, double max)
{
return min + (max - min) * double(rand()) / RAND_MAX;
}
void random_pose(double R[3][3], double t[3])
{
const double range = 1;
double phi = rand(0, range * 3.14159 * 2);
double theta = rand(0, range * 3.14159);
double psi = rand(0, range * 3.14159 * 2);
R[0][0] = cos(psi) * cos(phi) - cos(theta) * sin(phi) * sin(psi);
R[0][1] = cos(psi) * sin(phi) + cos(theta) * cos(phi) * sin(psi);
R[0][2] = sin(psi) * sin(theta);
R[1][0] = -sin(psi) * cos(phi) - cos(theta) * sin(phi) * cos(psi);
R[1][1] = -sin(psi) * sin(phi) + cos(theta) * cos(phi) * cos(psi);
R[1][2] = cos(psi) * sin(theta);
R[2][0] = sin(theta) * sin(phi);
R[2][1] = -sin(theta) * cos(phi);
R[2][2] = cos(theta);
t[0] = 0.0f;
t[1] = 0.0f;
t[2] = 6.0f;
}
void random_point(double & Xw, double & Yw, double & Zw)
{
double theta = rand(0, 3.14159), phi = rand(0, 2 * 3.14159), R = rand(0, +2);
Xw = sin(theta) * sin(phi) * R;
Yw = -sin(theta) * cos(phi) * R;
Zw = cos(theta) * R;
}
void project_with_noise(double R[3][3], double t[3], double Xw, double Yw, double Zw, double & u, double & v)
{
double Xc = R[0][0] * Xw + R[0][1] * Yw + R[0][2] * Zw + t[0];
double Yc = R[1][0] * Xw + R[1][1] * Yw + R[1][2] * Zw + t[1];
double Zc = R[2][0] * Xw + R[2][1] * Yw + R[2][2] * Zw + t[2];
double nu = rand(-noise, +noise);
double nv = rand(-noise, +noise);
u = uc + fu * Xc / Zc + nu;
v = vc + fv * Yc / Zc + nv;
}
void EPNP_Test()
{
epnp PnP;
srand(time(0));
PnP.set_internal_parameters(uc, vc, fu, fv);
PnP.set_maximum_number_of_correspondences(n);
double R_true[3][3], t_true[3];
random_pose(R_true, t_true);
PnP.reset_correspondences();
for (int i = 0; i < n; i++) {
double Xw, Yw, Zw, u, v;
random_point(Xw, Yw, Zw);
project_with_noise(R_true, t_true, Xw, Yw, Zw, u, v);
PnP.add_correspondence(Xw, Yw, Zw, u, v);
}
double R_est[3][3], t_est[3];
double err2 = PnP.compute_pose(R_est, t_est);
double rot_err, transl_err;
PnP.relative_error(rot_err, transl_err, R_true, t_true, R_est, t_est);
cout << ">>> Reprojection error: " << err2 << endl;
cout << ">>> rot_err: " << rot_err << ", transl_err: " << transl_err << endl;
cout << endl;
cout << "'True reprojection error':"
<< PnP.reprojection_error(R_true, t_true) << endl;
cout << endl;
cout << "True pose:" << endl;
PnP.print_pose(R_true, t_true);
cout << endl;
cout << "Found pose:" << endl;
PnP.print_pose(R_est, t_est);
return;
}
int main()
{
//P4Pf_Test(0, 0.1);
//P3P_Test(1.0 / 800.0);
EPNP_Test();
//DSPNP_Test();
return 0;
}
| [
"phuocminhvo@gmail.com"
] | phuocminhvo@gmail.com |
4aa0fbb4a243f6513a85d6fd870a54645baed3fd | 7219e61fe07bd6fc581dcd212f4a6c82f2ec2be9 | /Game6.0/core/服务器组件/中心服务器/AttemperEngineSink.cpp | d1b28ef7fc32d7b5cc558e78ea7af9f6cc1ba5b3 | [] | no_license | 860git/whgame | 5028006f02fb2e73f574b4482f59409edfce91c1 | 548170488da5c2d26ac2c8ba9085b0d37899d637 | refs/heads/master | 2021-08-10T20:54:41.195861 | 2019-03-21T15:31:17 | 2019-03-21T15:31:17 | 102,350,514 | 0 | 0 | null | 2017-09-04T10:42:51 | 2017-09-04T10:42:51 | null | GB18030 | C++ | false | false | 11,652 | cpp | #include "StdAfx.h"
#include "DataBaseSink.h"
#include "AttemperEngineSink.h"
CAttemperEngineSink::CAttemperEngineSink()
{
m_pInitParamter=NULL;
m_pITimerEngine=NULL;
m_pIEventService=NULL;
m_pITCPSocketEngine=NULL;
}
CAttemperEngineSink::~CAttemperEngineSink()
{
}
//接口查询
void * __cdecl CAttemperEngineSink::QueryInterface(const IID & Guid, DWORD dwQueryVer)
{
QUERYINTERFACE(IAttemperEngineSink,Guid,dwQueryVer);
QUERYINTERFACE_IUNKNOWNEX(IAttemperEngineSink,Guid,dwQueryVer);
return NULL;
}
//调度模块启动
bool __cdecl CAttemperEngineSink::BeginService(IUnknownEx * pIUnknownEx)
{
//效验参数
ASSERT(pIUnknownEx!=NULL);
ASSERT(m_pInitParamter!=NULL);
ASSERT(m_pIEventService!=NULL);
//创建组件
if (m_ServerListCenter.GetInterface()==NULL)
{
if (m_ServerListCenter.CreateInstance()==false)
{
m_pIEventService->ShowEventNotify(TEXT("中心服务器列表组件创建失败"),Level_Exception);
return false;
}
m_ServerListCenter->SetEventService(m_pIEventService);
}
//加载列表
tagDataBaseInfo DataBaseInfo;
DataBaseInfo.wDataBasePort=m_pInitParamter->m_wServerDataBasePort;
DataBaseInfo.dwDataBaseAddr=inet_addr(m_pInitParamter->m_szServerDataBaseAddr);
lstrcpyn(DataBaseInfo.szDataBaseUser,m_pInitParamter->m_szServerDataBaseUser,CountArray(DataBaseInfo.szDataBaseUser));
lstrcpyn(DataBaseInfo.szDataBasePass,m_pInitParamter->m_szServerDataBasePass,CountArray(DataBaseInfo.szDataBasePass));
lstrcpyn(DataBaseInfo.szDataBaseName,m_pInitParamter->m_szServerDataBaseName,CountArray(DataBaseInfo.szDataBaseName));
if (m_ServerListCenter->LoadServerList(DataBaseInfo)==false)
{
m_pIEventService->ShowEventNotify(TEXT("游戏列表加载失败"),Level_Exception);
return false;
}
return true;
}
//调度模块关闭
bool __cdecl CAttemperEngineSink::EndService(IUnknownEx * pIUnknownEx)
{
//重置列表
if (m_ServerListCenter.GetInterface()!=NULL)
{
m_ServerListCenter->ResetServerList();
}
return true;
}
//事件处理接口
bool __cdecl CAttemperEngineSink::OnAttemperEvent(WORD wIdentifier,
void * pDataBuffer,
WORD wDataSize,
DWORD dwInsertTime)
{
return false;
}
//设置事件
bool CAttemperEngineSink::SetEventService(IUnknownEx * pIUnknownEx)
{
//查询接口
ASSERT(pIUnknownEx!=NULL);
m_pIEventService=GET_OBJECTPTR_INTERFACE(pIUnknownEx,IEventService);
ASSERT(m_pIEventService!=NULL);
//设置组件
if (m_ServerListCenter.GetInterface()!=NULL)
{
m_ServerListCenter->SetEventService(m_pIEventService);
}
return (m_pIEventService!=NULL);
}
//配置函数
bool CAttemperEngineSink::InitAttemperSink(CInitParamter * pInitParamter,
IUnknownEx * pIUnknownEx)
{
//效验参数
ASSERT(pIUnknownEx!=NULL);
ASSERT(pInitParamter!=NULL);
//设置变量
m_pInitParamter=pInitParamter;
//服务引擎
IServiceEngine * pIServiceEngine=(IServiceEngine *)pIUnknownEx->QueryInterface(IID_IServiceEngine,VER_IServiceEngine);
if (pIServiceEngine==NULL)
{
m_pIEventService->ShowEventNotify(TEXT("获取服务引擎服务失败"),
Level_Exception);
return false;
}
//定时器引擎
m_pITimerEngine=(ITimerEngine *)pIServiceEngine->GetTimerEngine(IID_ITimerEngine,VER_ITimerEngine);
if (m_pITimerEngine==NULL)
{
m_pIEventService->ShowEventNotify(TEXT("获取定时器引擎服务失败"),Level_Exception);
return false;
}
//网络引擎
m_pITCPSocketEngine=(ITCPSocketEngine *)pIServiceEngine->GetTCPSocketEngine(IID_ITCPSocketEngine,VER_ITCPSocketEngine);
if (m_pITCPSocketEngine==NULL)
{
m_pIEventService->ShowEventNotify(TEXT("获取网络引擎服务失败"),
Level_Exception);
return false;
}
//数据库引擎
IDataBaseEngine * pIDataBaseEngine=(IDataBaseEngine *)pIServiceEngine->GetDataBaseEngine(IID_IDataBaseEngine,VER_IDataBaseEngine);
if (pIDataBaseEngine==NULL)
{
m_pIEventService->ShowEventNotify(TEXT("获取数据库引擎服务失败"),
Level_Exception);
return false;
}
//数据库触发
IUnknownEx * pIQueueService=(IUnknownEx *)pIDataBaseEngine->GetQueueService(IID_IUnknownEx,VER_IUnknownEx);
if (m_DataBaseEvent.SetQueueService(pIQueueService)==false)
{
m_pIEventService->ShowEventNotify(TEXT("获取数据库触发服务失败"),
Level_Exception);
return false;
}
return true;
}
//定时器事件
bool __cdecl CAttemperEngineSink::OnEventTimer(WORD wTimerID, WPARAM wBindParam)
{
return false;
}
//数据库事件
bool __cdecl CAttemperEngineSink::OnEventDataBase(void * pDataBuffer,
WORD wDataSize,
NTY_DataBaseEvent * pDataBaseEvent)
{
return false;
}
//网络应答事件
bool __cdecl CAttemperEngineSink::OnEventSocketAccept(NTY_SocketAcceptEvent * pSocketAcceptEvent)
{
return true;
}
//网络读取事件
bool __cdecl CAttemperEngineSink::OnEventSocketRead(CMD_Command Command,
void * pDataBuffer,
WORD wDataSize,
NTY_SocketReadEvent * pSocketReadEvent)
{
switch (Command.wMainCmdID)
{
//列表消息
case MDM_CS_SERVER_LIST:
{
return OnSocketMainServerList(Command,
pDataBuffer,
wDataSize,
pSocketReadEvent);
}
//房间管理
case MDM_CS_SERVER_MANAGER:
{
return OnSocketMainServerManager(Command,
pDataBuffer,
wDataSize,
pSocketReadEvent);
}
}
return false;
}
//网络关闭事件
bool __cdecl CAttemperEngineSink::OnEventSocketClose(NTY_SocketCloseEvent * pSocketCloseEvent)
{
return true;
}
//列表消息处理
bool CAttemperEngineSink::OnSocketMainServerList(CMD_Command Command,
void * pDataBuffer,
WORD wDataSize,
NTY_SocketReadEvent * pSocketReadEvent)
{
ASSERT(Command.wMainCmdID==MDM_CS_SERVER_LIST);
switch (Command.wSubCmdID)
{
//获取列表
case SUB_CS_GET_SERVER_LIST:
{
//变量定义
WORD wIndex=pSocketReadEvent->wIndex;
WORD wRountID=pSocketReadEvent->wRoundID;
//列表信息
CMD_CS_ListInfo ListInfo;
memset(&ListInfo,0,sizeof(ListInfo));
ListInfo.dwTypeCount=m_ServerListCenter->GetGameTypeCount();
ListInfo.dwKindCount=m_ServerListCenter->GetGameKindCount();
ListInfo.dwServerCount=m_ServerListCenter->GetGameServerCount();
ListInfo.dwStationCount=m_ServerListCenter->GetGameStationCount();
m_pITCPSocketEngine->SendData(wIndex,wRountID,MDM_CS_SERVER_LIST,SUB_CS_LIST_INFO,&ListInfo,sizeof(ListInfo));
//类型信息
POSITION Pos=NULL;
WORD wSendSize=0L;
BYTE cbBuffer[SOCKET_PACKAGE];
for (DWORD i=0;i<ListInfo.dwTypeCount;i++)
{
if ((wSendSize+sizeof(tagGameType))>sizeof(cbBuffer))
{
m_pITCPSocketEngine->SendData(wIndex,wRountID,MDM_CS_SERVER_LIST,SUB_CS_LIST_TYPE,cbBuffer,wSendSize);
wSendSize=0;
}
tagGameTypeItem * pGameTypeItem=m_ServerListCenter->EmunGameTypeItem(Pos);
CopyMemory(cbBuffer+wSendSize,&pGameTypeItem->GameType,sizeof(tagGameType));
wSendSize+=sizeof(tagGameType);
}
if (wSendSize>0) m_pITCPSocketEngine->SendData(wIndex,wRountID,MDM_CS_SERVER_LIST,SUB_CS_LIST_TYPE,cbBuffer,wSendSize);
//种类信息
Pos=NULL;
wSendSize=0L;
for (DWORD i=0;i<ListInfo.dwKindCount;i++)
{
if ((wSendSize+sizeof(tagGameKind))>sizeof(cbBuffer))
{
m_pITCPSocketEngine->SendData(wIndex,wRountID,MDM_CS_SERVER_LIST,SUB_CS_LIST_KIND,cbBuffer,wSendSize);
wSendSize=0;
}
tagGameKindItem * pGameKindItem=m_ServerListCenter->EmunGameKindItem(Pos);
CopyMemory(cbBuffer+wSendSize,&pGameKindItem->GameKind,sizeof(tagGameKind));
wSendSize+=sizeof(tagGameKind);
}
if (wSendSize>0) m_pITCPSocketEngine->SendData(wIndex,wRountID,MDM_CS_SERVER_LIST,SUB_CS_LIST_KIND,cbBuffer,wSendSize);
//站点信息
Pos=NULL;
wSendSize=0L;
for (DWORD i=0;i<ListInfo.dwStationCount;i++)
{
if ((wSendSize+sizeof(tagGameStation))>sizeof(cbBuffer))
{
m_pITCPSocketEngine->SendData(wIndex,wRountID,MDM_CS_SERVER_LIST,SUB_CS_LIST_STATION,cbBuffer,wSendSize);
wSendSize=0;
}
tagGameStationItem * pGameStationItem=m_ServerListCenter->EmunGameStationItem(Pos);
CopyMemory(cbBuffer+wSendSize,&pGameStationItem->GameStation,sizeof(tagGameStation));
wSendSize+=sizeof(tagGameStation);
}
if (wSendSize>0) m_pITCPSocketEngine->SendData(wIndex,wRountID,MDM_CS_SERVER_LIST,SUB_CS_LIST_STATION,cbBuffer,wSendSize);
//房间信息
Pos=NULL;
wSendSize=0L;
for (DWORD i=0;i<ListInfo.dwServerCount;i++)
{
if ((wSendSize+sizeof(tagGameServer))>sizeof(cbBuffer))
{
m_pITCPSocketEngine->SendData(wIndex,wRountID,MDM_CS_SERVER_LIST,SUB_CS_LIST_SERVER,cbBuffer,wSendSize);
wSendSize=0;
}
tagGameServerItem * pGameServerItem=m_ServerListCenter->EmunGameServerItem(Pos);
CopyMemory(cbBuffer+wSendSize,&pGameServerItem->GameServer,sizeof(tagGameServer));
wSendSize+=sizeof(tagGameServer);
}
if (wSendSize>0) m_pITCPSocketEngine->SendData(wIndex,wRountID,MDM_CS_SERVER_LIST,SUB_CS_LIST_SERVER,cbBuffer,wSendSize);
//发送完成
m_pITCPSocketEngine->SendData(wIndex,wRountID,MDM_CS_SERVER_LIST,SUB_CS_LIST_FINISH);
return true;
}
}
return false;
}
//房间消息处理
bool CAttemperEngineSink::OnSocketMainServerManager(CMD_Command Command,
void * pDataBuffer,
WORD wDataSize,
NTY_SocketReadEvent * pSocketReadEvent)
{
ASSERT(Command.wMainCmdID==MDM_CS_SERVER_MANAGER);
switch (Command.wSubCmdID)
{
//房间注册
case SUB_CS_REG_GAME_SERVER:
{
//效验参数
ASSERT(wDataSize==sizeof(CMD_CS_RegGameServer));
if (wDataSize!=sizeof(CMD_CS_RegGameServer)) return false;
//消息处理
CMD_CS_RegGameServer * pRegGameServer=(CMD_CS_RegGameServer *)pDataBuffer;
tagGameServer * pGameServer=&pRegGameServer->GameServer;
tagGameServerItem * pGameServerItem=m_ServerListCenter->SearchGameServer(pGameServer->wKindID,pGameServer->wServerID);
if (pGameServerItem!=NULL)
{
pGameServerItem->dwUpdateTime=(DWORD)time(NULL);
CopyMemory(&pGameServerItem->GameServer,pGameServer,sizeof(tagGameServer));
}
else m_ServerListCenter->InsertGameServer(pGameServer);
return true;
}
//注销房间
case SUB_CS_UNREG_GAME_SERVER:
{
//效验参数
ASSERT(wDataSize==sizeof(CMD_CS_UnRegGameServer));
if (wDataSize!=sizeof(CMD_CS_UnRegGameServer)) return false;
//消息处理
CMD_CS_UnRegGameServer * pUnRegGameServer=(CMD_CS_UnRegGameServer *)pDataBuffer;
m_ServerListCenter->DeleteGameServer(pUnRegGameServer->wKindID,pUnRegGameServer->wServerID);
return true;
}
//更新人数
case SUB_CS_SERVER_ONLINE_COUNT:
{
//效验参数
ASSERT(wDataSize==sizeof(CMD_CS_ServerOnLineCount));
if (wDataSize!=sizeof(CMD_CS_ServerOnLineCount)) return false;
//消息处理
CMD_CS_ServerOnLineCount * pServerOnLineCount=(CMD_CS_ServerOnLineCount *)pDataBuffer;
WORD wKindID=pServerOnLineCount->wKindID;
WORD wServerID=pServerOnLineCount->wServerID;
m_ServerListCenter->UpdateServerOnLineCount(wKindID,wServerID,pServerOnLineCount->dwOnLineCount);
return true;
}
}
return false;
}
//-----------------------------------------------
// the end
//-----------------------------------------------
| [
"loverlain@9639ad00-9d33-ea6c-355b-542d085e1887"
] | loverlain@9639ad00-9d33-ea6c-355b-542d085e1887 |
aad9f29fe46af20b867d3b8ad668cf77c0813d17 | d643ff48cdd4661e2a924a02a8458819b9aa23ac | /chapter11/11.28/main.cpp | 4b4fdb1d7e0307ddc39664fbf7fa135e9cc6fcbe | [] | no_license | grayondream/Primer-Learing | d9bc1116d0b562b3650b7df22ae64d640c54f0a5 | a0f4acb47770c11d3c1eb34e70f4f770d0255957 | refs/heads/master | 2021-05-11T04:09:33.206964 | 2018-01-24T06:30:12 | 2018-01-24T06:30:12 | 117,933,818 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 821 | cpp | /*************************************************************************
> File Name: main.cpp
> Author:
> Description:
> Mail:
> Created Time: 2018年01月12日 星期五 17时08分11秒
************************************************************************/
#include <vector>
#include <map>
#include <string>
#include <iostream>
using namespace std;
int main(int argc, char **argv)
{
cout<<"primer 11.28\n";
vector<int> v;
map<string ,vector<int>> m;
string str;
while(cin>>str)
{
vector<int> v;
int num = 0;
while(cin>>num)
{
v.push_back(num);
if(num == -1) break;
}
m[str] = v;
}
vector<int> p;
p.push_back(1);
map< string, vector<int>>::iterator it = m.find(string("w"));
return 0;
}
| [
"GrayOnDream@outlook.com"
] | GrayOnDream@outlook.com |
223cb0f6d971fbd53ae5171327be6efa971aeecd | 72a146dad10c3330548f175643822e6cc2e2ccba | /device/geolocation/network_location_request.cc | 49762137609a5df11c386ef7ac17b5ae70f9636a | [
"BSD-3-Clause"
] | permissive | daotianya/browser-android-tabs | bb6772394c2138e2f3859a83ec6e0860d01a6161 | 44e83a97eb1c7775944a04144e161d99cbb7de5b | refs/heads/master | 2020-06-10T18:07:58.392087 | 2016-12-07T15:37:13 | 2016-12-07T15:37:13 | 75,914,703 | 1 | 0 | null | 2016-12-08T07:37:51 | 2016-12-08T07:37:51 | null | UTF-8 | C++ | false | false | 16,114 | cc | // Copyright (c) 2012 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 "device/geolocation/network_location_request.h"
#include <stdint.h>
#include <limits>
#include <set>
#include <string>
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/metrics/histogram.h"
#include "base/metrics/sparse_histogram.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "device/geolocation/geoposition.h"
#include "device/geolocation/location_arbitrator_impl.h"
#include "google_apis/google_api_keys.h"
#include "net/base/escape.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_status.h"
namespace device {
namespace {
const char kAccessTokenString[] = "accessToken";
const char kLocationString[] = "location";
const char kLatitudeString[] = "lat";
const char kLongitudeString[] = "lng";
const char kAccuracyString[] = "accuracy";
enum NetworkLocationRequestEvent {
// NOTE: Do not renumber these as that would confuse interpretation of
// previously logged data. When making changes, also update the enum list
// in tools/metrics/histograms/histograms.xml to keep it in sync.
NETWORK_LOCATION_REQUEST_EVENT_REQUEST_START = 0,
NETWORK_LOCATION_REQUEST_EVENT_REQUEST_CANCEL = 1,
NETWORK_LOCATION_REQUEST_EVENT_RESPONSE_SUCCESS = 2,
NETWORK_LOCATION_REQUEST_EVENT_RESPONSE_NOT_OK = 3,
NETWORK_LOCATION_REQUEST_EVENT_RESPONSE_EMPTY = 4,
NETWORK_LOCATION_REQUEST_EVENT_RESPONSE_MALFORMED = 5,
NETWORK_LOCATION_REQUEST_EVENT_RESPONSE_INVALID_FIX = 6,
// NOTE: Add entries only immediately above this line.
NETWORK_LOCATION_REQUEST_EVENT_COUNT = 7
};
void RecordUmaEvent(NetworkLocationRequestEvent event) {
UMA_HISTOGRAM_ENUMERATION("Geolocation.NetworkLocationRequest.Event", event,
NETWORK_LOCATION_REQUEST_EVENT_COUNT);
}
void RecordUmaResponseCode(int code) {
UMA_HISTOGRAM_SPARSE_SLOWLY("Geolocation.NetworkLocationRequest.ResponseCode",
code);
}
void RecordUmaAccessPoints(int count) {
const int min = 1;
const int max = 20;
const int buckets = 21;
UMA_HISTOGRAM_CUSTOM_COUNTS("Geolocation.NetworkLocationRequest.AccessPoints",
count, min, max, buckets);
}
// Local functions
// Creates the request url to send to the server.
GURL FormRequestURL(const GURL& url);
void FormUploadData(const WifiData& wifi_data,
const base::Time& wifi_timestamp,
const base::string16& access_token,
std::string* upload_data);
// Attempts to extract a position from the response. Detects and indicates
// various failure cases.
void GetLocationFromResponse(bool http_post_result,
int status_code,
const std::string& response_body,
const base::Time& wifi_timestamp,
const GURL& server_url,
Geoposition* position,
base::string16* access_token);
// Parses the server response body. Returns true if parsing was successful.
// Sets |*position| to the parsed location if a valid fix was received,
// otherwise leaves it unchanged.
bool ParseServerResponse(const std::string& response_body,
const base::Time& wifi_timestamp,
Geoposition* position,
base::string16* access_token);
void AddWifiData(const WifiData& wifi_data,
int age_milliseconds,
base::DictionaryValue* request);
} // namespace
int NetworkLocationRequest::url_fetcher_id_for_tests = 0;
NetworkLocationRequest::NetworkLocationRequest(
const scoped_refptr<net::URLRequestContextGetter>& context,
const GURL& url,
LocationResponseCallback callback)
: url_context_(context), location_response_callback_(callback), url_(url) {}
NetworkLocationRequest::~NetworkLocationRequest() {}
bool NetworkLocationRequest::MakeRequest(const base::string16& access_token,
const WifiData& wifi_data,
const base::Time& wifi_timestamp) {
RecordUmaEvent(NETWORK_LOCATION_REQUEST_EVENT_REQUEST_START);
RecordUmaAccessPoints(wifi_data.access_point_data.size());
if (url_fetcher_ != NULL) {
DVLOG(1) << "NetworkLocationRequest : Cancelling pending request";
RecordUmaEvent(NETWORK_LOCATION_REQUEST_EVENT_REQUEST_CANCEL);
url_fetcher_.reset();
}
wifi_data_ = wifi_data;
wifi_timestamp_ = wifi_timestamp;
GURL request_url = FormRequestURL(url_);
url_fetcher_ = net::URLFetcher::Create(url_fetcher_id_for_tests, request_url,
net::URLFetcher::POST, this);
url_fetcher_->SetRequestContext(url_context_.get());
std::string upload_data;
FormUploadData(wifi_data, wifi_timestamp, access_token, &upload_data);
url_fetcher_->SetUploadData("application/json", upload_data);
url_fetcher_->SetLoadFlags(net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE |
net::LOAD_DO_NOT_SAVE_COOKIES |
net::LOAD_DO_NOT_SEND_COOKIES |
net::LOAD_DO_NOT_SEND_AUTH_DATA);
request_start_time_ = base::TimeTicks::Now();
url_fetcher_->Start();
return true;
}
void NetworkLocationRequest::OnURLFetchComplete(const net::URLFetcher* source) {
DCHECK_EQ(url_fetcher_.get(), source);
net::URLRequestStatus status = source->GetStatus();
int response_code = source->GetResponseCode();
RecordUmaResponseCode(response_code);
Geoposition position;
base::string16 access_token;
std::string data;
source->GetResponseAsString(&data);
GetLocationFromResponse(status.is_success(), response_code, data,
wifi_timestamp_, source->GetURL(), &position,
&access_token);
const bool server_error =
!status.is_success() || (response_code >= 500 && response_code < 600);
url_fetcher_.reset();
if (!server_error) {
const base::TimeDelta request_time =
base::TimeTicks::Now() - request_start_time_;
UMA_HISTOGRAM_CUSTOM_TIMES("Net.Wifi.LbsLatency", request_time,
base::TimeDelta::FromMilliseconds(1),
base::TimeDelta::FromSeconds(10), 100);
}
DVLOG(1) << "NetworkLocationRequest::OnURLFetchComplete() : run callback.";
location_response_callback_.Run(position, server_error, access_token,
wifi_data_);
}
// Local functions.
namespace {
struct AccessPointLess {
bool operator()(const AccessPointData* ap1,
const AccessPointData* ap2) const {
return ap2->radio_signal_strength < ap1->radio_signal_strength;
}
};
GURL FormRequestURL(const GURL& url) {
if (url == LocationArbitratorImpl::DefaultNetworkProviderURL()) {
std::string api_key = google_apis::GetAPIKey();
if (!api_key.empty()) {
std::string query(url.query());
if (!query.empty())
query += "&";
query += "key=" + net::EscapeQueryParamValue(api_key, true);
GURL::Replacements replacements;
replacements.SetQueryStr(query);
return url.ReplaceComponents(replacements);
}
}
return url;
}
void FormUploadData(const WifiData& wifi_data,
const base::Time& wifi_timestamp,
const base::string16& access_token,
std::string* upload_data) {
int age = std::numeric_limits<int32_t>::min(); // Invalid so AddInteger()
// will ignore.
if (!wifi_timestamp.is_null()) {
// Convert absolute timestamps into a relative age.
int64_t delta_ms = (base::Time::Now() - wifi_timestamp).InMilliseconds();
if (delta_ms >= 0 && delta_ms < std::numeric_limits<int32_t>::max())
age = static_cast<int>(delta_ms);
}
base::DictionaryValue request;
AddWifiData(wifi_data, age, &request);
if (!access_token.empty())
request.SetString(kAccessTokenString, access_token);
base::JSONWriter::Write(request, upload_data);
}
void AddString(const std::string& property_name,
const std::string& value,
base::DictionaryValue* dict) {
DCHECK(dict);
if (!value.empty())
dict->SetString(property_name, value);
}
void AddInteger(const std::string& property_name,
int value,
base::DictionaryValue* dict) {
DCHECK(dict);
if (value != std::numeric_limits<int32_t>::min())
dict->SetInteger(property_name, value);
}
void AddWifiData(const WifiData& wifi_data,
int age_milliseconds,
base::DictionaryValue* request) {
DCHECK(request);
if (wifi_data.access_point_data.empty())
return;
typedef std::multiset<const AccessPointData*, AccessPointLess> AccessPointSet;
AccessPointSet access_points_by_signal_strength;
for (const auto& ap_data : wifi_data.access_point_data)
access_points_by_signal_strength.insert(&ap_data);
base::ListValue* wifi_access_point_list = new base::ListValue();
for (auto* ap_data : access_points_by_signal_strength) {
base::DictionaryValue* wifi_dict = new base::DictionaryValue();
AddString("macAddress", base::UTF16ToUTF8(ap_data->mac_address), wifi_dict);
AddInteger("signalStrength", ap_data->radio_signal_strength, wifi_dict);
AddInteger("age", age_milliseconds, wifi_dict);
AddInteger("channel", ap_data->channel, wifi_dict);
AddInteger("signalToNoiseRatio", ap_data->signal_to_noise, wifi_dict);
wifi_access_point_list->Append(wifi_dict);
}
request->Set("wifiAccessPoints", wifi_access_point_list);
}
void FormatPositionError(const GURL& server_url,
const std::string& message,
Geoposition* position) {
position->error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE;
position->error_message = "Network location provider at '";
position->error_message += server_url.GetOrigin().spec();
position->error_message += "' : ";
position->error_message += message;
position->error_message += ".";
VLOG(1) << "NetworkLocationRequest::GetLocationFromResponse() : "
<< position->error_message;
}
void GetLocationFromResponse(bool http_post_result,
int status_code,
const std::string& response_body,
const base::Time& wifi_timestamp,
const GURL& server_url,
Geoposition* position,
base::string16* access_token) {
DCHECK(position);
DCHECK(access_token);
// HttpPost can fail for a number of reasons. Most likely this is because
// we're offline, or there was no response.
if (!http_post_result) {
FormatPositionError(server_url, "No response received", position);
RecordUmaEvent(NETWORK_LOCATION_REQUEST_EVENT_RESPONSE_EMPTY);
return;
}
if (status_code != 200) { // HTTP OK.
std::string message = "Returned error code ";
message += base::IntToString(status_code);
FormatPositionError(server_url, message, position);
RecordUmaEvent(NETWORK_LOCATION_REQUEST_EVENT_RESPONSE_NOT_OK);
return;
}
// We use the timestamp from the wifi data that was used to generate
// this position fix.
if (!ParseServerResponse(response_body, wifi_timestamp, position,
access_token)) {
// We failed to parse the repsonse.
FormatPositionError(server_url, "Response was malformed", position);
RecordUmaEvent(NETWORK_LOCATION_REQUEST_EVENT_RESPONSE_MALFORMED);
return;
}
// The response was successfully parsed, but it may not be a valid
// position fix.
if (!position->Validate()) {
FormatPositionError(server_url, "Did not provide a good position fix",
position);
RecordUmaEvent(NETWORK_LOCATION_REQUEST_EVENT_RESPONSE_INVALID_FIX);
return;
}
RecordUmaEvent(NETWORK_LOCATION_REQUEST_EVENT_RESPONSE_SUCCESS);
}
// Numeric values without a decimal point have type integer and IsDouble() will
// return false. This is convenience function for detecting integer or floating
// point numeric values. Note that isIntegral() includes boolean values, which
// is not what we want.
bool GetAsDouble(const base::DictionaryValue& object,
const std::string& property_name,
double* out) {
DCHECK(out);
const base::Value* value = NULL;
if (!object.Get(property_name, &value))
return false;
int value_as_int;
DCHECK(value);
if (value->GetAsInteger(&value_as_int)) {
*out = value_as_int;
return true;
}
return value->GetAsDouble(out);
}
bool ParseServerResponse(const std::string& response_body,
const base::Time& wifi_timestamp,
Geoposition* position,
base::string16* access_token) {
DCHECK(position);
DCHECK(!position->Validate());
DCHECK(position->error_code == Geoposition::ERROR_CODE_NONE);
DCHECK(access_token);
DCHECK(!wifi_timestamp.is_null());
if (response_body.empty()) {
LOG(WARNING) << "ParseServerResponse() : Response was empty.";
return false;
}
DVLOG(1) << "ParseServerResponse() : Parsing response " << response_body;
// Parse the response, ignoring comments.
std::string error_msg;
std::unique_ptr<base::Value> response_value =
base::JSONReader::ReadAndReturnError(response_body, base::JSON_PARSE_RFC,
NULL, &error_msg);
if (response_value == NULL) {
LOG(WARNING) << "ParseServerResponse() : JSONReader failed : " << error_msg;
return false;
}
if (!response_value->IsType(base::Value::TYPE_DICTIONARY)) {
VLOG(1) << "ParseServerResponse() : Unexpected response type "
<< response_value->GetType();
return false;
}
const base::DictionaryValue* response_object =
static_cast<base::DictionaryValue*>(response_value.get());
// Get the access token, if any.
response_object->GetString(kAccessTokenString, access_token);
// Get the location
const base::Value* location_value = NULL;
if (!response_object->Get(kLocationString, &location_value)) {
VLOG(1) << "ParseServerResponse() : Missing location attribute.";
// GLS returns a response with no location property to represent
// no fix available; return true to indicate successful parse.
return true;
}
DCHECK(location_value);
if (!location_value->IsType(base::Value::TYPE_DICTIONARY)) {
if (!location_value->IsType(base::Value::TYPE_NULL)) {
VLOG(1) << "ParseServerResponse() : Unexpected location type "
<< location_value->GetType();
// If the network provider was unable to provide a position fix, it should
// return a HTTP 200, with "location" : null. Otherwise it's an error.
return false;
}
return true; // Successfully parsed response containing no fix.
}
const base::DictionaryValue* location_object =
static_cast<const base::DictionaryValue*>(location_value);
// latitude and longitude fields are always required.
double latitude = 0;
double longitude = 0;
if (!GetAsDouble(*location_object, kLatitudeString, &latitude) ||
!GetAsDouble(*location_object, kLongitudeString, &longitude)) {
VLOG(1) << "ParseServerResponse() : location lacks lat and/or long.";
return false;
}
// All error paths covered: now start actually modifying postion.
position->latitude = latitude;
position->longitude = longitude;
position->timestamp = wifi_timestamp;
// Other fields are optional.
GetAsDouble(*response_object, kAccuracyString, &position->accuracy);
return true;
}
} // namespace
} // namespace device
| [
"serg.zhukovsky@gmail.com"
] | serg.zhukovsky@gmail.com |
95fb70fac6bcf10c8dc928f6b062017e11138aa9 | 8d966e3d6f7d908ccc1cf756c4dbbe0452c6584a | /Utilities/esUtil.h | 5849abb3afdf3f7e4a655d27c2f3b63cb79d6ad1 | [] | no_license | ducndbk62/DinhDuc_Fw3D | 2a88d22ab2950ad7acd1e5b5e235c780150444bd | 5e70eed8be4f2baba149ed8a66f2214374946593 | refs/heads/master | 2022-11-25T23:06:07.886672 | 2020-08-04T02:49:25 | 2020-08-04T02:49:25 | 284,853,777 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,325 | h | #pragma once
#include <GLES2/gl2.h>
#include <EGL/egl.h>
//#include <gl/GLU.h>
// Macros
#define ESUTIL_API __cdecl
#define ESCALLBACK __cdecl
/// esCreateWindow flag - RGB color buffer
#define ES_WINDOW_RGB 0
/// esCreateWindow flag - ALPHA color buffer
#define ES_WINDOW_ALPHA 1
/// esCreateWindow flag - depth buffer
#define ES_WINDOW_DEPTH 2
/// esCreateWindow flag - stencil buffer
#define ES_WINDOW_STENCIL 4
/// esCreateWindow flat - multi-sample buffer
#define ES_WINDOW_MULTISAMPLE 8
// Types
class ESContext
{
public:
/// Window width
GLint width;
/// Window height
GLint height;
/// Window handle
EGLNativeWindowType hWnd;
/// EGL display
EGLDisplay eglDisplay;
/// EGL context
EGLContext eglContext;
/// EGL surface
EGLSurface eglSurface;
/// Callbacks
void (ESCALLBACK *drawFunc) ( ESContext * );
void (ESCALLBACK *keyFunc) ( ESContext *, unsigned char, bool );
void (ESCALLBACK *updateFunc) ( ESContext *, float deltaTime );
};
// Public Functions
/// \brief Initialize ES framework context. This must be called before calling any other functions.
/// \param esContext Application context
void ESUTIL_API esInitContext ( ESContext *esContext );
//
/// \brief Create a window with the specified parameters
/// \param esContext Application context
/// \param title Name for title bar of window
/// \param width Width in pixels of window to create
/// \param height Height in pixels of window to create
/// \param flags Bitfield for the window creation flags
/// ES_WINDOW_RGB - specifies that the color buffer should have R,G,B channels
/// ES_WINDOW_ALPHA - specifies that the color buffer should have alpha
/// ES_WINDOW_DEPTH - specifies that a depth buffer should be created
/// ES_WINDOW_STENCIL - specifies that a stencil buffer should be created
/// ES_WINDOW_MULTISAMPLE - specifies that a multi-sample buffer should be created
/// \return GL_TRUE if window creation is succesful, GL_FALSE otherwise
GLboolean ESUTIL_API esCreateWindow ( ESContext *esContext, const char *title, GLint width, GLint height, GLuint flags );
//
/// \brief Start the main loop for the OpenGL ES application
/// \param esContext Application context
//
void ESUTIL_API esMainLoop ( ESContext *esContext );
//
/// \brief Register a draw callback function to be used to render each frame
/// \param esContext Application context
/// \param drawFunc Draw callback function that will be used to render the scene
//
void ESUTIL_API esRegisterDrawFunc ( ESContext *esContext, void (ESCALLBACK *drawFunc) ( ESContext* ) );
//
/// \brief Register an update callback function to be used to update on each time step
/// \param esContext Application context
/// \param updateFunc Update callback function that will be used to render the scene
//
void ESUTIL_API esRegisterUpdateFunc ( ESContext *esContext, void (ESCALLBACK *updateFunc) ( ESContext*, float ) );
//
/// \brief Register an keyboard input processing callback function
/// \param esContext Application context
/// \param keyFunc Key callback function for application processing of keyboard input
//
void ESUTIL_API esRegisterKeyFunc ( ESContext *esContext,
void (ESCALLBACK *drawFunc) ( ESContext*, unsigned char, bool ) );
//
/// \brief Log a message to the debug output for the platform
/// \param formatStr Format string for error log.
//
void ESUTIL_API esLogMessage ( const char *formatStr, ... );
//
///
/// \brief Load a shader, check for compile errors, print error messages to output log
/// \param type Type of shader (GL_VERTEX_SHADER or GL_FRAGMENT_SHADER)
/// \param shaderSrc Shader source string
/// \return A new shader object on success, 0 on failure
//
GLuint ESUTIL_API esLoadShader ( GLenum type, char * filename);
//
///
/// \brief Load a vertex and fragment shader, create a program object, link program.
/// Errors output to log.
/// \param vertShaderSrc Vertex shader source code
/// \param fragShaderSrc Fragment shader source code
/// \return A new program object linked with the vertex/fragment shader pair, 0 on failure
//
GLuint ESUTIL_API esLoadProgram ( GLuint vertexShader, GLuint fragmentShader );
| [
"ducndbk62@gmail.com"
] | ducndbk62@gmail.com |
20e175f38c32c4138ab53f565e3135f3558399e6 | bbf8d7413cd8270c7f4b82aab061d9e8a2808eb0 | /sop-sdk/sdk-c++/thirdparty/base64/base64.h | 19e29cfdf76961bc18a059735f593b418fe9e09b | [
"MIT"
] | permissive | xjie06109334/SOP | 32f441dadfae003779698ffe8d90974d9c2bbbdb | 06852f745ee8760dcdbeb9f8610a5c0e86a6d47a | refs/heads/master | 2023-01-30T16:18:00.643619 | 2020-12-07T07:30:19 | 2020-12-07T07:30:19 | 319,237,691 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 225 | h | #ifndef base64_h
#define base64_h
#include <string>
std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len);
std::string base64_decode(std::string const& encoded_string);
#endif /* base64_h */ | [
"xiejie@ansosz.com"
] | xiejie@ansosz.com |
a7ec2829cae7b5f6563508186683f38b1c482cd3 | f88d74e5eb146c717daf85ce8e685872522f791b | /Plugins/Runtime/HoudiniEngine/Source/HoudiniEngine/Private/HoudiniStringResolver.h | dae37b1e35144bd0360147da2d6a79607e778018 | [
"MIT"
] | permissive | IbrahimHindawi/LostSoul | 5f5ffe0f987d81a6ec364fe1dcc08bcadacc215c | 5482fa52ede5dfef987038c12970a7f6c538e7c1 | refs/heads/main | 2023-02-25T01:56:13.009241 | 2021-01-31T16:11:45 | 2021-01-31T16:11:45 | 333,579,347 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,446 | h | /*
* Copyright (c) <2021> Side Effects Software 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. The name of Side Effects Software may not be used to endorse or
* promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY SIDE EFFECTS SOFTWARE "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 SIDE EFFECTS SOFTWARE 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.
*/
#pragma once
#include "CoreMinimal.h"
#include "HoudiniStringResolver.generated.h"
USTRUCT()
struct HOUDINIENGINE_API FHoudiniStringResolver
{
GENERATED_USTRUCT_BODY();
protected:
// Named arguments that will be substituted into attribute values upon retrieval.
TMap<FString, FStringFormatArg> CachedTokens;
public:
// ----------------------------------
// Named argument accessors
// ----------------------------------
TMap<FString, FStringFormatArg>& GetCachedTokens() { return CachedTokens; }
// Set a named argument that will be used for argument replacement during GetAttribute calls.
void SetToken(const FString& InName, const FString& InValue);
void GetTokensAsStringMap(TMap<FString, FString>& OutTokens) const;
void SetTokensFromStringMap(const TMap<FString, FString>& InValue, bool bClearTokens=true);
// Resolve a string by substituting `Tokens` as named arguments during string formatting.
FString ResolveString(const FString& InStr) const;
};
USTRUCT()
struct HOUDINIENGINE_API FHoudiniAttributeResolver : public FHoudiniStringResolver
{
GENERATED_USTRUCT_BODY();
protected:
TMap<FString, FString> CachedAttributes;
public:
void SetCachedAttributes(const TMap<FString,FString>& Attributes);
// Return a mutable reference to the cached attributes.
TMap<FString, FString>& GetCachedAttributes() { return CachedAttributes; }
// Return immutable reference to cached attributes.
const TMap<FString, FString>& GetCachedAttributes() const { return CachedAttributes; }
// Set an attribute with the given name and value in the attribute cache.
void SetAttribute(const FString& InName, const FString& InValue);
// Try to resolve an attribute with the given name. If the attribute could not be
// found, use DefaultValue as a fallback.
FString ResolveAttribute(const FString& InAttrName, const FString& InDefaultValue) const;
// ----------------------------------
// Helpers
// ----------------------------------
// Helper for resolving the `unreal_level_path` attribute.
FString ResolveFullLevelPath() const;
// Helper for resolver custom output name attributes.
FString ResolveOutputName() const;
}; | [
"hassan.khazaal.drive@gmail.com"
] | hassan.khazaal.drive@gmail.com |
1d6347415d9028bfc39ae7c806b7f46db7a59624 | 5e5d1557ab3930bc58c8dcff8f8227d42ec45a91 | /Data/rpn.h | a2ce5c8034d726ed287a6880bbb234a5e5f93b8b | [] | no_license | pbreed/SBCAR | d364939468f8b525243e987e28a057ada7218c7c | a62c790c172bf87cd0caa5ae0329f95cf4f05175 | refs/heads/master | 2021-04-09T16:41:17.889756 | 2013-06-04T18:03:15 | 2013-06-04T18:03:15 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 57 | h | #include <string>
double eval(double di,std::string s);
| [
"pbreed@netburner.com"
] | pbreed@netburner.com |
8f5afb7aed44ba53d02d9f6fd4aef8960b73436f | 6ce4e07f567b8790cb38248de9cfd13828606add | /frameworks/runtime-src/Classes/quick-src/extra/luabinding/HelperFunc_luabinding.cpp | f8cf9850fb6643d3869e45f2773cd2a3a1c6e080 | [] | no_license | Kennywest3/kod_client | 3f80120aa0379f4637f443f060a97a21b5e02c54 | 7f63c69638ec714b5d9ad9048b689310ed25e39c | refs/heads/master | 2021-12-14T11:46:37.365439 | 2015-11-25T09:18:27 | 2015-11-25T09:18:27 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,872 | cpp | /*
** Lua binding: HelperFunc_luabinding
** Generated automatically by tolua++-1.0.92 on Tue Mar 3 21:15:55 2015.
*/
#include "HelperFunc_luabinding.h"
#include "CCLuaEngine.h"
using namespace cocos2d;
#include "../apptools/HelperFunc.h"
/* function to release collected object via destructor */
#ifdef __cplusplus
#endif
/* function to register type */
static void tolua_reg_types (lua_State* tolua_S)
{
tolua_usertype(tolua_S,"HelperFunc");
}
/* method: getFileData of class HelperFunc */
#ifndef TOLUA_DISABLE_tolua_HelperFunc_luabinding_HelperFunc_getFileData00
static int tolua_HelperFunc_luabinding_HelperFunc_getFileData00(lua_State* tolua_S)
{
#if COCOS2D_DEBUG >= 1
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"HelperFunc",0,&tolua_err) ||
!tolua_isstring(tolua_S,2,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,3,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
const char* pPathFile = ((const char*) tolua_tostring(tolua_S,2,0));
{
HelperFunc::getFileData(pPathFile);
}
}
return 1;
#if COCOS2D_DEBUG >= 1
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'getFileData'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* Open function */
TOLUA_API int tolua_HelperFunc_luabinding_open (lua_State* tolua_S)
{
tolua_open(tolua_S);
tolua_reg_types(tolua_S);
tolua_module(tolua_S,"cc",0);
tolua_beginmodule(tolua_S,"cc");
tolua_cclass(tolua_S,"HelperFunc","HelperFunc","",NULL);
tolua_beginmodule(tolua_S,"HelperFunc");
tolua_function(tolua_S,"getFileData",tolua_HelperFunc_luabinding_HelperFunc_getFileData00);
tolua_endmodule(tolua_S);
tolua_endmodule(tolua_S);
return 1;
}
#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501
TOLUA_API int luaopen_HelperFunc_luabinding (lua_State* tolua_S) {
return tolua_HelperFunc_luabinding_open(tolua_S);
};
#endif
| [
"dannyjiajia@gmail.com"
] | dannyjiajia@gmail.com |
9dcf52b0b669b8fdd2c96704392aa3ea4656fd51 | 10117aee3141557e97f96ee6c9caac1b6262807f | /include/binary_search.hpp | e91e894c46084de7539f52b654351248d02fc5af | [
"MIT"
] | permissive | TSonono/cpp-cmake-gtest-santiziers-coverage-setup | 9953023b6e233444bfa7ffb49ea6d492c8f9ce71 | 9cc656f9cfc96fbcff5bbba13138f229ab875992 | refs/heads/master | 2021-06-23T12:04:52.802502 | 2021-05-15T10:14:56 | 2021-05-15T11:31:38 | 225,574,370 | 1 | 0 | MIT | 2020-01-27T16:24:54 | 2019-12-03T08:58:43 | CMake | UTF-8 | C++ | false | false | 626 | hpp | #ifndef binary_search_H
#define binary_search_H
/**
* @file binary_search.hpp
*
* Description
*
*/
/*======= Includes ==========================================================*/
#include <vector>
/*======= Public macro definitions ==========================================*/
/*======= Type Definitions and declarations =================================*/
using namespace std;
/*======= Public variable declarations ======================================*/
/*======= Public function declarations ======================================*/
int binarySearch(vector<int> &array, int target);
#endif /* binary_search_H */
| [
"tofiksonono@msn.com"
] | tofiksonono@msn.com |
f8581d73632d69d8181f2d60d9281301dd0ae0c3 | c8294d6b0d2c9dbcec85c4bd077a5f76b6e8dd1c | /viennacl/linalg/cuda/spgemm_rmerge.hpp | a5275a51ded53e5c7829f1a6bccea8c205e7d1b2 | [
"MIT"
] | permissive | kaushikcfd/viennacl-dev | 131c4266d60b891d2997029c2ef814f50be2c43d | 61b5c2735351beb0ef4dfc353edba99c86ef590d | refs/heads/master | 2020-04-05T02:44:42.635782 | 2019-01-02T05:20:42 | 2019-01-02T05:20:42 | 156,488,670 | 1 | 0 | NOASSERTION | 2018-11-07T04:04:57 | 2018-11-07T04:04:57 | null | UTF-8 | C++ | false | false | 29,143 | hpp | #ifndef VIENNACL_LINALG_CUDA_SPGEMM_RMERGE_HPP_
#define VIENNACL_LINALG_CUDA_SPGEMM_RMERGE_HPP_
/* =========================================================================
Copyright (c) 2010-2016, Institute for Microelectronics,
Institute for Analysis and Scientific Computing,
TU Wien.
Portions of this software are copyright by UChicago Argonne, LLC.
-----------------
ViennaCL - The Vienna Computing Library
-----------------
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
(A list of authors and contributors can be found in the manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
/** @file viennacl/linalg/cuda/sparse_matrix_operations.hpp
@brief Implementations of operations using sparse matrices using CUDA
*/
#include <stdexcept>
#include "viennacl/forwards.h"
#include "viennacl/scalar.hpp"
#include "viennacl/vector.hpp"
#include "viennacl/tools/tools.hpp"
#include "viennacl/linalg/cuda/common.hpp"
#include "viennacl/tools/timer.hpp"
#include "viennacl/linalg/cuda/sparse_matrix_operations_solve.hpp"
namespace viennacl
{
namespace linalg
{
namespace cuda
{
/** @brief Loads a value from the specified address. With CUDA arch 3.5 and above the value is also stored in global constant memory for later reuse */
template<typename NumericT>
static inline __device__ NumericT load_and_cache(const NumericT *address)
{
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 350
return __ldg(address);
#else
return *address;
#endif
}
//
// Stage 1: Obtain upper bound for number of elements per row in C:
//
template<typename IndexT>
__device__ IndexT round_to_next_power_of_2(IndexT val)
{
if (val > 32)
return 64; // just to indicate that we need to split/factor the matrix!
else if (val > 16)
return 32;
else if (val > 8)
return 16;
else if (val > 4)
return 8;
else if (val > 2)
return 4;
else if (val > 1)
return 2;
else
return 1;
}
template<typename IndexT>
__global__ void compressed_matrix_gemm_stage_1(
const IndexT * A_row_indices,
const IndexT * A_col_indices,
IndexT A_size1,
const IndexT * B_row_indices,
IndexT *subwarpsize_per_group,
IndexT *max_nnz_row_A_per_group,
IndexT *max_nnz_row_B_per_group)
{
unsigned int subwarpsize_in_thread = 0;
unsigned int max_nnz_row_A = 0;
unsigned int max_nnz_row_B = 0;
unsigned int rows_per_group = (A_size1 - 1) / gridDim.x + 1;
unsigned int row_per_group_end = min(A_size1, rows_per_group * (blockIdx.x + 1));
for (unsigned int row = rows_per_group * blockIdx.x + threadIdx.x; row < row_per_group_end; row += blockDim.x)
{
unsigned int A_row_start = A_row_indices[row];
unsigned int A_row_end = A_row_indices[row+1];
unsigned int row_num = A_row_end - A_row_start;
subwarpsize_in_thread = max(A_row_end - A_row_start, subwarpsize_in_thread);
max_nnz_row_A = max(max_nnz_row_A, row_num);
for (unsigned int j = A_row_start; j < A_row_end; ++j)
{
unsigned int col = A_col_indices[j];
unsigned int row_len_B = B_row_indices[col + 1] - B_row_indices[col];
max_nnz_row_B = max(row_len_B, max_nnz_row_B);
}
}
// reduction to obtain maximum in thread block
__shared__ unsigned int shared_subwarpsize[256];
__shared__ unsigned int shared_max_nnz_row_A[256];
__shared__ unsigned int shared_max_nnz_row_B[256];
shared_subwarpsize[threadIdx.x] = subwarpsize_in_thread;
shared_max_nnz_row_A[threadIdx.x] = max_nnz_row_A;
shared_max_nnz_row_B[threadIdx.x] = max_nnz_row_B;
for (unsigned int stride = blockDim.x/2; stride > 0; stride /= 2)
{
__syncthreads();
if (threadIdx.x < stride)
{
shared_subwarpsize[threadIdx.x] = max( shared_subwarpsize[threadIdx.x], shared_subwarpsize[threadIdx.x + stride]);
shared_max_nnz_row_A[threadIdx.x] = max(shared_max_nnz_row_A[threadIdx.x], shared_max_nnz_row_A[threadIdx.x + stride]);
shared_max_nnz_row_B[threadIdx.x] = max(shared_max_nnz_row_B[threadIdx.x], shared_max_nnz_row_B[threadIdx.x + stride]);
}
}
if (threadIdx.x == 0)
{
subwarpsize_per_group[blockIdx.x] = round_to_next_power_of_2(shared_subwarpsize[0]);
max_nnz_row_A_per_group[blockIdx.x] = shared_max_nnz_row_A[0];
max_nnz_row_B_per_group[blockIdx.x] = shared_max_nnz_row_B[0];
}
}
//
// Stage 2: Determine sparsity pattern of C
//
// Using warp shuffle routines (CUDA arch 3.5)
template<unsigned int SubWarpSizeV, typename IndexT>
__device__ IndexT subwarp_minimum_shuffle(IndexT min_index)
{
for (unsigned int i = SubWarpSizeV/2; i >= 1; i /= 2)
min_index = min(min_index, __shfl_xor((int)min_index, (int)i));
return min_index;
}
// Using shared memory
template<unsigned int SubWarpSizeV, typename IndexT>
__device__ IndexT subwarp_minimum_shared(IndexT min_index, IndexT id_in_warp, IndexT *shared_buffer)
{
shared_buffer[threadIdx.x] = min_index;
for (unsigned int i = SubWarpSizeV/2; i >= 1; i /= 2)
shared_buffer[threadIdx.x] = min(shared_buffer[threadIdx.x], shared_buffer[(threadIdx.x + i) % 512]);
return shared_buffer[threadIdx.x - id_in_warp];
}
template<unsigned int SubWarpSizeV, typename IndexT>
__global__ void compressed_matrix_gemm_stage_2(
const IndexT * A_row_indices,
const IndexT * A_col_indices,
IndexT A_size1,
const IndexT * B_row_indices,
const IndexT * B_col_indices,
IndexT B_size2,
IndexT * C_row_indices)
{
__shared__ unsigned int shared_buffer[512];
unsigned int num_warps = blockDim.x / SubWarpSizeV;
unsigned int warp_id = threadIdx.x / SubWarpSizeV;
unsigned int id_in_warp = threadIdx.x % SubWarpSizeV;
unsigned int rows_per_group = (A_size1 - 1) / gridDim.x + 1;
unsigned int row_per_group_end = min(A_size1, rows_per_group * (blockIdx.x + 1));
for (unsigned int row = rows_per_group * blockIdx.x + warp_id; row < row_per_group_end; row += num_warps)
{
unsigned int row_A_start = A_row_indices[row];
unsigned int row_A_end = A_row_indices[row+1];
unsigned int my_row_B = row_A_start + id_in_warp;
unsigned int row_B_index = (my_row_B < row_A_end) ? A_col_indices[my_row_B] : 0;
unsigned int row_B_start = (my_row_B < row_A_end) ? load_and_cache(B_row_indices + row_B_index) : 0;
unsigned int row_B_end = (my_row_B < row_A_end) ? load_and_cache(B_row_indices + row_B_index + 1) : 0;
unsigned int num_nnz = 0;
if (row_A_end - row_A_start > 1) // zero or no row can be processed faster
{
unsigned int current_front_index = (row_B_start < row_B_end) ? load_and_cache(B_col_indices + row_B_start) : B_size2;
while (1)
{
// determine current minimum (warp shuffle)
unsigned int min_index = current_front_index;
min_index = subwarp_minimum_shared<SubWarpSizeV>(min_index, id_in_warp, shared_buffer);
if (min_index == B_size2)
break;
// update front:
if (current_front_index == min_index)
{
++row_B_start;
current_front_index = (row_B_start < row_B_end) ? load_and_cache(B_col_indices + row_B_start) : B_size2;
}
++num_nnz;
}
}
else
{
num_nnz = row_B_end - row_B_start;
}
if (id_in_warp == 0)
C_row_indices[row] = num_nnz;
}
}
//
// Stage 3: Fill C with values
//
// Using warp shuffle routines (CUDA arch 3.5)
template<unsigned int SubWarpSizeV, typename NumericT>
__device__ NumericT subwarp_accumulate_shuffle(NumericT output_value)
{
for (unsigned int i = SubWarpSizeV/2; i >= 1; i /= 2)
output_value += __shfl_xor((int)output_value, (int)i);
return output_value;
}
// Using shared memory
template<unsigned int SubWarpSizeV, typename NumericT>
__device__ NumericT subwarp_accumulate_shared(NumericT output_value, unsigned int id_in_warp, NumericT *shared_buffer)
{
shared_buffer[threadIdx.x] = output_value;
for (unsigned int i = SubWarpSizeV/2; i >= 1; i /= 2)
shared_buffer[threadIdx.x] += shared_buffer[(threadIdx.x + i) % 512];
return shared_buffer[threadIdx.x - id_in_warp];
}
template<unsigned int SubWarpSizeV, typename IndexT, typename NumericT>
__global__ void compressed_matrix_gemm_stage_3(
const IndexT * A_row_indices,
const IndexT * A_col_indices,
const NumericT * A_elements,
IndexT A_size1,
const IndexT * B_row_indices,
const IndexT * B_col_indices,
const NumericT * B_elements,
IndexT B_size2,
IndexT const * C_row_indices,
IndexT * C_col_indices,
NumericT * C_elements)
{
__shared__ unsigned int shared_indices[512];
__shared__ NumericT shared_values[512];
unsigned int num_warps = blockDim.x / SubWarpSizeV;
unsigned int warp_id = threadIdx.x / SubWarpSizeV;
unsigned int id_in_warp = threadIdx.x % SubWarpSizeV;
unsigned int rows_per_group = (A_size1 - 1) / gridDim.x + 1;
unsigned int row_per_group_end = min(A_size1, rows_per_group * (blockIdx.x + 1));
for (unsigned int row = rows_per_group * blockIdx.x + warp_id; row < row_per_group_end; row += num_warps)
{
unsigned int row_A_start = A_row_indices[row];
unsigned int row_A_end = A_row_indices[row+1];
unsigned int my_row_B = row_A_start + ((row_A_end - row_A_start > 1) ? id_in_warp : 0); // special case: single row
unsigned int row_B_index = (my_row_B < row_A_end) ? A_col_indices[my_row_B] : 0;
unsigned int row_B_start = (my_row_B < row_A_end) ? load_and_cache(B_row_indices + row_B_index) : 0;
unsigned int row_B_end = (my_row_B < row_A_end) ? load_and_cache(B_row_indices + row_B_index + 1) : 0;
NumericT val_A = (my_row_B < row_A_end) ? A_elements[my_row_B] : 0;
unsigned int index_in_C = C_row_indices[row];
if (row_A_end - row_A_start > 1)
{
unsigned int current_front_index = (row_B_start < row_B_end) ? load_and_cache(B_col_indices + row_B_start) : B_size2;
NumericT current_front_value = (row_B_start < row_B_end) ? load_and_cache(B_elements + row_B_start) : 0;
unsigned int index_buffer = 0;
NumericT value_buffer = 0;
unsigned int buffer_size = 0;
while (1)
{
// determine current minimum:
unsigned int min_index = subwarp_minimum_shared<SubWarpSizeV>(current_front_index, id_in_warp, shared_indices);
if (min_index == B_size2) // done
break;
// compute entry in C:
NumericT output_value = (current_front_index == min_index) ? val_A * current_front_value : 0;
output_value = subwarp_accumulate_shared<SubWarpSizeV>(output_value, id_in_warp, shared_values);
// update front:
if (current_front_index == min_index)
{
++row_B_start;
current_front_index = (row_B_start < row_B_end) ? load_and_cache(B_col_indices + row_B_start) : B_size2;
current_front_value = (row_B_start < row_B_end) ? load_and_cache(B_elements + row_B_start) : 0;
}
// write current front to register buffer:
index_buffer = (id_in_warp == buffer_size) ? min_index : index_buffer;
value_buffer = (id_in_warp == buffer_size) ? output_value : value_buffer;
++buffer_size;
// flush register buffer via a coalesced write once full:
if (buffer_size == SubWarpSizeV)
{
C_col_indices[index_in_C + id_in_warp] = index_buffer;
C_elements[index_in_C + id_in_warp] = value_buffer;
}
index_in_C += (buffer_size == SubWarpSizeV) ? SubWarpSizeV : 0;
buffer_size = (buffer_size == SubWarpSizeV) ? 0 : buffer_size;
}
// write remaining entries in register buffer to C:
if (id_in_warp < buffer_size)
{
C_col_indices[index_in_C + id_in_warp] = index_buffer;
C_elements[index_in_C + id_in_warp] = value_buffer;
}
}
else // write respective row using the full subwarp:
{
for (unsigned int i = row_B_start + id_in_warp; i < row_B_end; i += SubWarpSizeV)
{
C_col_indices[index_in_C + id_in_warp] = load_and_cache(B_col_indices + i);
C_elements[index_in_C + id_in_warp] = val_A * load_and_cache(B_elements + i);
index_in_C += SubWarpSizeV;
}
}
}
}
//
// Decomposition kernels:
//
template<typename IndexT>
__global__ void compressed_matrix_gemm_decompose_1(
const IndexT * A_row_indices,
IndexT A_size1,
IndexT max_per_row,
IndexT *chunks_per_row)
{
for (IndexT i = blockIdx.x * blockDim.x + threadIdx.x; i < A_size1; i += blockDim.x * gridDim.x)
{
IndexT num_entries = A_row_indices[i+1] - A_row_indices[i];
chunks_per_row[i] = (num_entries < max_per_row) ? 1 : ((num_entries - 1)/ max_per_row + 1);
}
}
template<typename IndexT, typename NumericT>
__global__ void compressed_matrix_gemm_A2(
IndexT * A2_row_indices,
IndexT * A2_col_indices,
NumericT * A2_elements,
IndexT A2_size1,
IndexT *new_row_buffer)
{
for (IndexT i = blockIdx.x * blockDim.x + threadIdx.x; i < A2_size1; i += blockDim.x * gridDim.x)
{
unsigned int index_start = new_row_buffer[i];
unsigned int index_stop = new_row_buffer[i+1];
A2_row_indices[i] = index_start;
for (IndexT j = index_start; j < index_stop; ++j)
{
A2_col_indices[j] = j;
A2_elements[j] = NumericT(1);
}
}
// write last entry in row_buffer with global thread 0:
if (threadIdx.x == 0 && blockIdx.x == 0)
A2_row_indices[A2_size1] = new_row_buffer[A2_size1];
}
template<typename IndexT, typename NumericT>
__global__ void compressed_matrix_gemm_G1(
IndexT * G1_row_indices,
IndexT * G1_col_indices,
NumericT * G1_elements,
IndexT G1_size1,
IndexT const *A_row_indices,
IndexT const *A_col_indices,
NumericT const *A_elements,
IndexT A_size1,
IndexT A_nnz,
IndexT max_per_row,
IndexT *new_row_buffer)
{
// Part 1: Copy column indices and entries:
for (IndexT i = blockIdx.x * blockDim.x + threadIdx.x; i < A_nnz; i += blockDim.x * gridDim.x)
{
G1_col_indices[i] = A_col_indices[i];
G1_elements[i] = A_elements[i];
}
// Part 2: Derive new row indicies:
for (IndexT i = blockIdx.x * blockDim.x + threadIdx.x; i < A_size1; i += blockDim.x * gridDim.x)
{
unsigned int old_start = A_row_indices[i];
unsigned int new_start = new_row_buffer[i];
unsigned int row_chunks = new_row_buffer[i+1] - new_start;
for (IndexT j=0; j<row_chunks; ++j)
G1_row_indices[new_start + j] = old_start + j * max_per_row;
}
// write last entry in row_buffer with global thread 0:
if (threadIdx.x == 0 && blockIdx.x == 0)
G1_row_indices[G1_size1] = A_row_indices[A_size1];
}
/** @brief Carries out sparse_matrix-sparse_matrix multiplication for CSR matrices
*
* Implementation of the convenience expression C = prod(A, B);
* Based on computing C(i, :) = A(i, :) * B via merging the respective rows of B
*
* @param A Left factor
* @param B Right factor
* @param C Result matrix
*/
template<class NumericT, unsigned int AlignmentV>
void prod_impl(viennacl::compressed_matrix<NumericT, AlignmentV> const & A,
viennacl::compressed_matrix<NumericT, AlignmentV> const & B,
viennacl::compressed_matrix<NumericT, AlignmentV> & C)
{
C.resize(A.size1(), B.size2(), false);
unsigned int blocknum = 256;
unsigned int threadnum = 128;
viennacl::vector<unsigned int> subwarp_sizes(blocknum, viennacl::traits::context(A)); // upper bound for the nonzeros per row encountered for each work group
viennacl::vector<unsigned int> max_nnz_row_A(blocknum, viennacl::traits::context(A)); // upper bound for the nonzeros per row encountered for each work group
viennacl::vector<unsigned int> max_nnz_row_B(blocknum, viennacl::traits::context(A)); // upper bound for the nonzeros per row encountered for each work group
//
// Stage 1: Determine upper bound for number of nonzeros
//
compressed_matrix_gemm_stage_1<<<blocknum, threadnum>>>(viennacl::cuda_arg<unsigned int>(A.handle1()),
viennacl::cuda_arg<unsigned int>(A.handle2()),
static_cast<unsigned int>(A.size1()),
viennacl::cuda_arg<unsigned int>(B.handle1()),
viennacl::cuda_arg(subwarp_sizes),
viennacl::cuda_arg(max_nnz_row_A),
viennacl::cuda_arg(max_nnz_row_B)
);
VIENNACL_CUDA_LAST_ERROR_CHECK("compressed_matrix_gemm_stage_1");
subwarp_sizes.switch_memory_context(viennacl::context(MAIN_MEMORY));
unsigned int * subwarp_sizes_ptr = viennacl::linalg::host_based::detail::extract_raw_pointer<unsigned int>(subwarp_sizes.handle());
max_nnz_row_A.switch_memory_context(viennacl::context(MAIN_MEMORY));
unsigned int const * max_nnz_row_A_ptr = viennacl::linalg::host_based::detail::extract_raw_pointer<unsigned int>(max_nnz_row_A.handle());
unsigned int max_subwarp_size = 0;
//std::cout << "Scratchpad offsets: " << std::endl;
for (std::size_t i=0; i<subwarp_sizes.size(); ++i)
max_subwarp_size = std::max(max_subwarp_size, subwarp_sizes_ptr[i]);
unsigned int A_max_nnz_per_row = 0;
for (std::size_t i=0; i<max_nnz_row_A.size(); ++i)
A_max_nnz_per_row = std::max(A_max_nnz_per_row, max_nnz_row_A_ptr[i]);
if (max_subwarp_size > 32)
{
// determine augmented size:
unsigned int max_entries_in_G = 32;
if (A_max_nnz_per_row <= 256)
max_entries_in_G = 16;
if (A_max_nnz_per_row <= 64)
max_entries_in_G = 8;
viennacl::vector<unsigned int> exclusive_scan_helper(A.size1() + 1, viennacl::traits::context(A));
compressed_matrix_gemm_decompose_1<<<blocknum, threadnum>>>(viennacl::cuda_arg<unsigned int>(A.handle1()),
static_cast<unsigned int>(A.size1()),
static_cast<unsigned int>(max_entries_in_G),
viennacl::cuda_arg(exclusive_scan_helper)
);
VIENNACL_CUDA_LAST_ERROR_CHECK("compressed_matrix_gemm_decompose_1");
viennacl::linalg::exclusive_scan(exclusive_scan_helper);
unsigned int augmented_size = exclusive_scan_helper[A.size1()];
// split A = A2 * G1
viennacl::compressed_matrix<NumericT, AlignmentV> A2(A.size1(), augmented_size, augmented_size, viennacl::traits::context(A));
viennacl::compressed_matrix<NumericT, AlignmentV> G1(augmented_size, A.size2(), A.nnz(), viennacl::traits::context(A));
// fill A2:
compressed_matrix_gemm_A2<<<blocknum, threadnum>>>(viennacl::cuda_arg<unsigned int>(A2.handle1()),
viennacl::cuda_arg<unsigned int>(A2.handle2()),
viennacl::cuda_arg<NumericT>(A2.handle()),
static_cast<unsigned int>(A2.size1()),
viennacl::cuda_arg(exclusive_scan_helper)
);
VIENNACL_CUDA_LAST_ERROR_CHECK("compressed_matrix_gemm_A2");
// fill G1:
compressed_matrix_gemm_G1<<<blocknum, threadnum>>>(viennacl::cuda_arg<unsigned int>(G1.handle1()),
viennacl::cuda_arg<unsigned int>(G1.handle2()),
viennacl::cuda_arg<NumericT>(G1.handle()),
static_cast<unsigned int>(G1.size1()),
viennacl::cuda_arg<unsigned int>(A.handle1()),
viennacl::cuda_arg<unsigned int>(A.handle2()),
viennacl::cuda_arg<NumericT>(A.handle()),
static_cast<unsigned int>(A.size1()),
static_cast<unsigned int>(A.nnz()),
static_cast<unsigned int>(max_entries_in_G),
viennacl::cuda_arg(exclusive_scan_helper)
);
VIENNACL_CUDA_LAST_ERROR_CHECK("compressed_matrix_gemm_G1");
// compute tmp = G1 * B;
// C = A2 * tmp;
viennacl::compressed_matrix<NumericT, AlignmentV> tmp(G1.size1(), B.size2(), 0, viennacl::traits::context(A));
prod_impl(G1, B, tmp); // this runs a standard RMerge without decomposition of G1
prod_impl(A2, tmp, C); // this may split A2 again
return;
}
//std::cout << "Running RMerge with subwarp size " << max_subwarp_size << std::endl;
subwarp_sizes.switch_memory_context(viennacl::traits::context(A));
max_nnz_row_A.switch_memory_context(viennacl::traits::context(A));
//
// Stage 2: Determine pattern of C
//
if (max_subwarp_size == 32)
{
compressed_matrix_gemm_stage_2<32><<<blocknum, threadnum>>>(viennacl::cuda_arg<unsigned int>(A.handle1()),
viennacl::cuda_arg<unsigned int>(A.handle2()),
static_cast<unsigned int>(A.size1()),
viennacl::cuda_arg<unsigned int>(B.handle1()),
viennacl::cuda_arg<unsigned int>(B.handle2()),
static_cast<unsigned int>(B.size2()),
viennacl::cuda_arg<unsigned int>(C.handle1())
);
VIENNACL_CUDA_LAST_ERROR_CHECK("compressed_matrix_gemm_stage_2");
}
else if (max_subwarp_size == 16)
{
compressed_matrix_gemm_stage_2<16><<<blocknum, threadnum>>>(viennacl::cuda_arg<unsigned int>(A.handle1()),
viennacl::cuda_arg<unsigned int>(A.handle2()),
static_cast<unsigned int>(A.size1()),
viennacl::cuda_arg<unsigned int>(B.handle1()),
viennacl::cuda_arg<unsigned int>(B.handle2()),
static_cast<unsigned int>(B.size2()),
viennacl::cuda_arg<unsigned int>(C.handle1())
);
VIENNACL_CUDA_LAST_ERROR_CHECK("compressed_matrix_gemm_stage_2");
}
else
{
compressed_matrix_gemm_stage_2<8><<<blocknum, threadnum>>>(viennacl::cuda_arg<unsigned int>(A.handle1()),
viennacl::cuda_arg<unsigned int>(A.handle2()),
static_cast<unsigned int>(A.size1()),
viennacl::cuda_arg<unsigned int>(B.handle1()),
viennacl::cuda_arg<unsigned int>(B.handle2()),
static_cast<unsigned int>(B.size2()),
viennacl::cuda_arg<unsigned int>(C.handle1())
);
VIENNACL_CUDA_LAST_ERROR_CHECK("compressed_matrix_gemm_stage_2");
}
// exclusive scan on C.handle1(), ultimately allowing to allocate remaining memory for C
viennacl::backend::typesafe_host_array<unsigned int> row_buffer(C.handle1(), C.size1() + 1);
viennacl::backend::memory_read(C.handle1(), 0, row_buffer.raw_size(), row_buffer.get());
unsigned int current_offset = 0;
for (std::size_t i=0; i<C.size1(); ++i)
{
unsigned int tmp = row_buffer[i];
row_buffer.set(i, current_offset);
current_offset += tmp;
}
row_buffer.set(C.size1(), current_offset);
viennacl::backend::memory_write(C.handle1(), 0, row_buffer.raw_size(), row_buffer.get());
//
// Stage 3: Compute entries in C
//
C.reserve(current_offset, false);
if (max_subwarp_size == 32)
{
compressed_matrix_gemm_stage_3<32><<<blocknum, threadnum>>>(viennacl::cuda_arg<unsigned int>(A.handle1()),
viennacl::cuda_arg<unsigned int>(A.handle2()),
viennacl::cuda_arg<NumericT>(A.handle()),
static_cast<unsigned int>(A.size1()),
viennacl::cuda_arg<unsigned int>(B.handle1()),
viennacl::cuda_arg<unsigned int>(B.handle2()),
viennacl::cuda_arg<NumericT>(B.handle()),
static_cast<unsigned int>(B.size2()),
viennacl::cuda_arg<unsigned int>(C.handle1()),
viennacl::cuda_arg<unsigned int>(C.handle2()),
viennacl::cuda_arg<NumericT>(C.handle())
);
VIENNACL_CUDA_LAST_ERROR_CHECK("compressed_matrix_gemm_stage_3");
}
else if (max_subwarp_size == 16)
{
compressed_matrix_gemm_stage_3<16><<<blocknum, threadnum>>>(viennacl::cuda_arg<unsigned int>(A.handle1()),
viennacl::cuda_arg<unsigned int>(A.handle2()),
viennacl::cuda_arg<NumericT>(A.handle()),
static_cast<unsigned int>(A.size1()),
viennacl::cuda_arg<unsigned int>(B.handle1()),
viennacl::cuda_arg<unsigned int>(B.handle2()),
viennacl::cuda_arg<NumericT>(B.handle()),
static_cast<unsigned int>(B.size2()),
viennacl::cuda_arg<unsigned int>(C.handle1()),
viennacl::cuda_arg<unsigned int>(C.handle2()),
viennacl::cuda_arg<NumericT>(C.handle())
);
VIENNACL_CUDA_LAST_ERROR_CHECK("compressed_matrix_gemm_stage_3");
}
else
{
compressed_matrix_gemm_stage_3<8><<<blocknum, threadnum>>>(viennacl::cuda_arg<unsigned int>(A.handle1()),
viennacl::cuda_arg<unsigned int>(A.handle2()),
viennacl::cuda_arg<NumericT>(A.handle()),
static_cast<unsigned int>(A.size1()),
viennacl::cuda_arg<unsigned int>(B.handle1()),
viennacl::cuda_arg<unsigned int>(B.handle2()),
viennacl::cuda_arg<NumericT>(B.handle()),
static_cast<unsigned int>(B.size2()),
viennacl::cuda_arg<unsigned int>(C.handle1()),
viennacl::cuda_arg<unsigned int>(C.handle2()),
viennacl::cuda_arg<NumericT>(C.handle())
);
VIENNACL_CUDA_LAST_ERROR_CHECK("compressed_matrix_gemm_stage_3");
}
}
} // namespace cuda
} //namespace linalg
} //namespace viennacl
#endif
| [
"rupp@iue.tuwien.ac.at"
] | rupp@iue.tuwien.ac.at |
57870e0a3fc0465fe940e4142593bb4bc8b0fbf5 | 4dfeeb148f11dc0ce9c5c7804c22d786930ad7ef | /OpenGL/src/Renderer.cpp | a2e4b68b175d910a7a2c8f485c931ffb2434d65f | [] | no_license | mouliii/OpenGL | 7db5683baa38746c7cce1d1fc5d46de435afcd9c | e58ec452de3a181b15f53472d126fe7f673b8a5a | refs/heads/master | 2023-07-25T19:40:38.011856 | 2021-09-08T14:29:10 | 2021-09-08T14:29:10 | 396,871,801 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,712 | cpp | #include "Renderer.h"
Renderer::Renderer(OrthoCamera* camera)
:shader("res/shaders/DefaultVertex.shader", "res/shaders/DefaultFragment.shader"),
vao(),vbo(),ibo(),
camera(camera)
{
vao.Bind();
vbo.Bind();
//vbo.SetData(vertices.size() * sizeof(Vertex), vertices.data());
ibo.Bind();
//ibo.SetData(indices);
vao.LinkAttribute(vbo, 0, 3, GL_FLOAT, sizeof(Vertex), (GLvoid*)offsetof(Vertex, pos));
vao.LinkAttribute(vbo, 1, 4, GL_FLOAT, sizeof(Vertex), (GLvoid*)offsetof(Vertex, color));
vao.LinkAttribute(vbo, 2, 2, GL_FLOAT, sizeof(Vertex), (GLvoid*)offsetof(Vertex, texCoord));
vao.LinkAttribute(vbo, 3, 1, GL_FLOAT, sizeof(Vertex), (GLvoid*)offsetof(Vertex, textureIndex));
vao.Unbind();
vbo.Unbind();
ibo.Unbind();
defaultTexture = TextureManager::LoadTexture("res/textures/white1x1.png");
shader.Unbind();
//// 1x1 white texture
//uint32_t wpId;
//glCreateTextures(GL_TEXTURE_2D, 1, &wpId);
//glBindTexture(GL_TEXTURE_2D, wpId);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
//uint32_t color = 0xffffffff;
//glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, &color);
}
void Renderer::BeginFrame()
{
}
void Renderer::EndFrame()
{
}
void Renderer::DrawTexture(const Vec2f& pos, const Texture* texture)
{
Quad q(pos, Vec2f(texture->GetWidth() / 2.f, texture->GetHeight() / 2.f), glm::vec4(1.f));
Draw(q, texture);
}
void Renderer::Draw(Primitive& primitive, const Texture* texture)
{
// set default shader
this->shader.Bind();
glm::mat4 viewProj = camera->GetViewProjectionMatrix();
this->shader.SetUniform4fv("uViewProj", viewProj);
this->shader.SetUniform4f("uColor", glm::vec4(1.f));
// activate texture
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture->GetId());
// draw
ImmediateDraw(primitive);
}
void Renderer::Draw(Primitive& primitive, const glm::vec4& color)
{
// set default shader
this->shader.Bind();
glm::mat4 viewProj = camera->GetViewProjectionMatrix();
this->shader.SetUniform4fv("uViewProj", viewProj);
this->shader.SetUniform4f("uColor", color);
// activate default texture
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, defaultTexture->GetId() );
ImmediateDraw(primitive);
}
void Renderer::Draw(Primitive& primitive, const Texture* texture, glm::mat4& transform, Shader& shader)
{
shader.Bind();
glm::mat4 viewProj = camera->GetViewProjectionMatrix();
shader.SetUniform4fv("uViewProj", viewProj);
shader.SetUniform4f("uColor", glm::vec4(1.f));
shader.SetUniform4fv("uTransform", transform);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture->GetId());
ImmediateDraw(primitive.GetVertices(), primitive.GetIndices());
shader.Unbind();
}
void Renderer::Draw(const std::vector<Vertex>& vertices, const std::vector<uint32_t>& indices, const Texture* texture)
{
// set default shader
this->shader.Bind();
glm::mat4 viewProj = camera->GetViewProjectionMatrix();
this->shader.SetUniform4fv("uViewProj", viewProj);
this->shader.SetUniform4f("uColor", glm::vec4(1.f));
// activate texture
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture->GetId());
// draw
ImmediateDraw(vertices, indices);
}
void Renderer::Draw(const std::vector<Vertex>& vertices, const std::vector<uint32_t>& indices, const glm::vec4& color)
{
// set default shader
this->shader.Bind();
glm::mat4 viewProj = camera->GetViewProjectionMatrix();
this->shader.SetUniform4fv("uViewProj", viewProj);
this->shader.SetUniform4f("uColor", color);
// activate default texture
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, defaultTexture->GetId());
ImmediateDraw(vertices, indices);
}
void Renderer::Draw(Mesh& mesh)
{
Draw(mesh.GetVertices(), mesh.GetIndices(), mesh.GetTexture().get() );
}
void Renderer::ImmediateDraw(Primitive& primitive)
{
vao.Bind();
vbo.Bind(); // todo: ei toimi jos eri *Vertex* struct
vbo.SetData(primitive.GetVertexCount() * sizeof(Vertex), primitive.GetVertices().data());
ibo.Bind();
ibo.SetData(primitive.GetIndices());
glDrawElements(GL_TRIANGLES, primitive.GetIndexCount(), GL_UNSIGNED_INT, 0);
vao.Unbind();
}
void Renderer::ImmediateDraw(const std::vector<Vertex>& vertices, const std::vector<uint32_t>& indices)
{
vao.Bind();
vbo.Bind(); // todo: ei toimi jos eri *Vertex* struct
vbo.SetData(vertices.size() * sizeof(Vertex), vertices.data());
ibo.Bind();
ibo.SetData(indices);
glDrawElements(GL_TRIANGLES, indices.size(), GL_UNSIGNED_INT, 0);
vao.Unbind();
}
| [
"rasanen.aleksi@hotmail.com"
] | rasanen.aleksi@hotmail.com |
dd174752fe2ed23b342e0889e61d760bed8d9a8b | 80a96581255056a03f126e19b081276d5a66dd2e | /DlgBitmapProperties.h | 64fde3933161cf151ddf49a3168b248379bd7aa8 | [] | no_license | patchell/FrontCad | 6c1c9e4e7642eafe8a8a556c17e098f32077c548 | b2567d6d0b57b22a29efa64aa42d583cd1a457b8 | refs/heads/master | 2023-07-07T04:24:40.368564 | 2023-06-29T03:42:46 | 2023-06-29T03:42:46 | 75,502,957 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,012 | h | #pragma once
// CDlgBitmapProperties dialog
class CDlgBitmapProperties : public CDialog
{
//-----------------------------------------
// Data
//-----------------------------------------
CCadBitmap* m_pBitmap;;
//-----------------------------------------
//Copntrols
//-----------------------------------------
CButton m_Check_MaintainAspecRation;
CEditText m_Edit_FileName;
DECLARE_DYNAMIC(CDlgBitmapProperties)
public:
CDlgBitmapProperties(CWnd* pParent = NULL); // standard constructor
virtual ~CDlgBitmapProperties();
void SetBitmapData(CCadBitmap* pCB) { m_pBitmap = pCB; }
afx_msg void OnBnClickedCheckMaintainAspectRatio();
afx_msg void OnBnClickedButtonChooseFile();
virtual void OnOK();
virtual BOOL OnInitDialog();
// Dialog Data
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_DIALOG_BITMAP_PROPERTIES };
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
afx_msg LRESULT OnDlgControlDirty(WPARAM wParam, LPARAM lParam);
};
| [
"patchell@cox.net"
] | patchell@cox.net |
7ee51b66a059025808b900c028527ae521af9a71 | 24cb3a4494179cf40fd5f4d964d853d516d15d80 | /leetcode/search-in-rotated-sorted-array.cpp | 71bcb2b2627ef0fd1bfccd826d00402529a013ce | [] | no_license | Garciat/competitive | 5dd7c82205292a34da6a4026955747407539f897 | 5567f19ec8b3d3303dc38670fe8a95aec201fe9e | refs/heads/master | 2021-07-09T20:29:36.339551 | 2021-04-21T20:43:44 | 2021-04-21T20:43:44 | 83,537,147 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 804 | cpp | // https://leetcode.com/problems/search-in-rotated-sorted-array/
class Solution {
public:
int search(vector<int>& nums, int target) {
if (nums.empty()) return -1;
int L = 0;
int R = nums.size() - 1;
while (L < R && nums[L] >= nums[R]) {
int M = L + (R - L) / 2;
if (nums[M] > nums[R]) {
L = M + 1;
} else {
R = M;
}
}
vector<int>::iterator it;
if (target <= nums.back()) {
it = lower_bound(nums.begin()+L, nums.end(), target);
} else {
it = lower_bound(nums.begin(), nums.begin()+L, target);
}
return it != nums.end() && *it == target ? it - nums.begin() : -1;
}
};
| [
"gabrielg@eventbrite.com"
] | gabrielg@eventbrite.com |
a3eb2c1d588cd660ab358616beee2bae4f4b61ab | c2d320626432c783b5f5090bfcc0ad56eb8d814c | /Backend/Parser/submissions/Assignment 2/90.cpp | 28d0f4f0d70df112120cb1020895f6348967b38b | [] | no_license | shreysingla11/ssl-project | dbc5569ac2d83b359daa3eda67ab1083949ea160 | 1a6e7494074f74a61100c1d8d09e7709f7f4931c | refs/heads/master | 2023-01-29T07:57:20.968588 | 2020-12-08T15:34:37 | 2020-12-08T15:34:37 | 304,885,246 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,946 | cpp | #include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
class cord{public:int x,y,index;};
void func(vector<cord> vred,vector<cord> vblue);
int main()
{
int n;
//int temp1,temp2;
cord t;
cin>>n;
vector<cord> vred;
vector<cord> vblue;
for(int i=0;i<(n/2);i++)
{
scanf("%d %d",&t.x,&t.y);
t.index=i;
vred.push_back(t);
}
for(int i=0;i<(n/2);i++)
{
scanf("%d %d",&t.x,&t.y);
t.index=i;
vblue.push_back(t);
}
/*for(int count=0;count<n/2;count++)
{cout<<vred[count].x<<" "<<vred[count].y<<" "<<vred[count].index<<"\n";}
for(int count=0;count<n/2;count++)
{cout<<vblue[count].x<<" "<<vblue[count].y<<" "<<vblue[count].index<<"\n";}
*/
func(vred,vblue);
}
void func(vector<cord> vred,vector<cord> vblue)
{
vector<cord> vredl;
vector<cord> vbluel;
vector<cord> vredr;
vector<cord> vbluer;
vredl.clear();
vredr.clear();
vbluel.clear();
vbluer.clear();
int c1,c2;
//vector<int> temp1r,temp2r,temp1b,temp2b;
if(vred.empty()){return;}
if(vred.size()==1){cout<<vred[0].index<<" "<<vblue[0].index<<"\n";return;}
else
{for(int i=0;i<vblue.size();i++)
{
c1=0;
vbluel.clear();
vbluer.clear();
c2=0;
vredl.clear();
vredr.clear();
for(int j=0;j<vblue.size();j++)
{
//temp1b.clear();
//temp2b.clear();
if(i==j){continue;}
else if(((vblue[j].y-vblue[i].y)*(vblue[i].x-vred[0].x)-(vblue[i].y-vred[0].y)*(vblue[j].x-vblue[i].x))<0)
{
c1++;
//cout<<c1;
vbluel.push_back(vblue[j]);
}
else {vbluer.push_back(vblue[j]);}
}
for(int j=1;j<vred.size();j++)
{
//temp1r.clear();
//temp2r.clear();
if(((vred[j].y-vblue[i].y)*(vblue[i].x-vred[0].x)-(vblue[i].y-vred[0].y)*(vred[j].x-vblue[i].x))<0)
{
c2++;
//cout<<c2;
vredl.push_back(vred[j]);
}
else {vredr.push_back(vred[j]);}
}
if(c1==c2)
{
cout<<vred[0].index<<" "<<vblue[i].index<<"\n";
/*for(int k=0;k<temp1r.size();k++)
{
vredl.push_back(vred[temp1r[k]]);
vbluel.push_back(vblue[temp1b[k]]);
}
for(int k=0;k<temp2r.size();k++)
{
vredr.push_back(vred[temp2r[k]]);
vbluer.push_back(vblue[temp2b[k]]);
}*/
i=i+1;
break;
}
}
func(vredr,vbluer);
func(vredl,vbluel);
return;
}}
| [
"shreysingla2@gmail.com"
] | shreysingla2@gmail.com |
e04dc79574c0d1dcdbc6909bfe37c3865d46c18f | 230fb8845f39bef0f30f5d3541eff5dc0641de14 | /Connect3/Export/windows/obj/src/haxe/ui/layouts/DelegateLayout.cpp | 2619b1e9ef5d7ca012c051f57d233262c015568c | [] | no_license | vhlk/AlgoritmoMinMax | 76abd62a6e2859ed229e5831264b6d8af27e318d | 40eded4948794ca48d50d16d2133a9ab21207768 | refs/heads/main | 2023-06-30T15:16:17.492478 | 2021-08-02T13:29:32 | 2021-08-02T13:29:32 | 390,493,745 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | true | 9,010 | cpp | // Generated by Haxe 4.2.0
#include <hxcpp.h>
#ifndef INCLUDED_haxe_ui_backend_ComponentBase
#include <haxe/ui/backend/ComponentBase.h>
#endif
#ifndef INCLUDED_haxe_ui_backend_ComponentImpl
#include <haxe/ui/backend/ComponentImpl.h>
#endif
#ifndef INCLUDED_haxe_ui_core_Component
#include <haxe/ui/core/Component.h>
#endif
#ifndef INCLUDED_haxe_ui_core_ComponentBounds
#include <haxe/ui/core/ComponentBounds.h>
#endif
#ifndef INCLUDED_haxe_ui_core_ComponentCommon
#include <haxe/ui/core/ComponentCommon.h>
#endif
#ifndef INCLUDED_haxe_ui_core_ComponentContainer
#include <haxe/ui/core/ComponentContainer.h>
#endif
#ifndef INCLUDED_haxe_ui_core_ComponentEvents
#include <haxe/ui/core/ComponentEvents.h>
#endif
#ifndef INCLUDED_haxe_ui_core_ComponentLayout
#include <haxe/ui/core/ComponentLayout.h>
#endif
#ifndef INCLUDED_haxe_ui_core_ComponentValidation
#include <haxe/ui/core/ComponentValidation.h>
#endif
#ifndef INCLUDED_haxe_ui_core_IClonable
#include <haxe/ui/core/IClonable.h>
#endif
#ifndef INCLUDED_haxe_ui_core_IComponentBase
#include <haxe/ui/core/IComponentBase.h>
#endif
#ifndef INCLUDED_haxe_ui_geom_Size
#include <haxe/ui/geom/Size.h>
#endif
#ifndef INCLUDED_haxe_ui_layouts_DefaultLayout
#include <haxe/ui/layouts/DefaultLayout.h>
#endif
#ifndef INCLUDED_haxe_ui_layouts_DelegateLayout
#include <haxe/ui/layouts/DelegateLayout.h>
#endif
#ifndef INCLUDED_haxe_ui_layouts_DelegateLayoutSize
#include <haxe/ui/layouts/DelegateLayoutSize.h>
#endif
#ifndef INCLUDED_haxe_ui_layouts_ILayout
#include <haxe/ui/layouts/ILayout.h>
#endif
#ifndef INCLUDED_haxe_ui_layouts_Layout
#include <haxe/ui/layouts/Layout.h>
#endif
#ifndef INCLUDED_haxe_ui_validation_IValidating
#include <haxe/ui/validation/IValidating.h>
#endif
#ifndef INCLUDED_openfl_display_DisplayObject
#include <openfl/display/DisplayObject.h>
#endif
#ifndef INCLUDED_openfl_display_DisplayObjectContainer
#include <openfl/display/DisplayObjectContainer.h>
#endif
#ifndef INCLUDED_openfl_display_IBitmapDrawable
#include <openfl/display/IBitmapDrawable.h>
#endif
#ifndef INCLUDED_openfl_display_InteractiveObject
#include <openfl/display/InteractiveObject.h>
#endif
#ifndef INCLUDED_openfl_display_Sprite
#include <openfl/display/Sprite.h>
#endif
#ifndef INCLUDED_openfl_events_EventDispatcher
#include <openfl/events/EventDispatcher.h>
#endif
#ifndef INCLUDED_openfl_events_IEventDispatcher
#include <openfl/events/IEventDispatcher.h>
#endif
HX_DEFINE_STACK_FRAME(_hx_pos_630268b720cd3097_9_new,"haxe.ui.layouts.DelegateLayout","new",0x1e7d4cb8,"haxe.ui.layouts.DelegateLayout.new","haxe/ui/layouts/DelegateLayout.hx",9,0x87ba55f7)
HX_LOCAL_STACK_FRAME(_hx_pos_630268b720cd3097_14_calcAutoSize,"haxe.ui.layouts.DelegateLayout","calcAutoSize",0x7d9fba2d,"haxe.ui.layouts.DelegateLayout.calcAutoSize","haxe/ui/layouts/DelegateLayout.hx",14,0x87ba55f7)
HX_LOCAL_STACK_FRAME(_hx_pos_630268b720cd3097_28_get_usableSize,"haxe.ui.layouts.DelegateLayout","get_usableSize",0xc2533eca,"haxe.ui.layouts.DelegateLayout.get_usableSize","haxe/ui/layouts/DelegateLayout.hx",28,0x87ba55f7)
namespace haxe{
namespace ui{
namespace layouts{
void DelegateLayout_obj::__construct( ::haxe::ui::layouts::DelegateLayoutSize size){
HX_STACKFRAME(&_hx_pos_630268b720cd3097_9_new)
HXLINE( 10) super::__construct();
HXLINE( 11) this->_size = size;
}
Dynamic DelegateLayout_obj::__CreateEmpty() { return new DelegateLayout_obj; }
void *DelegateLayout_obj::_hx_vtable = 0;
Dynamic DelegateLayout_obj::__Create(::hx::DynamicArray inArgs)
{
::hx::ObjectPtr< DelegateLayout_obj > _hx_result = new DelegateLayout_obj();
_hx_result->__construct(inArgs[0]);
return _hx_result;
}
bool DelegateLayout_obj::_hx_isInstanceOf(int inClassId) {
if (inClassId<=(int)0x23db4184) {
if (inClassId<=(int)0x1495ee76) {
return inClassId==(int)0x00000001 || inClassId==(int)0x1495ee76;
} else {
return inClassId==(int)0x23db4184;
}
} else {
return inClassId==(int)0x3799f835;
}
}
::haxe::ui::geom::Size DelegateLayout_obj::calcAutoSize(::Array< ::Dynamic> exclusions){
HX_GC_STACKFRAME(&_hx_pos_630268b720cd3097_14_calcAutoSize)
HXLINE( 15) this->_size->component = this->get_component();
HXLINE( 17) Float cx = this->_size->get_width();
HXLINE( 18) Float cy = this->_size->get_height();
HXLINE( 19) if ((this->_size->getBool(HX_("includePadding",89,18,b5,13),false) == true)) {
HXLINE( 20) Float cx1 = this->get_paddingLeft();
HXDLIN( 20) cx = (cx + (cx1 + this->get_paddingRight()));
HXLINE( 21) Float cy1 = this->get_paddingTop();
HXDLIN( 21) cy = (cy + (cy1 + this->get_paddingBottom()));
}
HXLINE( 24) ::haxe::ui::geom::Size size = ::haxe::ui::geom::Size_obj::__alloc( HX_CTX ,cx,cy);
HXLINE( 25) return size;
}
::haxe::ui::geom::Size DelegateLayout_obj::get_usableSize(){
HX_STACKFRAME(&_hx_pos_630268b720cd3097_28_get_usableSize)
HXLINE( 29) ::haxe::ui::geom::Size size = this->super::get_usableSize();
HXLINE( 30) this->_size->component = this->get_component();
HXLINE( 31) ::haxe::ui::geom::Size size1 = size;
HXDLIN( 31) Float size2 = size1->width;
HXDLIN( 31) size1->width = (size2 - this->_size->get_usableWidthModifier());
HXLINE( 32) ::haxe::ui::geom::Size size3 = size;
HXDLIN( 32) Float size4 = size3->height;
HXDLIN( 32) size3->height = (size4 - this->_size->get_usableHeightModifier());
HXLINE( 33) return size;
}
::hx::ObjectPtr< DelegateLayout_obj > DelegateLayout_obj::__new( ::haxe::ui::layouts::DelegateLayoutSize size) {
::hx::ObjectPtr< DelegateLayout_obj > __this = new DelegateLayout_obj();
__this->__construct(size);
return __this;
}
::hx::ObjectPtr< DelegateLayout_obj > DelegateLayout_obj::__alloc(::hx::Ctx *_hx_ctx, ::haxe::ui::layouts::DelegateLayoutSize size) {
DelegateLayout_obj *__this = (DelegateLayout_obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(DelegateLayout_obj), true, "haxe.ui.layouts.DelegateLayout"));
*(void **)__this = DelegateLayout_obj::_hx_vtable;
__this->__construct(size);
return __this;
}
DelegateLayout_obj::DelegateLayout_obj()
{
}
void DelegateLayout_obj::__Mark(HX_MARK_PARAMS)
{
HX_MARK_BEGIN_CLASS(DelegateLayout);
HX_MARK_MEMBER_NAME(_size,"_size");
::haxe::ui::layouts::Layout_obj::__Mark(HX_MARK_ARG);
HX_MARK_END_CLASS();
}
void DelegateLayout_obj::__Visit(HX_VISIT_PARAMS)
{
HX_VISIT_MEMBER_NAME(_size,"_size");
::haxe::ui::layouts::Layout_obj::__Visit(HX_VISIT_ARG);
}
::hx::Val DelegateLayout_obj::__Field(const ::String &inName,::hx::PropertyAccess inCallProp)
{
switch(inName.length) {
case 5:
if (HX_FIELD_EQ(inName,"_size") ) { return ::hx::Val( _size ); }
break;
case 12:
if (HX_FIELD_EQ(inName,"calcAutoSize") ) { return ::hx::Val( calcAutoSize_dyn() ); }
break;
case 14:
if (HX_FIELD_EQ(inName,"get_usableSize") ) { return ::hx::Val( get_usableSize_dyn() ); }
}
return super::__Field(inName,inCallProp);
}
::hx::Val DelegateLayout_obj::__SetField(const ::String &inName,const ::hx::Val &inValue,::hx::PropertyAccess inCallProp)
{
switch(inName.length) {
case 5:
if (HX_FIELD_EQ(inName,"_size") ) { _size=inValue.Cast< ::haxe::ui::layouts::DelegateLayoutSize >(); return inValue; }
}
return super::__SetField(inName,inValue,inCallProp);
}
void DelegateLayout_obj::__GetFields(Array< ::String> &outFields)
{
outFields->push(HX_("_size",a0,bc,64,ff));
super::__GetFields(outFields);
};
#ifdef HXCPP_SCRIPTABLE
static ::hx::StorageInfo DelegateLayout_obj_sMemberStorageInfo[] = {
{::hx::fsObject /* ::haxe::ui::layouts::DelegateLayoutSize */ ,(int)offsetof(DelegateLayout_obj,_size),HX_("_size",a0,bc,64,ff)},
{ ::hx::fsUnknown, 0, null()}
};
static ::hx::StaticInfo *DelegateLayout_obj_sStaticStorageInfo = 0;
#endif
static ::String DelegateLayout_obj_sMemberFields[] = {
HX_("_size",a0,bc,64,ff),
HX_("calcAutoSize",85,81,3f,fd),
HX_("get_usableSize",22,8c,f5,3e),
::String(null()) };
::hx::Class DelegateLayout_obj::__mClass;
void DelegateLayout_obj::__register()
{
DelegateLayout_obj _hx_dummy;
DelegateLayout_obj::_hx_vtable = *(void **)&_hx_dummy;
::hx::Static(__mClass) = new ::hx::Class_obj();
__mClass->mName = HX_("haxe.ui.layouts.DelegateLayout",c6,d0,c2,1c);
__mClass->mSuper = &super::__SGetClass();
__mClass->mConstructEmpty = &__CreateEmpty;
__mClass->mConstructArgs = &__Create;
__mClass->mGetStaticField = &::hx::Class_obj::GetNoStaticField;
__mClass->mSetStaticField = &::hx::Class_obj::SetNoStaticField;
__mClass->mStatics = ::hx::Class_obj::dupFunctions(0 /* sStaticFields */);
__mClass->mMembers = ::hx::Class_obj::dupFunctions(DelegateLayout_obj_sMemberFields);
__mClass->mCanCast = ::hx::TCanCast< DelegateLayout_obj >;
#ifdef HXCPP_SCRIPTABLE
__mClass->mMemberStorageInfo = DelegateLayout_obj_sMemberStorageInfo;
#endif
#ifdef HXCPP_SCRIPTABLE
__mClass->mStaticStorageInfo = DelegateLayout_obj_sStaticStorageInfo;
#endif
::hx::_hx_RegisterClass(__mClass->mName, __mClass);
}
} // end namespace haxe
} // end namespace ui
} // end namespace layouts
| [
"vhlk@cin.ufpe.br"
] | vhlk@cin.ufpe.br |
311536dafde16e696228f426e5077544f0d5080d | cdfe332ed1e98a74be82f7ab674c2b5bcb18e1f9 | /src/testApp.cpp | 64937aab6964db3e11cd2201107c44444a4f7548 | [] | no_license | joselynNeon/oF_Sketch_Attractor_with_Flower | 3f92f62f8b035b7735af90c1886f8a744a131eef | a10a68dc589d46e79e59a21034521fc346a94a1f | refs/heads/master | 2020-05-17T23:29:37.491276 | 2014-07-08T19:59:10 | 2014-07-08T19:59:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,755 | cpp | #include "testApp.h"
//--------------------------------------------------------------
void testApp::setup(){
flower.loadMovie("flower.mov");
flower.play();
space.loadImage("space.jpg");
ofBackground(0,0,0);
//-----------make pdf-------
to_pdf = false;
//-----------------sound-----------------------
soundStream.listDevices();
int bufferSize = 256;
left.assign(bufferSize, 0.0);
right.assign(bufferSize, 0.0);
volHistory.assign(400, 0.0);
bufferCounter= 0;
drawCounter= 0;
smoothedVol = 0.0;
scaledVol= 0.0;
soundStream.setup(this, 0, 2, 44100, bufferSize, 4);
//-----------------sound-----------------------
}
//--------------------------------------------------------------
void testApp::update(){
flower.update();
//-----------------sound-----------------------
//lets scale the vol up to a 0-1 range
scaledVol = ofMap(smoothedVol, 0.0, 0.17, 0.0, 0.5, true);
//lets record the volume into an array
volHistory.push_back( scaledVol );
//if we are bigger the the size we want to record - lets drop the oldest value
if( volHistory.size() >= 400 ){
volHistory.erase(volHistory.begin(), volHistory.begin()+1);
}
//-----------------sound-----------------------
}
//--------------------------------------------------------------
void testApp::draw(){
flower.draw(0+30, 0, ofGetWidth(), ofGetHeight());
//ofColor centerColor = ofColor(0, 0, 0);
//ofColor edgeColor(255, 255, 255);
//ofBackgroundGradient(centerColor, edgeColor, OF_GRADIENT_CIRCULAR);
//---------attractor stuff__________________
int n = 100000;
//a = 1.40, b = 1.56, c = 1.40, d = -6.56
float a = 1.4;
//sin(ofGetElapsedTimef()*scaledVol);
float b = 1.56;
float c = 1.40 + +sin(ofGetElapsedTimef()*scaledVol);
float d = -6.56;
float x0, y0, x1, y1 = 0;
x0 = y0 = x1 = y1 = 0;
ofTranslate(ofGetWidth()/2, ofGetHeight()/2);
ofScale(300, 200, 200);
for (int i=0; i<n; i++) {
x1 = sin(a * y0) - cos(b * x0);
y1 = sin(c * x0) - cos(d * y0);
//ofSetColor(170, 0, 0);
//ofFill();
ofLine(x1, y1, x1+0.01, y1);
x0 = x1;
y0 = y1;
}
if (scaledVol>=0.40){
//change = true;
for (int i = 0; i<255; i++){
for (int j = 0; j<255; j++){
ofSetColor(0, j, 0, 100);
//ofFill();
ofLine(x1, y1, x1+0.01, y1);
}
}
} else {
ofSetColor(255);
}
cout << scaledVol<< endl;
if(to_pdf){
ofEndSaveScreenAsPDF();
to_pdf = !to_pdf;
}
}
//--------------------------------------------------------------
void testApp::audioIn(float * input, int bufferSize, int nChannels){
float curVol = 0.0;
// samples are "interleaved"
int numCounted = 0;
//lets go through each sample and calculate the root mean square which is a rough way to calculate volume
for (int i = 0; i < bufferSize; i++){
left[i]= input[i*2]*0.5;
right[i]= input[i*2+1]*0.5;
curVol += left[i] * left[i];
curVol += right[i] * right[i];
numCounted+=2;
}
//this is how we get the mean of rms :)
curVol /= (float)numCounted;
// this is how we get the root of rms :)
curVol = sqrt( curVol );
smoothedVol *= 0.93;
smoothedVol += 0.07 * curVol;
bufferCounter++;
}
//--------------------------------------------------------------
void testApp::keyPressed(int key){
if(key=='p'){
to_pdf = !to_pdf;
}
}
//--------------------------------------------------------------
void testApp::keyReleased(int key){
}
//--------------------------------------------------------------
void testApp::mouseMoved(int x, int y ){
}
//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button){
}
//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){
}
//--------------------------------------------------------------
void testApp::mouseReleased(int x, int y, int button){
}
//--------------------------------------------------------------
void testApp::windowResized(int w, int h){
}
//--------------------------------------------------------------
void testApp::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void testApp::dragEvent(ofDragInfo dragInfo){
}
| [
"mcdoj494@newschool.edu"
] | mcdoj494@newschool.edu |
e13e814bc1043862a3d5f24568c07d2ff96dc99f | b8dc2a82c66afdff9ac7e3d10889f4371df6a2d7 | /aten/src/ATen/templates/StorageDerived.cpp | a92c4375af1484168d146497beb26d9b300f843d | [
"BSD-2-Clause"
] | permissive | onlytailei/pytorch | 44d2d4fc605f48e83c559c2bc132b07e37e1355f | a10d9351aa860169e5e164fd2137cc80ea90fdf3 | refs/heads/master | 2021-08-16T21:13:19.090131 | 2017-11-18T17:05:34 | 2017-11-18T17:05:34 | 110,982,432 | 8 | 0 | null | 2017-11-16T14:38:03 | 2017-11-16T14:38:03 | null | UTF-8 | C++ | false | false | 3,217 | cpp | #include "ATen/${Storage}.h"
#include "ATen/Half.h"
namespace at {
${Storage}::${Storage}(Context* context):
storage(${THStorage}_new(${state})), context(context) {}
${Storage}::${Storage}(Context* context, ${THStorage}* storage):
storage(storage), context(context) {}
${Storage}::${Storage}(Context* context, std::size_t storage_size)
: storage(${THStorage}_newWithSize(${state,} storage_size)), context(context) {}
#if ${isCUDA}
static cudaError_t call_deleter(void * ctx, void * data) {
auto fnptr = (std::function<void(void*)>*) ctx;
(*fnptr)(data);
delete fnptr;
return cudaSuccess;
}
static THCDeviceAllocator storage_deleter = {
nullptr,
nullptr,
call_deleter,
nullptr,
nullptr,
};
#else
static void call_deleter(void * ctx, void * data) {
auto fnptr = (std::function<void(void*)>*) ctx;
(*fnptr)(data);
delete fnptr;
}
static THAllocator storage_deleter = {
nullptr,
nullptr,
call_deleter,
};
#endif
${Storage}::${Storage}(Context* context,
void * data, std::size_t size, const std::function<void(void*)> & deleter)
: storage(${THStorage}_newWithDataAndAllocator(${state,}
static_cast<${THScalarType}*>(data), size,
&storage_deleter,
new std::function<void(void*)>(deleter)
)),
context(context) {
${THStorage}_clearFlag(${state,} storage, TH_STORAGE_RESIZABLE);
}
${Storage}::~${Storage}() {
${THStorage}_free(${state,} storage);
}
std::size_t ${Storage}::elementSize() const {
return sizeof(${ScalarType});
}
std::size_t ${Storage}::size() const {
return storage->size;
}
void* ${Storage}::data() {
return storage->data;
}
const void* ${Storage}::data() const {
return storage->data;
}
auto ${Storage}::retain() -> ${Storage}& {
${THStorage}_retain(${state,} storage);
return *this;
}
auto ${Storage}::free() -> ${Storage}& {
${THStorage}_free(${state,} storage);
return *this;
}
auto ${Storage}::resize(int64_t new_size) -> ${Storage}& {
${THStorage}_resize(${state,} storage, new_size);
return *this;
}
auto ${Storage}::fill(Scalar value) -> ${Storage}& {
${THStorage}_fill(${state,} storage, ${to_th_type}(value.to${ScalarName}()));
return *this;
}
auto ${Storage}::set(std::size_t ind, Scalar value) -> ${Storage}& {
${THStorage}_set(${state,} storage, ind, ${to_th_type}(value.to${ScalarName}()));
return *this;
}
auto ${Storage}::fast_set(std::size_t ind, Scalar value) -> ${Storage}& {
throw std::runtime_error("unsupported operation 'fast_set'");
}
auto ${Storage}::get(std::size_t ind) -> Scalar {
// static cast to fix long -> int64_t issues
return static_cast<${ScalarType}>(${to_at_type}(${THStorage}_get(${state,} storage, ind)));
}
auto ${Storage}::fast_get(std::size_t ind) -> Scalar {
if(${isCUDA})
throw std::runtime_error("unsupported operation 'fast_get'");
return static_cast<${ScalarType}>(${to_at_type}(storage->data[ind]));
}
int ${Storage}::getDevice() const {
${storage_device} //storage->device;
}
Type& ${Storage}::type() const {
return context->getType(Backend::${Backend},ScalarType::${ScalarName});
}
const char * ${Storage}::toString() const {
return "${Storage}";
}
const char * ${Storage}::typeString() {
return "${Type}";
}
}
| [
"ezyang@mit.edu"
] | ezyang@mit.edu |
56b50e032bd95c1ef0f133d8d83cd94da8d4cd7c | 0f2c3a74d84db49509872bc51b0075a7565a377e | /examples/example1/main.cpp | 8775621b60bc0b95d2e9efd358eb29c25b177117 | [
"MIT"
] | permissive | shanesatterfield/Antic_Engine | 6f408490053974e5ea43788785e6c9c45fc4c0fc | 224582a629a009f6ef80b04f549a7adddc691a1f | refs/heads/master | 2016-09-05T09:51:44.380913 | 2014-11-30T07:03:02 | 2014-11-30T07:03:02 | 16,337,994 | 0 | 0 | null | 2014-10-27T01:56:47 | 2014-01-29T07:17:26 | C++ | UTF-8 | C++ | false | false | 322 | cpp | #include <Antic/Antic.h>
#include <Antic/Texture.h>
int main( int argc, char* argv[] )
{
antic::Engine engine;
if( engine.init("Example 1", 1024, 768, 60) == false )
exit( EXIT_FAILURE );
while( glfwWindowShouldClose( agraph::window ) == false )
{
glfwPollEvents();
agraph::renderDone();
}
engine.close();
} | [
"dustyplant@gmail.com"
] | dustyplant@gmail.com |
d7aeb70bc50ef837155417df53e8ecbefd63d985 | 47de1c3720ee7df453ce7904e1767798bbc5f1c7 | /src/mavencore/maven/Integer.h | 77b17fdc43c19b16e1fb4bdf3938970dd81a1911 | [] | no_license | elliotchance/maven | 28a20058d8b83c0b364680f573b329941ad0573a | ea189bf5cea7cacf15ecfe071762d5560323d0ab | refs/heads/master | 2021-01-10T21:01:14.871430 | 2010-05-04T08:20:32 | 2010-05-04T08:20:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 698 | h | #ifndef MAVENCORE_MAVEN_INTEGER
#define MAVENCORE_MAVEN_INTEGER 1
#include "../mavencore.h"
#include "../maven/Data.h"
namespace maven {
class Integer extends maven::Object {
public_variable mint value;
public_constructor Integer();
public_constructor Integer(mint newValue);
public_method mboolean toBoolean();
public_method mbyte toByte();
public_method mchar toCharacter();
public_method maven::Data* toData();
public_method mdouble toDouble();
public_method mfloat toFloat();
public_method mint toInteger();
public_method mlong toLong();
public_method mquad toQuad();
public_method mshort toShort();
public_method maven::String* toString();
};
}
#endif
| [
"elliot@chancemedia.com"
] | elliot@chancemedia.com |
757aaa9fd117e238a1ea6160dad86d6b3d4921ae | b3f2be049bbceb9f3e77634112302ca48408a6d9 | /DP/C++/11727.cpp | a85d1e9ef59873dc23ba5e4f276d8222725d3542 | [] | no_license | devilzCough/Algorithm | 55455b7e5f1d824f5f2edbb55d4f2e523eee4beb | f5e64d583533ad0cb2bca5eed1caca2c3be4e9f4 | refs/heads/master | 2022-02-07T03:10:41.256408 | 2022-01-25T14:13:22 | 2022-01-25T14:13:22 | 247,606,195 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 241 | cpp | #include <stdio.h>
int n;
int tile[1001];
int main()
{
scanf("%d", &n);
tile[1] = 1;
tile[2] = 3;
for (int i = 3; i <= n; i++)
tile[i] = (tile[i-1] + tile[i-2]*2)%10007;
printf("%d\n", tile[n]);
return 0;
}
| [
"devilzcough@gmail.com"
] | devilzcough@gmail.com |
c650aff3f6d0dda85e9ea353959b56a5439aa3ca | 70e87b029bd2e95fd871e5f3f3d6cfc62856ae41 | /Arithmetic_Generator/Arithmetic_Generator.cpp | bae30ec3d28a1f27c65330107f6adcedc996b3c8 | [] | no_license | JoboboHu/Arithmetic_Generator | 6703c77a97e9461eeea90359e2e68b16f92a1f46 | c572798b0f68b808259c86f85dc60740d163c854 | refs/heads/master | 2020-07-20T17:56:30.220799 | 2019-09-07T11:29:34 | 2019-09-07T11:29:34 | 206,688,042 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 3,458 | cpp | // Arithmetic_Generator.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "../include/gflags/gflags.h"
#include <iostream>
#include <time.h>
#include "expression_factory.h"
#include <fstream>
DEFINE_int32(n, 100, "expression count");
DEFINE_string(t, "txt", "output file type: \"txt\" or \"csv\"");
using namespace std;
void output_txt(const vector<def_expression_ptr>& vec_expressions)
{
char path_buffer_answer[_MAX_PATH];
char path_buffer_expression[_MAX_PATH];
char drive[_MAX_DRIVE];
char dir[_MAX_DIR];
char fname[_MAX_FNAME];
char ext[_MAX_EXT];
char* path = nullptr;
_get_pgmptr(&path);
_splitpath_s(path, drive, _MAX_DRIVE, dir, _MAX_DIR, fname, _MAX_FNAME, ext, _MAX_EXT);
_makepath_s(path_buffer_answer, _MAX_PATH, drive, dir, "answer", "txt");
_makepath_s(path_buffer_expression, _MAX_PATH, drive, dir, "expression", "txt");
ofstream ofs_answer(path_buffer_answer);
ofstream ofs_expression(path_buffer_expression);
for (auto item : vec_expressions)
{
auto num = item->get_num();
auto opr = item->get_opr();
ofs_answer << num[0] << opr[0] << num[1] << opr[1] << num[2] << "=" << item->get_result() << endl;
ofs_expression << num[0] << opr[0] << num[1] << opr[1] << num[2] << "=" << endl;
}
ofs_answer.close();
ofs_expression.close();
}
void output_csv(const vector<def_expression_ptr>& vec_expressions)
{
char path_buffer_answer[_MAX_PATH];
char path_buffer_expression[_MAX_PATH];
char drive[_MAX_DRIVE];
char dir[_MAX_DIR];
char fname[_MAX_FNAME];
char ext[_MAX_EXT];
char* path = nullptr;
_get_pgmptr(&path);
_splitpath_s(path, drive, _MAX_DRIVE, dir, _MAX_DIR, fname, _MAX_FNAME, ext, _MAX_EXT);
_makepath_s(path_buffer_answer, _MAX_PATH, drive, dir, "answer", "csv");
_makepath_s(path_buffer_expression, _MAX_PATH, drive, dir, "expression", "csv");
ofstream ofs_answer(path_buffer_answer);
ofstream ofs_expression(path_buffer_expression);
for (auto item : vec_expressions)
{
auto num = item->get_num();
auto opr = item->get_opr();
ofs_answer << num[0] << "," << opr[0] << "," << num[1] << "," << opr[1] << "," << num[2] << "," << "=,"
<< item->get_result() << endl;
ofs_expression << num[0] << "," << opr[0] << "," << num[1] << "," << opr[1] << "," << num[2] << "," << "=" << endl;
}
ofs_answer.close();
ofs_expression.close();
}
void create_math_question(const int expression_count, const string& output_type)
{
srand((int)time(0));
vector<def_expression_ptr> vec_expressions;
for (int i = 0; i < expression_count; ++i)
{
while (true)
{
bool flag = true;
auto expression = expression_factory::create_expression(addition_subtraction);
expression->create_expression();
for (auto item : vec_expressions)
{
if (item == expression)
{
flag = false;
break;
}
}
if (!flag)
continue;
vec_expressions.push_back(expression);
break;
}
}
if (output_type.compare("txt") == 0)
output_txt(vec_expressions);
else if (output_type.compare("csv") == 0)
output_csv(vec_expressions);
}
int main(int argc, char* argv[])
{
google::ParseCommandLineFlags(&argc, &argv, true);
int expression_count = FLAGS_n;
std::string output_type = FLAGS_t;
if (output_type.compare("txt") != 0 && output_type.compare("csv") != 0)
{
cout << "output file type error!" << endl;
return 1;
}
create_math_question(expression_count, output_type);
cout << "finish" << endl;
getchar();
return 0;
}
| [
"jobobo@outlook.com"
] | jobobo@outlook.com |
a1a95d6fc41db0314da702958c9d4fefd2f184ac | eb120dfc702e5a6944448575962115bb0df60477 | /4AJ.2.2/mydroid/frameworks/native/libs/gui/SurfaceTextureClient.cpp | 3f212d64c269fb5c9938c848f1bffc515efa9497 | [
"LicenseRef-scancode-unicode",
"Apache-2.0"
] | permissive | faridazhar/panda-a4 | 5dd215387c71a42e1d3f1517ca1f0c642f269050 | ff88df36a11e3af5c85d565351ad72ce62406e5e | refs/heads/master | 2020-04-06T05:21:41.192262 | 2015-05-20T22:11:06 | 2015-05-20T22:11:06 | 34,291,586 | 1 | 5 | null | 2020-03-08T23:51:30 | 2015-04-20T23:11:26 | C | UTF-8 | C++ | false | false | 27,383 | cpp | /*
* Copyright (C) 2010 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 LOG_TAG "SurfaceTextureClient"
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
//#define LOG_NDEBUG 0
#include <android/native_window.h>
#include <utils/Log.h>
#include <utils/Trace.h>
#include <gui/ISurfaceComposer.h>
#include <gui/SurfaceComposerClient.h>
#include <gui/SurfaceTexture.h>
#include <gui/SurfaceTextureClient.h>
#include <private/gui/ComposerService.h>
namespace android {
SurfaceTextureClient::SurfaceTextureClient(
const sp<ISurfaceTexture>& surfaceTexture)
{
SurfaceTextureClient::init();
SurfaceTextureClient::setISurfaceTexture(surfaceTexture);
}
// see SurfaceTextureClient.h
SurfaceTextureClient::SurfaceTextureClient(const
sp<SurfaceTexture>& surfaceTexture)
{
SurfaceTextureClient::init();
SurfaceTextureClient::setISurfaceTexture(surfaceTexture->getBufferQueue());
}
SurfaceTextureClient::SurfaceTextureClient() {
SurfaceTextureClient::init();
}
SurfaceTextureClient::~SurfaceTextureClient() {
if (mConnectedToCpu) {
SurfaceTextureClient::disconnect(NATIVE_WINDOW_API_CPU);
}
}
void SurfaceTextureClient::init() {
// Initialize the ANativeWindow function pointers.
ANativeWindow::setSwapInterval = hook_setSwapInterval;
ANativeWindow::dequeueBuffer = hook_dequeueBuffer;
ANativeWindow::cancelBuffer = hook_cancelBuffer;
ANativeWindow::lockBuffer = hook_lockBuffer;
ANativeWindow::queueBuffer = hook_queueBuffer;
ANativeWindow::query = hook_query;
ANativeWindow::perform = hook_perform;
const_cast<int&>(ANativeWindow::minSwapInterval) = 0;
const_cast<int&>(ANativeWindow::maxSwapInterval) = 1;
mReqWidth = 0;
mReqHeight = 0;
mReqFormat = 0;
mReqUsage = 0;
mTimestamp = NATIVE_WINDOW_TIMESTAMP_AUTO;
mCrop.clear();
mScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE;
mTransform = 0;
mDefaultWidth = 0;
mDefaultHeight = 0;
mUserWidth = 0;
mUserHeight = 0;
mTransformHint = 0;
mConsumerRunningBehind = false;
mConnectedToCpu = false;
}
void SurfaceTextureClient::setISurfaceTexture(
const sp<ISurfaceTexture>& surfaceTexture)
{
mSurfaceTexture = surfaceTexture;
}
sp<ISurfaceTexture> SurfaceTextureClient::getISurfaceTexture() const {
return mSurfaceTexture;
}
int SurfaceTextureClient::hook_setSwapInterval(ANativeWindow* window, int interval) {
SurfaceTextureClient* c = getSelf(window);
return c->setSwapInterval(interval);
}
int SurfaceTextureClient::hook_dequeueBuffer(ANativeWindow* window,
ANativeWindowBuffer** buffer) {
SurfaceTextureClient* c = getSelf(window);
return c->dequeueBuffer(buffer);
}
int SurfaceTextureClient::hook_cancelBuffer(ANativeWindow* window,
ANativeWindowBuffer* buffer) {
SurfaceTextureClient* c = getSelf(window);
return c->cancelBuffer(buffer);
}
int SurfaceTextureClient::hook_lockBuffer(ANativeWindow* window,
ANativeWindowBuffer* buffer) {
SurfaceTextureClient* c = getSelf(window);
return c->lockBuffer(buffer);
}
int SurfaceTextureClient::hook_queueBuffer(ANativeWindow* window,
ANativeWindowBuffer* buffer) {
SurfaceTextureClient* c = getSelf(window);
return c->queueBuffer(buffer);
}
int SurfaceTextureClient::hook_query(const ANativeWindow* window,
int what, int* value) {
const SurfaceTextureClient* c = getSelf(window);
return c->query(what, value);
}
int SurfaceTextureClient::hook_perform(ANativeWindow* window, int operation, ...) {
va_list args;
va_start(args, operation);
SurfaceTextureClient* c = getSelf(window);
return c->perform(operation, args);
}
int SurfaceTextureClient::setSwapInterval(int interval) {
ATRACE_CALL();
// EGL specification states:
// interval is silently clamped to minimum and maximum implementation
// dependent values before being stored.
// Although we don't have to, we apply the same logic here.
if (interval < minSwapInterval)
interval = minSwapInterval;
if (interval > maxSwapInterval)
interval = maxSwapInterval;
status_t res = mSurfaceTexture->setSynchronousMode(interval ? true : false);
return res;
}
int SurfaceTextureClient::dequeueBuffer(android_native_buffer_t** buffer) {
ATRACE_CALL();
ALOGV("SurfaceTextureClient::dequeueBuffer");
Mutex::Autolock lock(mMutex);
int buf = -1;
int reqW = mReqWidth ? mReqWidth : mUserWidth;
int reqH = mReqHeight ? mReqHeight : mUserHeight;
status_t result = mSurfaceTexture->dequeueBuffer(&buf, reqW, reqH,
mReqFormat, mReqUsage);
if (result < 0) {
ALOGV("dequeueBuffer: ISurfaceTexture::dequeueBuffer(%d, %d, %d, %d)"
"failed: %d", mReqWidth, mReqHeight, mReqFormat, mReqUsage,
result);
return result;
}
sp<GraphicBuffer>& gbuf(mSlots[buf].buffer);
if (result & ISurfaceTexture::RELEASE_ALL_BUFFERS) {
freeAllBuffers();
}
if ((result & ISurfaceTexture::BUFFER_NEEDS_REALLOCATION) || gbuf == 0) {
result = mSurfaceTexture->requestBuffer(buf, &gbuf);
if (result != NO_ERROR) {
ALOGE("dequeueBuffer: ISurfaceTexture::requestBuffer failed: %d",
result);
return result;
}
}
*buffer = gbuf.get();
return OK;
}
int SurfaceTextureClient::cancelBuffer(android_native_buffer_t* buffer) {
ATRACE_CALL();
ALOGV("SurfaceTextureClient::cancelBuffer");
Mutex::Autolock lock(mMutex);
int i = getSlotFromBufferLocked(buffer);
if (i < 0) {
return i;
}
mSurfaceTexture->cancelBuffer(i);
return OK;
}
int SurfaceTextureClient::getSlotFromBufferLocked(
android_native_buffer_t* buffer) const {
bool dumpedState = false;
for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
if (mSlots[i].buffer != NULL &&
mSlots[i].buffer->handle == buffer->handle) {
return i;
}
}
ALOGE("getSlotFromBufferLocked: unknown buffer: %p", buffer->handle);
return BAD_VALUE;
}
int SurfaceTextureClient::lockBuffer(android_native_buffer_t* buffer) {
ALOGV("SurfaceTextureClient::lockBuffer");
Mutex::Autolock lock(mMutex);
return OK;
}
int SurfaceTextureClient::queueBuffer(android_native_buffer_t* buffer) {
ATRACE_CALL();
ALOGV("SurfaceTextureClient::queueBuffer");
Mutex::Autolock lock(mMutex);
int64_t timestamp;
if (mTimestamp == NATIVE_WINDOW_TIMESTAMP_AUTO) {
timestamp = systemTime(SYSTEM_TIME_MONOTONIC);
ALOGV("SurfaceTextureClient::queueBuffer making up timestamp: %.2f ms",
timestamp / 1000000.f);
} else {
timestamp = mTimestamp;
}
int i = getSlotFromBufferLocked(buffer);
if (i < 0) {
return i;
}
// Make sure the crop rectangle is entirely inside the buffer.
Rect crop;
mCrop.intersect(Rect(buffer->width, buffer->height), &crop);
ISurfaceTexture::QueueBufferOutput output;
ISurfaceTexture::QueueBufferInput input(timestamp, crop, mScalingMode,
mTransform);
#ifdef OMAP_ENHANCEMENT_CPCAM
status_t err = mSurfaceTexture->queueBuffer(i, input, &output, mMetadata);
#else
status_t err = mSurfaceTexture->queueBuffer(i, input, &output);
#endif
if (err != OK) {
ALOGE("queueBuffer: error queuing buffer to SurfaceTexture, %d", err);
}
uint32_t numPendingBuffers = 0;
output.deflate(&mDefaultWidth, &mDefaultHeight, &mTransformHint,
&numPendingBuffers);
mConsumerRunningBehind = (numPendingBuffers >= 2);
return err;
}
int SurfaceTextureClient::query(int what, int* value) const {
ATRACE_CALL();
ALOGV("SurfaceTextureClient::query");
{ // scope for the lock
Mutex::Autolock lock(mMutex);
switch (what) {
case NATIVE_WINDOW_FORMAT:
if (mReqFormat) {
*value = mReqFormat;
return NO_ERROR;
}
break;
case NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER: {
sp<ISurfaceComposer> composer(
ComposerService::getComposerService());
if (composer->authenticateSurfaceTexture(mSurfaceTexture)) {
*value = 1;
} else {
*value = 0;
}
return NO_ERROR;
}
case NATIVE_WINDOW_CONCRETE_TYPE:
*value = NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT;
return NO_ERROR;
case NATIVE_WINDOW_DEFAULT_WIDTH:
*value = mUserWidth ? mUserWidth : mDefaultWidth;
return NO_ERROR;
case NATIVE_WINDOW_DEFAULT_HEIGHT:
*value = mUserHeight ? mUserHeight : mDefaultHeight;
return NO_ERROR;
case NATIVE_WINDOW_TRANSFORM_HINT:
*value = mTransformHint;
return NO_ERROR;
case NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND: {
status_t err = NO_ERROR;
if (!mConsumerRunningBehind) {
*value = 0;
} else {
err = mSurfaceTexture->query(what, value);
if (err == NO_ERROR) {
mConsumerRunningBehind = *value;
}
}
return err;
}
}
}
return mSurfaceTexture->query(what, value);
}
int SurfaceTextureClient::perform(int operation, va_list args)
{
int res = NO_ERROR;
switch (operation) {
case NATIVE_WINDOW_CONNECT:
// deprecated. must return NO_ERROR.
break;
case NATIVE_WINDOW_DISCONNECT:
// deprecated. must return NO_ERROR.
break;
case NATIVE_WINDOW_SET_USAGE:
res = dispatchSetUsage(args);
break;
case NATIVE_WINDOW_SET_CROP:
res = dispatchSetCrop(args);
break;
case NATIVE_WINDOW_SET_BUFFER_COUNT:
res = dispatchSetBufferCount(args);
break;
case NATIVE_WINDOW_SET_BUFFERS_GEOMETRY:
res = dispatchSetBuffersGeometry(args);
break;
case NATIVE_WINDOW_SET_BUFFERS_TRANSFORM:
res = dispatchSetBuffersTransform(args);
break;
case NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP:
res = dispatchSetBuffersTimestamp(args);
break;
#ifdef OMAP_ENHANCEMENT_CPCAM
case NATIVE_WINDOW_SET_BUFFERS_METADATA:
res = dispatchSetBuffersMetadata(args);
break;
#endif
case NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS:
res = dispatchSetBuffersDimensions(args);
break;
case NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS:
res = dispatchSetBuffersUserDimensions(args);
break;
case NATIVE_WINDOW_SET_BUFFERS_FORMAT:
res = dispatchSetBuffersFormat(args);
break;
case NATIVE_WINDOW_LOCK:
res = dispatchLock(args);
break;
case NATIVE_WINDOW_UNLOCK_AND_POST:
res = dispatchUnlockAndPost(args);
break;
case NATIVE_WINDOW_SET_SCALING_MODE:
res = dispatchSetScalingMode(args);
break;
case NATIVE_WINDOW_API_CONNECT:
res = dispatchConnect(args);
break;
case NATIVE_WINDOW_API_DISCONNECT:
res = dispatchDisconnect(args);
break;
#ifdef OMAP_ENHANCEMENT
case NATIVE_WINDOW_SET_BUFFERS_LAYOUT:
res = dispatchSetBuffersLayout(args);
break;
#endif
#ifdef OMAP_ENHANCEMENT_CPCAM
case NATIVE_WINDOW_UPDATE_AND_GET_CURRENT:
res = dispatchUpdateAndGetCurrent(args);
break;
case NATIVE_WINDOW_ADD_BUFFER_SLOT:
res = dispatchAddBufferSlot(args);
break;
case NATIVE_WINDOW_GET_ID:
res = dispatchGetId(args);
break;
#endif
default:
res = NAME_NOT_FOUND;
break;
}
return res;
}
int SurfaceTextureClient::dispatchConnect(va_list args) {
int api = va_arg(args, int);
return connect(api);
}
int SurfaceTextureClient::dispatchDisconnect(va_list args) {
int api = va_arg(args, int);
return disconnect(api);
}
int SurfaceTextureClient::dispatchSetUsage(va_list args) {
int usage = va_arg(args, int);
return setUsage(usage);
}
int SurfaceTextureClient::dispatchSetCrop(va_list args) {
android_native_rect_t const* rect = va_arg(args, android_native_rect_t*);
return setCrop(reinterpret_cast<Rect const*>(rect));
}
int SurfaceTextureClient::dispatchSetBufferCount(va_list args) {
size_t bufferCount = va_arg(args, size_t);
return setBufferCount(bufferCount);
}
int SurfaceTextureClient::dispatchSetBuffersGeometry(va_list args) {
int w = va_arg(args, int);
int h = va_arg(args, int);
int f = va_arg(args, int);
int err = setBuffersDimensions(w, h);
if (err != 0) {
return err;
}
return setBuffersFormat(f);
}
int SurfaceTextureClient::dispatchSetBuffersDimensions(va_list args) {
int w = va_arg(args, int);
int h = va_arg(args, int);
return setBuffersDimensions(w, h);
}
int SurfaceTextureClient::dispatchSetBuffersUserDimensions(va_list args) {
int w = va_arg(args, int);
int h = va_arg(args, int);
return setBuffersUserDimensions(w, h);
}
int SurfaceTextureClient::dispatchSetBuffersFormat(va_list args) {
int f = va_arg(args, int);
return setBuffersFormat(f);
}
int SurfaceTextureClient::dispatchSetScalingMode(va_list args) {
int m = va_arg(args, int);
return setScalingMode(m);
}
int SurfaceTextureClient::dispatchSetBuffersTransform(va_list args) {
int transform = va_arg(args, int);
return setBuffersTransform(transform);
}
int SurfaceTextureClient::dispatchSetBuffersTimestamp(va_list args) {
int64_t timestamp = va_arg(args, int64_t);
return setBuffersTimestamp(timestamp);
}
#ifdef OMAP_ENHANCEMENT_CPCAM
int SurfaceTextureClient::dispatchSetBuffersMetadata(va_list args) {
MemoryBase* metadata = va_arg(args, MemoryBase*);
return setBuffersMetadata(metadata);
}
#endif
int SurfaceTextureClient::dispatchLock(va_list args) {
ANativeWindow_Buffer* outBuffer = va_arg(args, ANativeWindow_Buffer*);
ARect* inOutDirtyBounds = va_arg(args, ARect*);
return lock(outBuffer, inOutDirtyBounds);
}
int SurfaceTextureClient::dispatchUnlockAndPost(va_list args) {
return unlockAndPost();
}
#ifdef OMAP_ENHANCEMENT
int SurfaceTextureClient::dispatchSetBuffersLayout(va_list args) {
uint32_t bufLayout = va_arg(args, uint32_t);
return setBuffersLayout(bufLayout);
}
#endif
#ifdef OMAP_ENHANCEMENT_CPCAM
int SurfaceTextureClient::dispatchUpdateAndGetCurrent(va_list args) {
ANativeWindowBuffer** buffer = va_arg(args, ANativeWindowBuffer**);
return updateAndGetCurrent(buffer);
}
int SurfaceTextureClient::dispatchAddBufferSlot(va_list args) {
const sp<GraphicBuffer> *buffer = va_arg(args, sp<GraphicBuffer> *);
return addBufferSlot(*buffer);
}
int SurfaceTextureClient::dispatchGetId(va_list args) {
String8* name = va_arg(args, String8*);
*name = getId();
return NO_ERROR;
}
#endif
int SurfaceTextureClient::connect(int api) {
ATRACE_CALL();
ALOGV("SurfaceTextureClient::connect");
Mutex::Autolock lock(mMutex);
ISurfaceTexture::QueueBufferOutput output;
int err = mSurfaceTexture->connect(api, &output);
if (err == NO_ERROR) {
uint32_t numPendingBuffers = 0;
output.deflate(&mDefaultWidth, &mDefaultHeight, &mTransformHint,
&numPendingBuffers);
mConsumerRunningBehind = (numPendingBuffers >= 2);
}
if (!err && api == NATIVE_WINDOW_API_CPU) {
mConnectedToCpu = true;
}
return err;
}
int SurfaceTextureClient::disconnect(int api) {
ATRACE_CALL();
ALOGV("SurfaceTextureClient::disconnect");
Mutex::Autolock lock(mMutex);
freeAllBuffers();
int err = mSurfaceTexture->disconnect(api);
if (!err) {
mReqFormat = 0;
mReqWidth = 0;
mReqHeight = 0;
mReqUsage = 0;
mCrop.clear();
mScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE;
mTransform = 0;
if (api == NATIVE_WINDOW_API_CPU) {
mConnectedToCpu = false;
}
}
return err;
}
int SurfaceTextureClient::setUsage(uint32_t reqUsage)
{
ALOGV("SurfaceTextureClient::setUsage");
Mutex::Autolock lock(mMutex);
mReqUsage = reqUsage;
return OK;
}
int SurfaceTextureClient::setCrop(Rect const* rect)
{
ATRACE_CALL();
Rect realRect;
if (rect == NULL || rect->isEmpty()) {
realRect.clear();
} else {
realRect = *rect;
}
ALOGV("SurfaceTextureClient::setCrop rect=[%d %d %d %d]",
realRect.left, realRect.top, realRect.right, realRect.bottom);
Mutex::Autolock lock(mMutex);
mCrop = realRect;
return NO_ERROR;
}
int SurfaceTextureClient::setBufferCount(int bufferCount)
{
ATRACE_CALL();
ALOGV("SurfaceTextureClient::setBufferCount");
Mutex::Autolock lock(mMutex);
status_t err = mSurfaceTexture->setBufferCount(bufferCount);
ALOGE_IF(err, "ISurfaceTexture::setBufferCount(%d) returned %s",
bufferCount, strerror(-err));
if (err == NO_ERROR) {
freeAllBuffers();
}
return err;
}
int SurfaceTextureClient::setBuffersDimensions(int w, int h)
{
ATRACE_CALL();
ALOGV("SurfaceTextureClient::setBuffersDimensions");
if (w<0 || h<0)
return BAD_VALUE;
if ((w && !h) || (!w && h))
return BAD_VALUE;
Mutex::Autolock lock(mMutex);
mReqWidth = w;
mReqHeight = h;
return NO_ERROR;
}
int SurfaceTextureClient::setBuffersUserDimensions(int w, int h)
{
ATRACE_CALL();
ALOGV("SurfaceTextureClient::setBuffersUserDimensions");
if (w<0 || h<0)
return BAD_VALUE;
if ((w && !h) || (!w && h))
return BAD_VALUE;
Mutex::Autolock lock(mMutex);
mUserWidth = w;
mUserHeight = h;
return NO_ERROR;
}
int SurfaceTextureClient::setBuffersFormat(int format)
{
ALOGV("SurfaceTextureClient::setBuffersFormat");
if (format<0)
return BAD_VALUE;
Mutex::Autolock lock(mMutex);
mReqFormat = format;
return NO_ERROR;
}
int SurfaceTextureClient::setScalingMode(int mode)
{
ATRACE_CALL();
ALOGV("SurfaceTextureClient::setScalingMode(%d)", mode);
switch (mode) {
case NATIVE_WINDOW_SCALING_MODE_FREEZE:
case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW:
case NATIVE_WINDOW_SCALING_MODE_SCALE_CROP:
break;
default:
ALOGE("unknown scaling mode: %d", mode);
return BAD_VALUE;
}
Mutex::Autolock lock(mMutex);
mScalingMode = mode;
return NO_ERROR;
}
int SurfaceTextureClient::setBuffersTransform(int transform)
{
ATRACE_CALL();
ALOGV("SurfaceTextureClient::setBuffersTransform");
Mutex::Autolock lock(mMutex);
mTransform = transform;
return NO_ERROR;
}
int SurfaceTextureClient::setBuffersTimestamp(int64_t timestamp)
{
ALOGV("SurfaceTextureClient::setBuffersTimestamp");
Mutex::Autolock lock(mMutex);
mTimestamp = timestamp;
return NO_ERROR;
}
#ifdef OMAP_ENHANCEMENT
int SurfaceTextureClient::setBuffersLayout(uint32_t bufLayout)
{
ALOGV("SurfaceTextureClient::setBuffersLayout");
Mutex::Autolock lock(mMutex);
status_t err = mSurfaceTexture->setLayout(bufLayout);
return NO_ERROR;
}
#endif
void SurfaceTextureClient::freeAllBuffers() {
for (int i = 0; i < NUM_BUFFER_SLOTS; i++) {
mSlots[i].buffer = 0;
}
}
// ----------------------------------------------------------------------
// the lock/unlock APIs must be used from the same thread
static status_t copyBlt(
const sp<GraphicBuffer>& dst,
const sp<GraphicBuffer>& src,
const Region& reg)
{
// src and dst with, height and format must be identical. no verification
// is done here.
status_t err;
uint8_t const * src_bits = NULL;
err = src->lock(GRALLOC_USAGE_SW_READ_OFTEN, reg.bounds(), (void**)&src_bits);
ALOGE_IF(err, "error locking src buffer %s", strerror(-err));
uint8_t* dst_bits = NULL;
err = dst->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, reg.bounds(), (void**)&dst_bits);
ALOGE_IF(err, "error locking dst buffer %s", strerror(-err));
Region::const_iterator head(reg.begin());
Region::const_iterator tail(reg.end());
if (head != tail && src_bits && dst_bits) {
const size_t bpp = bytesPerPixel(src->format);
const size_t dbpr = dst->stride * bpp;
const size_t sbpr = src->stride * bpp;
while (head != tail) {
const Rect& r(*head++);
ssize_t h = r.height();
if (h <= 0) continue;
size_t size = r.width() * bpp;
uint8_t const * s = src_bits + (r.left + src->stride * r.top) * bpp;
uint8_t * d = dst_bits + (r.left + dst->stride * r.top) * bpp;
if (dbpr==sbpr && size==sbpr) {
size *= h;
h = 1;
}
do {
memcpy(d, s, size);
d += dbpr;
s += sbpr;
} while (--h > 0);
}
}
if (src_bits)
src->unlock();
if (dst_bits)
dst->unlock();
return err;
}
// ----------------------------------------------------------------------------
status_t SurfaceTextureClient::lock(
ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds)
{
if (mLockedBuffer != 0) {
ALOGE("Surface::lock failed, already locked");
return INVALID_OPERATION;
}
if (!mConnectedToCpu) {
int err = SurfaceTextureClient::connect(NATIVE_WINDOW_API_CPU);
if (err) {
return err;
}
// we're intending to do software rendering from this point
setUsage(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN);
}
ANativeWindowBuffer* out;
status_t err = dequeueBuffer(&out);
ALOGE_IF(err, "dequeueBuffer failed (%s)", strerror(-err));
if (err == NO_ERROR) {
sp<GraphicBuffer> backBuffer(GraphicBuffer::getSelf(out));
err = lockBuffer(backBuffer.get());
ALOGE_IF(err, "lockBuffer (handle=%p) failed (%s)",
backBuffer->handle, strerror(-err));
if (err == NO_ERROR) {
const Rect bounds(backBuffer->width, backBuffer->height);
Region newDirtyRegion;
if (inOutDirtyBounds) {
newDirtyRegion.set(static_cast<Rect const&>(*inOutDirtyBounds));
newDirtyRegion.andSelf(bounds);
} else {
newDirtyRegion.set(bounds);
}
// figure out if we can copy the frontbuffer back
const sp<GraphicBuffer>& frontBuffer(mPostedBuffer);
const bool canCopyBack = (frontBuffer != 0 &&
backBuffer->width == frontBuffer->width &&
backBuffer->height == frontBuffer->height &&
backBuffer->format == frontBuffer->format);
if (canCopyBack) {
// copy the area that is invalid and not repainted this round
const Region copyback(mDirtyRegion.subtract(newDirtyRegion));
if (!copyback.isEmpty())
copyBlt(backBuffer, frontBuffer, copyback);
} else {
// if we can't copy-back anything, modify the user's dirty
// region to make sure they redraw the whole buffer
newDirtyRegion.set(bounds);
mDirtyRegion.clear();
Mutex::Autolock lock(mMutex);
for (size_t i=0 ; i<NUM_BUFFER_SLOTS ; i++) {
mSlots[i].dirtyRegion.clear();
}
}
{ // scope for the lock
Mutex::Autolock lock(mMutex);
int backBufferSlot(getSlotFromBufferLocked(backBuffer.get()));
if (backBufferSlot >= 0) {
Region& dirtyRegion(mSlots[backBufferSlot].dirtyRegion);
mDirtyRegion.subtract(dirtyRegion);
dirtyRegion = newDirtyRegion;
}
}
mDirtyRegion.orSelf(newDirtyRegion);
if (inOutDirtyBounds) {
*inOutDirtyBounds = newDirtyRegion.getBounds();
}
void* vaddr;
status_t res = backBuffer->lock(
GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN,
newDirtyRegion.bounds(), &vaddr);
ALOGW_IF(res, "failed locking buffer (handle = %p)",
backBuffer->handle);
mLockedBuffer = backBuffer;
outBuffer->width = backBuffer->width;
outBuffer->height = backBuffer->height;
outBuffer->stride = backBuffer->stride;
outBuffer->format = backBuffer->format;
outBuffer->bits = vaddr;
}
}
return err;
}
status_t SurfaceTextureClient::unlockAndPost()
{
if (mLockedBuffer == 0) {
ALOGE("Surface::unlockAndPost failed, no locked buffer");
return INVALID_OPERATION;
}
status_t err = mLockedBuffer->unlock();
ALOGE_IF(err, "failed unlocking buffer (%p)", mLockedBuffer->handle);
err = queueBuffer(mLockedBuffer.get());
ALOGE_IF(err, "queueBuffer (handle=%p) failed (%s)",
mLockedBuffer->handle, strerror(-err));
mPostedBuffer = mLockedBuffer;
mLockedBuffer = 0;
return err;
}
#ifdef OMAP_ENHANCEMENT_CPCAM
int SurfaceTextureClient::updateAndGetCurrent(android_native_buffer_t** buffer)
{
ALOGV("SurfaceTextureClient::updateAndGetCurrent");
status_t err = NO_ERROR;
Mutex::Autolock lock(mMutex);
err = mSurfaceTexture->updateAndGetCurrent(&mCurrentBuffer);
*buffer = mCurrentBuffer.get();
return err;
}
int SurfaceTextureClient::setBuffersMetadata(const sp<MemoryBase>& metadata)
{
ALOGV("SurfaceTextureClient::setBuffersMetadata");
Mutex::Autolock lock(mMutex);
mMetadata = metadata;
return NO_ERROR;
}
int SurfaceTextureClient::addBufferSlot(const sp<GraphicBuffer>& buffer)
{
ALOGV("SurfaceTextureClient::addBufferSlot");
int slot = -1;
Mutex::Autolock lock(mMutex);
slot = mSurfaceTexture->addBufferSlot(buffer);
if (0 > slot) {
return NO_MEMORY;
}
if (NUM_BUFFER_SLOTS <= slot) {
return BAD_INDEX;
}
mSlots[slot].buffer = buffer;
mSlots[slot].dirtyRegion.clear();
return NO_ERROR;
}
String8 SurfaceTextureClient::getId() const
{
ALOGV("SurfaceTextureClient::getId");
Mutex::Autolock lock(mMutex);
return mSurfaceTexture->getId();
}
#endif
}; // namespace android
| [
"fazrnet@gmail.com"
] | fazrnet@gmail.com |
637df46d8aca45297e8e3775533dce7ee6b1d537 | 77c0b69b3da92c46278da9cab9979b1f8efe01c3 | /mpllibs/metamonad/v1/fwd/make_monadic_c.hpp | e52eef9886ca3a094fc7a2908352b2cbd976853d | [
"BSL-1.0"
] | permissive | sabel83/mpllibs | 6e670ab0c23422c4ab80ccbe1ba0c2531619fbf5 | 8e245aedcf658fe77bb29537aeba1d4e1a619a19 | refs/heads/master | 2021-01-21T12:31:50.702386 | 2016-05-13T19:45:07 | 2016-05-13T19:45:07 | 691,824 | 82 | 7 | null | 2014-05-04T08:29:15 | 2010-05-28T21:13:03 | C++ | UTF-8 | C++ | false | false | 491 | hpp | #ifndef MPLLIBS_METAMONAD_V1_FWD_MAKE_MONADIC_C_HPP
#define MPLLIBS_METAMONAD_V1_FWD_MAKE_MONADIC_C_HPP
// Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
namespace mpllibs
{
namespace metamonad
{
namespace v1
{
template <class MonadTag, class Expr>
struct make_monadic_c;
}
}
}
#endif
| [
"abelsoft@freemail.hu"
] | abelsoft@freemail.hu |
0185e221afbeadf2f4c7595c9ba31cc613854a42 | 3baffc040c8c8b330fb355a76a02d9629caf875f | /libs/core_math/Lerp.inl | e4511d1b70af3f515d4b1731f444a649b55e87be | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | max-delta/retrofit-public | 76ded1e506ed37796d40cc5ddbf0b71db7a0fb46 | e294fc356ad3fbee28d3637c2a524d051d57bd0f | refs/heads/master | 2023-09-03T11:53:23.988590 | 2023-09-02T01:49:59 | 2023-09-02T01:49:59 | 203,477,950 | 3 | 0 | NOASSERTION | 2019-08-21T06:39:47 | 2019-08-21T00:55:32 | C++ | UTF-8 | C++ | false | false | 1,990 | inl | #pragma once
#include "Lerp.h"
#include "rftl/type_traits"
namespace RF::math {
///////////////////////////////////////////////////////////////////////////////
template<typename TYPE, typename SCALAR>
constexpr TYPE Lerp( TYPE const& vt0, TYPE const& vt1, SCALAR const& t )
{
return vt0 + t * ( vt1 - vt0 );
}
template<typename TYPE>
constexpr TYPE Lerp( TYPE const& vt0, TYPE const& vt1, float const& t )
{
return static_cast<TYPE>( ( 1.f - t ) * static_cast<float>( vt0 ) ) + static_cast<TYPE>( t * static_cast<float>( vt1 ) );
}
template<typename TYPE>
constexpr TYPE Lerp( TYPE const& vt0, TYPE const& vt1, double const& t )
{
return static_cast<TYPE>( ( 1.0 - t ) * static_cast<double>( vt0 ) ) + static_cast<TYPE>( t * static_cast<double>( vt1 ) );
}
template<typename TYPE>
constexpr TYPE Lerp( TYPE const& vt0, TYPE const& vt1, long double const& t )
{
return static_cast<TYPE>( ( 1.0l - t ) * vt0 ) + static_cast<TYPE>( t * vt1 );
}
template<typename RESULT, typename TYPE>
constexpr RESULT Unlerp( TYPE const& vt0, TYPE const& vt1, TYPE const& v )
{
// NOTE: Difference type may not be the same as operand type
// EXAMPLE: chrono::time_point vs chrono::duration
using DiffT = decltype( vt1 - vt0 );
DiffT const zero = vt0 - vt0;
DiffT const range = vt1 - vt0;
DiffT const offset = v - vt0;
bool const valid = range > zero;
// NOTE: Convert to result first, under the assumption that the common
// cases would result in a lossy integer division if it wasn't converted
return valid ? static_cast<RESULT>( offset ) / static_cast<RESULT>( range ) : RESULT{};
}
template<typename OUTTYPE, typename INTYPE, typename RATIOTYPE>
constexpr OUTTYPE Rescale( OUTTYPE const& outMin, OUTTYPE const& outMax, INTYPE const& inMin, INTYPE const& inMax, INTYPE const& inVal )
{
RATIOTYPE const t = Unlerp<RATIOTYPE>( inMin, inMax, inVal );
return Lerp( outMin, outMax, t );
}
///////////////////////////////////////////////////////////////////////////////
}
| [
"54338561+max-delta@users.noreply.github.com"
] | 54338561+max-delta@users.noreply.github.com |
318a5971431f9767fe1233e7a30e84ffdf4bba12 | ab2c6c1488074011d42a144e5c68fa8c6ad43bcf | /spoj/PP0506A.cc | f55fbf12d4b158cb57b001ff9ddbcc224dac6f21 | [] | no_license | mtszkw/contests | 491883aa9f596e6dbd213049baee3a5c58d4a492 | 5b66d26be114fe12e5c1bc102ae4c3bafbc764e9 | refs/heads/master | 2021-07-09T07:55:05.221632 | 2017-10-08T20:11:24 | 2017-10-08T20:11:24 | 101,620,189 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 743 | cc | #include <set>
#include <cstdio>
#include <cstring>
struct Point
{
int x, y;
char letter[11];
bool operator < (const Point& p) const { return (x*x+y*y < p.x*p.x+p.y*p.y); }
};
int main(int argc, char *argv[])
{
unsigned t, n;
scanf("%d", &t);
while(t--)
{
scanf("%d", &n);
std::set<Point> points;
std::set<Point>::iterator it;
while(n--)
{
Point p;
scanf("%s %d %d", p.letter, &p.x, &p.y);
points.insert(p);
}
for (it = points.begin(); it != points.end(); it++)
{
printf("%s %d %d\n", (*it).letter, (*it).x, (*it).y);
}
printf("\n");
}
return 0;
} | [
"kwasniak.mateusz@gmail.com"
] | kwasniak.mateusz@gmail.com |
f9ce84843a3157b403c7de9f194f3e3511d1d5cb | aa781b866048b40c773f09da50b7c41eb4c1fc76 | /Star War3.0/Star War3.0/Buff.cpp | 5fa774d6fa0ba83c3df4fb45645cca00b653d09d | [
"MIT"
] | permissive | CharlieLeee/Star-War | 5d292d05397d5d6b6edec5f61929c52a878b2d2b | bb4e54cdcea0d58762863e6e631e1022c0d42171 | refs/heads/master | 2022-06-21T06:48:18.586344 | 2022-05-26T20:45:29 | 2022-05-26T20:45:29 | 126,565,128 | 14 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 508 | cpp | #include "Buff.h"
Buff::Buff(Texture *texture, Vector2f pos)
{
this->mult = 62.5f;
this->shape.setTexture(*texture);
this->shape.setScale(0.15f, 0.15f);
this->shape.setOrigin(
texture->getSize().x / 2,
texture->getSize().y / 2
);
this->shape.setPosition(pos);
}
Buff::~Buff()
{
}
void Buff::Update(float speed, const float & dt)
{
this->shape.move(-speed * mult * dt, 0.f);
this->shape.rotate(4.f * dt * mult);
}
void Buff::Draw(RenderWindow * window)
{
window->draw(this->shape);
}
| [
"lichengkun0805@gmail.com"
] | lichengkun0805@gmail.com |
60d655b13b6e45e6d450c37b26c853804c73c707 | 246cd2ca963ed6bd06508f51b3627834332e397e | /esp8266-DS18B20-DeepSleep.ino | 1fba5d148aa7bc0c57f3d662686b39f1395e6a53 | [] | no_license | radimkeseg/esp8266-DS18B20-DeepSleep | fde77efea09e0927d5cb6763a8c65628be2d8808 | e8721141c84340041ee84439374c5c546febacfd | refs/heads/master | 2021-06-14T18:38:49.004137 | 2019-02-25T22:09:42 | 2019-02-25T22:09:42 | 165,419,457 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,319 | ino | /*
* low consumption temp/humidity sensor
* inspiration
* https://openhomeautomation.net/esp8266-battery/
*/
// Library
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include "Interval.h"
#include <ThingSpeak.h>
#define TEMP_BUS 2 //(GPIO2)
OneWire oneWire(TEMP_BUS);
DallasTemperature sensors(&oneWire);
// www.ThingSpeak.com
unsigned long myChannelNumber = 999999 //!!! set your channel number !!!
const char * myWriteAPIKey = "XXXXXXXXXXXXXXXX"; //!!! set you write api key !!!
// WiFi settings
const char* ssid = "SSID"; //!!! set your WIFI name !!!
const char* password = "password"; //!!! set your WIFI password !!!
// Time to sleep (in seconds):
const int sleepTimeS = 10*60;
void write_ThingsSpeak(){
float temperature; // raw values from sensors
temperature = read_temp();
if (isnan(temperature))
{
Serial.println("Failed to read from DS18B20 sensor!");
return;
}
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" °C");
//send data to thingSpeak
ThingSpeak.setField(3,temperature); //!!!! change field number !!!
ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
}
float read_temp(){
sensors.requestTemperatures(); // Send the command to get temperature readings
Serial.print("Temperature: ");
float value_temp=sensors.getTempCByIndex(0); // Why "byIndex"?
Serial.print(value_temp);
Serial.println("C");
return value_temp;
}
void setup()
{
// Serial
Serial.begin(9600);
Serial.println("ESP8266 in normal mode");
// Connect to WiFi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
// Print the IP address
Serial.println(WiFi.localIP());
sensors.begin();
}
void loop()
{
// Use WiFiClient class to create TCP connections
WiFiClient wfclient;
//setup thingSpeak
Serial.println("start sending data to ThingSpeak.com");
ThingSpeak.begin(wfclient);
write_ThingsSpeak();
Serial.println("end sending data to ThingSpeak.com");
Serial.println();
Serial.println("closing connection");
// Sleep
Serial.println("ESP8266 in sleep mode");
ESP.deepSleep(sleepTimeS * 1000000);
}
| [
"radim.keseg@hotmail.com"
] | radim.keseg@hotmail.com |
1d03c0ac4e6e72523a78f164814f983bdb19b366 | c348eb400d9de8fe0b0b11bbbb9b4c03b7fd37af | /programs/geeksforgeeks/test/src/program0011.cpp | 2082a55371d13d2e125ab9cbbad8fea4b8dfe6de | [] | no_license | rangaeeeee/profession | 353e158cebf590e44adfeefd8096676239f9a37f | f88b5a8fd9922b06b04de797624be75f0c7c1427 | refs/heads/master | 2020-12-29T02:38:02.832049 | 2017-04-18T17:15:19 | 2017-04-18T17:15:19 | 52,584,347 | 0 | 2 | null | 2016-03-02T13:11:13 | 2016-02-26T06:42:09 | C++ | UTF-8 | C++ | false | false | 2,098 | cpp | /**
* \file file.c
* \author Rangarajan R
* \date March, 2016
* \brief
* Predict the output.
*
* \details
* Detailed description of file.
*
* \note
*
ShellSort
ShellSort is mainly a variation of Insertion Sort. In insertion sort, we move elements only one position ahead. When an element has to be moved far ahead, many movements are involved. The idea of shellSort is to allow exchange of far items. In shellSort, we make the array h-sorted for a large value of h. We keep reducing the value of h until it becomes 1. An array is said to be h-sorted if all sublists of every h’th element is sorted.
* \copyright
*
*/
// C++ implementation of Shell Sort
#include <iostream>
using namespace std;
/* function to sort arr using shellSort */
int shellSort(int arr[], int n)
{
// Start with a big gap, then reduce the gap
for (int gap = n/2; gap > 0; gap /= 2)
{
// Do a gapped insertion sort for this gap size.
// The first gap elements a[0..gap-1] are already in gapped order
// keep adding one more element until the entire array is
// gap sorted
for (int i = gap; i < n; i += 1)
{
// add a[i] to the elements that have been gap sorted
// save a[i] in temp and make a hole at position i
int temp = arr[i];
// shift earlier gap-sorted elements up until the correct
// location for a[i] is found
int j;
for (j = i; j >= gap && arr[j - gap] > temp; j -= gap)
arr[j] = arr[j - gap];
// put temp (the original a[i]) in its correct location
arr[j] = temp;
}
}
return 0;
}
void printArray(int arr[], int n)
{
for (int i=0; i<n; i++)
cout << arr[i] << " ";
}
int main()
{
int arr[] = {12, 34, 54, 2, 3}, i;
int n = sizeof(arr)/sizeof(arr[0]);
cout << "Array before sorting: \n";
printArray(arr, n);
shellSort(arr, n);
cout << "\nArray after sorting: \n";
printArray(arr, n);
return 0;
}
| [
"rrangarajan.85@gmail.com"
] | rrangarajan.85@gmail.com |
26ae4a506c64d03292a6bed93e0de546eabad8cc | 3bdbb61b4d37cb4a3f5ce69102264f84649560b7 | /Usr/System_Config.cpp | b3e589e2daa0fbf729053fc9c9f66bdede3cfde2 | [
"Apache-2.0"
] | permissive | qrqiuren/coppeliasim_infantry | fc1d3d5d23ea0f775eded2a54f07ad91ee2710ba | 5f3e8f15e9146ec53e95656b0f72ea0c76e8ef61 | refs/heads/master | 2022-12-18T16:58:11.089314 | 2020-09-19T09:44:05 | 2020-09-19T09:44:05 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 6,501 | cpp | /**
******************************************************************************
* @file System_config.cpp
* @brief Deploy resources,tasks and services in this file.
******************************************************************************
* @note
* - Before running your Task you should first include your headers and init-
* ialize used resources in "System_Resource_Init()". This function will be
* called before tasks Start.
*
* - All tasks should be created in "System_Tasks_Init()".
* - FreeRTOS scheduler will be started after tasks are created.
*
===============================================================================
Task List
===============================================================================
* <table>
* <tr><th>Task Name <th>Priority <th>Frequency/Hz <th>Stack/Byte
* <tr><td> <td> <td> <td>
* </table>
*
*/
/* Includes ------------------------------------------------------------------*/
#include "System_Config.h"
#include "System_DataPool.h"
/* Service */
#include "simulation.h"
#include "win32_support.h"
/* User support package & SRML */
#include "User_Task.h"
/* Private variables ---------------------------------------------------------*/
/*Founctions------------------------------------------------------------------*/
/**
* @brief Load drivers ,modules, and data resources for tasks.
* @note Edit this function to add Init-functions and configurations.
*/
void System_Resource_Init(void)
{
/* Drivers Init ---------------------*/
/* RTOS resources Init --------------*/
/* Other resources Init -------------*/
LogOutputBacken_Init();
/* Modules Init ---------------------*/
/* Service configurations -----------*/
SerialPort_Vision.Register_RecvCallBack(VisionSerial_RxCpltCallback);
}
uint32_t getSimMicroSec(void) { return CoppeliaSim->GetSimMicroSec(); }
/**
* @brief Load and start User Tasks. This function run directly in "main()"
* @note Edit this function to add tasks into the activated tasks list.
*/
void System_Tasks_Init(void)
{
/* Syetem Service init --------------*/
/*Serial Communication service*/
Service_SerialPortCom_Init();
/*CoppeliaSim service*/
Service_CoppeliaSim_Init();
/* -------- */
// PID模块
myPIDTimer::getMicroTick_regist(GetMicroSecond);
gimbal.initPID(YAW_ANGLE_ENC, 1.0f, 0, 0, 0, 100.0f);
gimbal.initPID(YAW_SPEED, 0.5f, 0, 0, 0, 1.6f);
gimbal.initPID(YAW_ANGLE_IMU, 2.0f, 0, 0, 0, 100.0f);
gimbal.initPID(PITCH_SPEED, 1.0f, 0.5f, 0, 1.6f, 1.6f);
gimbal.initPID(PITCH_ANGLE, 2.0f, 0, 0, 0, 100.0f);
gimbal.pitchSpeed.I_SeparThresh = 0.5f;
chassis.initPID(1.0f, 0.0f, 0.0f, 100.0f, 1000.0f);
vision.yawPID.SetPIDParam(5E-5, 0, 4E-6, 0, 1.0f);
vision.yawPID.Target = 0;
vision.pitchPID.SetPIDParam(8E-5, 0, 6E-6, 0, 1.0f);
vision.pitchPID.Target = 0;
// 步兵模块
Infantry = CoppeliaSim->Add_Object("Infantry_1", OTHER_OBJECT, { SIM_ORIENTATION | CLIENT_RO, SIM_VELOCITY | CLIENT_RO });
Wheel[LB] = CoppeliaSim->Add_Object("Wheel_LB", JOINT, { SIM_VELOCITY | CLIENT_RW, SIM_POSITION | CLIENT_RO });
Wheel[LF] = CoppeliaSim->Add_Object("Wheel_LF", JOINT, { SIM_VELOCITY | CLIENT_RW, SIM_POSITION | CLIENT_RO });
Wheel[RB] = CoppeliaSim->Add_Object("Wheel_RB", JOINT, { SIM_VELOCITY | CLIENT_RW, SIM_POSITION | CLIENT_RO });
Wheel[RF] = CoppeliaSim->Add_Object("Wheel_RF", JOINT, { SIM_VELOCITY | CLIENT_RW, SIM_POSITION | CLIENT_RO });
Gimbal[YAW] = CoppeliaSim->Add_Object("GimbalYaw", JOINT, { SIM_VELOCITY | CLIENT_RW, SIM_POSITION | CLIENT_RO, SIM_FORCE | CLIENT_WO });
Gimbal[PITCH] = CoppeliaSim->Add_Object("GimbalPitch", JOINT, { SIM_VELOCITY | CLIENT_RW, SIM_POSITION | CLIENT_RO, SIM_FORCE | CLIENT_WO });
imuYawAngle = CoppeliaSim->Add_Object("Infantry_1.YawAng", SIM_FLOAT_SIGNAL, { SIM_SIGNAL_OP | CLIENT_RO });
imuPitchAngle = CoppeliaSim->Add_Object("Infantry_1.PitchAng", SIM_FLOAT_SIGNAL, { SIM_SIGNAL_OP | CLIENT_RO });
imuYawVel = CoppeliaSim->Add_Object("Infantry_1.YawVel", SIM_FLOAT_SIGNAL, { SIM_SIGNAL_OP | CLIENT_RO });
imuPitchVel = CoppeliaSim->Add_Object("Infantry_1.PitchVel", SIM_FLOAT_SIGNAL, { SIM_SIGNAL_OP | CLIENT_RO });
FireCmd = CoppeliaSim->Add_Object("Infantry_1.FireCmd", SIM_INTEGER_SIGNAL, { SIM_SIGNAL_OP | CLIENT_WO });
BulletSpeed = CoppeliaSim->Add_Object("Infantry_1.BulletSpeed", SIM_FLOAT_SIGNAL, { SIM_SIGNAL_OP | CLIENT_WO });
// 神符模块
RuneMotorRed = CoppeliaSim->Add_Object("BladeRed", JOINT, { SIM_VELOCITY | CLIENT_RW, SIM_POSITION | CLIENT_RO });
for (unsigned int i = 0; i < RUNE_ARMOR_NUM; i++)
{
Collision[i] = CoppeliaSim->Add_Object("RuneCollision_" + to_string(i + 1));
RuneLight[i] = CoppeliaSim->Add_Object("RuneLight_" + to_string(i + 1), SIM_INTEGER_SIGNAL, { SIM_SIGNAL_OP | CLIENT_WO });
}
/* Terrible memory check */
string check_result = "";
if (Infantry == nullptr)
check_result.append("\n\rInfantry pointer exploded !");
if (imuYawAngle == nullptr || imuPitchVel == nullptr || imuYawVel == nullptr || imuPitchVel == nullptr)
check_result.append("\n\imuData pointer exploded !");
if (FireCmd == nullptr)
check_result.append("\n\rFireCmd pointer exploded !");
if (BulletSpeed == nullptr)
check_result.append("\n\rBulletSpeed pointer exploded !");
if (RuneMotorRed == nullptr)
check_result.append("\n\rRuneMotorRed pointer exploded !");
for each (auto i in Wheel)
if (i == nullptr)
check_result.append("\n\rWheel pointer exploded !");
for each (auto i in Gimbal)
if (i == nullptr)
check_result.append("\n\rGimbal pointer exploded !");
for each (auto i in Collision)
if (i == nullptr)
check_result.append("\n\rCollision pointer exploded !");
for each (auto i in RuneLight)
if (i == nullptr)
check_result.append("\n\rRuneLight pointer exploded !");
// vrep中存在掉线模块
if (!check_result.empty())
{
std::cout << "----------------------------> Objects add failed ! <----------------------------";
std::cout << check_result << std::endl;
std::cout << "------------------------> Process will be suspended ! <-------------------------" << std::endl;
exit(0);
}
else
std::cout << "------------------------> Objects added successfully ! <------------------------" << std::endl;
/* Applications Init ----------------*/
User_Tasks_Init();
/* Start the tasks and timer running. */
vTaskStartScheduler();
}
/************************ COPYRIGHT(C) SCUT-ROBOTLAB **************************/
| [
"201730645459@mail.scut.edu.cn"
] | 201730645459@mail.scut.edu.cn |
b40d688b73023beb4449fec3096112952fc0d73d | 41239a431037ac94aa315fb996bc03c4d6401235 | /MPIOnline/Database.h | 8065236181f9657da99ba0b90e6b355f8a879dde | [] | no_license | uhuanli/DistributedRDFEngine | a6e28ef1e72eed7a5955b908ba2298e63d5aa544 | 973aa3768cd957c55cfc9d162d73ee6cfbd38a5c | refs/heads/master | 2020-04-16T09:28:53.858270 | 2019-01-13T05:20:45 | 2019-01-13T05:20:45 | 165,465,758 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 4,901 | h | #ifndef DATABASE_H
#define DATABASE_H
//#include "Global.h"
class Database{
private:
int sqlType;
public:
virtual int connectRead();
virtual int disConnectRead();
virtual int connectWrite();
virtual int disConnectWrite();
virtual int setEntityToEntityID(const char* entity,int entityID);
virtual int getEntityToEntityID(const char* entity,int& entityID);
virtual int setPredictToPreID(const char* predict,int preID);
virtual int getPredictToPreID(const char* predict,int& preID);
virtual int setLocationToLocID(const char* location,int locID);
virtual int getLocationToLocID(const char* location,int& locID);
virtual int setEntityIDToEntity(int entityID,const char* entity);
virtual int getEntityIDToEntity(int entityID,char*& entity);
virtual int setPreIDToPredict(int preID,const char* predict);
virtual int getPreIDToPredict(int preID,char*& predict);
virtual int setLocIDToLocation(int locID,const char* location);
virtual int getLocIDToLocation(int locID,char*& location);
virtual int setLocIDToLocXLocY(int locID,double locX,double locY);
virtual int getLocIDToLocXLocY(int locID,double& locX,double& locY);
virtual int setLocXLocYToLocID(double locX,double locY,int locID);
virtual int setLocXLocYToLocIDList(double locX,double locY,int locIDListLen,int* locIDList);
virtual int getLocXLocYToLocIDList(double locXL,double locXH,double locYL,double locYH,int& locIDListLen,int*& locIDList);
virtual int setSubIDToLineID(int subID,int lineID);
virtual int setSubIDToLineIDList(int subID,int lineIDListLen,int* lineIDList);
virtual int getSubIDToLineIDList(int subID,int& lineIDListLen,int*& lineIDList);
virtual int setSubIDToObjID(int subID,int objID);
virtual int setSubIDToObjIDList(int subID,int objIDListLen,int* objIDList);
virtual int getSubIDToObjIDList(int subID,int& objIDListLen,int*& objIDList);
virtual int setSubIDPreIDToLineID(int subID,int preID,int lineID);
virtual int setSubIDPreIDToLineIDList(int subID,int preID,int lineIDListLen,int* lineIDList);
virtual int getSubIDPreIDToLineIDList(int subID,int preID,int& lineIDListLen,int*& lineIDList);
virtual int setSubIDPreIDToObjID(int subID,int preID,int objID);
virtual int setSubIDPreIDToObjIDList(int subID,int preID,int objIDListLen,int* objIDList);
virtual int getSubIDPreIDToObjIDList(int subID,int preID,int& objIDListLen,int*& objIDList);
virtual int setSubIDPreIDToLocID(int subID,int preID,int locID);
virtual int setSubIDPreIDToLocIDList(int subID,int preID,int locIDListLen,int* locIDList);
virtual int getSubIDPreIDToLocIDList(int subID,int preID,int& locIDListLen,int*& locIDList);
virtual int setObjIDToLineID(int objID,int lineID);
virtual int setObjIDToLineIDList(int objID,int lineIDListLen,int* lineIDList);
virtual int getObjIDToLineIDList(int objID,int& lineIDListLen,int*& lineIDList);
virtual int setObjIDToSubID(int objID,int subID);
virtual int setObjIDToSubIDList(int objID,int subIDListLen,int* subIDList);
virtual int getObjIDToSubIDList(int objID,int& subIDListLen,int*& subIDList);
virtual int setObjIDPreIDToLineID(int objID,int preID,int lineID);
virtual int setObjIDPreIDToLineIDList(int objID,int preID,int lineIDListLen,int* lineIDList);
virtual int getObjIDPreIDToLineIDList(int objID,int preID,int& lineIDListLen,int*& lineIDList);
virtual int setObjIDPreIDToSubID(int objID,int preID,int subID);
virtual int setObjIDPreIDToSubIDList(int objID,int preID,int subIDListLen,int* subIDList);
virtual int getObjIDPreIDToSubIDList(int objID,int preID,int& subIDListLen,int*& subIDList);
virtual int setObjIDPreIDToLocID(int objID,int preID,int locID);
virtual int setObjIDPreIDToLocIDList(int objID,int preID,int locIDListLen,int* locIDList);
virtual int getObjIDPreIDToLocIDList(int objID,int preID,int& locIDListLen,int*& locIDList);
/*
virtual int setLocXLocYPreIDToLineID(double locX,double locY,int preID,int lineID);
virtual int setLocXLocYPreIDToLineIDList(double locXL,double locXH,double locYL,double locYH,int preID,int lineIDListLen,int* lineIDList);
virtual int getLocXLocYPreIDToLineIDList(double locXL,double locXH,double locYL,double locYH,int preID,int& lineIDListLen,int*& lineIDList);
*/
virtual int setLineIDToSubID(int lineID,int subID);
virtual int getLineIDToSubID(int lineID,int& subID);
virtual int setLineIDToObjID(int lineID,int subID);
virtual int getLineIDToObjID(int lineID,int& subID);
virtual int setLineIDToPreID(int lineID,int subID);
virtual int getLineIDToPreID(int lineID,int& subID);
virtual int setLineIDToLocID(int lineID,int subID);
virtual int getLineIDToLocID(int lineID,int& subID);
virtual int setLineIDToSPOL(int lineID,int subID,int preID,int objID,int locID);
virtual int getLineIDToSPOL(int lineID,int& subID,int& preID,int& objID,int& locID);
};
#endif
| [
"liyouhuan@youhuanli-mb0.tencent.com"
] | liyouhuan@youhuanli-mb0.tencent.com |
0aba5cc29bb98d5892ab2486f20a8fb7f88e4355 | 16f2dfe568c296a9356dbcdd5e8b6043967d025e | /ext/v8/upstream/2.1.10/src/v8.cc | 7219d630ce9671b19d0f098256866dd704cd5b01 | [
"MIT",
"BSD-3-Clause"
] | permissive | skarayan/therubyracer | ddcdf5e3138cc292605ea77f2330b57b961dbb05 | cd512d31359efa458d550aecd54686062d4b511c | refs/heads/master | 2021-01-17T23:21:45.963707 | 2010-07-08T15:10:19 | 2010-07-08T15:10:19 | 795,376 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,431 | cc | // Copyright 2006-2009 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "v8.h"
#include "bootstrapper.h"
#include "debug.h"
#include "serialize.h"
#include "simulator.h"
#include "stub-cache.h"
#include "oprofile-agent.h"
#include "log.h"
namespace v8 {
namespace internal {
bool V8::is_running_ = false;
bool V8::has_been_setup_ = false;
bool V8::has_been_disposed_ = false;
bool V8::has_fatal_error_ = false;
bool V8::Initialize(Deserializer* des) {
bool create_heap_objects = des == NULL;
if (has_been_disposed_ || has_fatal_error_) return false;
if (IsRunning()) return true;
is_running_ = true;
has_been_setup_ = true;
has_fatal_error_ = false;
has_been_disposed_ = false;
#ifdef DEBUG
// The initialization process does not handle memory exhaustion.
DisallowAllocationFailure disallow_allocation_failure;
#endif
// Enable logging before setting up the heap
Logger::Setup();
CpuProfiler::Setup();
// Setup the platform OS support.
OS::Setup();
// Initialize other runtime facilities
#if !V8_HOST_ARCH_ARM && V8_TARGET_ARCH_ARM
::assembler::arm::Simulator::Initialize();
#endif
{ // NOLINT
// Ensure that the thread has a valid stack guard. The v8::Locker object
// will ensure this too, but we don't have to use lockers if we are only
// using one thread.
ExecutionAccess lock;
StackGuard::InitThread(lock);
}
// Setup the object heap
ASSERT(!Heap::HasBeenSetup());
if (!Heap::Setup(create_heap_objects)) {
SetFatalError();
return false;
}
Bootstrapper::Initialize(create_heap_objects);
Builtins::Setup(create_heap_objects);
Top::Initialize();
if (FLAG_preemption) {
v8::Locker locker;
v8::Locker::StartPreemption(100);
}
#ifdef ENABLE_DEBUGGER_SUPPORT
Debug::Setup(create_heap_objects);
#endif
StubCache::Initialize(create_heap_objects);
// If we are deserializing, read the state into the now-empty heap.
if (des != NULL) {
des->Deserialize();
StubCache::Clear();
}
// Deserializing may put strange things in the root array's copy of the
// stack guard.
Heap::SetStackLimits();
// Setup the CPU support. Must be done after heap setup and after
// any deserialization because we have to have the initial heap
// objects in place for creating the code object used for probing.
CPU::Setup();
OProfileAgent::Initialize();
// If we are deserializing, log non-function code objects and compiled
// functions found in the snapshot.
if (des != NULL && FLAG_log_code) {
HandleScope scope;
LOG(LogCodeObjects());
LOG(LogCompiledFunctions());
}
return true;
}
void V8::SetFatalError() {
is_running_ = false;
has_fatal_error_ = true;
}
void V8::TearDown() {
if (!has_been_setup_ || has_been_disposed_) return;
OProfileAgent::TearDown();
if (FLAG_preemption) {
v8::Locker locker;
v8::Locker::StopPreemption();
}
Builtins::TearDown();
Bootstrapper::TearDown();
Top::TearDown();
Heap::TearDown();
CpuProfiler::TearDown();
Logger::TearDown();
is_running_ = false;
has_been_disposed_ = true;
}
static uint32_t random_seed() {
if (FLAG_random_seed == 0) {
return random();
}
return FLAG_random_seed;
}
uint32_t V8::Random() {
// Random number generator using George Marsaglia's MWC algorithm.
static uint32_t hi = 0;
static uint32_t lo = 0;
// Initialize seed using the system random(). If one of the seeds
// should ever become zero again, or if random() returns zero, we
// avoid getting stuck with zero bits in hi or lo by re-initializing
// them on demand.
if (hi == 0) hi = random_seed();
if (lo == 0) lo = random_seed();
// Mix the bits.
hi = 36969 * (hi & 0xFFFF) + (hi >> 16);
lo = 18273 * (lo & 0xFFFF) + (lo >> 16);
return (hi << 16) + (lo & 0xFFFF);
}
bool V8::IdleNotification() {
// Returning true tells the caller that there is no need to call
// IdleNotification again.
if (!FLAG_use_idle_notification) return true;
// Tell the heap that it may want to adjust.
return Heap::IdleNotification();
}
// Use a union type to avoid type-aliasing optimizations in GCC.
typedef union {
double double_value;
uint64_t uint64_t_value;
} double_int_union;
Object* V8::FillHeapNumberWithRandom(Object* heap_number) {
uint64_t random_bits = Random();
// Make a double* from address (heap_number + sizeof(double)).
double_int_union* r = reinterpret_cast<double_int_union*>(
reinterpret_cast<char*>(heap_number) +
HeapNumber::kValueOffset - kHeapObjectTag);
// Convert 32 random bits to 0.(32 random bits) in a double
// by computing:
// ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
const double binary_million = 1048576.0;
r->double_value = binary_million;
r->uint64_t_value |= random_bits;
r->double_value -= binary_million;
return heap_number;
}
} } // namespace v8::internal
| [
"cowboyd@thefrontside.net"
] | cowboyd@thefrontside.net |
f8adaf1421b602dbe00636331b768250f8e72994 | b759b3663e826405814936d58a52cde63745a384 | /Server_Lu/Network/Protocol/ServerMessageProto.pb.cc | 15c1a7bfd13154d40136702e668f83c543f2c353 | [] | no_license | arno-Lu/GameServer | 22a22585edfbae332aac9034097a6a131378c486 | faf4d807d2c95386546cba828bb27b86fc40828a | refs/heads/master | 2021-04-27T02:50:44.727214 | 2018-02-24T05:20:06 | 2018-02-24T05:20:06 | 122,703,794 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | true | 129,993 | cc | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: ServerMessageProto.proto
#include "ServerMessageProto.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 LU {
class LoginMSGDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<LoginMSG>
_instance;
} _LoginMSG_default_instance_;
class LoginRSPSDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<LoginRSPS>
_instance;
} _LoginRSPS_default_instance_;
class RegisterMSGDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<RegisterMSG>
_instance;
} _RegisterMSG_default_instance_;
class RegisterRSPSDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<RegisterRSPS>
_instance;
} _RegisterRSPS_default_instance_;
class ChatMSGDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<ChatMSG>
_instance;
} _ChatMSG_default_instance_;
class ChatRSPSDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<ChatRSPS>
_instance;
} _ChatRSPS_default_instance_;
class MatchMSGDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<MatchMSG>
_instance;
} _MatchMSG_default_instance_;
class MatchRSPSDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<MatchRSPS>
_instance;
} _MatchRSPS_default_instance_;
class SCStartGameDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<SCStartGame>
_instance;
} _SCStartGame_default_instance_;
class CSFrameNotifyDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<CSFrameNotify>
_instance;
} _CSFrameNotify_default_instance_;
class SCFrameNotifyDefaultTypeInternal {
public:
::google::protobuf::internal::ExplicitlyConstructed<SCFrameNotify>
_instance;
} _SCFrameNotify_default_instance_;
} // namespace LU
namespace protobuf_ServerMessageProto_2eproto {
void InitDefaultsLoginMSGImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
{
void* ptr = &::LU::_LoginMSG_default_instance_;
new (ptr) ::LU::LoginMSG();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::LU::LoginMSG::InitAsDefaultInstance();
}
void InitDefaultsLoginMSG() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsLoginMSGImpl);
}
void InitDefaultsLoginRSPSImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
{
void* ptr = &::LU::_LoginRSPS_default_instance_;
new (ptr) ::LU::LoginRSPS();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::LU::LoginRSPS::InitAsDefaultInstance();
}
void InitDefaultsLoginRSPS() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsLoginRSPSImpl);
}
void InitDefaultsRegisterMSGImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
{
void* ptr = &::LU::_RegisterMSG_default_instance_;
new (ptr) ::LU::RegisterMSG();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::LU::RegisterMSG::InitAsDefaultInstance();
}
void InitDefaultsRegisterMSG() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsRegisterMSGImpl);
}
void InitDefaultsRegisterRSPSImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
{
void* ptr = &::LU::_RegisterRSPS_default_instance_;
new (ptr) ::LU::RegisterRSPS();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::LU::RegisterRSPS::InitAsDefaultInstance();
}
void InitDefaultsRegisterRSPS() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsRegisterRSPSImpl);
}
void InitDefaultsChatMSGImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
{
void* ptr = &::LU::_ChatMSG_default_instance_;
new (ptr) ::LU::ChatMSG();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::LU::ChatMSG::InitAsDefaultInstance();
}
void InitDefaultsChatMSG() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsChatMSGImpl);
}
void InitDefaultsChatRSPSImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
{
void* ptr = &::LU::_ChatRSPS_default_instance_;
new (ptr) ::LU::ChatRSPS();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::LU::ChatRSPS::InitAsDefaultInstance();
}
void InitDefaultsChatRSPS() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsChatRSPSImpl);
}
void InitDefaultsMatchMSGImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
{
void* ptr = &::LU::_MatchMSG_default_instance_;
new (ptr) ::LU::MatchMSG();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::LU::MatchMSG::InitAsDefaultInstance();
}
void InitDefaultsMatchMSG() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsMatchMSGImpl);
}
void InitDefaultsMatchRSPSImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
{
void* ptr = &::LU::_MatchRSPS_default_instance_;
new (ptr) ::LU::MatchRSPS();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::LU::MatchRSPS::InitAsDefaultInstance();
}
void InitDefaultsMatchRSPS() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsMatchRSPSImpl);
}
void InitDefaultsSCStartGameImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
{
void* ptr = &::LU::_SCStartGame_default_instance_;
new (ptr) ::LU::SCStartGame();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::LU::SCStartGame::InitAsDefaultInstance();
}
void InitDefaultsSCStartGame() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsSCStartGameImpl);
}
void InitDefaultsCSFrameNotifyImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
{
void* ptr = &::LU::_CSFrameNotify_default_instance_;
new (ptr) ::LU::CSFrameNotify();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::LU::CSFrameNotify::InitAsDefaultInstance();
}
void InitDefaultsCSFrameNotify() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsCSFrameNotifyImpl);
}
void InitDefaultsSCFrameNotifyImpl() {
GOOGLE_PROTOBUF_VERIFY_VERSION;
#ifdef GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
::google::protobuf::internal::InitProtobufDefaultsForceUnique();
#else
::google::protobuf::internal::InitProtobufDefaults();
#endif // GOOGLE_PROTOBUF_ENFORCE_UNIQUENESS
protobuf_ServerMessageProto_2eproto::InitDefaultsCSFrameNotify();
{
void* ptr = &::LU::_SCFrameNotify_default_instance_;
new (ptr) ::LU::SCFrameNotify();
::google::protobuf::internal::OnShutdownDestroyMessage(ptr);
}
::LU::SCFrameNotify::InitAsDefaultInstance();
}
void InitDefaultsSCFrameNotify() {
static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
::google::protobuf::GoogleOnceInit(&once, &InitDefaultsSCFrameNotifyImpl);
}
::google::protobuf::Metadata file_level_metadata[11];
const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::LoginMSG, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::LoginMSG, username_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::LoginMSG, password_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::LoginRSPS, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::LoginRSPS, message_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::RegisterMSG, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::RegisterMSG, username_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::RegisterMSG, password_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::RegisterRSPS, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::RegisterRSPS, message_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::ChatMSG, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::ChatMSG, uin_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::ChatMSG, message_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::ChatRSPS, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::ChatRSPS, uin_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::ChatRSPS, message_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::MatchMSG, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::MatchMSG, role_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::MatchRSPS, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::MatchRSPS, uin_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::SCStartGame, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::SCStartGame, uins_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::CSFrameNotify, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::CSFrameNotify, uin_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::CSFrameNotify, keys_),
~0u, // no _has_bits_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::SCFrameNotify, _internal_metadata_),
~0u, // no _extensions_
~0u, // no _oneof_case_
~0u, // no _weak_field_map_
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::SCFrameNotify, keys_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::SCFrameNotify, currentframe_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(::LU::SCFrameNotify, nextframe_),
};
static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
{ 0, -1, sizeof(::LU::LoginMSG)},
{ 7, -1, sizeof(::LU::LoginRSPS)},
{ 13, -1, sizeof(::LU::RegisterMSG)},
{ 20, -1, sizeof(::LU::RegisterRSPS)},
{ 26, -1, sizeof(::LU::ChatMSG)},
{ 33, -1, sizeof(::LU::ChatRSPS)},
{ 40, -1, sizeof(::LU::MatchMSG)},
{ 46, -1, sizeof(::LU::MatchRSPS)},
{ 52, -1, sizeof(::LU::SCStartGame)},
{ 58, -1, sizeof(::LU::CSFrameNotify)},
{ 65, -1, sizeof(::LU::SCFrameNotify)},
};
static ::google::protobuf::Message const * const file_default_instances[] = {
reinterpret_cast<const ::google::protobuf::Message*>(&::LU::_LoginMSG_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::LU::_LoginRSPS_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::LU::_RegisterMSG_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::LU::_RegisterRSPS_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::LU::_ChatMSG_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::LU::_ChatRSPS_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::LU::_MatchMSG_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::LU::_MatchRSPS_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::LU::_SCStartGame_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::LU::_CSFrameNotify_default_instance_),
reinterpret_cast<const ::google::protobuf::Message*>(&::LU::_SCFrameNotify_default_instance_),
};
void protobuf_AssignDescriptors() {
AddDescriptors();
::google::protobuf::MessageFactory* factory = NULL;
AssignDescriptors(
"ServerMessageProto.proto", schemas, file_default_instances, TableStruct::offsets, factory,
file_level_metadata, NULL, 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, 11);
}
void AddDescriptorsImpl() {
InitDefaults();
static const char descriptor[] GOOGLE_PROTOBUF_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
"\n\030ServerMessageProto.proto\022\002LU\".\n\010LoginM"
"SG\022\020\n\010username\030\002 \001(\t\022\020\n\010password\030\003 \001(\t\"\034"
"\n\tLoginRSPS\022\017\n\007message\030\002 \001(\t\"1\n\013Register"
"MSG\022\020\n\010username\030\002 \001(\t\022\020\n\010password\030\003 \001(\t\""
"\037\n\014RegisterRSPS\022\017\n\007message\030\002 \001(\t\"\'\n\007Chat"
"MSG\022\013\n\003uin\030\002 \001(\005\022\017\n\007message\030\003 \001(\t\"(\n\010Cha"
"tRSPS\022\013\n\003uin\030\002 \001(\005\022\017\n\007message\030\003 \001(\t\"\030\n\010M"
"atchMSG\022\014\n\004role\030\002 \001(\t\"\030\n\tMatchRSPS\022\013\n\003ui"
"n\030\002 \001(\005\"\033\n\013SCStartGame\022\014\n\004uins\030\002 \003(\005\"*\n\r"
"CSFrameNotify\022\013\n\003uin\030\002 \001(\005\022\014\n\004keys\030\003 \003(\005"
"\"Y\n\rSCFrameNotify\022\037\n\004keys\030\002 \003(\0132\021.LU.CSF"
"rameNotify\022\024\n\014currentFrame\030\003 \001(\005\022\021\n\tnext"
"Frame\030\004 \001(\005b\006proto3"
};
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
descriptor, 499);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"ServerMessageProto.proto", &protobuf_RegisterTypes);
}
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_ServerMessageProto_2eproto
namespace LU {
// ===================================================================
void LoginMSG::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int LoginMSG::kUsernameFieldNumber;
const int LoginMSG::kPasswordFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
LoginMSG::LoginMSG()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_ServerMessageProto_2eproto::InitDefaultsLoginMSG();
}
SharedCtor();
// @@protoc_insertion_point(constructor:LU.LoginMSG)
}
LoginMSG::LoginMSG(const LoginMSG& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
username_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.username().size() > 0) {
username_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.username_);
}
password_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.password().size() > 0) {
password_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.password_);
}
// @@protoc_insertion_point(copy_constructor:LU.LoginMSG)
}
void LoginMSG::SharedCtor() {
username_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
password_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
_cached_size_ = 0;
}
LoginMSG::~LoginMSG() {
// @@protoc_insertion_point(destructor:LU.LoginMSG)
SharedDtor();
}
void LoginMSG::SharedDtor() {
username_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
password_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void LoginMSG::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* LoginMSG::descriptor() {
::protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const LoginMSG& LoginMSG::default_instance() {
::protobuf_ServerMessageProto_2eproto::InitDefaultsLoginMSG();
return *internal_default_instance();
}
LoginMSG* LoginMSG::New(::google::protobuf::Arena* arena) const {
LoginMSG* n = new LoginMSG;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void LoginMSG::Clear() {
// @@protoc_insertion_point(message_clear_start:LU.LoginMSG)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
username_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
password_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
_internal_metadata_.Clear();
}
bool LoginMSG::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:LU.LoginMSG)
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)) {
// string username = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_username()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->username().data(), static_cast<int>(this->username().length()),
::google::protobuf::internal::WireFormatLite::PARSE,
"LU.LoginMSG.username"));
} else {
goto handle_unusual;
}
break;
}
// string password = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_password()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->password().data(), static_cast<int>(this->password().length()),
::google::protobuf::internal::WireFormatLite::PARSE,
"LU.LoginMSG.password"));
} 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:LU.LoginMSG)
return true;
failure:
// @@protoc_insertion_point(parse_failure:LU.LoginMSG)
return false;
#undef DO_
}
void LoginMSG::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:LU.LoginMSG)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// string username = 2;
if (this->username().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->username().data(), static_cast<int>(this->username().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"LU.LoginMSG.username");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->username(), output);
}
// string password = 3;
if (this->password().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->password().data(), static_cast<int>(this->password().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"LU.LoginMSG.password");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
3, this->password(), 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:LU.LoginMSG)
}
::google::protobuf::uint8* LoginMSG::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:LU.LoginMSG)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// string username = 2;
if (this->username().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->username().data(), static_cast<int>(this->username().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"LU.LoginMSG.username");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->username(), target);
}
// string password = 3;
if (this->password().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->password().data(), static_cast<int>(this->password().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"LU.LoginMSG.password");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
3, this->password(), 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:LU.LoginMSG)
return target;
}
size_t LoginMSG::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:LU.LoginMSG)
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()));
}
// string username = 2;
if (this->username().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->username());
}
// string password = 3;
if (this->password().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->password());
}
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 LoginMSG::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:LU.LoginMSG)
GOOGLE_DCHECK_NE(&from, this);
const LoginMSG* source =
::google::protobuf::internal::DynamicCastToGenerated<const LoginMSG>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:LU.LoginMSG)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:LU.LoginMSG)
MergeFrom(*source);
}
}
void LoginMSG::MergeFrom(const LoginMSG& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:LU.LoginMSG)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.username().size() > 0) {
username_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.username_);
}
if (from.password().size() > 0) {
password_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.password_);
}
}
void LoginMSG::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:LU.LoginMSG)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void LoginMSG::CopyFrom(const LoginMSG& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:LU.LoginMSG)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool LoginMSG::IsInitialized() const {
return true;
}
void LoginMSG::Swap(LoginMSG* other) {
if (other == this) return;
InternalSwap(other);
}
void LoginMSG::InternalSwap(LoginMSG* other) {
using std::swap;
username_.Swap(&other->username_);
password_.Swap(&other->password_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata LoginMSG::GetMetadata() const {
protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void LoginRSPS::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int LoginRSPS::kMessageFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
LoginRSPS::LoginRSPS()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_ServerMessageProto_2eproto::InitDefaultsLoginRSPS();
}
SharedCtor();
// @@protoc_insertion_point(constructor:LU.LoginRSPS)
}
LoginRSPS::LoginRSPS(const LoginRSPS& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
message_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.message().size() > 0) {
message_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.message_);
}
// @@protoc_insertion_point(copy_constructor:LU.LoginRSPS)
}
void LoginRSPS::SharedCtor() {
message_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
_cached_size_ = 0;
}
LoginRSPS::~LoginRSPS() {
// @@protoc_insertion_point(destructor:LU.LoginRSPS)
SharedDtor();
}
void LoginRSPS::SharedDtor() {
message_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void LoginRSPS::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* LoginRSPS::descriptor() {
::protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const LoginRSPS& LoginRSPS::default_instance() {
::protobuf_ServerMessageProto_2eproto::InitDefaultsLoginRSPS();
return *internal_default_instance();
}
LoginRSPS* LoginRSPS::New(::google::protobuf::Arena* arena) const {
LoginRSPS* n = new LoginRSPS;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void LoginRSPS::Clear() {
// @@protoc_insertion_point(message_clear_start:LU.LoginRSPS)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
message_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
_internal_metadata_.Clear();
}
bool LoginRSPS::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:LU.LoginRSPS)
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)) {
// string message = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_message()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->message().data(), static_cast<int>(this->message().length()),
::google::protobuf::internal::WireFormatLite::PARSE,
"LU.LoginRSPS.message"));
} 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:LU.LoginRSPS)
return true;
failure:
// @@protoc_insertion_point(parse_failure:LU.LoginRSPS)
return false;
#undef DO_
}
void LoginRSPS::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:LU.LoginRSPS)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// string message = 2;
if (this->message().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->message().data(), static_cast<int>(this->message().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"LU.LoginRSPS.message");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->message(), 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:LU.LoginRSPS)
}
::google::protobuf::uint8* LoginRSPS::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:LU.LoginRSPS)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// string message = 2;
if (this->message().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->message().data(), static_cast<int>(this->message().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"LU.LoginRSPS.message");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->message(), 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:LU.LoginRSPS)
return target;
}
size_t LoginRSPS::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:LU.LoginRSPS)
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()));
}
// string message = 2;
if (this->message().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->message());
}
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 LoginRSPS::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:LU.LoginRSPS)
GOOGLE_DCHECK_NE(&from, this);
const LoginRSPS* source =
::google::protobuf::internal::DynamicCastToGenerated<const LoginRSPS>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:LU.LoginRSPS)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:LU.LoginRSPS)
MergeFrom(*source);
}
}
void LoginRSPS::MergeFrom(const LoginRSPS& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:LU.LoginRSPS)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.message().size() > 0) {
message_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.message_);
}
}
void LoginRSPS::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:LU.LoginRSPS)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void LoginRSPS::CopyFrom(const LoginRSPS& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:LU.LoginRSPS)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool LoginRSPS::IsInitialized() const {
return true;
}
void LoginRSPS::Swap(LoginRSPS* other) {
if (other == this) return;
InternalSwap(other);
}
void LoginRSPS::InternalSwap(LoginRSPS* other) {
using std::swap;
message_.Swap(&other->message_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata LoginRSPS::GetMetadata() const {
protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void RegisterMSG::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int RegisterMSG::kUsernameFieldNumber;
const int RegisterMSG::kPasswordFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
RegisterMSG::RegisterMSG()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_ServerMessageProto_2eproto::InitDefaultsRegisterMSG();
}
SharedCtor();
// @@protoc_insertion_point(constructor:LU.RegisterMSG)
}
RegisterMSG::RegisterMSG(const RegisterMSG& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
username_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.username().size() > 0) {
username_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.username_);
}
password_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.password().size() > 0) {
password_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.password_);
}
// @@protoc_insertion_point(copy_constructor:LU.RegisterMSG)
}
void RegisterMSG::SharedCtor() {
username_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
password_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
_cached_size_ = 0;
}
RegisterMSG::~RegisterMSG() {
// @@protoc_insertion_point(destructor:LU.RegisterMSG)
SharedDtor();
}
void RegisterMSG::SharedDtor() {
username_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
password_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void RegisterMSG::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* RegisterMSG::descriptor() {
::protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const RegisterMSG& RegisterMSG::default_instance() {
::protobuf_ServerMessageProto_2eproto::InitDefaultsRegisterMSG();
return *internal_default_instance();
}
RegisterMSG* RegisterMSG::New(::google::protobuf::Arena* arena) const {
RegisterMSG* n = new RegisterMSG;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void RegisterMSG::Clear() {
// @@protoc_insertion_point(message_clear_start:LU.RegisterMSG)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
username_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
password_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
_internal_metadata_.Clear();
}
bool RegisterMSG::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:LU.RegisterMSG)
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)) {
// string username = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_username()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->username().data(), static_cast<int>(this->username().length()),
::google::protobuf::internal::WireFormatLite::PARSE,
"LU.RegisterMSG.username"));
} else {
goto handle_unusual;
}
break;
}
// string password = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_password()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->password().data(), static_cast<int>(this->password().length()),
::google::protobuf::internal::WireFormatLite::PARSE,
"LU.RegisterMSG.password"));
} 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:LU.RegisterMSG)
return true;
failure:
// @@protoc_insertion_point(parse_failure:LU.RegisterMSG)
return false;
#undef DO_
}
void RegisterMSG::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:LU.RegisterMSG)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// string username = 2;
if (this->username().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->username().data(), static_cast<int>(this->username().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"LU.RegisterMSG.username");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->username(), output);
}
// string password = 3;
if (this->password().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->password().data(), static_cast<int>(this->password().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"LU.RegisterMSG.password");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
3, this->password(), 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:LU.RegisterMSG)
}
::google::protobuf::uint8* RegisterMSG::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:LU.RegisterMSG)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// string username = 2;
if (this->username().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->username().data(), static_cast<int>(this->username().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"LU.RegisterMSG.username");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->username(), target);
}
// string password = 3;
if (this->password().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->password().data(), static_cast<int>(this->password().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"LU.RegisterMSG.password");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
3, this->password(), 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:LU.RegisterMSG)
return target;
}
size_t RegisterMSG::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:LU.RegisterMSG)
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()));
}
// string username = 2;
if (this->username().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->username());
}
// string password = 3;
if (this->password().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->password());
}
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 RegisterMSG::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:LU.RegisterMSG)
GOOGLE_DCHECK_NE(&from, this);
const RegisterMSG* source =
::google::protobuf::internal::DynamicCastToGenerated<const RegisterMSG>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:LU.RegisterMSG)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:LU.RegisterMSG)
MergeFrom(*source);
}
}
void RegisterMSG::MergeFrom(const RegisterMSG& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:LU.RegisterMSG)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.username().size() > 0) {
username_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.username_);
}
if (from.password().size() > 0) {
password_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.password_);
}
}
void RegisterMSG::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:LU.RegisterMSG)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void RegisterMSG::CopyFrom(const RegisterMSG& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:LU.RegisterMSG)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool RegisterMSG::IsInitialized() const {
return true;
}
void RegisterMSG::Swap(RegisterMSG* other) {
if (other == this) return;
InternalSwap(other);
}
void RegisterMSG::InternalSwap(RegisterMSG* other) {
using std::swap;
username_.Swap(&other->username_);
password_.Swap(&other->password_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata RegisterMSG::GetMetadata() const {
protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void RegisterRSPS::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int RegisterRSPS::kMessageFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
RegisterRSPS::RegisterRSPS()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_ServerMessageProto_2eproto::InitDefaultsRegisterRSPS();
}
SharedCtor();
// @@protoc_insertion_point(constructor:LU.RegisterRSPS)
}
RegisterRSPS::RegisterRSPS(const RegisterRSPS& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
message_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.message().size() > 0) {
message_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.message_);
}
// @@protoc_insertion_point(copy_constructor:LU.RegisterRSPS)
}
void RegisterRSPS::SharedCtor() {
message_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
_cached_size_ = 0;
}
RegisterRSPS::~RegisterRSPS() {
// @@protoc_insertion_point(destructor:LU.RegisterRSPS)
SharedDtor();
}
void RegisterRSPS::SharedDtor() {
message_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void RegisterRSPS::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* RegisterRSPS::descriptor() {
::protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const RegisterRSPS& RegisterRSPS::default_instance() {
::protobuf_ServerMessageProto_2eproto::InitDefaultsRegisterRSPS();
return *internal_default_instance();
}
RegisterRSPS* RegisterRSPS::New(::google::protobuf::Arena* arena) const {
RegisterRSPS* n = new RegisterRSPS;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void RegisterRSPS::Clear() {
// @@protoc_insertion_point(message_clear_start:LU.RegisterRSPS)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
message_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
_internal_metadata_.Clear();
}
bool RegisterRSPS::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:LU.RegisterRSPS)
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)) {
// string message = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_message()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->message().data(), static_cast<int>(this->message().length()),
::google::protobuf::internal::WireFormatLite::PARSE,
"LU.RegisterRSPS.message"));
} 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:LU.RegisterRSPS)
return true;
failure:
// @@protoc_insertion_point(parse_failure:LU.RegisterRSPS)
return false;
#undef DO_
}
void RegisterRSPS::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:LU.RegisterRSPS)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// string message = 2;
if (this->message().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->message().data(), static_cast<int>(this->message().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"LU.RegisterRSPS.message");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->message(), 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:LU.RegisterRSPS)
}
::google::protobuf::uint8* RegisterRSPS::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:LU.RegisterRSPS)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// string message = 2;
if (this->message().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->message().data(), static_cast<int>(this->message().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"LU.RegisterRSPS.message");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->message(), 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:LU.RegisterRSPS)
return target;
}
size_t RegisterRSPS::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:LU.RegisterRSPS)
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()));
}
// string message = 2;
if (this->message().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->message());
}
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 RegisterRSPS::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:LU.RegisterRSPS)
GOOGLE_DCHECK_NE(&from, this);
const RegisterRSPS* source =
::google::protobuf::internal::DynamicCastToGenerated<const RegisterRSPS>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:LU.RegisterRSPS)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:LU.RegisterRSPS)
MergeFrom(*source);
}
}
void RegisterRSPS::MergeFrom(const RegisterRSPS& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:LU.RegisterRSPS)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.message().size() > 0) {
message_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.message_);
}
}
void RegisterRSPS::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:LU.RegisterRSPS)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void RegisterRSPS::CopyFrom(const RegisterRSPS& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:LU.RegisterRSPS)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool RegisterRSPS::IsInitialized() const {
return true;
}
void RegisterRSPS::Swap(RegisterRSPS* other) {
if (other == this) return;
InternalSwap(other);
}
void RegisterRSPS::InternalSwap(RegisterRSPS* other) {
using std::swap;
message_.Swap(&other->message_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata RegisterRSPS::GetMetadata() const {
protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void ChatMSG::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int ChatMSG::kUinFieldNumber;
const int ChatMSG::kMessageFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
ChatMSG::ChatMSG()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_ServerMessageProto_2eproto::InitDefaultsChatMSG();
}
SharedCtor();
// @@protoc_insertion_point(constructor:LU.ChatMSG)
}
ChatMSG::ChatMSG(const ChatMSG& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
message_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.message().size() > 0) {
message_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.message_);
}
uin_ = from.uin_;
// @@protoc_insertion_point(copy_constructor:LU.ChatMSG)
}
void ChatMSG::SharedCtor() {
message_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
uin_ = 0;
_cached_size_ = 0;
}
ChatMSG::~ChatMSG() {
// @@protoc_insertion_point(destructor:LU.ChatMSG)
SharedDtor();
}
void ChatMSG::SharedDtor() {
message_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void ChatMSG::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ChatMSG::descriptor() {
::protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const ChatMSG& ChatMSG::default_instance() {
::protobuf_ServerMessageProto_2eproto::InitDefaultsChatMSG();
return *internal_default_instance();
}
ChatMSG* ChatMSG::New(::google::protobuf::Arena* arena) const {
ChatMSG* n = new ChatMSG;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void ChatMSG::Clear() {
// @@protoc_insertion_point(message_clear_start:LU.ChatMSG)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
message_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
uin_ = 0;
_internal_metadata_.Clear();
}
bool ChatMSG::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:LU.ChatMSG)
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)) {
// int32 uin = 2;
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::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &uin_)));
} else {
goto handle_unusual;
}
break;
}
// string message = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_message()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->message().data(), static_cast<int>(this->message().length()),
::google::protobuf::internal::WireFormatLite::PARSE,
"LU.ChatMSG.message"));
} 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:LU.ChatMSG)
return true;
failure:
// @@protoc_insertion_point(parse_failure:LU.ChatMSG)
return false;
#undef DO_
}
void ChatMSG::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:LU.ChatMSG)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// int32 uin = 2;
if (this->uin() != 0) {
::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->uin(), output);
}
// string message = 3;
if (this->message().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->message().data(), static_cast<int>(this->message().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"LU.ChatMSG.message");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
3, this->message(), 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:LU.ChatMSG)
}
::google::protobuf::uint8* ChatMSG::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:LU.ChatMSG)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// int32 uin = 2;
if (this->uin() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->uin(), target);
}
// string message = 3;
if (this->message().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->message().data(), static_cast<int>(this->message().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"LU.ChatMSG.message");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
3, this->message(), 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:LU.ChatMSG)
return target;
}
size_t ChatMSG::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:LU.ChatMSG)
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()));
}
// string message = 3;
if (this->message().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->message());
}
// int32 uin = 2;
if (this->uin() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->uin());
}
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 ChatMSG::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:LU.ChatMSG)
GOOGLE_DCHECK_NE(&from, this);
const ChatMSG* source =
::google::protobuf::internal::DynamicCastToGenerated<const ChatMSG>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:LU.ChatMSG)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:LU.ChatMSG)
MergeFrom(*source);
}
}
void ChatMSG::MergeFrom(const ChatMSG& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:LU.ChatMSG)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.message().size() > 0) {
message_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.message_);
}
if (from.uin() != 0) {
set_uin(from.uin());
}
}
void ChatMSG::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:LU.ChatMSG)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ChatMSG::CopyFrom(const ChatMSG& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:LU.ChatMSG)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool ChatMSG::IsInitialized() const {
return true;
}
void ChatMSG::Swap(ChatMSG* other) {
if (other == this) return;
InternalSwap(other);
}
void ChatMSG::InternalSwap(ChatMSG* other) {
using std::swap;
message_.Swap(&other->message_);
swap(uin_, other->uin_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata ChatMSG::GetMetadata() const {
protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void ChatRSPS::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int ChatRSPS::kUinFieldNumber;
const int ChatRSPS::kMessageFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
ChatRSPS::ChatRSPS()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_ServerMessageProto_2eproto::InitDefaultsChatRSPS();
}
SharedCtor();
// @@protoc_insertion_point(constructor:LU.ChatRSPS)
}
ChatRSPS::ChatRSPS(const ChatRSPS& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
message_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.message().size() > 0) {
message_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.message_);
}
uin_ = from.uin_;
// @@protoc_insertion_point(copy_constructor:LU.ChatRSPS)
}
void ChatRSPS::SharedCtor() {
message_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
uin_ = 0;
_cached_size_ = 0;
}
ChatRSPS::~ChatRSPS() {
// @@protoc_insertion_point(destructor:LU.ChatRSPS)
SharedDtor();
}
void ChatRSPS::SharedDtor() {
message_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void ChatRSPS::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ChatRSPS::descriptor() {
::protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const ChatRSPS& ChatRSPS::default_instance() {
::protobuf_ServerMessageProto_2eproto::InitDefaultsChatRSPS();
return *internal_default_instance();
}
ChatRSPS* ChatRSPS::New(::google::protobuf::Arena* arena) const {
ChatRSPS* n = new ChatRSPS;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void ChatRSPS::Clear() {
// @@protoc_insertion_point(message_clear_start:LU.ChatRSPS)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
message_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
uin_ = 0;
_internal_metadata_.Clear();
}
bool ChatRSPS::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:LU.ChatRSPS)
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)) {
// int32 uin = 2;
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::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &uin_)));
} else {
goto handle_unusual;
}
break;
}
// string message = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_message()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->message().data(), static_cast<int>(this->message().length()),
::google::protobuf::internal::WireFormatLite::PARSE,
"LU.ChatRSPS.message"));
} 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:LU.ChatRSPS)
return true;
failure:
// @@protoc_insertion_point(parse_failure:LU.ChatRSPS)
return false;
#undef DO_
}
void ChatRSPS::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:LU.ChatRSPS)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// int32 uin = 2;
if (this->uin() != 0) {
::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->uin(), output);
}
// string message = 3;
if (this->message().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->message().data(), static_cast<int>(this->message().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"LU.ChatRSPS.message");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
3, this->message(), 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:LU.ChatRSPS)
}
::google::protobuf::uint8* ChatRSPS::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:LU.ChatRSPS)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// int32 uin = 2;
if (this->uin() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->uin(), target);
}
// string message = 3;
if (this->message().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->message().data(), static_cast<int>(this->message().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"LU.ChatRSPS.message");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
3, this->message(), 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:LU.ChatRSPS)
return target;
}
size_t ChatRSPS::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:LU.ChatRSPS)
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()));
}
// string message = 3;
if (this->message().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->message());
}
// int32 uin = 2;
if (this->uin() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->uin());
}
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 ChatRSPS::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:LU.ChatRSPS)
GOOGLE_DCHECK_NE(&from, this);
const ChatRSPS* source =
::google::protobuf::internal::DynamicCastToGenerated<const ChatRSPS>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:LU.ChatRSPS)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:LU.ChatRSPS)
MergeFrom(*source);
}
}
void ChatRSPS::MergeFrom(const ChatRSPS& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:LU.ChatRSPS)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.message().size() > 0) {
message_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.message_);
}
if (from.uin() != 0) {
set_uin(from.uin());
}
}
void ChatRSPS::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:LU.ChatRSPS)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ChatRSPS::CopyFrom(const ChatRSPS& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:LU.ChatRSPS)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool ChatRSPS::IsInitialized() const {
return true;
}
void ChatRSPS::Swap(ChatRSPS* other) {
if (other == this) return;
InternalSwap(other);
}
void ChatRSPS::InternalSwap(ChatRSPS* other) {
using std::swap;
message_.Swap(&other->message_);
swap(uin_, other->uin_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata ChatRSPS::GetMetadata() const {
protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void MatchMSG::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int MatchMSG::kRoleFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
MatchMSG::MatchMSG()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_ServerMessageProto_2eproto::InitDefaultsMatchMSG();
}
SharedCtor();
// @@protoc_insertion_point(constructor:LU.MatchMSG)
}
MatchMSG::MatchMSG(const MatchMSG& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
role_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
if (from.role().size() > 0) {
role_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.role_);
}
// @@protoc_insertion_point(copy_constructor:LU.MatchMSG)
}
void MatchMSG::SharedCtor() {
role_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
_cached_size_ = 0;
}
MatchMSG::~MatchMSG() {
// @@protoc_insertion_point(destructor:LU.MatchMSG)
SharedDtor();
}
void MatchMSG::SharedDtor() {
role_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void MatchMSG::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* MatchMSG::descriptor() {
::protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const MatchMSG& MatchMSG::default_instance() {
::protobuf_ServerMessageProto_2eproto::InitDefaultsMatchMSG();
return *internal_default_instance();
}
MatchMSG* MatchMSG::New(::google::protobuf::Arena* arena) const {
MatchMSG* n = new MatchMSG;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void MatchMSG::Clear() {
// @@protoc_insertion_point(message_clear_start:LU.MatchMSG)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
role_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
_internal_metadata_.Clear();
}
bool MatchMSG::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:LU.MatchMSG)
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)) {
// string role = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_role()));
DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->role().data(), static_cast<int>(this->role().length()),
::google::protobuf::internal::WireFormatLite::PARSE,
"LU.MatchMSG.role"));
} 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:LU.MatchMSG)
return true;
failure:
// @@protoc_insertion_point(parse_failure:LU.MatchMSG)
return false;
#undef DO_
}
void MatchMSG::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:LU.MatchMSG)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// string role = 2;
if (this->role().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->role().data(), static_cast<int>(this->role().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"LU.MatchMSG.role");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->role(), 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:LU.MatchMSG)
}
::google::protobuf::uint8* MatchMSG::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:LU.MatchMSG)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// string role = 2;
if (this->role().size() > 0) {
::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
this->role().data(), static_cast<int>(this->role().length()),
::google::protobuf::internal::WireFormatLite::SERIALIZE,
"LU.MatchMSG.role");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->role(), 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:LU.MatchMSG)
return target;
}
size_t MatchMSG::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:LU.MatchMSG)
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()));
}
// string role = 2;
if (this->role().size() > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->role());
}
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 MatchMSG::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:LU.MatchMSG)
GOOGLE_DCHECK_NE(&from, this);
const MatchMSG* source =
::google::protobuf::internal::DynamicCastToGenerated<const MatchMSG>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:LU.MatchMSG)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:LU.MatchMSG)
MergeFrom(*source);
}
}
void MatchMSG::MergeFrom(const MatchMSG& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:LU.MatchMSG)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.role().size() > 0) {
role_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.role_);
}
}
void MatchMSG::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:LU.MatchMSG)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void MatchMSG::CopyFrom(const MatchMSG& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:LU.MatchMSG)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool MatchMSG::IsInitialized() const {
return true;
}
void MatchMSG::Swap(MatchMSG* other) {
if (other == this) return;
InternalSwap(other);
}
void MatchMSG::InternalSwap(MatchMSG* other) {
using std::swap;
role_.Swap(&other->role_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata MatchMSG::GetMetadata() const {
protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void MatchRSPS::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int MatchRSPS::kUinFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
MatchRSPS::MatchRSPS()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_ServerMessageProto_2eproto::InitDefaultsMatchRSPS();
}
SharedCtor();
// @@protoc_insertion_point(constructor:LU.MatchRSPS)
}
MatchRSPS::MatchRSPS(const MatchRSPS& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
uin_ = from.uin_;
// @@protoc_insertion_point(copy_constructor:LU.MatchRSPS)
}
void MatchRSPS::SharedCtor() {
uin_ = 0;
_cached_size_ = 0;
}
MatchRSPS::~MatchRSPS() {
// @@protoc_insertion_point(destructor:LU.MatchRSPS)
SharedDtor();
}
void MatchRSPS::SharedDtor() {
}
void MatchRSPS::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* MatchRSPS::descriptor() {
::protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const MatchRSPS& MatchRSPS::default_instance() {
::protobuf_ServerMessageProto_2eproto::InitDefaultsMatchRSPS();
return *internal_default_instance();
}
MatchRSPS* MatchRSPS::New(::google::protobuf::Arena* arena) const {
MatchRSPS* n = new MatchRSPS;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void MatchRSPS::Clear() {
// @@protoc_insertion_point(message_clear_start:LU.MatchRSPS)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
uin_ = 0;
_internal_metadata_.Clear();
}
bool MatchRSPS::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:LU.MatchRSPS)
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)) {
// int32 uin = 2;
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::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &uin_)));
} 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:LU.MatchRSPS)
return true;
failure:
// @@protoc_insertion_point(parse_failure:LU.MatchRSPS)
return false;
#undef DO_
}
void MatchRSPS::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:LU.MatchRSPS)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// int32 uin = 2;
if (this->uin() != 0) {
::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->uin(), 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:LU.MatchRSPS)
}
::google::protobuf::uint8* MatchRSPS::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:LU.MatchRSPS)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// int32 uin = 2;
if (this->uin() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->uin(), 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:LU.MatchRSPS)
return target;
}
size_t MatchRSPS::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:LU.MatchRSPS)
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()));
}
// int32 uin = 2;
if (this->uin() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->uin());
}
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 MatchRSPS::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:LU.MatchRSPS)
GOOGLE_DCHECK_NE(&from, this);
const MatchRSPS* source =
::google::protobuf::internal::DynamicCastToGenerated<const MatchRSPS>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:LU.MatchRSPS)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:LU.MatchRSPS)
MergeFrom(*source);
}
}
void MatchRSPS::MergeFrom(const MatchRSPS& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:LU.MatchRSPS)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
if (from.uin() != 0) {
set_uin(from.uin());
}
}
void MatchRSPS::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:LU.MatchRSPS)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void MatchRSPS::CopyFrom(const MatchRSPS& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:LU.MatchRSPS)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool MatchRSPS::IsInitialized() const {
return true;
}
void MatchRSPS::Swap(MatchRSPS* other) {
if (other == this) return;
InternalSwap(other);
}
void MatchRSPS::InternalSwap(MatchRSPS* other) {
using std::swap;
swap(uin_, other->uin_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata MatchRSPS::GetMetadata() const {
protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void SCStartGame::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int SCStartGame::kUinsFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
SCStartGame::SCStartGame()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_ServerMessageProto_2eproto::InitDefaultsSCStartGame();
}
SharedCtor();
// @@protoc_insertion_point(constructor:LU.SCStartGame)
}
SCStartGame::SCStartGame(const SCStartGame& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
uins_(from.uins_),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
// @@protoc_insertion_point(copy_constructor:LU.SCStartGame)
}
void SCStartGame::SharedCtor() {
_cached_size_ = 0;
}
SCStartGame::~SCStartGame() {
// @@protoc_insertion_point(destructor:LU.SCStartGame)
SharedDtor();
}
void SCStartGame::SharedDtor() {
}
void SCStartGame::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* SCStartGame::descriptor() {
::protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const SCStartGame& SCStartGame::default_instance() {
::protobuf_ServerMessageProto_2eproto::InitDefaultsSCStartGame();
return *internal_default_instance();
}
SCStartGame* SCStartGame::New(::google::protobuf::Arena* arena) const {
SCStartGame* n = new SCStartGame;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void SCStartGame::Clear() {
// @@protoc_insertion_point(message_clear_start:LU.SCStartGame)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
uins_.Clear();
_internal_metadata_.Clear();
}
bool SCStartGame::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:LU.SCStartGame)
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)) {
// repeated int32 uins = 2;
case 2: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(18u /* 18 & 0xFF */)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, this->mutable_uins())));
} else if (
static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
1, 18u, input, this->mutable_uins())));
} 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:LU.SCStartGame)
return true;
failure:
// @@protoc_insertion_point(parse_failure:LU.SCStartGame)
return false;
#undef DO_
}
void SCStartGame::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:LU.SCStartGame)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated int32 uins = 2;
if (this->uins_size() > 0) {
::google::protobuf::internal::WireFormatLite::WriteTag(2, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
output->WriteVarint32(static_cast< ::google::protobuf::uint32>(
_uins_cached_byte_size_));
}
for (int i = 0, n = this->uins_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteInt32NoTag(
this->uins(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:LU.SCStartGame)
}
::google::protobuf::uint8* SCStartGame::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:LU.SCStartGame)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated int32 uins = 2;
if (this->uins_size() > 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
2,
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
static_cast< ::google::protobuf::int32>(
_uins_cached_byte_size_), target);
target = ::google::protobuf::internal::WireFormatLite::
WriteInt32NoTagToArray(this->uins_, 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:LU.SCStartGame)
return target;
}
size_t SCStartGame::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:LU.SCStartGame)
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 int32 uins = 2;
{
size_t data_size = ::google::protobuf::internal::WireFormatLite::
Int32Size(this->uins_);
if (data_size > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
static_cast< ::google::protobuf::int32>(data_size));
}
int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_uins_cached_byte_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
total_size += data_size;
}
int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void SCStartGame::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:LU.SCStartGame)
GOOGLE_DCHECK_NE(&from, this);
const SCStartGame* source =
::google::protobuf::internal::DynamicCastToGenerated<const SCStartGame>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:LU.SCStartGame)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:LU.SCStartGame)
MergeFrom(*source);
}
}
void SCStartGame::MergeFrom(const SCStartGame& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:LU.SCStartGame)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
uins_.MergeFrom(from.uins_);
}
void SCStartGame::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:LU.SCStartGame)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void SCStartGame::CopyFrom(const SCStartGame& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:LU.SCStartGame)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool SCStartGame::IsInitialized() const {
return true;
}
void SCStartGame::Swap(SCStartGame* other) {
if (other == this) return;
InternalSwap(other);
}
void SCStartGame::InternalSwap(SCStartGame* other) {
using std::swap;
uins_.InternalSwap(&other->uins_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata SCStartGame::GetMetadata() const {
protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void CSFrameNotify::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int CSFrameNotify::kUinFieldNumber;
const int CSFrameNotify::kKeysFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
CSFrameNotify::CSFrameNotify()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_ServerMessageProto_2eproto::InitDefaultsCSFrameNotify();
}
SharedCtor();
// @@protoc_insertion_point(constructor:LU.CSFrameNotify)
}
CSFrameNotify::CSFrameNotify(const CSFrameNotify& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
keys_(from.keys_),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
uin_ = from.uin_;
// @@protoc_insertion_point(copy_constructor:LU.CSFrameNotify)
}
void CSFrameNotify::SharedCtor() {
uin_ = 0;
_cached_size_ = 0;
}
CSFrameNotify::~CSFrameNotify() {
// @@protoc_insertion_point(destructor:LU.CSFrameNotify)
SharedDtor();
}
void CSFrameNotify::SharedDtor() {
}
void CSFrameNotify::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CSFrameNotify::descriptor() {
::protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const CSFrameNotify& CSFrameNotify::default_instance() {
::protobuf_ServerMessageProto_2eproto::InitDefaultsCSFrameNotify();
return *internal_default_instance();
}
CSFrameNotify* CSFrameNotify::New(::google::protobuf::Arena* arena) const {
CSFrameNotify* n = new CSFrameNotify;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void CSFrameNotify::Clear() {
// @@protoc_insertion_point(message_clear_start:LU.CSFrameNotify)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
keys_.Clear();
uin_ = 0;
_internal_metadata_.Clear();
}
bool CSFrameNotify::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:LU.CSFrameNotify)
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)) {
// int32 uin = 2;
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::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &uin_)));
} else {
goto handle_unusual;
}
break;
}
// repeated int32 keys = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(26u /* 26 & 0xFF */)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, this->mutable_keys())));
} else if (
static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(24u /* 24 & 0xFF */)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
1, 26u, input, this->mutable_keys())));
} 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:LU.CSFrameNotify)
return true;
failure:
// @@protoc_insertion_point(parse_failure:LU.CSFrameNotify)
return false;
#undef DO_
}
void CSFrameNotify::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:LU.CSFrameNotify)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// int32 uin = 2;
if (this->uin() != 0) {
::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->uin(), output);
}
// repeated int32 keys = 3;
if (this->keys_size() > 0) {
::google::protobuf::internal::WireFormatLite::WriteTag(3, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output);
output->WriteVarint32(static_cast< ::google::protobuf::uint32>(
_keys_cached_byte_size_));
}
for (int i = 0, n = this->keys_size(); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteInt32NoTag(
this->keys(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:LU.CSFrameNotify)
}
::google::protobuf::uint8* CSFrameNotify::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:LU.CSFrameNotify)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// int32 uin = 2;
if (this->uin() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(2, this->uin(), target);
}
// repeated int32 keys = 3;
if (this->keys_size() > 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray(
3,
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED,
target);
target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray(
static_cast< ::google::protobuf::int32>(
_keys_cached_byte_size_), target);
target = ::google::protobuf::internal::WireFormatLite::
WriteInt32NoTagToArray(this->keys_, 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:LU.CSFrameNotify)
return target;
}
size_t CSFrameNotify::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:LU.CSFrameNotify)
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 int32 keys = 3;
{
size_t data_size = ::google::protobuf::internal::WireFormatLite::
Int32Size(this->keys_);
if (data_size > 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
static_cast< ::google::protobuf::int32>(data_size));
}
int cached_size = ::google::protobuf::internal::ToCachedSize(data_size);
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_keys_cached_byte_size_ = cached_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
total_size += data_size;
}
// int32 uin = 2;
if (this->uin() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->uin());
}
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 CSFrameNotify::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:LU.CSFrameNotify)
GOOGLE_DCHECK_NE(&from, this);
const CSFrameNotify* source =
::google::protobuf::internal::DynamicCastToGenerated<const CSFrameNotify>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:LU.CSFrameNotify)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:LU.CSFrameNotify)
MergeFrom(*source);
}
}
void CSFrameNotify::MergeFrom(const CSFrameNotify& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:LU.CSFrameNotify)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
keys_.MergeFrom(from.keys_);
if (from.uin() != 0) {
set_uin(from.uin());
}
}
void CSFrameNotify::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:LU.CSFrameNotify)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CSFrameNotify::CopyFrom(const CSFrameNotify& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:LU.CSFrameNotify)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CSFrameNotify::IsInitialized() const {
return true;
}
void CSFrameNotify::Swap(CSFrameNotify* other) {
if (other == this) return;
InternalSwap(other);
}
void CSFrameNotify::InternalSwap(CSFrameNotify* other) {
using std::swap;
keys_.InternalSwap(&other->keys_);
swap(uin_, other->uin_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata CSFrameNotify::GetMetadata() const {
protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages];
}
// ===================================================================
void SCFrameNotify::InitAsDefaultInstance() {
}
#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int SCFrameNotify::kKeysFieldNumber;
const int SCFrameNotify::kCurrentFrameFieldNumber;
const int SCFrameNotify::kNextFrameFieldNumber;
#endif // !defined(_MSC_VER) || _MSC_VER >= 1900
SCFrameNotify::SCFrameNotify()
: ::google::protobuf::Message(), _internal_metadata_(NULL) {
if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
::protobuf_ServerMessageProto_2eproto::InitDefaultsSCFrameNotify();
}
SharedCtor();
// @@protoc_insertion_point(constructor:LU.SCFrameNotify)
}
SCFrameNotify::SCFrameNotify(const SCFrameNotify& from)
: ::google::protobuf::Message(),
_internal_metadata_(NULL),
keys_(from.keys_),
_cached_size_(0) {
_internal_metadata_.MergeFrom(from._internal_metadata_);
::memcpy(¤tframe_, &from.currentframe_,
static_cast<size_t>(reinterpret_cast<char*>(&nextframe_) -
reinterpret_cast<char*>(¤tframe_)) + sizeof(nextframe_));
// @@protoc_insertion_point(copy_constructor:LU.SCFrameNotify)
}
void SCFrameNotify::SharedCtor() {
::memset(¤tframe_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&nextframe_) -
reinterpret_cast<char*>(¤tframe_)) + sizeof(nextframe_));
_cached_size_ = 0;
}
SCFrameNotify::~SCFrameNotify() {
// @@protoc_insertion_point(destructor:LU.SCFrameNotify)
SharedDtor();
}
void SCFrameNotify::SharedDtor() {
}
void SCFrameNotify::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* SCFrameNotify::descriptor() {
::protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}
const SCFrameNotify& SCFrameNotify::default_instance() {
::protobuf_ServerMessageProto_2eproto::InitDefaultsSCFrameNotify();
return *internal_default_instance();
}
SCFrameNotify* SCFrameNotify::New(::google::protobuf::Arena* arena) const {
SCFrameNotify* n = new SCFrameNotify;
if (arena != NULL) {
arena->Own(n);
}
return n;
}
void SCFrameNotify::Clear() {
// @@protoc_insertion_point(message_clear_start:LU.SCFrameNotify)
::google::protobuf::uint32 cached_has_bits = 0;
// Prevent compiler warnings about cached_has_bits being unused
(void) cached_has_bits;
keys_.Clear();
::memset(¤tframe_, 0, static_cast<size_t>(
reinterpret_cast<char*>(&nextframe_) -
reinterpret_cast<char*>(¤tframe_)) + sizeof(nextframe_));
_internal_metadata_.Clear();
}
bool SCFrameNotify::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:LU.SCFrameNotify)
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)) {
// repeated .LU.CSFrameNotify keys = 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, add_keys()));
} else {
goto handle_unusual;
}
break;
}
// int32 currentFrame = 3;
case 3: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(24u /* 24 & 0xFF */)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, ¤tframe_)));
} else {
goto handle_unusual;
}
break;
}
// int32 nextFrame = 4;
case 4: {
if (static_cast< ::google::protobuf::uint8>(tag) ==
static_cast< ::google::protobuf::uint8>(32u /* 32 & 0xFF */)) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &nextframe_)));
} 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:LU.SCFrameNotify)
return true;
failure:
// @@protoc_insertion_point(parse_failure:LU.SCFrameNotify)
return false;
#undef DO_
}
void SCFrameNotify::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:LU.SCFrameNotify)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated .LU.CSFrameNotify keys = 2;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->keys_size()); i < n; i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->keys(static_cast<int>(i)), output);
}
// int32 currentFrame = 3;
if (this->currentframe() != 0) {
::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->currentframe(), output);
}
// int32 nextFrame = 4;
if (this->nextframe() != 0) {
::google::protobuf::internal::WireFormatLite::WriteInt32(4, this->nextframe(), 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:LU.SCFrameNotify)
}
::google::protobuf::uint8* SCFrameNotify::InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* target) const {
(void)deterministic; // Unused
// @@protoc_insertion_point(serialize_to_array_start:LU.SCFrameNotify)
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
// repeated .LU.CSFrameNotify keys = 2;
for (unsigned int i = 0,
n = static_cast<unsigned int>(this->keys_size()); i < n; i++) {
target = ::google::protobuf::internal::WireFormatLite::
InternalWriteMessageToArray(
2, this->keys(static_cast<int>(i)), deterministic, target);
}
// int32 currentFrame = 3;
if (this->currentframe() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->currentframe(), target);
}
// int32 nextFrame = 4;
if (this->nextframe() != 0) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(4, this->nextframe(), 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:LU.SCFrameNotify)
return target;
}
size_t SCFrameNotify::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:LU.SCFrameNotify)
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 .LU.CSFrameNotify keys = 2;
{
unsigned int count = static_cast<unsigned int>(this->keys_size());
total_size += 1UL * count;
for (unsigned int i = 0; i < count; i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSize(
this->keys(static_cast<int>(i)));
}
}
// int32 currentFrame = 3;
if (this->currentframe() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->currentframe());
}
// int32 nextFrame = 4;
if (this->nextframe() != 0) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->nextframe());
}
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 SCFrameNotify::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:LU.SCFrameNotify)
GOOGLE_DCHECK_NE(&from, this);
const SCFrameNotify* source =
::google::protobuf::internal::DynamicCastToGenerated<const SCFrameNotify>(
&from);
if (source == NULL) {
// @@protoc_insertion_point(generalized_merge_from_cast_fail:LU.SCFrameNotify)
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
// @@protoc_insertion_point(generalized_merge_from_cast_success:LU.SCFrameNotify)
MergeFrom(*source);
}
}
void SCFrameNotify::MergeFrom(const SCFrameNotify& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:LU.SCFrameNotify)
GOOGLE_DCHECK_NE(&from, this);
_internal_metadata_.MergeFrom(from._internal_metadata_);
::google::protobuf::uint32 cached_has_bits = 0;
(void) cached_has_bits;
keys_.MergeFrom(from.keys_);
if (from.currentframe() != 0) {
set_currentframe(from.currentframe());
}
if (from.nextframe() != 0) {
set_nextframe(from.nextframe());
}
}
void SCFrameNotify::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:LU.SCFrameNotify)
if (&from == this) return;
Clear();
MergeFrom(from);
}
void SCFrameNotify::CopyFrom(const SCFrameNotify& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:LU.SCFrameNotify)
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool SCFrameNotify::IsInitialized() const {
return true;
}
void SCFrameNotify::Swap(SCFrameNotify* other) {
if (other == this) return;
InternalSwap(other);
}
void SCFrameNotify::InternalSwap(SCFrameNotify* other) {
using std::swap;
keys_.InternalSwap(&other->keys_);
swap(currentframe_, other->currentframe_);
swap(nextframe_, other->nextframe_);
_internal_metadata_.Swap(&other->_internal_metadata_);
swap(_cached_size_, other->_cached_size_);
}
::google::protobuf::Metadata SCFrameNotify::GetMetadata() const {
protobuf_ServerMessageProto_2eproto::protobuf_AssignDescriptorsOnce();
return ::protobuf_ServerMessageProto_2eproto::file_level_metadata[kIndexInFileMessages];
}
// @@protoc_insertion_point(namespace_scope)
} // namespace LU
// @@protoc_insertion_point(global_scope)
| [
"765070327@qq.com"
] | 765070327@qq.com |
c7409064cbdc29e97d4296abe37e4e597cb4337b | 711e5c8b643dd2a93fbcbada982d7ad489fb0169 | /XPSP1/NT/multimedia/danim/src/appel/ctx/viewport.cpp | 4cdf6566569e1295a33d8c6b7a46b2c72d589ae8 | [] | no_license | aurantst/windows-XP-SP1 | 629a7763c082fd04d3b881e0d32a1cfbd523b5ce | d521b6360fcff4294ae6c5651c539f1b9a6cbb49 | refs/heads/master | 2023-03-21T01:08:39.870106 | 2020-09-28T08:10:11 | 2020-09-28T08:10:11 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 124,003 | cpp | /*******************************************************************************
Copyright (c) 1996-1998 Microsoft Corporation. All rights reserved.
Implements the DirectDraw viewport class which contains all per window
ddraw information.
*******************************************************************************/
#include "headers.h"
#include <math.h>
#include <ddraw.h>
#include <ddrawex.h>
#include <htmlfilter.h> // trident stuff
#include "appelles/hacks.h"
#include "appelles/bbox2.h"
#include "privinc/ddutil.h"
#include "privinc/imgdev.h"
#include "privinc/solidImg.h"
#include "privinc/dibimage.h"
#include "privinc/overimg.h"
#include "privinc/xform2i.h"
#include "privinc/bbox2i.h"
#include "appelles/text.h"
#include "privinc/texti.h"
#include "privinc/textctx.h"
#include "privinc/dddevice.h"
#include "privinc/viewport.h"
#include "privinc/ddrender.h"
#include "privinc/geomimg.h"
#include "privinc/debug.h"
#include "privinc/registry.h"
#include "privinc/except.h"
#include "privinc/util.h"
#include "privinc/d3dutil.h"
#include "privinc/resource.h"
#include "privinc/comutil.h"
#include <privinc/SurfaceManager.h>
#include <dxtrans.h>
//---------------------------------------------------------
// Local functions
//---------------------------------------------------------
// globals
bool g_preference_UseVideoMemory = false;
COLORREF g_preference_defaultColorKey = 0;
static HINSTANCE hInstDDraw = NULL;
static IDirectDrawFactory *g_surfFact = NULL;
static CritSect *DDrawCritSect = NULL;
static bool g_ddraw3Avail = false;
static CritSect *g_viewportListLock = NULL;
#define SHARE_DDRAW 0
#if SHARE_DDRAW
static IDirectDraw *g_DirectDraw1 = NULL;
static IDirectDraw2 *g_DirectDraw2 = NULL;
static IDirectDraw3 *g_DirectDraw3 = NULL;
static IDDrawSurface *g_primarySurface = NULL;
#endif
//
// Given at least one ddraw object, fills in the
// remaining ddraw objects using qi
//
void CompleteDdrawObjectSet(IDirectDraw **directDraw1,
IDirectDraw2 **directDraw2,
IDirectDraw3 **directDraw3);
#if _DEBUG
void DrawRect(HDC dc, RECT *rect,
int r, int g, int b,
int a1, int a2, int a3)
{
COLORREF c = RGB(r,g,b);
HBRUSH brush = CreateSolidBrush(c);
::FrameRect(dc, rect, brush);
DeleteObject(brush);
}
void DrawRect(DDSurface *surf, RECT *rect,
int r, int g, int b,
int a1, int a2, int a3)
{
HDC dc = surf->GetDC("no dc for drawRec");
COLORREF c = RGB(r,g,b);
HBRUSH brush = CreateSolidBrush(c);
HRGN oldrgn = NULL;
GetClipRgn(dc, oldrgn);
SelectClipRgn(dc, NULL);
::FrameRect(dc, rect, brush);
SelectClipRgn(dc, oldrgn);
DeleteObject(brush);
surf->ReleaseDC("yeehaw");
}
void DrawRect(DDSurface *surf, const Bbox2 &bbox,
int height, int width, Real res,
int red, int g, int b)
{
#define P2R(p,res) (Real(p) / res)
RECT r;
r.left = width/2 + P2R(bbox.min.x , res);
r.right = width/2 + P2R(bbox.max.x , res);
r.top = height/2 - P2R(bbox.max.y , res);
r.bottom = height/2 - P2R(bbox.min.y , res);
HDC dc = surf->GetDC("no dc for drawRec");
COLORREF c = RGB(red,g,b);
HBRUSH brush = CreateSolidBrush(c);
::FrameRect(dc, &r, brush);
DeleteObject(brush);
surf->ReleaseDC("yeehaw");
}
#endif
//---------------------------------------------------------
// Global viewport list management
//---------------------------------------------------------
typedef set< DirectDrawViewport *, less<DirectDrawViewport *> > ViewportSet_t;
ViewportSet_t g_viewportSet;
void GlobalViewportList_Add(DirectDrawViewport *vp)
{
Assert(vp);
CritSectGrabber csg(*g_viewportListLock);
g_viewportSet.insert(vp);
}
void GlobalViewportList_Remove(DirectDrawViewport *vp)
{
Assert(vp);
CritSectGrabber csg(*g_viewportListLock);
g_viewportSet.erase(vp);
}
//---------------------------------------------------------
// Local Helper functions
//---------------------------------------------------------
void CopyOrClearRect(RECT **src, RECT **dest, bool clear = TRUE);
// Includes IfErrorXXXX inline functions
#include "privinc/error.h"
static int LeastSigBit(DWORD dword)
{
int s;
for (s = 0; dword && !(dword & 1); s++, dword >>= 1);
return s;
}
static int MostSigBit(DWORD dword)
{
int s;
for (s = 0; dword; s++, dword >>= 1);
return s;
}
void LogFontW2A(LPLOGFONTW plfW, LPLOGFONTA plfA)
{
plfA->lfHeight = plfW->lfHeight;
plfA->lfWidth = plfW->lfWidth;
plfA->lfEscapement = plfW->lfEscapement;
plfA->lfOrientation = plfW->lfOrientation;
plfA->lfWeight = plfW->lfWeight;
plfA->lfItalic = plfW->lfItalic;
plfA->lfUnderline = plfW->lfUnderline;
plfA->lfStrikeOut = plfW->lfStrikeOut;
plfA->lfCharSet = plfW->lfCharSet;
plfA->lfOutPrecision = plfW->lfOutPrecision;
plfA->lfClipPrecision = plfW->lfClipPrecision;
plfA->lfQuality = plfW->lfQuality;
plfA->lfPitchAndFamily = plfW->lfPitchAndFamily;
WideCharToMultiByte(CP_ACP, 0, plfW->lfFaceName, LF_FACESIZE, plfA->lfFaceName, LF_FACESIZE, NULL, NULL);
}
void LogFontA2W(LPLOGFONTA plfA, LPLOGFONTW plfW)
{
plfW->lfHeight = plfA->lfHeight;
plfW->lfWidth = plfA->lfWidth;
plfW->lfEscapement = plfA->lfEscapement;
plfW->lfOrientation = plfA->lfOrientation;
plfW->lfWeight = plfA->lfWeight;
plfW->lfItalic = plfA->lfItalic;
plfW->lfUnderline = plfA->lfUnderline;
plfW->lfStrikeOut = plfA->lfStrikeOut;
plfW->lfCharSet = plfA->lfCharSet;
plfW->lfOutPrecision = plfA->lfOutPrecision;
plfW->lfClipPrecision = plfA->lfClipPrecision;
plfW->lfQuality = plfA->lfQuality;
plfW->lfPitchAndFamily = plfA->lfPitchAndFamily;
MultiByteToWideChar(CP_ACP, 0, plfA->lfFaceName, LF_FACESIZE, plfW->lfFaceName, LF_FACESIZE);
}
int CALLBACK MyEnumFontFamProc(const LOGFONTA *plf,
const TEXTMETRIC *ptm,
DWORD dwFontType,
LPARAM lparam)
{
LOGFONTA *plfOut = (LOGFONTA*)lparam;
if (plfOut==NULL)
return (int)(E_POINTER);
memcpy(plfOut, plf, sizeof(LOGFONTA));
return 0;
} // EnumFontFamCB
int MyEnumFontFamiliesEx(HDC hdcScreen, LPLOGFONTW plfIn, FONTENUMPROCA EnumFontFamProc, LPLOGFONTW plfOut)
{
LOGFONTA lfInA;
LOGFONTA lfOutA;
//Work in ansi so that we can use one code path for both win9x and NT
LogFontW2A(plfIn, &lfInA);
int ret = EnumFontFamiliesExA(hdcScreen, &lfInA, EnumFontFamProc, (LPARAM)(&lfOutA), 0);
plfOut->lfCharSet = lfOutA.lfCharSet;
MultiByteToWideChar(CP_ACP, 0, lfOutA.lfFaceName, LF_FACESIZE, plfOut->lfFaceName, LF_FACESIZE);
return ret;
}
// TODO: Do not call functions w/o completely initializing the object
DirectDrawViewport::DirectDrawViewport() :
_heapIWasCreatedOn(GetHeapOnTopOfStack())
{
// Clear all member data.
_onDeathRow = false;
_usingExternalDdraw = false;
_opacityCompositionException = false;
_tmpDev = 0;
_directDraw = 0;
_directDraw1 = 0;
_directDraw2 = 0;
_directDraw3 = 0;
_primSurface = 0;
_primaryClipper = 0;
_targetSurfaceClipper = NULL;
_externalTargetDDSurface = NULL;
_externalTargetDDSurfaceClipper = NULL;
_oldExternalTargetDDSurfaceClipper = NULL;
_finalDDpalette = NULL;
_halftoneDDpalette = NULL;
_halftoneHPal = NULL;
_resolution = 0;
_width = 0;
_height = 0;
_canDisplay = false;
_canFinalBlit = false;
_windowResize = 0;
_deviceInitialized = FALSE;
_defaultColorKey = 0;
_currentImageDev = NULL;
_targetPackage.Reset(false);
_oldtargetPackage.Reset();
_retreivedPrimaryPixelFormat = false;
_targetPixelFormatIsSet = false;
_surfaceManager = 0;
_imageSurfaceMap = 0;
_imageTextureSurfaceMap = 0;
_imageUpsideDownTextureSurfaceMap = 0;
_freeCompositingSurfaces = 0;
_compositingStack = 0;
_zbufferSurfaces = 0;
_surfMgrSet = false;
#if _DEBUG
_externalTargetDDSurface._reason = "_externalTargetDDSurface";
_externalTargetDDSurface._client = this;
#endif
//
// Add myself to the global viewport list last
//
GlobalViewportList_Add(this);
}
void DirectDrawViewport::
PostConstructorInitialize()
{
//
// Get an image renderer to use
//
_currentImageDev = PopImageDevice();
Assert(_currentImageDev);
// not used
//_deviceDepth = BitsPerDisplayPixel();
//
// Get pixel format (needs to happen after we're sure we can
// create ddraw object
//
if (!_retreivedPrimaryPixelFormat) {
IDirectDrawSurface *primarySurf;
IDirectDraw2 *ddraw2;
if( SUCCEEDED( GetDirectDraw(NULL, &ddraw2, NULL) ) ){
if( SUCCEEDED( GetPrimarySurface(ddraw2, NULL, &primarySurf) )) {
_primaryPixelFormat.dwSize = sizeof(_primaryPixelFormat);
if( SUCCEEDED(primarySurf->GetPixelFormat(&_primaryPixelFormat))){
_retreivedPrimaryPixelFormat = true;
}
primarySurf->Release();
}
ddraw2->Release();
}
}
_resolution = ViewerResolution();
_deviceInitialized = FALSE;
//
//
//
SetUpDx2D();
//
// Assert that NO directdraw objects are created
//
Assert( !_directDraw && !_directDraw1 &&
!_directDraw2 && !_directDraw3 );
InitializeDevice(); // if can init on startup, go for it.
}
void DirectDrawViewport::
SetUpSurfaceManagement( DDPIXELFORMAT &ddpf )
{
//
// Set up surface manager
//
_surfaceManager = NEW SurfaceManager(*this);
//
// Set up surface maps: owned by surfaceManager
//
_imageSurfaceMap = NEW SurfaceMap(*_surfaceManager, ddpf);
_imageTextureSurfaceMap = NEW SurfaceMap(*_surfaceManager, ddpf, isTexture);
_imageUpsideDownTextureSurfaceMap = NEW SurfaceMap(*_surfaceManager, ddpf, isTexture);
//
// Set up compositing surfaces pool: owned by surfaceManager
//
_freeCompositingSurfaces = NEW SurfacePool(*_surfaceManager, ddpf);
//
// Set up compositing stack: owned by surfaceManager too
//
_compositingStack = NEW CompositingStack(*this, *_freeCompositingSurfaces);
//
// Set up zbuffer surface pools: owned by surfaceManager
//
// TODO: set up pixel format for the zbuffers
DDPIXELFORMAT zbuffPf;
ZeroMemory( &zbuffPf, sizeof( DDPIXELFORMAT ));
zbuffPf.dwSize = sizeof(DDPIXELFORMAT);
zbuffPf.dwFlags = DDPF_ZBUFFER;
zbuffPf.dwRGBBitCount = 16;
zbuffPf.dwGBitMask = 0xffff;
_zbufferSurfaces = NEW SurfacePool(*_surfaceManager, zbuffPf);
#if _DEBUGSURFACE
// allocate a surfaceTracker
_debugonly_surfaceTracker = NEW SurfaceTracker();
#endif
_surfMgrSet = true;
}
void DirectDrawViewport::
SetUpDx2D()
{
bool ok = false;
_ddrval = ::CoCreateInstance( CLSID_DX2D, NULL, CLSCTX_INPROC,
IID_IDX2D, (void **)&_dx2d );
if( FAILED(_ddrval) ) {
TraceTag((tagError, "Couldn't find Dx2D: continuing without antialising"));
_dx2d = NULL;
_IDXTransformFactory = NULL;
_IDXSurfaceFactory = NULL;
ok = true;
} else {
//--- Create the transform factory
_ddrval = ::CoCreateInstance( CLSID_DXTransformFactory,
NULL, CLSCTX_INPROC,
IID_IDXTransformFactory,
(void **)&_IDXTransformFactory );
if( SUCCEEDED( _ddrval ) ) {
_ddrval = _IDXTransformFactory->QueryInterface(IID_IDXSurfaceFactory, (void **)&_IDXSurfaceFactory);
if( SUCCEEDED( _ddrval ) ) {
_ddrval = _dx2d->SetTransformFactory( _IDXTransformFactory );
if( SUCCEEDED( _ddrval ) ) {
ok = true;
}
}
}
}
if( !ok ) {
// this error isn't good. what should we raise if we expect
// to find the transform factory, but we don't ?
RaiseException_ResourceError();
}
}
void DirectDrawViewport::
InitializeDevice()
{
if(_deviceInitialized) return;
// Check for window size
UpdateWindowMembers();
if(Width() <= 0 || Height() <= 0) {
_deviceInitialized = FALSE;
// can't do it.
return;
}
Assert(!_deviceInitialized);
ConstructDdrawMembers();
#if _DEBUG
if(_targetDescriptor._pixelFormat.dwFlags & DDPF_ZBUFFER) {
_deviceInitialized = FALSE;
Assert(FALSE && "Target Surface is a Zbuffer!!!");
// can't do it.
return;
}
#endif
//
// Cache some info about pixel format
//
if( GetTargetBitDepth() == 8 ) {
// Paletized
} else {
// not paletized
_targetDescriptor._redShift = (CHAR)LeastSigBit(_targetDescriptor._pixelFormat.dwRBitMask);
_targetDescriptor._greenShift = (CHAR)LeastSigBit(_targetDescriptor._pixelFormat.dwGBitMask);
_targetDescriptor._blueShift = (CHAR)LeastSigBit(_targetDescriptor._pixelFormat.dwBBitMask);
_targetDescriptor._redWidth = (CHAR)MostSigBit(_targetDescriptor._pixelFormat.dwRBitMask
>> _targetDescriptor._redShift);
_targetDescriptor._greenWidth = (CHAR)MostSigBit(_targetDescriptor._pixelFormat.dwGBitMask
>> _targetDescriptor._greenShift);
_targetDescriptor._blueWidth = (CHAR)MostSigBit(_targetDescriptor._pixelFormat.dwBBitMask
>> _targetDescriptor._blueShift);
// Shift a 8bit value right to truncate
_targetDescriptor._redTrunc = 8 - _targetDescriptor._redWidth ;
_targetDescriptor._greenTrunc = 8 - _targetDescriptor._greenWidth;
_targetDescriptor._blueTrunc = 8 - _targetDescriptor._blueWidth ;
// rgb value range: 0 to (2^n - 1)
_targetDescriptor._red = Real((1 << _targetDescriptor._redWidth) - 1);
_targetDescriptor._green = Real((1 << _targetDescriptor._greenWidth) - 1);
_targetDescriptor._blue = Real((1 << _targetDescriptor._blueWidth) - 1);
TraceTag((tagViewportInformative,
"Pixel Format: shift (%d, %d, %d) width (%d, %d, %d)",
_targetDescriptor._redShift,
_targetDescriptor._greenShift,
_targetDescriptor._blueShift,
_targetDescriptor._redWidth,
_targetDescriptor._greenWidth,
_targetDescriptor._blueWidth));
}
_targetDescriptor.isReady = true;
// MapColorToDWORD uses ddraw
_defaultColorKey = MapColorToDWORD(g_preference_defaultColorKey);
// remove alpha bit mask bits from the default color key
_defaultColorKey &= ~_targetDescriptor._pixelFormat.dwRGBAlphaBitMask;
TraceTag((tagViewportInformative,
"Default color key is (%d, %d, %d)",
GetRValue(g_preference_defaultColorKey),
GetGValue(g_preference_defaultColorKey),
GetBValue(g_preference_defaultColorKey) ));
// Perform the initial clear on the viewport
Clear();
_deviceInitialized = TRUE;
}
void DirectDrawViewport::
DestroyTargetSurfaces()
{
if (_compositingStack) {
_compositingStack->ReleaseAndEmpty();
_compositingStack->ReleaseScratch();
}
}
void DirectDrawViewport::
DestroySizeDependentDDMembers()
{
DestroyTargetSurfaces();
DestroyCompositingSurfaces();
DestroyZBufferSurfaces();
RELEASE(_targetSurfaceClipper);
}
DirectDrawViewport::~DirectDrawViewport()
{
//TIME_GDI( DeleteObject(_targetPackage._clipRgn) );
// Destroy all devices on _deviceStack
while(!_deviceStack.empty()) {
delete PopImageDevice();
}
delete _currentImageDev;
DestroyTargetSurfaces(); // deletes everything but the external
// compositing surface....
delete _surfaceManager;
//
// Kill stuff associated with target trident surfaces
//
if(_targetPackage._targetDDSurf && _targetPackage.IsDdsurf()) {
_targetPackage._targetDDSurf->DestroyGeomDevice();
_targetPackage._targetDDSurf->IDDSurface()->SetClipper(NULL);
if(_externalTargetDDSurfaceClipper) {
_externalTargetDDSurfaceClipper->Release();
_externalTargetDDSurfaceClipper = NULL;
}
}
// As far as I can tell, DDRAW deletes attached clippers,
// but not attached surfaces.
FASTRELEASE(_targetSurfaceClipper);
FASTRELEASE(_halftoneDDpalette);
FASTRELEASE(_finalDDpalette);
if(_halftoneHPal) {
DeleteObject(_halftoneHPal);
}
//
// delete targetPackage members
//
_targetPackage.Reset(true);
FASTRELEASE(_primSurface);
ReleaseIDirectDrawObjects();
TraceTag((tagViewportInformative, ">>> Viewport Destructor <<<"));
// Remove us from the global viewport list. atomic
GlobalViewportList_Remove(this);
// _dx2d is a DAComPtr
}
void DirectDrawViewport::
ClearSurface(DDSurface *dds, DWORD color, RECT *rect)
{
if(!CanDisplay()) return;
// not really necessary to clear this every frame.
ZeroMemory(&_bltFx, sizeof(_bltFx));
_bltFx.dwSize = sizeof(_bltFx);
_bltFx.dwFillColor = color;
// Workaround for DX3 bug: ddraw limits the Blt to the size of the primary
// surface if Clipper is set. This looks bad when the offscreen surface
// is bigger than the primary surface.
// The workaround: Set the Clipper to NULL before the Blt, then set it back
// to what it was.
// Begin workaround part 1
LPDIRECTDRAWCLIPPER currClipp=NULL;
_ddrval = dds->IDDSurface()->GetClipper( &currClipp );
if(_ddrval != DD_OK &&
_ddrval != DDERR_NOCLIPPERATTACHED) {
IfDDErrorInternal(_ddrval, "Could not get clipper on trident surf");
}
if( currClipp ) {
_ddrval = dds->IDDSurface()->SetClipper(NULL);
IfDDErrorInternal(_ddrval, "Couldn't set clipper to NULL");
}
// End workaround part 1
TIME_DDRAW(_ddrval = dds->ColorFillBlt(rect, DDBLT_WAIT | DDBLT_COLORFILL, &_bltFx));
IfDDErrorInternal(_ddrval, "Couldn't clear surface");
// Begin workaround part 2
if( currClipp ) {
_ddrval = dds->IDDSurface()->SetClipper(currClipp);
// dump our reference.
currClipp->Release();
IfDDErrorInternal(_ddrval, "Couldn't set clipper");
}
// End workaround part 2
}
void
DirectDrawViewport::UpdateWindowMembers()
{
#if _DEBUG
if(!IsWindowless()) {
Assert(_targetPackage._targetHWND);
Assert(_targetPackage._prcViewport);
}
#endif
//
// Use _prcViewport
//
LONG lw=0, lh=0;
if(_targetPackage._prcViewport) {
lw = WIDTH(_targetPackage._prcViewport);
lh = HEIGHT(_targetPackage._prcViewport);
}
SetRect(&_clientRect, 0,0,lw,lh);
SetHeight(lh); SetWidth(lw);
UpdateTargetBbox();
TraceTag((tagViewportInformative, "Updating viewport window size to: %d, %d", Width(), Height()));
}
IDDrawSurface * DirectDrawViewport::GetMyPrimarySurface()
{
if( !IsWindowless() ) {
if (_primSurface == NULL) {
_ddrval = GetPrimarySurface(_directDraw2, _directDraw3, &_primSurface);
IfDDErrorInternal(_ddrval, "Could not get primary surface");
}
}
return _primSurface;
}
void DirectDrawViewport::
ReleaseIDirectDrawObjects()
{
_directDraw = NULL; // XXX: this should be addreffed
RELEASE( _directDraw1 );
RELEASE( _directDraw2 );
RELEASE( _directDraw3 );
}
void
DirectDrawViewport::ConstructDdrawMembers()
{
//----------------------------------------------------------------------
// Initialize Window size and client rect
//----------------------------------------------------------------------
UpdateWindowMembers();
if(Height() <=0 || Width() <=0) {
_canDisplay = false;
if(!IsWindowless()) return;
} else {
_canDisplay = true;
}
//----------------------------------------------------------------------
// Create main DirectDraw object
//----------------------------------------------------------------------
if(!_directDraw1 && !_directDraw2 && !_directDraw3) {
_ddrval = GetDirectDraw( &_directDraw1, &_directDraw2, &_directDraw3 );
IfDDErrorInternal(_ddrval, "Viewport:ConstructDdrawMembers:: Could not get a DirectDraw object");
}
TraceTag((tagViewportInformative,
"Viewport ddraws: ddraw1 %x, ddraw2 %x, ddraw3 %x\n",
_directDraw1, _directDraw2, _directDraw3));
#if SHARE_DDRAW
#if _DEBUG
{
//
// If one of our objects is the same as the global object,
// assert that all are the same. If it's different, assert
// that all are different
//
CritSectGrabber csg(*DDrawCritSect);
if(_directDraw1 == g_DirectDraw1) {
Assert(_directDraw2 == g_DirectDraw2);
if(_directDraw3 && g_DirectDraw3) Assert(_directDraw3 == g_DirectDraw3);
} else {
Assert(_directDraw1 != g_DirectDraw1);
Assert(_directDraw2 != g_DirectDraw2);
if(_directDraw3 && g_DirectDraw3) Assert(_directDraw3 != g_DirectDraw3);
}
}
#endif
#endif
_ddrval = DIRECTDRAW->SetCooperativeLevel( _targetPackage._targetHWND, DDSCL_NORMAL );
// TEMP
//_ddrval = DIRECTDRAW->SetCooperativeLevel( NULL, DDSCL_NORMAL );
IfDDErrorInternal(_ddrval, "Could not set cooperative level");
//----------------------------------------------------------------------
// Create the DD primary and target surfaces
//----------------------------------------------------------------------
if( !IsWindowless() ) {
_targetPackage._targetType = target_hwnd;
// create a clipper for the primary surface
_ddrval = DIRECTDRAW->CreateClipper( 0, &_primaryClipper, NULL );
IfDDErrorInternal(_ddrval, "Could not create primary clipper");
Assert(_targetPackage._targetHWND);
_ddrval = _primaryClipper->SetHWnd( 0, _targetPackage._targetHWND );
IfDDErrorInternal(_ddrval, "Could not set hwnd on primary clipper");
}
//----------------------------------------------------------------------
// Create and initialize target surface clipper, palette, and ZBuffer.
// Push one target surface on _targetSurfaceStack.
//----------------------------------------------------------------------
OneTimeDDrawMemberInitialization();
CreateSizeDependentTargDDMembers();
//----------------------------------------------------------------------
// Get the pixel format data from primarySurface
//----------------------------------------------------------------------
_targetDescriptor.Reset();
_targetDescriptor._pixelFormat.dwSize = sizeof(DDPIXELFORMAT);
_ddrval = _compositingStack->TargetDDSurface()->IDDSurface()->GetPixelFormat(& _targetDescriptor._pixelFormat);
IfDDErrorInternal(_ddrval, "Could not get pixel format");
#if _DEBUG
if(_targetDescriptor._pixelFormat.dwFlags & DDPF_ZBUFFER) {
_deviceInitialized = FALSE;
Assert(FALSE && "Target Surface has Zbuffer PixFmt!!!");
// can't do it.
return;
}
#endif
DebugCode(
if(_targetDescriptor._pixelFormat.dwFlags & DDPF_PALETTEINDEXED8) {
Assert( GetTargetBitDepth() == 8 );
}
);
TraceTag((tagViewportInformative,
"Device pixel format: depth=%d, R=%x, G=%x, B=%x",
_targetDescriptor._pixelFormat.dwRGBBitCount,
_targetDescriptor._pixelFormat.dwRBitMask,
_targetDescriptor._pixelFormat.dwGBitMask,
_targetDescriptor._pixelFormat.dwBBitMask));
//----------------------------------------------------------------------
// Assert if the primary surface does not have a palette attached.
//----------------------------------------------------------------------
#if _DEBUG
// TODO: the real assert here should be: are we rendering to
// primary ? if so, does it have a palette attached ? if not,
// can we decide which one to attach ?
if(0 ) {
LPDIRECTDRAWPALETTE pal = NULL;
if(GetMyPrimarySurface() != NULL) {
GetMyPrimarySurface()->GetPalette(&pal);
if(pal == NULL)
TraceTag((tagError, "primary surface w/o attatched pallete"));
else
pal->Release();
}
}
#endif
}
//---------------------------------------------------------
// P O P I M A G E D E V I C E
//---------------------------------------------------------
DirectDrawImageDevice *
DirectDrawViewport::PopImageDevice()
{
if(_deviceStack.empty()) {
_tmpDev = NEW DirectDrawImageDevice(*this);
} else {
_tmpDev = _deviceStack.back();
_deviceStack.pop_back();
// clear device's context before returning it.
_tmpDev->ResetContextMembers();
}
return _tmpDev;
}
//---------------------------------------------------------
// P U S H I M A G E D E V I C E
//---------------------------------------------------------
void
DirectDrawViewport::PushImageDevice(DirectDrawImageDevice *dev)
{
// Clean up device and return to its place...
dev->CleanupIntermediateRenderer();
_deviceStack.push_back(dev);
}
//---------------------------------------------------------
// M A K E L O G I C A L F O N T
//---------------------------------------------------------
// Based on information in textCtx and the familyName (if any)
// pick and create the most appropriate font, returned as
// a pointer to a logical font structure.
void DirectDrawViewport::
MakeLogicalFont(
TextCtx &textCtx,
LPLOGFONTW lf,
LONG width,
LONG height)
{
BYTE win32PitchAndFamily;
WideString familyName;
HDC hdcScreen = GetDC(NULL);
// Zero it out just to be safe
ZeroMemory(lf,sizeof(LOGFONTW));
// Initialize to "no-care". We might restrict this later.
lf->lfCharSet = DEFAULT_CHARSET;
//Set the facename and character set if it is specified
familyName = textCtx.GetFontFamily();
if (familyName && (lstrlenW(familyName) < ARRAY_SIZE(lf->lfFaceName)))
{
Assert((lstrlenW(familyName) < ARRAY_SIZE(lf->lfFaceName)) &&
"familyName string toooo long!");
StrCpyNW(lf->lfFaceName, familyName, ARRAY_SIZE(lf->lfFaceName));
// Character set remains no-care. EnumFontFamiliesEx will pick an arbitrary character set from
// the ones this face name supports
}
else
{
// The face name is not specified. Use the current character set of the DC and let EnumFontFamiliesEx
// pick any facename that supports this character set
if(hdcScreen)
lf->lfCharSet = (BYTE) GetTextCharset(hdcScreen);
// Character set remains no-care.
}
//Set the font family if it is specified
win32PitchAndFamily = FF_DONTCARE;
switch(textCtx.GetFont()) {
default:
case ff_serifProportional:
win32PitchAndFamily = FF_ROMAN | VARIABLE_PITCH; //serifProportional
break;
case ff_sansSerifProportional:
win32PitchAndFamily = FF_SWISS | VARIABLE_PITCH; //sansSerifProportional
break;
case ff_monospaced:
win32PitchAndFamily = FF_MODERN | FIXED_PITCH; //serif or sans Monospaced
break;
}
lf->lfPitchAndFamily = win32PitchAndFamily;
// negative height specifies that we want the CHARACTER to be that
// height, and not the glyph.
lf->lfHeight = height;
lf->lfWidth = 0;
lf->lfEscapement = 0;
lf->lfOrientation = 0;
// If bold is set, use the bold face, otherwise use whatever is
// specified by the weight (normalized 0 to 1). Special case 0,
// since a weight of 0 is interpeted by GDI as FW_REGULAR.
// Multiply by 1000 and clamp since GDI takes values between 0 and
// 1000.
int weight = (int)(textCtx.GetWeight() * 1000.0);
weight = CLAMP(weight, 1, 1000);
if (textCtx.GetBold()) {
weight = FW_BOLD;
}
lf->lfWeight = weight;
lf->lfItalic = (UCHAR)textCtx.GetItalic();
lf->lfUnderline = (UCHAR)textCtx.GetUnderline();
lf->lfStrikeOut = (UCHAR)textCtx.GetStrikethrough();
lf->lfOutPrecision = OUT_TT_ONLY_PRECIS; // Match only TT fonts, even if another family
lf->lfClipPrecision = CLIP_DEFAULT_PRECIS; // clipping precision, not used.
// lf->lfQuality = DRAFT_QUALITY; // font quality: only meaningful for raster fonts
lf->lfQuality = PROOF_QUALITY; // font quality: only meaningful for raster fonts
lf->lfPitchAndFamily = win32PitchAndFamily; // font pitch & family: set above.
// Now that all fields of interest in the logfont are filled in, choose a font on the system that is closest
// to lf. Both the input and output of EnumFontFamiliesEx is lf. Our callback simply overwrites lf.
MyEnumFontFamiliesEx(hdcScreen, lf, MyEnumFontFamProc, lf);
if (hdcScreen)
ReleaseDC(NULL,hdcScreen);
return; //void
}
// If surface exists it releases the surface.
// Creates a new surface of size width/height
// with clipRect for cliplist on surface.
void DirectDrawViewport::ReInitializeSurface(
LPDDRAWSURFACE *surfPtrPtr,
DDPIXELFORMAT &pf,
LPDIRECTDRAWCLIPPER *clipperPtr,
LONG width,
LONG height,
RECT *clipRect,
vidmem_enum vid,
except_enum exc)
{
DDSURFACEDESC ddsd;
ZeroMemory(&ddsd, sizeof(ddsd));
if(*surfPtrPtr) {
int ret = (*surfPtrPtr)->Release();
Assert((ret == 0) && "We wanted to release the surface but someone has a ref to it!");
}
CreateOffscreenSurface(surfPtrPtr, pf, width, height, vid, exc);
// Don't do this if there is no clipper or clip rect
if (*surfPtrPtr && (clipRect && clipperPtr)) {
// passing a null pointer to CreateClipper is bad
CreateClipper(clipperPtr);
SetCliplistOnSurface(*surfPtrPtr, clipperPtr, clipRect);
}
}
void DirectDrawViewport::CreateSizedDDSurface(DDSurface **ppSurf,
DDPIXELFORMAT &pf,
LONG width,
LONG height,
RECT *clipRect,
vidmem_enum vid)
{
Assert( ppSurf );
*ppSurf = NULL; // in case of failure.
DAComPtr<IDDrawSurface> iddSurf;
ReInitializeSurface( &iddSurf, pf, NULL,
width, height, clipRect,
vid, noExcept);
// Just stash away null and get out if failed.
if( iddSurf ) {
RECT r = {0,0,width,height};
NEWDDSURF( ppSurf,
iddSurf,
NullBbox2,
&r,
GetResolution(),
0, false, // clr key
false, // wrapper ?
false, // texture ?
"CreateSizeDDSurface" );
}
}
void DirectDrawViewport::
CreateClipper(LPDIRECTDRAWCLIPPER *clipperPtr)
{
if(*clipperPtr) return;
_ddrval = DIRECTDRAW->CreateClipper( 0, clipperPtr, NULL );
IfDDErrorInternal(_ddrval, "Could not create clipper");
}
void DirectDrawViewport::
SetCliplistOnSurface(LPDDRAWSURFACE surface,
LPDIRECTDRAWCLIPPER *clipper,
RECT *rect)
{
if(rect) {
struct {
char foo[sizeof(RGNDATA) + sizeof(RECT)];
} bar;
RGNDATA *clipList = (RGNDATA *) &bar;
clipList->rdh.dwSize = sizeof(clipList->rdh);
clipList->rdh.nCount = 1;
clipList->rdh.iType = RDH_RECTANGLES;
clipList->rdh.nRgnSize = sizeof(RECT);
clipList->rdh.rcBound = *rect;
memcpy(&(clipList->Buffer), rect, sizeof(RECT));
if(! (*clipper) ) CreateClipper( clipper );
// Clear any former cliplists
_ddrval = (*clipper)->SetClipList(NULL,0);
_ddrval = (*clipper)->SetClipList(clipList,0);
IfDDErrorInternal(_ddrval, "Could not SetClipList");
} // if rect
Assert(clipper && "clipper is NULL in SetCliplistOnSurface");
Assert((*clipper) && " *clipper is NULL SetCliplistOnSurface");
_ddrval = surface->SetClipper( *clipper );
IfDDErrorInternal(_ddrval, "Could not setClipper on surf");
}
HRESULT DirectDrawViewport::MyCreateSurface(LPDDSURFACEDESC lpDesc,
LPDIRECTDRAWSURFACE FAR * lplpSurf,
IUnknown FAR *pUnk
#if _DEBUG
, char *why
#endif
)
{
if( sysInfo.IsNT() ) {
// These are the limits Jeff Noyle suggested for nt4, sp3
if((lpDesc->dwWidth > 2048 || lpDesc->dwHeight > 2048)) {
*lplpSurf = NULL;
return E_FAIL;
}
}
HRESULT hr = DIRECTDRAW->CreateSurface(lpDesc, lplpSurf, pUnk);
if(FAILED(hr)) {
DebugCode(
printDDError( hr );
OutputDebugString("Unable to create ddraw surf. Falling back...");
);
return hr;
}
// We need to ensure that we can acutally blit on the surface.
// For this lets make a quick check to see if we are able to bit or not.
if ((*lplpSurf)->GetBltStatus(DDGBS_CANBLT) == DDERR_SURFACEBUSY) {
RaiseException_UserError
(DAERR_VIEW_SURFACE_BUSY, IDS_ERR_IMG_SURFACE_BUSY);
}
TraceTag((tagViewportMemory,
"-->New ddsurf: %x (%d x %d), ddraw %x. %s",
*lplpSurf, lpDesc->dwWidth, lpDesc->dwHeight, DIRECTDRAW, why));
if (!(lpDesc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE || lpDesc->dwFlags & DDSD_ZBUFFERBITDEPTH)) {
if (lpDesc->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8 ||
(lpDesc->ddpfPixelFormat.dwSize == 0 && GetTargetBitDepth() == 8)) {
LPDIRECTDRAWPALETTE pal;
(*lplpSurf)->GetPalette(&pal);
// if we have a palette, do not attach another...
if (pal) {
Assert(0);
pal->Release();
}
else {
AttachCurrentPalette(*lplpSurf);
}
}
}
return hr;
}
void DirectDrawViewport::
CreateOffscreenSurface(LPDDRAWSURFACE *surfPtrPtr,
DDPIXELFORMAT &pf,
LONG width, LONG height,
vidmem_enum vid,
except_enum exc)
{
DDSURFACEDESC ddsd;
ZeroMemory(&ddsd, sizeof(ddsd));
Assert( &pf != NULL );
ddsd.dwSize = sizeof( ddsd );
ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
ddsd.dwWidth = width;
ddsd.dwHeight = height;
ddsd.dwFlags |= DDSD_PIXELFORMAT;
ddsd.ddpfPixelFormat = pf;
// DX3 bug workaround (bug 11166): StretchBlt doesn't always work
// for hdc's we get from ddraw surfaces. Need to specify OWNDC
// in order for it to work.
ddsd.ddsCaps.dwCaps =
DDSCAPS_3DDEVICE |
DDSCAPS_OFFSCREENPLAIN |
#if USING_DX5
(vid == vidmem ? DDSCAPS_VIDEOMEMORY : DDSCAPS_SYSTEMMEMORY);
#else
(vid == vidmem ? DDSCAPS_VIDEOMEMORY : DDSCAPS_SYSTEMMEMORY | DDSCAPS_OWNDC);
#endif
_ddrval = CREATESURF( &ddsd, surfPtrPtr, NULL, "Offscreen");
if (FAILED(_ddrval)) {
if (exc == except) {
IfDDErrorInternal(_ddrval, "Could not create an offsreenPlain surface");
} else {
*surfPtrPtr = NULL;
}
}
}
void DirectDrawViewport::
CreateSpecialSurface(LPDDRAWSURFACE *surfPtrPtr,
LPDDSURFACEDESC ddsd,
char *errStr)
{
// For now only the first compositing surface will every be in video memory,
// all else resides in system memory.
ddsd->ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
_ddrval = CREATESURF( ddsd, surfPtrPtr, NULL, "Special" );
IfDDErrorInternal(_ddrval, errStr);
}
/*****************************************************************************
This procedure attaches a zbuffer surface to the given target as needed.
*****************************************************************************/
HRESULT DirectDrawViewport::AttachZBuffer (DDSurface *target, except_enum exc)
{
Assert (target);
// Query to see if the surface already has an attached Z-buffer. If it
// doesn't have an attached Z-buffer surface, then we expect the return
// code DDERR_NOTFOUND.
DAComPtr<IDDrawSurface> zbuffSurf;
static DDSCAPS caps = { DDSCAPS_ZBUFFER };
_ddrval = target->IDDSurface()->GetAttachedSurface (&caps, &zbuffSurf);
if (FAILED(_ddrval) && (_ddrval != DDERR_NOTFOUND)) {
if (exc == except)
IfDDErrorInternal (_ddrval, "GetAttachedSurface(ZBUFFER) failed.");
else
return _ddrval;
}
#if _DEBUG
// INVARIANT: there MUST be a zbuffer (as a DDSurface) associated with
// the target AND that zbuffer MUST be in the _zbufferSurface pool
// check that our datat structures match what ddraw thinks
DDSurface* targetZBuffer = target->GetZBuffer();
if ( (zbuffSurf && targetZBuffer) ||
(!zbuffSurf && !targetZBuffer) ) {
// now make sure they are the same IDirectDrawSurface
if(targetZBuffer) {
Assert( zbuffSurf == target->GetZBuffer()->IDDSurface() );
// Now it also must be in the ZBuffer pool!
DDSurface* foo;
foo = _zbufferSurfaces->GetSizeCompatibleDDSurf(
NULL,
target->Width(),
target->Height(),
target->IsSystemMemory() ? notVidmem : vidmem,
zbuffSurf);
Assert( foo == targetZBuffer );
}
} else {
// this is actually not bad when you have two controls on one
// page, they share the same surface, so one control attaches
// the zbuffer, and the second should just be able to use it.
#if 0
// bad... one has a surface, one doesn't
if( zbuffSurf ) {
Assert(0 && "target has an IDDSurface attached, but not a DDSurface");
} else {
Assert(0 && "target has a DDSurface attached, but not an IDDSurface");
}
#endif
}
#endif
// if there is already a zbuffer attached, return, we are done.
if (zbuffSurf)
return NO_ERROR;
// Search through our list of DDSurface Zbuffers for entries that match
// both the surface dimensions, and the found Z-buffer surface (if one
// exists).
DDSurfPtr<DDSurface> zbuff =
_zbufferSurfaces->GetSizeCompatibleDDSurf(
NULL,
target->Width(),
target->Height(),
target->IsSystemMemory() ? notVidmem : vidmem,
zbuffSurf
);
// If we didn't find a matching DDSurface Z-buffer, we need to create one.
if(! zbuff ) {
// If we didn't find a Z-buffer that matches, so we create it here.
DDSURFACEDESC ddsd;
ZeroMemory(&ddsd, sizeof(DDSURFACEDESC));
ddsd.dwSize = sizeof(DDSURFACEDESC);
ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS | DDSD_ZBUFFERBITDEPTH;
ddsd.dwHeight = target->Height();
ddsd.dwWidth = target->Width();
ddsd.dwZBufferBitDepth = 16;
ddsd.ddsCaps.dwCaps = target->IsSystemMemory()
? (DDSCAPS_ZBUFFER | DDSCAPS_SYSTEMMEMORY)
: (DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY);
_ddrval = CREATESURF(&ddsd, &zbuffSurf, NULL, "ZBuffer");
if (FAILED(_ddrval)) {
if (exc == except)
IfDDErrorInternal
(_ddrval,"CreateSurface for window Z-buffer failed.");
else
return _ddrval;
}
// Now that we've got a DirectDraw zbuffer, we need to create a new
// DDSurface that wraps it.
RECT rect = {0,0, target->Width(), target->Height() };
NEWDDSURF(&zbuff,
zbuffSurf,
NullBbox2, &rect,
GetResolution(),
0, false,
false, false,
"ZBuffer");
// Add the new zbuffer DDSurface to the list of zbuffer objects.
AddZBufferDDSurface( zbuff );
}
#if _DEBUG
else {
LONG hz, wz, hs, ws;
// make sure zbuffer and surface are the same size
GetSurfaceSize(zbuff->IDDSurface(), &wz, &hz);
GetSurfaceSize(target->IDDSurface(), &ws, &hs);
Assert((wz == ws) && (hz == hs) &&
"AttachZBuffer: zbuffer/target dimensions differ");
}
#endif
// set the zbuffer on the surface
_ddrval = target->SetZBuffer( zbuff );
if (FAILED(_ddrval)) {
if (exc == except)
IfDDErrorInternal
(_ddrval, "AddAttachedBuffer failed for Z-buffer.");
else
return _ddrval;
}
return NO_ERROR;
// zBuffSurf implicit Release() on exit
// zbuff DDSurfPtr implicit Release() on exit
}
/*****************************************************************************
This routine attaches the halftone palette to the given surface. The palette
is needed for D3D rendering or for discrete image conversion.
*****************************************************************************/
void DirectDrawViewport::AttachCurrentPalette (LPDDRAWSURFACE surface, bool bUsingXforms)
{
if (GetTargetBitDepth() == 8)
{
if(bUsingXforms || !AttachFinalPalette(surface))
SetPaletteOnSurface (surface, GethalftoneDDpalette());
}
}
bool DirectDrawViewport::AttachFinalPalette(LPDDRAWSURFACE surface)
{
if(IsNT5Windowed())
{
if(!_finalDDpalette) {
BYTE rgbytes[ sizeof(LOGPALETTE) +
(255 * sizeof(PALETTEENTRY)) ];
LOGPALETTE * pLogPal = reinterpret_cast<LOGPALETTE *>(rgbytes);
memset( &rgbytes[0], 0, sizeof(rgbytes) );
pLogPal->palVersion = 0x300;
pLogPal->palNumEntries = 256;
HDC hdc = GetDC(_targetPackage._targetHWND);
if(hdc)
{
GetSystemPaletteEntries(hdc,0u,256u,pLogPal->palPalEntry);
ReleaseDC(_targetPackage._targetHWND,hdc);
CreateDDPaletteWithEntries(&_finalDDpalette,pLogPal->palPalEntry);
}
else
{
return false;
}
}
SetPaletteOnSurface(surface,_finalDDpalette);
return true;
}
return false; // didn't attach the palette.
}
DWORD
DirectDrawViewport::MapColorToDWORD(Color *color)
{
Assert(_targetDescriptor.isReady && "_targetDescriptor not ready in MapColorToDWORD");
DWORD retColor = 0;
if( GetTargetBitDepth() == 8 ) {
//
// Use GDI
//
COLORREF colorRef = RGB(CHAR(255.0 * color->red),
CHAR(255.0 * color->green),
CHAR(255.0 * color->blue));
retColor = (DWORD)GetNearestPaletteIndex(GethalftoneHPal(), colorRef);
} else {
//
// build the color dword
//
// NOTE: this mapping is optimal, mapping the 'from' color
// space evenly into the 'to' color space.
retColor = _targetDescriptor.GetPixelFormat().dwRGBAlphaBitMask |
( LONG((0.999 + _targetDescriptor._red) * (color->red)) << _targetDescriptor._redShift) |
( LONG((0.999 + _targetDescriptor._green) * (color->green)) << _targetDescriptor._greenShift) |
( LONG((0.999 + _targetDescriptor._blue) * (color->blue)) << _targetDescriptor._blueShift);
}
return retColor;
}
DWORD
DirectDrawViewport::MapColorToDWORD(COLORREF colorRef)
{
Assert(_targetDescriptor.isReady && "_targetDescriptor not ready in MapColorToDWORD");
DWORD retColor = 0;
if( GetTargetBitDepth() == 8 ) {
//
// Use GDI
//
retColor = (DWORD)GetNearestPaletteIndex(GethalftoneHPal(), colorRef);
} else {
#define R(w) ( ((w) << _targetDescriptor._redShift ) & _targetDescriptor._pixelFormat.dwRBitMask)
#define G(w) ( ((w) << _targetDescriptor._greenShift) & _targetDescriptor._pixelFormat.dwGBitMask)
#define B(w) ( ((w) << _targetDescriptor._blueShift ) & _targetDescriptor._pixelFormat.dwBBitMask)
//
// build the color dword
//
retColor = _targetDescriptor._pixelFormat.dwRGBAlphaBitMask |
R( GetRValue(colorRef) >> _targetDescriptor._redTrunc ) |
G( GetGValue(colorRef) >> _targetDescriptor._greenTrunc ) |
B( GetBValue(colorRef) >> _targetDescriptor._blueTrunc ) ;
#undef R
#undef G
#undef B
}
return retColor;
}
/*
// Herf claims this takes 10 cycles instead of 50 (ftol()== bad!)
__asm
{
fld x
fistp ret
}
*/
inline BYTE contToByte(Real mxRng, Real contVal)
{
return (BYTE)( (mxRng + 0.9999) * contVal );
}
DXSAMPLE MapColorToDXSAMPLE(Color *c, Real opac)
{
return DXSAMPLE( contToByte( 255.0, opac ),
contToByte( 255.0, c->red ),
contToByte( 255.0, c->green ),
contToByte( 255.0, c->blue ) );
}
/*
// This is the way D3DRM does it
inline BYTE contToByte2(Real mxRng, Real contVal)
{
return (BYTE)( mxRng * contVal + 0.5 );
}
// Uncomment if we need it in the future. probably wont becuase we'll
// be using dx2d fulltime, but just in case
COLORREF MapColorToCOLORREF( Color *c, TargetDescriptor &td )
{
BYTE r = contToByte( 255.0, c->red);
BYTE g = contToByte( 255.0, c->green );
BYTE b = contToByte( 255.0, c->blue ) ;
COLORREF ref = RGB( r, g, b );
return ref;
}*/
#if _DEBUG
void RaiseSomeException()
{
if (IsTagEnabled(tagFail_InternalError)) {
RaiseException_InternalError("fooo!");
}
if (IsTagEnabled(tagFail_InternalErrorCode)) {
RaiseException_InternalErrorCode(false, "fooo!");
}
if (IsTagEnabled(tagFail_UserError)) {
RaiseException_UserError();
}
if (IsTagEnabled(tagFail_UserError1)) {
RaiseException_UserError(E_FAIL,
IDS_ERR_FILE_NOT_FOUND,
"http://foo!");
}
if (IsTagEnabled(tagFail_UserError2)) {
RaiseException_UserError(
E_FAIL,
IDS_ERR_FILE_NOT_FOUND,
"http://foo!");
}
if (IsTagEnabled(tagFail_ResourceError)) {
RaiseException_ResourceError();
}
if (IsTagEnabled(tagFail_ResourceError1)) {
RaiseException_ResourceError("out of fooo!");
}
if (IsTagEnabled(tagFail_ResourceError2)) {
RaiseException_ResourceError(
IDS_ERR_FILE_NOT_FOUND, "out of fooo!");
}
if (IsTagEnabled(tagFail_StackFault)) {
RaiseException_StackFault();
}
if (IsTagEnabled(tagFail_DividebyZero)) {
RaiseException_DivideByZero();}
if (IsTagEnabled(tagFail_OutOfMemory)) {
RaiseException_OutOfMemory("out of fooomem!", 100);
}
}
#endif
#if 0
#if _DEBUGMEM
// globals
_CrtMemState diff, oldState, newState;
#endif
#endif
//
// Top level, single threaded rendering function for a view
//
void
DirectDrawViewport::RenderImage(Image *image, DirtyRectState &d)
{
Assert(_currentImageDev);
if( _targetPackage._prcClip ) {
if( (WIDTH( _targetPackage._prcClip ) == 0) ||
(HEIGHT( _targetPackage._prcClip ) == 0) ) {
return;
}
}
DirectDrawImageDevice *dev = _currentImageDev;
dev->SetSurfaceSources(_compositingStack,
_freeCompositingSurfaces,
_imageSurfaceMap);
//
// Snapshot heap state
//
#if 0
#if _DEBUGMEM
_CrtMemCheckpoint(&oldState);
#endif
#endif
// If someone is rendering an image tree without and overlayed
// node at the top, we need to add one to leverage the overlayed
// node's rendering logic, and also for correctness.
// Specifically, the overlayed node is the only node that can
// handle opacity, by design.
// optimization opportunity
// Ok, here I'm setting the image's opacity on the overlayed
// node and subtracting it from the image. This is so that
// the whole overlayed node gets rendered with alpha ONTO the
// screen as the final compositing surface!
Real finalOpacity = image->GetOpacity();
//
// Don't render if it's fully clear
//
if( ! dev->IsFullyClear( finalOpacity ) ) {
#if 0
// check surface map sizes
OutputDebugString("----> IMAGE SURFACE MAP <----");
if(_imageSurfaceMap) _imageSurfaceMap->Report();
OutputDebugString("----> COMPOSITING SURFACES <----");
if(_freeCompositingSurfaces)_freeCompositingSurfaces->Report();
#endif
//
// this line causes flashing because the opacity
// is effectively lost if this is a regular image (not
// overlayed), and we're windowed: since the final
// blit doesn't look at opacity at all.
// ... but the problem is, taking it out causes
// curvey windowless to show cyan when it's getting clear
// because it does alpha blits onto a cleared surface (cyan as
// the color key) and then does alpha again onto the dest surf
//
image->SetOpacity(1.0);
Image *stubImage = NEW OverlayedImage(image, emptyImage);
BeginRendering( finalOpacity );
if( ! IsTargetViable() ) return;
dev->BeginRendering(stubImage, finalOpacity);
//if( ! CanDisplay() ) return;
// Simply display by calling the device's RenderImage() method.
// The device will then choose the appropriate method on the
// subclass of Image to call, based upon the type of device
// it is. Note that this is trying to simulate double dispatching
// with a single dispatch language (C++)
DebugCode(
RaiseSomeException();
);
dev->RenderImage(stubImage);
//
// Set opacity now, so it has effect on final blit
// but NOT on any intermediate blits (before final)
//
dev->SetOpacity(finalOpacity);
dev->EndRendering(d);
image->SetOpacity(finalOpacity);
dev->SetOpacity(1.0);
}
#if 0
#if _DEBUGMEM
_CrtMemCheckpoint(&newState);
_CrtMemDifference(&diff, &oldState, &newState);
_CrtMemDumpStatistics(&diff);
_CrtMemDumpAllObjectsSince(&oldState);
#endif
#endif
}
void
DirectDrawViewport::BeginRendering(Real topLevelOpac)
{
// make sure device is initialized if it can be
InitializeDevice();
if( _targetPackage._composeToTarget ) {
// Set a global clipRgn on the DC
//GetClipRgn(_targetPackage._dcFromSurf, _targetPackage._oldClipRgn);
//SelectClipRgn(_targetPackage._dcFromSurf, _targetPackage._clipRgn);
}
if(!_deviceInitialized) return;
if(_currentImageDev->IsFullyClear(topLevelOpac)) return;
// TODO: figure out the windowless control case...
if( !IsWindowless() ) {
if(GetMyPrimarySurface()->IsLost() == DDERR_SURFACELOST) {
TraceTag((tagError, "Surfaces Lost... marking views for destruction"));
{
// stops viewport creation or destruction
CritSectGrabber csg1(*g_viewportListLock);
// stops anyone from trying to create or
// release any ddraw resources
CritSectGrabber csg2(*DDrawCritSect);
// Turn on when there's a global shared ddraw object again
#if 0
//
// release the global primary because it's dependant on bitdepth
// Release it first!
//
TraceTag((tagViewportInformative, ">>>> ReleasePrimarySurface <<<<<"));
RELEASE(g_primarySurface);
RELEASE(g_DirectDraw1);
RELEASE(g_DirectDraw2);
RELEASE(g_DirectDraw3);
#endif
//
// All other vidmem surface are most likely lost
// do the thing and rebuild the
// universe. So mark all the viewports for destruction
//
set< DirectDrawViewport *, less<DirectDrawViewport *> >::iterator i;
for (i = g_viewportSet.begin(); i != g_viewportSet.end(); i++) {
(*i)->Stop();
(*i)->MarkForDestruction();
}
// Locks released on scope exit
}
// done!
return;
}
} // is windowless
//
// Turns off rendering if viewport is empty
//
if( IsWindowless() ) {
if( WIDTH(_targetPackage._prcViewport) <= 0 ||
HEIGHT(_targetPackage._prcViewport) <= 0) {
_canDisplay = false;
_canFinalBlit = false;
} else {
_canDisplay = true;
_canFinalBlit = true;
}
}
if(_windowResize) {
UpdateWindowMembers();
TraceTag((tagViewportInformative, "WINMSG: Resize: new viewport dimentions for hwnd=%x (%d,%d)",
_targetPackage._targetHWND, Width(), Height()));
if( !IsWindowless() ) {
RECT tmpRect;// = {0,0,0,0};
GetClientRect(_targetPackage._targetHWND, &tmpRect);
if((WIDTH(&tmpRect) > 0) && (HEIGHT(&tmpRect) > 0)) {
_canFinalBlit = true;
} else {
_canFinalBlit = false;
}
}
// xxx: what if it is windowless, has the viewport been
// xxx: updated somewhere ?
if(Width() <= 0 || Height() <= 0) {
_canDisplay = false;
} else {
// XXX: -----------------------------------------------------
// XXX: the right solution is to have all the image devices
// XXX: on the stack and just delete them all. ONE class
// XXX: must be the owner, it can't be both.
// Kill all the image devices we own
while(!_deviceStack.empty()) {
delete PopImageDevice();
}
// XXX: need to delete geom devices inside the DDSurface structs..
// XXX: delete the surface ? and force them to delete the devices.
// XXX: -----------------------------------------------------
//
// Kills all surfaces: target, scratch, compositing
//
DestroySizeDependentDDMembers();
#if 0
{
#if DEBUGMEM
static _CrtMemState diff, oldState, newState;
_CrtMemCheckpoint(&oldState);
#endif
CreateSizeDependentTargDDMembers();
DestroySizeDependentDDMembers();
#if DEBUGMEM
_CrtMemCheckpoint(&newState);
_CrtMemDifference(&diff, &oldState, &newState);
_CrtMemDumpStatistics(&diff);
_CrtMemDumpAllObjectsSince(&oldState);
#endif
}
#endif
//
// Pushes a target surface, creates zbuffer
// and clipper
//
CreateSizeDependentTargDDMembers();
_canDisplay = true;
}
Clear();
_windowResize = false;
}
if(!_canDisplay) return;
if((_targetPackage.IsDdsurf() ||
_targetPackage.IsHdc()) &&
!IsCompositeDirectly() &&
_canDisplay) {
Assert(IsWindowless());
Clear();
}
if( _targetPackage._composeToTarget ) {
//
// Grab the current clipper on the target surface
// and save it off, then restore it later (end
// rendering)
//
{
// nt4 ddraw sp3 workaround
{
RECT clipR = *_targetPackage._prcViewport;
if(_targetPackage._prcClip) {
IntersectRect(&clipR, &clipR, _targetPackage._prcClip);
}
Assert( _targetPackage._targetDDSurf );
Assert( _targetPackage._prcViewport );
// due to an nt4 ddraw bug, we're goign to reset the
// clip rgn, not the clipper
// Get current clipper.
// modify rgn
// release our reference
LPDIRECTDRAWCLIPPER currClipp=NULL;
_ddrval = _targetPackage._targetDDSurf->IDDSurface()->GetClipper( &currClipp );
if(_ddrval != DD_OK &&
_ddrval != DDERR_NOCLIPPERATTACHED) {
IfDDErrorInternal(_ddrval, "Could not get clipper on trident surf");
}
if( !currClipp ) {
// So we create a clipper that everyone's going to
// muck with... and when we're done, we'll release
// our reference. an imperfect system I know.
// Assert(!_externalTargetDDSurfaceClipper);
SetCliplistOnSurface(_targetPackage._targetDDSurf->IDDSurface(),
&_externalTargetDDSurfaceClipper,
&clipR);
} else {
RECT *rect = &clipR;
// modify the rect
struct {
char foo[sizeof(RGNDATA) + sizeof(RECT)];
} bar;
RGNDATA *clipList = (RGNDATA *) &bar;
clipList->rdh.dwSize = sizeof(clipList->rdh);
clipList->rdh.nCount = 1;
clipList->rdh.iType = RDH_RECTANGLES;
clipList->rdh.nRgnSize = sizeof(RECT);
clipList->rdh.rcBound = *rect;
memcpy(&(clipList->Buffer), rect, sizeof(RECT));
// Clear any former cliplists
_ddrval = currClipp->SetClipList(NULL,0);
// Set clip list on the clipper
_ddrval = currClipp->SetClipList(clipList,0);
IfDDErrorInternal(_ddrval, "Could not SetClipList");
// dump our reference.
currClipp->Release();
}
} // workaround
} // clipper stuff scope
//
// You know, there should be a better way to do this
// why aren't we doing alpha directly to the target ??
// Anyway, this is good for now.
//
if(! _currentImageDev->IsFullyOpaque(topLevelOpac)) {
//
// top level nontrivial opacity means
// that we can't compose directly to target
// like we planned. so push a target
// surface ontop of the compositing surface
// and set a flag
//
if(_opacityCompositionException) {
// make sure a target surface is here
// and clear it.
Assert( _compositingStack->Size() == 2 );
Clear();
} else {
Assert( _compositingStack->Size() == 1 );
_compositingStack->PushCompositingSurface(doClear, notScratch);
_opacityCompositionException = true;
}
} else {
//
// Ok, let's check to see if we need to
// undo something we did last frame...
//
if(_opacityCompositionException) {
//
// turn this off
//
_opacityCompositionException = false;
Assert( _compositingStack->Size() <= 2);
Assert( _compositingStack->Size() >= 1);
if( _compositingStack->Size() == 2) {
//
// Pop extra comp surface
//
_compositingStack->ReturnSurfaceToFreePool( _compositingStack->TargetDDSurface() );
_compositingStack->PopTargetSurface();
} else {
// the surface must have been released
// due to a resize. regardless we're ok.
}
} else {
Assert( _compositingStack->Size() == 1);
}
}
} // if composeToTarget
}
void
DirectDrawViewport::Clear()
{
if(_targetPackage._composeToTarget &&
(_externalTargetDDSurface == _compositingStack->TargetDDSurface())) {
// don't clear it if we're compositing directly to it!
return;
} else {
ClearSurface(_compositingStack->TargetDDSurface(), _defaultColorKey, &_clientRect);
}
}
#if _DEBUG
static void
MyDoBits16(LPDDRAWSURFACE surf16,
LONG width, LONG height)
{
static int counter = 0;
counter++;
counter = counter % 150;
HRESULT hr;
//
// Lock (16bpp) ddsurface (SRC)
//
void *srcp;
long pitch;
DDSURFACEDESC srcDesc;
srcDesc.dwSize = sizeof(DDSURFACEDESC);
hr = surf16->Lock(NULL, &srcDesc, DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR, NULL);
IfDDErrorInternal(hr, "Can't Get ddsurf lock for DoBits16");
srcp = srcDesc.lpSurface;
pitch = srcDesc.lPitch;
WORD *src;
for(int i=0; i<height; i++) {
src = (WORD *) ((BYTE *)srcp + (pitch * i));
for(int j=0; j<width; j++) {
*src = (WORD) (i * width + j * (counter+1));
src++;
}
}
surf16->Unlock(srcp);
}
#endif
bool
DirectDrawViewport::GetPixelFormatFromTargetPackage(targetPackage_t *targetStruct,DDPIXELFORMAT &targPf)
{
memset(&targPf, 0, sizeof(targPf));
targPf.dwSize = sizeof(targPf);
if( targetStruct->GetTargetType() == target_ddsurf ) {
if( ! targetStruct->GetIDDSurface() ) return false;
//
// Get pixel format
//
if (FAILED(targetStruct->GetIDDSurface()->GetPixelFormat(&targPf))) {
return false;
}
_targetDepth = targPf.dwRGBBitCount;
} else if (targetStruct->GetTargetType() == target_hdc ||
targetStruct->GetTargetType() == target_hwnd) {
// TODO: primary format will work on dcs, but we could do
// better to avoid a color convert.
//
// Get primary pixel format
//
Assert( _retreivedPrimaryPixelFormat );
targPf = _primaryPixelFormat;
_targetDepth = targPf.dwRGBBitCount;
} else {
Assert(0 && "bad target");
}
return true;
}
bool DirectDrawViewport::
SetTargetPackage(targetPackage_t *targetStruct)
{
// This simply checks to see if we're being asked to render to a
// ddsurface that is a different bit depth than our target bit depth. If
// so, we substitute in a different surface, and, after we're
// done, we blit to it.
DDPIXELFORMAT targPf;
if(!GetPixelFormatFromTargetPackage(targetStruct, targPf))
return false;
if( !_targetPixelFormatIsSet ) {
//------------------------------
// Since DirectDraw does not support
// 1, 2 or 4-bit per pixel modes, throw a resource error if needed.
//------------------------------
if (GetTargetBitDepth() < 8)
RaiseException_ResourceError (IDS_ERR_IMG_BAD_BITDEPTH, 1 << GetTargetBitDepth());
// sanity check
DebugCode(
if( (GetTargetBitDepth() == 8) ||
(targPf.dwFlags & DDPF_PALETTEINDEXED8) ) {
Assert( (GetTargetBitDepth() == 8) &&
(targPf.dwFlags & DDPF_PALETTEINDEXED8) );
}
);
_targetPixelFormatIsSet = true;
//
// This happens once!
//
Assert( !_surfaceManager &&
!_compositingStack &&
!_freeCompositingSurfaces &&
!_imageSurfaceMap );
SetUpSurfaceManagement( targPf );
_currentImageDev->SetSurfaceSources(_compositingStack,
_freeCompositingSurfaces,
_imageSurfaceMap);
}
/* DebugCode(
else {
// Assert that the format hasn't changed on us!
if( targetStruct->_targetType == target_ddsurf ) {
DDPIXELFORMAT pf;
pf.dwSize = sizeof(pf);
if (FAILED(targetStruct->GetIDDSurface()->GetPixelFormat(&pf))) {
// oh well it's just an assert...
} else {
Assert(_freeCompositingSurfaces->IsSamePixelFormat( &pf ));
}
}
}
); // end DebugCode
*/
bool result = ReallySetTargetPackage(targetStruct);
return result;
}
bool DirectDrawViewport::
ReallySetTargetPackage(targetPackage_t *targetStruct)
{
// Check bit depth and if it's 8bpp turn off composite directly to
// target.
if (GetTargetBitDepth() == 8) {
// don't compose directly to target for 8-bit surfaces
// this is because d3d has sticky palettes
targetStruct->SetComposeToTarget(false);
}
// xxx
// in the future we might want to pay attention to
// prcInvalid... although there are currently no ctrls
// that just render to and ibms without going through
// a dc...
_canFinalBlit = true;
_targetPackage._targetType = targetStruct->GetTargetType();
void *relevantSurf = NULL;
switch( _targetPackage._targetType ) {
case target_ddsurf:
TraceTag((tagViewportInformative, ">>>> SetTargetPackage, target_ddsurf <<<<<\n"));
relevantSurf = (void *) targetStruct->GetIDDSurface();
_targetPackage._composeToTarget = targetStruct->GetComposeToTarget();
{
#if SHARE_DDRAW
#if _DEBUG
{
// make sure that if we own a ddraw object
// that it's different than the global object
CritSectGrabber csg(*DDrawCritSect);
if(_directDraw1) {
Assert(_directDraw1 != g_DirectDraw1);
}
}
#endif
#endif
if (!_directDraw1) {
Assert (!IsInitialized() && "Can't set target ddsurf on"
&& " an initialized device because it already"
&& " has a ddraw object");
IDirectDraw *lpDD = NULL;
IDirectDrawSurface2 *dds = NULL;
dds = DDSurf1to2(targetStruct->GetIDDSurface());
_ddrval = dds->GetDDInterface((void **) &lpDD);
IfDDErrorInternal(_ddrval, "Can't get DirectDraw object from target surface");
dds->Release();
// @@@@@
_directDraw = _directDraw1 = lpDD;
_directDraw1->AddRef();
CompleteDdrawObjectSet(&_directDraw1, &_directDraw2, &_directDraw3);
// release the qi reference
lpDD->Release();
_usingExternalDdraw = true;
}
{
DebugCode(
IUnknown *lpDDIUnk = NULL;
TraceTag((tagDirectDrawObject, "Viewport (%x) ::SetTargetPackage...", this));
DDObjFromSurface( targetStruct->GetIDDSurface(), &lpDDIUnk, true);
Assert( lpDDIUnk );
IUnknown *currentDD = NULL;
_directDraw1->QueryInterface(IID_IUnknown, (void **)¤tDD);
Assert( currentDD );
Assert((currentDD == lpDDIUnk) &&
"Viewport::SetTargetPackage: underlying ddraw object mismatch!");
RELEASE( currentDD );
RELEASE( lpDDIUnk );
);
}
}
_targetPackage._alreadyOffset = targetStruct->GetAlreadyOffset();
break;
case target_hdc:
relevantSurf = (void *) targetStruct->GetHDC();
break;
case target_hwnd:
relevantSurf = (void *) targetStruct->GetHWND();
break;
default:
Assert(FALSE && "Bad target in SetTargetPackage");
}
if(!relevantSurf) {
_canDisplay = false;
return false;
}
bool viewportChanged = false;
// TODO: Danny - I added the check for targetStruct->_prcViewport
// since it was NULL sometimes (under IE3.02) and so we would
// crash in the below comparison.
if(_targetPackage._prcViewport &&
targetStruct->IsValid_ViewportRect()) {
if( !(::EqualRect(_targetPackage._prcViewport,
&targetStruct->GetViewportRect()))){
viewportChanged = true;
}
} else {
// new viewport means: it's changed!
viewportChanged = true;
}
//
// if a rectangle is defined in targetStruct, allocate our own
// and copy it. If not, deallocate what we have, and set it to NULL
//
{
if( targetStruct->IsValid_ViewportRect() ) {
if(! _targetPackage._prcViewport ) {
_targetPackage._prcViewport = NEW RECT;
}
*(_targetPackage._prcViewport) = targetStruct->GetViewportRect();
}
if( targetStruct->IsValid_ClipRect() ) {
if(! _targetPackage._prcClip ) {
_targetPackage._prcClip = NEW RECT;
}
*(_targetPackage._prcClip) = targetStruct->GetClipRect();
} else {
delete _targetPackage._prcClip;
_targetPackage._prcClip = NULL;
}
if( targetStruct->IsValid_InvalidRect() ) {
if(! _targetPackage._prcInvalid ) {
_targetPackage._prcInvalid = NEW RECT;
}
*(_targetPackage._prcInvalid) = targetStruct->GetInvalidRect();
} else {
delete _targetPackage._prcInvalid;
_targetPackage._prcInvalid = NULL;
}
}
RECT r, *surfRect = &r;
LONG h, w;
//
// Find the full surface size: surfRect
//
switch( _targetPackage._targetType ) {
case target_hwnd:
Assert(targetStruct->GetHWND());
// target hwnd is retained... so if it's not null
// it should be the same
if(!_targetPackage._targetHWND) {
_targetPackage._targetHWND = targetStruct->GetHWND();
} else {
Assert(_targetPackage._targetHWND == targetStruct->GetHWND());
}
//
// override given viewport (if any) with clientRect
//
if(!_targetPackage._prcViewport) {
RECT * r = new RECT;
//ZeroMemory(r, sizeof(RECT));
GetClientRect(targetStruct->GetHWND(), r);
if((WIDTH(r) == 0) || (HEIGHT(r) == 0)) {
// we can't display at all....
_canFinalBlit = false;
//
// Make sure we have something valid for viewport w/h
//
SetRect(r, 0,0, 3,3);
}
_targetPackage._prcViewport = r;
}
{
POINT pt={0,0};
ClientToScreen(targetStruct->GetHWND(), &pt );
OffsetRect(_targetPackage._prcViewport, pt.x, pt.y);
_targetPackage._offsetPt = pt;
}
// not setting surfRect on ddsurf, not meaningful
break;
case target_ddsurf:
{
GetSurfaceSize((IDDrawSurface *)relevantSurf, &w, &h);
SetRect(surfRect, 0, 0, w, h);
}
break;
case target_hdc:
// Assert(FALSE && "find hdc size or asser that viewport is set");
// what does size mean for a dc ?
//
// override given viewport (if any) with clientRect
//
if(!_targetPackage._prcViewport)
{
RECT * r = NEW RECT;
//ZeroMemory(r, sizeof(RECT));
GetClipBox(targetStruct->GetHDC(), r);
if((WIDTH(r) == 0) || (HEIGHT(r) == 0))
{
// we can't display at all....
_canFinalBlit = false;
//
// Make sure we have something valid for viewport w/h
//
SetRect(r, 0,0, 3,3);
}
_targetPackage._prcViewport = r;
}
break;
default:
break;
}
_targetPackage._offsetPt.x = 0;
_targetPackage._offsetPt.y = 0;
if(_targetPackage._prcViewport) {
_targetPackage._offsetPt.x = _targetPackage._prcViewport->left;
_targetPackage._offsetPt.y = _targetPackage._prcViewport->top;
} else {
_targetPackage._prcViewport = new RECT;
CopyRect(_targetPackage._prcViewport, surfRect);
// we're assuming that surf rect offset is 0
Assert(surfRect->left == 0);
Assert(surfRect->top == 0);
}
Bool newTarget = FALSE;
if( IsWindowless() ) {
if( _targetPackage.IsDdsurf() && !_targetPackage._targetDDSurf ) {
// scope
{
// The surface rect is the true size of this surface
// and differs from the _prcViewport which is where
// on that surface that we should draw.
DynamicHeapPusher dhp(_heapIWasCreatedOn);
NEWDDSURF(&_targetPackage._targetDDSurf,
(IDDrawSurface *)relevantSurf,
NullBbox2,
surfRect,
GetResolution(),
0, false,
true, // wrapper
false,
"TargetDDSurf wrapper");
// @@@: consider removing the "isWrapper" arg now that
// we're ref counting surfaces...
viewportChanged = true; // force bbox computation
}
//
// compose directly to target ?
//
if(_targetPackage._composeToTarget) {
Assert( _targetPackage.IsDdsurf() );
Assert(!_externalTargetDDSurface);
//
// Ok, push this surface on the viewport's
// targetDDSurface stack
//
_externalTargetDDSurface = _targetPackage._targetDDSurf;
// sanity checks...
Assert(( _compositingStack->Size() == 0 ) &&
"Something's on the targetsurface " &&
"stack but shouldn't be in SetTargetPackage, composeToTarget");
Assert(_targetPackage._prcViewport);
}
newTarget = TRUE;
} else if(_targetPackage.IsHdc() && !_targetPackage._targetGDISurf ) {
DynamicHeapPusher dhp(_heapIWasCreatedOn);
_targetPackage._targetGDISurf = NEW GDISurface( (HDC) relevantSurf );
viewportChanged = true; // force bbox computation
newTarget = true;
}
//
// Set genericSurface
//
GenericSurface *genericSurface = NULL;
switch( _targetPackage._targetType ) {
case target_ddsurf:
genericSurface = _targetPackage._targetDDSurf;
break;
case target_hdc:
genericSurface = _targetPackage._targetGDISurf;
break;
default:
break;
}
bool isDdrawSurf = true;
if( !_targetPackage.IsDdsurf() ) {
isDdrawSurf = false;
}
// has the surface rectangle changed ?
// If so we need to recreate all the stuff that depends on it:
// geometry devices + zbuffers
bool rectChanged = true;
if( isDdrawSurf ) {
if( *surfRect == *(_targetPackage._targetDDSurf->GetSurfRect()) ) {
rectChanged = false;
}
}
bool surfChanged = false;
if( relevantSurf != genericSurface->GetSurfacePtr() ) {
surfChanged = true;
genericSurface->SetSurfacePtr(relevantSurf);
}
if( (rectChanged || surfChanged) && isDdrawSurf) {
// Not equal: destroy geom dev + zbuffer
_targetPackage._targetDDSurf->DestroyGeomDevice();
// zbuffers are shared in in a pool, so get it and
// erase from surface pool (map)
DDSurface *targZBuf = NULL;
targZBuf = _targetPackage._targetDDSurf->GetZBuffer();
if(targZBuf) {
_zbufferSurfaces->Erase(targZBuf);
}
_targetPackage._targetDDSurf->SetZBuffer(NULL);
_targetPackage._targetDDSurf->SetSurfRect(surfRect);
}
if( viewportChanged && isDdrawSurf ) {
// calculate a new bbox and set it on the surface!
RECT *r = _targetPackage._prcViewport;
Bbox2 newBbox2;
RectToBbox( WIDTH(r),
HEIGHT(r),
newBbox2,
GetResolution());
_targetPackage._targetDDSurf->SetBbox(newBbox2);
}
// Translate the world by the offset homes!
if(_targetPackage._composeToTarget) {
Assert(isDdrawSurf && "Can't compose to target on non ddraw targets!");
if(_targetPackage._offsetPt.x || _targetPackage._offsetPt.y) {
TraceTag((tagViewportInformative, "VP %x: setting offset (%d,%d)\n",
this,_targetPackage._offsetPt.x,
_targetPackage._offsetPt.y));
_currentImageDev->SetOffset(_targetPackage._offsetPt);
} else {
// very important!
// also important not to touch this offset variable in
// the image device because it can be called to render
// twice or so, but the state is always and only set
// by the viewport!
TraceTag((tagViewportInformative, "VP %x: UNSETTING offset (%d,%d)\n",
this,_targetPackage._offsetPt.x,
_targetPackage._offsetPt.y));
_currentImageDev->UnsetOffset();
}
}
} // if IsWindowless
if(newTarget) {
_canDisplay = true;
_windowResize = true;
} else {
LONG w = Width(), h = Height();
UpdateWindowMembers(); // updates height/width from viewportRect
// did the width or height change ?
if((w != Width()) || (h != Height())) {
_windowResize = TRUE;
}
_canDisplay = true;
}
//
// if something new has happened, take advantage
// of it and initialize everything.
//
InitializeDevice();
return true;
}
void
DirectDrawViewport::EndRendering(DirtyRectState &d)
{
HDC hdcDraw = NULL;
HPALETTE old_hpal = NULL;
//
// Returns clipper on exit of scope
//
ClipperReturner cr(_targetPackage._targetDDSurf,
_oldExternalTargetDDSurfaceClipper,
*this);
if(!CanDisplay()) return;
if(!_canFinalBlit) return;
if(_currentImageDev->IsFullyClear()) return;
RECT destRect;
RECT srcRect;
// if intermediate surface is lost, forget even trying to
// rebuild it (not possible), who knows how many images are on it...
if(_compositingStack->TargetDDSurface()->IDDSurface()->IsLost() == DDERR_SURFACELOST)
return;
//
// todo: use the intersection of
// the cliprect and the invalid rect to set a clipper on the
// target surface
//
//
// Figure out destRect offset
//
POINT pt = {0,0};
if(IsWindowless()) {
pt = _targetPackage._offsetPt;
} else {
Assert(_targetPackage._targetHWND);
ClientToScreen( _targetPackage._targetHWND, &pt );
}
vector<Bbox2> *pBoxes;
int boxCount = d.GetMergedBoxes(&pBoxes);
#if _DEBUG
// If tracing dirty rects, force reblit of entire viewport. This
// will let us see the rects.
if (IsTagEnabled(tagDirtyRectsVisuals)) {
boxCount = 0;
}
#endif
if (boxCount >= 1) {
Bbox2 targBbox = _compositingStack->TargetDDSurface()->Bbox();
for (int i = 0; i < boxCount; i++) {
Bbox2 resultantBox =
IntersectBbox2Bbox2((*pBoxes)[i], targBbox);
if (resultantBox == NullBbox2) continue;
// optimization, convert box to rect
_currentImageDev->DoDestRectScale(&destRect,
_currentImageDev->GetResolution(),
resultantBox,
NULL);
/* negative numbers have been appearing here occasionally.
intersecting with the bounding box of the surface should
prevent this, but it doesn't. why ? */
destRect.left = MAX(destRect.left,0);
destRect.top = MAX(destRect.top,0);
srcRect = destRect;
if (destRect.left != destRect.right &&
destRect.top != destRect.bottom) {
BlitToPrimary(&pt,&destRect,&srcRect);
}
}
} else {
srcRect = _clientRect;
destRect = _clientRect;
BlitToPrimary(&pt,&destRect,&srcRect);
}
// return all the compositing surfaces
_compositingStack->ReplaceAndReturnScratchSurface(NULL);
}
void DirectDrawViewport::
DiscreteImageGoingAway(DiscreteImage *image)
{
if (!IsSurfMgrSet())
return;
//
// now we're done using this guy, return all it's resources
//
DDSurfPtr<DDSurface> s = _imageSurfaceMap->LookupSurfaceFromImage(image);
DDSurfPtr<DDSurface> t = _imageTextureSurfaceMap->LookupSurfaceFromImage(image);
DDSurfPtr<DDSurface> u = _imageUpsideDownTextureSurfaceMap->LookupSurfaceFromImage(image);
if(t) NotifyGeomDevsOfSurfaceDeath(t->IDDSurface());
if(u) NotifyGeomDevsOfSurfaceDeath(u->IDDSurface());
_imageSurfaceMap->DeleteMapEntry(image);
_imageTextureSurfaceMap->DeleteMapEntry(image);
_imageUpsideDownTextureSurfaceMap->DeleteMapEntry(image);
#if DEVELOPER_DEBUG
if (s && (s->GetRef() != 1))
{
TraceTag((tagError,
"Surface Leak: refcount = %d",
s->GetRef()));
}
if (t && (t->GetRef() != 1))
{
TraceTag((tagError,
"Texture Surface Leak: refcount = %d",
t->GetRef()));
}
if (u && (u->GetRef() != 1))
{
TraceTag((tagError,
"Upsidedown Texture Surface Leak: refcount = %d",
u->GetRef()));
}
#endif
// release DDSurface references automatically by smart pointers
}
/* helper function for EndRendering */
void DirectDrawViewport::BlitToPrimary(POINT *pt,RECT *destRect,RECT *srcRect)
{
if(!CanDisplay()) return;
// COMPOSITE
// blit intermediate img to primary.
Assert(WIDTH(destRect) == WIDTH(srcRect));
Assert(HEIGHT(destRect) == HEIGHT(srcRect));
// clip rect starts out as the dest Rect
RECT destClipRect = *destRect;
if(_targetPackage._prcClip) {
// clip rect is now the prcClip
destClipRect = *_targetPackage._prcClip;
if ((!_targetPackage._composeToTarget) && _targetPackage._targetType == target_ddsurf) {
RECT clipR = destClipRect;
// offset into non trident coords
OffsetRect(&clipR, -pt->x, -pt->y);
//
// need to clip destRect & srcRect by *pdestClipRect
// This block of code is copied from ComposeToIDDSurf, we
// may want to factor the same code into a function later on.
//
RECT Clippeddest;
if (!IntersectRect(&Clippeddest, destRect, &clipR)) {
return;
}
if (WIDTH(srcRect) != WIDTH(&Clippeddest)) {
srcRect->left += (Clippeddest.left - destRect->left);
srcRect->right = srcRect->left + WIDTH(&Clippeddest);
}
if (HEIGHT(srcRect) != HEIGHT(&Clippeddest)) {
srcRect->top += (Clippeddest.top - destRect->top);
srcRect->bottom = srcRect->top + HEIGHT(&Clippeddest);
}
*destRect = Clippeddest;
}
} else { // if _prcClip
// ofset the clipRect into dest space using the offset PT
OffsetRect( &destClipRect, pt->x, pt->y );
}
// offset destRect into trident coords
OffsetRect(destRect, pt->x, pt->y);
switch(_targetPackage._targetType) {
case target_ddsurf:
Assert(_targetPackage._targetDDSurf);
if(_targetPackage._composeToTarget &&
!_opacityCompositionException) {
// done...
} else {
_currentImageDev->ComposeToIDDSurf(
_targetPackage._targetDDSurf,
_compositingStack->TargetDDSurface(),
*destRect,
*srcRect,
destClipRect);
}
//
// Do a color conversion blit from a 16bpp target surface to some
// 8bpp target
//
// TESTING PURPOSES ONLY
#if 0
{
// creat an 8bpp surface
static DDSurface *dest_8bppSurf = NULL;
DDPIXELFORMAT pf;
pf.dwSize = sizeof(pf);
pf.dwFlags = DDPF_PALETTEINDEXED8 | DDPF_RGB;
pf.dwRGBBitCount = 8;
Assert(destRect->left == 0);
Assert(destRect->top == 0);
if( !dest_8bppSurf ) {
CreateSizedDDSurface(&dest_8bppSurf, &pf,
destRect->right,
destRect->bottom,
NULL, notVidmem);
SetPaletteOnSurface(dest_8bppSurf->IDDSurface(), GethalftoneDDpalette());
}
{
// convert
RECT rect = *(_targetPackage._targetDDSurf->GetSurfRect());
HDC srcDC = _targetPackage._targetDDSurf->GetDC("");
HDC destDC = dest_8bppSurf->GetDC("");
int ret;
ret = StretchBlt(destDC,
rect.left,
rect.top,
rect.right - rect.left,
rect.bottom - rect.top,
srcDC,
rect.left,
rect.top,
rect.right - rect.left,
rect.bottom - rect.top,
SRCCOPY);
Assert( ret ) ;
dest_8bppSurf->ReleaseDC("");
_targetPackage._targetDDSurf->ReleaseDC("");
}
}
#endif
break;
case target_hdc:
Assert(_targetPackage._targetGDISurf);
_currentImageDev->ComposeToHDC(_targetPackage._targetGDISurf,
_compositingStack->TargetDDSurface(),
destRect,
srcRect);
break;
case target_hwnd:
Assert(GetMyPrimarySurface());
{
// Grab the critical section and make sure this is all atomic
CritSectGrabber csg(*DDrawCritSect);
_ddrval = GetMyPrimarySurface()->SetClipper(_primaryClipper);
IfDDErrorInternal(_ddrval,
"Could not set clipper on primary surface");
TIME_DDRAW(_ddrval = GetMyPrimarySurface()->Blt(destRect,
_compositingStack->TargetDDSurface()->IDDSurface(),
srcRect,
DDBLT_WAIT,
NULL));
}
if( _ddrval != DD_OK) {
if( _ddrval == DDERR_SURFACELOST) {
TraceTag((tagError, "Primary lost"));
} else {
printDDError(_ddrval);
TraceTag((tagError, "vwprt: %x. PrimaryBlt failed srcRect:(%d,%d,%d,%d) destRect:(%d,%d,%d,%d)",
this, srcRect->left, srcRect->top, srcRect->right,
srcRect->bottom, destRect->left, destRect->top,
destRect->right, destRect->bottom));
}
}
break;
default:
Assert(FALSE && "Invalid target in EndRendering");
}
}
HPALETTE DirectDrawViewport::GethalftoneHPal()
{
if (_halftoneHPal == 0)
CreateHalftonePalettes();
return _halftoneHPal;
}
LPDIRECTDRAWPALETTE DirectDrawViewport::GethalftoneDDpalette()
{
if (_halftoneDDpalette == 0)
CreateHalftonePalettes();
return _halftoneDDpalette;
}
HPALETTE DirectDrawViewport::CreateHalftonePalettes()
{
PALETTEENTRY palentries[256];
HDC hdc = GetDC(NULL);
if (_halftoneHPal == NULL) {
_halftoneHPal = ::CreateHalftonePalette(hdc);
if (_halftoneHPal) {
::GetPaletteEntries(_halftoneHPal, 0, 256, palentries);
int i;
for (i=0; i < 256; ++i)
palentries[i].peFlags |= D3DPAL_READONLY;
CreateDDPaletteWithEntries(&_halftoneDDpalette,palentries);
}
}
ReleaseDC(NULL, hdc);
return _halftoneHPal;
}
void DirectDrawViewport::
GetPaletteEntries(HPALETTE hPal, LPPALETTEENTRY palEntries)
{
if(hPal) {
::GetPaletteEntries(hPal, 0, 256, palEntries);
}
}
void DirectDrawViewport::
CreateDDPaletteWithEntries (
LPDIRECTDRAWPALETTE *palPtr,
LPPALETTEENTRY palEntries)
{
_ddrval = DIRECTDRAW->CreatePalette(DDPCAPS_8BIT | DDPCAPS_INITIALIZE | DDPCAPS_ALLOW256,
palEntries,
palPtr, NULL);
IfDDErrorInternal(_ddrval, "Could not create palette with entries");
}
void DirectDrawViewport::
SetPaletteOnSurface(LPDDRAWSURFACE surface, LPDIRECTDRAWPALETTE pal)
{
_ddrval = surface->SetPalette(NULL);
if(_ddrval != DD_OK &&
_ddrval != DDERR_NOPALETTEATTACHED) {
printDDError(_ddrval);
RaiseException_InternalError("Couldn't release palette from surface");
}
_ddrval = surface->SetPalette(pal);
IfDDErrorInternal(_ddrval, "Could not set palette on surface");
}
void DirectDrawViewport::
CreateNewCompositingSurface(DDPIXELFORMAT &pf,
DDSurface **outSurf,
INT32 width, INT32 height,
vidmem_enum vid,
except_enum exc)
{
DAComPtr<IDDrawSurface> iddSurf;
bool nonTargetSize;
if(width < 0 || height < 0) {
width = Width();
height = Height();
nonTargetSize = false;
} else {
nonTargetSize = true;
}
Bbox2 surfBbox;
RECT surfRect;
LPDIRECTDRAWCLIPPER lpClip = NULL;
LPDIRECTDRAWCLIPPER *lplpClip;
if( nonTargetSize ) {
SetRect(&surfRect, 0,0, width, height);
RectToBbox(width, height, surfBbox, GetResolution());
lplpClip = &lpClip;
} else {
surfBbox = GetTargetBbox();
surfRect = _clientRect;
lplpClip = &_targetSurfaceClipper;
}
//
// This create the surface and the
// clipper if either is NULL using the given surfRect
//
ReInitializeSurface(&iddSurf,
pf,
lplpClip,
width, height,
&surfRect, vid, exc);
if( !iddSurf ) {
*outSurf = NULL;
if (exc == except) {
RaiseException_ResourceError("Can't create surface");
}
return;
}
if( GetTargetBitDepth() == 8 ) {
//
// Set palette on surface
//
AttachCurrentPalette(iddSurf);
}
DynamicHeapPusher dhp(_heapIWasCreatedOn);
// hand over reference
NEWDDSURF(outSurf,
iddSurf,
surfBbox,
&surfRect,
GetResolution(),
0, false,
false, false,
"CompositingSurface");
// iddSurf ref released on exit
if( nonTargetSize ) {
// release our reference, it's attached to the surface
(*lplpClip)->Release();
}
}
void DirectDrawViewport::
OneTimeDDrawMemberInitialization()
{
}
/*****************************************************************************\
This routine pushes the first surface for compositing. This surface is the
last stop before the final target surface.
*****************************************************************************/
void DirectDrawViewport::
PushFirstTargetSurface()
{
//
// Determine there's a surface that needs to be
// pushed on the stack first...
//
Assert((_compositingStack->Size() == 0) &&
"_targetSurfaceSTack should be empty in PushFirstTargetSurface");
if(_externalTargetDDSurface) {
// ok, push this guy first.
_compositingStack->PushTargetSurface(_externalTargetDDSurface);
} else {
// If we've got an HWND target, then we should place the first target
// surface in video memory to enable 3D hardware acceleration if it's
// available.
bool videomem = false;
if (!g_prefs3D.useHW)
{ TraceTag ((tag3DDevSelect, "3D hardware disabled in registry."));
}
#ifndef _IA64_
else if(IsWow64())
{
// Do not use 3d on WOW64, not supported
}
#endif
else if ( ! _targetPackage.IsHWND() )
{ TraceTag ((tag3DDevSelect,
"Target type != HWND; using 3D software renderer."));
}
else if ( (_primaryPixelFormat.dwRGBBitCount == 32)
&& (_primaryPixelFormat.dwRGBAlphaBitMask != 0)
)
{
TraceTag ((tag3DDevSelect,
"Primary surface is 32-bit with alpha; using software."));
}
else
{
ChosenD3DDevices *devs3d = SelectD3DDevices (DirectDraw1());
if (devs3d->hardware.guid == GUID_NULL)
{
TraceTag ((tag3DDevSelect, "No 3D hardware available."));
}
else if (!(devs3d->hardware.desc.dwDeviceRenderBitDepth
& BPPtoDDBD(BitsPerDisplayPixel())))
{
TraceTag ((tag3DDevSelect,
"No 3D hardware support for %d-bit target surface.",
BitsPerDisplayPixel()));
}
else if (BitsPerDisplayPixel() == 8)
{
// Most 3D cards don't support 8-bit acceleration. Of those
// that do, many don't properly support textures, so we choose
// software rendering instead for all 8-bit surfaces.
TraceTag ((tag3DDevSelect,
"Declining HW acceleration for 8-bit surface."));
}
else
{ TraceTag ((tag3DDevSelect,
"Creating main surface in video memory."));
videomem = true;
}
}
// Attempt to create the compositing surface. If we're trying for a
// system-memory surface, then throw an exception on failure. If we're
// trying for a video-memory surface, then return on failure so we can
// try again with system memory.
// this is ugly... find a better way
#if _DEBUG
DDSurfPtr<DDSurface> ddsurf("PushFirstTargetSurface", this);
#else
DDSurfPtr<DDSurface> ddsurf;
#endif
_compositingStack->GetSurfaceFromFreePool(
&ddsurf,
dontClear,
-1, -1,
notScratch,
videomem ? vidmem : notVidmem,
videomem ? noExcept : except);
// If we got back a null pointer (failed to create a video-memory
// surface), or if we couldn't attach a Z-buffer to the video-memory
// surface up front (probably due to memory constraints), then fall
// back to system memory. We don't bother attaching a Z-buffer to
// system memory surface since memory is much less constrained (and we
// do this lazily if needed).
if (!ddsurf || (videomem && FAILED(AttachZBuffer(ddsurf,noExcept)))) {
TraceTag ((tag3DDevSelect, "Couldn't allocate main "
"compositing%s surface in video memory.",
ddsurf? "" : " Z-buffer"));
if (ddsurf) {
ddsurf.Release();
}
_compositingStack->GetSurfaceFromFreePool
( &ddsurf,
dontClear,
-1, -1,
notScratch,
notVidmem,
except);
}
_compositingStack->PushTargetSurface (ddsurf);
}
}
void DirectDrawViewport::RePrepareTargetSurfaces ()
{
//
// Resize means kill all surface & zbuffer & clipper
//
DestroyTargetSurfaces();
if(_targetSurfaceClipper)
_targetSurfaceClipper->Release();
//
// NULL the pointers so they are created again
//
_targetSurfaceClipper = NULL;
//
// Create the surface and implicitly: the clipper & ZBuffer
// Push on _targetSurfaceStack
//
PushFirstTargetSurface();
Assert((_compositingStack->Size() == 1) && "Unexpected number of target surfaces in RePrepareTargetSurfaces");
}
//---------------------------------------------------------
//
// Compositing & target surface management
//
void DirectDrawViewport::
GetDDSurfaceForCompositing(
SurfacePool &pool,
DDSurface **outSurf,
INT32 minW, INT32 minH,
clear_enum clr,
scratch_enum scr,
vidmem_enum vid,
except_enum exc)
{
DDSurface* surface = NULL;
if(minW < 0 || minH < 0) {
minW = Width();
minH = Height();
}
//
// need to make sure the compositing surface returned is based on
// current viewport size
//
pool.FindAndReleaseSizeCompatibleDDSurf(
NULL,
minW,
minH,
vid,
NULL,
&surface); // our reference
if(!surface) {
// create one
CreateNewCompositingSurface(pool.GetPixelFormat(),
&surface,
minW, minH,
vid, exc);
}
__try {
if (clr == doClear && surface) {
ClearDDSurfaceDefaultAndSetColorKey(surface);
}
} __except ( HANDLE_ANY_DA_EXCEPTION ) {
// NOTE; if something else fails <non da> we leak this
// suface... like a div by zero, for example
// return the surface man!
pool.AddSurface(surface);
RETHROW;
}
if(surface) {
if( scr == scratch ) {
surface->SetScratchState(DDSurface::scratch_Dest);
}
}
// hand over the reference.
*outSurf = surface;
}
void DirectDrawViewport::
ColorKeyedCompose(DDSurface *destDDSurf,
RECT *destRect,
DDSurface *srcDDSurf,
RECT *srcRect,
DWORD clrKey)
{
Assert( !(clrKey & srcDDSurf->GetPixelFormat().dwRGBAlphaBitMask ) );
if (!sysInfo.IsWin9x() || (sysInfo.VersionDDraw() > 3)) {
// We are on NT OR dx5 or above
DWORD flags = DDBLT_KEYSRCOVERRIDE | DDBLT_WAIT;
ZeroMemory(&_bltFx, sizeof(_bltFx));
_bltFx.dwSize = sizeof(_bltFx);
_bltFx.ddckSrcColorkey.dwColorSpaceLowValue =
_bltFx.ddckSrcColorkey.dwColorSpaceHighValue = clrKey;
DebugCode(
RECT resRect;
IntersectRect(&resRect,destRect,srcRect);
Assert(&resRect != srcRect);
);
TIME_DDRAW(_ddrval = destDDSurf->Blt(destRect, srcDDSurf, srcRect, flags, &_bltFx));
// This is correct, but too risky for the cr1 release.
//destDDSurf->UnionInterestingRect( destRect );
if(_ddrval != DD_OK) {
printDDError(_ddrval);
TraceTag((tagError, "ColorKeyedCompose: failed srcRect:(%d,%d,%d,%d) destRect:(%d,%d,%d,%d)",
srcRect->left, srcRect->top, srcRect->right,srcRect->bottom,
destRect->left, destRect->top, destRect->right, destRect->bottom));
#if _DEBUG
DDPIXELFORMAT pf1;
DDPIXELFORMAT pf2;
destDDSurf->IDDSurface()->GetPixelFormat(&pf1);
srcDDSurf->IDDSurface()->GetPixelFormat(&pf2);
#endif
}
}
else {
// We are on DX3
destPkg_t pack;
pack.isSurface = true;
pack.lpSurface = destDDSurf->IDDSurface();
GetImageRenderer()->ColorKeyBlit(&pack,srcRect,srcDDSurf->IDDSurface(),
clrKey, destRect, destRect);
}
}
void CopyOrClearRect(RECT **src, RECT **dest, bool clear)
{
if( *src ) {
if(! (*dest) ) {
*dest = new RECT;
}
CopyRect(*dest, *src);
} else {
if(clear) {
delete *dest;
*dest = NULL;
}
}
}
//----------------------------------------------------------------------------
// Returns the geom device associated with the DDSurface
// creates one if none exists.
//----------------------------------------------------------------------------
GeomRenderer* DirectDrawViewport::GetGeomDevice (DDSurface *ddSurf)
{
if( !ddSurf ) return NULL;
GeomRenderer *gdev = ddSurf->GeomDevice();
if (!gdev) {
// Attach ZBuffer FIRST!
AttachZBuffer(ddSurf);
gdev = NewGeomRenderer (this, ddSurf);
if (gdev)
{
TraceTag ((tagViewportMemory,
"Created new geom device %x on %x\n", gdev, ddSurf));
ddSurf->SetGeomDevice( gdev );
}
}
return gdev;
}
bool DirectDrawViewport::IsTargetViable()
{
bool viable = false;
if( _targetPackage.IsValid() ) {
viable = true;
// WORKAROUND: When on Windows NT4SP3 or NT5, certain buggy display drivers
// will not allow us to lock the primary surface here. Since
// locking the primary here is a fix for the surface busy errors
// that hit us when running screen savers under Win98, and the
// screen savers don't matter under NT, then not doing the lock
// under NT is OK.
if (!sysInfo.IsNT()) {
if( _targetPackage.IsDdsurf() || _targetPackage.IsHWND() ) {
IDDrawSurface *idds = _targetPackage.IsDdsurf() ?
_targetPackage._targetDDSurf->IDDSurface() :
GetMyPrimarySurface();
Assert( idds );
// To see if the target surface will be free for modification,
// we blt a pixel to itself and test for success. In some
// situations (power management on Win98), the Lock was
// succeeding even thought the surface failed with
// SURFACEBBUSY on subsequent operations. This way we can
// ensure that we won't throw exceptions deep in our code on
// every call to View::Render.
RECT rect;
rect.left = 0;
rect.right = 1;
rect.top = 0;
rect.bottom = 1;
HRESULT hr = idds->Blt (&rect, idds, &rect, DDBLT_WAIT, NULL);
if (FAILED(hr))
{ viable = false;
TraceTag ((tagWarning, "Surface self-blt failed in IsTargetViable."));
}
}
}
}
return viable;
}
bool DirectDrawViewport::
TargetsDiffer( targetPackage_t &a,
targetPackage_t &b )
{
//
// if the types are different
//
if (a.GetTargetType() != b.GetTargetType())
return true;
//
// if composite to directly to target is different
//
if (a.GetComposeToTarget() != b.GetComposeToTarget())
return true;
//
// we know the targets are the same type.
// So: if the ptr changed, has the bitdepth
//
switch( a.GetTargetType() )
{
case target_ddsurf:
// check bit depth
// TODO: A possible optimization exists here:
// instead of getting the pixel format every frame, we can
// cache it.
// TODO: (bug) there's a smallish bug here that is we don't
// compare the rgb masks to make sure the pixel format is
// REALLY the same.
DDPIXELFORMAT pf1; pf1.dwSize = sizeof(DDPIXELFORMAT);
DDPIXELFORMAT pf2; pf2.dwSize = sizeof(DDPIXELFORMAT);
if( a.GetIDDSurface() && b.GetIDDSurface() ) {
if( SUCCEEDED( a.GetIDDSurface()->GetPixelFormat(&pf1) ) &&
SUCCEEDED( b.GetIDDSurface()->GetPixelFormat(&pf2) ))
{
return pf1.dwRGBBitCount != pf2.dwRGBBitCount;
} else {
return true;
}
} else {
return true;
}
break;
// for hdc and hwnd: we don't care if the underlying
// info changes because, in the hwnd case we only get
// the client rect and out pixel format is independent
// of the hwnd, and in the dc case we depend on it even
// less.
default:
break;
}
return false;
}
//----------------------------------------------------------------------------
// Return the GeomDDRenderer object associated with the target surface.
//----------------------------------------------------------------------------
GeomRenderer* DirectDrawViewport::MainGeomRenderer (void)
{
if( !_compositingStack ) return NULL;
if( _compositingStack->TargetSurfaceCount() > 0 ) {
Assert( ! IsBadReadPtr(_compositingStack->TargetDDSurface(),
sizeof(DDSurface *) ));
return GetGeomDevice (_compositingStack->TargetDDSurface());
} else {
return NULL;
}
}
GeomRenderer* DirectDrawViewport::GetAnyGeomRenderer()
{
GeomRenderer *gdev = NULL;
if( !_geomDevs.empty() ) {
gdev = _geomDevs.back();
}
return gdev;
}
static void
UpdateUserPreferences(PrivatePreferences *prefs,
Bool isInitializationTime)
{
g_preference_defaultColorKey =
RGB(prefs->_clrKeyR, prefs->_clrKeyG, prefs->_clrKeyB);
}
HRESULT GetDirectDraw(IDirectDraw **ddraw1,
IDirectDraw2 **ddraw2,
IDirectDraw3 **ddraw3)
{
TraceTag((tagViewportInformative, ">>>> GetDirectDraw <<<<<\n"));
CritSectGrabber csg(*DDrawCritSect);
HRESULT _ddrval = DD_OK;
// TEMP TEMP to make each viewport have a separate ddraw object
IDirectDraw *directDraw1 = NULL;
IDirectDraw2 *directDraw2 = NULL;
IDirectDraw3 *directDraw3 = NULL;
if(!directDraw1 && !directDraw2 && !directDraw3) {
if (!g_surfFact) {
g_ddraw3Avail = false;
_ddrval = CoCreateInstance(CLSID_DirectDrawFactory,
NULL, CLSCTX_INPROC_SERVER,
IID_IDirectDrawFactory,
(void **) & g_surfFact);
if(SUCCEEDED(_ddrval)) {
#if _DEBUG
{
DWORD foo;
DWORD sz = GetFileVersionInfoSize("ddrawex.dll", &foo);
char *vinfo = new char[sz];
if( GetFileVersionInfo("ddrawex.dll", 0, sz, vinfo) ) {
VS_FIXEDFILEINFO *ver=NULL;
UINT cb;
if( VerQueryValue(vinfo, "\\", (LPVOID *)&ver, &cb)){
if( ver != NULL ) {
}
}
}
delete vinfo;
}
#endif
g_ddraw3Avail = true;
}
}
if(g_ddraw3Avail) {
_ddrval = g_surfFact->CreateDirectDraw(NULL, GetDesktopWindow(), DDSCL_NORMAL, 0, NULL, &directDraw1);
IfDDErrorInternal(_ddrval, "Could not create DirectDraw object from ddrawex.dll");
g_surfFact->Release();
g_surfFact = NULL;
#if _DEBUG
OutputDebugString("Using IDirectDraw3 (ddrawex.dll)\n");
#endif
} else {
#if 1
if (!hInstDDraw) {
hInstDDraw = LoadLibrary("ddraw.dll");
if (!hInstDDraw) {
Assert(FALSE && "LoadLibrary of ddraw.dll failed");
return E_FAIL;
}
}
FARPROC fptr = GetProcAddress(hInstDDraw, "DirectDrawCreate");
if (!fptr) {
Assert(FALSE && "GetProcAddress of DirectDrawCreate failed");
return E_FAIL;
}
typedef HRESULT (WINAPI *DDrawCreatorFunc)
(GUID FAR *lpGuid,
LPDIRECTDRAW FAR *lplpDD,
IUnknown FAR *pUnkOuter);
DDrawCreatorFunc creatorFunc = (DDrawCreatorFunc)(fptr);
_ddrval = (*creatorFunc)(NULL, &directDraw1, NULL);
IfDDErrorInternal(_ddrval, "Could not create DirectDraw object");
#else
_ddrval = CoCreateInstance(CLSID_DirectDraw,
NULL, CLSCTX_INPROC_SERVER,
//NULL, CLSCTX_ALL,
IID_IDirectDraw,
(void **) & directDraw1);
IfDDErrorInternal(_ddrval, "Could not create DirectDraw object");
_ddrval = directDraw1->Initialize(NULL);
IfDDErrorInternal(_ddrval, "Could not Initialize direct draw object");
#endif
if (ddraw2) {
_ddrval = directDraw1->QueryInterface(IID_IDirectDraw2, (void **)&directDraw2);
IfDDErrorInternal(_ddrval, "Could not QI for a DirectDraw2 object");
}
}
// first time created, set coop level
_ddrval = directDraw1->SetCooperativeLevel( NULL, DDSCL_NORMAL );
IfDDErrorInternal(_ddrval, "Could not set cooperative level");
CompleteDdrawObjectSet(&directDraw1,
&directDraw2,
g_ddraw3Avail ? &directDraw3 : NULL);
// first time, don't addref the global object
if(ddraw1) {
*ddraw1 = directDraw1;
}
if(ddraw2) {
*ddraw2 = directDraw2;
}
if(ddraw3 && g_ddraw3Avail) {
*ddraw3 = directDraw3;
}
return _ddrval;
}
Assert((directDraw1 || directDraw3 || directDraw2) && "no ddraw object availabe (1,2 or 3)");
if(ddraw1) {
directDraw1->AddRef();
*ddraw1 = directDraw1;
}
if(ddraw2) {
directDraw2->AddRef();
*ddraw2 = directDraw2;
}
if(ddraw3 && g_ddraw3Avail) {
directDraw3->AddRef();
*ddraw3 = directDraw3;
}
return _ddrval;
}
IDirectDraw* DirectDrawViewport::DirectDraw1 (void)
{
if (!_directDraw1) {
if (_directDraw) {
_ddrval = _directDraw->QueryInterface (IID_IDirectDraw,
(void**)&_directDraw1);
IfDDErrorInternal (_ddrval, "QI for DirectDraw1 failed");
} else {
_ddrval = GetDirectDraw (&_directDraw1, NULL, NULL);
IfDDErrorInternal (_ddrval, "DirectDraw1 create failed");
_directDraw = _directDraw1;
}
}
return _directDraw1;
}
IDirectDraw2* DirectDrawViewport::DirectDraw2 (void)
{
if (!_directDraw2) {
if (_directDraw) {
_ddrval = _directDraw->QueryInterface (IID_IDirectDraw2,
(void**)&_directDraw2);
IfDDErrorInternal (_ddrval, "QI for DirectDraw2 failed");
} else {
_ddrval = GetDirectDraw (NULL, &_directDraw2, NULL);
IfDDErrorInternal (_ddrval, "DirectDraw2 create failed");
_directDraw = _directDraw2;
}
}
return _directDraw2;
}
#if DDRAW3
IDirectDraw3 *DirectDrawViewport::DirectDraw3 (void)
{
if (!_directDraw3) {
if (_directDraw) {
_ddrval = _directDraw->QueryInterface (IID_IDirectDraw3,
(void**)&_directDraw3);
IfDDErrorInternal (_ddrval, "QI for DirectDraw3 failed");
} else {
_ddrval = GetDirectDraw (NULL, NULL, &_directDraw3);
IfDDErrorInternal (_ddrval, "DirectDraw3 create failed");
_directDraw = _directDraw3;
}
}
return _directDraw3;
}
#endif
bool DirectDrawViewport::GetAlreadyOffset(DDSurface * ddsurf)
{
return ( _targetPackage._alreadyOffset &&
ddsurf == _externalTargetDDSurface &&
GetImageRenderer()->GetOffsetTransform());
}
void CompleteDdrawObjectSet(IDirectDraw **directDraw1,
IDirectDraw2 **directDraw2,
IDirectDraw3 **directDraw3)
{
IUnknown *ddraw;
if (*directDraw1)
ddraw = *directDraw1;
else if (*directDraw2)
ddraw = *directDraw2;
else if (directDraw3 && *directDraw3)
ddraw = *directDraw3;
else
Assert (!"All null pointers passed to CompleteDdrawObjectSet().");
HRESULT result;
if (!*directDraw1) {
result = ddraw->QueryInterface(IID_IDirectDraw, (void**)directDraw1);
IfDDErrorInternal (result, "Failed QI for DirectDraw1");
}
if (!*directDraw2) {
result = ddraw->QueryInterface(IID_IDirectDraw2, (void**)directDraw2);
IfDDErrorInternal (result, "Failed QI for DirectDraw2");
}
if (directDraw3 && !*directDraw3) {
result = ddraw->QueryInterface(IID_IDirectDraw3, (void**)directDraw3);
IfDDErrorInternal (result, "Failed QI for DirectDraw3");
}
}
HRESULT GetPrimarySurface (
IDirectDraw2 *ddraw2,
IDirectDraw3 *ddraw3,
IDDrawSurface **primary)
{
TraceTag((tagViewportInformative, ">>>> GetPrimarySurface <<<<<"));
CritSectGrabber csg(*DDrawCritSect);
// per view primary
// Remove this to have a global shared primary...
IDDrawSurface *g_primarySurface = NULL;
HRESULT hr = S_OK;
Assert((ddraw3 || ddraw2) && "NULL ddraw object in GetPrimarySurface");
if(!g_primarySurface) {
// create it! (once per process)
DDSURFACEDESC ddsd;
ZeroMemory(&ddsd, sizeof(ddsd));
// Primary surface, this surface is what is always seen !
ddsd.dwSize = sizeof( ddsd );
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
if(ddraw3) {
hr = ddraw3->CreateSurface( &ddsd, &g_primarySurface, NULL );
} else {
Assert(ddraw2);
hr = ddraw2->CreateSurface( &ddsd, &g_primarySurface, NULL );
}
if(hr != DDERR_NOEXCLUSIVEMODE)
IfDDErrorInternal(hr, "GetPrimarySurface - CreateSurface Failed.");
// no addref, first reference keeps it.
*primary = g_primarySurface;
return hr;
}
// The code below is never run because the primary is always created
// TEMP TEMP
if(hr != DD_OK) printDDError(hr);
if(g_primarySurface) g_primarySurface->AddRef();
*primary = g_primarySurface;
return hr;
}
void
RectToBbox(LONG pw, LONG ph, Bbox2 &box, Real res) {
Real w = Real(pw) / res;
Real h = Real(ph) / res;
box.min.Set(-(w*0.5), -(h*0.5));
box.max.Set( (w*0.5), (h*0.5));
}
/*****************************************************************************
This function returns the number of bits-per-pixel of the display.
*****************************************************************************/
int BitsPerDisplayPixel (void)
{
HDC dc = GetDC (NULL);
int bpp = GetDeviceCaps (dc, BITSPIXEL) * GetDeviceCaps (dc, PLANES);
ReleaseDC (NULL, dc);
return bpp;
}
//--------------------------------------------------
// C r e a t e V i e w p o r t
//
// Creates the top level viewport
//--------------------------------------------------
DirectDrawViewport *
CreateImageDisplayDevice()
{
DirectDrawViewport *viewport = NEW DirectDrawViewport();
viewport->PostConstructorInitialize(); // for exception throwing
// in the constructor
return viewport;
}
void DestroyImageDisplayDevice(DirectDrawViewport* dev)
{
// Surface tracker is part of the viewport class, we grab it
// destroy the viewport then delete it so that it can acuratly
// track all surface allocations and deletions.
#if _DEBUGSURFACE
SurfaceTracker *st = dev->Tracker();
#endif
delete dev;
#if _DEBUGSURFACE
delete st;
#endif
}
void
InitializeModule_Viewport()
{
ExtendPreferenceUpdaterList(UpdateUserPreferences);
if(!DDrawCritSect) DDrawCritSect = new CritSect ;
if(!g_viewportListLock) g_viewportListLock = new CritSect ;
}
void
DeinitializeModule_Viewport(bool bShutdown)
{
delete DDrawCritSect;
DDrawCritSect = NULL;
delete g_viewportListLock;
g_viewportListLock = NULL;
}
| [
"112426112@qq.com"
] | 112426112@qq.com |
e9627a6da55417716e3ed7eeef5a341a0f81294c | 9d7649ca193d5e62b6752ba4098c43eb5a16aa5f | /third_party/chromium_base/base/callback_old.h | ab3927df00dc98f477a14dbf1222b67c09922008 | [] | no_license | yiw2/ikran | 6aafe7d2b6ede852bdcffd9fc3ac4613ee9976a8 | cc8a3205cdbcb34f7807373db01c7f8b2558a639 | refs/heads/master | 2020-12-25T17:12:41.280090 | 2012-03-13T05:42:58 | 2012-03-13T05:42:58 | 3,196,837 | 4 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 8,277 | h | // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_CALLBACK_OLD_H_
#define BASE_CALLBACK_OLD_H_
#pragma once
#include "base/tuple.h"
#include "base/raw_scoped_refptr_mismatch_checker.h"
// Callback --------------------------------------------------------------------
//
// A Callback is like a Task but with unbound parameters. It is basically an
// object-oriented function pointer.
//
// Callbacks are designed to work with Tuples. A set of helper functions and
// classes is provided to hide the Tuple details from the consumer. Client
// code will generally work with the CallbackRunner base class, which merely
// provides a Run method and is returned by the New* functions. This allows
// users to not care which type of class implements the callback, only that it
// has a certain number and type of arguments.
//
// The implementation of this is done by CallbackImpl, which inherits
// CallbackStorage to store the data. This allows the storage of the data
// (requiring the class type T) to be hidden from users, who will want to call
// this regardless of the implementor's type T.
//
// Note that callbacks currently have no facility for cancelling or abandoning
// them. We currently handle this at a higher level for cases where this is
// necessary. The pointer in a callback must remain valid until the callback
// is made.
//
// Like Task, the callback executor is responsible for deleting the callback
// pointer once the callback has executed.
//
// Example client usage:
// void Object::DoStuff(int, string);
// Callback2<int, string>::Type* callback =
// NewCallback(obj, &Object::DoStuff);
// callback->Run(5, string("hello"));
// delete callback;
// or, equivalently, using tuples directly:
// CallbackRunner<Tuple2<int, string> >* callback =
// NewCallback(obj, &Object::DoStuff);
// callback->RunWithParams(MakeTuple(5, string("hello")));
//
// There is also a 0-args version that returns a value. Example:
// int Object::GetNextInt();
// CallbackWithReturnValue<int>::Type* callback =
// NewCallbackWithReturnValue(obj, &Object::GetNextInt);
// int next_int = callback->Run();
// delete callback;
// Base for all Callbacks that handles storage of the pointers.
template <class T, typename Method>
class CallbackStorage {
public:
CallbackStorage(T* obj, Method meth) : obj_(obj), meth_(meth) {
}
protected:
T* obj_;
Method meth_;
};
// Interface that is exposed to the consumer, that does the actual calling
// of the method.
template <typename Params>
class CallbackRunner {
public:
typedef Params TupleType;
virtual ~CallbackRunner() {}
virtual void RunWithParams(const Params& params) = 0;
// Convenience functions so callers don't have to deal with Tuples.
inline void Run() {
RunWithParams(Tuple0());
}
template <typename Arg1>
inline void Run(const Arg1& a) {
RunWithParams(Params(a));
}
template <typename Arg1, typename Arg2>
inline void Run(const Arg1& a, const Arg2& b) {
RunWithParams(Params(a, b));
}
template <typename Arg1, typename Arg2, typename Arg3>
inline void Run(const Arg1& a, const Arg2& b, const Arg3& c) {
RunWithParams(Params(a, b, c));
}
template <typename Arg1, typename Arg2, typename Arg3, typename Arg4>
inline void Run(const Arg1& a, const Arg2& b, const Arg3& c, const Arg4& d) {
RunWithParams(Params(a, b, c, d));
}
template <typename Arg1, typename Arg2, typename Arg3,
typename Arg4, typename Arg5>
inline void Run(const Arg1& a, const Arg2& b, const Arg3& c,
const Arg4& d, const Arg5& e) {
RunWithParams(Params(a, b, c, d, e));
}
};
template <class T, typename Method, typename Params>
class CallbackImpl : public CallbackStorage<T, Method>,
public CallbackRunner<Params> {
public:
CallbackImpl(T* obj, Method meth) : CallbackStorage<T, Method>(obj, meth) {
}
virtual void RunWithParams(const Params& params) {
// use "this->" to force C++ to look inside our templatized base class; see
// Effective C++, 3rd Ed, item 43, p210 for details.
DispatchToMethod(this->obj_, this->meth_, params);
}
};
// 0-arg implementation
struct Callback0 {
typedef CallbackRunner<Tuple0> Type;
};
template <class T>
typename Callback0::Type* NewCallback(T* object, void (T::*method)()) {
return new CallbackImpl<T, void (T::*)(), Tuple0 >(object, method);
}
// 1-arg implementation
template <typename Arg1>
struct Callback1 {
typedef CallbackRunner<Tuple1<Arg1> > Type;
};
template <class T, typename Arg1>
typename Callback1<Arg1>::Type* NewCallback(T* object,
void (T::*method)(Arg1)) {
return new CallbackImpl<T, void (T::*)(Arg1), Tuple1<Arg1> >(object, method);
}
// 2-arg implementation
template <typename Arg1, typename Arg2>
struct Callback2 {
typedef CallbackRunner<Tuple2<Arg1, Arg2> > Type;
};
template <class T, typename Arg1, typename Arg2>
typename Callback2<Arg1, Arg2>::Type* NewCallback(
T* object,
void (T::*method)(Arg1, Arg2)) {
return new CallbackImpl<T, void (T::*)(Arg1, Arg2),
Tuple2<Arg1, Arg2> >(object, method);
}
// 3-arg implementation
template <typename Arg1, typename Arg2, typename Arg3>
struct Callback3 {
typedef CallbackRunner<Tuple3<Arg1, Arg2, Arg3> > Type;
};
template <class T, typename Arg1, typename Arg2, typename Arg3>
typename Callback3<Arg1, Arg2, Arg3>::Type* NewCallback(
T* object,
void (T::*method)(Arg1, Arg2, Arg3)) {
return new CallbackImpl<T, void (T::*)(Arg1, Arg2, Arg3),
Tuple3<Arg1, Arg2, Arg3> >(object, method);
}
// 4-arg implementation
template <typename Arg1, typename Arg2, typename Arg3, typename Arg4>
struct Callback4 {
typedef CallbackRunner<Tuple4<Arg1, Arg2, Arg3, Arg4> > Type;
};
template <class T, typename Arg1, typename Arg2, typename Arg3, typename Arg4>
typename Callback4<Arg1, Arg2, Arg3, Arg4>::Type* NewCallback(
T* object,
void (T::*method)(Arg1, Arg2, Arg3, Arg4)) {
return new CallbackImpl<T, void (T::*)(Arg1, Arg2, Arg3, Arg4),
Tuple4<Arg1, Arg2, Arg3, Arg4> >(object, method);
}
// 5-arg implementation
template <typename Arg1, typename Arg2, typename Arg3,
typename Arg4, typename Arg5>
struct Callback5 {
typedef CallbackRunner<Tuple5<Arg1, Arg2, Arg3, Arg4, Arg5> > Type;
};
template <class T, typename Arg1, typename Arg2,
typename Arg3, typename Arg4, typename Arg5>
typename Callback5<Arg1, Arg2, Arg3, Arg4, Arg5>::Type* NewCallback(
T* object,
void (T::*method)(Arg1, Arg2, Arg3, Arg4, Arg5)) {
return new CallbackImpl<T, void (T::*)(Arg1, Arg2, Arg3, Arg4, Arg5),
Tuple5<Arg1, Arg2, Arg3, Arg4, Arg5> >(object, method);
}
// An UnboundMethod is a wrapper for a method where the actual object is
// provided at Run dispatch time.
template <class T, class Method, class Params>
class UnboundMethod {
public:
UnboundMethod(Method m, const Params& p) : m_(m), p_(p) {
COMPILE_ASSERT(
(base::internal::ParamsUseScopedRefptrCorrectly<Params>::value),
badunboundmethodparams);
}
void Run(T* obj) const {
DispatchToMethod(obj, m_, p_);
}
private:
Method m_;
Params p_;
};
// Return value implementation with no args.
template <typename ReturnValue>
struct CallbackWithReturnValue {
class Type {
public:
virtual ~Type() {}
virtual ReturnValue Run() = 0;
};
};
template <class T, typename Method, typename ReturnValue>
class CallbackWithReturnValueImpl
: public CallbackStorage<T, Method>,
public CallbackWithReturnValue<ReturnValue>::Type {
public:
CallbackWithReturnValueImpl(T* obj, Method meth)
: CallbackStorage<T, Method>(obj, meth) {}
virtual ReturnValue Run() {
return (this->obj_->*(this->meth_))();
}
protected:
virtual ~CallbackWithReturnValueImpl() {}
};
template <class T, typename ReturnValue>
typename CallbackWithReturnValue<ReturnValue>::Type*
NewCallbackWithReturnValue(T* object, ReturnValue (T::*method)()) {
return new CallbackWithReturnValueImpl<T, ReturnValue (T::*)(), ReturnValue>(
object, method);
}
#endif // BASE_CALLBACK_OLD_H_
| [
"ehugg@cisco.com"
] | ehugg@cisco.com |
6b9cbada3e166bc8fa480bda30d4dc7b42d0f452 | 94cb10457b3a3ade5b2cca4212d4b29f83af1dd6 | /Source/PortfolioApp/assimp/BaseProcess.h | 12487ef71c61fb7e90fa7b6535edf6eb83ad8b72 | [] | no_license | dy-dev/Portfolio | b371f1e3e5cbce62c9d3cce3874a22e1d8fa7b5f | 2f8af425a23a653c1b282f710d6c770100eb7c64 | refs/heads/master | 2021-04-30T23:08:25.091605 | 2016-06-07T09:34:38 | 2016-06-07T09:34:38 | 49,322,457 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,187 | h | /*
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2012, assimp team
All rights reserved.
Redistribution and use of this software 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 assimp team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the assimp team.
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.
----------------------------------------------------------------------
*/
/** @file Base class of all import post processing steps */
#ifndef INCLUDED_AI_BASEPROCESS_H
#define INCLUDED_AI_BASEPROCESS_H
#include <map>
#include "types.h"
#include "GenericProperty.h"
struct aiScene;
namespace Assimp {
class Importer;
// ---------------------------------------------------------------------------
/** Helper class to allow post-processing steps to interact with each other.
*
* The class maintains a simple property list that can be used by pp-steps
* to provide additional information to other steps. This is primarily
* intended for cross-step optimizations.
*/
class SharedPostProcessInfo
{
public:
struct Base
{
virtual ~Base()
{}
};
//! Represents data that is allocated on the heap, thus needs to be deleted
template <typename T>
struct THeapData : public Base
{
THeapData(T* in)
: data (in)
{}
~THeapData()
{
delete data;
}
T* data;
};
//! Represents static, by-value data not allocated on the heap
template <typename T>
struct TStaticData : public Base
{
TStaticData(T in)
: data (in)
{}
~TStaticData()
{}
T data;
};
// some typedefs for cleaner code
typedef unsigned int KeyType;
typedef std::map<KeyType, Base*> PropertyMap;
public:
//! Destructor
~SharedPostProcessInfo()
{
Clean();
}
//! Remove all stored properties from the table
void Clean()
{
// invoke the virtual destructor for all stored properties
for (PropertyMap::iterator it = pmap.begin(), end = pmap.end();
it != end; ++it)
{
delete (*it).second;
}
pmap.clear();
}
//! Add a heap property to the list
template <typename T>
void AddProperty( const char* name, T* in ){
AddProperty(name,(Base*)new THeapData<T>(in));
}
//! Add a static by-value property to the list
template <typename T>
void AddProperty( const char* name, T in ){
AddProperty(name,(Base*)new TStaticData<T>(in));
}
//! Get a heap property
template <typename T>
bool GetProperty( const char* name, T*& out ) const
{
THeapData<T>* t = (THeapData<T>*)GetPropertyInternal(name);
if(!t)
{
out = NULL;
return false;
}
out = t->data;
return true;
}
//! Get a static, by-value property
template <typename T>
bool GetProperty( const char* name, T& out ) const
{
TStaticData<T>* t = (TStaticData<T>*)GetPropertyInternal(name);
if(!t)return false;
out = t->data;
return true;
}
//! Remove a property of a specific type
void RemoveProperty( const char* name) {
SetGenericPropertyPtr<Base>(pmap,name,NULL);
}
private:
void AddProperty( const char* name, Base* data) {
SetGenericPropertyPtr<Base>(pmap,name,data);
}
Base* GetPropertyInternal( const char* name) const {
return GetGenericProperty<Base*>(pmap,name,NULL);
}
private:
//! Map of all stored properties
PropertyMap pmap;
};
#if 0
// ---------------------------------------------------------------------------
/** @brief Represents a dependency table for a postprocessing steps.
*
* For future use.
*/
struct PPDependencyTable
{
unsigned int execute_me_before_these;
unsigned int execute_me_after_these;
unsigned int only_if_these_are_not_specified;
unsigned int mutually_exclusive_with;
};
#endif
#define AI_SPP_SPATIAL_SORT "$Spat"
// ---------------------------------------------------------------------------
/** The BaseProcess defines a common interface for all post processing steps.
* A post processing step is run after a successful import if the caller
* specified the corresponding flag when calling ReadFile().
* Enum #aiPostProcessSteps defines which flags are available.
* After a successful import the Importer iterates over its internal array
* of processes and calls IsActive() on each process to evaluate if the step
* should be executed. If the function returns true, the class' Execute()
* function is called subsequently.
*/
class PORTFOLIOAPP_API_WINONLY BaseProcess
{
friend class Importer;
public:
/** Constructor to be privately used by Importer */
BaseProcess();
/** Destructor, private as well */
virtual ~BaseProcess();
public:
// -------------------------------------------------------------------
/** Returns whether the processing step is present in the given flag.
* @param pFlags The processing flags the importer was called with. A
* bitwise combination of #aiPostProcessSteps.
* @return true if the process is present in this flag fields,
* false if not.
*/
virtual bool IsActive( unsigned int pFlags) const = 0;
// -------------------------------------------------------------------
/** Check whether this step expects its input vertex data to be
* in verbose format. */
virtual bool RequireVerboseFormat() const;
// -------------------------------------------------------------------
/** Executes the post processing step on the given imported data.
* The function deletes the scene if the postprocess step fails (
* the object pointer will be set to NULL).
* @param pImp Importer instance (pImp->mScene must be valid)
*/
void ExecuteOnScene( Importer* pImp);
// -------------------------------------------------------------------
/** Called prior to ExecuteOnScene().
* The function is a request to the process to update its configuration
* basing on the Importer's configuration property list.
*/
virtual void SetupProperties(const Importer* pImp);
// -------------------------------------------------------------------
/** Executes the post processing step on the given imported data.
* A process should throw an ImportErrorException* if it fails.
* This method must be implemented by deriving classes.
* @param pScene The imported data to work at.
*/
virtual void Execute( aiScene* pScene) = 0;
// -------------------------------------------------------------------
/** Assign a new SharedPostProcessInfo to the step. This object
* allows multiple postprocess steps to share data.
* @param sh May be NULL
*/
inline void SetSharedData(SharedPostProcessInfo* sh) {
shared = sh;
}
// -------------------------------------------------------------------
/** Get the shared data that is assigned to the step.
*/
inline SharedPostProcessInfo* GetSharedData() {
return shared;
}
protected:
/** See the doc of #SharedPostProcessInfo for more details */
SharedPostProcessInfo* shared;
/** Currently active progress handler */
ProgressHandler* progress;
};
} // end of namespace Assimp
#endif // AI_BASEPROCESS_H_INC
| [
"dominique.yolin@free.fr"
] | dominique.yolin@free.fr |
1b001ac39e9dcc6572b6aca2a1e3df74ed94210e | 087596875bc3787d1bf984b84c541d3f52c9287e | /atcoder/abc142/C/main.cpp | 95c4b7b0dbc1470b8fc044c5492ef63c5c09a13b | [] | no_license | inada-s/procon | cc067440866c5acc1020eb50bcc9eb1aa2be8ff7 | 145b781fdabe298af46cfa671bbf4e4d97be1bfc | refs/heads/master | 2021-01-23T12:25:30.445723 | 2020-08-09T14:36:44 | 2020-08-09T14:36:44 | 93,155,603 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 481 | cpp | #include <bits/stdc++.h>
using namespace std;
#define loop(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < n; ++i)
#define dump(a) cerr << #a << " = " << (a) << "(L:" << __LINE__ << ")" << endl
void solve(long long N, std::vector<long long> A) {}
int main() {
long long N;
scanf("%lld", &N);
std::vector<long long> A(N);
for (int i = 0; i < N; i++) {
scanf("%lld", &A[i]);
}
solve(N, std::move(A));
return 0;
}
| [
"mecha.is06@gmail.com"
] | mecha.is06@gmail.com |
2c3b4792f21129b9aea1ca8645b3db3d4901181c | bacf17101dd8b03fdaac7deb17adb907cff2d48e | /src/lib.cpp | ea775d15aec61b3394f10a5112697048a79e9dcc | [] | no_license | mgh0010/AlgProject | b270c53c277574cc43d479b64d0173ab54f93981 | de8d961a582f4cd435f77b4888bb32cab903d86c | refs/heads/master | 2021-06-09T01:31:54.768040 | 2016-11-17T05:44:53 | 2016-11-17T05:44:53 | 73,773,909 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,013 | cpp | #include <cstdlib>
#include "../include/lib.h"
#include "../include/algorithms.h"
#include <fstream>
#include <iostream>
#include <sstream>
#define NUM_OF_ALG_CALLS 10
std::string output_filename = "/home/michael/ClionProjects/AlgProject/outputFiles/output";
std::string time_filename = "/home/michael/ClionProjects/AlgProject/outputFiles/time";
std::string input_filename = "/home/michael/ClionProjects/AlgProject/input";
std::ofstream time_file(time_filename);
std::ofstream output_file(output_filename);
/* Fills the test vector with random number vectors */
void
filltestvec(vec_of_int_vectors &test_vec)
{
// make 100 size array
test_vec.push_back(get_rand_vector(100));
// make 500 - 10,000 size arrays
for (int size = 500; size <= 10000; size += 500)
{
// put rand vector into test vector
test_vec.push_back(get_rand_vector(size));
}
}
/* Returns an array of given size filled with random numbers */
int_vector
get_rand_vector(int size)
{
int_vector vec;
for (int index = 0; index < size; ++index)
{
// generate rand num between 1-1000
int rand_num = 1000 - rand() % 2000;
// add number to back of vector
vec.push_back(rand_num);
}
return vec;
}
/* Returns string vector of input.txt lines */
string_vector
readinputfile()
{
std::string line;
std::ifstream file(input_filename);
if(file.is_open())
{
string_vector file_data;
while(getline(file, line))
{
file_data.push_back(line);
}
file.close();
return file_data;
} else
{
std::cout << "Could not open input.txt" << std::endl;
return string_vector{""};
}
}
vec_of_int_vectors
parseinputfiledata(string_vector str_vector)
{
// make vector to return
vec_of_int_vectors size_and_vec;
// Puts vector size into return vector
int_vector size = int_vector{std::stoi(str_vector[0])};
size_and_vec.push_back(size);
int_vector nums;
std::stringstream ss(str_vector[1]);
while(ss.good())
{
std::string str_num;
getline(ss, str_num, ',');
int num = std::stoi(str_num);
nums.push_back(num);
}
// Puts vector size into return vector
size_and_vec.push_back(nums);
return size_and_vec;
}
void
logbrutetimes(int_vector &brute_res, vec_of_int_vectors &test_vec, int test_vec_size)
{
clock_t t;
for (int i = 0; i < test_vec_size; ++i)
{
t = clock();
for(int j = 0; j < NUM_OF_ALG_CALLS; ++j)
{
brute(test_vec[i], (int) test_vec[i].size());
}
t = clock() - t;
if(time_file.is_open())
{
time_file << (float)t / CLOCKS_PER_SEC / NUM_OF_ALG_CALLS * 1000;
if(i < test_vec_size - 1)
{
time_file << ",";
}
} else
{
std::cout << "Could not open time.txt" << std::endl;
return;
}
}
time_file << std::endl;
}
void
logrecursivetimes(int_vector &recursive_res, vec_of_int_vectors &test_vec, int test_vec_size)
{
clock_t t;
for (int i = 0; i < test_vec_size; ++i)
{
t = clock();
for(int j = 0; j < NUM_OF_ALG_CALLS; ++j)
{
recursive(test_vec[i], (int) test_vec[i].size());
}
t = clock() - t;
if(time_file.is_open())
{
time_file << (float)t / CLOCKS_PER_SEC / NUM_OF_ALG_CALLS * 1000;
if(i < test_vec_size - 1)
{
time_file << ",";
}
} else
{
std::cout << "Could not open time.txt" << std::endl;
return;
}
}
time_file << std::endl;
}
void
logiterativetimes(int_vector &iterative_res, vec_of_int_vectors &test_vec, int test_vec_size)
{
clock_t t;
for (int i = 0; i < test_vec_size; ++i)
{
t = clock();
for(int j = 0; j < NUM_OF_ALG_CALLS; ++j)
{
iterative(test_vec[i], (int) test_vec[i].size());
}
t = clock() - t;
if(time_file.is_open())
{
time_file << (float)t / CLOCKS_PER_SEC / NUM_OF_ALG_CALLS * 1000;
if(i < test_vec_size - 1)
{
time_file << ",";
}
} else
{
std::cout << "Could not open time.txt" << std::endl;
return;
}
}
time_file << std::endl;
}
void
loginputresults(const int_vector &brute_res, const int_vector &recursive_res, const int_vector &iterative_res)
{
if(output_file.is_open())
{
output_file << brute_res[0] << "," << brute_res[1] << "," << brute_res[2] << std::endl;
output_file << recursive_res[0] << "," << recursive_res[1] << "," << recursive_res[2] << std::endl;
output_file << iterative_res[0] << "," << iterative_res[1] << "," << iterative_res[2] << std::endl;
} else
{
std::cout << "Could not open output.txt" << std::endl;
}
} | [
"mgh0010@auburn.edu"
] | mgh0010@auburn.edu |
307a095a901c76facdfa1bbf42fd0537008920c7 | 541c4f648cee67b937b3a5087d69a467826aff52 | /Src/Field/ScalarBool/scalarbool_load.cpp | ddd7f7715e86f6ac63f8326f734ee9139cbd08fb | [] | no_license | Wentao2017/PSI-Boil-liquid-film | 9831382e5d3303a7be54f2216225f113c804c630 | 8c59435c4bc6c75bb06b17f6d4c899aee0099aa0 | refs/heads/master | 2023-05-07T05:38:07.261651 | 2021-05-31T06:28:25 | 2021-05-31T06:28:25 | 328,350,633 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,037 | cpp | #include "scalarbool.h"
/******************************************************************************/
void ScalarBool::load(const char * nm, const int it) {
/* file name */
std::string name = name_file(nm, ".bck", it, boil::cart.iam());
/* open a file */
std::ifstream in(name.c_str(), std::ios::binary);
/* stop if file is not present */
if( in.rdstate() != 0 ) {
std::cout << "failed to open " << name << std::endl;
std::cout << "exiting!" << std::endl;
exit(0);
}
/* load the necessary data */
load(in);
/* close a file */
in.close();
}
/******************************************************************************/
void ScalarBool::load(std::ifstream & in) {
int n_x_saved, n_y_saved, n_z_saved;
in.read(reinterpret_cast<char *> (&n_x_saved), sizeof(int));
in.read(reinterpret_cast<char *> (&n_y_saved), sizeof(int));
in.read(reinterpret_cast<char *> (&n_z_saved), sizeof(int));
in.read(reinterpret_cast<char *> (val[0][0]),
ni()*nj()*nk()*sizeof(bool));
}
| [
"guow@eu-login-06.euler.ethz.ch"
] | guow@eu-login-06.euler.ethz.ch |
b4b01c97924d5528652a3ee69461c127377445ae | 04bc3e7e870a5bbde9561b7c31f4d6416eb909fe | /denoising/grid.hpp | 23366f59aebc0a287b3da2b82fcf4f1fc79dad73 | [
"MIT"
] | permissive | lmkaa/DenoisingSurfRecon | f5f52590ef0963367f89b7be84f584e0b4e5f7ec | f47d99920c587d64f0f63979c0d536c5d89e5550 | refs/heads/master | 2021-08-15T20:48:16.486155 | 2017-11-18T08:40:33 | 2017-11-18T08:40:33 | 111,060,109 | 2 | 2 | null | 2017-11-18T08:39:22 | 2017-11-17T05:00:45 | C++ | UTF-8 | C++ | false | false | 1,508 | hpp | #ifndef GRID_HPP
#define GRID_HPP
#include <iostream>
#include <fstream>
#include <vector>
#include <cmath>
#include "vector3.h"
#include "octreeNode.hpp"
using namespace std;
class octreeNode;
#ifndef GRIDCELL_HPP
#define GRIDCELL_HPP
class gridCell
{
private:
double center[3];
double sideLength;
int numOfVertex;
octreeNode* workingNode;
public:
gridCell();
void setCenter(double* _center);
const double* getCenter() const;
void setSideLength(double _sideLength);
void setWorkingNode(octreeNode* n);
octreeNode* getWorkingNode();
int getNumOfVertex() const;
double getSideLength();
const vector<int> & getInCellVertex() const;
int* getEdgeNeighborCellSize();
bool setEdgesAndCheckIntersection(double innerLength, double halfLength, const double* plane, const double b, gridCell gc[3][3][3], int cx, int cy, int cz, const double* rMaxC, const double* rMinC);
const double* getAvgPoint() const;
};
#endif
class grid
{
private:
octreeNode* workingNode;
double center[3];
double sideLength;
gridCell gc[3][3][3];
double minCoord[3];
double plane[3];
double b;
public:
grid(octreeNode* _node, const double* _center, double _sideLength);
octreeNode* const getNode() const;
double getSideLength() const;
bool computeNormal(const vector<double*> &v, vector<double*> &normal, double* myb);
const double* getNormal() const;
double getb() const;
bool hasEmptySmallCell(const vector<double*> &v, const double* rMaxC, const double* rMinC);
};
#endif
| [
"lmkia@win2k.cs.ust.hk"
] | lmkia@win2k.cs.ust.hk |
782c78a0395b7b844f4c2d38a954e2108b3bf588 | a679dba6ef0364962b94ed65d0caad1a88da6c43 | /OrginalServerCode/OrginalCode/labixiaoxin/server/ServerEngine/MsgServer/MsgServer/src/data/IModelBase.h | 2f5a2a560164390041d5274d959b5846e8855ea5 | [] | no_license | w5762847/Learn | 7f84933fe664e6cf52089a9f4b9140fca8b9a783 | a5494181ea791fd712283fa8e78ca0287bf05318 | refs/heads/master | 2020-08-27T05:43:35.496579 | 2016-12-02T12:16:12 | 2016-12-02T12:16:12 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 876 | h | /********************************************************************
创建时间: 2014/08/07 10:58:17
文件名: IGameBase
作者: 谢小军
功能: 1.模块消息类接口 主要用于逻辑调用
2.
说明: 1. 用于逻辑接口定义
2.
*********************************************************************/
#ifndef _IMODELBASE_H_
#define _IMODELBASE_H_
#include <string>
#include <vector>
#include "..\tools\DefineBase.h"
#include "GameDefine.h"
#define interface class
//逻辑接口
interface IModelBase
{
public:
bool m_isInit;
bool m_isDelete;
UserInfo m_user;
// MY_UINT32 m_userID;
// std::string m_name;
IModelBase(){m_isInit = false;m_isDelete = false;}
public:
//连接
virtual void OnInit() = 0;
//判断是否超时了
virtual bool OnTimeOut() = 0;
};
#endif | [
"flyer_son@126.com"
] | flyer_son@126.com |
0ce4de6a8a67f3a09fb589f72c3db7a6ca1bf516 | 8e911106b96b472b5bc7e667a67f4ee7a3454a5b | /MPU_6050/pitch_and_roll.cpp | c79e80bac2bc964b3f3202664b60a9b516bc1cf1 | [] | no_license | abhipray-cpu/arduino | a6640938f02853198537c22a14165cc7b7dbee94 | b534b39ca880e623c03705f202c3bc442aa86260 | refs/heads/main | 2023-07-17T01:45:48.346694 | 2021-08-18T15:24:13 | 2021-08-18T15:24:13 | 377,536,897 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 838 | cpp | //pitch and roll using accelerometre
#include <Wire.h>
#include <MPU6050.h>
MPU6050 mpu;
void setup()
{
Serial.begin(9600);
Serial.println("Initialize MPU6050");
while(!mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))
{
Serial.println("Could not find a valid MPU6050 sensor, check wiring!");
delay(500);
}
}
void loop()
{
// Read normalized values
Vector normAccel = mpu.readNormalizeAccel();
// Calculate Pitch & Roll
int pitch = -(atan2(normAccel.XAxis, sqrt(normAccel.YAxis*normAccel.YAxis + normAccel.ZAxis*normAccel.ZAxis))*180.0)/M_PI;
int roll = (atan2(normAccel.YAxis, normAccel.ZAxis)*180.0)/M_PI;
// Output
Serial.print(" Pitch = ");
Serial.print(pitch);
Serial.print(" Roll = ");
Serial.print(roll);
Serial.println();
delay(10);
} | [
"dumkaabhipray@gmail.com"
] | dumkaabhipray@gmail.com |
d9021d62baebae3ea90a099314a6f9a18bfd2b31 | c900848dd17c08494cc886b84e0061bf4a902099 | /Paramedic.cpp | 9559caa2601c8d2274365d22552957596a69ec8a | [
"MIT"
] | permissive | EvgenTen/EX4_wargame-a | 9a685443101771777f7399101f43b5fa0aeab93b | 6b3ea79f0d1ea8c85a9ceece062c7115a9ee6cf3 | refs/heads/master | 2022-09-04T05:53:16.243932 | 2020-05-26T14:52:26 | 2020-05-26T14:52:26 | 267,045,777 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 76 | cpp |
#include "Paramedic.hpp"
void Paramedic::attack(Soldier& soldiers){
} | [
"izerus@gmail.com"
] | izerus@gmail.com |
bc2867e80b31a5b8f84730e8b242638e06c5385d | 978570d38d466c5c39552d4d28d29768d2d6bfb8 | /nobrem_Chi_c1/Class/Chi_c1_DONT_TOUCH.cc | b28e67663e235a8329e0556708fa228cc70b2306 | [] | no_license | hixio-mh/processors | 39e60fde0446ebee2d754afedb170e813e061897 | 7e557e6d2d128dc7c3a647f1d4d3f37a7e40408b | refs/heads/master | 2021-09-14T15:33:07.067376 | 2018-05-15T19:08:34 | 2018-05-15T19:08:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,273 | cc | // -*- C++ -*-
//
// Package: Chi_c1
// Module: Chi_c1_DONT_TOUCH
//
// Description: DONT TOUCH THIS FILE
//
// Definition of bind action
//
// Implementation:
//
// Author: pts/7
// Created: Mon May 2 13:43:14 CDT 2011
// $Id$
//
// Revision history
//
// $Log$
#include "Experiment/Experiment.h"
// system include files
#if defined(AMBIGUOUS_STRING_FUNCTIONS_BUG)
#include <string>
#endif /* AMBIGUOUS_STRING_FUNCTIONS_BUG */
// user include files
#include "Chi_c1/Chi_c1.h"
#include "Processor/Action.h"
// STL classes
//
// constants, enums and typedefs
//
// ---- cvs-based strings (Id and Tag with which file was checked out)
static const char* const kIdString = "$Id: processor_DONT_TOUCH.cc,v 1.5 1998/12/01 21:11:58 mkl Exp $";
static const char* const kTagString = "$Name: v07_03_00 $";
//
// function definitions
//
//
// static data member definitions
//
//
// member functions
//
// ---------------- binding method to stream -------------------
void
Chi_c1::bind(
ActionBase::ActionResult (Chi_c1::*iMethod)( Frame& ),
const Stream::Type& iStream )
{
bindAction( iStream, new Action<Chi_c1>( iMethod, this ) );
}
//
// const member functions
//
//
// static member functions
//
| [
"tingxiao2007@gmail.com"
] | tingxiao2007@gmail.com |
6ec7391fc919aa3598a80716a5b263ae3044b6a0 | 8521262cb1994d209b71d14634f8f17e3d15965f | /CObject.h | 7b776fabe3f234f99e3a875769f976f5e24b656b | [] | no_license | jwvg0425/turtle-game | f770860fcf5edb7608791bade4095f98857ceb99 | 12bc617f71cdd33a5fc3a5d3fe37e23be8fe5978 | refs/heads/main | 2023-04-10T08:32:26.147514 | 2021-04-18T06:12:55 | 2021-04-18T06:12:55 | 359,059,437 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 424 | h | #pragma once
#include <Windows.h>
class CObject
{
protected:
int x,y; //현재 x,y 좌표
RECT area; //이 오브젝트가 차지하는 범위
public:
virtual int GetX();
virtual int GetY();
void SetX(int ax){x=ax;}
void SetY(int ay){y=ay;}
virtual RECT GetArea(){return area;}
virtual void Draw(HDC hdc)=0;
virtual bool IsScreenOut(); // 화면밖으로 나갔는지 아닌지. 나갔으면 삭제시켜야함.
}; | [
"jwvg0425@naver.com"
] | jwvg0425@naver.com |
434950314d2122faa76f9496b3c1fdfbaba11e96 | 4d6bf26f4d9a43082f87e177c1a2ac6c9662c288 | /Chapter 17/Program example/number_list_template.h | da21bfb8360c65aba637360f7b07c7a96754d93e | [] | no_license | Miao4382/Starting-Out-with-Cplusplus | 08d13d75fdb741be59a398b76275c5ee394840ca | dd3a1eadcf403ae57a68183987fc24fbfac0517f | refs/heads/master | 2020-05-24T23:22:49.978761 | 2019-05-20T18:40:01 | 2019-05-20T18:40:01 | 187,513,299 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,852 | h | #ifndef NUMBERLIST_H
#define NUMBERLIST_H
#include <iostream>
template<class T>
class NumberList
{
private:
// declaring a structure for the list
struct ListNode
{
T value; // hold the value in one node
ListNode* next; // a pointer of the same type, to point to the next node
};
// define a list head pointer
ListNode* head;
public:
/* Constructor */
// default constructor
// the head will point to nullptr, this is an empty linked list
NumberList()
{ head = nullptr; }
/* Destructor */
// deletes all nodes of the linked list (list head: head)
~NumberList();
/* Linked list operations */
void AppendNode(T num);
void InsertNode(T num);
void DeleteNode(T num);
void DisplayList() const;
};
/* Function declaration */
/* Destructor */
// deletes all nodes of the linked list (list head: head)
template <class T>
NumberList<T>::~NumberList()
{
if (head != nullptr)
{
ListNode* ptr = head;
ListNode* previous_ptr = nullptr;
while (ptr != nullptr)
{
previous_ptr = ptr;
ptr = ptr->next;
delete previous_ptr;
previous_ptr = nullptr;
}
delete previous_ptr;
previous_ptr = nullptr;
}
}
/* Linked list operations */
template <class T>
void NumberList<T>::AppendNode(T num)
{
ListNode* new_node = new ListNode;
ListNode* node_ptr;
new_node->value = num;
new_node->next = nullptr;
if (head == nullptr) // an empty list
{
head = new_node;
}
else
{
// find the last node
node_ptr = head;
while (node_ptr->next != nullptr)
node_ptr = node_ptr->next;
node_ptr->next = new_node;
}
}
template <class T>
void NumberList<T>::InsertNode(T num)
{
ListNode* new_node = new ListNode;
// store value
// the pointer should be assigned after proper position found
new_node->value = num;
// check if the list empty
if (!head)
{
head = new_node;
head->next = nullptr;
return;
}
// check if only one node in the list
// default order: ascending order
if(!head->next)
{
if (head->value >= new_node->value)
{
new_node->next = head;
head = new_node;
}
else
{
head->next = new_node;
new_node->next = nullptr;
}
return;
}
/* more than one node */
// determine the sorting mode: ascending, descending or all element equal
ListNode* ptr_1;
ListNode* ptr_2;
ptr_1 = head;
ptr_2 = head->next;
int sort_mode = 2; // flag, 1: ascending; 0: all equal; -1: descending; 2: not determined yet
while (sort_mode == 2)
{
if (ptr_1->value > ptr_2->value)
{
sort_mode = -1; // descending order
}
else if (ptr_1->value < ptr_2->value)
{
sort_mode = 1; // ascending order
}
else
{
if (!ptr_2->next) // means ptr_2 is the last element
{
sort_mode = 0;
break;
}
// ptr_2 is not the last element, move to next position and continue
ptr_1 = ptr_1->next;
ptr_2 = ptr_2->next;
}
}
// relocate ptr_1 and ptr_2
ptr_1 = nullptr;
ptr_2 = head;
// insert the new_node to the list based on the sorting mode
switch (sort_mode)
{
// ascending
case 1:
// find the right position
while (ptr_2 != nullptr && ptr_2->value < num)
{
ptr_1 = ptr_2;
ptr_2 = ptr_2->next;
}
// after the above while loop, right position found
// if the first node matches, insert to first node
if (ptr_1 == nullptr)
{
head = new_node;
new_node->next = ptr_2;
}
// if not the first node, the right position is between ptr_1 and ptr_2
else
{
ptr_1->next = new_node;
new_node->next = ptr_2;
}
break;
// descending
case -1:
// find out the right position
while (ptr_2 != nullptr && ptr_2->value > num)
{
// update position
ptr_1 = ptr_2;
ptr_2 = ptr_2->next;
}
// right position found
// if first node matches, insert to first node
if (ptr_1 == nullptr)
{
head = new_node;
new_node->next = ptr_2;
}
else
{
ptr_1->next = new_node;
new_node->next = ptr_2;
}
break;
// all element are equal, by default, insert in ascending order
case 0:
if (head->value >= new_node->value) // new_node should be the first
{
new_node->next = head;
head = new_node;
return;
}
else
AppendNode(new_node->value); // append to the end of the list
}
}
// delete node function
// search a node with value num, and delete it
// if no match found, print message
template <class T>
void NumberList<T>::DeleteNode(T num)
{
/* Check if the list is empty */
if (!head)
return;
/* Define two navigation pointers */
ListNode* ptr = head;
ListNode* previous_ptr = nullptr;
/* Check if the first node is the target */
if (head->value == num)
{
head = head->next;
delete ptr;
return;
}
/* Check middle node */
while (ptr != nullptr && ptr->value != num)
{
previous_ptr = ptr;
ptr = ptr->next;
}
// if ptr is not the nullptr, not the end, match found
if (ptr)
{
previous_ptr->next = ptr->next;
delete ptr;
return;
}
std::cout << "No match with a value of " << num << "found.\n";
}
template <class T>
void NumberList<T>::DisplayList() const
{
ListNode* node_ptr = head;
// notify empty list
if (!node_ptr)
std::cout << "Empty list!\n";
// display list
else
{
while (node_ptr->next)
{
std::cout << node_ptr->value << "\n";
node_ptr = node_ptr->next;
}
// display the last node
std::cout << node_ptr->value << "\n";
}
}
#endif | [
"33183267+Miao4382@users.noreply.github.com"
] | 33183267+Miao4382@users.noreply.github.com |
37960ecb05395bdc0871f5fcb6db7f9db5f97434 | d54672bd4f2eadcb5864547c65fb8f1a3fc97a88 | /sketch_rail.ino | c435360dddee7d57f332f756564d20e0760e18a7 | [] | no_license | ac005sheekar/Autonomous-Rail-Crossing-System | 4b656a4a19932204d55ba6eff30636ba6a79034c | f1a3462ab16fd40e871c1426eedceeccc7266655 | refs/heads/master | 2021-07-08T10:28:07.879824 | 2020-08-22T20:39:34 | 2020-08-22T20:39:34 | 181,207,968 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,900 | ino | //the code is entirely created by: SHEEKAR BANERJEE
//Dept. of CSE, IUBAT UNIVERSITY
#include<Servo.h> //This calls the Header of the repository containing the library files of Servo Motor Driver Modules
#define trigPin 9 //This initializes the Trig pin of HC-05 Ultrasonic Sensor to the pin no. 9 of Arduino Microcontroller
#define echoPin 10 //This initializes the Echo pin of HC-05 Ultrasonic Sensor to the pin no. 10 of Arduino Microcontroller
Servo sm; //Servo is a Class which is providing an independent data type // sm is a variable which is representing the servo motor
int sound=250;
void setup() {
Serial.begin(9600);
pinMode(trigPin,OUTPUT); //Here, Trig pin triggers the electrical impulses into the sensor as an output
pinMode(echoPin,INPUT); //Here, Echo pin inputs the reflective signals into the sensor
sm.attach(3); //The Coding Yellow Wire of the Servo motor is attached to the pin no. 3 of Arduino Microcontroller
}
void loop() {
long duration, distance;
digitalWrite(trigPin, LOW);
delayMicroseconds(2); // It will wait for 2 microseconds after every single electrical implulse of Trig pin if it is sending LOW(less than 1.6V) signal
digitalWrite(trigPin, HIGH);
delayMicroseconds(10); //It will wait for 10 microseconds after every single electrical implulse of Trig pin if it is sending HIGH(greater than 1.6V) signal
digitalWrite(trigPin, LOW);
duration=pulseIn(echoPin, HIGH); //Sensor inputs the signal through the Echo pin
distance=(duration/2)/29.1; //Calculation of distance
if(distance<10) //According to the reflection time calculation, if the distance is less than 10 cm
{
sm.write(80); //than the Servo Motor will rotate for 80 degrees
}
else {
sm.write(0); //Unless this, the Servo motor will stand still
}
}
| [
"noreply@github.com"
] | ac005sheekar.noreply@github.com |
563be2f041f017f0d3fb7a425c29d2557d9d4be9 | 39b282dc5373f6ac83397ae5b5e9c4ad0ab4c8d8 | /Src/Object/Value/objectvaluetext.h | 8277cd7e49feed8a0e009b96105976f586492c5d | [] | no_license | larnin/SpacePirateTools | 335c8c1f495bfc8f0f737e86a63d5d50f4ff99f7 | 9d94663801d70c433202b335e3ada6fd53b3a7dc | refs/heads/master | 2021-01-24T02:04:44.499940 | 2018-11-23T14:37:05 | 2018-11-23T14:37:05 | 122,832,993 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 662 | h | #ifndef OBJECTVALUETEXT_H
#define OBJECTVALUETEXT_H
#include "objectvaluebase.h"
#include <QString>
class ObjectValueText : public ObjectValueBase
{
public:
ObjectValueText();
ObjectValueText(const QJsonObject & obj);
ObjectValueText(const ObjectValueText &) = default;
std::unique_ptr<ObjectValueBase> clone() const override { return std::make_unique<ObjectValueText>(*this); }
std::unique_ptr<ValueRendererBase> renderer(SceneNode* node) override;
QString toString() const override;
QWidget* createUi() override;
QString text;
protected:
void onSave(QJsonObject & obj) const override;
};
#endif // OBJECTVALUETEXT_H
| [
"nicolas-donald.laurent@laposte.net"
] | nicolas-donald.laurent@laposte.net |
2680c37806f4c2ecdab1d1e68e9ca37b5a2aa670 | 34bcb4ce810b548025ad62f5c05146bc638f474f | /CS3130/Project 1/Proj1C.cpp | bd72350ebc9654a5bb88776026c5070408f6e820 | [] | no_license | bkedge/School-Projects | e11f98211425159333e3fdc453e58863ebec5535 | 1350d5d3745bd54cc014f103c367ddff585bf76c | refs/heads/master | 2021-01-17T11:20:11.075879 | 2016-12-15T18:35:03 | 2016-12-15T18:35:03 | 48,396,334 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,973 | cpp | // Brady Kedge
// 02-09-16
//Project 1 - Part C
//Time comparing program
#include <iostream>
#include <sys/time.h>
using namespace std;
int FibonacciRecursive(int n);
int FibonacciIteration(int n);
int main()
{
int n;
hrtime_t start, end, total;
cout << "Enter the Nth number of Fibonacci you want to find: ";
cin >> n;
//Recursive method
start = gethrtime();
FibonacciRecursive(n);
end = gethrtime();
total = end - start;
//Time Calculation
cout << "Time for Recursive method: " << endl;
//Start
cout << " Start: " << start << endl;
//End
cout << " End: " << end << endl;
//Total
cout << " Total Time: " << total << endl;
//Iterative method
start = gethrtime();
FibonacciIteration(n);
end = gethrtime();
//Time Calculation
total = end - start;
cout << "Time for Iterative method: " << endl;
//Start
cout << " Start: " << start << endl;
//End
cout << " End: " << end << endl;
//Total
cout << " Total Time: " << total << endl;
return 0;
}
int FibonacciRecursive(int n)
{
//Base cases
if (n == 1)
return 1;
if (n == 0)
return 0;
//Recursive function
return FibonacciRecursive(n - 1) + FibonacciRecursive(n - 2);
}
int FibonacciIteration(int n)
{
if (n == 1)
return 1;
if (n == 0)
return 0;
int n1 = 0;
int n2 = 1;
int addition = 0;
for (int i=0; i < n-1; i++)
{
addition = n2 + n1;
n1 = n2;
n2 = addition;
}
return addition;
}
| [
"bradykedge@gmail.com"
] | bradykedge@gmail.com |
6582b543375047ff735170726c21e45c231bbd83 | 8ae5b7001709dc6ede1776f6412091af55b77742 | /algorithm/Flatten_Binary_Tree_to_Linked_List.cpp | e0e457a60864535f11500a478bfd548edb8f81bf | [] | no_license | bingai/leetcode-1 | 08fa4ef6319d95c2503d645c8ae28c337ff732dd | cef9b57bad4daba6661e0427e6ebd538c70c50ae | refs/heads/master | 2020-04-27T02:03:56.789027 | 2017-06-16T14:51:16 | 2017-06-16T14:51:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 734 | cpp | /**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
void flatten(TreeNode *root) {
if(root==NULL) return;
f(root);
}
private:
TreeNode* f(TreeNode *root) {
if(!root->left && !root->right) return root;
TreeNode* r = NULL;
TreeNode* l = NULL;
if(root->right) r = f(root->right);
if(root->left) {
l = f(root->left);
root->left = NULL;
root->right = l;
while(l->right) l=l->right;
l->right = r;
}
return root;
}
};
| [
"xizhonghua@gmail.com"
] | xizhonghua@gmail.com |
bda43bec308ecc0ca35d2c5fd6348201a1a67afb | 948d555823c2d123601ff6c149869be377521282 | /SDK/SoT_BP_MerchantCrate_Commodity_Fort_Desc_classes.hpp | bf67ab83ab7e77c9cc87905753e9c9d196f5538d | [] | no_license | besimbicer89/SoT-SDK | 2acf79303c65edab01107ab4511e9b9af8ab9743 | 3a4c6f3b77c1045b7ef0cddd064350056ef7d252 | refs/heads/master | 2022-04-24T01:03:37.163407 | 2020-04-27T12:45:47 | 2020-04-27T12:45:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 731 | hpp | #pragma once
// SeaOfThieves (1.6.4) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
namespace SDK
{
//---------------------------------------------------------------------------
//Classes
//---------------------------------------------------------------------------
// BlueprintGeneratedClass BP_MerchantCrate_Commodity_Fort_Desc.BP_MerchantCrate_Commodity_Fort_Desc_C
// 0x0000 (0x0130 - 0x0130)
class UBP_MerchantCrate_Commodity_Fort_Desc_C : public UBootyItemDesc
{
public:
static UClass* StaticClass()
{
static auto ptr = UObject::FindClass("BlueprintGeneratedClass BP_MerchantCrate_Commodity_Fort_Desc.BP_MerchantCrate_Commodity_Fort_Desc_C");
return ptr;
}
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"getpeyton@gmail.com"
] | getpeyton@gmail.com |
6e607c5559362aa469e8ba399374a2755f6a90fb | 2e1bf5b9d78cbeafc5dd613e640f6ac26fa70304 | /源码/VirusKiller/StdAfx.h | 005d90ab28a637b1b20d3e432d555391e4ccdb30 | [] | no_license | cheliequan/PcGuard | e5fab9bee01f9969ec784831a4ff4c25f94b2778 | 837016f1a12a5f26578ed6115ba6299a76ff597f | refs/heads/master | 2021-01-21T07:53:13.765925 | 2014-01-12T05:56:29 | 2014-01-12T05:56:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,110 | h | // stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__4A8550C9_874E_4DE2_ADE1_51AE039BF90D__INCLUDED_)
#define AFX_STDAFX_H__4A8550C9_874E_4DE2_ADE1_51AE039BF90D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
class CKillerDlg;
extern CKillerDlg *GetCKillerDlg();
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__4A8550C9_874E_4DE2_ADE1_51AE039BF90D__INCLUDED_)
| [
"daniel@daniel-OptiPlex-320.(none)"
] | daniel@daniel-OptiPlex-320.(none) |
9e71f70e0ba7c98c02b65734a43c84d4460b930e | 974d04d2ea27b1bba1c01015a98112d2afb78fe5 | /paddle/fluid/framework/fleet/heter_ps/gpu_graph_utils.h | fbdcb181e0f285164cf18657fa41578183cb3600 | [
"Apache-2.0"
] | permissive | PaddlePaddle/Paddle | b3d2583119082c8e4b74331dacc4d39ed4d7cff0 | 22a11a60e0e3d10a3cf610077a3d9942a6f964cb | refs/heads/develop | 2023-08-17T21:27:30.568889 | 2023-08-17T12:38:22 | 2023-08-17T12:38:22 | 65,711,522 | 20,414 | 5,891 | Apache-2.0 | 2023-09-14T19:20:51 | 2016-08-15T06:59:08 | C++ | UTF-8 | C++ | false | false | 4,209 | h | // Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <cuda.h>
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
#include <stdio.h>
#include <time.h>
#include <algorithm>
#include <random>
#include <vector>
#include "paddle/fluid/platform/enforce.h"
#include "paddle/phi/core/flags.h"
PHI_DECLARE_bool(gpugraph_debug_gpu_memory);
namespace paddle {
namespace framework {
/**
* @brief wrapper of the std::default_random_engine each construction will have
* different seeds.
*/
struct random_engine_wrapper_t {
std::default_random_engine engine;
#if !defined(_WIN32)
random_engine_wrapper_t() {
timespec tp;
clock_gettime(CLOCK_REALTIME, &tp);
static std::atomic<unsigned long> x( // NOLINT
static_cast<unsigned long>(1)); // NOLINT
std::seed_seq sseq = {
x++, x++, x++, static_cast<uint64_t>(tp.tv_sec * 1e9 + tp.tv_nsec)};
engine.seed(sseq);
}
#endif
};
/**
* @brief Get a n-size vector<int>, but its element has unique shuffled int
* value (from 0 to n-1).
* @param n vector size
* @return the shuffled vector.
*/
inline std::vector<int> shuffle_int_vector(int n) {
random_engine_wrapper_t random_engine_wrapper;
std::vector<int> ret(n);
int i = 0;
for (auto& e : ret) {
e = i++;
}
std::shuffle(ret.begin(), ret.end(), random_engine_wrapper.engine);
return ret;
}
#define CUDA_CHECK(cmd) \
do { \
cudaError_t e = cmd; \
CHECK(e == cudaSuccess) << "Cuda failure " << __FILE__ << ":" << __LINE__ \
<< " " << cudaGetErrorString(e) << std::endl; \
} while (0)
class CudaDeviceRestorer {
public:
CudaDeviceRestorer() { cudaGetDevice(&dev_); }
~CudaDeviceRestorer() { cudaSetDevice(dev_); }
private:
int dev_;
};
inline void debug_gpu_memory_info(int gpu_id, const char* desc) {
if (!FLAGS_gpugraph_debug_gpu_memory) {
return;
}
CudaDeviceRestorer r;
size_t avail{0};
size_t total{0};
cudaSetDevice(gpu_id);
auto err = cudaMemGetInfo(&avail, &total);
PADDLE_ENFORCE_EQ(
err,
cudaSuccess,
platform::errors::InvalidArgument("cudaMemGetInfo failed!"));
VLOG(0) << "updatex gpu memory on device " << gpu_id << ", "
<< "avail=" << avail / 1024.0 / 1024.0 / 1024.0 << "g, "
<< "total=" << total / 1024.0 / 1024.0 / 1024.0 << "g, "
<< "use_rate=" << (total - avail) / static_cast<double>(total)
<< "%, "
<< "desc=" << desc;
}
inline void debug_gpu_memory_info(const char* desc) {
if (!FLAGS_gpugraph_debug_gpu_memory) {
return;
}
CudaDeviceRestorer r;
int device_num = 0;
auto err = cudaGetDeviceCount(&device_num);
PADDLE_ENFORCE_EQ(
err,
cudaSuccess,
platform::errors::InvalidArgument("cudaGetDeviceCount failed!"));
size_t avail{0};
size_t total{0};
for (int i = 0; i < device_num; ++i) {
cudaSetDevice(i);
auto err = cudaMemGetInfo(&avail, &total);
PADDLE_ENFORCE_EQ(
err,
cudaSuccess,
platform::errors::InvalidArgument("cudaMemGetInfo failed!"));
VLOG(0) << "update gpu memory on device " << i << ", "
<< "avail=" << avail / 1024.0 / 1024.0 / 1024.0 << "g, "
<< "total=" << total / 1024.0 / 1024.0 / 1024.0 << "g, "
<< "use_rate=" << (total - avail) / static_cast<double>(total)
<< "%, "
<< "desc=" << desc;
}
}
}; // namespace framework
}; // namespace paddle
| [
"noreply@github.com"
] | PaddlePaddle.noreply@github.com |
a9aea008cd8fe6abf05b07d1a38398964c942de8 | 38628fe00c9aa48343fbcd78a53dc8855c6fcaf6 | /shared/winnt/ntservice.cpp | b47d646e68fb5891c7ed424f08f0d7c10b671ee7 | [
"LicenseRef-scancode-openssl",
"LicenseRef-scancode-ssleay-windows",
"OpenSSL",
"Apache-2.0"
] | permissive | skyformat99/safmq | c5673ca62fae2f0071d80b479bee2857db924518 | d1bcd06cdea18d2c65bd1c6a7b61858078cd0948 | refs/heads/master | 2021-05-12T05:28:14.433072 | 2013-10-30T15:40:43 | 2013-10-30T15:40:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,190 | cpp | /*
Copyright 2004-2008 Matthew J. Battey
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.
This software implements an NT Service.
*/
#include "ntservice.h"
#include <direct.h>
#include <stdlib.h>
#include <assert.h>
#include <iostream>
#include <string>
#include "regutil.h"
using namespace std;
NTService* theService = NULL;
NTService::NTService()
{
m_shouldQuit = false;
m_thisServiceStatus = NULL;
assert(theService == NULL);
theService = this;
}
NTService::~NTService()
{
}
bool NTService::shouldQuit()
{
return m_shouldQuit;
}
void NTService::registerService(const char* exename)
{
SC_HANDLE manager = OpenSCManager(NULL,NULL,SC_MANAGER_CREATE_SERVICE);
char path[MAX_PATH];
getcwd(path,sizeof(path));
strcat(path,"\\");
strcat(path,exename);
if (manager) {
SC_HANDLE schService = CreateService(
manager,
getServiceName(),
getServiceLongName(),
SERVICE_ALL_ACCESS,
SERVICE_WIN32_OWN_PROCESS,
SERVICE_AUTO_START,
SERVICE_ERROR_NORMAL,
path, // service's binary
getLoadOrderGroup(), // no load ordering group
NULL, // no tag identifier
getDependancies(), // no dependencies
getLoginAccount(), // LocalSystem account
getLoginPassword()); // no password
if (schService) {
if (getServiceDescription() != NULL) {
try {
string strkey = string("SYSTEM\\CurrentControlSet\\Services\\") + getServiceName();
CRegKey key(HKEY_LOCAL_MACHINE,strkey.c_str());
key.setString("Description",getServiceDescription());
} catch (CRegKeyException ex) {
cerr << "While setting description: " << ex.what() << endl;
}
}
cout << getServiceName() << " installed successfully." << endl;
CloseServiceHandle(schService);
} else {
DWORD error = GetLastError();
switch (error) {
case ERROR_ACCESS_DENIED: // The handle to the specified service control manager database does not have SC_MANAGER_CREATE_SERVICE access.
cerr << "Error creating service: access denied." << endl; break;
case ERROR_DUP_NAME: //The display name already exists in the service control manager database either as a service name or as another display name.
cerr << "Error creating service: duplicate service name." << endl; break;
case ERROR_INVALID_SERVICE_ACCOUNT: //The user account name specified in the lpServiceStartName parameter does not exist.
cerr << "Error creating service: invalid service account." << endl; break;
case ERROR_SERVICE_EXISTS: //The specified service already exists in this database.
cerr << "Error creating service: service already exists in database." << endl; break;
}
}
CloseServiceHandle(manager);
} else {
DWORD error = GetLastError();
switch (error) {
case ERROR_ACCESS_DENIED:
cerr << "Error opening service control manager: Cannot create service, access denied." << endl; break;
case ERROR_DATABASE_DOES_NOT_EXIST:
cerr << "Error opening service control manager: Unable to access service database, database does not exist." << endl; break;
case ERROR_INVALID_PARAMETER:
cerr << "Error opening service control manager invalid parameter." << endl; break;
}
}
}
void NTService::unregisterService()
{
SC_HANDLE manager = OpenSCManager(NULL,NULL,SC_MANAGER_CREATE_SERVICE);
if (manager) {
SC_HANDLE schService = OpenService(manager,getServiceName(),SERVICE_ALL_ACCESS);
if (schService) {
if (!DeleteService(schService)) {
DWORD error = GetLastError();
switch (error) {
case ERROR_ACCESS_DENIED:
cerr << "Error removing service: access denied." << endl; break;
case ERROR_SERVICE_MARKED_FOR_DELETE:
cerr << "Service already marked for deletion." << endl; break;
default:
cerr << "Error removing service." << endl; break;
}
} else {
cout << getServiceName() << " removed successfully.";
}
} else {
DWORD error = GetLastError();
switch (error) {
case ERROR_ACCESS_DENIED: // The handle to the specified service control manager database does not have SC_MANAGER_CREATE_SERVICE access.
cerr << "Error removing service: access denied." << endl; break;
default:
cerr << "Error removing service while opening service." << endl; break;
}
}
CloseServiceHandle(manager);
} else {
DWORD error = GetLastError();
switch (error) {
case ERROR_ACCESS_DENIED:
cerr << "Error opening service control manager: Cannot create service, access denied." << endl; break;
case ERROR_DATABASE_DOES_NOT_EXIST:
cerr << "Error opening service control manager: Unable to access service database, database does not exist." << endl; break;
case ERROR_INVALID_PARAMETER:
cerr << "Error opening service control manager invalid parameter." << endl; break;
}
}
}
void NTService::startService(unsigned long argc, const char** argv)
{
SC_HANDLE manager = OpenSCManager(NULL,NULL,SC_MANAGER_ALL_ACCESS);
if (manager) {
SC_HANDLE service = OpenService(manager,getServiceName(),SERVICE_START);
if (service) {
cout << "attempting to start service" << endl;
if (StartService(service,argc,argv))
cout << getServiceName() << " started.";
else {
DWORD error = GetLastError();
switch (error) {
case ERROR_ACCESS_DENIED:
cerr << "The specified handle was not opened with SERVICE_START access." << endl; break;
case ERROR_INVALID_HANDLE:
cerr << "The specified handle is invalid." << endl; break;
case ERROR_PATH_NOT_FOUND:
cerr << "The service binary file could not be found." << endl; break;
case ERROR_SERVICE_ALREADY_RUNNING:
cerr << "An instance of the service is already running." << endl; break;
case ERROR_SERVICE_DATABASE_LOCKED:
cerr << "The database is locked." << endl; break;
case ERROR_SERVICE_DEPENDENCY_DELETED:
cerr << "The service depends on a service that does not exist or has been marked for deletion." << endl; break;
case ERROR_SERVICE_DEPENDENCY_FAIL:
cerr << "The service depends on another service that has failed to start." << endl; break;
case ERROR_SERVICE_DISABLED:
cerr << "The service has been disabled." << endl; break;
case ERROR_SERVICE_LOGON_FAILED:
cerr << "The service could not be logged on. This error occurs if the service was started from an account that does not have the \"Log on as a service\" right." << endl; break;
case ERROR_SERVICE_MARKED_FOR_DELETE:
cerr << "The service has been marked for deletion." << endl; break;
case ERROR_SERVICE_NO_THREAD:
cerr << "A thread could not be created for the service." << endl; break;
case ERROR_SERVICE_REQUEST_TIMEOUT:
cerr << "The process for the service was started, but it did not call StartServiceCtrlDispatcher, or the thread that called StartServiceCtrlDispatcher may be blocked in a control handler function." << endl; break;
default:
cerr << "An error occured attempting to start the service." << endl; break;
}
}
CloseServiceHandle(service);
} else {
switch (GetLastError()) {
case ERROR_ACCESS_DENIED:
cerr << "Error: Access denied accessing service to start." << endl; break;
case ERROR_SERVICE_DOES_NOT_EXIST:
cerr << "Error: Service does not exist, please install first." << endl; break;
default:
cerr << "Error occurred accessing service." << endl;
}
}
CloseServiceHandle(manager);
} else {
switch (GetLastError()) {
case ERROR_ACCESS_DENIED:
cerr << "Error: Access denied accessing service manager." << endl; break;
default:
cerr << "Error occurred accessing service." << endl;
}
}
}
const char* NTService::getLoadOrderGroup()
{
return NULL; // no dependancies
}
const char* NTService::getDependancies()
{
return NULL; // no dependancies
}
const char* NTService::getLoginAccount()
{
return NULL; // use the local system account
}
const char* NTService::getLoginPassword()
{
return NULL; // no password
}
void NTService::onStopService()
{
// default set m_shouldQuit to true.
m_shouldQuit = true;
}
void NTService::onShutdownService()
{
// Default call onStopService();
onStopService();
}
void NTService::onPauseService()
{
// default do nothing
}
void NTService::onContinueService()
{
// default do nothing
}
void NTService::onInterrogateService()
{
// Default report the status
SetServiceStatus(SERVICE_STOP_PENDING);
}
void WINAPI NTService::ServiceMain(unsigned long argc, char** argv)
{
memset(&theService->m_status,0,sizeof(theService->m_status));
theService->m_thisServiceStatus = RegisterServiceCtrlHandler(theService->getServiceName(), NTService::ServiceControlHandler);
theService->m_status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
theService->m_status.dwCurrentState = SERVICE_START_PENDING;
theService->m_status.dwControlsAccepted = SERVICE_ACCEPT_SHUTDOWN | SERVICE_ACCEPT_STOP;
::SetServiceStatus(theService->m_thisServiceStatus, &theService->m_status);
theService->performService(argc, (const char**)argv);
theService->m_status.dwCurrentState = SERVICE_STOPPED;
::SetServiceStatus(theService->m_thisServiceStatus, &theService->m_status);
}
void WINAPI NTService::ServiceControlHandler(unsigned long fdwControl)
{
switch (fdwControl) {
default:
case SERVICE_CONTROL_CONTINUE: // Notifies a paused service that it should resume.
theService->onContinueService();
break;
case SERVICE_CONTROL_INTERROGATE: // Notifies a service that it should report its current status information to the service control manager.
theService->onInterrogateService();
break;
case SERVICE_CONTROL_PAUSE: // Notifies a service that it should pause.
theService->onPauseService();
break;
case SERVICE_CONTROL_SHUTDOWN: // Notifies a service that the system is shutting down so the service can perform cleanup tasks.
theService->onShutdownService();
break;
case SERVICE_CONTROL_STOP:// Notifies a service that it should stop.
theService->onStopService();
break;
}
}
bool NTService::dispatchService()
{
SERVICE_TABLE_ENTRY DispatchTable[] = {
{(char*)getServiceName(), NTService::ServiceMain},
{NULL, NULL}
};
return StartServiceCtrlDispatcher(DispatchTable)!=0;
}
void NTService::SetServiceStatus(long status)
{
m_status.dwCurrentState = status;
::SetServiceStatus(m_thisServiceStatus, &m_status);
}
| [
"jhoelscher@jan-holschers-macbook.fritz.box"
] | jhoelscher@jan-holschers-macbook.fritz.box |
2575648fd7bc7598b1314cb10bf91905e0f37c4c | 6f224b734744e38062a100c42d737b433292fb47 | /clang/test/AST/constraints-explicit-instantiation.cpp | 10b6432f2db8c2ac30535f1117d1c804dd45abf9 | [
"Apache-2.0",
"LLVM-exception",
"NCSA"
] | permissive | smeenai/llvm-project | 1af036024dcc175c29c9bd2901358ad9b0e6610e | 764287f1ad69469cc264bb094e8fcdcfdd0fcdfb | refs/heads/main | 2023-09-01T04:26:38.516584 | 2023-08-29T21:11:41 | 2023-08-31T22:16:12 | 216,062,316 | 0 | 0 | Apache-2.0 | 2019-10-18T16:12:03 | 2019-10-18T16:12:03 | null | UTF-8 | C++ | false | false | 903 | cpp | // RUN: %clang_cc1 -std=c++20 -ast-dump %s | FileCheck %s
namespace PR46029 {
template <int N>
void canary1();
template <int N>
void canary2();
template <int N>
struct A {
void f() requires(N == 1) {
static_assert(N == 1);
canary1<N>();
}
void f() requires(N == 2) {
static_assert(N == 2);
canary2<N>();
}
};
// This checks that `canary1<1>` and `canaray2<2>` are instantiated, thus
// indirectly validating that the correct candidates of `A::f` were really
// instantiated each time.
// The `static_assert`s validate we don't instantiate wrong candidates.
// CHECK:{{.*}}FunctionTemplateDecl {{.*}} canary1
// CHECK: {{.*}}TemplateArgument integral
// CHECK-SAME: {{1$}}
template struct A<1>;
// CHECK: {{.*}}FunctionTemplateDecl {{.*}} canary2
// CHECK: {{.*}}TemplateArgument integral
// CHECK-SAME: {{2$}}
template struct A<2>;
template struct A<3>;
}
| [
"erich.keane@intel.com"
] | erich.keane@intel.com |
340a2a65b70a6de40d3c04d0227930f52410f05b | d0c44dd3da2ef8c0ff835982a437946cbf4d2940 | /cmake-build-debug/programs_tiling/function14484/function14484_schedule_32/function14484_schedule_32.cpp | 5ed191a41e21003502bfda8f8ef56d6856ab41e2 | [] | no_license | IsraMekki/tiramisu_code_generator | 8b3f1d63cff62ba9f5242c019058d5a3119184a3 | 5a259d8e244af452e5301126683fa4320c2047a3 | refs/heads/master | 2020-04-29T17:27:57.987172 | 2019-04-23T16:50:32 | 2019-04-23T16:50:32 | 176,297,755 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 1,330 | cpp | #include <tiramisu/tiramisu.h>
using namespace tiramisu;
int main(int argc, char **argv){
tiramisu::init("function14484_schedule_32");
constant c0("c0", 64), c1("c1", 256), c2("c2", 2048);
var i0("i0", 0, c0), i1("i1", 0, c1), i2("i2", 0, c2), i01("i01"), i02("i02"), i03("i03"), i04("i04"), i05("i05"), i06("i06");
input input00("input00", {i1}, p_int32);
input input01("input01", {i0}, p_int32);
input input02("input02", {i2}, p_int32);
input input03("input03", {i0, i1}, p_int32);
computation comp0("comp0", {i0, i1, i2}, input00(i1) - input01(i0) + input02(i2) - input03(i0, i1));
comp0.tile(i0, i1, i2, 64, 128, 128, i01, i02, i03, i04, i05, i06);
comp0.parallelize(i01);
buffer buf00("buf00", {256}, p_int32, a_input);
buffer buf01("buf01", {64}, p_int32, a_input);
buffer buf02("buf02", {2048}, p_int32, a_input);
buffer buf03("buf03", {64, 256}, p_int32, a_input);
buffer buf0("buf0", {64, 256, 2048}, p_int32, a_output);
input00.store_in(&buf00);
input01.store_in(&buf01);
input02.store_in(&buf02);
input03.store_in(&buf03);
comp0.store_in(&buf0);
tiramisu::codegen({&buf00, &buf01, &buf02, &buf03, &buf0}, "../data/programs/function14484/function14484_schedule_32/function14484_schedule_32.o");
return 0;
} | [
"ei_mekki@esi.dz"
] | ei_mekki@esi.dz |
82d06bf632081e2eb7bb0c5031085a89d33fe157 | d9b4adb8bdd3a19859b050c1735d06a380bb9929 | /poj-cpp/2871/14734703_AC_0MS_372K.cc | 84a5dc2fe15b41f9ec19928aeb05d94572ababfe | [] | no_license | conwnet/way-of-algorithm | eea4901ab62a6bc189e5c60209dc1e8610f76806 | 201df876cf55a7eae7e55789f2fa43d2f2545628 | refs/heads/master | 2021-07-31T19:17:48.871429 | 2021-07-24T17:42:30 | 2021-07-24T17:42:30 | 75,063,660 | 20 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 277 | cc | #include <stdio.h>
int main()
{
double p, q;
scanf("%lf", &p);
while(scanf("%lf", &q)) {
if(q==999) break;
printf("%.2f\n", q-p);
p = q;
}
printf("End of Output\n");
return 0;
}
| [
"netcon@live.com"
] | netcon@live.com |
2991dae81044844d5ce6026e7063a05ee510fd2d | 600df3590cce1fe49b9a96e9ca5b5242884a2a70 | /chrome/browser/chromeos/input_method/mock_input_method_manager.cc | 7dc9f219169ad80f87be174c127581246fded470 | [
"BSD-3-Clause"
] | permissive | metux/chromium-suckless | efd087ba4f4070a6caac5bfbfb0f7a4e2f3c438a | 72a05af97787001756bae2511b7985e61498c965 | refs/heads/orig | 2022-12-04T23:53:58.681218 | 2017-04-30T10:59:06 | 2017-04-30T23:35:58 | 89,884,931 | 5 | 3 | BSD-3-Clause | 2022-11-23T20:52:53 | 2017-05-01T00:09:08 | null | UTF-8 | C++ | false | false | 7,743 | cc | // Copyright (c) 2012 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 "chrome/browser/chromeos/input_method/mock_input_method_manager.h"
#include <utility>
namespace chromeos {
namespace input_method {
MockInputMethodManager::State::State(MockInputMethodManager* manager)
: manager_(manager) {
active_input_method_ids.push_back("xkb:us::eng");
}
MockInputMethodManager::State::~State() {
}
MockInputMethodManager::MockInputMethodManager()
: add_observer_count_(0),
remove_observer_count_(0),
state_(new State(this)),
util_(&delegate_),
mod3_used_(false) {
}
MockInputMethodManager::~MockInputMethodManager() {
}
InputMethodManager::UISessionState MockInputMethodManager::GetUISessionState() {
return InputMethodManager::STATE_BROWSER_SCREEN;
}
void MockInputMethodManager::AddObserver(
InputMethodManager::Observer* observer) {
++add_observer_count_;
}
void MockInputMethodManager::AddCandidateWindowObserver(
InputMethodManager::CandidateWindowObserver* observer) {
}
void MockInputMethodManager::AddImeMenuObserver(
InputMethodManager::ImeMenuObserver* observer) {}
void MockInputMethodManager::RemoveObserver(
InputMethodManager::Observer* observer) {
++remove_observer_count_;
}
void MockInputMethodManager::RemoveCandidateWindowObserver(
InputMethodManager::CandidateWindowObserver* observer) {
}
void MockInputMethodManager::RemoveImeMenuObserver(
InputMethodManager::ImeMenuObserver* observer) {}
std::unique_ptr<InputMethodDescriptors>
MockInputMethodManager::GetSupportedInputMethods() const {
std::unique_ptr<InputMethodDescriptors> result(new InputMethodDescriptors);
result->push_back(
InputMethodUtil::GetFallbackInputMethodDescriptor());
return result;
}
std::unique_ptr<InputMethodDescriptors>
MockInputMethodManager::State::GetActiveInputMethods() const {
std::unique_ptr<InputMethodDescriptors> result(new InputMethodDescriptors);
result->push_back(
InputMethodUtil::GetFallbackInputMethodDescriptor());
return result;
}
const std::vector<std::string>&
MockInputMethodManager::State::GetActiveInputMethodIds() const {
return active_input_method_ids;
}
size_t MockInputMethodManager::State::GetNumActiveInputMethods() const {
return 1;
}
const InputMethodDescriptor*
MockInputMethodManager::State::GetInputMethodFromId(
const std::string& input_method_id) const {
static const InputMethodDescriptor defaultInputMethod =
InputMethodUtil::GetFallbackInputMethodDescriptor();
for (size_t i = 0; i < active_input_method_ids.size(); i++) {
if (input_method_id == active_input_method_ids[i]) {
return &defaultInputMethod;
}
}
return NULL;
}
void MockInputMethodManager::State::EnableLoginLayouts(
const std::string& language_code,
const std::vector<std::string>& initial_layout) {
}
void MockInputMethodManager::State::EnableLockScreenLayouts() {
}
bool MockInputMethodManager::State::ReplaceEnabledInputMethods(
const std::vector<std::string>& new_active_input_method_ids) {
return true;
}
bool MockInputMethodManager::State::EnableInputMethod(
const std::string& new_active_input_method_id) {
return true;
}
void MockInputMethodManager::State::ChangeInputMethod(
const std::string& input_method_id,
bool show_message) {
}
void MockInputMethodManager::ActivateInputMethodMenuItem(
const std::string& key) {
}
void MockInputMethodManager::State::AddInputMethodExtension(
const std::string& extension_id,
const InputMethodDescriptors& descriptors,
ui::IMEEngineHandlerInterface* instance) {}
void MockInputMethodManager::State::RemoveInputMethodExtension(
const std::string& extension_id) {
}
void MockInputMethodManager::State::GetInputMethodExtensions(
InputMethodDescriptors* result) {
}
void MockInputMethodManager::State::SetEnabledExtensionImes(
std::vector<std::string>* ids) {
}
void MockInputMethodManager::State::SetInputMethodLoginDefault() {
}
void MockInputMethodManager::State::SetInputMethodLoginDefaultFromVPD(
const std::string& locale,
const std::string& layout) {
}
bool MockInputMethodManager::State::CanCycleInputMethod() {
return true;
}
void MockInputMethodManager::State::SwitchToNextInputMethod() {
}
void MockInputMethodManager::State::SwitchToPreviousInputMethod() {
}
bool MockInputMethodManager::State::CanSwitchInputMethod(
const ui::Accelerator& accelerator) {
return true;
}
void MockInputMethodManager::State::SwitchInputMethod(
const ui::Accelerator& accelerator) {
}
InputMethodDescriptor MockInputMethodManager::State::GetCurrentInputMethod()
const {
InputMethodDescriptor descriptor =
InputMethodUtil::GetFallbackInputMethodDescriptor();
if (!current_input_method_id.empty()) {
return InputMethodDescriptor(current_input_method_id,
descriptor.name(),
descriptor.indicator(),
descriptor.keyboard_layouts(),
descriptor.language_codes(),
true,
GURL(), // options page url.
GURL()); // input view page url.
}
return descriptor;
}
bool MockInputMethodManager::IsISOLevel5ShiftUsedByCurrentInputMethod() const {
return mod3_used_;
}
bool MockInputMethodManager::IsAltGrUsedByCurrentInputMethod() const {
return false;
}
ImeKeyboard* MockInputMethodManager::GetImeKeyboard() { return &keyboard_; }
InputMethodUtil* MockInputMethodManager::GetInputMethodUtil() {
return &util_;
}
ComponentExtensionIMEManager*
MockInputMethodManager::GetComponentExtensionIMEManager() {
return comp_ime_manager_.get();
}
void MockInputMethodManager::SetComponentExtensionIMEManager(
std::unique_ptr<ComponentExtensionIMEManager> comp_ime_manager) {
comp_ime_manager_ = std::move(comp_ime_manager);
}
void MockInputMethodManager::set_application_locale(const std::string& value) {
delegate_.set_active_locale(value);
}
bool MockInputMethodManager::IsLoginKeyboard(
const std::string& layout) const {
return true;
}
bool MockInputMethodManager::MigrateInputMethods(
std::vector<std::string>* input_method_ids) {
return false;
}
scoped_refptr<InputMethodManager::State> MockInputMethodManager::CreateNewState(
Profile* profile) {
NOTIMPLEMENTED();
return state_;
}
scoped_refptr<InputMethodManager::State>
MockInputMethodManager::GetActiveIMEState() {
return scoped_refptr<InputMethodManager::State>(state_.get());
}
scoped_refptr<InputMethodManager::State> MockInputMethodManager::State::Clone()
const {
NOTIMPLEMENTED();
return manager_->GetActiveIMEState();
}
void MockInputMethodManager::SetState(
scoped_refptr<InputMethodManager::State> state) {
state_ = scoped_refptr<MockInputMethodManager::State>(
static_cast<MockInputMethodManager::State*>(state.get()));
}
void MockInputMethodManager::SetCurrentInputMethodId(
const std::string& input_method_id) {
state_->current_input_method_id = input_method_id;
}
void MockInputMethodManager::ImeMenuActivationChanged(bool is_active) {}
void MockInputMethodManager::NotifyImeMenuItemsChanged(
const std::string& engine_id,
const std::vector<InputMethodManager::MenuItem>& items) {}
void MockInputMethodManager::MaybeNotifyImeMenuActivationChanged() {}
void MockInputMethodManager::OverrideKeyboardUrlRef(const std::string& keyset) {
}
bool MockInputMethodManager::IsEmojiHandwritingVoiceOnImeMenuEnabled() {
return false;
}
} // namespace input_method
} // namespace chromeos
| [
"enrico.weigelt@gr13.net"
] | enrico.weigelt@gr13.net |
52afc7c656ad87101b4a611a6afb05c470932f92 | 5d7b9431a65c1a17821fb88fa78726796e4ce310 | /Shovel_Knight/clear.cpp | f4f4c40f4e88c7d4711c81cf76ffd190ad29dd10 | [] | no_license | LeeJiu/portfolio | 981917167df32eed42acff96ca34ee21f1641a15 | 97b199cdf08956cd3e1eeba32b601f08522615b0 | refs/heads/master | 2021-01-21T04:31:30.470941 | 2018-09-21T02:37:41 | 2018-09-21T02:37:41 | 55,908,160 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 1,138 | cpp | #include "stdafx.h"
#include "clear.h"
clear::clear()
{
}
clear::~clear()
{
}
HRESULT clear::init()
{
_sourX = _sourY = _count = 0;
IMAGEMANAGER->addImage("clear", "image/background/clear.bmp", WINSIZEX, WINSIZEY, false, false);
_start = false;
return S_OK;
}
void clear::release()
{
SOUNDMANAGER->stop("clear");
}
void clear::update()
{
if (!_start)
{
SOUNDMANAGER->play("clear", 0.7f);
_start = true;
}
//스파클 이펙트 터트리자
_count++;
if (_count % 40 == 0)
{
EFFECTMANAGER->play("sparkle1", RND->getFromIntTo(0, WINSIZEX), RND->getFromIntTo(0, WINSIZEY));
EFFECTMANAGER->play("sparkle2", RND->getFromIntTo(0, WINSIZEX), RND->getFromIntTo(0, WINSIZEY));
EFFECTMANAGER->play("sparkle3", RND->getFromIntTo(0, WINSIZEX), RND->getFromIntTo(0, WINSIZEY));
}
if (_count % 50 == 0)
{
EFFECTMANAGER->play("wind", RND->getFromIntTo(0, WINSIZEX), RND->getFromIntTo(0, WINSIZEY));
}
EFFECTMANAGER->update();
if (KEYMANAGER->isOnceKeyDown(VK_RETURN))
{
SCENEMANAGER->changeScene("title");
}
}
void clear::render()
{
IMAGEMANAGER->render("clear", getMemDC());
EFFECTMANAGER->render();
}
| [
"leeji0408@skhu.kr"
] | leeji0408@skhu.kr |
ab866af63d36f3f7a9705cbee76b31668015bb73 | 03916ad00bf2ab56e7d3c5ea80ab900abea040c8 | /Common_3/ThirdParty/OpenSource/gainput/lib/source/gainput/mouse/GainputInputDeviceMouseLinux.h | addfaf9109bd0c61ae2600e6b5cfde35334a6ecb | [
"MIT",
"Apache-2.0"
] | permissive | erwincoumans/The-Forge | 3bab94e8649d0fe070e2d5ae7ccf1484c23f44a2 | d0b3ed153f5b740e9cbebc118eff232f71728f2b | refs/heads/master | 2021-05-10T15:28:31.608416 | 2018-09-07T21:12:04 | 2018-09-07T21:12:04 | 118,551,189 | 1 | 0 | null | 2018-01-23T03:16:46 | 2018-01-23T03:16:46 | null | UTF-8 | C++ | false | false | 2,945 | h |
#ifndef GAINPUTINPUTDEVICEMOUSELINUX_H_
#define GAINPUTINPUTDEVICEMOUSELINUX_H_
#include <X11/Xlib.h>
#include "GainputInputDeviceMouseImpl.h"
#include "../../../include/gainput/GainputHelpers.h"
namespace gainput
{
class InputDeviceMouseImplLinux : public InputDeviceMouseImpl
{
public:
InputDeviceMouseImplLinux(InputManager& manager, InputDevice& device, InputState& state, InputState& previousState) :
manager_(manager),
device_(device),
state_(&state),
previousState_(&previousState),
nextState_(manager.GetAllocator(), MouseButtonCount + MouseAxisCount),
delta_(0)
{
const size_t size = sizeof(bool)*MouseButtonCount;
isWheel_ = static_cast<bool*>(manager_.GetAllocator().Allocate(size));
GAINPUT_ASSERT(isWheel_);
memset(isWheel_, 0, size);
pressedThisFrame_ = static_cast<bool*>(manager_.GetAllocator().Allocate(size));
GAINPUT_ASSERT(pressedThisFrame_);
}
~InputDeviceMouseImplLinux()
{
manager_.GetAllocator().Deallocate(isWheel_);
manager_.GetAllocator().Deallocate(pressedThisFrame_);
}
InputDevice::DeviceVariant GetVariant() const
{
return InputDevice::DV_STANDARD;
}
void Update(InputDeltaState* delta)
{
delta_ = delta;
// Reset mouse wheel buttons
for (unsigned i = 0; i < MouseButtonCount; ++i)
{
const DeviceButtonId buttonId = i;
const bool oldValue = previousState_->GetBool(buttonId);
if (isWheel_[i] && oldValue)
{
const bool pressed = false;
HandleButton(device_, nextState_, delta_, buttonId, pressed);
}
}
*state_ = nextState_;
memset(pressedThisFrame_, 0, sizeof(bool) * MouseButtonCount);
}
void HandleEvent(XEvent& event)
{
GAINPUT_ASSERT(state_);
GAINPUT_ASSERT(previousState_);
switch (event.type)
{
case MotionNotify:
{
const XMotionEvent& motionEvent = event.xmotion;
const float x = float(motionEvent.x);
const float y = float(motionEvent.y);
HandleAxis(device_, nextState_, delta_, MouseAxisX, x);
HandleAxis(device_, nextState_, delta_, MouseAxisY, y);
break;
}
case ButtonPress:
case ButtonRelease:
{
const XButtonEvent& buttonEvent = event.xbutton;
GAINPUT_ASSERT(buttonEvent.button > 0);
const DeviceButtonId buttonId = buttonEvent.button-1;
GAINPUT_ASSERT(buttonId <= MouseButtonMax);
const bool pressed = event.type == ButtonPress;
if (!pressed && pressedThisFrame_[buttonId])
{
// This is a mouse wheel button. Ignore release now, reset next frame.
isWheel_[buttonId] = true;
}
else if (buttonEvent.button < MouseButtonCount)
{
HandleButton(device_, nextState_, delta_, buttonId, pressed);
}
if (pressed)
{
pressedThisFrame_[buttonId] = true;
}
break;
}
}
}
private:
InputManager& manager_;
InputDevice& device_;
bool* isWheel_;
bool* pressedThisFrame_;
InputState* state_;
InputState* previousState_;
InputState nextState_;
InputDeltaState* delta_;
};
}
#endif
| [
"jenkins@conffx.com"
] | jenkins@conffx.com |
d5184cd976f3c3d743e4d123f39d44aae2e3e488 | 5072f634b0a29f3f0bcf349d55a6a58d92231068 | /Server/GameServer.cpp | 5b325c54084731f7d66221a3e39f67e9c950326b | [] | no_license | Hibchibbler/TankGame | c3ba69f22f103a158abe6983ad5c48f0185c7cbd | acc1f67a99b4741985b4ecd1f550e015494f1959 | refs/heads/master | 2020-07-21T21:51:33.743666 | 2013-09-15T18:40:40 | 2013-09-15T18:40:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,596 | cpp | #include "GameServer.h"
#include "Common\LogFile.h"
#include "Common\Comm.h"
#include "Common\TeamManager.h"
#include "Common\ArenaManager.h"
using namespace tg;
GameServer::GameServer()
: stageEst(*this),
stageRun(*this)
{
//For Server, we want the Establish stage first.
//
numConnects=0;
state = GameServerState::Establish;
curStage = NULL;
stageEst.setId(0);
stageRun.setId(1);
curStage = &stageEst;
}
GameServer::~GameServer()
{
doCleanup();
}
sf::Uint32 GameServer::doRemoteEvents()
{
if (curStage == NULL)
return 1;
CommEvent event;
while (server.Receive(event)){
sf::Uint32 t;
event.packet >> t;
switch (t){
case CommEventType::Acceptance:{
LogFile::get()->log(0,0,"Acceptance");
sf::Uint32 cid;
event.packet >> cid;
Player p;
p.connectionId = cid;
teamMan.addPlayer(p,"New Guy", 0);
numConnects++;
break;
}case CommEventType::Disconnect:{
LogFile::get()->log(0,0,"Disconnect");
sf::Uint32 cid;
event.packet >> cid;
//remove player from either team0/1/2
teamMan.removePlayer(cid);
std::cout << "Player " << cid << " Disconnected" << std::endl;
numConnects--;
if (numConnects==0)
{
curStage = &stageEst;
state = GameServerState::Establish;
}
break;
}case CommEventType::Error:
LogFile::get()->log(0,0,"Error");
break;
case CommEventType::Data:{
//LogFile::get()->log(0,0,"Data");
sf::Uint32 msgId;
sf::Uint32 connId;
//std::cout << "Got Data" << std::endl;
connId = event.connectionId;
event.packet >> msgId;
curStage->doRemoteEvent(*this, event, connId, msgId);
break;
}case CommEventType::Sent:{
break;
}
}
}
return 0;
}
sf::Uint32 GameServer::doLocalEvents()
{
if (curStage == NULL)
return 1;
sf::Event wevent;
while (window.pollEvent(wevent))
{
curStage->doWindowEvent(window, wevent);
}
curStage->doLocalInput(window, *this);
return 0;
}
sf::Uint32 GameServer::doInit()
{
arenaMan.load("Assets\\37x25.map");
assetMan.load();
teamMan.load();
stageEst.doInit(*this);
stageRun.doInit(*this);
server.StartServer(8280);
return 0;
}
sf::Uint32 GameServer::doLoop()
{
if (curStage != NULL)
{
sf::Uint32 summary = curStage->doLoop(*this);
//Id is set in GameServer constructor.
switch (curStage->getId()){
case 0://stageEst
switch (summary){
case 0x1:
state = GameServerState::Run;
std::cout << "Switching to StageRun" << std::endl;
curStage = &stageRun;
break;
}
break;
case 1://stageRun
break;
}
}
return 0;
}
sf::Uint32 GameServer::doCleanup()
{
LogFile::get()->log(0,0,"GameServer::doCleanup");
stageEst.doCleanup(*this);
stageRun.doCleanup(*this);
return 0;
}
TeamManager & GameServer::getTeamMan()
{
return teamMan;
}
Comm & GameServer::getComm()
{
return server;
}
| [
"danieljayferguson@gmail.com"
] | danieljayferguson@gmail.com |
9f0a5fba0037d16688a9c1d219394835f4f23dc8 | e8f93e23d077fbd2bae2f8b433764772217a06f9 | /src/profiling/CounterDirectory.cpp | a84897995d1ca0533f40a6c271ca519c6bb9d246 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | melodylail/armnn | deafd0fac80f5258299d0065267fc69bffadb9f6 | 10e0786f15bdb60e1d632c9a368fce2737852ae4 | refs/heads/master | 2020-07-27T20:48:30.045194 | 2019-09-16T15:30:59 | 2019-09-17T13:04:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,822 | cpp | //
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "CounterDirectory.hpp"
#include <armnn/Exceptions.hpp>
namespace armnn
{
namespace profiling
{
CounterDirectory::CounterDirectory(uint16_t uid,
const std::string& name,
uint16_t deviceCount,
uint16_t counterCount,
uint16_t categoryCount)
: m_Uid(uid)
, m_Name(name)
, m_DeviceCount(deviceCount)
, m_CounterCount(counterCount)
, m_CategoryCount(categoryCount)
, m_DeviceIds(deviceCount)
, m_CounterIds(counterCount)
, m_CategoryIds(categoryCount)
, m_DeviceObjects(deviceCount)
, m_CounterObjects(counterCount)
, m_CategoryObjects(categoryCount)
{}
// Helper methods
void CounterDirectory::CheckDeviceIndex(uint16_t index) const
{
if (index >= m_DeviceCount)
{
throw InvalidArgumentException("Invalid device index");
}
}
void CounterDirectory::CheckCounterIndex(uint16_t index) const
{
if (index >= m_CounterCount)
{
throw InvalidArgumentException("Invalid counter index");
}
}
void CounterDirectory::CheckCategoryIndex(uint16_t index) const
{
if (index >= m_CategoryCount)
{
throw InvalidArgumentException("Invalid category index");
}
}
// Getters for basic attributes
uint16_t CounterDirectory::GetUid() const
{
return m_Uid;
}
const std::string& CounterDirectory::GetName() const
{
return m_Name;
}
// Getters for counts
uint16_t CounterDirectory::GetDeviceCount() const
{
return m_DeviceCount;
}
uint16_t CounterDirectory::GetCounterCount() const
{
return m_CounterCount;
}
uint16_t CounterDirectory::GetCategoryCount() const
{
return m_CategoryCount;
}
// Getters and setters for devices
void CounterDirectory::GetDeviceValue(uint16_t index, uint32_t& value) const
{
CheckDeviceIndex(index);
value = m_DeviceIds[index].load();
}
void CounterDirectory::SetDeviceValue(uint16_t index, uint32_t value)
{
CheckDeviceIndex(index);
m_DeviceIds[index].store(value);
}
void CounterDirectory::GetDeviceObject(uint16_t index, Device* device) const
{
CheckDeviceIndex(index);
device = m_DeviceObjects[index].load();
}
void CounterDirectory::SetDeviceObject(uint16_t index, Device* device)
{
CheckDeviceIndex(index);
m_DeviceObjects[index].store(device);
}
// Getters and setters for counters
void CounterDirectory::GetCounterValue(uint16_t index, uint32_t& value) const
{
CheckCounterIndex(index);
value = m_CounterIds[index].load();
}
void CounterDirectory::SetCounterValue(uint16_t index, uint32_t value)
{
CheckCounterIndex(index);
m_CounterIds[index].store(value);
}
void CounterDirectory::GetCounterObject(uint16_t index, Counter* counter) const
{
CheckCounterIndex(index);
counter = m_CounterObjects[index].load();
}
void CounterDirectory::SetCounterObject(uint16_t index, Counter* counter)
{
CheckCounterIndex(index);
m_CounterObjects[index].store(counter);
}
// Getters and setters for categories
void CounterDirectory::GetCategoryValue(uint16_t index, uint32_t& value) const
{
CheckCategoryIndex(index);
value = m_CategoryIds[index].load();
}
void CounterDirectory::SetCategoryValue(uint16_t index, uint32_t value)
{
CheckCategoryIndex(index);
m_CategoryIds[index].store(value);
}
void CounterDirectory::GetCategoryObject(uint16_t index, Category* category) const
{
CheckCategoryIndex(index);
category = m_CategoryObjects[index].load();
}
void CounterDirectory::SetCategoryObject(uint16_t index, Category* category)
{
CheckCategoryIndex(index);
m_CategoryObjects[index].store(category);
}
} // namespace profiling
} // namespace armnn
| [
"Aron.Virginas-Tar@arm.com"
] | Aron.Virginas-Tar@arm.com |
834b5091ccebacc0b9c52a8e837f80f248bc042b | fc0664a076eeb69a3a8a89e7af25329c3998dd07 | /Core/STL/Types/RefCountedObject.h | 543113fd25549c52966f8610856ac4d8a8bc383a | [
"BSD-2-Clause"
] | permissive | azhirnov/ModularGraphicsFramework | fabece2887da16c8438748c9dd5f3091a180058d | 348be601f1991f102defa0c99250529f5e44c4d3 | refs/heads/master | 2021-07-14T06:31:31.127788 | 2018-11-19T14:28:16 | 2018-11-19T14:28:16 | 88,896,906 | 14 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,206 | h | // Copyright (c) Zhirnov Andrey. For more information see 'LICENSE.txt'
#pragma once
#include "Core/STL/Types/SharedPointer.h"
#include "Core/STL/Types/WeakPointer.h"
#include "Core/STL/Types/RefCounter.h"
#include "Core/STL/OS/OSLowLevel.h"
#include "Core/STL/Containers/Set.h"
namespace GX_STL
{
namespace GXTypes
{
# define SHARED_POINTER( _name_ ) using _name_##Ptr = ::GX_STL::GXTypes::SharedPointerType< _name_ >;
# define WEAK_POINTER( _name_ ) using _name_##WPtr = ::GX_STL::GXTypes::WeakPointerType< _name_ >;
//
// Reference Counted Debug Object
//
class DbgRefCountedObject : public CompileTime::TypeQualifier< CompileTime::ETypeQualifier::Def_Noncopyable >
{
protected:
DbgRefCountedObject ()
{
_DebugAddRef();
}
DbgRefCountedObject (DbgRefCountedObject &&) = delete;
DbgRefCountedObject (const DbgRefCountedObject &) = delete;
virtual ~DbgRefCountedObject ()
{
_DebugRemoveRef();
}
private:
forceinline void _DebugAddRef ()
{
DEBUG_ONLY(
SCOPELOCK( _GetMutex() );
_GetObjectRefs().Add( this );
)
}
forceinline void _DebugRemoveRef ()
{
DEBUG_ONLY(
SCOPELOCK( _GetMutex() );
usize idx;
if ( _GetObjectRefs().FindIndex( this, idx ) ) {
_GetObjectRefs().EraseByIndex( idx );
}
)
}
DEBUG_ONLY(
static Set< DbgRefCountedObject *>& _GetObjectRefs () noexcept
{
static Set< DbgRefCountedObject *> s_instance;
return s_instance;
}
static Mutex& _GetMutex () noexcept
{
static Mutex s_mutex;
return s_mutex;
})
public:
DEBUG_ONLY(
static void s_ChenckNotReleasedObjects (uint refValue = 0)
{
SCOPELOCK( _GetMutex() );
auto& objects = _GetObjectRefs();
if ( objects.Count() != refValue )
{
GX_BREAK_POINT();
}
})
};
//
// Reference Counted Object
//
template <typename CounterType = RefCounter2>
class RefCountedObject : public DbgRefCountedObject
{
friend class StaticRefCountedObject;
friend struct SharedPointerStrategy< RefCountedObject< CounterType > >;
friend struct WeakPointerStrategy< RefCountedObject< CounterType > >;
// types
protected:
using Self = RefCountedObject< CounterType >;
using RefCounter_t = CounterType;
// variables
private:
RefCounter_t _counter;
// methods
private:
void operator = (Self &&) = delete;
void operator = (const Self &) = delete;
forceinline RefCounter_t& _GetCounter () { return _counter; }
protected:
RefCountedObject ()
{}
explicit RefCountedObject (const Self &other) : _counter( other._counter )
{}
explicit RefCountedObject (Self &&other) : _counter( RVREF(other._counter) )
{}
virtual ~RefCountedObject ()
{}
virtual void _Release (INOUT RefCounter_t &) { delete this; }
};
template <>
struct SharedPointerStrategy< RefCountedObject< RefCounter > >
{
using T = RefCountedObject< RefCounter >;
forceinline static void IncRef (T *ptr) { ptr->_GetCounter().Inc(); }
forceinline static void DecRef (T *ptr) { if ( ptr->_GetCounter().DecAndTest() ) { ptr->_Release( INOUT ptr->_GetCounter() ); } }
forceinline static int Count (T *ptr) { return ptr->_GetCounter().Count(); }
};
template <>
struct SharedPointerStrategy< RefCountedObject< RefCounter2 > >
{
using T = RefCountedObject< RefCounter2 >;
forceinline static void IncRef (T *ptr) { ptr->_GetCounter().Inc(); }
forceinline static void DecRef (T *ptr) { if ( ptr->_GetCounter().DecAndTest() ) { RefCounter2 rc{ ptr->_GetCounter() }; ptr->_Release( INOUT ptr->_GetCounter() ); rc.DecWeak(); } }
forceinline static int Count (T *ptr) { return ptr->_GetCounter().Count(); }
};
template <>
struct WeakPointerStrategy< RefCountedObject< RefCounter2 > >
{
using T = RefCountedObject< RefCounter2 >;
using Counter_t = RefCounter2;
forceinline static Counter_t& Create (T *ptr) { return ptr->_GetCounter(); }
forceinline static void IncRef (Counter_t &rc) { rc.IncWeak(); }
forceinline static void DecRef (Counter_t &rc) { rc.DecWeak(); }
forceinline static int Count (Counter_t &rc) { return rc.CountWeak(); }
forceinline static bool IncShared (Counter_t &rc) { return rc.TryInc(); }
};
template <typename T>
using SharedPointerType = SharedPointer< T, RefCountedObject< RefCounter2 >, SharedPointerStrategy< RefCountedObject< RefCounter2 > > >;
template <typename T>
using WeakPointerType = WeakPointer< T, RefCountedObject< RefCounter2 >, WeakPointerStrategy< RefCountedObject< RefCounter2 > >, SharedPointerStrategy< RefCountedObject< RefCounter2 > > >;
template <typename R, typename T>
ND_ forceinline constexpr R Cast (const SharedPointerType<T> &value)
{
return Cast<R>( value.RawPtr() );
}
template <typename R, typename T>
ND_ forceinline constexpr R Cast (const WeakPointerType<T> &value)
{
return Cast<R>( value.Lock() );
}
template <typename R, typename T>
ND_ forceinline constexpr R DynCast (const SharedPointerType<T> &value)
{
return DynCast<R>( value.RawPtr() );
}
template <typename R, typename T>
ND_ forceinline constexpr R DynCast (const WeakPointerType<T> &value)
{
return DynCast<R>( value.Lock() );
}
} // GXTypes
} // GX_STL
| [
"zh1dron@gmail.com"
] | zh1dron@gmail.com |
eebf3e821dc65a3bce537f4a66398325d7162e5f | 51635684d03e47ebad12b8872ff469b83f36aa52 | /external/gcc-12.1.0/libstdc++-v3/testsuite/experimental/filesystem/path/construct/locale.cc | 10df147f68c981935f7bef82f20ddf20b28ebda1 | [
"LGPL-2.1-only",
"GPL-3.0-only",
"GCC-exception-3.1",
"GPL-2.0-only",
"LGPL-3.0-only",
"LGPL-2.0-or-later",
"Zlib",
"LicenseRef-scancode-public-domain"
] | permissive | zhmu/ananas | 8fb48ddfe3582f85ff39184fc7a3c58725fe731a | 30850c1639f03bccbfb2f2b03361792cc8fae52e | refs/heads/master | 2022-06-25T10:44:46.256604 | 2022-06-12T17:04:40 | 2022-06-12T17:04:40 | 30,108,381 | 59 | 8 | Zlib | 2021-09-26T17:30:30 | 2015-01-31T09:44:33 | C | UTF-8 | C++ | false | false | 2,130 | cc | // { dg-options "-DUSE_FILESYSTEM_TS -lstdc++fs" }
// { dg-do run { target c++11 } }
// { dg-require-filesystem-ts "" }
// Copyright (C) 2014-2022 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, 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 General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 8.4.1 path constructors [path.construct]
#include <experimental/filesystem>
#include <testsuite_hooks.h>
#include <testsuite_iterators.h>
using std::experimental::filesystem::path;
void
test01()
{
path p("/foo/bar", std::locale::classic());
VERIFY( p.string() == "/foo/bar" );
}
void
test02()
{
using __gnu_test::test_container;
using __gnu_test::input_iterator_wrapper;
// Test with input iterators and const value_types
const std::locale loc;
const std::string s = "foo/bar/";
const path p0(s);
test_container<char, input_iterator_wrapper>
r1((char*)s.c_str(), (char*)s.c_str() + s.size());
path p1(r1.begin(), r1.end(), loc);
VERIFY( p1 == p0 );
test_container<char, input_iterator_wrapper>
r2((char*)s.c_str(), (char*)s.c_str() + s.size() + 1); // includes null-terminator
path p2(r2.begin(), loc);
VERIFY( p2 == p0 );
test_container<const char, input_iterator_wrapper>
r3(s.c_str(), s.c_str() + s.size());
path p3(r3.begin(), r3.end(), loc);
VERIFY( p3 == p0 );
test_container<const char, input_iterator_wrapper>
r4(s.c_str(), s.c_str() + s.size() + 1); // includes null-terminator
path p4(r4.begin(), loc);
VERIFY( p4 == p0 );
}
int
main()
{
test01();
test02();
}
| [
"rink@rink.nu"
] | rink@rink.nu |
139316158d33557a5c527223e676a7d4382f72ad | 73ee941896043f9b3e2ab40028d24ddd202f695f | /external/chromium_org/ui/base/latency_info_unittest.cc | bb834787d306756287eab1cb8e35c9311c7a5cb0 | [
"BSD-3-Clause"
] | permissive | CyFI-Lab-Public/RetroScope | d441ea28b33aceeb9888c330a54b033cd7d48b05 | 276b5b03d63f49235db74f2c501057abb9e79d89 | refs/heads/master | 2022-04-08T23:11:44.482107 | 2016-09-22T20:15:43 | 2016-09-22T20:15:43 | 58,890,600 | 5 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 5,844 | cc | // Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/base/latency_info.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace ui {
TEST(LatencyInfoTest, AddTwoSeparateEvent) {
LatencyInfo info;
info.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_RWH_COMPONENT,
0,
1,
base::TimeTicks::FromInternalValue(100),
1);
info.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
1,
5,
base::TimeTicks::FromInternalValue(1000),
2);
EXPECT_EQ(info.latency_components.size(), 2u);
LatencyInfo::LatencyComponent component;
EXPECT_FALSE(
info.FindLatency(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, &component));
EXPECT_FALSE(
info.FindLatency(INPUT_EVENT_LATENCY_RWH_COMPONENT, 1, &component));
EXPECT_TRUE(
info.FindLatency(INPUT_EVENT_LATENCY_RWH_COMPONENT, 0, &component));
EXPECT_EQ(component.sequence_number, 1);
EXPECT_EQ(component.event_count, 1u);
EXPECT_EQ(component.event_time.ToInternalValue(), 100);
EXPECT_TRUE(
info.FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1, &component));
EXPECT_EQ(component.sequence_number, 5);
EXPECT_EQ(component.event_count, 2u);
EXPECT_EQ(component.event_time.ToInternalValue(), 1000);
}
TEST(LatencyInfoTest, AddTwoSameEvent) {
LatencyInfo info;
info.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_RWH_COMPONENT,
0,
30,
base::TimeTicks::FromInternalValue(100),
2);
info.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_RWH_COMPONENT,
0,
13,
base::TimeTicks::FromInternalValue(200),
3);
EXPECT_EQ(info.latency_components.size(), 1u);
LatencyInfo::LatencyComponent component;
EXPECT_FALSE(
info.FindLatency(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, &component));
EXPECT_FALSE(
info.FindLatency(INPUT_EVENT_LATENCY_RWH_COMPONENT, 1, &component));
EXPECT_TRUE(
info.FindLatency(INPUT_EVENT_LATENCY_RWH_COMPONENT, 0, &component));
EXPECT_EQ(component.sequence_number, 30);
EXPECT_EQ(component.event_count, 5u);
EXPECT_EQ(component.event_time.ToInternalValue(), (100 * 2 + 200 * 3) / 5);
}
TEST(LatencyInfoTest, MergeTwoSeparateEvent) {
LatencyInfo info1;
LatencyInfo info2;
info1.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_RWH_COMPONENT,
0,
1,
base::TimeTicks::FromInternalValue(100),
1);
info2.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
1,
5,
base::TimeTicks::FromInternalValue(1000),
2);
info1.MergeWith(info2);
EXPECT_EQ(info1.latency_components.size(), 2u);
LatencyInfo::LatencyComponent component;
EXPECT_FALSE(
info1.FindLatency(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, &component));
EXPECT_FALSE(
info1.FindLatency(INPUT_EVENT_LATENCY_RWH_COMPONENT, 1, &component));
EXPECT_TRUE(
info1.FindLatency(INPUT_EVENT_LATENCY_RWH_COMPONENT, 0, &component));
EXPECT_EQ(component.sequence_number, 1);
EXPECT_EQ(component.event_count, 1u);
EXPECT_EQ(component.event_time.ToInternalValue(), 100);
EXPECT_TRUE(
info1.FindLatency(INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 1, &component));
EXPECT_EQ(component.sequence_number, 5);
EXPECT_EQ(component.event_count, 2u);
EXPECT_EQ(component.event_time.ToInternalValue(), 1000);
}
TEST(LatencyInfoTest, MergeTwoSameEvent) {
LatencyInfo info1;
LatencyInfo info2;
info1.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_RWH_COMPONENT,
0,
30,
base::TimeTicks::FromInternalValue(100),
2);
info2.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_RWH_COMPONENT,
0,
13,
base::TimeTicks::FromInternalValue(200),
3);
info1.MergeWith(info2);
EXPECT_EQ(info1.latency_components.size(), 1u);
LatencyInfo::LatencyComponent component;
EXPECT_FALSE(
info1.FindLatency(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, &component));
EXPECT_FALSE(
info1.FindLatency(INPUT_EVENT_LATENCY_RWH_COMPONENT, 1, &component));
EXPECT_TRUE(
info1.FindLatency(INPUT_EVENT_LATENCY_RWH_COMPONENT, 0, &component));
EXPECT_EQ(component.sequence_number, 30);
EXPECT_EQ(component.event_count, 5u);
EXPECT_EQ(component.event_time.ToInternalValue(), (100 * 2 + 200 * 3) / 5);
}
TEST(LatencyInfoTest, ClearEvents) {
LatencyInfo info;
info.AddLatencyNumberWithTimestamp(INPUT_EVENT_LATENCY_RWH_COMPONENT,
0,
30,
base::TimeTicks::FromInternalValue(100),
2);
EXPECT_EQ(info.latency_components.size(), 1u);
info.Clear();
EXPECT_EQ(info.latency_components.size(), 0u);
}
} // namespace ui
| [
"ProjectRetroScope@gmail.com"
] | ProjectRetroScope@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.